From d730e2a289b38356e28a04b35a0cb2e7b4c6c282 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 03 七月 2025 10:27:56 +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/irrigatePlan/IrrigatePlanCtrl.java | 105 ++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 89 insertions(+), 16 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanCtrl.java
index 0f22e38..40fbe97 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanCtrl.java
@@ -3,42 +3,115 @@
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
-import com.dy.pipIrrGlobal.voIr.VoGroupSimple;
+import com.dy.pipIrrIrrigate.irrigatePlan.dto.IrrigatePlan;
+import com.dy.pipIrrIrrigate.irrigatePlan.dto.PlanSimple;
+import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.http.MediaType;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import java.util.List;
+import java.util.Map;
+import java.util.Objects;
/**
* @author ZhuBaoMin
- * @date 2024-11-28 17:20
- * @LastEditTime 2024-11-28 17:20
- * @Description 鐏屾簤璁″垝鎺у埗绫�
+ * @date 2025-06-30 14:58
+ * @LastEditTime 2025-06-30 14:58
+ * @Description
*/
@Slf4j
@RestController
-@RequestMapping(path = "irrigatePlan")
+@RequestMapping(path = "plan")
@RequiredArgsConstructor
public class IrrigatePlanCtrl {
private final IrrigatePlanSv irrigatePlanSv;
/**
- * 鏍规嵁鍐滄埛缂栧彿鑾峰彇杞亴缁勫垪琛�
+ * 鍒涘缓鐏屾簤璁″垝
+ * @param planAndSchedule
+ * @param bindingResult
* @return
*/
- @GetMapping(path = "/getGroups")
+ @PostMapping(path = "createPlan", consumes = MediaType.APPLICATION_JSON_VALUE)
@SsoAop()
- public BaseResponse<List<VoGroupSimple>> getGroups(@RequestParam("clientId") Long clientId) {
- try {
- return BaseResponseUtils.buildSuccess(irrigatePlanSv.getGroups(clientId));
- } catch (Exception e) {
- log.error("鑾峰彇浠诲姟绫诲瀷寮傚父", e);
- return BaseResponseUtils.buildException(e.getMessage());
+ public BaseResponse<Boolean> createPlan(@RequestBody @Valid IrrigatePlan planAndSchedule, BindingResult bindingResult){
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
}
+
+ Map map_result = irrigatePlanSv.createPlan(planAndSchedule);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess() ;
+ }
+
+ /**
+ * 鍒犻櫎鐏屾簤璁″垝
+ * @param planSimple
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping(path = "deletePlan")
+ @SsoAop()
+ public BaseResponse<Boolean> deletePlan(@RequestBody @Valid PlanSimple planSimple, BindingResult bindingResult) {
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+
+ Map map_result = irrigatePlanSv.deletePlan(planSimple);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess() ;
+ }
+
+ /**
+ * 鍙戝竷鐏屾簤璁″垝
+ * 1. 淇敼鐏屾簤璁″垝鐘舵�佷负鍙戝竷鐘舵��
+ * 2. 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍
+ * 3. 鐢熸垚寮�闃�璁″垝
+ * @param planSimple
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping(path = "publishPlan", consumes = MediaType.APPLICATION_JSON_VALUE)
+ @SsoAop()
+ public BaseResponse<Boolean> publishPlan(@RequestBody @Valid PlanSimple planSimple, BindingResult bindingResult){
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+
+ Map map_result = irrigatePlanSv.publishPlan(planSimple);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess() ;
+ }
+
+ /**
+ * 缁堟鐏屾簤璁″垝
+ * @param planSimple
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping(path = "terminatePlan", consumes = MediaType.APPLICATION_JSON_VALUE)
+ @SsoAop()
+ public BaseResponse<Boolean> terminatePlan(@RequestBody @Valid PlanSimple planSimple, BindingResult bindingResult){
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+
+ Map map_result = irrigatePlanSv.terminatePlan(planSimple);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess() ;
}
}
--
Gitblit v1.8.0