tangzy
2021-10-20 87204491aac135822f96f3fff297ddca400ea8c9
1.山洪
14 files modified
519 ■■■■■ changed files
src/main/java/org/springblade/modules/mountainrain/controller/BigriverController.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java 175 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/controller/SmariverController.java 6 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/controller/ss.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.xml 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml 54 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/mapper/SmariverMapper.xml 18 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/service/IMountainrainService.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java 17 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java 60 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/river/controller/RiverRController.java 48 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java 108 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/mountainrain/controller/BigriverController.java
@@ -115,7 +115,7 @@
            String yjsw = selctsmriver.get(i).get("yjsw").toString();
            Double yjz = Double.parseDouble(yjsw);
            //水位
            String zs = selctsmriver.get(i).get("yuz").toString();
            String zs = selctsmriver.get(i).get("Z").toString();
            Double z = Double.parseDouble(zs);
            if (z > yjz) {
                listyj.add(selctsmriver.get(i));
src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
@@ -759,64 +759,64 @@
    }
    /**
     * 土壤湿度计算
     *
     * @return
     */
    @GetMapping("/soleval")
    public R soleval() {
        mountainrainService.soildel();
        int intervals = 31;
        ArrayList passDaysList = new ArrayList<>();
        for (int i = 0; i < intervals; i++) {
            passDaysList.add(getDays(i, false));
        }
        Collections.sort(passDaysList);
        //String s = mountainrainService.selectCode();
        String s = regionWeightService.selectCode();
        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);
        for (int i = 0; i < split.length; i++) {
            Integer num = 30;
            double v1 = 0;
            String stcd = null;
            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;
                    }
                }
            }
            if (v1 > 60) {
                mountainrainService.soleInster(stcd, "60");
            } else {
                String a = String.valueOf(v1);
                mountainrainService.soleInster(stcd, a);
            }
        }
        return R.success("成功");
    }
