ActivityRuleController.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package com.yihu.jw.controller;/**
  2. * Created by nature of king on 2018/4/27.
  3. */
  4. import com.alibaba.fastjson.JSONArray;
  5. import com.yihu.jw.entity.health.bank.ActivityDO;
  6. import com.yihu.jw.entity.health.bank.ActivityRuleDO;
  7. import com.yihu.jw.restmodel.web.MixEnvelop;
  8. import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
  9. import com.yihu.jw.rm.health.bank.HealthBankMapping;
  10. import com.yihu.jw.service.ActivityRuleService;
  11. import com.yihu.jw.service.ActivityService;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import io.swagger.annotations.ApiParam;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.cloud.sleuth.Tracer;
  17. import org.springframework.web.bind.annotation.PostMapping;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RequestParam;
  20. import org.springframework.web.bind.annotation.RestController;
  21. import java.util.ArrayList;
  22. import java.util.List;
  23. /**
  24. * @author wangzhinan
  25. * @create 2018-04-27 14:14
  26. * @desc 健康活动
  27. **/
  28. @RestController
  29. @RequestMapping(HealthBankMapping.api_health_bank_common)
  30. @Api(tags = "健康活动规则相关操作",description = "健康活动规则相关操作")
  31. public class ActivityRuleController extends EnvelopRestEndpoint {
  32. @Autowired
  33. private ActivityRuleService ruleservice;
  34. @Autowired
  35. private Tracer tracer;
  36. /**
  37. * publish activity
  38. *
  39. * @param activityId
  40. * @return
  41. */
  42. @PostMapping(value = HealthBankMapping.healthBank.selectByActivityRule)
  43. @ApiOperation(value = "获取规则")
  44. public MixEnvelop<ActivityRuleDO, ActivityRuleDO> publishActivity(@ApiParam(name = "activityId",value = "活动id")
  45. @RequestParam(value = "activityId",required = true)String activityId){
  46. try {
  47. return ruleservice.selectByActivityId(activityId);
  48. }catch (Exception e){
  49. e.printStackTrace();
  50. tracer.getCurrentSpan().logEvent(e.getMessage());
  51. return MixEnvelop.getError(e.getMessage());
  52. }
  53. }
  54. }