TaskPatientDetailController.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.yihu.jw.controller;/**
  2. * Created by nature of king on 2018/6/11.
  3. */
  4. import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
  5. import com.yihu.jw.restmodel.common.Envelop;
  6. import com.yihu.jw.restmodel.common.EnvelopRestController;
  7. import com.yihu.jw.rm.health.bank.HealthBankMapping;
  8. import com.yihu.jw.service.TaskPatientDtailService;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import io.swagger.annotations.ApiParam;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.cloud.sleuth.Tracer;
  14. import org.springframework.web.bind.annotation.PostMapping;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RequestParam;
  17. import org.springframework.web.bind.annotation.RestController;
  18. /**
  19. * @author wangzhinan
  20. * @create 2018-06-11 10:37
  21. * @desc 活动参与表
  22. **/
  23. @RestController
  24. @RequestMapping(HealthBankMapping.api_health_bank_common)
  25. @Api(tags = "健康任务参与详情",description = "健康任务参与详情")
  26. public class TaskPatientDetailController extends EnvelopRestController {
  27. @Autowired
  28. private TaskPatientDtailService service;
  29. @Autowired
  30. private Tracer tracer;
  31. /**
  32. * 参与活动
  33. *
  34. * @param taskPatientDetail 参与活动详情对象
  35. * @return
  36. */
  37. @PostMapping(value = HealthBankMapping.healthBank.attendTask)
  38. @ApiOperation(value = "参与活动")
  39. public Envelop<Boolean> insert(@ApiParam(name = "taskPatientDetail",value = "参与活动JSON")
  40. @RequestParam(value = "taskPatientDetail",required = true)String taskPatientDetail){
  41. try {
  42. TaskPatientDetailDO taskPatientDetailDO = toEntity(taskPatientDetail, TaskPatientDetailDO.class);
  43. return service.insert(taskPatientDetailDO);
  44. }catch (Exception e){
  45. e.printStackTrace();
  46. tracer.getCurrentSpan().logEvent(e.getMessage());
  47. return Envelop.getError(e.getMessage());
  48. }
  49. }
  50. }