//    /**
//     * 土壤湿度计算
//     *
//     * @return
//     */
//    @GetMapping("/soleval")
//    public R soleval() {
//        mountainrainService.soildel();
//        int intervals = 31;
//        ArrayList passDaysList = new ArrayList<>();
//        for (int i = 0; i < intervals; i++) {
//            passDaysList.add(getDays(i, false));
//        }
//        Collections.sort(passDaysList);
//        //String s = mountainrainService.selectCode();
//        String s = regionWeightService.selectCode();
//        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);
//        for (int i = 0; i < split.length; i++) {
//            Integer num = 30;
//            double v1 = 0;
//            String stcd = null;
//            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;
//                    }
//                }
//            }
//            if (v1 > 60) {
//                mountainrainService.soleInster(stcd, "60");
//            } else {
//                String a = String.valueOf(v1);
//                mountainrainService.soleInster(stcd, a);
//            }
//        }
//
//        return R.success("成功");
//    }
    public static double formatDouble1(double d) {
        return (double) Math.round(d * 10) / 10;
@@ -1156,11 +1156,13 @@
                    if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
                        int drp1 = mountainrainsCVOS.get(i).getDrp1();
                        Integer gohours = mountainrainsCVOS.get(i).getGohours();
                        int i1 = drp1 - gohours;
                        float i1 = (float)drp1 - gohours;
                        float v = (float) (Math.round(i1 * 10)) / 10;
                        String a= String.valueOf(v);
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "true");
                        map.put("status", 2);
                        map.put("num", i1);
                        map.put("num", a);
                        lists.add(map);
                    } else {
                        map.put("List", mountainrainsCVOS.get(i));
@@ -1173,11 +1175,13 @@
                    if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
                        int drp1 = mountainrainsCVOS.get(i).getDrp1();
                        Integer gohour = mountainrainsCVOS.get(i).getGohour();
                        int i1 = drp1 - gohour;
                        float i1 = (float)drp1 - gohour;
                        float v = (float) (Math.round(i1 * 10)) / 10;
                        String a= String.valueOf(v);
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "true");
                        map.put("status", 1);
                        map.put("num", i1);
                        map.put("num", a);
                        lists.add(map);
                    } else {
                        map.put("List", mountainrainsCVOS.get(i));
@@ -1290,8 +1294,9 @@
                if (drp1 > 30) {
                    double v = drp1 - 30;
                    double v1 = (double) Math.round(v * 100) / 100;
                    String a=String.valueOf(v1);
                    map.put("flage1", "true");
                    map.put("num", v1);
                    map.put("num", a);
                } else {
                    map.put("flage1", "false");
                }
@@ -1399,12 +1404,14 @@
                    if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
                        int drp1 = mountainrainsCVOS.get(i).getDrp1();
                        Integer gohours = mountainrainsCVOS.get(i).getGohours();
                        int i1 = drp1 - gohours;
                        float i1 = (float)drp1 - gohours;
                        float v = (float) (Math.round(i1 * 10)) / 10;
                        String a= String.valueOf(v);
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "true");
                        map.put("flage3", "false");
                        map.put("status", 2);
                        map.put("num", i1);
                        map.put("num", a);
                        lists.add(map);
                    } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) {
                        map.put("List", mountainrainsCVOS.get(i));
@@ -1424,12 +1431,14 @@
                    if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
                        int drp1 = mountainrainsCVOS.get(i).getDrp1();
                        Integer gohour = mountainrainsCVOS.get(i).getGohour();
                        int i1 = drp1 - gohour;
                        float i1 = (float)drp1 - gohour;
                        float v = (float) (Math.round(i1 * 10)) / 10;
                        String a= String.valueOf(v);
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage1", "true");
                        map.put("flage3", "false");
                        map.put("status", 1);
                        map.put("num", i1);
                        map.put("num", a);
                        lists.add(map);
                    } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) {
                        map.put("List", mountainrainsCVOS.get(i));
@@ -1554,7 +1563,7 @@
                double drp1 = w1.doubleValue();
                if (drp1 > 50) {
                    double v = drp1 - 50;
                    double v1 = (double) Math.round(v * 100) / 100;
                    double v1 = (double) Math.round(v * 10) / 10;
                    map.put("flage2", "true");
                    map.put("num", v1);
                } else {
@@ -1587,13 +1596,13 @@
                double drp1 = w1.doubleValue();
                row.createCell((short) 0).setCellValue(list.get(i).get("LGTD").toString());
                row.createCell((short) 1).setCellValue(list.get(i).get("LTTD").toString());
                if (drp1 > 50) {
                    row.createCell((short) 2).setCellValue(2);
                    continue;
                } else {
                    row.createCell((short) 2).setCellValue(1);
                    continue;
                }
                    if (drp1 > 50) {
                        row.createCell((short) 2).setCellValue(2);
                        continue;
                    } else {
                        row.createCell((short) 2).setCellValue(1);
                        continue;
                    }
            }
            // 第六步,将文件存到指定位置
            try {
@@ -1665,11 +1674,13 @@
                    if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthours()) {
                        int drp1 = mountainrainsCVOS.get(i).getDrp1();
                        Integer gohours = mountainrainsCVOS.get(i).getGohours();
                        int i1 = drp1 - gohours;
                        float i1 = (float)drp1 - gohours;
                        float v = (float) (Math.round(i1 * 10)) / 10;
                        String a= String.valueOf(v);
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage3", "true");
                        map.put("status", 2);
                        map.put("num", i1);
                        map.put("num", a);
                        lists.add(map);
                    } else {
                        map.put("List", mountainrainsCVOS.get(i));
@@ -1682,11 +1693,13 @@
                    if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthour()) {
                        int drp1 = mountainrainsCVOS.get(i).getDrp1();
                        Integer gohour = mountainrainsCVOS.get(i).getGohour();
                        int i1 = drp1 - gohour;
                        float i1 = (float)drp1 - gohour;
                        float v = (float) (Math.round(i1 * 10)) / 10;
                        String a= String.valueOf(v);
                        map.put("List", mountainrainsCVOS.get(i));
                        map.put("flage3", "true");
                        map.put("status", 1);
                        map.put("num", i1);
                        map.put("num", a);
                        lists.add(map);
                    } else {
                        map.put("List", mountainrainsCVOS.get(i));
@@ -1798,7 +1811,7 @@
                double drp1 = w1.doubleValue();
                if (drp1 > 80) {
                    double v = drp1 - 80;
                    double v1 = (double) Math.round(v * 100) / 100;
                    double v1 = (double) Math.round(v * 10) / 10;
                    map.put("flage3", "true");
                    map.put("num", v1);
                } else {
@@ -1880,7 +1893,7 @@
     * 土壤色斑图
     */
    @GetMapping("/selectS")
    public R selectS() {
    public R selectS(String time) {
        List<Map<String, Object>> list = mountainrainService.selectS();
        String fileName = "";
        // 第一步,创建一个webbook,对应一个Excel文件
src/main/java/org/springblade/modules/mountainrain/controller/SmariverController.java
@@ -24,14 +24,10 @@
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springblade.modules.mountainrain.entity.Yucbig;
import org.springblade.modules.mountainrain.entity.Yucsma;
import org.springblade.modules.mountainrain.excel.BgrExcel;
import org.springblade.modules.mountainrain.excel.BgrImporter;
import org.springblade.modules.mountainrain.excel.MgrExcel;
import org.springblade.modules.mountainrain.excel.MgrImporter;
import org.springblade.modules.mountainrain.service.ISmariverService;
import org.springblade.modules.mountainrain.wrapper.BigriverWrapper;
import org.springblade.modules.mountainrain.wrapper.SmariverWrapper;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -117,7 +113,7 @@
            String yjsw = selctsmriver.get(i).get("yjsw").toString();
            Double yjz = Double.parseDouble(yjsw);
            //水位
            String zs = selctsmriver.get(i).get("yuz").toString();
            String zs = selctsmriver.get(i).get("Z").toString();
            Double z = Double.parseDouble(zs);
            if (z > yjz) {
                listyj.add(selctsmriver.get(i));
src/main/java/org/springblade/modules/mountainrain/controller/ss.java
@@ -23,7 +23,9 @@
    @Scheduled(cron = "0 0 8 * * ?")
    public R soleval() {
        mountainrainService.soildel();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String dateNow = sdf.format(new Date());
        //mountainrainService.soildel();
        int intervals = 31;
        ArrayList passDaysList = new ArrayList<>();
        for (int i = 0; i < intervals; i++) {
@@ -66,10 +68,10 @@
                }
            }
            if (v1 > 60) {
                mountainrainService.soleInster(stcd, "60");
                mountainrainService.soleInster(stcd, "60",dateNow);
            } else {
                String a = String.valueOf(v1);
                mountainrainService.soleInster(stcd, a);
                mountainrainService.soleInster(stcd, a,dateNow);
            }
        }
src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.xml
@@ -4,23 +4,25 @@
    <!--大江大河-->
    <select id="selctbgriver" resultType="java.util.Map">
        SELECT cs1.stcd,
        SELECT cs1.stcd as STCD,
               cs1.ftime,
               cs1.ytime,
               cs1.yuz,
               cs1.yuz as Z,
               cs1.yjsw,
               cs1.stname,
               ad.ADDVNM as addvnm,
               cs1.river,
               st.LGTD,
               st.LTTD
        FROM (
                 SELECT A.stcd,
                        MAX(A.ftime) TM
                        MAX(A.ftime) as ftime
                 FROM (SELECT stcd, ftime FROM sys_Yucbig) AS A
                 GROUP BY A.stcd
             ) cs
                 INNER JOIN (SELECT stcd, stname, ftime, ytime, yuz, yjsw, river FROM sys_Yucbig) cs1
                            ON cs.stcd = cs1.stcd
                 INNER JOIN (SELECT LGTD, LTTD, STCD FROM ST_STBPRP_B) st ON st.STCD = cs1.stcd
                            ON cs.stcd = cs1.stcd and cs.ftime=cs1.ftime
                 INNER JOIN (SELECT LGTD, LTTD, STCD,ADDVCD FROM ST_STBPRP_B) st ON st.STCD = cs1.stcd
                 INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
    </select>
</mapper>
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.java
@@ -18,6 +18,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import liquibase.pro.packaged.S;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.mountainrain.entity.Mountainrain;
import org.springblade.modules.mountainrain.entity.Yucpptn;
@@ -150,10 +151,10 @@
    List<Map<String, Object>> selctsmriver(String time,String dateEnd);
    List<Map<String, Object>> selctbgriver(String time,String dateEnd);
    List<Map<String, Object>> selectTu();
    List<Map<String, Object>> selectS();
    List<Map<String, Object>> selectS(String stime);
    List<MountainrainsCVO> selectYum();
    void soleInster(String stcd, String soilval);
    void soleInster(String stcd, String soilval,String stime);
    void soildel();
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
@@ -255,27 +255,27 @@
    </select>
        <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 ('')),
    <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 ('')),
            1,
            1,
        ''
        ) AS siteids
        </select>
    </select>
<!--    <select id="selectCode" resultType="java.lang.String">-->
<!--        SELECT stuff((-->
<!--            SELECT ',' + CONVERT(VARCHAR (25), cenconding)-->
<!--            FROM dbo.blade_mountain FOR XML PATH ('')),-->
<!--        1,-->
<!--        1,-->
<!--    ''-->
<!--    ) AS siteids-->
<!--    </select>-->
    <!--    <select id="selectCode" resultType="java.lang.String">-->
    <!--        SELECT stuff((-->
    <!--            SELECT ',' + CONVERT(VARCHAR (25), cenconding)-->
    <!--            FROM dbo.blade_mountain FOR XML PATH ('')),-->
    <!--        1,-->
    <!--        1,-->
    <!--    ''-->
    <!--    ) AS siteids-->
    <!--    </select>-->
    <select id="Mountains" resultMap="mountainrainResultMapcInfo">
        SELECT cs.id,
@@ -426,9 +426,10 @@
    <insert id="soleInster">
        insert
        sys_soleval(stcd,soilval) value (
        sys_soleval(stcd,soilval,stime) value (
        #{stcd},
        #{soilval}
        #{soilval},
        #{stime}
        )
    </insert>
@@ -605,7 +606,7 @@
    <select id="selectTu" resultType="java.util.Map">
        SELECT m.cenconding,
               m.village_group as village,
               m.village_group      as village,
               m.county,
               isnull(s.soilval, 0) AS soilval
        FROM blade_mountain m
@@ -905,13 +906,12 @@
    <!--土壤色斑图-->
    <select id="selectS" resultType="java.util.Map">
        SELECT
            so.stcd,
            so.soilval,
            st.LGTD,
            st.LTTD
        FROM
            sys_soleval so
            INNER JOIN dbo.ST_STBPRP_B st ON so.stcd= st.STCD
        SELECT so.stcd,
               so.soilval,
               st.LGTD,
               st.LTTD
        FROM sys_soleval so
                 INNER JOIN dbo.ST_STBPRP_B st ON so.stcd = st.STCD
        where datediff(day, #{stime}, getdate()) = 0
    </select>
</mapper>
src/main/java/org/springblade/modules/mountainrain/mapper/SmariverMapper.xml
@@ -1,26 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.mountainrain.mapper.BigriverMapper">
<mapper namespace="org.springblade.modules.mountainrain.mapper.SmariverMapper">
    <!--中小河流-->
    <select id="selctsmriver" resultType="java.util.Map">
        SELECT cs1.stcd,
        SELECT cs1.stcd  as STCD,
               cs1.ftime,
               cs1.ytime,
               cs1.yuz,
               cs1.yuz   as Z,
               cs1.yjsw,
               cs1.stname,
               ad.ADDVNM as addvnm,
               cs1.river,
               st.LGTD,
               st.LTTD
        FROM (
                 SELECT A.stcd,
                        MAX(A.ftime) TM
                 FROM (SELECT stcd, ftime FROM sys_Yucbig) AS A
                        MAX(A.ftime) as ftime
                 FROM (SELECT stcd, ftime FROM sys_Yucsma) AS A
                 GROUP BY A.stcd
             ) cs
                 INNER JOIN (SELECT stcd, stname, ftime, ytime, yuz, yjsw, river FROM sys_Yucbig) cs1
                            ON cs.stcd = cs1.stcd
                 INNER JOIN (SELECT LGTD, LTTD, STCD FROM ST_STBPRP_B) st ON st.STCD = cs1.stcd
                 INNER JOIN (SELECT stcd, stname, ftime, ytime, yuz, yjsw, river FROM sys_Yucsma) cs1
                            ON cs.stcd = cs1.stcd and cs.ftime = cs1.ftime
                 INNER JOIN (SELECT LGTD, LTTD, STCD, ADDVCD FROM ST_STBPRP_B) st ON st.STCD = cs1.stcd
                 INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
    </select>
</mapper>
src/main/java/org/springblade/modules/mountainrain/service/IMountainrainService.java
@@ -137,7 +137,7 @@
     */
    int rainthree(int number,Integer gthour);
    String selectCode();
    void soleInster(String stcd,String soilval);
    void soleInster(String stcd,String soilval,String stime);
    void soildel();
    //预报信息新增
    int insertYuc(List<Yucpptn> yucpptnList);
@@ -152,6 +152,6 @@
    List<Map<String, Object>> selecMoneTw(String times, String dateEnd2, String code);
    List<Map<String, Object>> selecMoneTr(String times, String dateEnd3, String code);
    List<Map<String, Object>> selectTu();
    List<Map<String, Object>> selectS();
    List<Map<String, Object>> selectS(String stime);
    void del();
}
src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java
@@ -433,8 +433,8 @@
    }
    @Override
    public void soleInster(String stcd, String soilval) {
        baseMapper.soleInster(stcd,soilval);
    public void soleInster(String stcd, String soilval,String stime) {
        baseMapper.soleInster(stcd,soilval,stime);
    }
    @Override
@@ -503,23 +503,14 @@
    }
    @Override
    public List<Map<String, Object>> selectS() {
        return baseMapper.selectS();
    public List<Map<String, Object>> selectS(String stime) {
        return baseMapper.selectS(stime);
    }
    @Override
    public void del() {
        baseMapper.del();
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void importMgr(List<MgrExcel> data, Boolean isCovered) {
        data.forEach(MgrExcel -> {
            User user = Objects.requireNonNull(BeanUtil.copy(MgrExcel, User.class));
        });
    }
    /*
     * 计算最大值
src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
@@ -754,7 +754,14 @@
    @GetMapping("/selectReDc")
    public R selectReDc(String beginTime, String endTime) {
        String substring = beginTime.substring(0, 10);
        String r = beginTime.substring(11, 13);
        String t = beginTime.substring(11, 13);
        String r;
        if(t.substring(0,1).equals("0")){
            r=beginTime.substring(12,13);
        }
        else {
            r=beginTime.substring(11,13);
        }
        //截取月日
        String[] strs = substring.split("-");
        //月
@@ -762,7 +769,14 @@
        //日
        String day = strs[2].toString();
        String substrings = endTime.substring(0, 10);
        String rs = endTime.substring(11, 13);
        String ts = endTime.substring(11, 13);
        String rs;
        if(ts.substring(0,1).equals("0")){
            rs=beginTime.substring(12,13);
        }
        else {
            rs=beginTime.substring(11,13);
        }
        //截取月日
        String[] strss = substrings.split("-");
        //月
@@ -799,7 +813,8 @@
                String addvnm = maps.get(i).get("ADDVNM").toString();
                String stnm = maps.get(i).get("STNM").toString();
                BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量
                double dyp = bigDecimaldyp.doubleValue();
                double dyps = bigDecimaldyp.doubleValue();
                double dyp = (double) Math.round(dyps * 10) / 10;
                if (dyp > 0 && dyp <= 10) {
                    lista.add(maps.get(i));
                } else if (dyp > 10 && dyp <= 25) {
@@ -824,7 +839,8 @@
                }
            } else {
                BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量
                double dyp = bigDecimaldyp.doubleValue();
                double dyps = bigDecimaldyp.doubleValue();
                double dyp = (double) Math.round(dyps * 10) / 10;
                if (dyp > 0 && dyp <= 10) {
                    lista.add(maps.get(i));
                } else if (dyp > 10 && dyp <= 25) {
@@ -970,7 +986,14 @@
    @GetMapping("/selectReMs")
    public R selectReMs(String beginTime, String endTime) {
        String substring = beginTime.substring(0, 10);
        String r = beginTime.substring(11, 13);
        String t = beginTime.substring(11, 13);
        String r;
        if(t.substring(0,1).equals("0")){
             r=beginTime.substring(12,13);
        }
        else {
             r=beginTime.substring(11,13);
        }
        //截取月日
        String[] strs = substring.split("-");
        //月
@@ -978,7 +1001,14 @@
        //日
        String day = strs[2].toString();
        String substrings = endTime.substring(0, 10);
        String rs = endTime.substring(11, 13);
        String ts = endTime.substring(11, 13);
        String rs;
        if(ts.substring(0,1).equals("0")){
            rs=beginTime.substring(12,13);
        }
        else {
            rs=beginTime.substring(11,13);
        }
        //截取月日
        String[] strss = substrings.split("-");
        //月
@@ -1138,7 +1168,14 @@
    @GetMapping("/selectReL")
    public R selectReL(String beginTime, String endTime) {
        String substring = beginTime.substring(0, 10);
        String r = beginTime.substring(11, 13);
        String t = beginTime.substring(11, 13);
        String r;
        if(t.substring(0,1).equals("0")){
            r=beginTime.substring(12,13);
        }
        else {
            r=beginTime.substring(11,13);
        }
        //截取月日
        String[] strs = substring.split("-");
        //月
@@ -1146,7 +1183,14 @@
        //日
        String day = strs[2].toString();
        String substrings = endTime.substring(0, 10);
        String rs = endTime.substring(11, 13);
        String ts = endTime.substring(11, 13);
        String rs;
        if(t.substring(0,1).equals("0")){
            rs=beginTime.substring(12,13);
        }
        else {
            rs=beginTime.substring(11,13);
        }
        //截取月日
        String[] strss = substrings.split("-");
        //月
src/main/java/org/springblade/modules/river/controller/RiverRController.java
@@ -435,8 +435,10 @@
                            if (selecthd.get(i).get("Q") == null) {
                                texta += "流量暂无数据、";
                            } else {
                                DecimalFormat dfl = new DecimalFormat("#0.000");
                                texta += "流量" + Q + "立方米每秒;";
                                //DecimalFormat dfl = new DecimalFormat("#0.000");
                                //texta += "流量" + Q + "立方米每秒;";
                                String vc  = formatSignificantDigit(Q);
                                texta += "流量" + vc + "立方米每秒;";
                            }
                        }
                    }
@@ -652,8 +654,8 @@
                                if (selecthd.get(i).get("Q") == null) {
                                    texta += "流量暂无数据";
                                } else {
                                    DecimalFormat dfs = new DecimalFormat("#0.000");
                                    texta += "流量" + Q + "立方米每秒;";
                                    String vc  = formatSignificantDigit(Q);
                                    texta += "流量" + vc + "立方米每秒;";
                                }
                            }
                        }
@@ -679,7 +681,8 @@
                                    texta += "流量暂无数据;";
                                } else {
                                    //DecimalFormat dfs = new DecimalFormat("#0.000");
                                    texta += "流量" + Q + "立方米每秒;";
                                    String vc  = formatSignificantDigit(Q);
                                    texta += "流量" + vc + "立方米每秒;";
                                }
                            }
                        }
@@ -708,4 +711,39 @@
        return R.data(list);
    }
    public static int magnitude(Double price){
        if (price == 0.0) {return 0;}
        int fac;
        Long i;
        Long k = 10L;
        if (price > 1) {
            i = price.longValue();
            fac = 0;
            while (i / k != 0L) {
                fac++;
                k *= 10;
            }
        } else {
            fac = -1;
            while (price * k < 1) {
                fac--;
                k *= 10;
            }
        }
        return fac;
    }
    /**
     * 数字格式化 - 最少保留{num}位有效数字 - 保留 {min}~{max} 为小数 - format02
     */
    public static String formatSignificantDigit(Double price) {
        int min = 2;
        int max= 8;
        int num = 3;
        boolean sign = false;
        Double rate = 1.0;
        Double value = price * rate;
        int level = magnitude(Math.abs(value));
        int count = Math.max(min, Math.min(max, num - level - 1));
        return String.format("%"+(sign?"+": "")+"."+count + "f", value);
    }
}
src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java
@@ -228,7 +228,8 @@
                                BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                double INQ = inq.doubleValue();
                                //DecimalFormat df = new DecimalFormat("#0.000");
                                texta += "入库流量" + INQ + "立方米每秒、";
                                String vc  = formatSignificantDigit(INQ);
                                texta += "入库流量" + vc + "立方米每秒、";
                            }
                            if (map.get(i).get("W") == null) {
                                texta += "蓄水量暂无数据、";
@@ -243,7 +244,8 @@
                                BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                double OTQ = otq.doubleValue();
                                //DecimalFormat df = new DecimalFormat("#0.000");
                                texta += "出库流量" + OTQ + "立方米每秒;";
                                String vc  = formatSignificantDigit(OTQ);
                                texta += "出库流量" + vc + "立方米每秒;";
                            }
                        }
                        if (stnm.equals("廖坊")) {
@@ -260,7 +262,8 @@
                                BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                double INQ = inq.doubleValue();
                                //DecimalFormat df = new DecimalFormat("#0.000");
                                texth += "入库流量" + INQ + "立方米每秒、";
                                String vc  = formatSignificantDigit(INQ);
                                texth += "入库流量" + vc + "立方米每秒、";
                            }
                            if (map.get(i).get("W") == null) {
                                texth += "蓄水量暂无数据、";
@@ -275,7 +278,8 @@
                                BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                double OTQ = otq.doubleValue();
                                //DecimalFormat df = new DecimalFormat("#0.000");
                                texth += "出库流量" + OTQ + "立方米每秒。";
                                String vc  = formatSignificantDigit(OTQ);
                                texth += "出库流量" + vc + "立方米每秒。";
                            }
                        }
                        alist.add(map.get(i));
