Kaynağa Gözat

1.项目删除 删除区域
2.增加单位展示

lengfaqiang 2 yıl önce
ebeveyn
işleme
cc9799b338

+ 3 - 3
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/ThresholdLogDetailVO.java

@@ -64,7 +64,7 @@ public class ThresholdLogDetailVO implements Serializable {
     /**
      * 当前基准值
      */
-    private BigDecimal currentValue;
+    private String currentValue;
 
     /**
      * 当前偏移量
@@ -73,7 +73,7 @@ public class ThresholdLogDetailVO implements Serializable {
     /**
      * 原始基准值
      */
-    private BigDecimal originalValue;
+    private String originalValue;
 
     /**
      * 原始偏移量
@@ -82,7 +82,7 @@ public class ThresholdLogDetailVO implements Serializable {
     /**
      * 上次基准值
      */
-    private BigDecimal lastReferenceValue;
+    private String lastReferenceValue;
     /**
      * 告警时间
      */

+ 23 - 12
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/KwsAlarmService.java

@@ -425,6 +425,7 @@ public class KwsAlarmService {
                     location.append(kwsDevice.getLogicLat()).append(remark).append(";");
                 }
                 if (StringUtils.isNotBlank(kwsDevice.getLogicAlt())) {
+                    String remark = dictByDictCode.get(DictItemEnum.ALTITUDE_Z.getValue()).getRemark();
                     location.append(kwsDevice.getLogicAlt()).append(";");
                 }
                 vo.setLocation(location.toString());
@@ -450,13 +451,16 @@ public class KwsAlarmService {
                 KwsDevice kwsDevice = deviceMapper.selectById(kwsThreshold == null ? null : kwsThreshold.getDeviceId());
                 StringBuilder location = new StringBuilder();
                 if (StringUtils.isNotBlank(kwsDevice.getLogicLng())) {
-                    location.append(kwsDevice.getLogicLng()).append(";");
+                    String remark = dictByDictCode.get(DictItemEnum.LONGITUDE_X.getValue()).getRemark();
+                    location.append(kwsDevice.getLogicLng()).append(remark).append(";");
                 }
                 if (StringUtils.isNotBlank(kwsDevice.getLogicLat())) {
-                    location.append(kwsDevice.getLogicLat()).append(";");
+                    String remark = dictByDictCode.get(DictItemEnum.LATITUDE_Y.getValue()).getRemark();
+                    location.append(kwsDevice.getLogicLat()).append(remark).append(";");
                 }
                 if (StringUtils.isNotBlank(kwsDevice.getLogicAlt())) {
-                    location.append(kwsDevice.getLogicAlt()).append(";");
+                    String remark = dictByDictCode.get(DictItemEnum.ALTITUDE_Z.getValue()).getRemark();
+                    location.append(kwsDevice.getLogicAlt()).append(remark).append(";");
                 }
 //                vo.setLocation(kwsDevice == null ? null : kwsDevice.getLogicAlt() + ";" + kwsDevice.getLogicLat() + ";" + kwsDevice.getLogicLng());
                 vo.setLocation(location.toString());
@@ -522,28 +526,29 @@ public class KwsAlarmService {
             vo.setAlarmDetailId(id);
             vo.setDeviceId(deviceId.toString());
             vo.setItemName(itemName);
-            vo.setLastReferenceValue(deviceReference == null ? null : deviceReference.getCurrentValue());
+            String unit = "";
             if (devices != null) {
                 String val = devices.getVal();
                 if (list.contains(kwsThreshold.getItemName())) {
                     if (deviceReference != null) {
-                        String unit = kwsThreshold.getItemName() == null ? null :
+                        unit = kwsThreshold.getItemName() == null ? null :
                                 (dictByDictCode == null ?
                                         kwsThreshold.getItemName() : (dictByDictCode.get(kwsThreshold.getItemName()) == null ?
                                         kwsThreshold.getItemName() : dictByDictCode.get(kwsThreshold.getItemName()).getUrl()));
                         BigDecimal computeOffset = commonService.computeOffset(val, kwsThreshold.getItemName(), deviceReference);
                         BigDecimal computeOriginalOffset = commonService.computeOriginalOffset(val, kwsThreshold.getItemName(), deviceReference);
-                        vo.setCurrentValue(deviceReference.getCurrentValue());
+                        vo.setCurrentValue(deviceReference.getCurrentValue() + unit);
                         vo.setCurrentOffset(computeOffset.setScale(2, RoundingMode.HALF_UP) + unit);
-                        vo.setOriginalValue(deviceReference.getOriginalValue());
+                        vo.setOriginalValue(deviceReference.getOriginalValue() + unit);
                         vo.setOriginalOffset(computeOriginalOffset.setScale(2, RoundingMode.HALF_UP) + unit);
                     }
                 } else {
-                    vo.setCurrentValue(deviceReference == null ? null : deviceReference.getCurrentValue());
-                    vo.setOriginalValue(deviceReference == null ? null : deviceReference.getOriginalValue());
+                    vo.setCurrentValue(deviceReference == null ? null : deviceReference.getCurrentValue() + unit);
+                    vo.setOriginalValue(deviceReference == null ? null : deviceReference.getOriginalValue() + unit);
                 }
 
             }
+            vo.setLastReferenceValue(deviceReference == null ? null : deviceReference.getCurrentValue() + unit);
         }
         Map<String, SystemDict> levelDict = commonService.getDictByDictCode(DictEnum.THRESHOLD_LEVEL);
         Map<String, SystemDict> typeDict = commonService.getDictByDictCode(DictEnum.ALARM_TYPE);
@@ -852,6 +857,7 @@ public class KwsAlarmService {
         Long pid = kwsAlarmDetail.getPid();
         KwsAlarm kwsAlarm = alarmMapper.selectById(alarmId);
         Integer type = kwsAlarm.getType();
+        Map<String, SystemDict> dictByDictCode = commonService.getDictByDictCode(DictEnum.MODEL_PART);
         if (2 == type) {
             KwsThreshold kwsThreshold = thresholdMapper.selectById(pid);
             if (kwsThreshold == null) {
@@ -872,10 +878,15 @@ public class KwsAlarmService {
 //                if (list.contains(itemName)){
 //
 //                }
+
                 vo.setItemName(itemName);
-                vo.setCurrentValue(deviceReference.getCurrentValue());
+                String unit = kwsThreshold.getItemName() == null ? null :
+                        (dictByDictCode == null ?
+                                kwsThreshold.getItemName() : (dictByDictCode.get(kwsThreshold.getItemName()) == null ?
+                                kwsThreshold.getItemName() : dictByDictCode.get(kwsThreshold.getItemName()).getUrl()));
+                vo.setCurrentValue(deviceReference.getCurrentValue() + unit);
                 vo.setCurrentOffset(deviceReference.getOffset().toString());
-                vo.setOriginalValue(deviceReference.getOriginalValue());
+                vo.setOriginalValue(deviceReference.getOriginalValue() + unit);
                 vo.setOriginalOffset("0.00");
                 KwsDeviceReference lastDeviceReference = deviceReferenceMapper.selectOne(new LambdaQueryWrapper<KwsDeviceReference>()
                         .eq(KwsDeviceReference::getDelFlag, 1)
@@ -884,7 +895,7 @@ public class KwsAlarmService {
                         .orderByDesc(KwsDeviceReference::getUpdateTime)
                         .last("limit 1")
                 );
-                vo.setLastReferenceValue(lastDeviceReference == null ? null : lastDeviceReference.getCurrentValue());
+                vo.setLastReferenceValue(lastDeviceReference == null ? null : lastDeviceReference.getCurrentValue() + unit);
             }
         }
         Map<String, SystemDict> levelDict = commonService.getDictByDictCode(DictEnum.THRESHOLD_LEVEL);

+ 3 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/ProjectService.java

@@ -240,6 +240,7 @@ public class ProjectService {
             throw new BusinessException("项目存在关联设备,不允许删除!");
         }
         int update = projectMapper.update(null, new LambdaUpdateWrapper<KwsProject>().in(KwsProject::getId, list).set(KwsProject::getDelFlag, "1"));
+        projectAreaMapper.update(null,new LambdaUpdateWrapper<KwsProjectArea>().in(KwsProjectArea::getProjectId,list).set(KwsProjectArea::getDelFlag,1));
         Map<String, Object> logMap = new HashMap<>(NumberConstant.SIXTEEN);
         logMap.put("projectName", project.getName());
         logMap.put("mountainName", project.getMountainName());
@@ -1359,6 +1360,7 @@ public class ProjectService {
         List<KwsAlarm> kwsAlarmsCount = alarmMapper.selectList(new LambdaQueryWrapper<KwsAlarm>()
                 .eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarm::getMountainId, mountainId)
                 .eq(KwsAlarm::getStatus, 0)
+                .eq(KwsAlarm::getDelFlag, 0)
         );
         int alarmTotal = 0;
         if (!CollectionUtils.isEmpty(kwsAlarmsCount)) {
@@ -1369,6 +1371,7 @@ public class ProjectService {
         List<KwsAlarmDetail> unreadKwsAlarms = alarmDetailMapper.selectList(new LambdaQueryWrapper<KwsAlarmDetail>()
                 .eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarmDetail::getMountainId, mountainId)
                 .eq(KwsAlarmDetail::getStatus, 0)
+                .eq(KwsAlarmDetail::getDelFlag, 0)
         );
         vo.setUnreadAlarmTotal(CollectionUtils.isEmpty(unreadKwsAlarms) ? 0 : unreadKwsAlarms.size());
         List<KwsAlarm> oneThresholdAlarm = alarmMapper.selectList(new LambdaQueryWrapper<KwsAlarm>()