ActivityDetailController.java 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package com.yihu.jw.controller;/**
  2. * Created by nature of king on 2018/4/27.
  3. */
  4. import com.yihu.jw.restmodel.common.EnvelopRestController;
  5. import com.yihu.jw.rm.health.bank.HealthBankMapping;
  6. import com.yihu.jw.service.ActivityRuleService;
  7. import io.swagger.annotations.Api;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.cloud.sleuth.Tracer;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. /**
  13. * @author wangzhinan
  14. * @create 2018-04-27 15:24
  15. * @desc health activity info controller
  16. **/
  17. @RestController
  18. @RequestMapping(HealthBankMapping.api_health_bank_common)
  19. @Api(tags = "健康活动参与情况相关操作",description = "健康活动参与情况相关操作")
  20. public class ActivityDetailController extends EnvelopRestController {
  21. @Autowired
  22. private ActivityRuleService service;
  23. @Autowired
  24. private Tracer tracer;
  25. /*
  26. *//**
  27. * patient attend activity
  28. *
  29. * @param activityInfo
  30. * @return
  31. *//*
  32. @PostMapping(value = HealthBankMapping.healthBank.createActivityInfo)
  33. @ApiOperation(value = "参与活动")
  34. public Envelop<Boolean> attendActivity(@ApiParam(name = "activityInfo",value = "健康活动详情JSON")
  35. @RequestParam(value = "activityInfo",required = true)String activityInfo){
  36. try {
  37. ActivityRuleDO activityRuleDO = toEntity(activityInfo,ActivityRuleDO.class);
  38. return service.insert(activityRuleDO);
  39. }catch (Exception e){
  40. e.printStackTrace();
  41. tracer.getCurrentSpan().logEvent(e.getMessage());
  42. return Envelop.getError(e.getMessage());
  43. }
  44. }
  45. *//**
  46. * find health activity
  47. *
  48. * @param activityInfo
  49. * @param page
  50. * @param size
  51. * @return
  52. *//*
  53. @PostMapping(value = HealthBankMapping.healthBank.findActivityInfo)
  54. @ApiOperation(value = "查看健康活动")
  55. public Envelop<ActivityRuleDO> getActivityInfo(@ApiParam(name = "activityInfo",value = "健康活动JSON")
  56. @RequestParam(value = "activityInfo",required = false)String activityInfo,
  57. @ApiParam(name = "page", value = "第几页,从1开始")
  58. @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
  59. @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
  60. @RequestParam(value = "size", required = false)Integer size){
  61. try{
  62. ActivityRuleDO activityRuleDO = toEntity(activityInfo,ActivityRuleDO.class);
  63. return service.findByCondition(activityRuleDO,page,size);
  64. }catch (Exception e){
  65. e.printStackTrace();
  66. tracer.getCurrentSpan().logEvent(e.getMessage());
  67. return Envelop.getError(e.getMessage());
  68. }
  69. }
  70. *//**
  71. * patient update activity status
  72. *
  73. * @param activityInfo
  74. * @return
  75. *//*
  76. @PostMapping(value = HealthBankMapping.healthBank.updateActivityInfo)
  77. @ApiOperation(value = "更新活动状态")
  78. public Envelop<Boolean> updateActivity(@ApiParam(name = "activityInfo",value = "健康活动JSON")
  79. @RequestParam(value = "activityInfo",required = true)String activityInfo){
  80. try {
  81. ActivityRuleDO activityRuleDO = toEntity(activityInfo,ActivityRuleDO.class);
  82. return service.update(activityRuleDO);
  83. }catch (Exception e){
  84. e.printStackTrace();
  85. tracer.getCurrentSpan().logEvent(e.getMessage());
  86. return Envelop.getError(e.getMessage());
  87. }
  88. }*/
  89. }