From f8cb69b9e1b0e8443942e13bbd3f46b9d4203269 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期日, 28 四月 2024 08:54:08 +0800 Subject: [PATCH] 靳总离职前,应元谋二期项目要求(慧图),做了通信协议修改,在他离职后,从韩月处得到最新协议,并做了部分协议软件实现修改,发现新协议中有一些协议定义有重复,也有错误的,所以这版本协议未全部实现,但实现的部分可以用来测试测控一体阀(与段志强一起测试过)。目前情况下,这版本协议实现不能应用于实际项目中,如果必须实现,还需要结合硬件协议具体实现内容再实现通信中间件的协议解析与构造部分,还需要实现上行数据处理任务树部分。 --- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java | 66 ++++++++++++++++----------------- 1 files changed, 32 insertions(+), 34 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..01a550a 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,17 +2,13 @@ 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; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -23,10 +19,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 +27,7 @@ @Slf4j @Tag(name = "鍐滄埛绫诲瀷绠$悊", description = "鍐滄埛绫诲瀷澧炲垹鏀规煡绛夋搷浣�") @RestController -@RequestMapping(path="role") +@RequestMapping(path="clientType") @SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked") public class ClientTypeCtrl { @@ -59,7 +52,7 @@ ) }) @GetMapping(path = "all") - @SsoAop("-1") + @SsoAop() public BaseResponse<QueryResultVo<List<BaClientType>>> all(){ try { QueryResultVo<List<BaClientType>> res = this.sv.selectAll() ; @@ -83,9 +76,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 @Valid QueryVo vo){ try { QueryResultVo<List<BaClientType>> res = this.sv.selectSome(vo) ; return BaseResponseUtils.buildSuccess(res); @@ -108,9 +101,9 @@ schema = @Schema(implementation = BaClientType.class))} ) }) - @GetMapping(path = "one") - @SsoAop("-1") - public BaseResponse<BaClientType> one(@Parameter(description = "瀹炰綋id", required = true) Long id){ + @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) + @SsoAop() + public BaseResponse<BaClientType> one(Long id){ return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); } @@ -128,9 +121,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 @Valid BaClientType po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } @@ -163,9 +156,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 @Valid BaClientType po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } @@ -202,22 +195,27 @@ ) }) @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) - @SsoAop("-1")//@SsoAop(power = "-1") - public BaseResponse<Boolean> delete(@Parameter(description = "瀹炰綋id", required = true) Long id){ + @SsoAop() + public BaseResponse<Boolean> delete(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