|
@@ -277,7 +277,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList) throws Exception {
|
|
|
+ public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, List<CourseFormDto> courseForms,BigDecimal remitFee,BigDecimal courseRemitFee) throws Exception {
|
|
|
Date date = new Date();
|
|
|
StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
studentPaymentOrder.setUserId(studentRegistration.getUserId());
|
|
@@ -294,7 +294,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
ArrayList<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
|
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
|
|
|
studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
|
|
|
- studentPaymentOrderDetail.setPrice(courseFee);
|
|
|
+ studentPaymentOrderDetail.setPrice(courseFee.subtract(courseRemitFee));
|
|
|
+ studentPaymentOrderDetail.setRemitFee(courseRemitFee);
|
|
|
studentPaymentOrderDetail.setCreateTime(date);
|
|
|
studentPaymentOrderDetail.setUpdateTime(date);
|
|
|
studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
|
|
@@ -302,25 +303,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//乐器及打包辅件
|
|
|
if (goodsGroups != null && goodsGroups.size() > 0) {
|
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
- List<Map<String, Object>> goodsPrices = new ArrayList<>();
|
|
|
- for (Goods goods : goodsGroup.getGoodsList()) {
|
|
|
- HashMap<String, Object> goodsPrice = new HashMap<>();
|
|
|
- goodsPrice.put("id", goods.getId());
|
|
|
- goodsPrice.put("discountPrice", goods.getDiscountPrice());
|
|
|
- goodsPrice.put("agreeCostPrice", goods.getAgreeCostPrice());
|
|
|
- goodsPrices.add(goodsPrice);
|
|
|
- }
|
|
|
-
|
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
|
|
|
+ studentPaymentOrderDetail4goodsGroup.setRemitFee(BigDecimal.ZERO);
|
|
|
OrderDetailTypeEnum type = null;
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
|
|
|
type = OrderDetailTypeEnum.MUSICAL;
|
|
|
+ goodsGroup.setPrice(goodsGroup.getPrice().subtract(remitFee));
|
|
|
+ studentPaymentOrderDetail4goodsGroup.setRemitFee(remitFee);
|
|
|
} else if (goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
|
|
|
type = OrderDetailTypeEnum.ACCESSORIES;
|
|
|
} else if (goodsGroup.getType().equals(GoodsType.OTHER)) {
|
|
|
type = OrderDetailTypeEnum.TEACHING;
|
|
|
}
|
|
|
- studentPaymentOrderDetail4goodsGroup.setGoodsPrices(JSON.toJSONString(goodsPrices));
|
|
|
studentPaymentOrderDetail4goodsGroup.setType(type);
|
|
|
studentPaymentOrderDetail4goodsGroup.setPrice(goodsGroup.getPrice());
|
|
|
studentPaymentOrderDetail4goodsGroup.setGoodsIdList(goodsGroup.getGoodsIdList());
|
|
@@ -334,17 +328,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
//单独辅件
|
|
|
if (goodsList != null && goodsList.size() > 0) {
|
|
|
- List<Map<String, Object>> goodsPrices = new ArrayList<>();
|
|
|
for (Goods goods : goodsList) {
|
|
|
- HashMap<String, Object> goodsPrice = new HashMap<>();
|
|
|
- goodsPrice.put("id", goods.getId());
|
|
|
- goodsPrice.put("discountPrice", goods.getDiscountPrice());
|
|
|
- goodsPrice.put("agreeCostPrice", goods.getAgreeCostPrice());
|
|
|
- goodsPrices.add(goodsPrice);
|
|
|
-
|
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail4goods = new StudentPaymentOrderDetail();
|
|
|
OrderDetailTypeEnum orderDetailType = goods.getType().equals(GoodsType.INSTRUMENT) ? OrderDetailTypeEnum.MUSICAL : OrderDetailTypeEnum.ACCESSORIES;
|
|
|
- studentPaymentOrderDetail4goods.setGoodsPrices(JSON.toJSONString(goodsPrices));
|
|
|
studentPaymentOrderDetail4goods.setType(orderDetailType);
|
|
|
studentPaymentOrderDetail4goods.setPrice(goods.getGroupPurchasePrice());
|
|
|
studentPaymentOrderDetail4goods.setGoodsIdList(goods.getId().toString());
|
|
@@ -356,17 +342,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
//单独教谱
|
|
|
if (otherGoodsList != null && otherGoodsList.size() > 0) {
|
|
|
- List<Map<String, Object>> goodsPrices = new ArrayList<>();
|
|
|
|
|
|
for (Goods goods : otherGoodsList) {
|
|
|
- HashMap<String, Object> goodsPrice = new HashMap<>();
|
|
|
- goodsPrice.put("id", goods.getId());
|
|
|
- goodsPrice.put("discountPrice", goods.getDiscountPrice());
|
|
|
- goodsPrice.put("agreeCostPrice_", goods.getAgreeCostPrice());
|
|
|
- goodsPrices.add(goodsPrice);
|
|
|
-
|
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail4otherGoods = new StudentPaymentOrderDetail();
|
|
|
- studentPaymentOrderDetail4otherGoods.setGoodsPrices(JSON.toJSONString(goodsPrices));
|
|
|
studentPaymentOrderDetail4otherGoods.setType(OrderDetailTypeEnum.TEACHING);
|
|
|
studentPaymentOrderDetail4otherGoods.setPrice(goods.getGroupPurchasePrice());
|
|
|
studentPaymentOrderDetail4otherGoods.setGoodsIdList(goods.getId().toString());
|
|
@@ -376,6 +354,30 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentPaymentOrderDetailList.add(studentPaymentOrderDetail4otherGoods);
|
|
|
}
|
|
|
}
|
|
|
+ //可选课程
|
|
|
+ if (courseForms != null && courseForms.size() > 0) {
|
|
|
+ for (CourseFormDto courseForm : courseForms) {
|
|
|
+ OrderDetailTypeEnum courType = OrderDetailTypeEnum.MUSIC_COURSE;
|
|
|
+ if (courseForm.getType().equals("soundInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.MUSIC_COURSE;
|
|
|
+ } else if (courseForm.getType().equals("allInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.MIX_COURSE;
|
|
|
+ } else if (courseForm.getType().equals("baseInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.HIGH_ONLINE_COURSE;
|
|
|
+ } else if (courseForm.getType().equals("holidayInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.HOLIDAY_COURSE;
|
|
|
+ } else if (courseForm.getType().equals("networkInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.NETWORK_COURSE;
|
|
|
+ }
|
|
|
+ StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
|
|
|
+ studentPaymentOrderDetailCourse.setType(courType);
|
|
|
+ studentPaymentOrderDetailCourse.setPrice(courseForm.getPrice());
|
|
|
+ studentPaymentOrderDetailCourse.setCreateTime(date);
|
|
|
+ studentPaymentOrderDetailCourse.setUpdateTime(date);
|
|
|
+ studentPaymentOrderDetailCourse.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
+ studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
|
|
|
|
|
@@ -407,7 +409,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public StudentPaymentOrder reAddOrder(Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, String musicGroupId, StudentPaymentOrder oldOrder) {
|
|
|
+ public StudentPaymentOrder reAddOrder(Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, String musicGroupId, StudentPaymentOrder oldOrder, List<CourseFormDto> courseForms,BigDecimal remitFee,BigDecimal courseRemitFee) {
|
|
|
//关闭老订单
|
|
|
oldOrder.setStatus(DealStatusEnum.CLOSE);
|
|
|
studentPaymentOrderService.update(oldOrder);
|
|
@@ -427,10 +429,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentPaymentOrder.setMusicGroupId(musicGroupId);
|
|
|
studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
|
|
|
- ArrayList<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
|
|
|
+ List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
|
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
|
|
|
studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
|
|
|
- studentPaymentOrderDetail.setPrice(courseFee);
|
|
|
+ studentPaymentOrderDetail.setPrice(courseFee.subtract(courseRemitFee));
|
|
|
+ studentPaymentOrderDetail.setRemitFee(courseRemitFee);
|
|
|
studentPaymentOrderDetail.setCreateTime(date);
|
|
|
studentPaymentOrderDetail.setUpdateTime(date);
|
|
|
studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
|
|
@@ -439,9 +442,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
if (goodsGroups != null && goodsGroups.size() > 0) {
|
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
|
|
|
+ studentPaymentOrderDetail4goodsGroup.setRemitFee(BigDecimal.ZERO);
|
|
|
OrderDetailTypeEnum type = null;
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
|
|
|
type = OrderDetailTypeEnum.MUSICAL;
|
|
|
+ goodsGroup.setPrice(goodsGroup.getPrice().subtract(remitFee));
|
|
|
+ studentPaymentOrderDetail4goodsGroup.setRemitFee(remitFee);
|
|
|
} else if (goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
|
|
|
type = OrderDetailTypeEnum.ACCESSORIES;
|
|
|
} else if (goodsGroup.getType().equals(GoodsType.OTHER)) {
|
|
@@ -486,6 +492,30 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentPaymentOrderDetailList.add(studentPaymentOrderDetail4otherGoods);
|
|
|
}
|
|
|
}
|
|
|
+ //可选课程
|
|
|
+ if (courseForms != null && courseForms.size() > 0) {
|
|
|
+ for (CourseFormDto courseForm : courseForms) {
|
|
|
+ OrderDetailTypeEnum courType = OrderDetailTypeEnum.MUSIC_COURSE;
|
|
|
+ if (courseForm.getType().equals("soundInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.MUSIC_COURSE;
|
|
|
+ } else if (courseForm.getType().equals("allInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.MIX_COURSE;
|
|
|
+ } else if (courseForm.getType().equals("baseInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.HIGH_ONLINE_COURSE;
|
|
|
+ } else if (courseForm.getType().equals("holidayInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.HOLIDAY_COURSE;
|
|
|
+ } else if (courseForm.getType().equals("networkInfo")) {
|
|
|
+ courType = OrderDetailTypeEnum.NETWORK_COURSE;
|
|
|
+ }
|
|
|
+ StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
|
|
|
+ studentPaymentOrderDetailCourse.setType(courType);
|
|
|
+ studentPaymentOrderDetailCourse.setPrice(courseForm.getPrice());
|
|
|
+ studentPaymentOrderDetailCourse.setCreateTime(date);
|
|
|
+ studentPaymentOrderDetailCourse.setUpdateTime(date);
|
|
|
+ studentPaymentOrderDetailCourse.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
+ studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
|
|
|
|