From ed8c7a5effd0d423ce1118b680ecdca6fe732609 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 02 七月 2025 16:43:13 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.11.205:9000/r/P2022036_Service --- src/main/java/com/lf/server/controller/show/InquiryController.java | 90 +++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 82 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/lf/server/controller/show/InquiryController.java b/src/main/java/com/lf/server/controller/show/InquiryController.java index 9845d1f..6948fb1 100644 --- a/src/main/java/com/lf/server/controller/show/InquiryController.java +++ b/src/main/java/com/lf/server/controller/show/InquiryController.java @@ -1,21 +1,32 @@ package com.lf.server.controller.show; -import com.lf.server.aspect.SysLog; +import com.lf.server.annotation.SysLog; import com.lf.server.controller.all.BaseQueryController; +import com.lf.server.entity.all.HttpStatus; import com.lf.server.entity.all.ResponseMsg; +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.AesHelper; import com.lf.server.helper.StringHelper; -import com.lf.server.service.data.UploaderService; +import com.lf.server.helper.WebHelper; +import com.lf.server.service.all.BaseUploadService; +import com.lf.server.service.data.DownloadService; +import com.lf.server.service.data.PublishService; import com.lf.server.service.show.InquiryService; import com.lf.server.service.sys.TokenService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -28,16 +39,17 @@ @RestController @RequestMapping("/inquiry") public class InquiryController extends BaseQueryController { - private final static int FOUR = 4; - @Autowired TokenService tokenService; @Autowired - UploaderService uploaderService; + BaseUploadService baseUploadService; @Autowired InquiryService inquiryService; + + @Resource + PublishService publishService; @SysLog() @ApiOperation(value = "涓婁紶Shp鏂囦欢璇诲彇绗竴鏉¤褰曠殑WKT") @@ -50,8 +62,8 @@ return fail("鐢ㄦ埛鏈櫥褰�", null); } - List<MetaFileEntity> list = uploaderService.uploadData(null, ue, req, res); - if (list.size() < FOUR) { + List<MetaFileEntity> list = baseUploadService.uploadData(null, null, false, req, res); + if (list == null || list.size() < StaticData.FOUR) { return fail("娌℃湁鎵惧埌宸蹭笂浼犵殑鏁版嵁鎴栦笉瀹屾暣", null); } @@ -62,7 +74,69 @@ return success(sr); } catch (Exception ex) { - return fail(ex.getMessage(), null); + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鐡︾墖") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dt", value = "涓嬭浇鐡︾墖瀹炰綋绫�", dataType = "DownloadTileEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/downloadTiles") + public ResponseMsg<Object> downloadTiles(@RequestBody DownloadTileEntity dt, HttpServletRequest req, HttpServletResponse res) { + try { + if (null == dt || null == dt.getPubid() || StringHelper.isEmpty(dt.getPwd())) { + return fail("鍙戝竷ID鍜屽瘑鐮佷笉鑳戒负绌�"); + } + String err = dt.verifyCoords(); + if (null != err) { + return fail(err); + } + if (!DownloadService.decryptPwd(dt)) { + return fail("瀵嗙爜瑙e瘑澶辫触", null); + } + + PublishEntity pub = publishService.selectById(dt.getPubid()); + if (null == pub) { + return fail("鍙戝竷鏁版嵁涓嶅瓨鍦�"); + } + + UserEntity ue = tokenService.getCurrentUser(req); + String guid = inquiryService.zipTiles(dt, pub, ue); + if (null == guid) { + return fail("娌℃湁鐡︾墖闇�瑕佹墦鍖呬笅杞�"); + } + + return success(guid); + } catch (Exception ex) { + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") + }) + @ResponseBody + @GetMapping(value = "/downloadFile") + public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { + try { + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); + return; + } + + UserEntity ue = tokenService.getCurrentUser(req); + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); } } } -- Gitblit v1.9.3