From 710c6a4d568237016a70b74aa3769b89e336725c Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 13 五月 2025 15:48:21 +0800
Subject: [PATCH] 1、实现功能码92、93命令web后端接口定义与逻辑代码实现; 2、修改原来功能逻辑实现的逻辑,增加回调; 3、表阀一体机协议命令结果数据库存储补充实现。
---
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/project/ProjectCtrl.java | 155 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 147 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 973bccf..30ab742 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
@@ -7,8 +7,11 @@
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoIr.IrProject;
import com.dy.pipIrrGlobal.voIr.VoProject;
+import com.dy.pipIrrGlobal.voIr.VoProjectDetail;
import com.dy.pipIrrGlobal.voIr.VoProjectOne;
+import com.dy.pipIrrGlobal.voIr.VoProjectSimple;
import com.dy.pipIrrGlobal.voSe.VoActiveCard;
+import com.dy.pipIrrIrrigate.project.dto.IrrigateProject;
import com.dy.pipIrrIrrigate.result.IrrigateResultCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
@@ -44,8 +47,7 @@
private final ProjectSv projectSv;
/**
- * 娣诲姞椤圭洰
- *
+ * 娣诲姞椤圭洰锛屾棫鐗堟湰锛屽師鍒欎笂搴熷純
* @param po 椤圭洰瀹炰綋瀵硅薄
* @param bindingResult
* @return 娣诲姞鏄惁鎴愬姛
@@ -79,7 +81,7 @@
}
/**
- * 閫昏緫鍒犻櫎椤圭洰
+ * 閫昏緫鍒犻櫎椤圭洰锛屾棫鐗堟湰锛屽師鍒欎笂搴熷純
* @param map
* @return
*/
@@ -141,7 +143,7 @@
}
/**
- * 淇敼椤圭洰淇℃伅
+ * 淇敼椤圭洰淇℃伅锛屾棫鐗堟湰锛屽師鍒欎笂搴熷純
* @param po
* @param bindingResult
* @return
@@ -175,7 +177,7 @@
}
/**
- * 淇敼椤圭洰鐘舵��
+ * 淇敼椤圭洰鐘舵�侊紝鏃犵敤鎺ュ彛锛屽師鍒欎笂搴熷純
* @param po
* @param
* @return
@@ -206,8 +208,7 @@
}
/**
- * 鑾峰彇涓�涓」鐩暟鎹�
- *
+ * 鑾峰彇涓�涓」鐩暟鎹紝鏃х増鏈紝鍘熷垯涓婂簾寮�
* @return 鑾峰彇涓�涓」鐩暟鎹�
*/
@Operation(summary = "鑾峰彇涓�涓」鐩暟鎹�", description = "鑾峰彇涓�涓」鐩暟鎹�")
@@ -229,7 +230,7 @@
}
/**
- * 鍒嗛〉鏌ヨ
+ * 鍒嗛〉鏌ヨ锛屾棫鐗堟湰锛屽師鍒欎笂搴熷純
* @param vo
* @return
*/
@@ -253,4 +254,142 @@
return BaseResponseUtils.buildException(e.getMessage());
}
}
+
+ /**
+ * 娣诲姞椤圭洰锛屾柊鐗堟湰锛屼娇鐢ㄨ繖涓�
+ * @param po 椤圭洰瀹炰綋瀵硅薄
+ * @param bindingResult
+ * @return 娣诲姞鏄惁鎴愬姛
+ */
+ @PostMapping(path = "addIrrigateProject", consumes = MediaType.APPLICATION_JSON_VALUE)
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> addIrrigateProject(@RequestBody @Valid IrrigateProject po, BindingResult bindingResult) {
+ if (bindingResult != null && bindingResult.hasErrors()) {
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+
+ Map map_result = projectSv.addIrrigateProject(po);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess() ;
+
+ //String projectName = po.getProjectName();
+ //String irrigateGroups = po.getIrrigateGroups();
+ //Long operatorId = po.getOperatorId();
+ //
+ //IrProject irProject = new IrProject();
+ //irProject.setProjectName(projectName);
+ //irProject.setProjectState((byte)1);
+ //irProject.setOperator(operatorId);
+ //irProject.setOperateTime(new Date());
+ //irProject.setDeleted((byte)0);
+ //Long projectId = projectSv.addIrrigateProject(irProject);
+ //if(projectId == null) {
+ // return BaseResponseUtils.buildErrorMsg("鍒涘缓鐏屾簤椤圭洰澶辫触");
+ //}
+ //
+ //String[] irrigateGroupArr = irrigateGroups.split(",");
+ //Integer sort = 1;
+ //for(String irrigateGroupId : irrigateGroupArr) {
+ // String trimmed = irrigateGroupId.trim();
+ // if(trimmed.isEmpty()) {
+ // continue;
+ // }
+ // try {
+ // Long irrigateGroupIdLong = Long.parseLong(trimmed);
+ // IrProjectGroup irProjectGroup = new IrProjectGroup();
+ // irProjectGroup.setProjectId(projectId);
+ // irProjectGroup.setGroupId(irrigateGroupIdLong);
+ // irProjectGroup.setSort(sort++);
+ // projectSv.projectBindGroup(irProjectGroup);
+ //
+ // } catch (NumberFormatException e) {
+ // return BaseResponseUtils.buildErrorMsg("鐏屾簤缁処D鏍煎紡閿欒");
+ // }
+ //}
+
+ }
+
+ /**
+ * 鍒犻櫎椤圭洰锛屾柊鐗堟湰锛屼娇鐢ㄨ繖涓�
+ * @param projectId
+ * @return
+ */
+ @PostMapping(path = "deleteIrrigateProject")
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> deleteIrrigateProject(@RequestParam(required = false) Long projectId) {
+ if(projectId == null) {
+ return BaseResponseUtils.buildErrorMsg("椤圭洰ID涓嶈兘涓虹┖");
+ }
+
+ Map map_result = projectSv.deleteIrrigateProject(projectId);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess() ;
+ }
+
+ /**
+ * 淇敼椤圭洰锛屾柊鐗堟湰锛屼娇鐢ㄨ繖涓�
+ * @param po
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping(path = "updateIrrigateProject", consumes = MediaType.APPLICATION_JSON_VALUE)
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> updateIrrigateProject(@RequestBody @Valid IrrigateProject po, BindingResult bindingResult){
+ if (bindingResult != null && bindingResult.hasErrors()) {
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+
+ if(po.getProjectId() == null) {
+ return BaseResponseUtils.buildErrorMsg("椤圭洰ID涓嶈兘涓虹┖");
+ }
+
+ Map map_result = projectSv.updateIrrigateProject(po);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess() ;
+ }
+
+ /**
+ * 鍒嗛〉鏌ヨ椤圭洰锛屾柊鐗堟湰锛岀洰鍓嶄娇鐢�
+ * @param qo
+ * @return
+ */
+ @GetMapping(path = "/getSimpleProjects")
+ @SsoAop()
+ public BaseResponse<QueryResultVo<List<VoProjectSimple>>> getSimpleProjects(QueryVo qo) {
+ try {
+ QueryResultVo<List<VoProjectSimple>> res = projectSv.getSimpleProjects(qo);
+ return BaseResponseUtils.buildSuccess(res);
+ } catch (Exception e) {
+ log.error("鑾峰彇椤圭洰璁板綍寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage());
+ }
+ }
+
+ /**
+ * 鏍规嵁椤圭洰Id鑾峰彇椤圭洰璇︽儏锛岀紪杈戦」鐩俊鎭娇鐢�
+ * @param projectId
+ * @return
+ */
+ @GetMapping(path = "getProject")
+ @SsoAop()
+ public BaseResponse<VoProjectDetail> getProject(@RequestParam Long projectId) {
+ if(projectId == null) {
+ return BaseResponseUtils.buildErrorMsg("椤圭洰ID涓嶈兘涓虹┖");
+ }
+
+ Map map_result = projectSv.getProjectDetail(projectId);
+ if(map_result.get("success").equals(false)) {
+ return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
+ }
+ return BaseResponseUtils.buildSuccess(map_result.get("content")) ;
+ }
}
--
Gitblit v1.8.0