From 0f57ff65192aad10b974a28383ff898c4e6b9b31 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期六, 29 三月 2025 08:32:11 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
---
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java
index e3d4abe..349b3cd 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupCtrl.java
@@ -12,6 +12,7 @@
import com.dy.pipIrrGlobal.voIr.VoGroupOne;
import com.dy.pipIrrGlobal.voSe.VoActiveCard;
import com.dy.pipIrrIrrigate.irrigateGroup.dto.GroupClient;
+import com.dy.pipIrrIrrigate.irrigateGroup.dto.IrrigateGroup;
import com.dy.pipIrrIrrigate.result.IrrigateResultCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
@@ -71,7 +72,7 @@
try {
Integer rec = Optional.ofNullable(irrigateGroupSv.addIrrigateGroup(po)).orElse(0);
if (rec == 0) {
- return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage());
+ return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_GROUP_FAIL.getMessage());
}
} catch (Exception e) {
log.error("鍒涘缓杞亴缁勫紓甯�", e);
@@ -100,13 +101,13 @@
@SsoAop()
public BaseResponse<Boolean> delete(@RequestBody Map map) {
if (map == null || map.size() <= 0) {
- BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage());
+ BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_GROUP_ID.getMessage());
}
Long groupId = Long.parseLong(map.get("id").toString());
try {
Integer rows = irrigateGroupSv.deleteIrrigateGroup(groupId);
if (rows == 0) {
- return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
+ return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_GROUP_FAIL.getMessage());
}
} catch (Exception e) {
log.error("鍒犻櫎杞亴缁勫紓甯�", e);
@@ -134,7 +135,7 @@
try {
Integer rows = irrigateGroupSv.deleteIrrigateGroup(groupId);
if (rows == 0) {
- return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
+ return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_GROUP_FAIL.getMessage());
}
} catch (Exception e) {
log.error("鍒犻櫎杞亴缁勫紓甯�", e);
@@ -170,7 +171,7 @@
try {
Integer rec = Optional.ofNullable(irrigateGroupSv.updateIrrigateGroup(po)).orElse(0);
if (rec == 0) {
- return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage());
+ return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_GROUP_FAIL.getMessage());
}
} catch (Exception e) {
log.error("淇敼杞亴缁勫紓甯�", e);
@@ -264,7 +265,7 @@
irGroupUnit.setOperator(operator);
Integer rec = Optional.ofNullable(irrigateGroupSv.addGroupUnit(irGroupUnit)).orElse(0);
if (rec == 0) {
- return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage());
+ return BaseResponseUtils.buildFail(IrrigateResultCode.GROUP_ADD_UNIT_FAIL.getMessage());
}
}
} catch (Exception e) {
@@ -442,4 +443,46 @@
}
return BaseResponseUtils.buildSuccess(true);
}
+
+ /**
+ * 鏂板杞亴缁勶紝鏂颁唬鐮�
+ * @param po
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping(path = "addIrrigateGroup", consumes = MediaType.APPLICATION_JSON_VALUE)
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> addIrrigateGroup(@RequestBody @Valid IrrigateGroup po, BindingResult bindingResult) {
+ if (bindingResult != null && bindingResult.hasErrors()) {
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+
+ Map map_result = irrigateGroupSv.addIrrigateGroup(po);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess() ;
+ }
+
+ /**
+ * 鍒犻櫎杞亴缁勶紝鏂颁唬鐮�
+ * @param groupId
+ * @return
+ */
+ @PostMapping(path = "deleteIrrigateGroup")
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> deleteIrrigateGroup(@RequestParam(required = false) Long groupId) {
+ if(groupId == null) {
+ return BaseResponseUtils.buildErrorMsg("杞亴缁処D涓嶈兘涓虹┖");
+ }
+
+ Map map_result = irrigateGroupSv.deleteGroup(groupId);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess() ;
+ }
+
}
--
Gitblit v1.8.0