|
@@ -3301,4 +3301,96 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "分部云教练活动统计数据导出")
|
|
|
+ @RequestMapping("export/countCloudTeacherActive")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/countCloudTeacherActive')")
|
|
|
+ public void countCloudTeacherActive(CloudTeacherActiveQueryInfo queryInfo,HttpServletResponse response) throws IOException {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败");
|
|
|
+ }
|
|
|
+ Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ queryInfo.setPage(1);
|
|
|
+ queryInfo.setRows(49999);
|
|
|
+ List<Integer> organIds = new ArrayList<>();
|
|
|
+ if(StringUtils.isNotBlank(queryInfo.getOrganIds())){
|
|
|
+ organIds = Arrays.stream(queryInfo.getOrganIds().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList());
|
|
|
+ }else if(StringUtils.isNotBlank(employee.getOrganIdList())){
|
|
|
+ organIds = Arrays.stream(employee.getOrganIdList().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ List<Integer> ids = organIds.stream().filter(id -> !OrganizationService.EXCLUDE_ORGAN_IDS.contains(id)).collect(Collectors.toList());
|
|
|
+ Object object = studentService.countCloudTeacherActive(ids, queryInfo).get("resultList");
|
|
|
+ if(object == null){
|
|
|
+ throw new BizException("没有可导出的记录");
|
|
|
+ }
|
|
|
+ List<CloudTeacherActiveTargetDto> rows = (List<CloudTeacherActiveTargetDto>) object;
|
|
|
+
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ try {
|
|
|
+ String[] header = {"分部", "购买人数", "人均购买金额", "总人数", "购买率", "目标人数", "目标达成率"};
|
|
|
+ String[] body = {"organName", "buyNum", "avgBuyAmount", "totalNum", "buyScale",
|
|
|
+ "targetNum", "targetFinishScale"};
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "分部云教练学员训练数据导出")
|
|
|
+ @RequestMapping("export/countCloudTeacherActiveDetail")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/countCloudTeacherActiveDetail')")
|
|
|
+ public void countCloudTeacherActiveDetail(CloudTeacherActiveQueryInfo queryInfo,HttpServletResponse response) throws IOException {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败");
|
|
|
+ }
|
|
|
+ queryInfo.setPage(1);
|
|
|
+ queryInfo.setRows(49999);
|
|
|
+ List<CloudTeacherActiveTargetDetailDto> rows = studentService.countCloudTeacherActiveDetail(queryInfo).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;
|
|
|
+ }
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ try {
|
|
|
+ String[] header = {"学员编号", "学员", "合作单位", "乐团", "乐团模式", "声部", "年级", "指导老师", "购买套餐", "购买金额"};
|
|
|
+ String[] body = {"userId", "username", "cooperationName", "musicGroupName", "chargeType",
|
|
|
+ "subjectName", "currentGradeNum", "teacherName", "remark", "amount"};
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|