tangzy
2021-09-15 0fa45101a494897fe93b90d805b3ff0aedd36e17
1.山洪
8 files modified
1360 ■■■■ changed files
src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java 138 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml 29 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/service/IMountainrainService.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java 6 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java 28 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/river/controller/RiverRController.java 245 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java 910 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
@@ -490,17 +490,57 @@
                }
                Map<String, Object> map = new HashMap<String, Object>();
                if (mountainrainsCVOS.get(i).getSoilval() > 30) {
                    int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
                        mountainrainsCVOS.get(i).getGohours(), mountainrainsCVOS.get(i).getGthours());
                    map.put("List", mountainrainsCVOS.get(i));
                    map.put("Max", Max);
                    lists.add(map);
//                    int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
//                        mountainrainsCVOS.get(i).getGohours(), mountainrainsCVOS.get(i).getGthours());
//                    map.put("List", mountainrainsCVOS.get(i));
//                    map.put("Max", Max);
//                    lists.add(map);
                    //0.8雨量湿度
                    if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "true");
                        map.put("flage3", "false");
                        map.put("status", 2);
                        lists.add(map);
                    } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) {
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "false");
                        map.put("flage3", "true");
                        map.put("status", 2);
                        lists.add(map);
                    } else {
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "false");
                        map.put("flage3", "false");
                        map.put("status", 2);
                        lists.add(map);
                    }
                } else {
                    //0.5雨量湿度
                    int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
                        mountainrainsCVOS.get(i).getGohour(), mountainrainsCVOS.get(i).getGthour());
                    map.put("List", mountainrainsCVOS.get(i));
                    map.put("Max", Max);
                    lists.add(map);
//                    map.put("List", mountainrainsCVOS.get(i));
//                    map.put("Max", Max);
//                    lists.add(map);
                    if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "true");
                        map.put("flage3", "false");
                        map.put("status", 1);
                        lists.add(map);
                    } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) {
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "false");
                        map.put("flage3", "true");
                        map.put("status", 1);
                        lists.add(map);
                    } else {
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "false");
                        map.put("flage3", "false");
                        map.put("status", 1);
                        lists.add(map);
                    }
                }
            }
