|
@@ -637,9 +637,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//获取课程价格
|
|
|
MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
|
|
|
BigDecimal courseFee = musicOneSubjectClassPlan.getFee() == null ? BigDecimal.ZERO : musicOneSubjectClassPlan.getFee();
|
|
|
- if (studentRegistration.getTemporaryCourseFee() != null) {
|
|
|
- courseFee = studentRegistration.getTemporaryCourseFee();
|
|
|
- }
|
|
|
orderAmount = orderAmount.add(courseFee);
|
|
|
|
|
|
BigDecimal remitFee = BigDecimal.ZERO;
|
|
@@ -790,9 +787,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//获取课程价格
|
|
|
MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
|
|
|
BigDecimal courseFee = musicOneSubjectClassPlan.getFee() == null ? BigDecimal.ZERO : musicOneSubjectClassPlan.getFee();
|
|
|
- if (studentRegistration.getTemporaryCourseFee() != null) {
|
|
|
- courseFee = studentRegistration.getTemporaryCourseFee();
|
|
|
- }
|
|
|
orderAmount = orderAmount.add(courseFee);
|
|
|
|
|
|
BigDecimal remitFee = BigDecimal.ZERO;
|
|
@@ -802,100 +796,29 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
//乐器及打包辅件
|
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
|
- if (studentRegistration.getTemporaryCourseFee() != null) {
|
|
|
- List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
|
|
|
- for (StudentPaymentOrderDetail orderDetail : orderDetails) {
|
|
|
- if (orderDetail == null || orderDetail.getPrice() == null || orderDetail.getGoodsIdList() == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- MusicGroupSubjectGoodsGroup musicGroupSubjectGoodsGroup = new MusicGroupSubjectGoodsGroup();
|
|
|
- GoodsType goodsType = orderDetail.getType().equals(OrderDetailTypeEnum.MUSICAL) ? GoodsType.INSTRUMENT : GoodsType.ACCESSORIES;
|
|
|
- musicGroupSubjectGoodsGroup.setType(goodsType);
|
|
|
- musicGroupSubjectGoodsGroup.setGoodsIdList(orderDetail.getGoodsIdList());
|
|
|
- musicGroupSubjectGoodsGroup.setPrice(orderDetail.getPrice());
|
|
|
- musicGroupSubjectGoodsGroup.setKitGroupPurchaseType(orderDetail.getKitGroupPurchaseType());
|
|
|
- goodsGroups.add(musicGroupSubjectGoodsGroup);
|
|
|
-
|
|
|
- orderAmount = orderAmount.add(orderDetail.getPrice());
|
|
|
- }
|
|
|
- } else if (StringUtils.isNoneBlank(registerPayDto.getGoodsGroupIds())) {
|
|
|
- goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(registerPayDto.getGoodsGroupIds());
|
|
|
- for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
- if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
|
- goodsGroup.setPrice(musicOneSubjectClassPlan.getDepositFee());
|
|
|
- }
|
|
|
- if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.FREE)) {
|
|
|
- goodsGroup.setPrice(new BigDecimal(0));
|
|
|
- }
|
|
|
- orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
|
-
|
|
|
- //团购乐器减免课程费用
|
|
|
- if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && goodsGroup.getRemissionCourseFee() != null && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.GROUP)) {//团购
|
|
|
- orderAmount = orderAmount.subtract(goodsGroup.getRemissionCourseFee());
|
|
|
- courseFee = courseFee.subtract(goodsGroup.getRemissionCourseFee());
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (registerPayDto.getGoodsGroups() != null && registerPayDto.getGoodsGroups().size() > 0) {
|
|
|
+ if (registerPayDto.getGoodsGroups() != null && registerPayDto.getGoodsGroups().size() > 0) {
|
|
|
String goodsGroupIds = registerPayDto.getGoodsGroups().keySet().stream().map(Object::toString).collect(Collectors.joining(","));
|
|
|
goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(goodsGroupIds);
|
|
|
- for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
- Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
|
|
|
- });
|
|
|
- if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
|
|
|
- String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
|
|
|
- if (!groupType.containsKey(kitGroupPurchaseType)) {
|
|
|
- throw new BizException("乐器提供方式不存在,请核查");
|
|
|
- }
|
|
|
- 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);
|
|
|
- }
|
|
|
- orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
|
- goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
|
|
|
- }
|
|
|
- orderAmount = orderAmount.subtract(remitFee).subtract(courseRemitFee);
|
|
|
- }
|
|
|
-
|
|
|
- //单独辅件
|
|
|
- List<Goods> goodsList = null;
|
|
|
- if (registerPayDto.getGoodsIds() != null && !registerPayDto.getGoodsIds().equals("")) {
|
|
|
- goodsList = goodsService.findGoodsByIds(registerPayDto.getGoodsIds());
|
|
|
- for (Goods goods : goodsList) {
|
|
|
- orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
|
|
|
- }
|
|
|
}
|
|
|
+ for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
+ Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
|
|
|
+ });
|
|
|
|
|
|
- //单独教谱
|
|
|
- List<Goods> otherGoodsList = null;
|
|
|
- if (registerPayDto.getOtherGoodsIds() != null && !registerPayDto.getOtherGoodsIds().equals("")) {
|
|
|
- otherGoodsList = goodsService.findGoodsByIds(registerPayDto.getOtherGoodsIds());
|
|
|
- for (Goods goods : otherGoodsList) {
|
|
|
- orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
|
|
|
- }
|
|
|
- }
|
|
|
- //可选课程
|
|
|
- List<CourseFormDto> courseForms = new ArrayList<>();
|
|
|
- if (registerPayDto.getCourseKeys() != null && registerPayDto.getCourseKeys().size() > 0) {
|
|
|
- MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
|
- if (musicGroup.getCourseForm() == null) {
|
|
|
- throw new BizException("可选课程不存在");
|
|
|
- }
|
|
|
- JSONObject courseForm = JSON.parseObject(musicGroup.getCourseForm());
|
|
|
- for (String courseKey : registerPayDto.getCourseKeys()) {
|
|
|
- if (courseForm.get(courseKey) == null) {
|
|
|
- throw new BizException("可选课程不存在");
|
|
|
+ if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
|
|
|
+ String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
|
|
|
+ if (!groupType.containsKey(kitGroupPurchaseType)) {
|
|
|
+ throw new BizException("乐器提供方式不存在,请核查");
|
|
|
}
|
|
|
- CourseFormDto courseFormDto = new CourseFormDto();
|
|
|
- JSONObject jsonObject = JSON.parseObject(courseForm.getString(courseKey));
|
|
|
- orderAmount = orderAmount.add(jsonObject.getBigDecimal("value"));
|
|
|
- courseFormDto.setType(courseKey);
|
|
|
- courseFormDto.setPrice(jsonObject.getBigDecimal("value"));
|
|
|
- courseForms.add(courseFormDto);
|
|
|
+ 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);
|
|
|
}
|
|
|
+ orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
|
+ goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
|
|
|
}
|
|
|
|
|
|
//新课程形态
|
|
@@ -911,6 +834,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(registerPayDto.getBuyMaintenance()){
|
|
|
+ orderAmount = orderAmount.add(new BigDecimal(400));
|
|
|
+ }
|
|
|
+
|
|
|
if (amount.compareTo(orderAmount) != 0) {
|
|
|
throw new BizException("商品价格不符");
|
|
|
}
|
|
@@ -923,7 +850,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
String channelType = "";
|
|
|
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(), ApplyOrder, courseForms, remitFee, courseRemitFee, newCourses);
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, studentRegistration.getMusicGroupId(), ApplyOrder, remitFee, courseRemitFee, newCourses,registerPayDto.getBuyMaintenance());
|
|
|
studentPaymentOrder.setVersion(0);
|
|
|
Date date = new Date();
|
|
|
|