燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-04-25 d09e34040a6855c99d930d1b57c7254cf545ead8
1
已修改1个文件
54 ■■■■■ 文件已修改
src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java
@@ -37,25 +37,25 @@
public class WarningAnalyseServiceImpl implements IWarningAnalyseService {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private WarningDetailMapper warningDetailMapper;
    @Autowired
    private AlertConfigMapper alertConfigMapper;
    private AlertConfigMapper alertConfigMapper;
    @Autowired
    private ICommonService commonService;
    @Autowired
    private SuYuanMapper suYuanMapper;
    @Autowired
    private DictRecordMapper dictRecordMapper;
    @Autowired
    private  IAsyncService asyncService;
    private IAsyncService asyncService;
    @Override
    @Async("threadPoolTaskExecutor")
    public void insertWarningDetails(List<WarningDetail> warning) throws Exception {
@@ -65,9 +65,9 @@
        for (List<WarningDetail> corpReserveList : list) {
            asyncService.executeAsync("", corpReserveList, warningDetailMapper, countDownLatch);
        }
        countDownLatch.await();
        countDownLatch.await();
    }
    @Override
    public List<WarningVo> getRunTimeAlarmAnalyse() {
        List<WarningVo> result = new ArrayList<>();
@@ -78,7 +78,9 @@
            nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY);
        }
        List<WarningDetail> list = alarmAnalyseOperation(nowDate);
        list.forEach(s -> {result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));});
        list.forEach(s -> {
            result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
        });
        return result;
    }
@@ -92,7 +94,9 @@
            nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY);
        }
        List<WarningDetail> list = warningAnalyseOperation(nowDate);
        list.forEach(s -> {result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));});
        list.forEach(s -> {
            result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));
        });
        return result;
    }
@@ -104,7 +108,7 @@
        if (StringUtils.isNull(dictRecord)) {
            return result;
        }
        String tableName =dictRecord.getTableName();
        String tableName = dictRecord.getTableName();
        List<SuYuan2d> list = suYuanMapper.getAlarmsAnalyse(tableName, ids);
        list.forEach(s -> {
            String locationName = commonService.select3dCheckPointById(s.getId()).getName();
@@ -112,7 +116,7 @@
        });
        return result;
    }
    public List<WarningDetail> warningAnalyseOperation(Date date) {
        List<WarningDetail> result = new ArrayList<WarningDetail>();
        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
@@ -121,7 +125,7 @@
        if (StringUtils.isNull(dictRecord)) {
            return result;
        }
        String tableName =dictRecord.getTableName();
        String tableName = dictRecord.getTableName();
        List<SuYuan2d> list = suYuanMapper.getWarningAnalyse(tableName, ids);
        list.forEach(s -> {
            String locationName = commonService.select3dCheckPointById(s.getId()).getName();
@@ -198,12 +202,16 @@
        Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -3, Calendar.HOUR_OF_DAY)));
        List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
        checkPoints.forEach(c -> {
            List<String> tableNames = new ArrayList<>();
            recordList.forEach(r -> {tableNames.add(r.getTableName());});
            List<Double> values = new ArrayList<>();
            List<String> tableNames = new ArrayList<>();
            recordList.forEach(r -> {
                tableNames.add(r.getTableName());
            });
            List<Double> values = new ArrayList<>();
            if (StringUtils.isNotNull(tableNames)) {
                List<SuYuanMonitorData> data = suYuanMapper.getMonitorData(tableNames, c.getId());
                data.forEach(v -> {values.add(v.getValue());});
                data.forEach(v -> {
                    values.add(v.getValue());
                });
                result.put(c.getName(), values);
            }
        });
@@ -218,8 +226,10 @@
        Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthEnd()));
        List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
        checkPoints.forEach(c -> {
            List<String> tableNames = new ArrayList<>();
            recordList.forEach(r -> {tableNames.add(r.getTableName());});
            List<String> tableNames = new ArrayList<>();
            recordList.forEach(r -> {
                tableNames.add(r.getTableName());
            });
            Map<String, Object> map = suYuanMapper.getMonthValueDataMax(tableNames, c.getId());
            if (StringUtils.isNotNull(map) && StringUtils.isNotEmpty(map)) {
                String suYuanId = map.get("id").toString();