From fee67ca8a0760315047a52fc4101a8f4f80b7a7f Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 11 十一月 2024 15:02:54 +0800
Subject: [PATCH] 1

---
 src/main/java/com/moon/server/controller/data/PublishController.java |  154 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 113 insertions(+), 41 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 b6a5678..e8bcc59 100644
--- a/src/main/java/com/moon/server/controller/data/PublishController.java
+++ b/src/main/java/com/moon/server/controller/data/PublishController.java
@@ -8,9 +8,9 @@
 import com.moon.server.entity.data.PublishEntity;
 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;
@@ -20,15 +20,12 @@
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.util.Arrays;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
-/**
- * 鏁版嵁鍙戝竷
- * @author WWW
- */
 @Api(tags = "鏁版嵁绠$悊\\鍙戝竷绠$悊")
 @RestController
+@SuppressWarnings("ALL")
 @RequestMapping("/publish")
 public class PublishController extends BaseController {
     @Resource
@@ -39,6 +36,9 @@
 
     @Resource
     PermsService permsService;
+
+    @Resource
+    ShuJianService shuJianService;
 
     @SysLog()
     @ApiOperation(value = "鍒嗛〉鏌ヨ鍏冩暟鎹�")
@@ -75,13 +75,10 @@
         }
     }
 
-    /**
-     * 鑾峰彇绫诲瀷
-     */
     private String getType(String type) throws Exception {
         switch (type) {
             case "DOM":
-                return "type in ('tif', 'tiff', 'img', 'jp2', 'jpg') and mata_type in (1, 3, 4, 5)";
+                return "type in ('tif', 'tiff', 'img', 'jp2', 'jpg') and mata_type in (1, 2, 3, 4, 5)";
             case "DEM":
                 return "type in ('tif', 'tiff', 'dem') and mata_type = 2";
             case "Vector":
@@ -123,9 +120,6 @@
         }
     }
 
-    /**
-     * 鑾峰彇鍙戝竷绫诲瀷
-     */
     private String getPubType(String type) throws Exception {
         if (StringHelper.isEmpty(type)) {
             return null;
@@ -133,13 +127,13 @@
 
         switch (type) {
             case "DOM":
-                return "type = 'DOM'";
+                return "a.type = 'DOM'";
             case "DEM":
-                return "type = 'DEM'";
+                return "a.type = 'DEM'";
             case "Vector":
-                return "type = 'Vector'";
+                return "a.type = 'Vector'";
             case "Model":
-                return "type = 'Model'";
+                return "a.type = 'Model'";
             default:
                 throw new Exception("鏁版嵁绫诲瀷涓嶅尮閰�");
         }
@@ -162,72 +156,120 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "鎻掑叆鍙戝竷鏁版嵁")
+    @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 = "/selectSjColorTables")
+    public void selectSjColorTables(int pageSize, int pageIndex, HttpServletRequest req, HttpServletResponse res) {
+        pageIndex = Math.max(pageIndex, 1);
+        pageSize = Math.max(pageSize, 5);
+
+        shuJianService.selectSjColorTables(pageSize, pageIndex, req, res);
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鏌ヨ鏁扮畝鍥惧眰")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "port", value = "绔彛", dataType = "int", paramType = "query", example = "50001")
+    })
+    @GetMapping(value = "/selectSjLayers")
+    public void selectSjLayers(Integer port, HttpServletRequest req, HttpServletResponse res) {
+        shuJianService.selectSjLayers(port, req, res);
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鏌ヨ鏁扮畝浠诲姟鐘舵��")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "int", paramType = "query", example = "10008101")
+    })
+    @GetMapping(value = "/selectSjMissionStatus")
+    public void selectSjMissionStatus(Integer id, HttpServletRequest req, HttpServletResponse res) {
+        shuJianService.selectSjMissionStatus(id, req, res);
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鎻掑叆鏁扮畝鏈嶅姟")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PubEntity", paramType = "body")
     })
