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

+ 9 - 6
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/KwsAlarmService.java

@@ -337,7 +337,7 @@ public class KwsAlarmService {
         if (!CollectionUtils.isEmpty(idsList) && idsList.size() > 0) {
             wrapper.in(KwsAlarm::getId, idsList);
         }
-        List<KwsAlarm> list = alarmMapper.selectExportListByQuery(query, headerData.getMountainId(),idsList);
+        List<KwsAlarm> list = alarmMapper.selectExportListByQuery(query, headerData.getMountainId(), idsList);
 //        List<KwsAlarm> list = alarmMapper.selectList(wrapper);
         List<KwsAlarmExportVO> alarmVOS = new ArrayList<>();
         if (CollectionUtils.isEmpty(list)) {
@@ -435,16 +435,19 @@ public class KwsAlarmService {
             for (KwsAlarmDetail detail : detailList) {
                 Long pid = detail.getPid();
                 KwsThreshold kwsThreshold = thresholdMapper.selectById(pid);
+                if (kwsThreshold == null) {
+                    kwsThreshold = thresholdMapper.selectByPrimaryKey(pid);
+                }
                 ThresholdRecordDetailVO vo = new ThresholdRecordDetailVO();
                 vo.setId(detail.getId());
                 vo.setAlarmLevel(kwsAlarm.getLevel() == null ? null :
                         (thresholdLevel == null ? String.valueOf(kwsAlarm.getLevel()) : thresholdLevel.get(String.valueOf(kwsAlarm.getLevel())).getLabel()));
-                vo.setType(kwsThreshold.getItemName() == null ? null :
-                        (dictByDictCode == null ? kwsThreshold.getItemName() : dictByDictCode.get(kwsThreshold.getItemName()).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());
-                vo.setItemName(kwsThreshold.getItemName());
-                vo.setPhone(kwsThreshold.getPhones());
-                KwsDevice kwsDevice = deviceMapper.selectById(kwsThreshold.getDeviceId());
+                vo.setItemName(kwsThreshold == null ? null : kwsThreshold.getItemName());
+                vo.setPhone(kwsThreshold == null ? null : kwsThreshold.getPhones());
+                KwsDevice kwsDevice = deviceMapper.selectById(kwsThreshold == null ? null : kwsThreshold.getDeviceId());
                 StringBuilder location = new StringBuilder();
                 if (StringUtils.isNotBlank(kwsDevice.getLogicLng())) {
                     location.append(kwsDevice.getLogicLng()).append(";");