Browse Source

学员小课数据统计

zouxuan 3 years ago
parent
commit
3f681ab2a1

+ 42 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -169,6 +169,8 @@ public class ExportServiceImpl implements ExportService {
     private MusicGroupService musicGroupService;
     private MusicGroupService musicGroupService;
     @Autowired
     @Autowired
     private SysUserCashAccountLogService sysUserCashAccountLogService;
     private SysUserCashAccountLogService sysUserCashAccountLogService;
+    @Autowired
+    private StudentStatisticsService studentStatisticsService;
 
 
     @Value("${spring.profiles.active:dev}")
     @Value("${spring.profiles.active:dev}")
     private String profiles;
     private String profiles;
@@ -2732,4 +2734,44 @@ public class ExportServiceImpl implements ExportService {
             }
             }
         }
         }
     }
     }
+
+    @Override
+    public void exportStudentSmallClassStatisticsSum(StudentStatisticsQueryInfo queryInfo, ManagerDownload managerDownload) throws FileNotFoundException {
+        List<StudentStatisticsDto> rows = studentStatisticsService.queryStatisticsPage(queryInfo).getRows();
+        String basePath = new ApplicationHome(this.getClass()).getSource().getParentFile().getPath();
+        File file = new File(basePath + "/" + managerDownload.getName());
+        FileOutputStream fileOutputStream = new FileOutputStream(file);
+        OutputStream ouputStream = null;
+        try {
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部", "学生姓名", "学员编号","联系电话", "声部", "学校", "年级", "学员状态", "未排课时", "总课时", "已完成课时",
+                    "剩余课时","预收金额","第一次课时间","最近上课时间","指导老师编号","指导老师","乐团主管编号","乐团主管","声部课老师编号","声部课老师","近30天课耗","回访次数",
+                    "回访状态","原因","回访日期"},
+            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) ? '在读':''",
+                    "noScheduleNum","totalCourseNum", "overCourseNum", "subCourseNum","preCourseFee","firstCourseTime","lastCourseTime","teacherId","teacherName","musicDirectorId","musicDirectorName",
+                    "studentBasicInfo.subjectTeacherId","studentBasicInfo.subjectTeacherName","latelyCourseConsumer","visitNum","lastVisitStatus","visitReason","lastVisitTime"}, rows);
+
+            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 {
+            if (ouputStream != null) {
+                try {
+                    ouputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 }
 }