lengfaqiang 2 жил өмнө
parent
commit
ee8fd7c18c

+ 21 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/KwsAlarmService.java

@@ -60,6 +60,9 @@ public class KwsAlarmService {
     @Autowired
     KwsDeviceMapper deviceMapper;
 
+    @Autowired
+    KwsIntegrationMapper integrationMapper;
+
     @Autowired
     KwsDeviceReferenceMapper deviceReferenceMapper;
 
@@ -445,7 +448,24 @@ public class KwsAlarmService {
                         (thresholdLevel == null ? String.valueOf(kwsAlarm.getLevel()) : thresholdLevel.get(String.valueOf(kwsAlarm.getLevel())).getLabel()));
                 vo.setType(kwsThreshold == null ? null : (kwsThreshold.getItemName() == null ? null :
                         (dictByDictCode == null ? kwsThreshold.getItemName() : (dictByDictCode.get(kwsThreshold.getItemName()) == null ? kwsThreshold.getItemName() : dictByDictCode.get(kwsThreshold.getItemName()).getLabel()))));
-                vo.setValue(detail.getVal());
+//                List<String> list1=new ArrayList<>();
+//                list1.add(DictItemEnum.LONGITUDE_X.getValue());
+//                list1.add(DictItemEnum.LATITUDE_Y.getValue());
+//                list1.add(DictItemEnum.ALTITUDE_Z.getValue());
+                if (dictByDictCode.get(kwsThreshold.getItemName()) == null) {
+                    String itemName = kwsThreshold.getItemName();
+                    KwsIntegration kwsIntegration = integrationMapper.selectOne(new LambdaQueryWrapper<KwsIntegration>()
+                            .eq(KwsIntegration::getIntegrationName, itemName));
+                    String unit = "";
+                    if (kwsIntegration != null) {
+                        Map<String, SystemDict> dictCode = commonService.getDictByDictCode(DictEnum.INTEGRATION_UNIT);
+                        unit = dictCode.get(kwsIntegration.getUnit()).getDescription();
+                    }
+                    vo.setValue(detail.getVal() + unit);
+                } else {
+                    vo.setValue(detail.getVal());
+                }
+
                 vo.setItemName(kwsThreshold == null ? null : kwsThreshold.getItemName());
                 vo.setPhone(kwsThreshold == null ? null : kwsThreshold.getPhones());
                 KwsDevice kwsDevice = deviceMapper.selectById(kwsThreshold == null ? null : kwsThreshold.getDeviceId());