|
@@ -3217,7 +3217,9 @@ public class ExportServiceImpl implements ExportService {
|
|
|
|
|
|
public @PostConstruct
|
|
|
void initOrderDetailTypeServiceConsumerMap() {
|
|
|
- BiConsumer<StudentPaymentOrderExportDto, StudentPaymentOrderDetail> con1 = (orderDto, detail) -> orderDto.setMusicGroupCourseFee(orderDto.getMusicGroupCourseFee().add(detail.getPrice()));
|
|
|
+ BiConsumer<StudentPaymentOrderExportDto, StudentPaymentOrderDetail> con1 =
|
|
|
+ (orderDto, detail) -> orderDto.setMusicGroupCourseFee(orderDto.getMusicGroupCourseFee().add(detail.getPrice())
|
|
|
+ .compareTo(orderDto.getServiceAmount()) > 0 ? orderDto.getServiceAmount() : orderDto.getMusicGroupCourseFee().add(detail.getPrice()));
|
|
|
orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.COURSE, con1);
|
|
|
orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.CLASSROOM, con1);
|
|
|
orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.SINGLE, con1);
|
|
@@ -3230,15 +3232,30 @@ public class ExportServiceImpl implements ExportService {
|
|
|
orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.HIGH, con1);
|
|
|
orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.HIGH_ONLINE, con1);
|
|
|
orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.HIGH_ONLINE_COURSE, con1);
|
|
|
- orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.DEGREE_REGISTRATION, (orderDto, detail) -> orderDto.setDegreeFee(orderDto.getDegreeFee().add(detail.getPrice())));
|
|
|
- orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.MAINTENANCE, (orderDto, detail) -> orderDto.setMaintenanceFee(orderDto.getMaintenanceFee().add(detail.getPrice())));
|
|
|
- BiConsumer<StudentPaymentOrderExportDto, StudentPaymentOrderDetail> con2 = (orderDto, detail) -> orderDto.setCloudTeacherFee(orderDto.getCloudTeacherFee().add(detail.getPrice()));
|
|
|
+ orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.DEGREE_REGISTRATION,
|
|
|
+ (orderDto, detail) -> orderDto.setDegreeFee(orderDto.getDegreeFee().add(detail.getPrice())
|
|
|
+ .compareTo(orderDto.getServiceAmount()) > 0 ? orderDto.getServiceAmount() : orderDto.getDegreeFee().add(detail.getPrice())));
|
|
|
+ orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.MAINTENANCE,
|
|
|
+ (orderDto, detail) -> orderDto.setMaintenanceFee(orderDto.getMaintenanceFee().add(detail.getPrice())
|
|
|
+ .compareTo(orderDto.getServiceAmount()) > 0 ? orderDto.getServiceAmount() : orderDto.getMaintenanceFee().add(detail.getPrice())));
|
|
|
+ //原有的业务逻辑不支持同一笔订单明细分润导多个账户,所以这里先比较金额大小,会有bug
|
|
|
+ BiConsumer<StudentPaymentOrderExportDto, StudentPaymentOrderDetail> con2 =
|
|
|
+ (orderDto, detail) -> orderDto.setCloudTeacherFee(orderDto.getCloudTeacherFee().add(detail.getPrice())
|
|
|
+ .compareTo(orderDto.getServiceAmount()) > 0 ? orderDto.getServiceAmount() : orderDto.getCloudTeacherFee().add(detail.getPrice()));
|
|
|
orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.CLOUD_TEACHER, con2);
|
|
|
orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.CLOUD_TEACHER_PLUS, con2);
|
|
|
- orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.THEORY_COURSE, (orderDto, detail) -> orderDto.setTheoryCourseFee(orderDto.getTheoryCourseFee().add(detail.getPrice())));
|
|
|
- orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.PRACTICE, (orderDto, detail) -> orderDto.setPracticeCourseFee(orderDto.getPracticeCourseFee().add(detail.getPrice())));
|
|
|
- orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.VIP, (orderDto, detail) -> orderDto.setVipCourseFee(orderDto.getVipCourseFee().add(detail.getPrice())));
|
|
|
- orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.REPAIR, (orderDto, detail) -> orderDto.setRepairFee(orderDto.getRepairFee().add(detail.getPrice())));
|
|
|
+ orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.THEORY_COURSE,
|
|
|
+ (orderDto, detail) -> orderDto.setTheoryCourseFee(orderDto.getTheoryCourseFee().add(detail.getPrice())
|
|
|
+ .compareTo(orderDto.getServiceAmount()) > 0 ? orderDto.getServiceAmount() : orderDto.getTheoryCourseFee().add(detail.getPrice())));
|
|
|
+ orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.PRACTICE,
|
|
|
+ (orderDto, detail) -> orderDto.setPracticeCourseFee(orderDto.getPracticeCourseFee().add(detail.getPrice())
|
|
|
+ .compareTo(orderDto.getServiceAmount()) > 0 ? orderDto.getServiceAmount() : orderDto.getPracticeCourseFee().add(detail.getPrice())));
|
|
|
+ orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.VIP,
|
|
|
+ (orderDto, detail) -> orderDto.setVipCourseFee(orderDto.getVipCourseFee().add(detail.getPrice())
|
|
|
+ .compareTo(orderDto.getServiceAmount()) > 0 ? orderDto.getServiceAmount() : orderDto.getVipCourseFee().add(detail.getPrice())));
|
|
|
+ orderDetailTypeServiceConsumerMap.put(OrderDetailTypeEnum.REPAIR,
|
|
|
+ (orderDto, detail) -> orderDto.setRepairFee(orderDto.getRepairFee().add(detail.getPrice())
|
|
|
+ .compareTo(orderDto.getServiceAmount()) > 0 ? orderDto.getServiceAmount() : orderDto.getRepairFee().add(detail.getPrice())));
|
|
|
}
|
|
|
|
|
|
//计算订单详情实际支付金额(按比例)
|
|
@@ -3282,18 +3299,22 @@ public class ExportServiceImpl implements ExportService {
|
|
|
BigDecimal price = orderDetail.getPrice().subtract(orderDetail.getIncome());
|
|
|
switch (orderDetail.getType()) {
|
|
|
case OTHER:
|
|
|
- basicOrder.setOtherFee(basicOrder.getOtherFee().add(price));
|
|
|
+ basicOrder.setOtherFee(basicOrder.getOtherFee().add(price)
|
|
|
+ .compareTo(basicOrder.getSaleAmount()) > 0 ? basicOrder.getSaleAmount() : basicOrder.getOtherFee().add(price));
|
|
|
break;
|
|
|
case MUSICAL:
|
|
|
if (orderDetail.getKitGroupPurchaseType() != null && orderDetail.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
|
- basicOrder.setLeaseFee(basicOrder.getLeaseFee().add(price));
|
|
|
+ basicOrder.setLeaseFee(basicOrder.getLeaseFee().add(price)
|
|
|
+ .compareTo(basicOrder.getSaleAmount()) > 0 ? basicOrder.getSaleAmount() : basicOrder.getLeaseFee().add(price));
|
|
|
} else {
|
|
|
- basicOrder.setMusicalFee(basicOrder.getMusicalFee().add(price));
|
|
|
+ basicOrder.setMusicalFee(basicOrder.getMusicalFee().add(price)
|
|
|
+ .compareTo(basicOrder.getSaleAmount()) > 0 ? basicOrder.getSaleAmount() : basicOrder.getMusicalFee().add(price));
|
|
|
}
|
|
|
break;
|
|
|
case TEACHING:
|
|
|
case ACCESSORIES:
|
|
|
- basicOrder.setTeachingFee(basicOrder.getTeachingFee().add(price));
|
|
|
+ basicOrder.setTeachingFee(basicOrder.getTeachingFee().add(price)
|
|
|
+ .compareTo(basicOrder.getSaleAmount()) > 0 ? basicOrder.getSaleAmount() : basicOrder.getTeachingFee().add(price));
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -3306,13 +3327,16 @@ public class ExportServiceImpl implements ExportService {
|
|
|
case ACCESSORIES:
|
|
|
case TEACHING:
|
|
|
case STAFF:
|
|
|
- basicOrder.setTeachingFee(basicOrder.getTeachingFee().add(sellOrder.getActualAmount()));
|
|
|
+ basicOrder.setTeachingFee(basicOrder.getTeachingFee().add(sellOrder.getActualAmount())
|
|
|
+ .compareTo(basicOrder.getSaleAmount()) > 0 ? basicOrder.getSaleAmount() : basicOrder.getTeachingFee().add(sellOrder.getActualAmount()));
|
|
|
break;
|
|
|
case INSTRUMENT:
|
|
|
- basicOrder.setMusicalFee(basicOrder.getMusicalFee().add(sellOrder.getActualAmount()));
|
|
|
+ basicOrder.setMusicalFee(basicOrder.getMusicalFee().add(sellOrder.getActualAmount())
|
|
|
+ .compareTo(basicOrder.getSaleAmount()) > 0 ? basicOrder.getSaleAmount() : basicOrder.getMusicalFee().add(sellOrder.getActualAmount()));
|
|
|
break;
|
|
|
case OTHER:
|
|
|
- basicOrder.setOtherFee(basicOrder.getOtherFee().add(sellOrder.getActualAmount()));
|
|
|
+ basicOrder.setOtherFee(basicOrder.getOtherFee().add(sellOrder.getActualAmount())
|
|
|
+ .compareTo(basicOrder.getSaleAmount()) > 0 ? basicOrder.getSaleAmount() : basicOrder.getOtherFee().add(sellOrder.getActualAmount()));
|
|
|
break;
|
|
|
}
|
|
|
}
|