| | |
| | | return R.fail("未查询到用户"); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "报到党员管理导出Excel") |
| | | @PostMapping("/member/report/export") |
| | | public R exportPbreportMember(@RequestBody PagePartyOrganizationVO pagePartyOrganizationVO) { |
| | | pagePartyOrganizationVO.setCommunityId(this.getCommunityId()); |
| | | String name = "报道党员管理导出表.xlsx"; |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | // 用户搜索了就下载搜索的用户否则下载所有用户 |
| | | String[] area={"东区","仁和区","米易县","盐边县","西区","钒钛高新区"}; |
| | | Long[] ids = {1584725574201409537L,1584725574771834881L,1584725575031881730L,1584725575593918466L, |
| | | 1584725576118206466L,1584725576416002050L,1584725576667660289L,1584725576952872961L,1584725577238085633L, |
| | | 1584725577854648322L,1584725578626400258L,1584725579213602817L,1584725579867914241L,1584725580505448449L, |
| | | 1584725580815826946L,1584725581386252289L,1584725581671464962L,1584726087093485569L,1584726087433224193L, |
| | | 1584726088058175490L,1584726088880259073L,1584726089442295809L,1584726091128406018L,1584726091694637058L, |
| | | 1584726092537692162L,1584726093053591554L,1584726093779206146L,1584726094655815681L}; |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | if(ArrayUtil.contains(area, loginUserInfo.getName())){ |
| | | pagePartyOrganizationVO.setBelongTo(loginUserInfo.getName()); |
| | | } |
| | | Long communityId = pagePartyOrganizationVO.getCommunityId(); |
| | | if (null!= communityId && communityId == 0L){ |
| | | pagePartyOrganizationVO.setCommunityId(null); |
| | | } |
| | | if(loginUserInfo.getBindingCheckUnitId()!=null){ |
| | | pagePartyOrganizationVO.setCheckUnitId(loginUserInfo.getBindingCheckUnitId()); |
| | | } |
| | | if ("PZHZGNYYH".equals(loginUserInfo.getAccount())){ |
| | | pagePartyOrganizationVO.setIds(ids); |
| | | } |
| | | R r = partyBuildingService.pagePartyOrganization(pagePartyOrganizationVO); |
| | | if (R.isOk(r)) { |
| | | List<ManagementRegisteredExcelVO> eexcelUserDTOS = |
| | | JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ManagementRegisteredExcelVO.class); |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | excelWriter = EasyExcel.write(fileName, ManagementRegisteredExcelVO.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("报到党员管理信息导出").build(); |
| | | excelWriter.write(eexcelUserDTOS, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(url + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | return R.fail("未查询到用户"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "批量上传照片/视频 (jpg/jpeg/png/mp4/mov)") |
| | | @PostMapping(value = "uploads", consumes = "multipart/*", headers = "content-type=multipart/form-date") |
| | | public R uploadImages(@RequestParam MultipartFile[] files, HttpServletRequest request) { |