| | |
| | | |
| | | import com.lf.server.entity.ctrl.DownloadReqEntity; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.show.PipelineEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.*; |
| | | import com.lf.server.mapper.data.DownloadMapper; |
| | |
| | | /** |
| | | * 解密 |
| | | * |
| | | * @param pe 管道分析实体类 |
| | | * @return 是/否解密成功 |
| | | */ |
| | | public static boolean decryptPwd(PipelineEntity pe) { |
| | | try { |
| | | String pwd = RsaHelper.decrypt(pe.getPwd()); |
| | | if (StringHelper.isEmpty(pwd)) { |
| | | return false; |
| | | } |
| | | |
| | | pe.setPwd(pwd); |
| | | |
| | | return true; |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解密 |
| | | * |
| | | * @param pwd 加密密码 |
| | | * @return 原始密码 |
| | | */ |
| | |
| | | * @param pwd 密码 |
| | | * @return 下载文件GUID |
| | | */ |
| | | public String zipFiles(UserEntity ue, List<MetaFileEntity> list, String pwd) throws Exception { |
| | | public String zipFiles(UserEntity ue, List<MetaEntity> list, String pwd) throws Exception { |
| | | rmRepeatMetaFiles(list); |
| | | |
| | | String downloadPath = pathHelper.getDownloadFullPath(); |
| | |
| | | /** |
| | | * 移除重复的元数据文件 |
| | | */ |
| | | private void rmRepeatMetaFiles(List<MetaFileEntity> list) { |
| | | private void rmRepeatMetaFiles(List<MetaEntity> list) { |
| | | List<String> guidList = new ArrayList<>(); |
| | | |
| | | int i = 0; |
| | | while (i < list.size()) { |
| | | MetaFileEntity entity = list.get(i); |
| | | MetaEntity entity = list.get(i); |
| | | if (guidList.contains(entity.getGuid())) { |
| | | list.remove(i); |
| | | continue; |
| | |
| | | /** |
| | | * 添加元数据文件至Zip包 |
| | | */ |
| | | private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaFileEntity> list) { |
| | | private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaEntity> list) { |
| | | String uploadPath = pathHelper.getConfig().getUploadPath(); |
| | | |
| | | int i = 1; |
| | | for (MetaFileEntity entity : list) { |
| | | for (MetaEntity entity : list) { |
| | | try { |
| | | File file = new File(uploadPath + File.separator + entity.getPath()); |
| | | zip.addFile(file, params); |