@@ -295,7 +299,8 @@
                                BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                double INQ = inq.doubleValue();
                                //DecimalFormat df = new DecimalFormat("#0.000");
                                texta += "入库流量" + INQ + "立方米每秒、";
                                String vc  = formatSignificantDigit(INQ);
                                texta += "入库流量" + vc + "立方米每秒、";
                            }
                            if (map.get(i).get("W") == null) {
                                texta += "蓄水量暂无数据、";
@@ -310,7 +315,8 @@
                                BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                double OTQ = otq.doubleValue();
                                //DecimalFormat df = new DecimalFormat("#0.000");
                                texta += "出库流量" + OTQ + "立方米每秒;";
                                String vc  = formatSignificantDigit(OTQ);
                                texta += "出库流量" + vc + "立方米每秒;";
                            }
                        }
                        if (stnm.equals("廖坊")) {
@@ -321,7 +327,8 @@
                                BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                double INQ = inq.doubleValue();
                                //DecimalFormat df = new DecimalFormat("#0.000");
                                texth += "入库流量" + INQ + "立方米每秒、";
                                String vc  = formatSignificantDigit(INQ);
                                texth += "入库流量" + vc + "立方米每秒、";
                            }
                            if (map.get(i).get("W") == null) {
                                texth += "蓄水量暂无数据、";
@@ -336,7 +343,8 @@
                                BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                double OTQ = otq.doubleValue();
                                //DecimalFormat df = new DecimalFormat("#0.000");
                                texth += "出库流量" + OTQ + "立方米每秒。";
                                String vc  = formatSignificantDigit(OTQ);
                                texth += "出库流量" + vc + "立方米每秒。";
                            }
                        }
                        alist.add(map.get(i));
