From 2a5cdf98e669f724758865135f5fefabf7c8f185 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期一, 04 九月 2023 09:23:51 +0800
Subject: [PATCH] 井业务修改井号唯一性验证 电子围栏报警时间改为alarmTime
---
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java | 9 +++++++++
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java | 2 +-
ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml | 6 ++----
ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java | 2 +-
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 24 +++++++++++++++++++++---
5 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
index 275650e..cf8633c 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
@@ -283,7 +283,7 @@
GlobalAlarmData globalAlarmData = new GlobalAlarmData()
.setId(ardAlarmWall.getId())
.setName(ardAlarmWall.getWallName())
- .setAlarmTime(ardAlarmWall.getCreateTime())
+ .setAlarmTime(ardAlarmWall.getAlarmTime())
.setLongitude(ardAlarmWall.getLongitude())
.setLatitude(ardAlarmWall.getLatitude())
.setCount(ardAlarmWall.getCount())
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
index e9c80ad..7a26348 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
@@ -85,7 +85,7 @@
* @return 缁撴灉
*/
- public boolean checkWellIdExists(String wellId);
+ public ArdAlarmpointsWell checkWellIdExists(String wellId);
List<ArdAlarmpointsWell> wellByPlanId(String id);
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
index 677d16f..7127f2f 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
@@ -98,6 +98,15 @@
*/
public void checkWellAllowed(ArdAlarmpointsWell well);
+ /**
+ * 鏍稿浜曞彿鏄惁鍞竴
+ *
+ * @param id 闇�瑕佹牳瀵圭殑浜曠殑涓婚敭
+ * @return 缁撴灉
+ */
+
+ public Boolean checkWellIdExists(ArdAlarmpointsWell well);
+
List<ArdAlarmpointsWell> wellByDeptList(List<Long> deptList);
ArdAlarmpointsWell wellById(String id);
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
index c18c197..f28238b 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
@@ -94,7 +94,7 @@
@Override
@Transactional
public int insertArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
- boolean wellIdExists = ardAlarmpointsWellMapper.checkWellIdExists(ardAlarmpointsWell.getWellId());
+ boolean wellIdExists = checkWellIdExists(ardAlarmpointsWell);
if(wellIdExists)
{
throw new RuntimeException("浜曞彿宸插瓨鍦�");
@@ -115,7 +115,7 @@
@Override
@Transactional
public int updateArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
- boolean wellIdExists = ardAlarmpointsWellMapper.checkWellIdExists(ardAlarmpointsWell.getWellId());
+ boolean wellIdExists = checkWellIdExists(ardAlarmpointsWell);
if(wellIdExists)
{
throw new RuntimeException("浜曞彿宸插瓨鍦�");
@@ -230,7 +230,25 @@
}
}
}
-
+ /**
+ * 鏍稿浜曞彿鏄惁鍞竴
+ *
+ * @param wellId 闇�瑕佹牳瀵圭殑浜曞彿
+ * @return 缁撴灉
+ */
+ @Override
+ public Boolean checkWellIdExists(ArdAlarmpointsWell well) {
+ // 鏍¢獙锛歸ellId
+ String id = (well.getId() == null) ? "" : well.getId();
+ String wellId = well.getWellId();
+ ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.checkWellIdExists(wellId);
+ String infoId = (ardAlarmpointsWell == null) ? "" : (ardAlarmpointsWell.getId());
+ if ((ardAlarmpointsWell != null) && !((infoId).equals(id))) {
+ //宸插瓨鍦�
+ return true;
+ }
+ return false;
+ }
@Override
public List<ArdAlarmpointsWell> wellByDeptList(List<Long> deptList) {
diff --git a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
index 7d1aa7f..b34868d 100644
--- a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
@@ -198,10 +198,8 @@
#{id}
</foreach>
</delete>
- <select id="checkWellIdExists" resultType="boolean">
- SELECT COUNT(*)
- FROM ard_alarmpoints_well
- WHERE well_id = #{wellId}
+ <select id="checkWellIdExists" resultType="ArdAlarmpointsWell">
+ SELECT * FROM ard_alarmpoints_well WHERE well_id = #{wellId} limit 1
</select>
<select id="wellByPlanId" parameterType="String" resultMap="wellResult">
--
Gitblit v1.9.3