From c0a1e58617d69fa78cceebb27376e57e324a562e Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期三, 21 八月 2024 08:51:51 +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/project/ProjectCtrl.java |  174 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 166 insertions(+), 8 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java
index 409ed4e..6f46207 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java
@@ -3,8 +3,14 @@
 import com.dy.common.aop.SsoAop;
 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.pipIrrGlobal.pojoIr.IrProject;
+import com.dy.pipIrrGlobal.pojoPr.PrIntake;
+import com.dy.pipIrrGlobal.voIr.VoProject;
+import com.dy.pipIrrGlobal.voIr.VoProjectOne;
+import com.dy.pipIrrGlobal.voPr.VoIntake;
+import com.dy.pipIrrGlobal.voSe.VoActiveCard;
 import com.dy.pipIrrIrrigate.result.IrrigateResultCode;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.media.Content;
@@ -19,14 +25,10 @@
 import org.springframework.http.MediaType;
 import org.springframework.transaction.annotation.Transactional;
 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.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
+import java.lang.reflect.Array;
+import java.util.*;
 
 /**
  * @author :WuZeYu
@@ -77,6 +79,20 @@
         return BaseResponseUtils.buildSuccess(true);
     }
 
+    /**
+     * 閫昏緫鍒犻櫎椤圭洰
+     * @param map
+     * @return
+     */
+    @Operation(summary = "閫昏緫鍒犻櫎椤圭洰", description = "閫昏緫鍒犻櫎椤圭洰")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
     @PostMapping(path = "delete", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
@@ -84,7 +100,7 @@
         if (map == null || map.size() <= 0) {
             BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage());
         }
-        Long projectId = Long.parseLong(map.get("projectId").toString());
+        Long projectId = Long.parseLong(map.get("id").toString());
         try {
             Integer rows = projectSv.deleteProject(projectId);
             if (rows == 0) {
@@ -96,4 +112,146 @@
         }
         return BaseResponseUtils.buildSuccess(true);
     }
+
+    /**
+     * 鎵归噺鍒犻櫎
+     * @param projectIds
+     * @return
+     */
+    @PostMapping(path = "delete_batch", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> delete_batch(@RequestBody Map<String,List> projectIds) {
+        if (projectIds == null || projectIds.size() <= 0) {
+            BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage());
+        }
+        List ids = projectIds.get("projectIds");
+        for (int i = 0; i < ids.size(); i++) {
+            long projectId = Long.parseLong(ids.get(i).toString());
+            try {
+                Integer rows = projectSv.deleteProject(projectId);
+                if (rows == 0) {
+                    return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage());
+                }
+            } catch (Exception e) {
+                log.error("鍒犻櫎椤圭洰寮傚父", e);
+                return BaseResponseUtils.buildException(e.getMessage());
+            }
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 淇敼椤圭洰淇℃伅
+     * @param po
+     * @param bindingResult
+     * @return
+     */
+    @Operation(summary = "淇敼椤圭洰淇℃伅", description = "淇敼椤圭洰淇℃伅")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
+    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> update(@RequestBody @Valid IrProject po, BindingResult bindingResult){
+        if (bindingResult != null && bindingResult.hasErrors()) {
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        try {
+            Integer rec = Optional.ofNullable(projectSv.updateProject(po)).orElse(0);
+            if (rec == 0) {
+                return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage());
+            }
+        } catch (Exception e) {
+            log.error("淇敼椤圭洰寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 淇敼椤圭洰鐘舵��
+     * @param po
+     * @param
+     * @return
+     */
+    @Operation(summary = "淇敼椤圭洰鐘舵��", description = "淇敼椤圭洰鐘舵��")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
+    @PostMapping(path = "update_state", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> update_state(@RequestBody IrProject po){
+        try {
+            Integer rec = Optional.ofNullable(projectSv.updateProjectState(po)).orElse(0);
+            if (rec == 0) {
+                return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage());
+            }
+        } catch (Exception e) {
+            log.error("淇敼椤圭洰寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true);
+    }
+
+    /**
+     * 鑾峰彇涓�涓」鐩暟鎹�
+     *
+     * @return 鑾峰彇涓�涓」鐩暟鎹�
+     */
+    @Operation(summary = "鑾峰彇涓�涓」鐩暟鎹�", description = "鑾峰彇涓�涓」鐩暟鎹�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鑾峰彇涓�涓」鐩暟鎹紙BaseResponse.content:{}锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = IrProject.class))}
+            )
+    })
+    @GetMapping(path = "one")
+    @SsoAop()
+    public BaseResponse<VoProjectOne> one(@RequestParam Long id) {
+        VoProjectOne irProject = this.projectSv.selectById(id);
+
+            return BaseResponseUtils.buildSuccess(irProject);
+
+    }
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     * @param vo
+     * @return
+     */
+    @Operation(summary = "鑾峰緱涓�椤甸」鐩褰�", description = "鑾峰緱涓�椤甸」鐩褰�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鑾峰緱涓�椤甸」鐩褰曪紙BaseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = VoActiveCard.class))}
+            )
+    })
+    @GetMapping(path = "some")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoProject>>> getProjects(QueryVo vo) {
+        try {
+            QueryResultVo<List<VoProject>> res = projectSv.getProjects(vo);
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鑾峰彇椤圭洰璁板綍寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
 }

--
Gitblit v1.8.0