| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求下载") |
| | | @ApiOperation(value = "请求元数据下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "dr", value = "请求下载实体类", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "请求元数据下载") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "reqEntity", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | @ApiImplicitParam(name = "dr", value = "请求下载实体", dataType = "DownloadReqEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/downloadReq") |
| | |
| | | return fail("密码不能为空"); |
| | | } |
| | | if (null == dr.getIds() || dr.getIds().isEmpty()) { |
| | | return fail("请选择要下载的文件"); |
| | | return fail("请选择要下载的文件ID"); |
| | | } |
| | | if (!DownloadService.decryptPwd(dr)) { |
| | | return fail("密码解密失败", null); |
| | |
| | | |
| | | /** |
| | | * 请求元数据下载 |
| | | * |
| | | * @param ue 用户实体 |
| | | * @param dr 请求下载实体 |
| | | * @return 下载文件GUID |
| | | * @throws Exception 异常 |
| | | */ |
| | | public String downloadMeteReq(UserEntity ue, DownloadReqEntity dr) throws Exception { |
| | | List<MetaEntity> list = selectMetaFiles(dr.getIds()); |
| | |
| | | return null; |
| | | } |
| | | |
| | | return zipFiles(ue, list, dr.getPwd()); |
| | | } |
| | | |
| | | /** |
| | | * 打包文件 |
| | | * |
| | | * @param ue 用户实体 |
| | | * @param list 元数据文件集合 |
| | | * @param pwd 密码 |
| | | * @return 下载文件GUID |
| | | */ |
| | | public String zipFiles(UserEntity ue, List<MetaEntity> list, String pwd) throws Exception { |
| | | Map<String, List<String>> tabs = getTabs(list); |
| | | rmRepeatMetas(list); |
| | | |
| | |
| | | } |
| | | |
| | | String zipFile = pathHelper.getDownloadFullPath() + File.separator + tempName + ".zip"; |
| | | ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd); |
| | | ZipFile zip = Zip4jHelper.createZipFile(zipFile, dr.getPwd()); |
| | | ZipParameters params = Zip4jHelper.getZipParams(true); |
| | | addMetaFiles(zip, params, list); |
| | | if (dataMap.size() > 0) { |
| | |
| | | addAnnex(zip, params, annexMap); |
| | | } |
| | | |
| | | String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd)); |
| | | String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd())); |
| | | DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd); |
| | | int rows = downloadService.insert(de); |
| | | if (de.getId() > 0) { |
| | |
| | | import com.lf.server.helper.AesHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.show.ApplyMapper; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.data.MetaService; |
| | | import com.lf.server.service.sys.UserService; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | |
| | | UserService userService; |
| | | |
| | | @Autowired |
| | | DataLibService dataLibService; |
| | | MetaService metaService; |
| | | |
| | | @Autowired |
| | | DownloadService downloadService; |
| | | DataLibService dataLibService; |
| | | |
| | | private final static Log log = LogFactory.getLog(ApplyService.class); |
| | | |
| | |
| | | dr.setIds(getIds(entity)); |
| | | dr.setFilter(entity.getFilters()); |
| | | |
| | | String guid = "sysmeta".equals(entity.getEntities()) ? "" : dataLibService.downloadDbReq(ue, dr); |
| | | String guid = "sysmeta".equals(entity.getEntities()) ? metaService.downloadMeteReq(ue, dr) : dataLibService.downloadDbReq(ue, dr); |
| | | if (!StringHelper.isEmpty(guid)) { |
| | | entity.setGuid(guid); |
| | | update(entity); |
| | |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.mapper.data.DownloadMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.data.MetaService; |
| | | import net.lingala.zip4j.ZipFile; |
| | | import net.lingala.zip4j.model.ZipParameters; |
| | |
| | | } |
| | | |
| | | for (String id : ids) { |
| | | // || "00".equals(id) |
| | | if (StringHelper.isEmpty(id)) { |
| | | continue; |
| | | } |