-    @PostMapping(value = "/insertForPub", produces = "application/json; charset=UTF-8")
-    public ResponseMsg<Object> insertForPub(@RequestBody PubEntity entity, HttpServletRequest req) {
+    @ResponseBody
+    @PostMapping(value = "/insertSjService", produces = "application/json; charset=UTF-8")
+    public ResponseMsg<Object> insertSjService(@RequestBody PubEntity entity, HttpServletRequest req, HttpServletResponse res) {
         try {
             if (null == entity || null == entity.getIds() || entity.getIds().isEmpty()) {
                 return fail("瀹炰綋绫讳负绌烘垨鎵句笉鍒板厓鏁版嵁ID", 0);
             }
             if (StringHelper.isEmpty(entity.getType())) {
-                return fail("鏁版嵁绫诲埆涓虹┖", null);
+                return fail("鍙戝竷绫诲埆涓虹┖", null);
+            }
+            if (!ShuJianService.TYPES.contains(entity.getType())) {
+                return fail("鍙戝竷绫诲埆涓嶆敮鎸�", null);
             }
 
             UserEntity ue = tokenService.getCurrentUser(req);
-            if (ue != null) {
+            if (null != ue) {
                 entity.setUserId(ue.getId());
+                entity.setDepcode(ue.getDepcode());
             }
+            entity.setDefault();
 
             permsService.clearPermsCache();
-            // String method = getConvertMethod(entity.getType())
-            long count = publishService.postForPub(entity, "", req);
+            Integer rows = shuJianService.insertSjService(entity);
 
-            return success(count);
+            return success(rows);
         } catch (Exception ex) {
             return fail(ex.getMessage(), -1);
         }
     }
 
     @SysLog()
-    @ApiOperation(value = "鍙戝竷鏁扮畝鏈嶅姟")
+    @ApiOperation(value = "鏇存柊鏁扮畝鏈嶅姟")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PubEntity", paramType = "body")
     })
-    public ResponseMsg<Object> insertShuJianService(@RequestBody PubEntity entity, HttpServletRequest req) {
+    @ResponseBody
+    @PostMapping(value = "/updateSjService", produces = "application/json; charset=UTF-8")
+    public ResponseMsg<Object> updateSjService(@RequestBody PubEntity entity, HttpServletRequest req, HttpServletResponse res) {
         try {
-            if (null == entity || null == entity.getIds() || entity.getIds().isEmpty()) {
-                return fail("瀹炰綋绫讳负绌烘垨鎵句笉鍒板厓鏁版嵁ID", 0);
+            if (null == entity || null == entity.getPubid()) {
+                return fail("瀹炰綋绫讳负绌烘垨鍙戝竷ID涓虹┖", 0);
+            }
+            if (StringHelper.isEmpty(entity.getType())) {
+                return fail("鍙戝竷绫诲埆涓虹┖", null);
             }
 
-            return success(null);
+            UserEntity ue = tokenService.getCurrentUser(req);
+            if (null != ue) {
+                entity.setUserId(ue.getId());
+                entity.setDepcode(ue.getDepcode());
+            }
+            entity.setDefault();
+
+            permsService.clearPermsCache();
+            Integer rows = shuJianService.updateSjService(entity);
+
+            return success(rows);
         } catch (Exception ex) {
             return fail(ex.getMessage(), -1);
         }
     }
 
     @SysLog()
-    @ApiOperation(value = "鍒犻櫎澶氭潯")
+    @ApiOperation(value = "鍒犻櫎鏁扮畝鏈嶅姟")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1")
     })
-    @GetMapping(value = "/deletes")
-    public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids, HttpServletRequest req) {
+    @GetMapping(value = "/deletesSjServices")
+    public ResponseMsg<Integer> deletesSjServices(@RequestParam List<Integer> ids) {
         try {
-            if (ids == null || ids.isEmpty()) {
+            if (null == ids || ids.isEmpty()) {
                 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);
+            int count = shuJianService.deletesSjServices(ids);
 
             return success(count);
         } catch (Exception ex) {
@@ -248,6 +290,9 @@
             if (ue != null) {
                 entity.setUpdateUser(ue.getId());
             }
+            if (StringHelper.isEmpty(entity.getGeom())) {
+                entity.setGeom("null");
+            }
 
             permsService.clearPermsCache();
             int count = publishService.update(entity);
@@ -257,4 +302,31 @@
             return fail(ex.getMessage(), -1);
         }
     }
+
+    @SysLog()
+    @ApiOperation(value = "鏇存柊鏁扮畝鍥惧眰鐨勬媺浼告柟寮�")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PubEntity", paramType = "body")
+    })
+    @ResponseBody
+    @PostMapping(value = "/updateSjLayerStretch", produces = "application/json; charset=UTF-8")
+    public ResponseMsg<Integer> updateSjLayerStretch(@RequestBody PubEntity entity, HttpServletRequest req) {
+        try {
+            if (null == entity || null == entity.getLayerId()) {
+                return fail("瀹炰綋绫讳负绌烘垨鍥惧眰ID涓虹┖", 0);
+            }
+
+            UserEntity ue = tokenService.getCurrentUser(req);
+            if (null != ue) {
+                entity.setUserId(ue.getId());
+                entity.setDepcode(ue.getDepcode());
+            }
+
+            Integer rows = shuJianService.updateSjLayerStretch(entity);
+
+            return success(rows);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), -1);
+        }
+    }
 }

--
Gitblit v1.9.3