From c8b52a0878fc2848a8ce362b0ab976983df43476 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 21 十二月 2023 14:34:40 +0800
Subject: [PATCH] 1、原SsoAop进行登录验证有鉴权,现改为只验证登录,不做鉴权,相应SsoCtrl中增加只鉴权的方法 2、优化通信中间件代码、common模块中协议代码、

---
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java |   61 +++++++++++++++---------------
 1 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java
index 5196939..74829e8 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java
@@ -2,14 +2,11 @@
 
 
 import com.dy.common.aop.SsoAop;
-import com.dy.common.mybatis.envm.Deleted;
 import com.dy.common.webUtil.BaseResponse;
 import com.dy.common.webUtil.BaseResponseUtils;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.common.webUtil.ResultCodeMsg;
-import com.dy.pipIrrBase.role.RoleSv;
 import com.dy.pipIrrBase.user.QueryVo;
-import com.dy.pipIrrGlobal.pojoBa.BaClientType;
 import com.dy.pipIrrGlobal.pojoBa.BaClientType;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
@@ -23,10 +20,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 import java.util.Objects;
@@ -34,7 +28,7 @@
 @Slf4j
 @Tag(name = "鍐滄埛绫诲瀷绠$悊", description = "鍐滄埛绫诲瀷澧炲垹鏀规煡绛夋搷浣�")
 @RestController
-@RequestMapping(path="role")
+@RequestMapping(path="clientType")
 @SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked")
 public class ClientTypeCtrl {
 
@@ -59,7 +53,7 @@
             )
     })
     @GetMapping(path = "all")
-    @SsoAop("-1")
+    @SsoAop()
     public BaseResponse<QueryResultVo<List<BaClientType>>> all(){
         try {
             QueryResultVo<List<BaClientType>> res = this.sv.selectAll() ;
@@ -83,9 +77,9 @@
                             schema = @Schema(implementation = BaClientType.class))}
             )
     })
-    @PostMapping(path = "some", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    @SsoAop("-1")
-    public BaseResponse<QueryResultVo<List<BaClientType>>> some(@Parameter(description = "鏌ヨform琛ㄥ崟鏁版嵁", required = true) @Valid QueryVo vo){
+    @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<BaClientType>>> some(@RequestBody @Parameter(description = "鏌ヨform琛ㄥ崟json鏁版嵁", required = true) @Valid QueryVo vo){
         try {
             QueryResultVo<List<BaClientType>> res = this.sv.selectSome(vo) ;
             return BaseResponseUtils.buildSuccess(res);
@@ -108,8 +102,8 @@
                             schema = @Schema(implementation = BaClientType.class))}
             )
     })
-    @GetMapping(path = "one")
-    @SsoAop("-1")
+    @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE)
+    @SsoAop()
     public BaseResponse<BaClientType> one(@Parameter(description = "瀹炰綋id", required = true) Long id){
         return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
     }
@@ -128,9 +122,9 @@
                             schema = @Schema(implementation = Boolean.class))}
             )
     })
-    @PostMapping(path = "save", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    @SsoAop("-1")//@SsoAop(power = "-1")
-    public BaseResponse<Boolean> save(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){
+    @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @SsoAop()
+    public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){
         if(bindingResult != null && bindingResult.hasErrors()){
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
@@ -163,9 +157,9 @@
                             schema = @Schema(implementation = Boolean.class))}
             )
     })
-    @PostMapping(path = "update", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    @SsoAop("-1")//@SsoAop(power = "-1")
-    public BaseResponse<Boolean> update(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){
+    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @SsoAop()
+    public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){
         if(bindingResult != null && bindingResult.hasErrors()){
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
@@ -202,22 +196,27 @@
             )
     })
     @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
-    @SsoAop("-1")//@SsoAop(power = "-1")
+    @SsoAop()
     public BaseResponse<Boolean> delete(@Parameter(description = "瀹炰綋id", required = true) Long id){
         if(id == null){
             return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ;
         }
-        int count;
-        try {
-            count = this.sv.delete(id);
-        } catch (Exception e) {
-            log.error("淇濆瓨鍐滄埛绫诲瀷寮傚父", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
-        }
-        if(count <= 0){
-            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+        Long clientCount = this.sv.selectClientByType(id) ;
+        if(clientCount > 0){
+            return BaseResponseUtils.buildFail("鍒犻櫎澶辫触锛屽瓨鍦�" + clientCount + "涓啘鎴峰綊灞炴绫诲瀷锛岃绫诲瀷涓嶈兘琚垹闄�") ;
         }else{
-            return BaseResponseUtils.buildSuccess(true) ;
+            int count;
+            try {
+                count = this.sv.delete(id);
+            } catch (Exception e) {
+                log.error("淇濆瓨鍐滄埛绫诲瀷寮傚父", e);
+                return BaseResponseUtils.buildException(e.getMessage()) ;
+            }
+            if(count <= 0){
+                return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+            }else{
+                return BaseResponseUtils.buildSuccess(true) ;
+            }
         }
     }
 

--
Gitblit v1.8.0