|
@@ -1647,6 +1647,21 @@ public class ExportServiceImpl implements ExportService {
|
|
|
if(org.apache.commons.collections.CollectionUtils.isNotEmpty(outOrderList)){
|
|
|
outOrderAmountMap = MapUtil.convertIntegerMap(sellOrderDao.sumOutOrderAmount(outOrderList));
|
|
|
}
|
|
|
+ List<Long> otherOrderIds = studentPaymentOrderExportDtos.stream().filter(e -> e.getGroupType() != GroupType.GOODS_SELL
|
|
|
+ && e.getGroupType() != GroupType.REPLACEMENT
|
|
|
+ && e.getGroupType() != GroupType.PRACTICE
|
|
|
+ && e.getGroupType() != GroupType.SPORADIC
|
|
|
+ && e.getGroupType() != GroupType.MEMBER
|
|
|
+ && e.getGroupType() != GroupType.ACTIVITY
|
|
|
+ && e.getGroupType() != GroupType.VIP).map(e -> e.getId()).collect(Collectors.toList());
|
|
|
+ Map<Long, List<StudentPaymentOrderExportDto>> feeByTypeMap = new HashMap<>();
|
|
|
+ Map<Long, BigDecimal> childRepairMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(otherOrderIds)){
|
|
|
+ List<StudentPaymentOrderExportDto> feeByType = sellOrderDao.queryFeeByType(otherOrderIds);
|
|
|
+ feeByTypeMap = feeByType.stream().collect(Collectors.groupingBy(StudentPaymentOrderExportDto::getId));
|
|
|
+ childRepairMap = MapUtil.convertIntegerMap(sellOrderDao.queryChildRepair(otherOrderIds));
|
|
|
+ }
|
|
|
+
|
|
|
for (StudentPaymentOrderExportDto row : studentPaymentOrderExportDtos) {
|
|
|
if (row.getActualAmount() == null) {
|
|
|
row.setActualAmount(BigDecimal.ZERO);
|
|
@@ -1889,27 +1904,39 @@ public class ExportServiceImpl implements ExportService {
|
|
|
row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.LARGE_MUSICAL);
|
|
|
}
|
|
|
} else {
|
|
|
- StudentPaymentOrderExportDto feeByType = sellOrderDao.getFeeByType(row.getId());
|
|
|
- BigDecimal childRepairFee = sellOrderDao.getChildRepair(row.getId());
|
|
|
- row.setMusicalFee(feeByType.getMusicalFee());
|
|
|
- row.setTeachingFee(feeByType.getTeachingFee().subtract(childRepairFee));
|
|
|
- row.setMaintenanceProductFee(feeByType.getRepairFee().add(childRepairFee));
|
|
|
- row.setOtherFee(feeByType.getOtherFee());
|
|
|
- if (row.getGroupType().equals(GroupType.MUSIC)) {
|
|
|
- StudentRegistration studentRegistration = studentRegistrationDao.findStudentByMusicGroupIdAndUserId(row.getMusicGroupId(), row.getUserId());
|
|
|
- if (studentRegistration != null) {
|
|
|
- row.setSubjectName(studentRegistration.getSubjectName());
|
|
|
- row.setSchoolName(studentRegistration.getSchoolName());
|
|
|
- row.setCooperationOrganName(studentRegistration.getRemark());
|
|
|
- row.setEduTeacher(studentRegistration.getName());
|
|
|
+ List<StudentPaymentOrderExportDto> exportDtoList = feeByTypeMap.get(row.getId());
|
|
|
+ if(!CollectionUtils.isEmpty(exportDtoList)){
|
|
|
+ StudentPaymentOrderExportDto feeByType = exportDtoList.get(0);
|
|
|
+ BigDecimal childRepairFee = childRepairMap.get(row.getId()) == null?BigDecimal.ZERO:childRepairMap.get(row.getId());
|
|
|
+// StudentPaymentOrderExportDto feeByType = sellOrderDao.getFeeByType(row.getId());
|
|
|
+// BigDecimal childRepairFee = sellOrderDao.getChildRepair(row.getId());
|
|
|
+ row.setMusicalFee(feeByType.getMusicalFee());
|
|
|
+ row.setTeachingFee(feeByType.getTeachingFee().subtract(childRepairFee));
|
|
|
+ row.setMaintenanceProductFee(feeByType.getRepairFee().add(childRepairFee));
|
|
|
+ row.setOtherFee(feeByType.getOtherFee());
|
|
|
+ if (row.getGroupType().equals(GroupType.MUSIC)) {
|
|
|
+ if(row.getType() != OrderTypeEnum.APPLY && row.getType() != OrderTypeEnum.ADD_STUDENT){
|
|
|
+ //判断之前是否有付费订单,如果没有,那么是乐团转化
|
|
|
+ int orderNum = studentPaymentOrderDao.getStudentMusicOrderNum(row.getMusicGroupId(),row.getUserId(),row.getId());
|
|
|
+ if(orderNum == 0){
|
|
|
+ row.setTypeDesc(StudentPaymentOrderExportDto.TypeDesc.MUSIC_CONVERT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.findStudentByMusicGroupIdAndUserId(row.getMusicGroupId(), row.getUserId());
|
|
|
+ if (studentRegistration != null) {
|
|
|
+ row.setSubjectName(studentRegistration.getSubjectName());
|
|
|
+ row.setSchoolName(studentRegistration.getSchoolName());
|
|
|
+ row.setCooperationOrganName(studentRegistration.getRemark());
|
|
|
+ row.setEduTeacher(studentRegistration.getName());
|
|
|
+ }
|
|
|
+ row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(row.getTeachingFee()).subtract(row.getMaintenanceFee()).subtract(row.getMaintenanceProductFee()).subtract(feeByType.getOtherFee()).subtract(row.getLeaseFee()).subtract(row.getCloudTeacherFee()));
|
|
|
+ } else if (row.getType().equals(OrderTypeEnum.REPAIR)) {
|
|
|
+ row.setRepairFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(feeByType.getTeachingFee()).subtract(feeByType.getOtherFee()));
|
|
|
+ } else if (row.getType().equals(OUTORDER)) {
|
|
|
+ row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(row.getTeachingFee()).subtract(row.getMaintenanceProductFee()).subtract(feeByType.getOtherFee()));
|
|
|
+ row.setTransferFee(BigDecimal.ZERO);
|
|
|
+ row.setPlatformFee(BigDecimal.ZERO);
|
|
|
}
|
|
|
- row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(row.getTeachingFee()).subtract(row.getMaintenanceFee()).subtract(row.getMaintenanceProductFee()).subtract(feeByType.getOtherFee()).subtract(row.getLeaseFee()).subtract(row.getCloudTeacherFee()));
|
|
|
- } else if (row.getType().equals(OrderTypeEnum.REPAIR)) {
|
|
|
- row.setRepairFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(feeByType.getTeachingFee()).subtract(feeByType.getOtherFee()));
|
|
|
- } else if (row.getType().equals(OUTORDER)) {
|
|
|
- row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(row.getTeachingFee()).subtract(row.getMaintenanceProductFee()).subtract(feeByType.getOtherFee()));
|
|
|
- row.setTransferFee(BigDecimal.ZERO);
|
|
|
- row.setPlatformFee(BigDecimal.ZERO);
|
|
|
}
|
|
|
}
|
|
|
//如果合作单位不存在取学员的第一个乐团的合作单位,乐团主管
|