燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-07-21 58cb215b67a5bf50fba0d63969f40711fc23135c
src/main/java/com/yssh/service/WarningAnalyseService.java
@@ -353,7 +353,56 @@
        return map;
    }
    public List<Report> getAlarmAndWarnByTime(Date begin, Date end) {
    public List<Report> getAlarmAndWarnByTime(Date beginDate, Date endDate) {
        String strStart = DateUtils.getYyyyMmDdHh(beginDate);
        String strEnd = DateUtils.getYyyyMmDdHh(endDate);
        Integer start = Integer.parseInt(strStart);
        Integer end = Integer.parseInt(strEnd);
        List<Qxsh> rsList = qxshMapper.selectByBeginAndEnd(start, end);
        if (null == rsList || rsList.isEmpty()) return null;
        Hashtable<String, Boolean> dict = getExistTabDict(rsList);
        List<Report> list = new ArrayList<>();
        for (Qxsh qxsh : rsList) {
            String tab = "su_yuan_" + qxsh.getTime();
            if (!dict.get(tab)) continue;
            MonitorPointPosition point = commonService.select3dCheckPointByName(qxsh.getName());
            String suYuanId = point.getId().substring(0, point.getId().lastIndexOf("_") + 1) + "0";
            Double lastVal = qxshMapper.selectLastYearVal(Integer.parseInt(qxsh.getTime()) - 1000000, qxsh.getName());
            WarningDetail wd = new WarningDetail(0L, tab, suYuanId, qxsh.getName(), null, 0, qxsh.getValue());
            DistanceSuYuan suYuan = suYuanMapper.getSuYuanById(tab, suYuanId);
            List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(point, 50);
            DistanceSuYuan suMax = suYuanMapper.getSuYuan500Max(tab, ids3d);
            suMax.setAddr(getAddr(suMax.getId()));
            Report report = Report.calcReport(wd, suYuan, suMax);
            report.setLastVal(lastVal);
            list.add(report);
        }
        return list;
    }
    private Hashtable<String, Boolean> getExistTabDict(List<Qxsh> rsList) {
        Hashtable<String, Boolean> dict = new Hashtable<>();
        for (Qxsh qxsh : rsList) {
            String tab = "su_yuan_" + qxsh.getTime();
            if (dict.containsKey(tab)) {
                continue;
            }
            Boolean b = suYuanMapper.isTableExists(tab) > 0;
            dict.put(tab, b);
        }
        return dict;
    }
    public List<Report> getAlarmAndWarnByTime2(Date begin, Date end) {
        String startTime = DateUtils.getYyyyMmDdHhMmSs(begin);
        String endTime = DateUtils.getYyyyMmDdHhMmSs(end);
@@ -367,9 +416,6 @@
        Hashtable<String, Boolean> dict = new Hashtable<>();
        List<Report> list = new ArrayList<>();
        for (WarningDetail wd : rs) {
            //String time = ymdh.format(wd.getCreateTime());
            //list.add(new WarningVo(wd.getLocationName(), wd.getSuYuanId(), 0.0, 0.0, wd.getValue(), time));
            /*DistanceSuYuan suYuan = suYuanMapper.getSuYuanById(wd.getTableName(), wd.getSuYuanId());
            Double lastVal = warningDetailMapper.getLastYearVal(wd.getId());
@@ -382,7 +428,6 @@
            } else {
                suMax = suYuan;
            }*/
            if (dict.containsKey(wd.getTableName())) {
                if (!dict.get(wd.getTableName())) continue;
            } else {