Commit b78e61f8daa1fa4750fe2bd7be08c8e9ddd29046

Authored by litao@lymsh.com
1 parent a21885fadf

改bug

Showing 4 changed files with 57 additions and 5 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ b78e61f
... ... @@ -116,5 +116,7 @@
116 116 Integer findUnUsedPeopleInfoCount(Map<String, Object> param);
117 117  
118 118 List<Map<String, Object>> findMulitPatienInfo(List<String> sendUserIds);
  119 +
  120 + List<Map<String,Object>> findUserSendInfoByUids(Map<String, Object> uids);
119 121 }
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ b78e61f
... ... @@ -661,5 +661,20 @@
661 661 ) a group by a.ymd, a.user_id
662 662 ) a group by a.user_id
663 663 </select>
  664 +
  665 +
  666 + <select id="findUserSendInfoByUids" resultType="map" parameterType="map">
  667 + select distinct(a.create_hospital_id), a.user_id, DATE_FORMAT(a.create_date, '%Y-%m-%d') as create_date, d.name as send_hospital, e.name as doctoer_name
  668 + from coupon_info a, coupon_template b, coupon_type c, organization d, users e
  669 + where a.coupon_template_id = b.id and b.type_id = c.id and a.create_hospital_id = d.id and a.create_user_id = e.id
  670 + and a.create_hospital_id in
  671 + <foreach collection="hid" open="(" close=")" separator="," item="hid">
  672 + #{hid}
  673 + </foreach>
  674 + and a.user_id in
  675 + <foreach collection="uids" open="(" close=")" separator="," item="uid">
  676 + #{uid}
  677 + </foreach>
  678 + </select>
664 679 </mapper>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java View file @ b78e61f
... ... @@ -369,7 +369,7 @@
369 369 Integer page, Integer limit) {
370 370 Map<String, Object> param = CollectionUtils.createMap("userId", getUserId(request), "startDate", startDate,
371 371 "endDate", endDate != null ? DateUtil.addDay(endDate, 1) : endDate, "hospitalId", CollectionUtils.asList(hospitalId), "provinceId", provinceId, "cityId", cityId, "areaId", areaId, "type", type,
372   - "tempId", tempId, "couponType",couponType, "currentPage", page, "pageSize", limit);
  372 + "tempId", tempId, "couponType",couponType, "currentPage", page, "pageSize", limit, "currentPage2", page, "pageSize2", limit);
373 373 return reportService.couponInfo(param);
374 374 }
375 375  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ b78e61f
... ... @@ -831,11 +831,27 @@
831 831  
832 832 @Override
833 833 public BaseObjectResponse coupon(Map<String ,Object> param) {
  834 + if(param.get("hospitalId") instanceof ArrayList) {
  835 + List<String> hids = (List<String>) param.get("hospitalId");
  836 + if(CollectionUtils.isEmpty(hids)) {
  837 + param.put("hospitalId", accessPermissionFacade.getCurrentUserHospPermissions(Integer.parseInt(param.get("userId") + ""))); /** 模拟根据登陆人id 查询出来的医院 */
  838 + }
  839 + param.put("hospitalId", hids); /** 模拟根据登陆人id 查询出来的医院 */
  840 + } else {
  841 + if(StringUtils.isBlank((String) param.get("hospitalId"))) {
  842 + param.put("hospitalId", accessPermissionFacade.getCurrentUserHospPermissions(Integer.parseInt(param.get("userId") + ""))); /** 模拟根据登陆人id 查询出来的医院 */
  843 + } else {
  844 + param.put("hospitalId", CollectionUtils.asList((String) param.get("hospitalId")));
  845 + }
  846 + }
  847 +
  848 +
  849 +/*
834 850 if(StringUtils.isBlank((String) param.get("hospitalId"))) {
835   - param.put("hospitalId", accessPermissionFacade.getCurrentUserHospPermissions(Integer.parseInt(param.get("userId") + ""))); /** 模拟根据登陆人id 查询出来的医院 */
  851 + param.put("hospitalId", accessPermissionFacade.getCurrentUserHospPermissions(Integer.parseInt(param.get("userId") + ""))); *//** 模拟根据登陆人id 查询出来的医院 *//*
836 852 } else {
837 853 param.put("hospitalId", CollectionUtils.asList((String) param.get("hospitalId")));
838   - }
  854 + }*/
839 855 doHospitalFilter(param);
840 856  
841 857 List<Map<String, Object>> couponReport = new ArrayList<>();
... ... @@ -920,6 +936,7 @@
920 936 }
921 937 }
922 938 map.put("sendUserIds", sendUserIds2);
  939 + map.put("people_send_count", sendUserIds2.size());
923 940  
924 941 List<String> usedUserIds = (List<String>) map.get("usedUserIds");
925 942 List<String> usedUserIds2 = new ArrayList<>();
... ... @@ -936,6 +953,7 @@
936 953 }
937 954 }
938 955 map.put("usedUserIds", usedUserIds2);
  956 + map.put("user_used_count", usedUserIds2.size());
939 957 }
940 958  
941 959 return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", couponReportMap, "reportModel", reportModal);
... ... @@ -1287,8 +1305,25 @@
1287 1305 PageResult pageResult = new PageResult(count, currentPage,(Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", couponInfos, "subTitle", subTitle));
1288 1306 return RespBuilder.buildSuccess(pageResult);
1289 1307 } if(type == 1) { /** 发放人数统计 */
1290   - List<Map<String,Object>> userSendInfo = couponMapper.findUserSendInfo(param);
1291   - Integer count = couponMapper.findUserSendInfoCount(param);
  1308 +
  1309 +// List<Map<String,Object>> userSendInfo = couponMapper.findUserSendInfo(param);
  1310 + BaseObjectResponse tempResp = coupon(param);
  1311 + List<Map<String, Object>> couponReport = (List<Map<String, Object>>) ((Map<String, Object>) tempResp.getData()).get("couponReport");
  1312 + List<String> userIds = new ArrayList<>();
  1313 + for (Map<String, Object> map : couponReport) {
  1314 + List<String> list = (List<String>) map.get("sendUserIds");
  1315 + for (String s : list) {
  1316 + userIds.add(s.split("_")[0]);
  1317 + }
  1318 + }
  1319 + Integer count = userIds.size();
  1320 + List<String> ids = CollectionUtils.getPageIds(userIds, (Integer) param.get("currentPage2"), (Integer) param.get("pageSize2"));
  1321 + Map<String, Object> param2 = new HashMap<>();
  1322 + param2.put("hid", param.get("hospitalId"));
  1323 + param2.put("uids", ids);
  1324 + List<Map<String,Object>> userSendInfo = couponMapper.findUserSendInfoByUids(param2);
  1325 +
  1326 +// Integer count = couponMapper.findUserSendInfoCount(param);
1292 1327 for (Map<String, Object> map : userSendInfo) {
1293 1328 String userId = (String) map.get("user_id");
1294 1329 if(StringUtils.isNotEmpty(userId)) {