From f8cb69b9e1b0e8443942e13bbd3f46b9d4203269 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期日, 28 四月 2024 08:54:08 +0800
Subject: [PATCH] 靳总离职前,应元谋二期项目要求(慧图),做了通信协议修改,在他离职后,从韩月处得到最新协议,并做了部分协议软件实现修改,发现新协议中有一些协议定义有重复,也有错误的,所以这版本协议未全部实现,但实现的部分可以用来测试测控一体阀(与段志强一起测试过)。目前情况下,这版本协议实现不能应用于实际项目中,如果必须实现,还需要结合硬件协议具体实现内容再实现通信中间件的协议解析与构造部分,还需要实现上行数据处理任务树部分。
---
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java | 86 +++++++++++++++++++++++++++++++-----------
1 files changed, 63 insertions(+), 23 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java
index e8cfeca..7fd8e0b 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java
@@ -1,6 +1,7 @@
package com.dy.pipIrrProject.intake;
import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pipIrrGlobal.daoPr.PrDivideMapper;
import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper;
import com.dy.pipIrrGlobal.pojoPr.PrIntake;
import com.dy.pipIrrGlobal.voPr.VoIntake;
@@ -12,6 +13,7 @@
import java.util.List;
import java.util.Map;
+import java.util.Optional;
/**
* @author wuzeyu
@@ -25,6 +27,8 @@
public class IntakeSv {
@Autowired
private PrIntakeMapper prIntakeMapper;
+ @Autowired
+ private PrDivideMapper prDivideMapper;
/**
* 娣诲姞鍙栨按鍙�
@@ -34,41 +38,47 @@
*/
@Transactional
Integer addIntake(PrIntake po) {
- if (po.getTownId()==null||po.getTownId()==0)
- {
- Long townId=getSupperByVillageId(po.getVillageId());
- po.setTownId(townId);
+ Long villageId = Optional.ofNullable(po.getVillageId()).orElse(0L);
+
+ if (villageId != 0){
+ if (po.getTownId() == null || po.getTownId() == 0) {
+ Long townId = getSupperByVillageId(po.getVillageId());
+ po.setTownId(townId);
+ }
+ if (po.getCountyId() == null || po.getCountyId() == 0) {
+ Long countyId = getSupperByVillageId(getSupperByVillageId(po.getVillageId()));
+ po.setCountyId(countyId);
+ }
}
- if (po.getCountyId()==null||po.getCountyId()==0)
- {
- Long countyId=getSupperByVillageId(getSupperByVillageId(po.getVillageId()));
- po.setCountyId(countyId);
+ if (po.getBlockId() == null || po.getBlockId() == 0) {
+ Long blockId = prDivideMapper.getBlockIdById(po.getDivideId());
+ po.setBlockId(blockId);
}
return prIntakeMapper.insertSelective(po);
}
- public Long getSupperByVillageId(long vaId){
+
+ public Long getSupperByVillageId(long vaId) {
return prIntakeMapper.getSupperByVillageId(vaId);
}
/**
* 淇濆瓨淇敼瀹炰綋
+ *
* @param po 瀹炰綋
* @return 鏁伴噺
*/
- public int update(PrIntake po){
- if (po.getTownId()==null||po.getTownId()==0)
- {
- Long townId=getSupperByVillageId(po.getVillageId());
+ public int update(PrIntake po) {
+ if (po.getTownId() == null || po.getTownId() == 0) {
+ Long townId = getSupperByVillageId(po.getVillageId());
po.setTownId(townId);
}
- if (po.getCountyId()==null||po.getCountyId()==0)
- {
- Long countyId=getSupperByVillageId(getSupperByVillageId(po.getVillageId()));
+ if (po.getCountyId() == null || po.getCountyId() == 0) {
+ Long countyId = getSupperByVillageId(getSupperByVillageId(po.getVillageId()));
po.setCountyId(countyId);
}
- return this.prIntakeMapper.updateByPrimaryKeySelective(po) ;
+ return this.prIntakeMapper.updateByPrimaryKeySelective(po);
// return this.prIntakeMapper.updateByPrimaryKey(po);
}
@@ -79,6 +89,12 @@
* @return 鍙栨按鍙h褰曞垪琛�
*/
public QueryResultVo<List<VoIntake>> getIntakes(QueryVo queryVo) {
+// String isBinded = queryVo.getIsBinded();
+//
+// if(isBinded == null || isBinded.length() <= 0) {
+//
+// }
+
Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
Long itemTotal = prIntakeMapper.getRecordCount(params);
@@ -104,39 +120,63 @@
/**
* 寰楀埌鎵�鏈夊彇姘村彛
+ *
* @return 鎵�鏈夊彇姘村彛闆嗗悎
*/
public QueryResultVo<List<PrIntake>> selectAll() {
- QueryResultVo<List<PrIntake>> rsVo = new QueryResultVo<>() ;
- rsVo.obj = this.prIntakeMapper.selectAll() ;
- return rsVo ;
+ QueryResultVo<List<PrIntake>> rsVo = new QueryResultVo<>();
+ rsVo.obj = this.prIntakeMapper.selectAll();
+ return rsVo;
}
/**
* 寰楀埌涓�涓彇姘村彛
+ *
* @param id 鍙栨按鍙D
* @return 鍙栨按鍙e疄浣�
*/
public PrIntake selectById(Long id) {
- return this.prIntakeMapper.selectByPrimaryKey(id) ;
+ return this.prIntakeMapper.selectByPrimaryKey(id);
}
/**
* 閫昏緫鍒犻櫎瀹炰綋
+ *
* @param id 瀹炰綋ID
* @return 鏁伴噺
*/
@Transactional
- public int delete(Long id){
- return this.prIntakeMapper.deleteLogicById(id) ;
+ public int delete(Long id) {
+ return this.prIntakeMapper.deleteLogicById(id);
}
/**
* 鏍规嵁鍙栨按鍙g紪鍙疯幏鍙栨湭鍒犻櫎鐨勫彇姘村彛鏁伴噺
+ *
* @param intakeId
* @return
*/
public Integer getRecordCountOfIntake(Long intakeId) {
return prIntakeMapper.getRecordCountOfIntake(intakeId);
}
+
+ /**
+ * 鏍规嵁鏉慖d鑾峰彇鍏ㄩ儴鍦板潃
+ *
+ * @param villageId 鏉慖d
+ * @return address 鍏ㄩ儴浜旂骇鍦板潃
+ */
+ public String getAddressByVillageId(long villageId) {
+ return prIntakeMapper.getAddressByVillageId(villageId);
+ }
+
+ /**
+ * 鏍规嵁鍖哄煙Id鑾峰彇鍖哄煙绛夌骇
+ *
+ * @param regionId 鍖哄煙Id
+ * @return Level 鍖哄煙绛夌骇
+ */
+ public int getLevelByRegionId(long regionId) {
+ return prIntakeMapper.getLevelByRegionId(regionId);
+ }
}
--
Gitblit v1.8.0