From 53d68348f21c33e846ba1dd9ef483468d13f3228 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 02 九月 2023 15:11:01 +0800 Subject: [PATCH] 添加查询数简颜色表接口 --- src/main/java/com/moon/server/controller/data/PublishController.java | 119 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 86 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/moon/server/controller/data/PublishController.java b/src/main/java/com/moon/server/controller/data/PublishController.java index 0027314..6ef2f9f 100644 --- a/src/main/java/com/moon/server/controller/data/PublishController.java +++ b/src/main/java/com/moon/server/controller/data/PublishController.java @@ -9,16 +9,20 @@ import com.moon.server.entity.sys.UserEntity; import com.moon.server.helper.StringHelper; import com.moon.server.helper.WebHelper; +import com.moon.server.service.all.PermsService; import com.moon.server.service.data.PublishService; +import com.moon.server.service.data.ShuJianService; import com.moon.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.Arrays; import java.util.List; /** @@ -29,11 +33,17 @@ @RestController @RequestMapping("/publish") public class PublishController extends BaseController { - @Autowired + @Resource PublishService publishService; - @Autowired + @Resource TokenService tokenService; + + @Resource + PermsService permsService; + + @Resource + ShuJianService shuJianService; @SysLog() @ApiOperation(value = "鍒嗛〉鏌ヨ鍏冩暟鎹�") @@ -76,15 +86,13 @@ private String getType(String type) throws Exception { switch (type) { case "DOM": - return "type in ('tif', 'tiff', 'img')"; + return "type in ('tif', 'tiff', 'img', 'jp2', 'jpg') and mata_type in (1, 3, 4, 5)"; case "DEM": - return "type in ('tif', 'tiff')"; - case "MPT": - return "type = 'mpt'"; - case "3DML": - return "type = '3dml'"; - case "BIM": - return "type in ('ifc', 'fbx', 'rvt')"; + return "type in ('tif', 'tiff', 'dem') and mata_type = 2"; + case "Vector": + return "type in ('shp', 'gdb') and mata_type = 6"; + case "Model": + return "type in ('ifc', 'gdb') and mata_type = 7"; default: throw new Exception("鏁版嵁绫诲瀷涓嶅尮閰�"); } @@ -94,26 +102,51 @@ @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") @ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "dircode", value = "鐩綍", dataType = "String", paramType = "query", example = ""), + @ApiImplicitParam(name = "type", value = "绫诲埆", dataType = "String", paramType = "query", example = ""), @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") }) @GetMapping(value = "/selectByPageAndCount") - public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { + public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, String dircode, String type, Integer pageSize, Integer pageIndex) { try { if (pageSize < 1 || pageIndex < 1) { return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); } + type = getPubType(type); - int count = publishService.selectCount(name); + int count = publishService.selectCount(name, dircode, type); if (count == 0) { return success(0, null); } - List<PublishEntity> rs = publishService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + List<PublishEntity> rs = publishService.selectByPage(name, dircode, type, pageSize, pageSize * (pageIndex - 1)); return success(count, rs); } catch (Exception ex) { return fail(ex.getMessage(), null); + } + } + + /** + * 鑾峰彇鍙戝竷绫诲瀷 + */ + private String getPubType(String type) throws Exception { + if (StringHelper.isEmpty(type)) { + return null; + } + + switch (type) { + case "DOM": + return "type = 'DOM'"; + case "DEM": + return "type = 'DEM'"; + case "Vector": + return "type = 'Vector'"; + case "Model": + return "type = 'Model'"; + default: + throw new Exception("鏁版嵁绫诲瀷涓嶅尮閰�"); } } @@ -134,6 +167,20 @@ } @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ鏁扮畝鐨勯鑹茶〃") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "int", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "int", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectColorTables") + public void selectColorTables(int pageSize, int pageIndex, HttpServletRequest req, HttpServletResponse res) { + pageIndex = Math.max(pageIndex, 1); + pageSize = Math.max(pageSize, 5); + + shuJianService.selectColorTables(pageSize, pageIndex, req, res); + } + + @SysLog() @ApiOperation(value = "鎻掑叆鍙戝竷鏁版嵁") @ApiImplicitParams({ @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PubEntity", paramType = "body") @@ -151,11 +198,11 @@ UserEntity ue = tokenService.getCurrentUser(req); if (ue != null) { entity.setUserId(ue.getId()); - entity.setToken(WebHelper.getToken(req)); } - String method = getConvertMethod(entity.getType()); - long count = publishService.postForPub(entity, method, req); + permsService.clearPermsCache(); + // String method = getConvertMethod(entity.getType()) + long count = publishService.postForPub(entity, "", req); return success(count); } catch (Exception ex) { @@ -163,22 +210,20 @@ } } - /** - * 鑾峰彇杞崲鏂规硶 - */ - private String getConvertMethod(String type) throws Exception { - switch (type) { - case "DOM": - return "/Convert/ToTiles"; - case "DEM": - return "/Convert/ToTerra"; - case "MPT": - case "3DML": - return "/Convert/ToSG"; - case "BIM": - return "/Convert/ToTileset"; - default: - throw new Exception("鏁版嵁绫诲瀷涓嶅尮閰�"); + @SysLog() + @ApiOperation(value = "鍙戝竷鏁扮畝鏈嶅姟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PubEntity", paramType = "body") + }) + public ResponseMsg<Object> insertShuJianService(@RequestBody PubEntity entity, HttpServletRequest req) { + try { + if (null == entity || null == entity.getIds() || entity.getIds().isEmpty()) { + return fail("瀹炰綋绫讳负绌烘垨鎵句笉鍒板厓鏁版嵁ID", 0); + } + + return success(null); + } catch (Exception ex) { + return fail(ex.getMessage(), -1); } } @@ -194,6 +239,13 @@ return fail("id鏁扮粍涓嶈兘涓虹┖", -1); } + String strs = StringHelper.join(ids, ","); + List<PublishEntity> list = publishService.selectByIds(strs); + if (null == list || list.isEmpty()) { + return fail("娌℃湁鎵惧埌瑕佸垹闄ょ殑鏁版嵁", -1); + } + + permsService.clearPermsCache(); int count = publishService.deletes(ids, req); return success(count); @@ -216,6 +268,7 @@ entity.setUpdateUser(ue.getId()); } + permsService.clearPermsCache(); int count = publishService.update(entity); return success(count); -- Gitblit v1.9.3