@@ -362,7 +370,8 @@
                                    BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                    double INQ = inq.doubleValue();
                                    //DecimalFormat df = new DecimalFormat("#0.000");
                                    texta += "入库流量" + INQ + "立方米每秒、";
                                    String vc  = formatSignificantDigit(INQ);
                                    texta += "入库流量" + vc + "立方米每秒、";
                                }
                                if (map.get(i).get("W") == null) {
                                    texta += "蓄水量暂无数据、";
@@ -377,7 +386,8 @@
                                    BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                    double OTQ = otq.doubleValue();
                                    //DecimalFormat df = new DecimalFormat("#0.000");
                                    texta += "出库流量" + OTQ + "立方米每秒;";
                                    String vc  = formatSignificantDigit(OTQ);
                                    texta += "出库流量" + vc + "立方米每秒;";
                                }
                            }
                            if (stnm.equals("廖坊")) {
@@ -388,7 +398,8 @@
                                    BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                    double INQ = inq.doubleValue();
                                    //DecimalFormat df = new DecimalFormat("#0.000");
                                    texth += "入库流量" + INQ + "立方米每秒、";
                                    String vc  = formatSignificantDigit(INQ);
                                    texth += "入库流量" + vc + "立方米每秒、";
                                }
                                if (map.get(i).get("W") == null) {
                                    texth += "蓄水量暂无数据、";
@@ -403,7 +414,8 @@
                                    BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                    double OTQ = otq.doubleValue();
                                    //DecimalFormat df = new DecimalFormat("#0");
                                    texth += "出库流量" + OTQ + "立方米每秒。";
                                    String vc  = formatSignificantDigit(OTQ);
                                    texth += "出库流量" + vc + "立方米每秒。";
                                }
                            }
                        }
