From 844594bc560ba6c5dd7f92ce3301295fb980282a Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 08 五月 2025 21:09:42 +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