package com.yihu.jw.controller;/** * Created by nature of king on 2018/4/27. */ import com.alibaba.fastjson.JSONArray; import com.yihu.jw.entity.health.bank.ActivityDO; import com.yihu.jw.entity.health.bank.ActivityRuleDO; import com.yihu.jw.restmodel.web.MixEnvelop; import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint; import com.yihu.jw.rm.health.bank.HealthBankMapping; import com.yihu.jw.service.ActivityRuleService; import com.yihu.jw.service.ActivityService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.sleuth.Tracer; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; /** * @author wangzhinan * @create 2018-04-27 14:14 * @desc 健康活动 **/ @RestController @RequestMapping(HealthBankMapping.api_health_bank_common) @Api(tags = "健康活动规则相关操作",description = "健康活动规则相关操作") public class ActivityRuleController extends EnvelopRestEndpoint { @Autowired private ActivityRuleService ruleservice; @Autowired private Tracer tracer; /** * publish activity * * @param activityId * @return */ @PostMapping(value = HealthBankMapping.healthBank.selectByActivityRule) @ApiOperation(value = "获取规则") public MixEnvelop publishActivity(@ApiParam(name = "activityId",value = "活动id") @RequestParam(value = "activityId",required = true)String activityId){ try { return ruleservice.selectByActivityId(activityId); }catch (Exception e){ e.printStackTrace(); tracer.getCurrentSpan().logEvent(e.getMessage()); return MixEnvelop.getError(e.getMessage()); } } }