| | |
| | | return R.status(result); |
| | | } |
| | | |
| | | /** |
| | | * 导入保安员制证时间 |
| | | */ |
| | | @PostMapping("import-security-paperTime") |
| | | @ApiOperationSupport(order = 12) |
| | | @ApiOperation(value = "导入用户", notes = "传入excel") |
| | | public R importSecurityPaperTime(MultipartFile file, Integer isCovered, String deptId) { |
| | | UserCertificateExcelImporter userCertificateExcelImporter = new UserCertificateExcelImporter(userService, false, deptId); |
| | | ExcelUtil.save(file, userCertificateExcelImporter, UserCertificateExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 保安员制证时间导出模板 |
| | | */ |
| | | @GetMapping("export-template-security-paperTime") |
| | | @ApiOperationSupport(order = 14) |
| | | @ApiOperation(value = "导出模板") |
| | | public void exportPaperTimeExcelTemplate(HttpServletResponse response) throws IOException { |
| | | List<UserCertificateExcel> list = new ArrayList<>(); |
| | | UserCertificateExcel userCertificateExcel = new UserCertificateExcel(); |
| | | userCertificateExcel.setRealName("张三"); |
| | | userCertificateExcel.setCardid("360XXX19XXXXXX****"); |
| | | userCertificateExcel.setPaperTime("2023-12-26"); |
| | | |
| | | list.add(userCertificateExcel); |
| | | |
| | | String fileName = null; |
| | | try { |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name()); |
| | | fileName = URLEncoder.encode("发证时间导入数据模板" + DateUtil.time(), Charsets.UTF_8.name()); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | //修改单元格格式为文本格式 |
| | | EasyExcel.write(response.getOutputStream(), UserCertificateExcel.class).sheet("发证时间导入数据表").registerWriteHandler(new RowWriteHandler()).doWrite(list); |
| | | } catch (Throwable var6) { |
| | | throw var6; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |