Prechádzať zdrojové kódy

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 6 rokov pred
rodič
commit
69b1569c75

+ 22 - 37
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActivityController.java

@ -277,45 +277,30 @@ 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) {
    public PageEnvelop<ActivityDO> pageActivity(@ApiParam(name = "type", value = "活动类型")
                                                @RequestParam(value = "type", required = false) String type,
                                                @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();
            stringBuffer.append("delFlag=1;");
            if (StringUtils.isNotEmpty(filter)) {
                stringBuffer.append("title?").append(filter).append(" g1;").append("organizer?").append(filter).append(" g1;").append("areaName?").append(filter).append(" g1;");
            }
            if (null != status && "2".equals(status) ) {
                stringBuffer.append("status=-1,2;");
            } else if (null != status && "1".equals(status) ) {
                stringBuffer.append("status=0,1;");
            }
            if(null!=crowdType&&StringUtils.isNotBlank(crowdType)){
                stringBuffer.append("crowdType="+crowdType+";");
            }
            if(StringUtils.isNotBlank(releaseTime)){
                stringBuffer.append("activityOfflineTime>="+releaseTime+" 00:00:00;");
            }
            if(StringUtils.isNotBlank(activityOfflineTime)){
                stringBuffer.append("activityOfflineTime<="+ activityOfflineTime+" 59:59:59;");
            }
            String sorts="-createTime";
            List<ActivityDO> activityDOList = service.search("", stringBuffer.toString(), sorts, page, size);
            int count = (int) service.getCount(stringBuffer.toString());
            return success(activityDOList, count, page, size);
            JSONObject obj = service.ListActivityDO(type, status,crowdType,releaseTime,activityOfflineTime,filter,page,size);
//            int count = (int) service.getCount(stringBuffer.toString());
            List<ActivityDO> list=(List<ActivityDO>)obj.get("activityDOList");
            int count =obj.getInteger("count");
            return success(list, count, page, size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

+ 42 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java

@ -859,4 +859,46 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
        return object;
    }
    public JSONObject ListActivityDO(String type, String status,String crowdType,String releaseTime,String activityOfflineTime, String filter,Integer page,Integer size)throws ParseException {
        JSONObject obj=new JSONObject();
        StringBuffer stringBuffer=new StringBuffer();
        if (StringUtils.isNotEmpty(type)) {
            stringBuffer.append(" and type='").append(type).append("'");
        }
        if (StringUtils.isNotEmpty(filter)) {
            stringBuffer.append(" and (title like '%").append(filter).append("%' or ").append("organizer like '%").append(filter).append("%' or ").append("area_name like '%").append(filter).append("%')");
        }
        if (null != status && "2".equals(status) ) {
            stringBuffer.append(" and status in (-1,2) ");
        } else if (null != status && "1".equals(status) ) {
            stringBuffer.append(" and status in (0,1) ");
        }
        if(null!=crowdType&&StringUtils.isNotBlank(crowdType)){
            stringBuffer.append(" and crowd_type="+crowdType);
        }
        if(StringUtils.isNotBlank(releaseTime)){
            stringBuffer.append(" and activity_offline_time>='"+releaseTime+" 00:00:00' ");
        }
        if(StringUtils.isNotBlank(activityOfflineTime)){
            stringBuffer.append(" and activity_offline_time<='"+ activityOfflineTime+" 59:59:59' ");
        }
        stringBuffer.append(" order by create_time desc");
        String sql = "SELECT * FROM wlyy_health_bank.wlyy_health_bank_activity  WHERE 1=1 AND del_flag=1 "+stringBuffer.toString()+" LIMIT "+(page-1)*size+","+size;
        List<ActivityDO> activityDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class));
        String sqlcount = "SELECT COUNT(1)  AS total  FROM wlyy_health_bank.wlyy_health_bank_activity  WHERE 1=1 AND del_flag=1 "+stringBuffer.toString();
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        obj .put("activityDOList",activityDOList);
        obj .put("count",count);
        return obj;
    }
}