Commit 364ad3591360a27a13164be95fd3ac8b1c511928
1 parent
e753b17d4f
Exists in
master
and in
1 other branch
bug
xiufu
Showing 4 changed files with 52 additions and 5 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
- platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
View file @
364ad35
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
364ad35
... | ... | @@ -335,5 +335,21 @@ |
335 | 335 | </if> |
336 | 336 | ) a |
337 | 337 | </select> |
338 | + | |
339 | + <select id="doHospitalFilter" parameterType="map" resultType="string"> | |
340 | + select id from organization where id in | |
341 | + <foreach collection="hospitalId" open="(" close=")" separator="," item="hid"> | |
342 | + #{hid} | |
343 | + </foreach> | |
344 | + <if test="provinceId != null and provinceId != ''"> | |
345 | + and province_id = #{provinceId} | |
346 | + </if> | |
347 | + <if test="cityId != null and cityId != '' "> | |
348 | + and city_id = #{cityId} | |
349 | + </if> | |
350 | + <if test="areaId != null and areaId != ''"> | |
351 | + and area_id = #{areaId} | |
352 | + </if> | |
353 | + </select> | |
338 | 354 | </mapper> |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
364ad35
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | import com.lyms.platform.common.base.BaseController; |
5 | 5 | import com.lyms.platform.common.base.LoginContext; |
6 | 6 | import com.lyms.platform.common.result.BaseObjectResponse; |
7 | +import com.lyms.platform.common.utils.DateUtil; | |
7 | 8 | import com.lyms.platform.operate.web.service.IReportService; |
8 | 9 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
9 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -208,7 +209,7 @@ |
208 | 209 | public BaseObjectResponse coupon(HttpServletRequest request, Date startDate, Date endDate, |
209 | 210 | String provinceId, String cityId, String areaId, String hospitalId, String tempId, String couponType) { |
210 | 211 | Map<String, Object> param = CollectionUtils.createMap("userId", getUserId(request), "startDate", startDate, |
211 | - "endDate", endDate, "hospitalId", hospitalId, "provinceId", provinceId, "cityId", cityId, "areaId", | |
212 | + "endDate", DateUtil.addDay(endDate, 1), "hospitalId", hospitalId, "provinceId", provinceId, "cityId", cityId, "areaId", | |
212 | 213 | areaId, "tempId", tempId, "couponType", couponType); |
213 | 214 | return reportService.coupon(param); |
214 | 215 | } |
... | ... | @@ -234,7 +235,7 @@ |
234 | 235 | String provinceId, String cityId, String areaId, String hospitalId, String tempId, String couponType, |
235 | 236 | Integer page, Integer limit) { |
236 | 237 | Map<String, Object> param = CollectionUtils.createMap("userId", getUserId(request), "startDate", startDate, |
237 | - "endDate", endDate, "hospitalId", CollectionUtils.asList(hospitalId), "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "type", type, | |
238 | + "endDate", DateUtil.addDay(endDate, 1), "hospitalId", CollectionUtils.asList(hospitalId), "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "type", type, | |
238 | 239 | "tempId", tempId, "couponType", CollectionUtils.asList(couponType), "currentPage", page, "pageSize", limit); |
239 | 240 | return reportService.couponInfo(param); |
240 | 241 | } |
... | ... | @@ -261,7 +262,7 @@ |
261 | 262 | String provinceId, String cityId, String areaId, String hospitalId, String tempId, String couponType, |
262 | 263 | Integer page, Integer limit) { |
263 | 264 | Map<String, Object> param = CollectionUtils.createMap("userId", getUserId(request), "startDate", startDate, |
264 | - "endDate", endDate, "hospitalId", hospitalId, "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "type", type, | |
265 | + "endDate", DateUtil.addDay(endDate, 1), "hospitalId", hospitalId, "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "type", type, | |
265 | 266 | "tempId", tempId, "couponType", CollectionUtils.asList(couponType), "currentPage", page, "pageSize", limit); |
266 | 267 | /*Map<String, Object> param = CollectionUtils.createMap("userId", "1000000185", "hospitalId", CollectionUtils.asList("216"), "type", type, |
267 | 268 | "tempId", tempId, "couponType", CollectionUtils.asList("1,2,3,4,5,6,7,8"), "currentPage", page, "pageSize", limit);*/ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
364ad35
... | ... | @@ -443,6 +443,9 @@ |
443 | 443 | } else { |
444 | 444 | param.put("hospitalId", CollectionUtils.asList((String) param.get("hospitalId"))); |
445 | 445 | } |
446 | + | |
447 | + doHospitalFilter(param); | |
448 | + | |
446 | 449 | param.put("status", 2); |
447 | 450 | param.put("couponType", CollectionUtils.asList((String) param.get("couponType"))); |
448 | 451 | |
... | ... | @@ -462,8 +465,6 @@ |
462 | 465 | map.put("area_name", areaName); |
463 | 466 | xAxis.add(areaName); |
464 | 467 | } |
465 | - } else{ | |
466 | -// return RespBuilder.buildErro(ResponseCode.DATA_ERROR); | |
467 | 468 | } |
468 | 469 | } |
469 | 470 | |
470 | 471 | |
... | ... | @@ -474,10 +475,36 @@ |
474 | 475 | reportModel.doMerge(); |
475 | 476 | |
476 | 477 | Map<String, Object> titleMap = parseTitle(couponReport); |
478 | + transNullToZero(couponReport, titleMap); | |
479 | + | |
477 | 480 | |
478 | 481 | return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", titleMap, "reportModel", reportModel); |
479 | 482 | } |
480 | 483 | |
484 | + private void transNullToZero(List<Map<String, Object>> couponReport, Map<String, Object> titleMap) { | |
485 | + if(org.apache.commons.collections.CollectionUtils.isNotEmpty(couponReport) | |
486 | + && org.apache.commons.collections.MapUtils.isNotEmpty(titleMap)) | |
487 | + for (Map<String, Object> coupon : couponReport) { | |
488 | + Set<String> set = titleMap.keySet(); | |
489 | + for (String s : set) { | |
490 | + if(coupon.get(s) == null) { | |
491 | + coupon.put(s, 0); | |
492 | + } | |
493 | + } | |
494 | + } | |
495 | + } | |
496 | + | |
497 | + | |
498 | + | |
499 | + /** | |
500 | + * 根据省市区县过滤医院 | |
501 | + * @param param | |
502 | + */ | |
503 | + private void doHospitalFilter(Map<String, Object> param) { | |
504 | + List<String> hospitalIds = couponMapper.doHospitalFilter(param); | |
505 | + param.put("hospitalId", hospitalIds); | |
506 | + } | |
507 | + | |
481 | 508 | private Map<String,Object> parseTitle(List<Map<String, Object>> couponReport) { |
482 | 509 | Map<String, Object> titleMap = new HashMap<>(); |
483 | 510 | for (Map<String, Object> map : couponReport) { |
... | ... | @@ -520,6 +547,7 @@ |
520 | 547 | param.put("hospitalIds", CollectionUtils.asList((String) param.get("hospitalId"))); |
521 | 548 | } |
522 | 549 | |
550 | + doHospitalFilter(param); | |
523 | 551 | |
524 | 552 | String couponType = (String) param.get("couponType"); |
525 | 553 | List<CouponEnums> enmus = new ArrayList<>(); |
... | ... | @@ -539,6 +567,7 @@ |
539 | 567 | if(StringUtils.isEmpty(param.get("hospitalId") + "")) { |
540 | 568 | param.put("hospitalId", accessPermissionFacade.getCurrentUserHospPermissions(Integer.parseInt(param.get("userId") + ""))); /** 根据登陆人id 查询出来的医院 */ |
541 | 569 | } |
570 | + doHospitalFilter(param); | |
542 | 571 | List<Map<String, Object>> couponInfos = couponMapper.findCouponInfo(param); |
543 | 572 | for (Map<String, Object> couponInfo : couponInfos) { |
544 | 573 | String desc = (String) couponReportMap.get(couponInfo.get("type") + "_" + couponInfo.get("coupon_order")); |