@@ -593,7 +605,8 @@
                        } else {
                            BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                            double INQ = inq.doubleValue();
                            texta += "入库流量" + INQ + "立方米每秒、";
                            String vc  = formatSignificantDigit(INQ);
                            texta += "入库流量" + vc + "立方米每秒、";
                        }
                        if (map.get(i).get("W") == null) {
                            texta += "蓄水量暂无数据、";
@@ -607,7 +620,8 @@
                        } else {
                            BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                            double OTQ = otq.doubleValue();
                            texta += "出库流量" + OTQ + "立方米每秒;";
                            String vc  = formatSignificantDigit(OTQ);
                            texta += "出库流量" + vc + "立方米每秒;";
                        }
//                        texta += "汛限水位暂无数据;";
                    } else if (stnm.equals("廖坊")) {
@@ -627,7 +641,8 @@
                        } else {
                            BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                            double INQ = inq.doubleValue();
                            texth += "入库流量" + INQ + "立方米每秒、";
                            String vc  = formatSignificantDigit(INQ);
                            texth += "入库流量" + vc + "立方米每秒、";
                        }
                        if (map.get(i).get("W") == null) {
                            texth += "蓄水量暂无数据、";
@@ -641,7 +656,8 @@
                        } else {
                            BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                            double OTQ = otq.doubleValue();
                            texth += "出库流量" + OTQ + "立方米每秒。";
                            String vc  = formatSignificantDigit(OTQ);
                            texth += "出库流量" + vc + "立方米每秒。";
                        }
                    }
                    blist.add(map.get(i));
