|
@@ -1152,4 +1152,59 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "课外训练-教学导出")
|
|
|
+ @GetMapping("export/isSettlementCourseSalarys")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/isSettlementCourseSalarys')")
|
|
|
+ public void isSettlementCourseSalarys(CourseSalaryQueryInfo4Web queryInfo, HttpServletResponse response) throws IOException {
|
|
|
+ queryInfo.setRows(999999999);
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败");
|
|
|
+ }
|
|
|
+ if (!sysUser.getIsSuperAdmin()) {
|
|
|
+ Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
|
|
|
+ queryInfo.setOrganIdList(employee.getOrganIdList());
|
|
|
+ } else if (org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())) {
|
|
|
+ throw new BizException("用户所在分部异常");
|
|
|
+ } else {
|
|
|
+ List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
+ if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
|
|
|
+ throw new BizException("非法请求");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<TeacherCourseSalaryDetail4WebDto> rows = courseScheduleTeacherSalaryService.findIsSettlementCourseSalarys(queryInfo).getRows();
|
|
|
+ if (CollectionUtils.isEmpty(rows)) {
|
|
|
+ response.setStatus(500);
|
|
|
+ response.setContentType("Content-Type: application/json;charset=UTF-8");
|
|
|
+ response.getOutputStream().write("{\"data\": null, \"code\": 500, \"status\": false, \"msg\": \"没有可导出的记录\"}".getBytes());
|
|
|
+ response.flushBuffer();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ OutputStream ouputStream = null;
|
|
|
+ try {
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(
|
|
|
+ new String[]{"分部", "课程组类型", "课程编号", "时间", "课程名称", "老师编号", "老师姓名", "签到时间", "签退时间", "应发课酬",
|
|
|
+ "课酬扣款", "结算课酬", "结算课酬", "状态", "备注"},
|
|
|
+ new String[]{"organName", "groupType", "courseScheduleId", "startClassTime", "courseName", "teacherId", "teacherName",
|
|
|
+ "signInTime", "signOutTime", "actualSalary", "reduceSalary", "actualSalary", "confirmStatus", "memo"}, rows);
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+ ouputStream = response.getOutputStream();
|
|
|
+ workbook.write(ouputStream);
|
|
|
+ ouputStream.flush();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (ouputStream != null) {
|
|
|
+ try {
|
|
|
+ ouputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|