Commit 1f81266c407d146a936fe73fb72ba38b82a66968

Authored by litao@lymsh.com
1 parent 89d693a287

改bug

Showing 1 changed file with 16 additions and 9 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 1f81266
... ... @@ -905,18 +905,25 @@
905 905  
906 906 for (Map<String, Object> map : couponReport) {
907 907 List<String> sendUserIds = (List<String>) map.get("sendUserIds");
  908 + if(CollectionUtils.isNotEmpty(sendUserIds)) {
  909 + int addSendcount = couponMapper.findMulitPatientCount(sendUserIds); /** 查询需要添加人数的总数, 例如A发了两次优惠券 那么这里返回需要加的值为1 */
  910 + map.put("coupon_send_count", ((Long) map.get("coupon_send_count")) + addSendcount);
  911 + for (int i = 0; i < addSendcount; i++) {
  912 + sendUserIds.add(UUID.randomUUID().toString());
  913 + }
  914 + }
  915 +
908 916 List<String> usedUserIds = (List<String>) map.get("usedUserIds");
909   - int addSendcount = couponMapper.findMulitPatientCount(sendUserIds); /** 查询需要添加人数的总数, 例如A发了两次优惠券 那么这里返回需要加的值为1 */
  917 + if(CollectionUtils.isNotEmpty(usedUserIds)) {
910 918 int addUsedcount = couponMapper.findMulitPatientCount(usedUserIds); /** 查询需要添加人数的总数, 例如A发了两次优惠券 那么这里返回需要加的值为1 */
911   - map.put("coupon_send_count", ((Integer) map.get("coupon_send_count")) + addSendcount);
912   - map.put("coupon_used_count", ((Integer) map.get("coupon_used_count")) + addUsedcount);
913   -
914   - for (int i = 0; i < addSendcount; i++) {
915   - sendUserIds.add(UUID.randomUUID().toString());
  919 + map.put("coupon_used_count", (((Long) map.get("coupon_used_count")) + addUsedcount) );
  920 + for (int i = 0; i < addUsedcount; i++) {
  921 + usedUserIds.add(UUID.randomUUID().toString());
  922 + }
916 923 }
917   - for (int i = 0; i < addUsedcount; i++) {
918   - usedUserIds.add(UUID.randomUUID().toString());
919   - }
  924 +
  925 +
  926 +
920 927 }
921 928  
922 929 return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", couponReportMap, "reportModel", reportModal);