|
@@ -1,5 +1,6 @@
|
|
package com.ym.mec.biz.service.impl;
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.TypeReference;
|
|
import com.alibaba.fastjson.TypeReference;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
@@ -409,6 +410,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
orderAmount = orderAmount.add(courseFee);
|
|
orderAmount = orderAmount.add(courseFee);
|
|
|
|
|
|
BigDecimal remitFee = BigDecimal.ZERO;
|
|
BigDecimal remitFee = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal courseRemitFee = BigDecimal.ZERO;
|
|
|
|
|
|
//乐器及打包辅件
|
|
//乐器及打包辅件
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
@@ -451,6 +453,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
|
|
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)) {
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
|
|
String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
|
|
String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
|
|
if (!groupType.containsKey(kitGroupPurchaseType)) {
|
|
if (!groupType.containsKey(kitGroupPurchaseType)) {
|
|
@@ -461,11 +465,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
}
|
|
}
|
|
goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
|
|
goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
|
|
remitFee = groupType.get(kitGroupPurchaseType);
|
|
remitFee = groupType.get(kitGroupPurchaseType);
|
|
|
|
+ courseRemitFee = coursePurchase.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : coursePurchase.get(kitGroupPurchaseType);
|
|
}
|
|
}
|
|
orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
|
|
goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
|
|
}
|
|
}
|
|
- orderAmount = orderAmount.subtract(remitFee);
|
|
|
|
|
|
+ orderAmount = orderAmount.subtract(remitFee).subtract(courseRemitFee);
|
|
}
|
|
}
|
|
|
|
|
|
//单独辅件
|
|
//单独辅件
|
|
@@ -485,6 +490,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
|
|
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("可选课程不存在");
|
|
|
|
+ }
|
|
|
|
+ Map<String, String> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
|
|
|
|
+ for (String courseKey : registerPayDto.getCourseKeys()) {
|
|
|
|
+ if (courseForm.get(courseKey) == null) {
|
|
|
|
+ throw new BizException("可选课程不存在");
|
|
|
|
+ }
|
|
|
|
+ CourseFormDto courseFormDto = new CourseFormDto();
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(musicGroup.getCourseForm());
|
|
|
|
+ orderAmount = orderAmount.add(jsonObject.getBigDecimal("value"));
|
|
|
|
+ courseFormDto.setType(courseKey);
|
|
|
|
+ courseFormDto.setPrice(jsonObject.getBigDecimal("value"));
|
|
|
|
+ courseForms.add(courseFormDto);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if (amount.compareTo(orderAmount) != 0) {
|
|
if (amount.compareTo(orderAmount) != 0) {
|
|
throw new BizException("商品价格不符");
|
|
throw new BizException("商品价格不符");
|
|
}
|
|
}
|
|
@@ -496,7 +522,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
String channelType = "";
|
|
String channelType = "";
|
|
|
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList);
|
|
|
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList,courseForms);
|
|
studentPaymentOrder.setVersion(0);
|
|
studentPaymentOrder.setVersion(0);
|
|
|
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
@@ -518,6 +544,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
}
|
|
}
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
studentPaymentOrder.setRemitFee(remitFee);
|
|
studentPaymentOrder.setRemitFee(remitFee);
|
|
|
|
+ studentPaymentOrder.setCourseRemitFee(courseRemitFee);
|
|
studentPaymentOrder.setOrganId(musicGroup.getOrganId());
|
|
studentPaymentOrder.setOrganId(musicGroup.getOrganId());
|
|
studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
|
|
studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
@@ -589,6 +616,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
orderAmount = orderAmount.add(courseFee);
|
|
orderAmount = orderAmount.add(courseFee);
|
|
|
|
|
|
BigDecimal remitFee = BigDecimal.ZERO;
|
|
BigDecimal remitFee = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal courseRemitFee = BigDecimal.ZERO;
|
|
|
|
|
|
//乐器及打包辅件
|
|
//乐器及打包辅件
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
@@ -631,6 +659,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
|
|
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)) {
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
|
|
String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
|
|
String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
|
|
if (!groupType.containsKey(kitGroupPurchaseType)) {
|
|
if (!groupType.containsKey(kitGroupPurchaseType)) {
|
|
@@ -641,11 +671,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
}
|
|
}
|
|
goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
|
|
goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
|
|
remitFee = groupType.get(kitGroupPurchaseType);
|
|
remitFee = groupType.get(kitGroupPurchaseType);
|
|
|
|
+ courseRemitFee = coursePurchase.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : coursePurchase.get(kitGroupPurchaseType);
|
|
}
|
|
}
|
|
orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
|
|
goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
|
|
}
|
|
}
|
|
- orderAmount = orderAmount.subtract(remitFee);
|
|
|
|
|
|
+ orderAmount = orderAmount.subtract(remitFee).subtract(courseRemitFee);
|
|
}
|
|
}
|
|
|
|
|
|
//单独辅件
|
|
//单独辅件
|
|
@@ -665,6 +696,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
|
|
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("可选课程不存在");
|
|
|
|
+ }
|
|
|
|
+ Map<String, String> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
|
|
|
|
+ for (String courseKey : registerPayDto.getCourseKeys()) {
|
|
|
|
+ if (courseForm.get(courseKey) == null) {
|
|
|
|
+ throw new BizException("可选课程不存在");
|
|
|
|
+ }
|
|
|
|
+ CourseFormDto courseFormDto = new CourseFormDto();
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(musicGroup.getCourseForm());
|
|
|
|
+ orderAmount = orderAmount.add(jsonObject.getBigDecimal("value"));
|
|
|
|
+ courseFormDto.setType(courseKey);
|
|
|
|
+ courseFormDto.setPrice(jsonObject.getBigDecimal("value"));
|
|
|
|
+ courseForms.add(courseFormDto);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if (amount.compareTo(orderAmount) != 0) {
|
|
if (amount.compareTo(orderAmount) != 0) {
|
|
throw new BizException("商品价格不符");
|
|
throw new BizException("商品价格不符");
|
|
}
|
|
}
|
|
@@ -677,7 +729,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
String channelType = "";
|
|
String channelType = "";
|
|
|
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(), ApplyOrder);
|
|
|
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(), ApplyOrder,courseForms);
|
|
studentPaymentOrder.setVersion(0);
|
|
studentPaymentOrder.setVersion(0);
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
|
|
|
@@ -699,6 +751,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
}
|
|
}
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
studentPaymentOrder.setRemitFee(remitFee);
|
|
studentPaymentOrder.setRemitFee(remitFee);
|
|
|
|
+ studentPaymentOrder.setCourseRemitFee(courseRemitFee);
|
|
studentPaymentOrder.setOrganId(musicGroup.getOrganId());
|
|
studentPaymentOrder.setOrganId(musicGroup.getOrganId());
|
|
studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
|
|
studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
studentPaymentOrder.setUpdateTime(date);
|