@@ -672,7 +688,8 @@
                        } else {
                            BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                            double INQ = inq.doubleValue();
                            texta += "入库流量" + INQ + "立方米每秒、";
                            String vc  = formatSignificantDigit(INQ);
                            texta += "入库流量" + vc + "立方米每秒、";
                        }
                        if (map.get(i).get("W") == null) {
                            texta += "蓄水量暂无数据、";
@@ -686,7 +703,8 @@
                        } else {
                            BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                            double OTQ = otq.doubleValue();
                            texta += "出库流量" + OTQ + "立方米每秒;";
                            String vc  = formatSignificantDigit(OTQ);
                            texta += "出库流量" + vc + "立方米每秒;";
                        }
//                        texta += "汛限水位暂无数据;";
                    } else if (stnm.equals("廖坊")) {
@@ -706,7 +724,8 @@
                        } else {
                            BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                            double INQ = inq.doubleValue();
                            texth += "入库流量" + INQ + "立方米每秒、";
                            String vc  = formatSignificantDigit(INQ);
                            texth += "入库流量" + vc + "立方米每秒、";
                        }
                        if (map.get(i).get("W") == null) {
                            texth += "蓄水量暂无数据、";
@@ -720,7 +739,8 @@
                        } else {
                            BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                            double OTQ = otq.doubleValue();
                            texth += "出库流量" + OTQ + "立方米每秒。";
                            String vc  = formatSignificantDigit(OTQ);
                            texth += "出库流量" + vc + "立方米每秒。";
                        }
                    }
                    blist.add(map.get(i));
