| 
					
				 | 
			
			
				@ -3,21 +3,21 @@ package com.yihu.jw.controller;/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.health.bank.ActivityDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.MixEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.ObjEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.PageEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.health.bank.HealthBankMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.service.ActivityService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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 org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -183,7 +183,7 @@ public class ActivityController extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop<ActivityDO> editActivity( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "id", value = "活动id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "id", required = true) String id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "type", value = "操作类型:上线:0,下线:2,推荐:3") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "type", value = "操作类型:上线:0,下线:2,推荐:3,取消推荐:4") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "type", required = true) String type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ActivityDO activityDO=service.editActivity(id, type); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -203,11 +203,11 @@ public class ActivityController extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = HealthBankMapping.healthBank.findActivityById) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "根据id获取活动详情+活动规则") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop<ActivityDO> findActivityById( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop<JSONObject> findActivityById( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "id", value = "活动id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "id", required = true) String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ActivityDO activityDO=service.findActivityById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject activityDO=service.findActivityById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return  ObjEnvelop.getSuccess("获取成功!",activityDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -216,6 +216,55 @@ public class ActivityController extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostMapping(value = HealthBankMapping.healthBank.pageActivity) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "分页查询活动") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop<ActivityDO> pageActivity(@ApiParam(name = "status", value = "活动状态:1上线,2下线") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @RequestParam(value = "status", required = false) String status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @ApiParam(name = "crowdType", value = "人群类型:1:签约居民、2平台用户") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @RequestParam(value = "crowdType", required = false) String crowdType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @ApiParam(name = "releaseTime", value = "上线时间") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @RequestParam(value = "releaseTime", required = false) String releaseTime, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @ApiParam(name = "activityOfflineTime", value = "下线时间") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @RequestParam(value = "activityOfflineTime", required = false) String activityOfflineTime, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @ApiParam(name = "filter", value = "活动名、发布机构、面向范围名称") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @RequestParam(value = "filter", required = false) String filter, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @ApiParam(name = "page", value = "第几页,从1开始") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @RequestParam(value = "page", defaultValue = "1", required = false) Integer page, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @ApiParam(name = "size", defaultValue = "10", value = ",每页分页大小") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                               @RequestParam(value = "size", required = false) Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            StringBuffer stringBuffer=new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotEmpty(filter)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                stringBuffer.append("title?").append(filter).append(" g1;").append("organizer?").append(filter).append(" g1;").append("areaName?").append(filter).append(" g1;"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                stringBuffer.append(filter).append("delFlag=1;"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                stringBuffer.append("delFlag=1;"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null != status && "2".equals(status) ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                stringBuffer.append("status=2;"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                stringBuffer.append("status<2;"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(null!=crowdType&&StringUtils.isNotBlank(crowdType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                stringBuffer.append("crowdType="+crowdType+";"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(releaseTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                stringBuffer.append("releaseTime="+releaseTime+";"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(activityOfflineTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                stringBuffer.append("activityOfflineTime="+activityOfflineTime+";"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sorts="-createTime"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<ActivityDO> activityDOList = service.search("", stringBuffer.toString(), sorts, page, size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int count = (int) service.getCount(filter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return success(activityDOList, count, page, size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tracer.getCurrentSpan().logEvent(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return PageEnvelop.getError("获取失败"+e.getMessage(),-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |