|
@@ -140,6 +140,9 @@ public class ExportController extends BaseController {
|
|
|
@Autowired
|
|
|
private MusicGroupQuitService musicGroupQuitService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TeacherCourseStatisticsService teacherCourseStatisticsService;
|
|
|
+
|
|
|
@ApiOperation(value = "班级列表导出")
|
|
|
@PostMapping("export/classGroup")
|
|
|
@PreAuthorize("@pcs.hasPermissions('export/classGroup')")
|
|
@@ -2559,4 +2562,60 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "运营预警导出")
|
|
|
+ @RequestMapping("export/teacherCourseStatistics")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/teacherCourseStatistics')")
|
|
|
+ public void teacherServeInfo(TeacherCourseStatisticsQueryInfo queryInfo, HttpServletResponse response) throws IOException {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败");
|
|
|
+ }
|
|
|
+ Employee employee = employeeService.get(sysUser.getId());
|
|
|
+ if (StringUtils.isBlank(queryInfo.getOrganId())) {
|
|
|
+ queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
+ }else if(StringUtils.isEmpty(employee.getOrganIdList())){
|
|
|
+ throw new BizException("用户所在分部异常");
|
|
|
+ }else {
|
|
|
+ List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
+ if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
|
|
|
+ throw new BizException("非法请求");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ queryInfo.setPage(1);
|
|
|
+ queryInfo.setRows(49999);
|
|
|
+ PageInfo<TeacherCourseStatistics> result = teacherCourseStatisticsService.queryPageDetail(queryInfo);
|
|
|
+ if (CollectionUtils.isEmpty(result.getRows())) {
|
|
|
+ response.setStatus(200);
|
|
|
+ response.setContentType("Content-Type: application/json;charset=UTF-8");
|
|
|
+ response.getOutputStream().write("{\"data\": null, \"code\": 500, \"status\": false, \"msg\": \"没有可导出的记录\"}".getBytes());
|
|
|
+ response.flushBuffer();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+
|
|
|
+ try {
|
|
|
+ String[] header = {"月份", "分部", "老师", "专业", "乐团节数", "VIP结束", "网管节数",
|
|
|
+ "预计乐团课酬", "预计VIP课酬", "预计网管课酬", "预计课酬合计", "平均上课时长"};
|
|
|
+ String[] body = {"monthStr", "organName", "realName", "subjectListStr", "musicCourseNum", "vipCourseNum", "practiceCourseNum",
|
|
|
+ "expectMusicCourseSalary", "expectVipCourseSalary", "expectPracticeCourseSalary", "expectTotalSalary", "averageClassMinutes"};
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(header, body, result.getRows());
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=teacherDefaultSalary-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+ response.flushBuffer();
|
|
|
+ outputStream = response.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
+ outputStream.flush();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (outputStream != null) {
|
|
|
+ try {
|
|
|
+ outputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|