@@ -756,7 +776,8 @@
                            } else {
                                BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                double INQ = inq.doubleValue();
                                texta += "入库流量" + INQ + "立方米每秒、";
                                String vc  = formatSignificantDigit(INQ);
                                texta += "入库流量" + vc + "立方米每秒、";
                            }
                            if (map.get(i).get("W") == null) {
                                texta += "蓄水量暂无数据、";
@@ -770,7 +791,8 @@
                            } else {
                                BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                double OTQ = otq.doubleValue();
                                texta += "出库流量" + OTQ + "立方米每秒;";
                                String vc  = formatSignificantDigit(OTQ);
                                texta += "出库流量" + vc + "立方米每秒;";
                            }
//                        texta += "汛限水位暂无数据;";
                        } else if (stnm.equals("廖坊")) {
@@ -790,7 +812,8 @@
                            } else {
                                BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
                                double INQ = inq.doubleValue();
                                texth += "入库流量" + INQ + "立方米每秒、";
                                String vc  = formatSignificantDigit(INQ);
                                texth += "入库流量" + vc + "立方米每秒、";
                            }
                            if (map.get(i).get("W") == null) {
                                texth += "蓄水量暂无数据、";
@@ -804,7 +827,8 @@
                            } else {
                                BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
                                double OTQ = otq.doubleValue();
                                texth += "出库流量" + OTQ + "立方米每秒。";
                                String vc  = formatSignificantDigit(OTQ);
                                texth += "出库流量" + vc + "立方米每秒。";
                            }
                        }
                    }
