|
@@ -157,6 +157,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
|
|
private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
|
|
private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SubjectChangeDao subjectChangeDao;
|
|
|
|
|
|
|
|
private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
|
|
private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
@@ -447,7 +451,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//乐器及打包辅件
|
|
//乐器及打包辅件
|
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
|
if (studentRegistration.getTemporaryCourseFee() != null) {
|
|
if (studentRegistration.getTemporaryCourseFee() != null) {
|
|
|
- List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(),studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
|
|
|
|
|
|
|
+ List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
|
|
|
for (StudentPaymentOrderDetail orderDetail : orderDetails) {
|
|
for (StudentPaymentOrderDetail orderDetail : orderDetails) {
|
|
|
if (orderDetail == null || orderDetail.getPrice() == null || orderDetail.getGoodsIdList() == null) {
|
|
if (orderDetail == null || orderDetail.getPrice() == null || orderDetail.getGoodsIdList() == null) {
|
|
|
continue;
|
|
continue;
|
|
@@ -665,7 +669,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//乐器及打包辅件
|
|
//乐器及打包辅件
|
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
|
if (studentRegistration.getTemporaryCourseFee() != null) {
|
|
if (studentRegistration.getTemporaryCourseFee() != null) {
|
|
|
- List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(),studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
|
|
|
|
|
|
|
+ List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
|
|
|
for (StudentPaymentOrderDetail orderDetail : orderDetails) {
|
|
for (StudentPaymentOrderDetail orderDetail : orderDetails) {
|
|
|
if (orderDetail == null || orderDetail.getPrice() == null || orderDetail.getGoodsIdList() == null) {
|
|
if (orderDetail == null || orderDetail.getPrice() == null || orderDetail.getGoodsIdList() == null) {
|
|
|
continue;
|
|
continue;
|
|
@@ -1501,6 +1505,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
|
|
studentRegistrationDao.update(studentRegistration);
|
|
studentRegistrationDao.update(studentRegistration);
|
|
|
|
|
|
|
|
|
|
+ //删除用户购买的课程记录
|
|
|
|
|
+ musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
|
|
+
|
|
|
BigDecimal amount = new BigDecimal(0);
|
|
BigDecimal amount = new BigDecimal(0);
|
|
|
|
|
|
|
|
// 判断乐器是否是租赁
|
|
// 判断乐器是否是租赁
|
|
@@ -1515,6 +1522,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
|
|
List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
|
|
List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
|
|
|
|
|
|
|
|
|
|
+ Set<String> courseTypeSet = new HashSet<>();
|
|
|
|
|
+ if (isRefundCourseFee) {
|
|
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getMusicGroupRegCalenderCourseSettings(studentRegistration.getMusicGroupId());
|
|
|
|
|
+ courseTypeSet = courseSettings.stream().map(e -> e.getCourseType().getCode()).collect(Collectors.toSet());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SubjectChange studentLastChange = null;
|
|
|
|
|
+ if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
|
|
|
|
|
+ studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
|
|
BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
|
|
|
for (StudentPaymentOrderDetail detail : orderDetailList) {
|
|
for (StudentPaymentOrderDetail detail : orderDetailList) {
|
|
|
if (remitFee.compareTo(detail.getPrice()) >= 0) {
|
|
if (remitFee.compareTo(detail.getPrice()) >= 0) {
|
|
@@ -1527,24 +1545,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
|
|
if (isRefundCourseFee) {
|
|
if (isRefundCourseFee) {
|
|
|
// 退课程费用
|
|
// 退课程费用
|
|
|
- if (detail.getType() == OrderDetailTypeEnum.COURSE) {
|
|
|
|
|
|
|
+ if (courseTypeSet.contains(detail.getType().getCode())) {
|
|
|
amount = amount.add(detail.getPrice());
|
|
amount = amount.add(detail.getPrice());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (isRefundInstrumentFee) {
|
|
|
|
|
|
|
+ if (isRefundInstrumentFee && studentLastChange == null) {
|
|
|
// 退乐器费用
|
|
// 退乐器费用
|
|
|
if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
|
|
if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
|
|
|
amount = amount.add(detail.getPrice());
|
|
amount = amount.add(detail.getPrice());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- if (isRefundTeachingAssistantsFee) {
|
|
|
|
|
|
|
+ if (isRefundTeachingAssistantsFee && studentLastChange == null) {
|
|
|
// 退教辅费用
|
|
// 退教辅费用
|
|
|
if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
|
|
if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
|
|
|
amount = amount.add(detail.getPrice());
|
|
amount = amount.add(detail.getPrice());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if (studentLastChange != null) {
|
|
|
|
|
+ amount = amount.add(studentLastChange.getChangeMusicalPrice()).add(studentLastChange.getChangeAccessoriesPrice());
|
|
|
|
|
+ }
|
|
|
if (amount.doubleValue() > 0) {
|
|
if (amount.doubleValue() > 0) {
|
|
|
// 增加交易流水
|
|
// 增加交易流水
|
|
|
sysUserCashAccountDetailService.addCashAccountDetail(userId, amount, SysUserCashAccountDetailService.MUSIC_GROUP + musicGroupId, "",
|
|
sysUserCashAccountDetailService.addCashAccountDetail(userId, amount, SysUserCashAccountDetailService.MUSIC_GROUP + musicGroupId, "",
|
|
@@ -1604,6 +1625,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
|
|
studentRegistrationDao.update(studentRegistration);
|
|
studentRegistrationDao.update(studentRegistration);
|
|
|
|
|
|
|
|
|
|
+ //删除用户购买的课程记录
|
|
|
|
|
+ musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
|
|
+
|
|
|
BigDecimal amount = new BigDecimal(0);
|
|
BigDecimal amount = new BigDecimal(0);
|
|
|
|
|
|
|
|
// 判断乐器是否是租赁
|
|
// 判断乐器是否是租赁
|
|
@@ -1616,6 +1640,18 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
|
|
List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
|
|
|
|
|
+
|
|
|
|
|
+ Set<String> courseTypeSet = new HashSet<>();
|
|
|
|
|
+ if (isRefundCourseFee) {
|
|
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getMusicGroupRegCalenderCourseSettings(studentRegistration.getMusicGroupId());
|
|
|
|
|
+ courseTypeSet = courseSettings.stream().map(e -> e.getCourseType().getCode()).collect(Collectors.toSet());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SubjectChange studentLastChange = null;
|
|
|
|
|
+ if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
|
|
|
|
|
+ studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
|
|
BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
|
|
|
|
|
|
|
|
for (StudentPaymentOrderDetail detail : orderDetailList) {
|
|
for (StudentPaymentOrderDetail detail : orderDetailList) {
|
|
@@ -1628,24 +1664,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
}
|
|
|
if (isRefundCourseFee) {
|
|
if (isRefundCourseFee) {
|
|
|
// 退课程费用
|
|
// 退课程费用
|
|
|
- if (detail.getType() == OrderDetailTypeEnum.COURSE) {
|
|
|
|
|
|
|
+ if (courseTypeSet.contains(detail.getType().getCode())) {
|
|
|
amount = amount.add(detail.getPrice());
|
|
amount = amount.add(detail.getPrice());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (isRefundInstrumentFee) {
|
|
|
|
|
|
|
+ if (isRefundInstrumentFee && studentLastChange == null) {
|
|
|
// 退乐器费用
|
|
// 退乐器费用
|
|
|
if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
|
|
if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
|
|
|
amount = amount.add(detail.getPrice());
|
|
amount = amount.add(detail.getPrice());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- if (isRefundTeachingAssistantsFee) {
|
|
|
|
|
|
|
+ if (isRefundTeachingAssistantsFee && studentLastChange == null) {
|
|
|
// 退教辅费用
|
|
// 退教辅费用
|
|
|
if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
|
|
if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
|
|
|
amount = amount.add(detail.getPrice());
|
|
amount = amount.add(detail.getPrice());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if (studentLastChange != null) {
|
|
|
|
|
+ amount = amount.add(studentLastChange.getChangeMusicalPrice()).add(studentLastChange.getChangeAccessoriesPrice());
|
|
|
|
|
+ }
|
|
|
if (amount.doubleValue() > 0) {
|
|
if (amount.doubleValue() > 0) {
|
|
|
// 增加交易流水
|
|
// 增加交易流水
|
|
|
sysUserCashAccountDetailService.addCashAccountDetail(userId, amount, SysUserCashAccountDetailService.MUSIC_GROUP + musicGroupId, "",
|
|
sysUserCashAccountDetailService.addCashAccountDetail(userId, amount, SysUserCashAccountDetailService.MUSIC_GROUP + musicGroupId, "",
|
|
@@ -1830,7 +1869,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
|
|
List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderDetail.getMusicGroupPaymentCalenderId());
|
|
List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderDetail.getMusicGroupPaymentCalenderId());
|
|
|
List<StudentPaymentOrderDetail> paymentOrderDetails = new ArrayList<>();
|
|
List<StudentPaymentOrderDetail> paymentOrderDetails = new ArrayList<>();
|
|
|
- courseSettings.forEach(e->{
|
|
|
|
|
|
|
+ courseSettings.forEach(e -> {
|
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
|
|
|
studentPaymentOrderDetail.setType(OrderDetailTypeEnum.valueOf(e.getCourseType().getCode()));
|
|
studentPaymentOrderDetail.setType(OrderDetailTypeEnum.valueOf(e.getCourseType().getCode()));
|
|
|
studentPaymentOrderDetail.setPrice(e.getCourseCurrentPrice());
|
|
studentPaymentOrderDetail.setPrice(e.getCourseCurrentPrice());
|
|
@@ -2207,6 +2246,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
|
|
MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
|
|
|
if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
|
|
if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
|
|
|
regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN);
|
|
regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN);
|
|
|
|
|
+ regCalender.setDeadlinePaymentDate(DateUtil.toDate(expireDate));
|
|
|
regCalender.setUpdateTime(new Date());
|
|
regCalender.setUpdateTime(new Date());
|
|
|
musicGroupPaymentCalenderDao.update(regCalender);
|
|
musicGroupPaymentCalenderDao.update(regCalender);
|
|
|
}
|
|
}
|