From 007da15aef3c8c4887bae335d1df7e4bd21e6995 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期日, 23 四月 2023 16:07:49 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/service/show/InquiryService.java | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/lf/server/service/show/InquiryService.java b/src/main/java/com/lf/server/service/show/InquiryService.java index 943eb4c..a1bc0fa 100644 --- a/src/main/java/com/lf/server/service/show/InquiryService.java +++ b/src/main/java/com/lf/server/service/show/InquiryService.java @@ -3,10 +3,13 @@ import com.lf.server.entity.all.StaticData; import com.lf.server.entity.ctrl.DownloadTileEntity; import com.lf.server.entity.ctrl.ShpRecordEntity; +import com.lf.server.entity.data.DownloadEntity; import com.lf.server.entity.data.MetaFileEntity; import com.lf.server.entity.data.PublishEntity; import com.lf.server.entity.sys.UserEntity; import com.lf.server.helper.*; +import com.lf.server.service.data.DownloadService; +import com.lf.server.service.sys.DownlogService; import net.lingala.zip4j.ZipFile; import net.lingala.zip4j.model.ZipParameters; import org.springframework.stereotype.Service; @@ -26,6 +29,9 @@ public class InquiryService { @Resource PathHelper pathHelper; + + @Resource + DownloadService downloadService; /** * 璇诲彇Shp绗竴鏉¤褰曠殑WKT @@ -68,7 +74,11 @@ ZipParameters params = Zip4jHelper.getZipParams(true); addFiles(zip, params, list, pub.getPath() + File.separator); - return "aaa"; + String dbPwd = Md5Helper.reverse(Md5Helper.generate(dt.getPwd())); + DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd); + int rows = downloadService.insert(de); + + return rows > 0 ? de.getGuid() : null; } /** @@ -132,4 +142,25 @@ } } } + + /** + * 鑾峰彇涓嬭浇瀹炰綋绫� + */ + private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { + DownloadEntity de = new DownloadEntity(); + de.setName(FileHelper.getFileName(file)); + // 1-Shp鏂囦欢锛�2-涓撻鍥撅紝3-鍏冩暟鎹紝4-涓氬姟鏁版嵁锛�5-绠¢亾鍒嗘瀽锛�6-缁熻鎶ュ憡锛�7-闄勪欢鏂囦欢锛�8-鐡︾墖鏂囦欢 + de.setType(8); + de.setSizes(FileHelper.sizeToMb(new File(file).length())); + de.setDepid(ue.getDepid()); + de.setDcount(0); + de.setPwd(pwd); + de.setUrl(FileHelper.getRelativePath(file)); + de.setDescr("鐡︾墖鏂囦欢"); + de.setGuid(FileHelper.getFileMd5(file)); + de.setCreateUser(ue.getId()); + // de.setGeom(null) + + return de; + } } -- Gitblit v1.9.3