Explorar o código

Merge branch 'online1'

周箭河 %!s(int64=4) %!d(string=hai) anos
pai
achega
950804d8f4

+ 18 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -516,7 +516,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         orderAmount = orderAmount.add(courseFee);
 
         BigDecimal remitFee = BigDecimal.ZERO;
-        BigDecimal courseRemitFee = BigDecimal.ZERO;
+        BigDecimal courseRemitFee = BigDecimal.ZERO; //课程减免费用
+        boolean remitCourseRFeeFlag = false; //减免课程费用标识
 
         //乐器及打包辅件
         List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
@@ -560,8 +561,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
                 });
 
-                Map<String, BigDecimal> coursePurchase = JSONObject.parseObject(goodsGroup.getCoursePurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
-                });
                 if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
                     String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
                     if (!groupType.containsKey(kitGroupPurchaseType)) {
@@ -569,17 +568,16 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     }
                     if (!kitGroupPurchaseType.equals("GROUP")) {
                         goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
+                    }else{
+                        remitCourseRFeeFlag  = goodsGroup.getGroupRemissionCourseFee().equals(1);
                     }
                     goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
                     remitFee = groupType.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : groupType.get(kitGroupPurchaseType);
-                    if (coursePurchase != null) {
-                        courseRemitFee = coursePurchase.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : coursePurchase.get(kitGroupPurchaseType);
-                    }
                 }
                 orderAmount = orderAmount.add(goodsGroup.getPrice());
                 goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
             }
-            orderAmount = orderAmount.subtract(remitFee).subtract(courseRemitFee);
+            orderAmount = orderAmount.subtract(remitFee);
         }
 
         //单独辅件
@@ -625,6 +623,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
             newCourses = musicGroupPaymentCalenderCourseSettingsDao.getCalenderCourseSettings(registerPayDto.getNewCourse());
             for (MusicGroupPaymentCalenderCourseSettings calenderCourseSetting : newCourses) {
+                if(remitCourseRFeeFlag && !calenderCourseSetting.getIsStudentOptional()){
+                    courseRemitFee = courseRemitFee.add(calenderCourseSetting.getCourseCurrentPrice());
+                    continue;
+                }
                 orderAmount = orderAmount.add(calenderCourseSetting.getCourseCurrentPrice());
             }
         }
@@ -734,7 +736,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         orderAmount = orderAmount.add(courseFee);
 
         BigDecimal remitFee = BigDecimal.ZERO;
-        BigDecimal courseRemitFee = BigDecimal.ZERO;
+        BigDecimal courseRemitFee = BigDecimal.ZERO; //课程减免费用
+        boolean remitCourseRFeeFlag = false; //减免课程费用标识
+
 
         //乐器及打包辅件
         List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
@@ -777,8 +781,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
                 });
-                Map<String, BigDecimal> coursePurchase = JSONObject.parseObject(goodsGroup.getCoursePurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
-                });
                 if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
                     String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
                     if (!groupType.containsKey(kitGroupPurchaseType)) {
@@ -786,12 +788,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     }
                     if (!kitGroupPurchaseType.equals("GROUP")) {
                         goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
+                    }else {
+                        remitCourseRFeeFlag = goodsGroup.getGroupRemissionCourseFee().equals(1);
                     }
                     goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
                     remitFee = groupType.get(kitGroupPurchaseType);
-                    if (coursePurchase != null) {
-                        courseRemitFee = coursePurchase.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : coursePurchase.get(kitGroupPurchaseType);
-                    }
                 }
                 orderAmount = orderAmount.add(goodsGroup.getPrice());
                 goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
@@ -842,6 +843,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
             newCourses = musicGroupPaymentCalenderCourseSettingsDao.getCalenderCourseSettings(registerPayDto.getNewCourse());
             for (MusicGroupPaymentCalenderCourseSettings calenderCourseSetting : newCourses) {
+                if(remitCourseRFeeFlag && !calenderCourseSetting.getIsStudentOptional()){
+                    courseRemitFee = courseRemitFee.add(calenderCourseSetting.getCourseCurrentPrice());
+                    continue;
+                }
                 orderAmount = orderAmount.add(calenderCourseSetting.getCourseCurrentPrice());
             }
         }