@@ -522,31 +562,55 @@
            String dateEnd3 = dateEnds3;
            String s = regionWeightService.selectCode();
            //String s = "62334490";
            String[] split = s.split(",");
            String strArrays = "";
            for (int i = 0; i < split.length; i++) {
                strArrays += "'" + split[i] + "',";
            }
            String code = strArrays.substring(0, strArrays.length() - 1);
            List<Map<String, Integer>> list = mountainrainService.selecMone(times, dateEnd1, dateEnd2, dateEnd3, code);
            List<Map<String, Object>> list = mountainrainService.selecMone(times, dateEnd1, dateEnd2, dateEnd3, code);
            List<Map<String, Object>> lists = new ArrayList<>();
            Map<String, Object> map = new HashMap<String, Object>();
            for (int i = 0; i < list.size(); i++) {
                if (list.get(i).get("drp1") >= 30) {
                BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
                double drp1 = w1.doubleValue();
                BigDecimal w2 = (BigDecimal) list.get(i).get("drp2");
                double drp2 = w2.doubleValue();
                BigDecimal w3 = (BigDecimal) list.get(i).get("drp3");
                double drp3 = w3.doubleValue();
                if (drp1 > 30) {
                    Map<String, Object> map = new HashMap<String, Object>();
                    map.put("List", list.get(i));
                    map.put("Max", 1);
                    map.put("flage1", "true");
                    map.put("flage2", "false");
                    map.put("flage3", "false");
                    lists.add(map);
                }
                if (list.get(i).get("drp2") >= 50) {
                if (drp2 > 50) {
                    Map<String, Object> map = new HashMap<String, Object>();
                    map.put("List", list.get(i));
                    map.put("Max", 2);
                    map.put("flage1", "false");
                    map.put("flage2", "true");
                    map.put("flage3", "false");
                    lists.add(map);
                }
                if (list.get(i).get("drp3") >= 80) {
                if (drp3 > 80) {
                    Map<String, Object> map = new HashMap<String, Object>();
                    map.put("List", list.get(i));
                    map.put("Max", 3);
                    map.put("flage1", "false");
                    map.put("flage2", "false");
                    map.put("flage3", "true");
                    lists.add(map);
                } else {
                    Map<String, Object> map = new HashMap<String, Object>();
                    map.put("List", list.get(i));
                    map.put("flage1", "false");
                    map.put("flage2", "false");
                    map.put("flage3", "false");
                    lists.add(map);
                }
            }
            lists.add(map);
            return R.data(lists);
        }
@@ -557,7 +621,7 @@
     *
     * @return
     */
    //@Scheduled(cron = "0 0 8 * * ?")
    @Scheduled(cron = "0 0 8 * * ?")
    @GetMapping("/soleval")
    public R soleval() {
        mountainrainService.soildel();
@@ -568,7 +632,6 @@
        }
        Collections.sort(passDaysList);
        String s = mountainrainService.selectCode();
        //String s = "62310356,62310305";
        String[] split = s.split(",");
        String strArrays = "";
        for (int i = 0; i < split.length; i++) {
@@ -579,22 +642,28 @@
            Integer num = 30;
            double v1 = 0;
            String stcd = null;
        for (int j = 0; j < passDaysList.size() - 1; j++) {
            List<Map<String, Object>> map = mountainrainService.selectMtwo(passDaysList.get(j).toString(), passDaysList.get(j + 1).toString(), code);
            if (map.size()==0){
                continue;
            for (int j = 0; j < passDaysList.size() - 2; j++) {
                List<Map<String, Object>> map = mountainrainService.selectMtwo(passDaysList.get(j).toString(), passDaysList.get(j + 1).toString(), code);
                if (map.size() == 0 || i > map.size() - 1) {
                    break;
                }
                BigDecimal w = (BigDecimal) map.get(i).get("drp");
                double drp = w.doubleValue();
                stcd = map.get(i).get("STCD").toString();
                //计算湿度
                if (j == 0) {
                    v1 = formatDouble1((num + drp) * 0.85);
                    if (v1 > 60) {
                        v1 = 60;
                    }
                } else {
                    v1 += drp;
                    v1 = formatDouble1(v1 * 0.85);
                    if (v1 > 60) {
                        v1 = 60;
                    }
                }
            }
            BigDecimal w = (BigDecimal) map.get(i).get("drp");
            double drp = w.doubleValue();
            stcd = map.get(i).get("STCD").toString();
            //计算湿度
            if (i == 0) {
                v1 = formatDouble1((num + drp) * 0.85);
            } else {
                v1 += drp;
                v1 = formatDouble1(v1 * 0.85);
            }
        }
            if (v1 > 60) {
                mountainrainService.soleInster(stcd, "60");
            } else {
@@ -624,4 +693,3 @@
    }
}
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.java
@@ -114,7 +114,7 @@
    Integer selectCount(String beginTime,String endTime);
    String selectCode();
    List<Map<String, Integer>> selecMone(String times,String dateEnd1,String dateEnd2,String dateEnd3,String code);
    List<Map<String, Object>> selecMone(String times,String dateEnd1,String dateEnd2,String dateEnd3,String code);
    List<Map<String, Object>> selectMtwo(String time3,String time,String code);
    void soleInster(String stcd,String soilval);
    void soildel();
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
@@ -258,7 +258,9 @@
    <select id="selectCode" resultType="java.lang.String">
        SELECT stuff((
            SELECT ',' + CONVERT(VARCHAR (25), m.cenconding)
            FROM dbo.blade_mountain m INNER JOIN ST_STBPRP_B s ON  s.STCD=m.cenconding  GROUP BY m.cenconding   FOR XML PATH ('')),
            FROM dbo.blade_mountain m
                     INNER JOIN ST_STBPRP_B s ON s.STCD = m.cenconding
            GROUP BY m.cenconding FOR XML PATH ('')),
        1,
        1,
    ''
@@ -303,7 +305,7 @@
            SELECT ISNULL(SUM(s.DRP), 0) AS drp2,
                   STCD
            FROM dbo.ST_PPTN_R s
            WHERE s.TM &gt; #{dateEnd3}
            WHERE s.TM &gt; #{dateEnd2}
              AND s.TM &lt;= #{times}
              AND s.STCD IN (${code})
            GROUP BY s.STCD
@@ -312,7 +314,7 @@
            SELECT ISNULL(SUM(strs.DRP), 0) AS drp3,
                   STCD
            FROM dbo.ST_PPTN_R strs
            WHERE strs.TM &gt; #{dateEnd6}
            WHERE strs.TM &gt; #{dateEnd3}
              AND strs.TM &lt;= #{times}
              AND strs.STCD IN (${code})
            GROUP BY STCD
@@ -340,6 +342,10 @@
                   gthours
            FROM blade_mountain
        ) cs ON cs.cenconding = a.STCD
                 LEFT JOIN (
            SELECT stcd, soilval
            FROM sys_soleval
        ) so ON so.stcd = a.STCD
    </select>
    <!--第一种预警-->
@@ -352,11 +358,11 @@
               cs.HNNM,
               cs.LTTD,
               cs.LGTD,
               isnull(a.drp1, 0) as drp1
            isnull(b.drp2,0) as drp2
            isnull(a.drp1, 0) as drp1,
            isnull(b.drp2,0) as drp2,
            isnull(c.drp3,0) as drp3
        FROM (
                 SELECT ISNULL(SUM(str.DRP), 0) AS drp1,
                 SELECT SUM(str.DRP) AS drp1,
                        STCD
                 FROM dbo.ST_PPTN_R str
                 WHERE str.TM &gt; #{dateEnd1}
@@ -365,7 +371,7 @@
                 GROUP BY str.STCD
             ) a
                 FULL JOIN (
            SELECT ISNULL(SUM(s.DRP), 0) AS drp2,
            SELECT SUM(s.DRP) AS drp2,
                   STCD
            FROM dbo.ST_PPTN_R s
            WHERE s.TM &gt; #{dateEnd2}
@@ -374,7 +380,7 @@
            GROUP BY s.STCD
        ) b ON a.STCD = b.STCD
                 FULL JOIN (
            SELECT ISNULL(SUM(strs.DRP), 0) AS drp3,
            SELECT SUM(strs.DRP) AS drp3,
                   STCD
            FROM dbo.ST_PPTN_R strs
            WHERE strs.TM &gt; #{dateEnd3}
@@ -395,16 +401,11 @@
            FROM dbo.ST_STBPRP_B st
                     INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
        ) cs ON cs.STCD = a.STCD
                 LEFT JOIN (
            SELECT stcd, soilval
            FROM sys_soleval
        ) so ON so.stcd = a.STCD
    </select>
    <!--土壤湿度计算-->
    <select id="selectMtwo" resultType="java.util.Map">
        SELECT SUM
                   (DRP) AS drp,
        SELECT ISNULL(SUM(DRP), 0) AS drp,
               STCD
        FROM dbo.ST_PPTN_R
        WHERE TM &gt; #{time3}
src/main/java/org/springblade/modules/mountainrain/service/IMountainrainService.java
@@ -123,7 +123,7 @@
     */
    int rainOne(int number,Integer gohour);
    List<MountainrainsCVO> Mountains(String times,String dateEnd1,String dateEnd2,String dateEnd3,String code);
    List<Map<String, Integer>> selecMone(String times,String dateEnd1,String dateEnd2,String dateEnd3,String code);
    List<Map<String, Object>> selecMone(String times,String dateEnd1,String dateEnd2,String dateEnd3,String code);
    List<Map<String, Object>> selectMtwo(String time3,String time,String code);
    /**
     *三小时
src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java
@@ -370,10 +370,10 @@
        if (number<=gohour){
            return 0;//正常
        }else  if(number>gohour){
            return  1;//准备转移
            return  1;//1小时
        }
        else {
            return  3;//立即转移
            return  3;//3小时
        }
    }
@@ -383,7 +383,7 @@
    }
    @Override
    public List<Map<String, Integer>> selecMone(String times, String dateEnd1, String dateEnd2, String dateEnd3, String code) {
    public List<Map<String, Object>> selecMone(String times, String dateEnd1, String dateEnd2, String dateEnd3, String code) {
        return baseMapper.selecMone(times, dateEnd1, dateEnd2, dateEnd3, code);
    }
src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
@@ -189,7 +189,7 @@
        String years = strss[1].toString();
        //日
        String days = strss[2].toString();
        String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
        String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时";
        //最新雨量值
        List<Map<String, Object>> map = regionWeightService.selectReM(beginTime, endTime);
        List<Map<String, Object>> mapAll = regionWeightService.selectAll();
@@ -300,7 +300,7 @@
            });
            //拼接前3位降雨最大的区域
            double v3 = (double) Math.round(num * 10) / 10;
            String text = "全市日平均降雨量:" + v3 + "(毫米)。 ";
            String text = "全市日平均降雨量:" + v3 + "毫米。 ";
            String text1 = "县市区平均降雨量前3位为: ";
            String tx = "";
            for (int i = 0; i < entryList2.size(); i++) {
@@ -316,7 +316,7 @@
                        mapa.put("dyp", as);
                        listc.add(mapa);
                        if (i < 3) {
                            tx += station_name + "降雨量为:" + as + "(毫米),";
                            tx += station_name + "降雨量为:" + as + "毫米,";
                        }
                    }
@@ -632,7 +632,7 @@
            });
            for (int c = 0; c < listc.size(); c++) {
                if (c < 3) {
                    text += listc.get(c).get("region").toString() + ":" + listc.get(c).get("dyp") + "(毫米),";
                    text += listc.get(c).get("region").toString() + ":" + listc.get(c).get("dyp") + "毫米,";
                }
            }
            String a = "流域前三的为:" + text.substring(0, text.length() - 1) + "。";
@@ -773,7 +773,7 @@
        List<Map<String, Object>> lists = new ArrayList<>();
        Map<String, Object> map = new HashMap<String, Object>();
        String text = "";
        String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
        String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时";
        //0-10降雨量范围
        List lista = new ArrayList<>();
        //10-25降雨量范围
@@ -805,7 +805,15 @@
                } else if (dyp > 250) {
                    listf.add(maps.get(i));
                }
                text += stnm + "站" + dyp + "毫米,";
                if (i==0){
                    text += addvnm+stnm + "站" + dyp + "毫米,";
                }
                if (i==1){
                    text += addvnm+stnm + "站" + dyp + "毫米次之,";
                }
                if (i==2){
                    text += addvnm+stnm + "站" + dyp + "毫米第三,";
                }
            } else {
                BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量
                double dyp = bigDecimaldyp.doubleValue();
@@ -840,7 +848,7 @@
        if (maps.size() == 0) {
            a = yday + "暂无降雨信息。";
        } else {
            a = yday + "点降雨量前三为:" + text.substring(0, text.length() - 1) + "。";
            a = yday + "点最大降雨量为" + text.substring(0, text.length() - 1) + "。";
        }
        map.put("text", a);
        lists.add(map);
@@ -917,7 +925,7 @@
        String years = strss[1].toString();
        //日
        String days = strss[2].toString();
        String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
        String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时";
        String ss = regionWeightService.selectCodeM();
        String[] split = ss.split(",");
        String strArrays = "";
@@ -1035,7 +1043,7 @@
            });
            //拼接前3位降雨最大的区域
            double v3 = (double) Math.round(num * 10) / 10;
            String text = "全市日平均降雨量:" + v3 + "(毫米)。 ";
            String text = "全市日平均降雨量:" + v3 + "毫米。 ";
            String text1 = "县市区平均降雨量前3位为: ";
            String tx = "";
            for (int i = 0; i < entryList2.size(); i++) {
@@ -1051,7 +1059,7 @@
                        mapa.put("dyp", as);
                        listc.add(mapa);
                        if (i < 3) {
                            tx += station_name + "降雨量为:" + as + "(毫米),";
                            tx += station_name + "降雨量为:" + as + "毫米,";
                        }
                    }
src/main/java/org/springblade/modules/river/controller/RiverRController.java
@@ -137,18 +137,18 @@
        //截取月日
        String[] strss = substrings.split("-");
        //月
        String years= strss[1].toString();
        String years = strss[1].toString();
        //日
        String days = strss[2].toString();
        //定义短信内容头
        String text = year + "月" + day + "日"+hs+"时"+"-"+years+ "月" + days + "日"+hss+"时";
        String text = year + "月" + day + "日" + hs + "时" + "-" + years + "月" + days + "日" + hss + "时";
        String texta = "";
        //定义统计数量
        int number = 0;
        //河道超警信息
        List<Map<String, Object>> selecthd = riverRService.selecthd(beginTime, endTime);
        Map<String, Object> sel = riverRService.sel();
        selecthd.add(sel);
        //Map<String, Object> sel = riverRService.sel();
        //selecthd.add(sel);
        //基本站信息
        List<Map<String, Object>> list1 = riverRService.selectP();
        //用来判断是否重复统计超警信息
@@ -164,6 +164,7 @@
        }
        //不为空遍历数据计算是否超出预警值
        else {
            int c = 0;
            for (int i = 0; i < selecthd.size(); i++) {
                //实时河道水位值
                BigDecimal z = (BigDecimal) selecthd.get(i).get("Z");
@@ -198,7 +199,8 @@
                                texta += stnm.replaceAll(" ", "") + "水位" + df.format(Z) + "米,";
                                if (selecthd.get(i).get("Q") == null) {
                                    texta += "流量暂无数据";
                                } else {DecimalFormat dfs = new DecimalFormat("#0.000");
                                } else {
                                    DecimalFormat dfs = new DecimalFormat("#0.000");
                                    texta += "流量" + Q + "立方米每秒;";
                                }
                            }
@@ -230,13 +232,13 @@
                            }
                        }
                    }
                    }
                }
            }
            if (number == 0) {
                text +="暂无河道超警戒信息。"+texta;
                text += "暂无河道超警戒信息。" + texta;
            } else {
                text +="有" + number + "个河道站超警戒。"+texta;
                text += "有" + number + "个河道站超警戒。" + texta;
            }
        }
        //河道涨幅,跌幅信息
@@ -264,50 +266,63 @@
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date sd1 = df.parse(maxTM);
            Date sd2 = df.parse(minTM);
            //如果最大时间大于最小时间就是涨幅
            if (sd1.after(sd2)) {
                //创建一个map集合保存涨幅数据
                double v = maxZ.doubleValue();
                double v1 = minZ.doubleValue();
                //涨幅值
                double v2 = v - v1;
                double v3 = (double) Math.round(v2 * 100) / 100;
                m1.put(Math.abs(v3), stnm.replaceAll(" ", "") + "站");
                c.put(stcd,Math.abs(v3));
            }
            //跌幅
            else {
                //创建一个map集合保存跌幅数据
                double v = maxZ.doubleValue();
                double v1 = minZ.doubleValue();
                //涨幅值
                double v2 = v1 - v;
                double v3 = (double) Math.round(v2 * 100) / 100;
                m2.put(Math.abs(v3), stnm.replaceAll(" ", "") + "站");
                c.put(stcd,v3);
            }
            double v = maxZ.doubleValue();
            double v1 = minZ.doubleValue();
            //涨幅值
            double v2 = v - v1;
            double v3 = (double) Math.round(v2 * 100) / 100;
            m1.put(v3, stnm.replaceAll(" ", "") + "站");
            c.put(stcd, v3);
        }
        if (m1.size()==0){
            text += "暂无涨幅信息。";
        }
        else {
            //获取涨幅最大的信息
        if (m1.size() != 0) {
            Object maxKey = getMaxKey(m1);
            String s1 = m1.get(maxKey).toString();
            text += "涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。";
            text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。";
        }
        if (m2.size()==0){
            text += "暂无跌幅信息。";
        }
        else {
            //获取跌幅最大的信息
            Object maxKey2 = getMaxKey(m2);
            String s2 = m2.get(maxKey2).toString();
            text += "跌幅最大的是:" + s2 + "(跌" + maxKey2 + "米)。";
        }
//            //如果最大时间大于最小时间就是涨幅
//            if (sd1.after(sd2)) {
//                //创建一个map集合保存涨幅数据
//                double v = maxZ.doubleValue();
//                double v1 = minZ.doubleValue();
//                //涨幅值
//                double v2 = v - v1;
//                double v3 = (double) Math.round(v2 * 100) / 100;
//                m1.put(Math.abs(v3), stnm.replaceAll(" ", "") + "站");
//                c.put(stcd,Math.abs(v3));
//
//
//            }
//            //跌幅
//            else {
//                //创建一个map集合保存跌幅数据
//                double v = maxZ.doubleValue();
//                double v1 = minZ.doubleValue();
//                //涨幅值
//                double v2 = v1 - v;
//                double v3 = (double) Math.round(v2 * 100) / 100;
//                m2.put(Math.abs(v3), stnm.replaceAll(" ", "") + "站");
//                c.put(stcd,v3);
//
//            }
//        }
//        if (m1.size()==0){
//            text += "暂无涨幅信息。";
//        }
//        else {
//            //获取涨幅最大的信息
//            Object maxKey = getMaxKey(m1);
//            String s1 = m1.get(maxKey).toString();
//            text += "涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。";
//        }
//        if (m2.size()==0){
//            text += "暂无跌幅信息。";
//        }
//        else {
//            //获取跌幅最大的信息
//            Object maxKey2 = getMaxKey(m2);
//            String s2 = m2.get(maxKey2).toString();
//            text += "跌幅最大的是:" + s2 + "(跌" + maxKey2 + "米)。";
//        }
        m.put("text", text);
        m.put("number", number);
        m.put("Yjlist", ylist);
@@ -326,7 +341,7 @@
     */
    @PostMapping("/selecthdt")
    public R selecthdt() throws ParseException {
        int w=1;
        int w = 1;
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = df.format(new Date());
        String yearc = time.substring(0, 4);
@@ -335,11 +350,11 @@
        int months = Integer.parseInt(monthc);
        String dayc = time.substring(8, 10);
        int days = Integer.parseInt(dayc);
        int da=days-w;
        int da = days - w;
        String hss = time.substring(11, 13);
        int hs = Integer.parseInt(hss);
        //前一天的8时
        String timec = years +"-" + months + "-"+da+" 08:00:00";
        String timec = years + "-" + months + "-" + da + " 08:00:00";
        //前24小时
        Calendar calendar6 = Calendar.getInstance();
        calendar6.set(Calendar.HOUR_OF_DAY, calendar6.get(Calendar.HOUR_OF_DAY) - 24);
@@ -352,7 +367,7 @@
        //日
        String day = strs[2].toString();
        //定义短信内容头
        String text = year + "月" + day + "日"+hs+"时";
        String text = year + "月" + day + "日" + hs + "时";
        String texta = "";
        //定义统计数量
        int number = 0;
@@ -361,15 +376,15 @@
        //定义List保存未警戒信息
        List blist = new ArrayList();
        //河道超警信息
        List<Map<String, Object>> selecthd = riverRService.selecthdt(dateBegin24,time);
        Map<String, Object> sel = riverRService.sel();
        selecthd.add(sel);
        List<Map<String, Object>> selecthd = riverRService.selecthdt(dateBegin24, time);
        //Map<String, Object> sel = riverRService.sel();
        //selecthd.add(sel);
        List<Map<String, Object>> list1 = riverRService.selectP();
        //用来判断是否重复统计超警信息
        Map mnum = new HashMap();
        //查询数据为空
        if (selecthd.size() == 0) {
            text +="暂无河道超警信息。廖家湾水位暂无数据,流量暂无数据;娄家村水位暂无数据,流量暂无数据;";
            text += "暂无河道超警信息。廖家湾水位暂无数据,流量暂无数据;娄家村水位暂无数据,流量暂无数据;";
        }
        //不为空遍历数据计算是否超出预警值
        else {
@@ -378,7 +393,7 @@
                BigDecimal z = (BigDecimal) selecthd.get(i).get("Z");
                double Z = z.doubleValue();
                //超警戒水位值
                if (selecthd.get(i).get("WRZ") == null || selecthd.get(i).get("Q")==null) {
                if (selecthd.get(i).get("WRZ") == null || selecthd.get(i).get("Q") == null) {
                    String stnm = selecthd.get(i).get("STNM").toString();
                    if (stnm.equals("廖家湾") || stnm.equals("娄家村")) {
                        String stcd = selecthd.get(i).get("STCD").toString();
@@ -389,15 +404,14 @@
                        DecimalFormat dfc = new DecimalFormat("#0.00");
                        String format = dfc.format(vz);
                        double v = Double.parseDouble(format);
                        texta +=stnm.replaceAll(" ", "") + "水位" + dfc.format(Z) + "米、";
                        if (v<0){
                            texta+="比昨日8时下跌"+Math.abs(v)+"米、";
                        texta += stnm.replaceAll(" ", "") + "水位" + dfc.format(Z) + "米、";
                        if (v < 0) {
                            texta += "比昨日8时下跌" + Math.abs(v) + "米、";
                        } else {
                            texta += "比昨日8时上涨" + Math.abs(v) + "米、";
                        }
                        else {
                            texta+="比昨日8时上涨"+Math.abs(v)+"米、";
                        }
                        if (selecthd.get(i).get("Q")==null){
                            texta+="流量暂无信息;";
                        if (selecthd.get(i).get("Q") == null) {
                            texta += "流量暂无信息;";
                        }
                    }
                    blist.add(selecthd.get(i));
@@ -418,19 +432,17 @@
                        DecimalFormat dfc = new DecimalFormat("#0.00");
                        String format = dfc.format(vz);
                        double v = Double.parseDouble(format);
                        texta +=stnm.replaceAll(" ", "") + "水位" + dfc.format(Z) + "米、";
                        if (v<0){
                            texta+="比昨日8时下跌"+Math.abs(v)+"米、";
                        texta += stnm.replaceAll(" ", "") + "水位" + dfc.format(Z) + "米、";
                        if (v < 0) {
                            texta += "比昨日8时下跌" + Math.abs(v) + "米、";
                        } else {
                            texta += "比昨日8时上涨" + Math.abs(v) + "米、";
                        }
                        else {
                            texta+="比昨日8时上涨"+Math.abs(v)+"米、";
                        }
                        if (selecthd.get(i).get("Q")==null){
                            texta+="流量暂无数据;";
                        }
                        else {
                        if (selecthd.get(i).get("Q") == null) {
                            texta += "流量暂无数据;";
                        } else {
                            //DecimalFormat dfl = new DecimalFormat("#0.000");
                            texta+="流量"+Q+"立方米每秒;";
                            texta += "流量" + Q + "立方米每秒;";
                        }
                    }
                    blist.add(selecthd.get(i));
@@ -457,28 +469,26 @@
                            DecimalFormat dfc = new DecimalFormat("#0.00");
                            String format = dfc.format(vz);
                            double v = Double.parseDouble(format);
                            texta += "。" + stnm.replaceAll(" ", "") + "站超出警戒水位" + dfc.format(v3) + "米、"+ "水位" + dfc.format(Z) + "米、";
                            if (v<0){
                                texta+="比昨日8时下跌"+Math.abs(v)+"米、";
                            texta += "。" + stnm.replaceAll(" ", "") + "站超出警戒水位" + dfc.format(v3) + "米、" + "水位" + dfc.format(Z) + "米、";
                            if (v < 0) {
                                texta += "比昨日8时下跌" + Math.abs(v) + "米、";
                            } else {
                                texta += "比昨日8时上涨" + Math.abs(v) + "米、";
                            }
                            else {
                                texta+="比昨日8时上涨"+Math.abs(v)+"米、";
                            }
                            if (selecthd.get(i).get("Q")==null){
                                texta+="流量暂无数据、";
                            }
                            else {
                            if (selecthd.get(i).get("Q") == null) {
                                texta += "流量暂无数据、";
                            } else {
                                DecimalFormat dfl = new DecimalFormat("#0.000");
                                texta+="流量"+Q+"立方米每秒;";
                                texta += "流量" + Q + "立方米每秒;";
                            }
                        }
                    }
                }
            }
            if (number == 0) {
                text +="暂无河道超警戒信息。"+texta;
                text += "暂无河道超警戒信息。" + texta;
            } else {
                text +="有" + number + "个河道站超警戒。" + texta;
                text += "有" + number + "个河道站超警戒。" + texta;
            }
        }
        Map m = new HashMap();
@@ -491,13 +501,15 @@
        list.add(m);
        return R.data(list);
    }
    /**
     * 河道实时预警
     *
     * @return
     */
    @ApiLog("河道实时预警")
    @PostMapping("/selecthdyj")
    public R selecthdyj(String times,int k) {
    public R selecthdyj(String times, int k) {
        Date date = null;
        // 把Date按照格式转换成字符串
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -508,51 +520,44 @@
        }
        String dateEnd = sdf.format(date);
        List<Map<String, Object>> list;
        if(k==13){
            list= riverRService.selecthdyj(times,dateEnd);
        }
        else {
            list= riverRService.selecthdyj(times,dateEnd);
        if (k == 13) {
            list = riverRService.selecthdyj(times, dateEnd);
        } else {
            list = riverRService.selecthdyj(times, dateEnd);
        }
        List<Map<String, Object>> lists = new ArrayList<>();
        for (int i =0;i<list.size();i++) {
        for (int i = 0; i < list.size(); i++) {
            Map<String, Object> maps = new HashMap<String, Object>();
            BigDecimal b = (BigDecimal) list.get(i).get("Z");
            int i1 = b.intValue();
            if(i1==0){
                list.get(i).put("yuc","无预警");
            }
            else {
            if (i1 == 0) {
                list.get(i).put("yuc", "无预警");
            } else {
                BigDecimal bigDecimalz = (BigDecimal) list.get(i).get("Z");//实时水位
                BigDecimal bigDecimalw = (BigDecimal) list.get(i).get("WRZ");//警戒水位
                double wrz = bigDecimalw.doubleValue();//警戒水位
                double z = bigDecimalz.doubleValue();//实时水位
                Double fy= (Double) list.get(i).get("fy");
                Double oy= (Double) list.get(i).get("oy");
                Double toy= (Double) list.get(i).get("toy");
                Double ty= (Double) list.get(i).get("ty");
                if(z<wrz || wrz==0){
                    list.get(i).put("yuc","无预警");
                }
                else if(z>=wrz && z<fy){
                    list.get(i).put("yuc","蓝色预警");
                }
                else if(z>=fy && z<oy){
                    list.get(i).put("yuc","黄色预警");
                }
                else if(z>=oy && z<ty){
                    list.get(i).put("yuc","橙色预警");
                }
                else {
                    list.get(i).put("yuc","红色预警");
                Double fy = (Double) list.get(i).get("fy");
                Double oy = (Double) list.get(i).get("oy");
                Double toy = (Double) list.get(i).get("toy");
                Double ty = (Double) list.get(i).get("ty");
                if (z < wrz || wrz == 0) {
                    list.get(i).put("yuc", "无预警");
                } else if (z >= wrz && z < fy) {
                    list.get(i).put("yuc", "蓝色预警");
                } else if (z >= fy && z < oy) {
                    list.get(i).put("yuc", "黄色预警");
                } else if (z >= oy && z < ty) {
                    list.get(i).put("yuc", "橙色预警");
                } else {
                    list.get(i).put("yuc", "红色预警");
                }
            }
            maps.put("YjList",list.get(i));
            maps.put("YjList", list.get(i));
            lists.add(maps);
        }
        return R.data(lists);
    }
    /**
src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java
@@ -449,11 +449,11 @@
                m1.put(v3, stnm.replaceAll(" ", "") + "站");
                c.put(stcd, v3);
                //获取涨幅最大的信息
                if (m1.size()!=0) {
                    Object maxKey = getMaxKey(m1);
                    String s1 = m1.get(maxKey).toString();
                    text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。";
                }
            }
            if (m1.size() != 0) {
                Object maxKey = getMaxKey(m1);
                String s1 = m1.get(maxKey).toString();
                text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。";
            }
//                //如果最大时间大于最小时间就是涨幅
//                if (sd1.after(sd2)) {
@@ -490,196 +490,280 @@
//                String s2 = m2.get(maxKey2).toString();
//                text += " 跌幅最大的是:" + s2 + "(跌" + maxKey2 + "米)。";
//            }
                m.put("text", text);
                m.put("number", number);
                m.put("Yjlist", ylist);
                m.put("list", alist);
                m.put("clist", c);
                list.add(m);
            }
            return R.data(list);
            m.put("text", text);
            m.put("number", number);
            m.put("Yjlist", ylist);
            m.put("list", alist);
            m.put("clist", c);
            list.add(m);
        }
        return R.data(list);
    }
        /**
         * 水库水情最新信息
         */
        @PostMapping("/selectyjcks")
        public R selectyjcks () throws ParseException {
            int ws = 1;
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String time = df.format(new Date());
            SimpleDateFormat dfz = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
            String timez = dfz.format(new Date());
            String yearc = time.substring(0, 4);
            int years = Integer.parseInt(yearc);
            String monthc = time.substring(5, 7);
            int months = Integer.parseInt(monthc);
            String dayc = time.substring(8, 10);
            int days = Integer.parseInt(dayc);
            int da = days - ws;
            String hss = time.substring(11, 13);
            int hs = Integer.parseInt(hss);
            //前一天8时
            String timec = years + "-" + months + "-" + da + " 08:00:00";
            //前24小时
            Calendar calendar6 = Calendar.getInstance();
            calendar6.set(Calendar.HOUR_OF_DAY, calendar6.get(Calendar.HOUR_OF_DAY) - 24);
            String dateBegin24 = df.format(calendar6.getTime());
    /**
     * 水库水情最新信息
     */
    @PostMapping("/selectyjcks")
    public R selectyjcks() throws ParseException {
        int ws = 1;
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = df.format(new Date());
        SimpleDateFormat dfz = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
        String timez = dfz.format(new Date());
        String yearc = time.substring(0, 4);
        int years = Integer.parseInt(yearc);
        String monthc = time.substring(5, 7);
        int months = Integer.parseInt(monthc);
        String dayc = time.substring(8, 10);
        int days = Integer.parseInt(dayc);
        int da = days - ws;
        String hss = time.substring(11, 13);
        int hs = Integer.parseInt(hss);
        //前一天8时
        String timec = years + "-" + months + "-" + da + " 08:00:00";
        //前24小时
        Calendar calendar6 = Calendar.getInstance();
        calendar6.set(Calendar.HOUR_OF_DAY, calendar6.get(Calendar.HOUR_OF_DAY) - 24);
        String dateBegin24 = df.format(calendar6.getTime());
            String substring = time.substring(0, 10);
            //截取月日
            String[] strs = substring.split("-");
            //月
            String year = strs[1].toString();
            //日
            String day = strs[2].toString();
            //定义短信内容头
            String text = year + "月" + day + "日" + hs + "时";
            String texta = "";
            String texth = "";
            //定义统计数量
            int number = 0;
            String mouz = year + day;
            Integer mou = Integer.parseInt(mouz);
            String egmd = "";
            String edmd = "";
            List<Map<String, Object>> selectfx = rsvrRService.selectfx();
            String b = (String) selectfx.get(0).get("BGMD");
            String e = (String) selectfx.get(0).get("EDMD");
            String b2 = (String) selectfx.get(1).get("BGMD");
            String e2 = (String) selectfx.get(1).get("EDMD");
            int bs = Integer.parseInt(b.trim());
            int es = Integer.parseInt(e.trim());
            int b2s = Integer.parseInt(b2.trim());
            int e2s = Integer.parseInt(e2.trim());
            if (mou >= bs && mou <= es) {
        String substring = time.substring(0, 10);
        //截取月日
        String[] strs = substring.split("-");
        //月
        String year = strs[1].toString();
        //日
        String day = strs[2].toString();
        //定义短信内容头
        String text = year + "月" + day + "日" + hs + "时";
        String texta = "";
        String texth = "";
        //定义统计数量
        int number = 0;
        String mouz = year + day;
        Integer mou = Integer.parseInt(mouz);
        String egmd = "";
        String edmd = "";
        List<Map<String, Object>> selectfx = rsvrRService.selectfx();
        String b = (String) selectfx.get(0).get("BGMD");
        String e = (String) selectfx.get(0).get("EDMD");
        String b2 = (String) selectfx.get(1).get("BGMD");
        String e2 = (String) selectfx.get(1).get("EDMD");
        int bs = Integer.parseInt(b.trim());
        int es = Integer.parseInt(e.trim());
        int b2s = Integer.parseInt(b2.trim());
        int e2s = Integer.parseInt(e2.trim());
        if (mou >= bs && mou <= es) {
            egmd = b;
            edmd = e;
        } else if (mou >= b2s && mou <= e2s) {
            egmd = b2;
            edmd = e2;
        } else {
            String mous = "0901";
            int m = Integer.parseInt(mous);
            if (m >= bs && m <= es) {
                egmd = b;
                edmd = e;
            } else if (mou >= b2s && mou <= e2s) {
            } else if (m >= b2s && m <= e2s) {
                egmd = b2;
                edmd = e2;
            } else {
                String mous = "0901";
                int m = Integer.parseInt(mous);
                if (m >= bs && m <= es) {
                    egmd = b;
                    edmd = e;
                } else if (m >= b2s && m <= e2s) {
                    egmd = b2;
                    edmd = e2;
                }
            }
            //水库水情预警信息
            List<Map<String, Object>> map = rsvrRService.selectyjcks(egmd, edmd, timec, timez);
            //用来判断是否重复统计超警信息
            Map mnum = new HashMap();
            //定义list保存预警信息
            List alist = new ArrayList();
            List blist = new ArrayList();
            double RZ = 0.0;
            double v = 0.0;
            //定义list保存未预警信息
            //查询数据为空
            if (map.size() == 0) {
                text += "暂无水库超汛限。$$$$$洪门水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据;$$$$$廖坊水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据。";
            } else {
                for (int i = 0; i < map.size(); i++) {
                    BigDecimal rz = (BigDecimal) map.get(i).get("RZ");
                    RZ = rz.doubleValue();
                    String stcd = map.get(i).get("STCD").toString();
                    String ti = map.get(i).get("TM").toString();
                    Map<String, Object> stringObjectMap = rsvrRService.selectRZ(stcd, timec);
                    //BigDecimal zc = (BigDecimal) stringObjectMap.get("RZ");
                    BigDecimal zc = (BigDecimal) map.get(i).get("RZS");
                    double ZC = zc.doubleValue();
                    Double vs = RZ - ZC;
                    DecimalFormat dfc = new DecimalFormat("#0.00");
                    String format = dfc.format(vs);
                    v = Double.parseDouble(format);
                    if (map.get(i).get("FSLTDZ") == null || RZ == 0) {
                        String addvcd5 = map.get(i).get("ADDVNM").toString();
                        //站点名称
                        String stnm = map.get(i).get("STNM").toString();
                        //实时水库水位值
                        if (stnm.equals("洪门")) {
                            texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
                            if (RZ == 0) {
                                texta += "库水位暂无数据、";
                            } else {
                                texta += "库水位" + RZ + "米、";
                            }
                            if (v < 0) {
                                texta += "比昨日8时下降" + Math.abs(v) + "米、";
                            } else {
                                texta += "比昨日8时上涨" + Math.abs(v) + "米、";
                            }
                            if (map.get(i).get("INQ") == null) {
                                texta += "入库流量暂无数据、";
                            } else {
                                BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                double INQ = inq.doubleValue();
                                texta += "入库流量" + INQ + "立方米每秒、";
                            }
                            if (map.get(i).get("W") == null) {
                                texta += "蓄水量暂无数据、";
                            } else {
                                BigDecimal w = (BigDecimal) map.get(i).get("W");
                                double W = w.doubleValue();
                                texta += "蓄水量" + W + "百万立方米、";
                            }
                            if (map.get(i).get("OTQ") == null) {
                                texta += "出库流量暂无数据、";
                            } else {
                                BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                double OTQ = otq.doubleValue();
                                texta += "出库流量" + OTQ + "立方米每秒;";
                            }
//                        texta += "汛限水位暂无数据;";
                        } else if (stnm.equals("廖坊")) {
                            texth += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
                            if (RZ == 0) {
                                texth += "库水位暂无数据、";
                            } else {
                                texth += "库水位" + RZ + "米、";
                            }
                            if (v < 0) {
                                texth += "比昨日8时下降" + Math.abs(v) + "米、";
                            } else {
                                texth += "比昨日8时上涨" + Math.abs(v) + "米、";
                            }
                            if (map.get(i).get("INQ") == null) {
                                texth += "入库流量暂无数据、";
                            } else {
                                BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                double INQ = inq.doubleValue();
                                texth += "入库流量" + INQ + "立方米每秒、";
                            }
                            if (map.get(i).get("W") == null) {
                                texth += "蓄水量暂无数据、";
                            } else {
                                BigDecimal w = (BigDecimal) map.get(i).get("W");
                                double W = w.doubleValue();
                                texth += "蓄水量" + W + "百万立方米、";
                            }
                            if (map.get(i).get("OTQ") == null) {
                                texth += "出库流量暂无数据、";
                            } else {
                                BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                double OTQ = otq.doubleValue();
                                texth += "出库流量" + OTQ + "立方米每秒。";
                            }
        }
        //水库水情预警信息
        List<Map<String, Object>> map = rsvrRService.selectyjcks(egmd, edmd, timec, timez);
        //用来判断是否重复统计超警信息
        Map mnum = new HashMap();
        //定义list保存预警信息
        List alist = new ArrayList();
        List blist = new ArrayList();
        double RZ = 0.0;
        double v = 0.0;
        //定义list保存未预警信息
        //查询数据为空
        if (map.size() == 0) {
            text += "暂无水库超汛限。$$$$$洪门水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据;$$$$$廖坊水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据。";
        } else {
            for (int i = 0; i < map.size(); i++) {
                BigDecimal rz = (BigDecimal) map.get(i).get("RZ");
                RZ = rz.doubleValue();
                String stcd = map.get(i).get("STCD").toString();
                String ti = map.get(i).get("TM").toString();
                Map<String, Object> stringObjectMap = rsvrRService.selectRZ(stcd, timec);
                //BigDecimal zc = (BigDecimal) stringObjectMap.get("RZ");
                BigDecimal zc = (BigDecimal) map.get(i).get("RZS");
                double ZC = zc.doubleValue();
                Double vs = RZ - ZC;
                DecimalFormat dfc = new DecimalFormat("#0.00");
                String format = dfc.format(vs);
                v = Double.parseDouble(format);
                if (map.get(i).get("FSLTDZ") == null || RZ == 0) {
                    String addvcd5 = map.get(i).get("ADDVNM").toString();
                    //站点名称
                    String stnm = map.get(i).get("STNM").toString();
                    //实时水库水位值
                    if (stnm.equals("洪门")) {
                        texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
                        if (RZ == 0) {
                            texta += "库水位暂无数据、";
                        } else {
                            texta += "库水位" + RZ + "米、";
                        }
                        blist.add(map.get(i));
                        continue;
                        if (v < 0) {
                            texta += "比昨日8时下降" + Math.abs(v) + "米、";
                        } else {
                            texta += "比昨日8时上涨" + Math.abs(v) + "米、";
                        }
                        if (map.get(i).get("INQ") == null) {
                            texta += "入库流量暂无数据、";
                        } else {
                            BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                            double INQ = inq.doubleValue();
                            texta += "入库流量" + INQ + "立方米每秒、";
                        }
                        if (map.get(i).get("W") == null) {
                            texta += "蓄水量暂无数据、";
                        } else {
                            BigDecimal w = (BigDecimal) map.get(i).get("W");
                            double W = w.doubleValue();
                            texta += "蓄水量" + W + "百万立方米、";
                        }
                        if (map.get(i).get("OTQ") == null) {
                            texta += "出库流量暂无数据、";
                        } else {
                            BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                            double OTQ = otq.doubleValue();
                            texta += "出库流量" + OTQ + "立方米每秒;";
                        }
//                        texta += "汛限水位暂无数据;";
                    } else if (stnm.equals("廖坊")) {
                        texth += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
                        if (RZ == 0) {
                            texth += "库水位暂无数据、";
                        } else {
                            texth += "库水位" + RZ + "米、";
                        }
                        if (v < 0) {
                            texth += "比昨日8时下降" + Math.abs(v) + "米、";
                        } else {
                            texth += "比昨日8时上涨" + Math.abs(v) + "米、";
                        }
                        if (map.get(i).get("INQ") == null) {
                            texth += "入库流量暂无数据、";
                        } else {
                            BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                            double INQ = inq.doubleValue();
                            texth += "入库流量" + INQ + "立方米每秒、";
                        }
                        if (map.get(i).get("W") == null) {
                            texth += "蓄水量暂无数据、";
                        } else {
                            BigDecimal w = (BigDecimal) map.get(i).get("W");
                            double W = w.doubleValue();
                            texth += "蓄水量" + W + "百万立方米、";
                        }
                        if (map.get(i).get("OTQ") == null) {
                            texth += "出库流量暂无数据、";
                        } else {
                            BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                            double OTQ = otq.doubleValue();
                            texth += "出库流量" + OTQ + "立方米每秒。";
                        }
                    }
                    BigDecimal fsltdz = (BigDecimal) map.get(i).get("FSLTDZ");
                    double FSLTDZ = fsltdz.doubleValue();
                    if (RZ <= FSLTDZ) {
                    blist.add(map.get(i));
                    continue;
                }
                BigDecimal fsltdz = (BigDecimal) map.get(i).get("FSLTDZ");
                double FSLTDZ = fsltdz.doubleValue();
                if (RZ <= FSLTDZ) {
                    //县,市
                    String addvcd5 = map.get(i).get("ADDVNM").toString();
                    //站点名称
                    String stnm = map.get(i).get("STNM").toString();
                    //站点名称
                    if (stnm.equals("洪门")) {
                        texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
                        if (RZ == 0) {
                            texta += "库水位暂无数据、";
                        } else {
                            texta += "库水位" + RZ + "米、";
                        }
                        if (v < 0) {
                            texta += "比昨日8时下降" + Math.abs(v) + "米、";
                        } else {
                            texta += "比昨日8时上涨" + Math.abs(v) + "米、";
                        }
                        if (map.get(i).get("INQ") == null) {
                            texta += "入库流量暂无数据、";
                        } else {
                            BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                            double INQ = inq.doubleValue();
                            texta += "入库流量" + INQ + "立方米每秒、";
                        }
                        if (map.get(i).get("W") == null) {
                            texta += "蓄水量暂无数据、";
                        } else {
                            BigDecimal w = (BigDecimal) map.get(i).get("W");
                            double W = w.doubleValue();
                            texta += "蓄水量" + W + "百万立方米、";
                        }
                        if (map.get(i).get("OTQ") == null) {
                            texta += "出库流量暂无数据;";
                        } else {
                            BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                            double OTQ = otq.doubleValue();
                            texta += "出库流量" + OTQ + "立方米每秒;";
                        }
//                        texta += "汛限水位暂无数据;";
                    } else if (stnm.equals("廖坊")) {
                        texth += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
                        if (RZ == 0) {
                            texth += "库水位暂无数据、";
                        } else {
                            texth += "库水位" + RZ + "米、";
                        }
                        if (v < 0) {
                            texth += "比昨日8时下降" + Math.abs(v) + "米、";
                        } else {
                            texth += "比昨日8时上涨" + Math.abs(v) + "米、";
                        }
                        if (map.get(i).get("INQ") == null) {
                            texth += "入库流量暂无数据、";
                        } else {
                            BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                            double INQ = inq.doubleValue();
                            texth += "入库流量" + INQ + "立方米每秒、";
                        }
                        if (map.get(i).get("W") == null) {
                            texth += "蓄水量暂无数据、";
                        } else {
                            BigDecimal w = (BigDecimal) map.get(i).get("W");
                            double W = w.doubleValue();
                            texth += "蓄水量" + W + "百万立方米、";
                        }
                        if (map.get(i).get("OTQ") == null) {
                            texth += "出库流量暂无数据。";
                        } else {
                            BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                            double OTQ = otq.doubleValue();
                            texth += "出库流量" + OTQ + "立方米每秒。";
                        }
                    }
                    blist.add(map.get(i));
                } else {
                    //如果map集合保存了站点则不重复统计数量
                    //如果map集合保存了站点则不重复统计数量
                    if (mnum.containsKey(map.get(i).get("STCD").toString()) == true) {
                    } else {
                        alist.add(map.get(i));
                        mnum.put(map.get(i).get("STCD").toString(), i);
                        number++;
                        //超出警戒水位多少
                        Double num = RZ - FSLTDZ;
                        double v3 = (double) Math.round(num * 100) / 100;
                        //县,市
                        String addvcd5 = map.get(i).get("ADDVNM").toString();
                        //站点名称
                        String stnm = map.get(i).get("STNM").toString();
                        //站点名称
                        if (stnm.equals("洪门")) {
                            texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
                            if (RZ == 0) {
@@ -748,302 +832,218 @@
                                texth += "出库流量" + OTQ + "立方米每秒。";
                            }
                        }
                        blist.add(map.get(i));
                    } else {
                        //如果map集合保存了站点则不重复统计数量
                        //如果map集合保存了站点则不重复统计数量
                        if (mnum.containsKey(map.get(i).get("STCD").toString()) == true) {
                        } else {
                            alist.add(map.get(i));
                            mnum.put(map.get(i).get("STCD").toString(), i);
                            number++;
                            //超出警戒水位多少
                            Double num = RZ - FSLTDZ;
                            double v3 = (double) Math.round(num * 100) / 100;
                            //县,市
                            String addvcd5 = map.get(i).get("ADDVNM").toString();
                            //站点名称
                            String stnm = map.get(i).get("STNM").toString();
                            if (stnm.equals("洪门")) {
                                texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
                                if (RZ == 0) {
                                    texta += "库水位暂无数据、";
                                } else {
                                    texta += "库水位" + RZ + "米、";
                                }
                                if (v < 0) {
                                    texta += "比昨日8时下降" + Math.abs(v) + "米、";
                                } else {
                                    texta += "比昨日8时上涨" + Math.abs(v) + "米、";
                                }
                                if (map.get(i).get("INQ") == null) {
                                    texta += "入库流量暂无数据、";
                                } else {
                                    BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                    double INQ = inq.doubleValue();
                                    texta += "入库流量" + INQ + "立方米每秒、";
                                }
                                if (map.get(i).get("W") == null) {
                                    texta += "蓄水量暂无数据、";
                                } else {
                                    BigDecimal w = (BigDecimal) map.get(i).get("W");
                                    double W = w.doubleValue();
                                    texta += "蓄水量" + W + "百万立方米、";
                                }
                                if (map.get(i).get("OTQ") == null) {
                                    texta += "出库流量暂无数据;";
                                } else {
                                    BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                    double OTQ = otq.doubleValue();
                                    texta += "出库流量" + OTQ + "立方米每秒;";
                                }
//                        texta += "汛限水位暂无数据;";
                            } else if (stnm.equals("廖坊")) {
                                texth += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
                                if (RZ == 0) {
                                    texth += "库水位暂无数据、";
                                } else {
                                    texth += "库水位" + RZ + "米、";
                                }
                                if (v < 0) {
                                    texth += "比昨日8时下降" + Math.abs(v) + "米、";
                                } else {
                                    texth += "比昨日8时上涨" + Math.abs(v) + "米、";
                                }
                                if (map.get(i).get("INQ") == null) {
                                    texth += "入库流量暂无数据、";
                                } else {
                                    BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                    double INQ = inq.doubleValue();
                                    texth += "入库流量" + INQ + "立方米每秒、";
                                }
                                if (map.get(i).get("W") == null) {
                                    texth += "蓄水量暂无数据、";
                                } else {
                                    BigDecimal w = (BigDecimal) map.get(i).get("W");
                                    double W = w.doubleValue();
                                    texth += "蓄水量" + W + "百万立方米、";
                                }
                                if (map.get(i).get("OTQ") == null) {
                                    texth += "出库流量暂无数据。";
                                } else {
                                    BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                    double OTQ = otq.doubleValue();
                                    texth += "出库流量" + OTQ + "立方米每秒。";
                                }
                            }
                        }
                    }
                }
                if (number == 0) {
                    text += texta + texth;
                } else {
                    text += "有" + number + "个水库站超汛限;" + texta + texth;
                }
            }
            Map m = new HashMap();
            List list = new ArrayList();
            m.put("text", text);
            m.put("number", number);
            m.put("Yjlist", alist);
            m.put("list", blist);
            list.add(m);
            return R.data(list);
        }
        /**
         * 水库详情
         *
         * @param stcd
         * @return
         */
        @PostMapping("/selectInfo")
        public R selectInfo (String stcd){
            return R.data(rsvrRService.selectInfo(stcd));
        }
        @PostMapping("/selectTinfo")
        public R selectTinfo (String stcd){
            Calendar cal = Calendar.getInstance();
            int mnth = cal.get(Calendar.MONTH) + 1;
            return R.data(rsvrRService.selectTinfo(mnth, stcd));
        }
        /**
         * 求Map<K,V>中Key(键)的最大值
         *
         * @param map
         * @return
         */
        public static Object getMaxKey (Map < Double, Integer > map){
            if (map == null) return null;
            Set<Double> set = map.keySet();
            Object[] obj = set.toArray();
            Arrays.sort(obj);
            return obj[obj.length - 1];
        }
        /**
         * 求Map<K,V>中Value(值)的最大值
         *
         * @param map
         * @return
         */
        public static Object getMaxValue (Map < Integer, Integer > map){
            if (map == null) return null;
            Collection<Integer> c = map.values();
            Object[] obj = c.toArray();
            Arrays.sort(obj);
            return obj[obj.length - 1];
        }
        /**
         * 水位流量曲线
         *
         * @param stcd
         * @return
         */
        @PostMapping("/selList")
        public R selList (String stcd){
            List<Map<String, Object>> newList = rsvrRService.selList(stcd);
            Map<String, List<Map>> mm = new HashMap();
            for (Map temp : newList) {
                if (mm.containsKey(temp.get("LNNM")))
                    mm.get(temp.get("LNNM")).add(temp);
                else {
                    List<Map> ll = new ArrayList<>();
                    ll.add(temp);
                    mm.put((String) temp.get("LNNM"), ll);
                }
            if (number == 0) {
                text += texta + texth;
            } else {
                text += "有" + number + "个水库站超汛限;" + texta + texth;
            }
            List<List<Map>> res = new ArrayList();
            for (Map.Entry<String, List<Map>> et : mm.entrySet()) {
                res.add(et.getValue());
        }
        Map m = new HashMap();
        List list = new ArrayList();
        m.put("text", text);
        m.put("number", number);
        m.put("Yjlist", alist);
        m.put("list", blist);
        list.add(m);
        return R.data(list);
    }
    /**
     * 水库详情
     *
     * @param stcd
     * @return
     */
    @PostMapping("/selectInfo")
    public R selectInfo(String stcd) {
        return R.data(rsvrRService.selectInfo(stcd));
    }
    @PostMapping("/selectTinfo")
    public R selectTinfo(String stcd) {
        Calendar cal = Calendar.getInstance();
        int mnth = cal.get(Calendar.MONTH) + 1;
        return R.data(rsvrRService.selectTinfo(mnth, stcd));
    }
    /**
     * 求Map<K,V>中Key(键)的最大值
     *
     * @param map
     * @return
     */
    public static Object getMaxKey(Map<Double, Integer> map) {
        if (map == null) return null;
        Set<Double> set = map.keySet();
        Object[] obj = set.toArray();
        Arrays.sort(obj);
        return obj[obj.length - 1];
    }
    /**
     * 求Map<K,V>中Value(值)的最大值
     *
     * @param map
     * @return
     */
    public static Object getMaxValue(Map<Integer, Integer> map) {
        if (map == null) return null;
        Collection<Integer> c = map.values();
        Object[] obj = c.toArray();
        Arrays.sort(obj);
        return obj[obj.length - 1];
    }
    /**
     * 水位流量曲线
     *
     * @param stcd
     * @return
     */
    @PostMapping("/selList")
    public R selList(String stcd) {
        List<Map<String, Object>> newList = rsvrRService.selList(stcd);
        Map<String, List<Map>> mm = new HashMap();
        for (Map temp : newList) {
            if (mm.containsKey(temp.get("LNNM")))
                mm.get(temp.get("LNNM")).add(temp);
            else {
                List<Map> ll = new ArrayList<>();
                ll.add(temp);
                mm.put((String) temp.get("LNNM"), ll);
            }
            return R.data(res);
        }
        /**
         * 库容曲线
         *
         * @param stcd
         * @return
         */
        @PostMapping("/selLists")
        public R selLists (String stcd){
            return R.data(rsvrRService.selLists(stcd));
        List<List<Map>> res = new ArrayList();
        for (Map.Entry<String, List<Map>> et : mm.entrySet()) {
            res.add(et.getValue());
        }
        return R.data(res);
    }
    /**
     * 库容曲线
     *
     * @param stcd
     * @return
     */
    @PostMapping("/selLists")
    public R selLists(String stcd) {
        return R.data(rsvrRService.selLists(stcd));
    }
        /**
         * 水库站水位流量过程接口
         */
        @PostMapping("/selectRsvrList")
        @ApiOperation(value = "水库站水位过程接口", notes = "code,dateBegin,dateEnd")
        public R selectRsvrList (String code, String dateBegin, String dateEnd){
            List<Map<String, Object>> list = rsvrRService.selectRsvrList(code, dateBegin, dateEnd);
            return R.data(list);
    /**
     * 水库站水位流量过程接口
     */
    @PostMapping("/selectRsvrList")
    @ApiOperation(value = "水库站水位过程接口", notes = "code,dateBegin,dateEnd")
    public R selectRsvrList(String code, String dateBegin, String dateEnd) {
        List<Map<String, Object>> list = rsvrRService.selectRsvrList(code, dateBegin, dateEnd);
        return R.data(list);
    }
    /**
     * 河道水位流量过程接口
     */
    @PostMapping("/selectRiverList")
    @ApiOperation(value = "水库站水位过程接口", notes = "code,dateBegin,dateEnd")
    public R selectRiverList(String code, String dateBegin, String dateEnd) {
        List<Map<String, Object>> list = rsvrRService.selectRsvrLists(code, dateBegin, dateEnd);
        return R.data(list);
    }
    /**
     * 水库实时预警
     */
    @ApiLog("水库实时预警")
    @PostMapping("/selectyj")
    @ApiOperation(value = "水库实时预警", notes = "")
    public R selectyj(String times, int mou, int k) {
        Date date = null;
        // 把Date按照格式转换成字符串
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            date = sdf.parse(times);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        String dateEnd = sdf.format(date);
        /**
         * 河道水位流量过程接口
         */
        @PostMapping("/selectRiverList")
        @ApiOperation(value = "水库站水位过程接口", notes = "code,dateBegin,dateEnd")
        public R selectRiverList (String code, String dateBegin, String dateEnd){
            List<Map<String, Object>> list = rsvrRService.selectRsvrLists(code, dateBegin, dateEnd);
            return R.data(list);
        }
        /**
         * 水库实时预警
         */
        @ApiLog("水库实时预警")
        @PostMapping("/selectyj")
        @ApiOperation(value = "水库实时预警", notes = "")
        public R selectyj (String times,int mou, int k){
            Date date = null;
            // 把Date按照格式转换成字符串
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            try {
                date = sdf.parse(times);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            String dateEnd = sdf.format(date);
            String egmd = "";
            String edmd = "";
            List<Map<String, Object>> selectfx = rsvrRService.selectfx();
            String b = (String) selectfx.get(0).get("BGMD");
            String e = (String) selectfx.get(0).get("EDMD");
            String b2 = (String) selectfx.get(1).get("BGMD");
            String e2 = (String) selectfx.get(1).get("EDMD");
            int bs = Integer.parseInt(b.trim());
            int es = Integer.parseInt(e.trim());
            int b2s = Integer.parseInt(b2.trim());
            int e2s = Integer.parseInt(e2.trim());
            if (mou >= bs && mou <= es) {
        String egmd = "";
        String edmd = "";
        List<Map<String, Object>> selectfx = rsvrRService.selectfx();
        String b = (String) selectfx.get(0).get("BGMD");
        String e = (String) selectfx.get(0).get("EDMD");
        String b2 = (String) selectfx.get(1).get("BGMD");
        String e2 = (String) selectfx.get(1).get("EDMD");
        int bs = Integer.parseInt(b.trim());
        int es = Integer.parseInt(e.trim());
        int b2s = Integer.parseInt(b2.trim());
        int e2s = Integer.parseInt(e2.trim());
        if (mou >= bs && mou <= es) {
            egmd = b;
            edmd = e;
        } else if (mou >= b2s && mou <= e2s) {
            egmd = b2;
            edmd = e2;
        } else {
            String mous = "0901";
            int m = Integer.parseInt(mous);
            if (m >= bs && m <= es) {
                egmd = b;
                edmd = e;
            } else if (mou >= b2s && mou <= e2s) {
            } else if (m >= b2s && m <= e2s) {
                egmd = b2;
                edmd = e2;
            } else {
                String mous = "0901";
                int m = Integer.parseInt(mous);
                if (m >= bs && m <= es) {
                    egmd = b;
                    edmd = e;
                } else if (m >= b2s && m <= e2s) {
                    egmd = b2;
                    edmd = e2;
                }
            }
            List<Map<String, Object>> map;
            if (k == 13) {
                map = rsvrRService.selectyj(egmd, edmd, times, dateEnd);
        }
        List<Map<String, Object>> map;
        if (k == 13) {
            map = rsvrRService.selectyj(egmd, edmd, times, dateEnd);
        } else {
            map = rsvrRService.selectyj(egmd, edmd, times, dateEnd);
        }
        List<Map<String, Object>> lists = new ArrayList<>();
        for (int i = 0; i < map.size(); i++) {
            Map<String, Object> maps = new HashMap<String, Object>();
            BigDecimal bigDecimaldz = (BigDecimal) map.get(i).get("FSLTDZ");//汛限水位
            BigDecimal bigDecimalrz = (BigDecimal) map.get(i).get("RZ");//当前水位
            BigDecimal bigDecimallz = (BigDecimal) map.get(i).get("DSFLZ");//设计水位
            BigDecimal bigDecimalmz = (BigDecimal) map.get(i).get("NORMZ");//防洪高水位
            double dz = bigDecimaldz.doubleValue();
            double rz = bigDecimalrz.doubleValue();
            double lz = bigDecimallz.doubleValue();
            double mz = bigDecimalmz.doubleValue();
            double num = 0.5;
            double s = dz - num;
            if (dz == 0) {
                map.get(i).put("yj", "无预警");
                maps.put("YjList", map.get(i));
                lists.add(maps);
            } else {
                map = rsvrRService.selectyj(egmd, edmd, times, dateEnd);
            }
            List<Map<String, Object>> lists = new ArrayList<>();
            for (int i = 0; i < map.size(); i++) {
                Map<String, Object> maps = new HashMap<String, Object>();
                BigDecimal bigDecimaldz = (BigDecimal) map.get(i).get("FSLTDZ");//汛限水位
                BigDecimal bigDecimalrz = (BigDecimal) map.get(i).get("RZ");//当前水位
                BigDecimal bigDecimallz = (BigDecimal) map.get(i).get("DSFLZ");//设计水位
                BigDecimal bigDecimalmz = (BigDecimal) map.get(i).get("NORMZ");//防洪高水位
                double dz = bigDecimaldz.doubleValue();
                double rz = bigDecimalrz.doubleValue();
                double lz = bigDecimallz.doubleValue();
                double mz = bigDecimalmz.doubleValue();
                double num = 0.5;
                double s = dz - num;
                if (dz == 0) {
                if (rz > 0 && rz < s) {
                    map.get(i).put("yj", "无预警");
                    maps.put("YjList", map.get(i));
                    lists.add(maps);
                } else if (rz >= s && rz < dz) {
                    map.get(i).put("yj", "蓝色预警");
                } else if (rz >= dz && rz < mz) {
                    map.get(i).put("yj", "黄色预警");
                } else if (rz >= mz && rz < lz) {
                    map.get(i).put("yj", "橙色预警");
                } else {
                    if (rz > 0 && rz < s) {
                        map.get(i).put("yj", "无预警");
                    } else if (rz >= s && rz < dz) {
                        map.get(i).put("yj", "蓝色预警");
                    } else if (rz >= dz && rz < mz) {
                        map.get(i).put("yj", "黄色预警");
                    } else if (rz >= mz && rz < lz) {
                        map.get(i).put("yj", "橙色预警");
                    } else {
                        map.get(i).put("yj", "红色预警");
                    }
                    maps.put("YjList", map.get(i));
                    lists.add(maps);
                    map.get(i).put("yj", "红色预警");
                }
                maps.put("YjList", map.get(i));
                lists.add(maps);
            }
            return R.data(lists);
        }
        return R.data(lists);
    }
}