浏览代码

增加最大收款金额

周箭河 4 年之前
父节点
当前提交
55783dcb6f

+ 8 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -302,11 +302,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             if (chargeInfo.getOpenMaxTerm().equals(YesOrNoEnum.YES) && chargeInfo.getMaxAmount().compareTo(chargeInfo.getPaidAmount()) <= 0) {
                 throw new Exception("活动人数暂时已满,请稍后再试");
             }
-            chargeInfo.setPaidAmount(chargeInfo.getPaidAmount().add(chargeInfo.getAmount()));
-            chargeInfo.setUpdateTime(new Date());
-            int update = sporadicChargeInfoDao.update(chargeInfo);
-            if (update <= 0) {
-                throw new BizException("活动火爆,请稍后再试");
+            List<SporadicChargeInfo> activeInfos = sporadicChargeInfoDao.getOrganActiveInfo(chargeInfo.getOrganId(), 12);
+            for (SporadicChargeInfo activeInfo : activeInfos) {
+                activeInfo.setPaidAmount(activeInfo.getPaidAmount().add(chargeInfo.getAmount()));
+                activeInfo.setUpdateTime(new Date());
+                int update = sporadicChargeInfoDao.update(activeInfo);
+                if (update <= 0) {
+                    throw new BizException("活动火爆,请稍后再试");
+                }
             }
         }
 

+ 8 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SporadicChargeInfoImpl.java

@@ -149,11 +149,14 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
         }
         if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
             if (info.getMaxAmount() != null && info.getPaidAmount().compareTo(BigDecimal.ZERO) > 0) {
-                info.setPaidAmount(info.getPaidAmount().subtract(studentPaymentOrder.getActualAmount()));
-                info.setUpdateTime(new Date());
-                int update = sporadicChargeInfoDao.update(info);
-                if (update <= 0) {
-                    throw new BizException("已收金额更新失败,请重试");
+                List<SporadicChargeInfo> activeInfos = sporadicChargeInfoDao.getOrganActiveInfo(info.getOrganId(), 12);
+                for (SporadicChargeInfo activeInfo : activeInfos) {
+                    activeInfo.setPaidAmount(activeInfo.getPaidAmount().subtract(info.getAmount()));
+                    activeInfo.setUpdateTime(new Date());
+                    int update = sporadicChargeInfoDao.update(activeInfo);
+                    if (update <= 0) {
+                        throw new BizException("已收金额更新失败,请重试");
+                    }
                 }
             }
             if (info.getOrganId().equals(42) && info.getChargeType().equals(SporadicChargeTypeEnum.LEVEL)) {