|
|
@@ -215,7 +215,7 @@ public class ExportServiceImpl implements ExportService {
|
|
|
exportEnum = ExportEnum.ORDER_LIST2;
|
|
|
}
|
|
|
}else if(exportEnum == ExportEnum.ROUTE_ORDER_LIST1 || exportEnum == ExportEnum.ROUTE_ORDER_LIST2){
|
|
|
- if(sysUser.getTenantId() <= 0){
|
|
|
+ if(sysUser.getTenantId() <= 1){
|
|
|
exportEnum = ExportEnum.ROUTE_ORDER_LIST1;
|
|
|
}else {
|
|
|
exportEnum = ExportEnum.ROUTE_ORDER_LIST2;
|
|
|
@@ -344,6 +344,8 @@ public class ExportServiceImpl implements ExportService {
|
|
|
exportManageFuncMap.put(ExportEnum.ORDER_LIST1, (info,headColumns) -> orderList(info,headColumns));
|
|
|
exportManageFuncMap.put(ExportEnum.ORDER_LIST2, (info,headColumns) -> orderList(info,headColumns));
|
|
|
exportManageFuncMap.put(ExportEnum.STUDENT_VIP_PRACTICE, (info,headColumns) -> exportStudentVipPractice(info,headColumns));
|
|
|
+ exportManageFuncMap.put(ExportEnum.STUDENT_VIP_COURSE_INFO, (info,headColumns) -> exportStudentVipCourseInfo(info,headColumns));
|
|
|
+ exportManageFuncMap.put(ExportEnum.STUDENT_MUSIC_THEORY_COURSE_INFO, (info,headColumns) -> exportStudentMusicTheoryCourseInfo(info,headColumns));
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1389,11 +1391,14 @@ public class ExportServiceImpl implements ExportService {
|
|
|
}
|
|
|
queryInfo.setRoutingOrganId(null);
|
|
|
ManagerDownload managerDownload = saveManagerDownload(ExportTypeEnum.ROUTE_ORDER,sysUser.getId());
|
|
|
- try {
|
|
|
- this.routeOrderList(params, managerDownload, headColumns);
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- return BaseController.failed(e.getMessage());
|
|
|
- }
|
|
|
+ ExecutorService executor = Executors.newCachedThreadPool();
|
|
|
+ CompletableFuture.runAsync(()->{
|
|
|
+ try {
|
|
|
+ this.routeOrderList(params, managerDownload, headColumns);
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ },executor);
|
|
|
HttpResponseResult<Object> succeed = BaseController.succeed();
|
|
|
succeed.setMsg(managerDownload.getName() + "导出申请已提交,请到【报表中心-下载列表查看】");
|
|
|
return succeed;
|
|
|
@@ -1410,11 +1415,62 @@ public class ExportServiceImpl implements ExportService {
|
|
|
Integer tenantId = TenantContextHolder.getTenantId();
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
ManagerDownload managerDownload = saveManagerDownload(ExportTypeEnum.STUDENT_VIP_PRACTICE,sysUser.getId());
|
|
|
- try {
|
|
|
- this.studentVipPractice(organId, managerDownload, tenantId,headColumns);
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- return BaseController.failed(e.getMessage());
|
|
|
+ ExecutorService executor = Executors.newCachedThreadPool();
|
|
|
+ CompletableFuture.runAsync(()->{
|
|
|
+ try {
|
|
|
+ this.studentVipPractice(organId, managerDownload, tenantId,headColumns);
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ },executor);
|
|
|
+ HttpResponseResult<Object> succeed = BaseController.succeed();
|
|
|
+ succeed.setMsg(managerDownload.getName() + "导出申请已提交,请到【报表中心-下载列表查看】");
|
|
|
+ return succeed;
|
|
|
+ }
|
|
|
+
|
|
|
+ //学员小课记录导出
|
|
|
+ @Override
|
|
|
+ public HttpResponseResult exportStudentVipCourseInfo(Map<String, Object> info, List<String> headColumns){
|
|
|
+ String organId = getParam(info, "organId", String.class);
|
|
|
+ Integer tenantId = TenantContextHolder.getTenantId();
|
|
|
+ Boolean hasCourse = courseScheduleStudentPaymentDao.hasStudentMusicTheoryCourseInfo(organId, tenantId,"VIP");
|
|
|
+ if (hasCourse == null || !hasCourse) {
|
|
|
+ return BaseController.failed("没有可导出的数据");
|
|
|
}
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ ManagerDownload managerDownload = saveManagerDownload(ExportTypeEnum.STUDENT_VIP_COURSE_INFO,sysUser.getId());
|
|
|
+ ExecutorService executor = Executors.newCachedThreadPool();
|
|
|
+ CompletableFuture.runAsync(()->{
|
|
|
+ try {
|
|
|
+ this.queryStudentCourseInfo(organId, tenantId,"VIP", managerDownload,headColumns,ExportEnum.STUDENT_VIP_COURSE_INFO);
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ },executor);
|
|
|
+ HttpResponseResult<Object> succeed = BaseController.succeed();
|
|
|
+ succeed.setMsg(managerDownload.getName() + "导出申请已提交,请到【报表中心-下载列表查看】");
|
|
|
+ return succeed;
|
|
|
+ }
|
|
|
+
|
|
|
+ //学员小课记录导出
|
|
|
+ @Override
|
|
|
+ public HttpResponseResult exportStudentMusicTheoryCourseInfo(Map<String, Object> info, List<String> headColumns){
|
|
|
+ String organId = getParam(info, "organId", String.class);
|
|
|
+ Integer tenantId = TenantContextHolder.getTenantId();
|
|
|
+ Boolean hasCourse = courseScheduleStudentPaymentDao.hasStudentMusicTheoryCourseInfo(organId, tenantId,"THEORY");
|
|
|
+ if (hasCourse == null || !hasCourse) {
|
|
|
+ return BaseController.failed("没有可导出的数据");
|
|
|
+ }
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ ManagerDownload managerDownload = saveManagerDownload(ExportTypeEnum.STUDENT_MUSIC_THEORY_COURSE_INFO,sysUser.getId());
|
|
|
+ ExecutorService executor = Executors.newCachedThreadPool();
|
|
|
+ CompletableFuture.runAsync(()->{
|
|
|
+ try {
|
|
|
+ this.queryStudentCourseInfo(organId, tenantId,"THEORY", managerDownload,headColumns,ExportEnum.STUDENT_MUSIC_THEORY_COURSE_INFO);
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ },executor);
|
|
|
HttpResponseResult<Object> succeed = BaseController.succeed();
|
|
|
succeed.setMsg(managerDownload.getName() + "导出申请已提交,请到【报表中心-下载列表查看】");
|
|
|
return succeed;
|
|
|
@@ -1447,11 +1503,14 @@ public class ExportServiceImpl implements ExportService {
|
|
|
return BaseController.failed("数据集太大,不能导出.最大数据集不能超过50000");
|
|
|
}
|
|
|
ManagerDownload managerDownload = saveManagerDownload(ExportTypeEnum.ORDER,sysUser.getId());
|
|
|
- try {
|
|
|
- this.orderList(params, managerDownload, headColumns);
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- return BaseController.failed(e.getMessage());
|
|
|
- }
|
|
|
+ ExecutorService executor = Executors.newCachedThreadPool();
|
|
|
+ CompletableFuture.runAsync(()->{
|
|
|
+ try {
|
|
|
+ this.orderList(params, managerDownload, headColumns);
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ },executor);
|
|
|
HttpResponseResult<Object> succeed = BaseController.succeed();
|
|
|
succeed.setMsg(managerDownload.getName() + "导出申请已提交,请到【报表中心-下载列表查看】");
|
|
|
return succeed;
|
|
|
@@ -1476,11 +1535,14 @@ public class ExportServiceImpl implements ExportService {
|
|
|
return BaseController.failed("数据集太大,不能导出.最大数据集不能超过50000");
|
|
|
}
|
|
|
ManagerDownload managerDownload = saveManagerDownload(ExportTypeEnum.COURSE_SCHEDULE,sysUser.getId());
|
|
|
- try {
|
|
|
- this.superFindCourseSchedules(queryInfo, managerDownload);
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- return BaseController.failed(e.getMessage());
|
|
|
- }
|
|
|
+ ExecutorService executor = Executors.newCachedThreadPool();
|
|
|
+ CompletableFuture.runAsync(()->{
|
|
|
+ try {
|
|
|
+ this.superFindCourseSchedules(queryInfo, managerDownload);
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ },executor);
|
|
|
HttpResponseResult<Object> succeed = BaseController.succeed();
|
|
|
succeed.setMsg(managerDownload.getName() + "导出申请已提交,请到【报表中心-下载列表查看】");
|
|
|
return succeed;
|
|
|
@@ -1497,7 +1559,7 @@ public class ExportServiceImpl implements ExportService {
|
|
|
.append(DateUtil.getDate(nowDate))
|
|
|
.append(".xls").toString();
|
|
|
ManagerDownload managerDownload = new ManagerDownload();
|
|
|
- managerDownload.setType(ExportTypeEnum.COURSE_SCHEDULE);
|
|
|
+ managerDownload.setType(exportTypeEnum);
|
|
|
managerDownload.setUserId(userId);
|
|
|
managerDownload.setName(fileName);
|
|
|
managerDownload.setFileUrl("");
|
|
|
@@ -1509,7 +1571,6 @@ public class ExportServiceImpl implements ExportService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- @Async
|
|
|
public void orderList(Map<String, Object> params, ManagerDownload managerDownload,List<String> headColumns) throws FileNotFoundException {
|
|
|
List<StudentPaymentOrderExportDto> studentPaymentOrderExportDtos = studentPaymentOrderService.ExportQueryPage(params);
|
|
|
long i = 1;
|
|
|
@@ -1826,7 +1887,6 @@ public class ExportServiceImpl implements ExportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Async
|
|
|
public void routeOrderList(Map<String, Object> params, ManagerDownload managerDownload,List<String> headColumns) throws FileNotFoundException {
|
|
|
List<StudentPaymentOrderExportDto> studentPaymentOrderExportDtos = studentPaymentRouteOrderDao.ExportQueryPage(params);
|
|
|
|
|
|
@@ -2339,7 +2399,6 @@ public class ExportServiceImpl implements ExportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Async
|
|
|
public void superFindCourseSchedules(EndCourseScheduleQueryInfo queryInfo, ManagerDownload managerDownload) throws FileNotFoundException {
|
|
|
List<CourseScheduleEndDto> rows = courseScheduleService.endFindCourseSchedules(queryInfo).getRows();
|
|
|
for (CourseScheduleEndDto row : rows) {
|
|
|
@@ -2380,7 +2439,6 @@ public class ExportServiceImpl implements ExportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Async
|
|
|
public void studentVipPractice(String organId, ManagerDownload managerDownload, Integer tenantId,List<String> headColumns) throws FileNotFoundException {
|
|
|
List<StudentVipPracticeExportDto> studentVipPracticeExportDtos = courseScheduleStudentPaymentDao.exportStudentVipPractice(organId, tenantId);
|
|
|
if(studentVipPracticeExportDtos != null && studentVipPracticeExportDtos.size() > 0){
|
|
|
@@ -2418,10 +2476,6 @@ public class ExportServiceImpl implements ExportService {
|
|
|
|
|
|
HSSFWorkbook workbook = null;
|
|
|
try {
|
|
|
- /*String[] header = {"分部", "学员编号", "学生姓名", "课程余额", "声部", "VIP已结束课时数", "VIP未开始课时数", "已结束VIP上课老师编号", "已结束VIP上课老师",
|
|
|
- "网管课已结束课时数", "网管课未开始课时数", "已结束网管课上课老师编号", "已结束网管课上课老师", "指导老师编号", "指导老师"};
|
|
|
- String[] body = {"organName","userId", "username","courseBalance", "subjectName", "vipOverNum", "vipNotStartNum", "vipOverTeacherId", "vipOverTeacherName"
|
|
|
- , "practiceOverNum", "practiceNotStartNum", "practiceOverTeacherId", "practiceOverTeacherName","teacherId","teacherName"};*/
|
|
|
Map<String, String> headMap = getExportMap(new ExportDto(ExportEnum.STUDENT_VIP_PRACTICE, headColumns));
|
|
|
String[] header = headMap.keySet().toArray(new String[headMap.keySet().size()]);
|
|
|
String[] body = headMap.values().toArray(new String[headMap.keySet().size()]);
|
|
|
@@ -2448,4 +2502,40 @@ public class ExportServiceImpl implements ExportService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void queryStudentCourseInfo(String organId, Integer tenantId, String groupType, ManagerDownload managerDownload, List<String> headColumns,ExportEnum exportEnum) throws FileNotFoundException {
|
|
|
+ List<ExportStudentCourseInfoDto> studentCourseInfoDtos = courseScheduleStudentPaymentDao.queryStudentCourseInfo(organId,tenantId,groupType);
|
|
|
+ String basePath = new ApplicationHome(this.getClass()).getSource().getParentFile().getPath();
|
|
|
+ File file = new File(basePath + "/" + managerDownload.getName());
|
|
|
+ FileOutputStream fileOutputStream = new FileOutputStream(file);
|
|
|
+
|
|
|
+ HSSFWorkbook workbook = null;
|
|
|
+ try {
|
|
|
+ Map<String, String> headMap = getExportMap(new ExportDto(exportEnum, headColumns));
|
|
|
+ String[] header = headMap.keySet().toArray(new String[headMap.keySet().size()]);
|
|
|
+ String[] body = headMap.values().toArray(new String[headMap.keySet().size()]);
|
|
|
+ workbook = POIUtil.exportExcel(header, body, studentCourseInfoDtos);
|
|
|
+ workbook.write(fileOutputStream);
|
|
|
+ fileOutputStream.getFD().sync();
|
|
|
+ fileOutputStream.close();
|
|
|
+
|
|
|
+ String folder = "download/" + UploadUtil.getFileFloder();
|
|
|
+ String url = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, folder, file);
|
|
|
+ //把记录插入下载表
|
|
|
+ managerDownload.setFileUrl(url);
|
|
|
+ managerDownload.setStatus(1);
|
|
|
+ managerDownloadDao.update(managerDownload);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ fileOutputStream.close();
|
|
|
+ workbook.close();
|
|
|
+ file.delete();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|