|
@@ -2296,12 +2296,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
if (studentPaymentOrderList.size() > 0) {
|
|
|
|
|
|
- BigDecimal remitFee = BigDecimal.ZERO;
|
|
|
-
|
|
|
- for(StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList){
|
|
|
- remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
|
|
|
- }
|
|
|
-
|
|
|
List<Long> paymentOrderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
|
|
|
|
|
|
List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
|
|
@@ -2310,32 +2304,29 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
|
|
|
studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
|
|
|
}
|
|
|
+
|
|
|
+ for (StudentPaymentOrderDetail detail : orderDetailList) {
|
|
|
|
|
|
- for (StudentPaymentOrderDetail detail : orderDetailList) {
|
|
|
- if (remitFee.compareTo(detail.getPrice()) >= 0) {
|
|
|
- remitFee = remitFee.subtract(detail.getPrice());
|
|
|
- detail.setPrice(BigDecimal.ZERO);
|
|
|
- } else {
|
|
|
- detail.setPrice(detail.getPrice().subtract(remitFee));
|
|
|
- remitFee = BigDecimal.ZERO;
|
|
|
- }
|
|
|
- if (isRefundInstrumentFee && studentLastChange == null) {
|
|
|
- // 退乐器费用
|
|
|
- if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
|
|
|
- amount = amount.add(detail.getPrice());
|
|
|
- }
|
|
|
+ // 退乐器费用
|
|
|
+ if (isRefundInstrumentFee && detail.getType() == OrderDetailTypeEnum.MUSICAL) {
|
|
|
+ if (studentLastChange.getOriginalOrderId() != null && studentLastChange.getOriginalOrderId() == detail.getPaymentOrderId().intValue()) {
|
|
|
+ amount = amount.add(studentLastChange.getChangeMusicalPrice());
|
|
|
+ } else {
|
|
|
+ amount = amount.add(detail.getPrice()).subtract(detail.getRemitFee());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- if (isRefundTeachingAssistantsFee && studentLastChange == null) {
|
|
|
- // 退教辅费用
|
|
|
- if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
|
|
|
- amount = amount.add(detail.getPrice());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (studentLastChange != null) {
|
|
|
- amount = amount.add(studentLastChange.getChangeMusicalPrice()).add(studentLastChange.getChangeAccessoriesPrice());
|
|
|
- }
|
|
|
+ // 退教辅费用
|
|
|
+ if (isRefundTeachingAssistantsFee
|
|
|
+ && (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING)) {
|
|
|
+ if (studentLastChange.getOriginalOrderId() != null && studentLastChange.getOriginalOrderId() == detail.getPaymentOrderId().intValue()) {
|
|
|
+ amount = amount.add(studentLastChange.getChangeAccessoriesPrice());
|
|
|
+ } else {
|
|
|
+ amount = amount.add(detail.getPrice()).subtract(detail.getRemitFee());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//退乐保费用
|