| | |
| | | select * from lf.sys_attach where tab='lf.sys_style'; |
| | | select * from lf.sys_attach order by tab,tab_guid; |
| | | |
| | | |
| | | |
| | | select * from bs.s_survey_information 勘察信息表 |
| | | select * from bs.s_surveyworksite 勘察工点 |
| | | select * from lf.sys_download order by id desc; |
| | | |
| | | |
| | | |
| | |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.ctrl.DownloadReqEntity; |
| | | import com.lf.server.entity.sys.ResEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | |
| | | @ApiImplicitParam(name = "guids", value = "附件Guid数组", dataType = "String", paramType = "body", allowMultiple = true, example = "e5b6ae0889b88111f13a4b6e048348db,fa4f299e901a0c46e634f8fcc8185c0c") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadReq") |
| | | public ResponseMsg<Object> downloadReqForGuids(String[] guids, HttpServletRequest req, HttpServletResponse res) { |
| | | @PostMapping(value = "/downloadReqForGuids") |
| | | public ResponseMsg<Object> downloadReqForGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (null == guids || guids.length == 0) { |
| | | if (null == dre || null == dre.getGuids() || dre.getGuids().isEmpty()) { |
| | | return fail("Guid数组为空"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = uploadAttachService.downloadReqForGuids(ue, guids); |
| | | String guid = uploadAttachService.downloadReqForGuids(ue, dre.getGuids()); |
| | | |
| | | return success(""); |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | |
| | | @ApiImplicitParam(name = "guids", value = "附件Guid数组", dataType = "String", paramType = "body", allowMultiple = true, example = "08e5b4ad-93b8-46f6-adaa-46a6274af4ce,6f94f4f8-6e8d-44e7-8803-3d068d34983f") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadReq") |
| | | public ResponseMsg<Object> downloadReqForTabGuids(String tab, String[] guids, HttpServletRequest req, HttpServletResponse res) { |
| | | @PostMapping(value = "/downloadReqForTabGuids") |
| | | public ResponseMsg<Object> downloadReqForTabGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (StringHelper.isEmpty(tab)) { |
| | | if (null == dre || StringHelper.isEmpty(dre.getTab())) { |
| | | return fail("表名为空"); |
| | | } |
| | | if (null != guids && guids.length == 0) { |
| | | guids = null; |
| | | if (null != dre.getGuids() && dre.getGuids().size() == 0) { |
| | | dre.setIds(null); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | String guid = uploadAttachService.downloadReqForTabGuids(ue, tab, guids); |
| | | String guid = uploadAttachService.downloadReqForTabGuids(ue, dre.getTab(), dre.getGuids()); |
| | | |
| | | return success(guid); |
| | | } catch (Exception ex) { |
| | |
| | | |
| | | private String guid; |
| | | |
| | | private List<String> guids; |
| | | |
| | | private List<Integer> ids; |
| | | |
| | | private String wkt; |
| | | |
| | | private List<String> entities; |
| | | |
| | | private String tab; |
| | | |
| | | private List<String> tabs; |
| | | |
| | |
| | | this.guid = guid; |
| | | } |
| | | |
| | | public List<String> getGuids() { |
| | | return guids; |
| | | } |
| | | |
| | | public void setGuids(List<String> guids) { |
| | | this.guids = guids; |
| | | } |
| | | |
| | | public List<Integer> getIds() { |
| | | return ids; |
| | | } |
| | |
| | | this.wkt = wkt; |
| | | } |
| | | |
| | | public String getTab() { |
| | | return tab; |
| | | } |
| | | |
| | | public void setTab(String tab) { |
| | | this.tab = tab; |
| | | } |
| | | |
| | | public List<String> getTabs() { |
| | | return tabs; |
| | | } |
| | |
| | | f.delete(); |
| | | } |
| | | |
| | | ZipParameters params = getZipParams(); |
| | | ZipParameters params = getZipParams(!StringHelper.isEmpty(pwd)); |
| | | |
| | | // 要打包的文件或文件夹 |
| | | File currentFile = new File(sourcePath); |
| | |
| | | /** |
| | | * 获取ZipParameters |
| | | */ |
| | | public static ZipParameters getZipParams() { |
| | | public static ZipParameters getZipParams(boolean flag) { |
| | | // 设置压缩文件参数 |
| | | ZipParameters params = new ZipParameters(); |
| | | // 压缩方式 |
| | | params.setCompressionMethod(CompressionMethod.DEFLATE); |
| | | // 压缩级别 |
| | | params.setCompressionLevel(CompressionLevel.MAXIMUM); |
| | | // 是否设置加密文件 |
| | | params.setEncryptFiles(true); |
| | | // 设置AES加密强度:KEY_STRENGTH_256 |
| | | params.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_128); |
| | | // 设置加密算法 |
| | | params.setEncryptionMethod(EncryptionMethod.AES); |
| | | |
| | | if (flag) { |
| | | // 是否设置加密文件 |
| | | params.setEncryptFiles(true); |
| | | // 设置AES加密强度:KEY_STRENGTH_256 |
| | | params.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_128); |
| | | // 设置加密算法 |
| | | params.setEncryptionMethod(EncryptionMethod.AES); |
| | | } |
| | | |
| | | return params; |
| | | } |
| | |
| | | * @param guids |
| | | * @return |
| | | */ |
| | | public List<AttachEntity> selectByGuids(String[] guids); |
| | | public List<AttachEntity> selectByGuids(List<String> guids); |
| | | |
| | | /** |
| | | * 根据表名和GUID查询 |
| | |
| | | * @param guids |
| | | * @return |
| | | */ |
| | | public List<AttachEntity> selectByTabGuids(String tab, String[] guids); |
| | | public List<AttachEntity> selectByTabGuids(String tab, List<String> guids); |
| | | |
| | | /** |
| | | * 根据表和GUID查询 |
| | |
| | | /** |
| | | * 请求下载 |
| | | */ |
| | | public String downloadReqForGuids(UserEntity ue, String[] guids) { |
| | | public String downloadReqForGuids(UserEntity ue, List<String> guids) { |
| | | List<AttachEntity> list = attachService.selectByGuids(guids); |
| | | |
| | | return downloadReq(ue, list); |
| | |
| | | /** |
| | | * 请求下载 |
| | | */ |
| | | public String downloadReqForTabGuids(UserEntity ue, String tab, String[] guids) { |
| | | public String downloadReqForTabGuids(UserEntity ue, String tab, List<String> guids) { |
| | | List<AttachEntity> list = attachService.selectByTabGuids(tab, guids); |
| | | |
| | | return downloadReq(ue, list); |
| | |
| | | String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName; |
| | | |
| | | ZipFile zip = Zip4jHelper.createZipFile(zipFile, null); |
| | | ZipParameters params = Zip4jHelper.getZipParams(); |
| | | ZipParameters params = Zip4jHelper.getZipParams(false); |
| | | addZipFiles(zip, params, list); |
| | | |
| | | DownloadEntity downloadEntity = getDownloadEntity(ue, zipFile, null); |
| | |
| | | String zipFile = downloadPath + File.separator + zipName; |
| | | |
| | | ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd); |
| | | ZipParameters params = Zip4jHelper.getZipParams(); |
| | | ZipParameters params = Zip4jHelper.getZipParams(true); |
| | | addMetaFiles(zip, params, list); |
| | | |
| | | String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); |
| | |
| | | String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName; |
| | | |
| | | ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd); |
| | | ZipParameters params = Zip4jHelper.getZipParams(); |
| | | ZipParameters params = Zip4jHelper.getZipParams(true); |
| | | addZipFiles(zip, params, file.listFiles()); |
| | | |
| | | String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); |
| | |
| | | String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName; |
| | | |
| | | ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd); |
| | | ZipParameters params = Zip4jHelper.getZipParams(); |
| | | ZipParameters params = Zip4jHelper.getZipParams(true); |
| | | addZipFiles(zip, params, file.listFiles()); |
| | | |
| | | String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); |
| | |
| | | String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName; |
| | | |
| | | ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd); |
| | | ZipParameters params = Zip4jHelper.getZipParams(); |
| | | ZipParameters params = Zip4jHelper.getZipParams(true); |
| | | addZipFiles(zip, params, file.listFiles()); |
| | | |
| | | String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<AttachEntity> selectByGuids(String[] guids) { |
| | | public List<AttachEntity> selectByGuids(List<String> guids) { |
| | | return attachMapper.selectByGuids(guids); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<AttachEntity> selectByTabGuids(String tab, String[] guids) { |
| | | public List<AttachEntity> selectByTabGuids(String tab, List<String> guids) { |
| | | return attachMapper.selectByTabGuids(tab, guids); |
| | | } |
| | | |