Commit 44509c6ecd325ccc14c7767e44d6fbda163e2381

Authored by litao
1 parent f52c077a44

优惠券统计详情bug修复

Showing 2 changed files with 21 additions and 14 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 44509c6
... ... @@ -683,23 +683,28 @@
683 683 @Override
684 684 public BaseObjectResponse couponInfo(Map<String, Object> param) {
685 685 PageUtil.setPageInfo(param);
686   - if(StringUtils.isEmpty(param.get("hospitalId") + "")) {
  686 + if(param.get("hospitalId") == null) {
687 687 param.put("hospitalId", accessPermissionFacade.getCurrentUserHospPermissions(Integer.parseInt(param.get("userId") + ""))); /** 根据登陆人id 查询出来的医院 */
688 688 }
689 689 doHospitalFilter(param);
  690 + if(param.get("hospitalId") == null) {
  691 + return RespBuilder.buildSuccess(new PageResult(0, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", new ArrayList<>())));
  692 + }
690 693 List<Map<String, Object>> couponInfos = couponMapper.findCouponInfo(param);
691   - for (Map<String, Object> couponInfo : couponInfos) {
692   - String desc = (String) couponReportMap.get(couponInfo.get("type") + "_" + couponInfo.get("coupon_order"));
693   - if(StringUtils.isNotBlank(desc)) {
694   - /** <div class='ag-double-line'>儿童保健券(五)<div>使用人次</div></div> */
695   - String s = desc.replace("使用人次", "")
696   - .replace("<div class='ag-double-line'>", "")
697   - .replace("<div>", "")
698   - .replace("</div>", "");
699   - couponInfo.put("type_desc", s);
700   - }
  694 + if(CollectionUtils.isNotEmpty(couponInfos)) {
  695 + for (Map<String, Object> couponInfo : couponInfos) {
  696 + String desc = (String) couponReportMap.get(couponInfo.get("type") + "_" + couponInfo.get("coupon_order"));
  697 + if(StringUtils.isNotBlank(desc)) {
  698 + /** <div class='ag-double-line'>儿童保健券(五)<div>使用人次</div></div> */
  699 + String s = desc.replace("使用人次", "")
  700 + .replace("<div class='ag-double-line'>", "")
  701 + .replace("<div>", "")
  702 + .replace("</div>", "");
  703 + couponInfo.put("type_desc", s);
  704 + }
701 705  
702   - setUsedInfo(couponInfo);
  706 + setUsedInfo(couponInfo);
  707 + }
703 708 }
704 709 int count = couponMapper.findCouponInfoCount(param);
705 710 PageResult pageResult = new PageResult(count, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", couponInfos));
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CollectionUtils.java View file @ 44509c6
... ... @@ -74,9 +74,11 @@
74 74 }
75 75  
76 76 public static <T> List<T> asList(String ids, Class<T> clazz) {
77   - Assert.notNull(ids);
78   - Assert.notNull(clazz);
  77 + if(StringUtils.isEmpty(ids)) {
  78 + return null;
  79 + }
79 80  
  81 + Assert.notNull(clazz);
80 82 List<T> list = new ArrayList<>();
81 83 String[] id = ids.split(",");
82 84 for (String s : id) {