|
@@ -1563,7 +1563,7 @@ public class ExportServiceImpl implements ExportService {
|
|
|
if (count > 50000) {
|
|
|
return BaseController.failed("数据集太大,不能导出.最大数据集不能超过50000");
|
|
|
}
|
|
|
- ManagerDownload managerDownload = saveManagerDownload(ExportTypeEnum.ORDER,sysUser.getId());
|
|
|
+ ManagerDownload managerDownload = saveManagerDownload(ExportTypeEnum.ORDER_LIST_SUM,sysUser.getId());
|
|
|
ExecutorService executor = Executors.newCachedThreadPool();
|
|
|
CompletableFuture.runAsync(()->{
|
|
|
try {
|
|
@@ -1647,6 +1647,20 @@ 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) {
|
|
@@ -1890,27 +1904,42 @@ 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()).
|
|
|
+ subtract(row.getVipCourseFee()).subtract(row.getPracticeCourseFee()));
|
|
|
+ } 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);
|
|
|
}
|
|
|
}
|
|
|
//如果合作单位不存在取学员的第一个乐团的合作单位,乐团主管
|
|
@@ -1994,6 +2023,20 @@ 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);
|
|
@@ -2144,18 +2187,24 @@ public class ExportServiceImpl implements ExportService {
|
|
|
row.setLargeMusicalFee(row.getActualAmount());
|
|
|
}
|
|
|
} 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)) {
|
|
|
- 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()));
|
|
|
+ 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());
|
|
|
+ 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)) {
|
|
|
+ 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()).
|
|
|
+ subtract(row.getVipCourseFee()).subtract(row.getPracticeCourseFee()));
|
|
|
+ } 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.setRepairFee(row.getRepairFee().add(row.getMaintenanceProductFee()));
|
|
@@ -3007,9 +3056,12 @@ public class ExportServiceImpl implements ExportService {
|
|
|
"回访状态","原因","回访日期"},
|
|
|
new String[]{"studentBasicInfo.organName", "studentBasicInfo.userName", "studentBasicInfo.userId",
|
|
|
"studentBasicInfo.phone","studentBasicInfo.subjectName", "studentBasicInfo.cooperationOrganName", "studentBasicInfo.grade",
|
|
|
- "overCourseNum > 0 && subCourseNum > 0 && latelyYearCourseConsumer < 1 ? '沉睡' : (noScheduleNum > 0 || subCourseNum > 0) && (latelyYearCourseConsumer > 0 || overCourseNum <= 0) ? '在读':''",
|
|
|
+ "studentBasicInfo.studentStatus",
|
|
|
"noScheduleNum","totalCourseNum", "overCourseNum", "subCourseNum","preCourseFee","firstCourseTime","lastCourseTime","teacherId","teacherName","musicDirectorId","musicDirectorName",
|
|
|
- "studentBasicInfo.subjectTeacherId","studentBasicInfo.subjectTeacherName","latelyCourseConsumer","visitNum","lastVisitStatus","visitReason","lastVisitTime"}, rows);
|
|
|
+ "studentBasicInfo.subjectTeacherId","studentBasicInfo.subjectTeacherName","latelyCourseConsumer","visitNum",
|
|
|
+ "lastVisitStatus == null?'':lastVisitStatus == 'LOST' ? '流失':lastVisitStatus == 'THINKING' ? '考虑中':" +
|
|
|
+ "lastVisitStatus == 'PENDING_PAYMENT' ? '确认缴费待缴费':lastVisitStatus == 'PAUSE' ? '暂停':lastVisitStatus == 'OTHER' ? '其他':''"
|
|
|
+ ,"visitReason","lastVisitTime"}, rows);
|
|
|
|
|
|
workbook.write(fileOutputStream);
|
|
|
fileOutputStream.getFD().sync();
|