Commit fa3d96cada9ea0fd3c29c2994dc93a8082dbd66f
1 parent
7c8796791a
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 22 additions and 18 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
fa3d96c
| ... | ... | @@ -3135,6 +3135,26 @@ |
| 3135 | 3135 | // List<Map<String, Object>> couponInfos = couponMapper.couponInfo(param); |
| 3136 | 3136 | List<Map<String, Object>> couponInfos = couponMapper.couponInfo2(param); |
| 3137 | 3137 | |
| 3138 | + //秦皇岛年龄筛选 <35 岁(大于等于35需要移除,这里需要重新组装数据) | |
| 3139 | + List<Map<String, Object>> couponInfo2=new ArrayList<>(); | |
| 3140 | + if(null!=param.get("age")) { | |
| 3141 | + param.put("needPage", false); | |
| 3142 | + couponInfo2=couponMapper.couponInfo2(param); | |
| 3143 | + Iterator<Map<String, Object>> iterator = couponInfo2.iterator(); | |
| 3144 | + while (iterator .hasNext()) { | |
| 3145 | + Map<String, Object> map= iterator.next(); | |
| 3146 | + if(MapUtils.isNotEmpty(map) && null!=map.get("used_id")) { | |
| 3147 | + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("id").is(map.get("used_id").toString())), Patients.class); | |
| 3148 | + if (null != patients) { | |
| 3149 | + Integer age = DateUtil.getAge(patients.getBirth()); | |
| 3150 | + if (age >= 35) { | |
| 3151 | + iterator.remove(); | |
| 3152 | + } | |
| 3153 | + } | |
| 3154 | + } | |
| 3155 | + } | |
| 3156 | + couponInfos = CollectionUtils.getPageIds(couponInfo2, (Integer) param.get("currentPage"), (Integer) param.get("pageSize")); | |
| 3157 | + } | |
| 3138 | 3158 | String subTitle = null; |
| 3139 | 3159 | Set<String> subTitleTempSet = new HashSet<>(); |
| 3140 | 3160 | |
| 3141 | 3161 | |
| 3142 | 3162 | |
| ... | ... | @@ -3166,26 +3186,10 @@ |
| 3166 | 3186 | } |
| 3167 | 3187 | // int count = couponMapper.findCouponInfoCount(param); |
| 3168 | 3188 | int count = couponMapper.findCouponInfoCount2(param); |
| 3169 | - //秦皇岛年龄筛选 <35 岁(大于等于35需要移除,count,需要减1) | |
| 3189 | + //秦皇岛年龄筛选 <35 岁 (筛选后的总数) | |
| 3170 | 3190 | if(null!=param.get("age")) { |
| 3171 | - Iterator<Map<String, Object>> iterator = couponInfos.iterator(); | |
| 3172 | - while (iterator .hasNext()) { | |
| 3173 | - Map<String, Object> map= iterator.next(); | |
| 3174 | - if(MapUtils.isNotEmpty(map) && null!=map.get("used_id")) { | |
| 3175 | - Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("id").is(map.get("used_id").toString())), Patients.class); | |
| 3176 | - if (null != patients) { | |
| 3177 | - Integer age = DateUtil.getAge(patients.getBirth()); | |
| 3178 | - if (age >= 35) { | |
| 3179 | - iterator.remove(); | |
| 3180 | - if(0!=count){ | |
| 3181 | - count--; | |
| 3182 | - } | |
| 3183 | - } | |
| 3184 | - } | |
| 3185 | - } | |
| 3186 | - } | |
| 3191 | + count=couponInfo2.size(); | |
| 3187 | 3192 | } |
| 3188 | - | |
| 3189 | 3193 | PageResult pageResult = new PageResult(count, currentPage, (Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", couponInfos, "subTitle", subTitle)); |
| 3190 | 3194 | return RespBuilder.buildSuccess(pageResult); |
| 3191 | 3195 | } |