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/IrrigateGroupSv.java | 85 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 83 insertions(+), 2 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java
index 76dd797..61962f8 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigateGroup/IrrigateGroupSv.java
@@ -2,19 +2,23 @@
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoIr.IrGroupClientMapper;
+import com.dy.pipIrrGlobal.daoIr.IrGroupIntakeMapper;
import com.dy.pipIrrGlobal.daoIr.IrGroupUnitMapper;
import com.dy.pipIrrGlobal.daoIr.IrIrrigateGroupMapper;
import com.dy.pipIrrGlobal.pojoIr.IrGroupClient;
+import com.dy.pipIrrGlobal.pojoIr.IrGroupIntake;
import com.dy.pipIrrGlobal.pojoIr.IrGroupUnit;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup;
import com.dy.pipIrrGlobal.voIr.VoGroup;
import com.dy.pipIrrGlobal.voIr.VoGroupOne;
+import com.dy.pipIrrIrrigate.irrigateGroup.dto.IrrigateGroup;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -35,6 +39,9 @@
@Autowired
private IrGroupClientMapper irGroupClientMapper;
+ @Autowired
+ private IrGroupIntakeMapper irGroupIntakeMapper;
+
/**
* 鍒涘缓杞亴缁�
*
@@ -42,7 +49,7 @@
* @return
*/
public Integer addIrrigateGroup(IrIrrigateGroup po) {
- po.setOperateDt(new Date());
+ po.setOperateTime(new Date());
po.setDeleted((byte) 0);
int rows = irIrrigateGroupMapper.insertSelective(po);
if (rows == 0) {
@@ -71,7 +78,7 @@
* @return
*/
public Integer updateIrrigateGroup(IrIrrigateGroup po){
- po.setOperateDt(new Date());
+ po.setOperateTime(new Date());
int rows = irIrrigateGroupMapper.updateByPrimaryKeySelective(po);
if (rows == 0){
return 0;
@@ -168,4 +175,78 @@
public Integer deleteGroupClient (Long id) {
return irGroupClientMapper.deleteByPrimaryKey(id);
}
+
+ /**
+ * 鍒涘缓杞亴缁�
+ * @param po
+ * @return
+ */
+ public Map addIrrigateGroup(IrrigateGroup po) {
+ IrIrrigateGroup irrigateGroup = new IrIrrigateGroup();
+ irrigateGroup.setGroupCode(po.getGroupCode());
+ irrigateGroup.setDefaultDuration(po.getDefaultDuration());
+ irrigateGroup.setOperator(po.getOperator());
+ irrigateGroup.setOperateTime(new Date());
+ irrigateGroup.setDeleted((byte) 0);
+ irIrrigateGroupMapper.insertSelective(irrigateGroup);
+ Long groupId = irrigateGroup.getId();
+ if(groupId == null) {
+ Map map = new HashMap<>();
+ map.put("success", false);
+ map.put("msg", "鍒涘缓杞亴缁勫け璐�");
+ map.put("content", null);
+ return map;
+ }
+
+ String[] intakeArr = po.getIntakes().split(",");
+ Integer sort = 1;
+ for(String intekeId : intakeArr) {
+ String trimmed = intekeId.trim();
+ if(trimmed.isEmpty()) {
+ continue;
+ }
+ try {
+ Long intakeIdLong = Long.parseLong(trimmed);
+ IrGroupIntake irGroupIntake = new IrGroupIntake();
+ irGroupIntake.setGroupId(groupId);
+ irGroupIntake.setIntakeId(intakeIdLong);
+ irGroupIntakeMapper.insert(irGroupIntake);
+ } catch (NumberFormatException e) {
+ Map map = new HashMap<>();
+ map.put("success", false);
+ map.put("msg", "鍙栨按鍙D鏍煎紡閿欒");
+ map.put("content", null);
+ return map;
+ }
+ }
+ Map map = new HashMap<>();
+ map.put("success", true);
+ map.put("msg", "娣诲姞杞亴缁勬垚鍔�");
+ map.put("content", null);
+ return map;
+ }
+
+ /**
+ * 鏍规嵁缁処D鍒犻櫎鍙栨按鍙e叧鑱�
+ * @param groupId
+ * @return
+ */
+ public Map deleteGroup(Long groupId) {
+ try {
+ irGroupIntakeMapper.deleteByGroupId(groupId);
+ irIrrigateGroupMapper.deleteByPrimaryKey(groupId);
+
+ Map map = new HashMap<>();
+ map.put("success", true);
+ map.put("msg", "鐏屾簤椤圭洰鍒犻櫎鎴愬姛");
+ map.put("content", null);
+ return map;
+ } catch (Exception e) {
+ Map map = new HashMap<>();
+ map.put("success", false);
+ map.put("msg", "杞亴缁勫垹闄ゅけ璐�");
+ map.put("content", null);
+ return map;
+ }
+ }
}
--
Gitblit v1.8.0