@@ -1020,5 +1044,41 @@
        return R.data(lists);
    }
    public static int magnitude(Double price){
        if (price == 0.0) {return 0;}
        int fac;
        Long i;
        Long k = 10L;
        if (price > 1) {
            i = price.longValue();
            fac = 0;
            while (i / k != 0L) {
                fac++;
                k *= 10;
            }
        } else {
            fac = -1;
            while (price * k < 1) {
                fac--;
                k *= 10;
            }
        }
        return fac;
    }
    /**
     * 数字格式化 - 最少保留{num}位有效数字 - 保留 {min}~{max} 为小数 - format02
     */
    public static String formatSignificantDigit(Double price) {
        int min = 2;
        int max= 8;
        int num = 3;
        boolean sign = false;
        Double rate = 1.0;
        Double value = price * rate;
        int level = magnitude(Math.abs(value));
        int count = Math.max(min, Math.min(max, num - level - 1));
        return String.format("%"+(sign?"+": "")+"."+count + "f", value);
    }
}
src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.xml
@@ -71,7 +71,7 @@
                              and FSLTDZ is not null) rsv ON rsv.STCD = rs.STCD
                 INNER JOIN sys_rsvr st ON st.STCD = rs.STCD
                 INNER JOIN dbo.ST_RSVRFCCH_B rst ON rst.STCD = rs.STCD
        WHERE rs.TM &gt;= #{beginTime}
        WHERE rs.TM &gt; #{beginTime}
          AND rs.TM &lt;= #{endTime}
        ORDER BY rs.TM DESC
    </select>