From edcf06f395234fb1b2f34e4da3cf3539572c20d7 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期六, 02 九月 2023 15:39:31 +0800
Subject: [PATCH] 修改发布控制器的接口

---
 src/main/java/com/moon/server/controller/data/PublishController.java |   86 +++++++++++++++++-------------------------
 1 files changed, 35 insertions(+), 51 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 6ef2f9f..eb1240b 100644
--- a/src/main/java/com/moon/server/controller/data/PublishController.java
+++ b/src/main/java/com/moon/server/controller/data/PublishController.java
@@ -8,7 +8,6 @@
 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;
@@ -22,7 +21,6 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -172,104 +170,90 @@
             @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) {
+    @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.selectColorTables(pageSize, pageIndex, req, res);
+        shuJianService.selectSjColorTables(pageSize, pageIndex, req, res);
     }
 
     @SysLog()
-    @ApiOperation(value = "鎻掑叆鍙戝竷鏁版嵁")
+    @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);
             }
 
             UserEntity ue = tokenService.getCurrentUser(req);
-            if (ue != null) {
+            if (null != ue) {
                 entity.setUserId(ue.getId());
+                entity.setDepcode(ue.getDepcode());
             }
 
             permsService.clearPermsCache();
-            // String method = getConvertMethod(entity.getType())
-            long count = publishService.postForPub(entity, "", req);
+            Integer rows = shuJianService.insertSjService(entity, req, res);
 
-            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());
+            }
+
+            permsService.clearPermsCache();
+            Integer rows = shuJianService.updateSjService(entity, req, res);
+
+            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) {
+    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);
-
-            return success(count);
-        } catch (Exception ex) {
-            return fail(ex.getMessage(), -1);
-        }
-    }
-
-    @SysLog()
-    @ApiOperation(value = "鏇存柊涓�鏉�")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PublishEntity", paramType = "body")
-    })
-    @ResponseBody
-    @PostMapping(value = "/update", produces = "application/json; charset=UTF-8")
-    public ResponseMsg<Integer> update(@RequestBody PublishEntity entity, HttpServletRequest req) {
-        try {
-            UserEntity ue = tokenService.getCurrentUser(req);
-            if (ue != null) {
-                entity.setUpdateUser(ue.getId());
-            }
-
-            permsService.clearPermsCache();
-            int count = publishService.update(entity);
+            int count = shuJianService.deletesSjServices(ids);
 
             return success(count);
         } catch (Exception ex) {

--
Gitblit v1.9.3