Переглянути джерело

update 乐器销售修改

周箭河 4 роки тому
батько
коміт
f0f0d6934d

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java

@@ -51,6 +51,9 @@ public class StudentPaymentOrderDetail {
 	//减免费用
 	private BigDecimal remitFee;
 
+	//学生乐器id
+	private Long studentInstrumentId;
+
 	@ApiModelProperty(value = "子商品列表",required = false)
 	private List<Goods> childGoodsList;
 
@@ -154,4 +157,12 @@ public class StudentPaymentOrderDetail {
 	public void setChildGoodsList(List<Goods> childGoodsList) {
 		this.childGoodsList = childGoodsList;
 	}
+
+	public Long getStudentInstrumentId() {
+		return studentInstrumentId;
+	}
+
+	public void setStudentInstrumentId(Long studentInstrumentId) {
+		this.studentInstrumentId = studentInstrumentId;
+	}
 }

+ 17 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -388,7 +388,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Override
     @Transactional(rollbackFor = Exception.class)
     public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel,
-                                        BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses,Boolean buyMaintenance) throws Exception {
+                                        BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses, Boolean buyMaintenance) throws Exception {
         Date date = new Date();
         StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
         studentPaymentOrder.setUserId(studentRegistration.getUserId());
@@ -412,6 +412,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
         studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
         //乐器及打包辅件
+        String maintenanceGoodsId = "";
         if (goodsGroups != null && goodsGroups.size() > 0) {
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
@@ -434,6 +435,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetail4goodsGroup.setPaymentOrderId(studentPaymentOrder.getId());
                 studentPaymentOrderDetail4goodsGroup.setKitGroupPurchaseType(goodsGroup.getKitGroupPurchaseType());
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goodsGroup);
+                if (OrderDetailTypeEnum.MUSICAL.equals(type) && KitGroupPurchaseTypeEnum.GROUP.equals(goodsGroup.getKitGroupPurchaseType())) {
+                    maintenanceGoodsId = goodsGroup.getGoodsIdList();
+                }
             }
         }
 
@@ -442,7 +446,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             for (MusicGroupPaymentCalenderCourseSettings newCourse : newCourses) {
                 StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
                 studentPaymentOrderDetailCourse.setType(OrderDetailTypeEnum.valueOf(newCourse.getCourseType().getCode()));
-                studentPaymentOrderDetailCourse.setPrice(newCourse.getCourseCurrentPrice());
                 if (courseRemitFee.compareTo(BigDecimal.ZERO) > 0 && !newCourse.getIsStudentOptional()) {
                     studentPaymentOrderDetailCourse.setPrice(BigDecimal.ZERO);
                     studentPaymentOrderDetailCourse.setRemitFee(newCourse.getCourseCurrentPrice());
@@ -456,7 +459,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
             }
         }
-        if(buyMaintenance){
+        if (buyMaintenance) {
+            if ("".equals(maintenanceGoodsId)) {
+                throw new BizException("团购乐器才能购买乐保,请核查");
+            }
             StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
             maintenanceOrderDetail.setType(OrderDetailTypeEnum.MAINTENANCE);
             maintenanceOrderDetail.setPrice(new BigDecimal(400));
@@ -530,6 +536,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
         studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
         //乐器及打包辅件
+        String maintenanceGoodsId = "";
         if (goodsGroups != null && goodsGroups.size() > 0) {
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
@@ -552,6 +559,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetail4goodsGroup.setPaymentOrderId(studentPaymentOrder.getId());
                 studentPaymentOrderDetail4goodsGroup.setKitGroupPurchaseType(goodsGroup.getKitGroupPurchaseType());
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goodsGroup);
+                if (OrderDetailTypeEnum.MUSICAL.equals(type) && KitGroupPurchaseTypeEnum.GROUP.equals(goodsGroup.getKitGroupPurchaseType())) {
+                    maintenanceGoodsId = goodsGroup.getGoodsIdList();
+                }
             }
         }
 
@@ -573,7 +583,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
             }
         }
-        if(buyMaintenance){
+        if (buyMaintenance) {
+            if ("".equals(maintenanceGoodsId)) {
+                throw new BizException("团购乐器才能购买乐保,请核查");
+            }
             StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
             maintenanceOrderDetail.setType(OrderDetailTypeEnum.MAINTENANCE);
             maintenanceOrderDetail.setPrice(new BigDecimal(400));