|
@@ -3245,4 +3245,53 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "分部云教练学员训练数据导出")
|
|
|
+ @RequestMapping("export/cloudStudyStudentTrainData")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/cloudStudyStudentTrainData')")
|
|
|
+ public void cloudStudyStudentTrainData(StudentQueryInfo queryInfo,HttpServletResponse response) throws IOException {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败");
|
|
|
+ }
|
|
|
+ queryInfo.setPage(1);
|
|
|
+ queryInfo.setRows(49999);
|
|
|
+
|
|
|
+ List<EduOrganStudentListDto> rows = ((PageInfo<EduOrganStudentListDto>)studentService.organStudentData(queryInfo).getDetail()).getRows();
|
|
|
+ if (CollectionUtils.isEmpty(rows)) {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ for (EduOrganStudentListDto row : rows) {
|
|
|
+ row.setCloudStudyUseTime(Math.round(row.getCloudStudyUseTime()));
|
|
|
+ row.setCloudStudyUseAvgTime(Math.round(row.getCloudStudyUseAvgTime()));
|
|
|
+ }
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ try {
|
|
|
+ String[] header = {"学员编号", "学员", "训练总时长", "连续训练天数", "乐团", "指导老师", "声部", "是否有小课", "训练次数", "训练天数", "训练平均时长", "会员有效期"};
|
|
|
+ String[] body = {"studentId", "studentName", "cloudStudyUseTime+\"分钟\"", "cloudStudyRunningDays+\"天\"", "musicGroupNames",
|
|
|
+ "teacherName", "subjectName", "hasVipGroup>0?\"是\":\"否\"", "cloudStudyUseNum+\"次\"", "cloudStudyUseDays+\"天\"",
|
|
|
+ "cloudStudyUseAvgTime+\"分钟\"", "membershipEndTime"};
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(header, body, rows);
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=employeeInfo-" + 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|