wuzeyu
2024-08-05 1e83714d06985bdfa8c5faa70a72b16be45de300
Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

 Conflicts:
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java
12个文件已添加
1 文件已重命名
26个文件已修改
3122 ■■■■ 已修改文件
pipIrr-platform/pipIrr-common/pom.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataAlarmVo.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCd99Vo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA0Vo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA1Vo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA2Vo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DoubleUtil.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java 341 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysCpuUtil.java 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysFileSysUtil.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysJvmUtil.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysMemoryUtil.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysSysUtil.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysUtil.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportHistoryMapper.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportLastMapper.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoOnLineIntake.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoBatteryVolt.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoCumulativeFlow.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoSignalIntensity.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml 963 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml 635 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/pom.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoDeal.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoVo.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealAlarmStatus.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pom.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrOperationApplication.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/BatteryVoltQO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/SignalIntensityQO.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/pom.xml
@@ -132,6 +132,23 @@
            <artifactId>quartz</artifactId>
        </dependency>
        <!-- 获得系统信息 -->
        <dependency>
            <groupId>com.github.oshi</groupId>
            <artifactId>oshi-core</artifactId>
            <version>6.6.2</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>5.12.1</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
            <version>5.12.1</version>
        </dependency>
        <!-- Hutool是一个小而全的Java工具类库(https://github.com/dromara/hutool)  -->
        <dependency>
            <groupId>cn.hutool</groupId>
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java
@@ -39,10 +39,10 @@
    public static final String cd_95 = "95" ;//复位终端参数和状态(未实现)
    public static final String cd_97 = "97" ;//APP远程开阀
    public static final String cd_98 = "98" ;//APP远程关阀
    public static final String cd_99 = "99" ;//定时关阀开阀
    public static final String cd_A0 = "A0" ;//定量关阀开阀
    public static final String cd_A1 = "A1" ;//定时关阀计划开阀
    public static final String cd_A2 = "A2" ;//定量关阀计划开阀
    public static final String cd_99 = "99" ;//定时关阀式开阀
    public static final String cd_A0 = "A0" ;//定量关阀式开阀
    public static final String cd_A1 = "A1" ;//定时关阀式计划开阀
    public static final String cd_A2 = "A2" ;//定量关阀式计划开阀
    public static final String cd_B0 = "B0" ;//查询实时数据(未实现)
    public static final String cd_C0 = "C0" ;//遥测站整点上报实时数据 ok
@@ -84,10 +84,10 @@
            (code.equals(cd_95) ? "复位终端参数和状态" :
            (code.equals(cd_97) ? "APP远程开阀" :
            (code.equals(cd_98) ? "APP远程关阀" :
            (code.equals(cd_99) ? "定时关阀开阀" :
            (code.equals(cd_A0) ? "定量关阀开阀" :
            (code.equals(cd_A1) ? "定时关阀计划开阀" :
            (code.equals(cd_A2) ? "定量关阀计划开阀" :
            (code.equals(cd_99) ? "定时关阀式开阀" :
            (code.equals(cd_A0) ? "定量关阀式开阀" :
            (code.equals(cd_A1) ? "定时关阀式计划开阀" :
            (code.equals(cd_A2) ? "定量关阀式计划开阀" :
            (code.equals(cd_B0) ? "查询实时数据" :
            (code.equals(cd_C0) ? "自报(整点)实时数据" :
            ""))))))))))))))))))))))))))))))))))))))))))) ;
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataAlarmVo.java
@@ -22,17 +22,22 @@
    public String alarmContent(){
        String txt = "" ;
        boolean hasTxt = false ;
        if(batteryVolt != null && batteryVolt == 1){
            txt += "蓄电池电压报警" ;
            txt += (hasTxt?"、":"") + "蓄电池电压报警" ;
            hasTxt = true ;
        }
        if(meter != null && meter == 1){
            txt += ",流量计故障报警" ;
            txt += (hasTxt?"、":"") + "流量计故障报警" ;
            hasTxt = true ;
        }
        if(valve != null && valve == 1){
            txt += ",阀门故障报警" ;
            txt += (hasTxt?"、":"") + "阀门故障报警" ;
            hasTxt = true ;
        }
       if(loss != null && loss == 1){
            txt += ",漏损报警" ;
            txt += (hasTxt?"、":"") + "漏损报警" ;
           hasTxt = true ;
        }
        return txt ;
    }
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCd99Vo.java
@@ -15,7 +15,7 @@
    public String toString(){
        StringBuilder sb = new StringBuilder() ;
        sb.append("   定时关阀开阀应答:\n");
        sb.append("   定时关阀式开阀应答:\n");
        sb.append("      虚拟卡号:");
        sb.append(cardNo);
        sb.append("\n");
@@ -29,7 +29,7 @@
    public String comLog(){
        StringBuilder sb = new StringBuilder() ;
        sb.append("定时关阀开阀命令回复:\n");
        sb.append("定时关阀式开阀命令回复:\n");
        sb.append("   虚拟卡号:");
        sb.append(cardNo);
        sb.append("\n");
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA0Vo.java
@@ -15,7 +15,7 @@
    public String toString(){
        StringBuilder sb = new StringBuilder() ;
        sb.append("   定量关阀开阀应答:\n");
        sb.append("   定量关阀式开阀应答:\n");
        sb.append("      虚拟卡号:");
        sb.append(cardNo);
        sb.append("\n");
@@ -29,7 +29,7 @@
    public String comLog(){
        StringBuilder sb = new StringBuilder() ;
        sb.append("定量关阀开阀命令回复:\n");
        sb.append("定量关阀式开阀命令回复:\n");
        sb.append("   虚拟卡号:");
        sb.append(cardNo);
        sb.append("\n");
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA1Vo.java
@@ -15,7 +15,7 @@
    public String toString(){
        StringBuilder sb = new StringBuilder() ;
        sb.append("   定时关阀开阀应答:\n");
        sb.append("   定时关阀式开阀应答:\n");
        sb.append("      虚拟卡号:");
        sb.append(cardNo);
        sb.append("\n");
@@ -29,7 +29,7 @@
    public String comLog(){
        StringBuilder sb = new StringBuilder() ;
        sb.append("定时关阀开阀命令回复:\n");
        sb.append("定时关阀式开阀命令回复:\n");
        sb.append("   虚拟卡号:");
        sb.append(cardNo);
        sb.append("\n");
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA2Vo.java
@@ -15,7 +15,7 @@
    public String toString(){
        StringBuilder sb = new StringBuilder() ;
        sb.append("   定量关阀开阀应答:\n");
        sb.append("   定量关阀式开阀应答:\n");
        sb.append("      虚拟卡号:");
        sb.append(cardNo);
        sb.append("\n");
@@ -29,7 +29,7 @@
    public String comLog(){
        StringBuilder sb = new StringBuilder() ;
        sb.append("定量关阀开阀命令回复:\n");
        sb.append("定量关阀式开阀命令回复:\n");
        sb.append("   虚拟卡号:");
        sb.append(cardNo);
        sb.append("\n");
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DoubleUtil.java
New file
@@ -0,0 +1,103 @@
package com.dy.common.util;
import java.math.BigDecimal;
import java.math.RoundingMode;
/**
 * @Author: liurunyu
 * @Date: 2024/8/2 13:58
 * @Description 精准的double计算
 */
public class DoubleUtil {
    /** 默认除法运算精度 */
    private static final int DEF_DIV_SCALE = 10;
    /** 这个类不能实例化 */
    private DoubleUtil() {
    }
    /**
     * 提供精确的加法运算。
     * @param v1 被加数
     * @param v2 加数
     * @return 两个参数的和
     */
    public static double add(double v1, double v2)  {
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.add(b2).doubleValue();
    }
    /**
     * 提供精确的减法运算。
     * @param v1 被减数
     * @param v2 减数
     * @return 两个参数的差
     */
    public static double sub(double v1, double v2) {
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.subtract(b2).doubleValue();
    }
    /**
     * 提供精确的乘法运算。
     * @param v1 被乘数
     * @param v2 乘数
     * @return 两个参数的积
     */
    public static double mul(double v1, double v2) {
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.multiply(b2).doubleValue();
    }
    /**
     * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
     * 小数点以后10位,以后的数字四舍五入。
     * @param v1 被除数
     * @param v2 除数
     * @return 两个参数的商
     */
    public static double div(double v1, double v2)
    {
        return div(v1, v2, DEF_DIV_SCALE);
    }
    /**
     * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
     * 定精度,以后的数字四舍五入。
     * @param v1 被除数
     * @param v2 除数
     * @param scale 表示表示需要精确到小数点以后几位。
     * @return 两个参数的商
     */
    public static double div(double v1, double v2, int scale) {
        if (scale < 0) {
            throw new IllegalArgumentException(
                    "The scale must be a positive integer or zero");
        }
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        if (b1.compareTo(BigDecimal.ZERO) == 0) {
            return BigDecimal.ZERO.doubleValue();
        }
        return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
    }
    /**
     * 提供精确的小数位四舍五入处理。
     * @param v 需要四舍五入的数字
     * @param scale 小数点后保留几位
     * @return 四舍五入后的结果
     */
    public static double round(double v, int scale) {
        if (scale < 0) {
            throw new IllegalArgumentException(
                    "The scale must be a positive integer or zero");
        }
        BigDecimal b = new BigDecimal(Double.toString(v));
        BigDecimal one = BigDecimal.ONE;
        return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java
New file
@@ -0,0 +1,341 @@
package com.dy.common.util;
import jakarta.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * 获取IP方法
 *
 * @author liurunyu
 */
public class IPUtils {
    /**
     * 检查IP是否合法
     *
     * @param ip
     * @return
     */
    public static boolean ipValid(String ip) {
        String regex0 = "(2[0-4]\\d)" + "|(25[0-5])";
        String regex1 = "1\\d{2}";
        String regex2 = "[1-9]\\d";
        String regex3 = "\\d";
        String regex = "(" + regex0 + ")|(" + regex1 + ")|(" + regex2 + ")|(" + regex3 + ")";
        regex = "(" + regex + ").(" + regex + ").(" + regex + ").(" + regex + ")";
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(ip);
        return m.matches();
    }
    /**
     * 获取本地ip 适合windows与linux
     *
     * @return
     */
    public static String getLocalIP() {
        String localIP = "127.0.0.1";
        try {
            Enumeration netInterfaces = NetworkInterface.getNetworkInterfaces();
            while (netInterfaces.hasMoreElements()) {
                NetworkInterface ni = (NetworkInterface) netInterfaces.nextElement();
                InetAddress ip = ni.getInetAddresses().nextElement();
                if (!ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {
                    localIP = ip.getHostAddress();
                    break;
                }
            }
        } catch (Exception e) {
            try {
                localIP = InetAddress.getLocalHost().getHostAddress();
            } catch (UnknownHostException e1) {
                e1.printStackTrace();
            }
        }
        return localIP;
    }
    /**
     * 获取客户端IP
     *
     * @param request 请求对象
     * @return IP地址
     */
    public static String getClientIp(HttpServletRequest request)
    {
        if (request == null)
        {
            return "unknown";
        }
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getHeader("X-Forwarded-For");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getHeader("X-Real-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
        {
            ip = request.getRemoteAddr();
        }
        return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
    }
    /**
     * 检查是否为内部IP地址
     *
     * @param ip IP地址
     * @return 结果
     */
    public static boolean internalIp(String ip)
    {
        byte[] addr = textToNumericFormatV4(ip);
        return internalIp(addr) || "127.0.0.1".equals(ip);
    }
    /**
     * 检查是否为内部IP地址
     *
     * @param addr byte地址
     * @return 结果
     */
    private static boolean internalIp(byte[] addr)
    {
        if (addr == null || addr.length < 2)
        {
            return true;
        }
        final byte b0 = addr[0];
        final byte b1 = addr[1];
        // 10.x.x.x/8
        final byte SECTION_1 = 0x0A;
        // 172.16.x.x/12
        final byte SECTION_2 = (byte) 0xAC;
        final byte SECTION_3 = (byte) 0x10;
        final byte SECTION_4 = (byte) 0x1F;
        // 192.168.x.x/16
        final byte SECTION_5 = (byte) 0xC0;
        final byte SECTION_6 = (byte) 0xA8;
        switch (b0)
        {
            case SECTION_1:
                return true;
            case SECTION_2:
                if (b1 >= SECTION_3 && b1 <= SECTION_4)
                {
                    return true;
                }
            case SECTION_5:
                switch (b1)
                {
                    case SECTION_6:
                        return true;
                }
            default:
                return false;
        }
    }
    /**
     * 把ip转化为整数
     *
     * @param ip
     * @return
     */
    public static long translateIP2Int(String ip) {
        String[] intArr = ip.split("\\.");
        int[] ipInt = new int[intArr.length];
        for (int i = 0; i < intArr.length; i++) {
            ipInt[i] = Integer.parseInt(intArr[i]) ;
        }
        return ipInt[0] * 256 * 256 * 256 + +ipInt[1] * 256 * 256 + ipInt[2] * 256 + ipInt[3];
    }
    /**
     * 将IPv4地址转换成字节
     *
     * @param text IPv4地址
     * @return byte 字节
     */
    public static byte[] textToNumericFormatV4(String text)
    {
        if (text.length() == 0)
        {
            return null;
        }
        byte[] bytes = new byte[4];
        String[] elements = text.split("\\.", -1);
        try
        {
            long l;
            int i;
            switch (elements.length)
            {
                case 1:
                    l = Long.parseLong(elements[0]);
                    if ((l < 0L) || (l > 4294967295L))
                    {
                        return null;
                    }
                    bytes[0] = (byte) (int) (l >> 24 & 0xFF);
                    bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF);
                    bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
                    bytes[3] = (byte) (int) (l & 0xFF);
                    break;
                case 2:
                    l = Integer.parseInt(elements[0]);
                    if ((l < 0L) || (l > 255L))
                    {
                        return null;
                    }
                    bytes[0] = (byte) (int) (l & 0xFF);
                    l = Integer.parseInt(elements[1]);
                    if ((l < 0L) || (l > 16777215L))
                    {
                        return null;
                    }
                    bytes[1] = (byte) (int) (l >> 16 & 0xFF);
                    bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
                    bytes[3] = (byte) (int) (l & 0xFF);
                    break;
                case 3:
                    for (i = 0; i < 2; ++i)
                    {
                        l = Integer.parseInt(elements[i]);
                        if ((l < 0L) || (l > 255L))
                        {
                            return null;
                        }
                        bytes[i] = (byte) (int) (l & 0xFF);
                    }
                    l = Integer.parseInt(elements[2]);
                    if ((l < 0L) || (l > 65535L))
                    {
                        return null;
                    }
                    bytes[2] = (byte) (int) (l >> 8 & 0xFF);
                    bytes[3] = (byte) (int) (l & 0xFF);
                    break;
                case 4:
                    for (i = 0; i < 4; ++i)
                    {
                        l = Integer.parseInt(elements[i]);
                        if ((l < 0L) || (l > 255L))
                        {
                            return null;
                        }
                        bytes[i] = (byte) (int) (l & 0xFF);
                    }
                    break;
                default:
                    return null;
            }
        }
        catch (NumberFormatException e)
        {
            return null;
        }
        return bytes;
    }
    /**
     * 获取IP地址
     *
     * @return 本地IP地址
     */
    public static String getHostIp()
    {
        try
        {
            return InetAddress.getLocalHost().getHostAddress();
        }
        catch (UnknownHostException e)
        {
        }
        return "127.0.0.1";
    }
    /**
     * 获取主机名
     *
     * @return 本地主机名
     */
    public static String getHostName()
    {
        try
        {
            return InetAddress.getLocalHost().getHostName();
        }
        catch (UnknownHostException e)
        {
        }
        return "未知";
    }
    /**
     * 从多级反向代理中获得第一个非unknown IP地址
     *
     * @param ip 获得的IP地址
     * @return 第一个非unknown IP地址
     */
    public static String getMultistageReverseProxyIp(String ip)
    {
        // 多级反向代理检测
        if (ip != null && ip.indexOf(",") > 0)
        {
            final String[] ips = ip.trim().split(",");
            for (String subIp : ips)
            {
                if (false == isUnknown(subIp))
                {
                    ip = subIp;
                    break;
                }
            }
        }
        return ip;
    }
    /**
     * 检测给定字符串是否为未知,多用于检测HTTP请求相关
     *
     * @param checkString 被检测的字符串
     * @return 是否未知
     */
    public static boolean isUnknown(String checkString)
    {
        return isBlank(checkString) || "unknown".equalsIgnoreCase(checkString);
    }
    private static boolean isBlank(final CharSequence cs) {
        final int strLen = length(cs);
        if (strLen == 0) {
            return true;
        }
        for (int i = 0; i < strLen; i++) {
            if (!Character.isWhitespace(cs.charAt(i))) {
                return false;
            }
        }
        return true;
    }
    public static int length(final CharSequence cs) {
        return cs == null ? 0 : cs.length();
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysCpuUtil.java
New file
@@ -0,0 +1,110 @@
package com.dy.common.util;
import lombok.Data;
import oshi.hardware.CentralProcessor;
import oshi.util.Util;
/**
 * @Author: liurunyu
 * @Date: 2024/8/2 11:17
 * @Description
 */
public class SysCpuUtil {
    private static final int OSHI_WAIT_SECOND = 1000;
    /**
     * 得到CPU信息
     */
    public static CpuInfoVo info(CentralProcessor processor){
        /**
         * 获取系统范围内的CPU负载计数器。返回一个包含八个元素的数组,表示在用户(0)、尼斯(1)、系统(2)、空闲(3)、
         * IOwait(4)、硬件中断(IRQ)(5)、软件中断/DPC(SoftIRQ))(6)或窃取(7)状态下花费的毫秒数。使用
         * {@link-shi.hardware.TickType#getIndex()}检索相应的索引。通过测量一个时间间
         * 隔内滴答声之间的差异,可以计算出该时间间隔内的CPU负载。
         * 在某些逻辑处理器数量可变的操作系统上,此阵列的大小可能会发生变化,并且可能与其他每处理器方法不一致。
         * 请注意,虽然滴答计数器以毫秒为单位,但它们可能会随着(依赖于平台的)时钟滴答声以更大的增量前进。例如,默认
         * 情况下,Windows时钟节拍为1/64秒(约15或16毫秒),Linux时钟节拍取决于分布和配置,但通常为1/100秒(10
         * 毫秒)。
         * Windows上没有Nice和IOWait信息,macOS上没有IOWait和IRQ信息,因此这些标记将始终为零。
         * 要使用此方法计算总空闲时间,请同时包括Idle和IOWait标记。同样,应将IRQ、SoftIRQ和Steal标记添加到系统值
         * 中以获得总和。系统计时还包括执行其他虚拟主机(窃取)的时间。
         * *
         * @return一个由8个长值组成的数组,表示在User、Nice、System、Idle、IOwait、IRQ、SoftIRQ和Steal状态下花费的时间。
         */
        long[] prevTicks = processor.getSystemCpuLoadTicks();
        Util.sleep(OSHI_WAIT_SECOND);
        long[] ticks = processor.getSystemCpuLoadTicks();
        long nice = ticks[1] - prevTicks[1];
        long irq = ticks[5] - prevTicks[5];
        long softIrq = ticks[6] - prevTicks[6];
        long steal = ticks[7] - prevTicks[7];
        long cSys = ticks[2] - prevTicks[2];
        long user = ticks[0] - prevTicks[0];
        long ioWait = ticks[4] - prevTicks[4];
        long idle = ticks[3] - prevTicks[3];
        /*
        long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()];
        long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()];
        long softIrq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()];
        long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()];
        long cSys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()];
        long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()];
        long ioWait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()];
        long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()];
        */
        long totalCpu = user + nice + cSys + idle + ioWait + irq + softIrq + steal;
        CpuInfoVo vo = new CpuInfoVo() ;
        vo.cores = processor.getLogicalProcessorCount() ;
        vo.totalRate = totalCpu ;
        vo.sysRate = cSys ;
        vo.userRate = user ;
        vo.waitRate = ioWait ;
        vo.freeRate = idle ;
        return vo ;
    }
    @Data
    public static class CpuInfoVo{
        /**
         * 核心数
         */
        public int cores;
        /**
         * CPU总的使用率
         */
        public double totalRate;
        /**
         * CPU系统使用率
         */
        public double sysRate;
        /**
         * CPU用户使用率
         */
        public double userRate;
        /**
         * CPU当前等待率
         */
        public double waitRate;
        /**
         * CPU当前空闲率
         */
        public double freeRate;
        public String toString(){
            StringBuilder sb = new StringBuilder() ;
            sb.append("   CPU信息:\n");
            sb.append("      核心数:" + cores + "\n");
            sb.append("      CPU总的使用率:" + totalRate + "\n");
            sb.append("      CPU系统使用率:" + sysRate + "\n");
            sb.append("      CPU用户使用率:" + userRate + "\n");
            sb.append("      CPU当前等待率:" + waitRate + "\n");
            sb.append("      CPU当前空闲率:" + freeRate + "\n");
            return sb.toString() ;
        }
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysFileSysUtil.java
New file
@@ -0,0 +1,113 @@
package com.dy.common.util;
import lombok.Data;
import oshi.software.os.FileSystem;
import oshi.software.os.OSFileStore;
import oshi.software.os.OperatingSystem;
import java.util.LinkedList;
import java.util.List;
/**
 * @Author: liurunyu
 * @Date: 2024/8/2 13:54
 * @Description
 */
public class SysFileSysUtil {
    /**
     * 磁盘信息
     */
    public static LinkedList<SysFile> info(OperatingSystem os)  {
        LinkedList<SysFile> sysFiles = new LinkedList<SysFile>();
        FileSystem fileSystem = os.getFileSystem();
        List<OSFileStore> fsArray = fileSystem.getFileStores();
        for (OSFileStore fs : fsArray) {
            long free = fs.getUsableSpace();
            long total = fs.getTotalSpace();
            long used = total - free;
            SysFile sysFile = new SysFile();
            sysFile.setDirName(fs.getMount());
            sysFile.setSysTypeName(fs.getType());
            sysFile.setTypeName(fs.getName());
            sysFile.setTotal(convertFileSize(total));
            sysFile.setFree(convertFileSize(free));
            sysFile.setUsed(convertFileSize(used));
            sysFile.setUsage(DoubleUtil.mul(DoubleUtil.div(used, total, 4), 100));
            sysFiles.add(sysFile);
        }
        return sysFiles ;
    }
    /**
     * 字节转换
     *
     * @param size 字节大小
     * @return 转换后值
     */
    public static String convertFileSize(long size) {
        long kb = 1024;
        long mb = kb * 1024;
        long gb = mb * 1024;
        if (size >= gb) {
            return String.format("%.1f GB", (float) size / gb);
        } else if (size >= mb) {
            float f = (float) size / mb;
            return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f);
        } else if (size >= kb) {
            float f = (float) size / kb;
            return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f);
        } else {
            return String.format("%d B", size);
        }
    }
    @Data
    public static class SysFile{
        /**
         * 盘符路径
         */
        public String dirName;
        /**
         * 盘符类型
         */
        public String sysTypeName;
        /**
         * 文件类型
         */
        public String typeName;
        /**
         * 总大小
         */
        public String total;
        /**
         * 剩余大小
         */
        public String free;
        /**
         * 已经使用量
         */
        public String used;
        /**
         * 资源的使用率
         */
        public double usage;
        public String toString(){
            StringBuilder sb = new StringBuilder() ;
            sb.append("   磁盘" + dirName + "\n");
            sb.append("      盘符类型:" + sysTypeName + "\n");
            sb.append("      文件类型:" + typeName + "\n");
            sb.append("      总大小:" + total + "\n");
            sb.append("      剩余大小:" + free + "\n");
            sb.append("      已经使用量:" + used + "\n");
            sb.append("      资源使用率:" + usage + "\n");
            return sb.toString() ;
        }
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysJvmUtil.java
New file
@@ -0,0 +1,78 @@
package com.dy.common.util;
import lombok.Data;
import java.net.UnknownHostException;
import java.text.DecimalFormat;
import java.util.Properties;
/**
 * @Author: liurunyu
 * @Date: 2024/8/2 13:52
 * @Description
 */
public class SysJvmUtil {
    /**
Java虚拟机信息
     */
    public static JvmInfoVo info() throws UnknownHostException {
        JvmInfoVo vo = new JvmInfoVo() ;
        Properties props = System.getProperties();
        vo.setTotal(toMbytes(Runtime.getRuntime().totalMemory()));
        vo.setMax(toMbytes(Runtime.getRuntime().maxMemory()));
        vo.setFree(toMbytes(Runtime.getRuntime().freeMemory()));
        vo.setVersion(props.getProperty("java.version"));
        vo.setHome(props.getProperty("java.home"));
        return vo ;
    }
    private static double toMbytes(double value){
        return value/1000000.0 ;
    }
    @Data
    public static class JvmInfoVo {
        /**
    当前JVM占用的内存总数(M)
         */
        public double total;
        /**
    JVM最大可用内存总数(M)
         */
        public double max;
        /**
    JVM空闲内存(M)
         */
        public double free;
        /**
    JDK版本
         */
        public String version;
        /**
    JDK路径
         */
        public String home;
        public String toString(){
            DecimalFormat df = new DecimalFormat("#.####"); // 设定格式
            StringBuilder sb = new StringBuilder() ;
            sb.append("   JVM信息:\n");
            sb.append("      JVM最大可用内存总数(M):" + df.format(max) + "\n");
            sb.append("      JVM占用的内存数(M):" + df.format(total) + "\n");
            sb.append("      JVM空闲内存数(M):" + df.format(free) + "\n");
            sb.append("      JDK版本:" + version + "\n");
            sb.append("      JDK路径:" + home + "\n");
            return sb.toString() ;
        }
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysMemoryUtil.java
New file
@@ -0,0 +1,58 @@
package com.dy.common.util;
import lombok.Data;
import oshi.hardware.GlobalMemory;
import java.text.DecimalFormat;
/**
 * @Author: liurunyu
 * @Date: 2024/8/2 13:42
 * @Description
 */
public class SysMemoryUtil {
    /**
     * 内存信息
     */
    public static MemInfoVo info(GlobalMemory memory) {
        MemInfoVo vo = new MemInfoVo() ;
        vo.setTotal(toGbytes(memory.getTotal()));
        vo.setUsed(toGbytes(memory.getTotal() - memory.getAvailable()));
        vo.setFree(toGbytes(memory.getAvailable()));
        return vo ;
    }
    private static double toGbytes(double value){
        return value/1000000000.0 ;
    }
    @Data
    public static class MemInfoVo {
        /**
         * 内存总量
         */
        public double total;
        /**
         * 已用内存
         */
        public double used;
        /**
         * 剩余内存
         */
        public double free;
        public String toString(){
            DecimalFormat df = new DecimalFormat("#.####"); // 设定格式
            StringBuilder sb = new StringBuilder() ;
            sb.append("   内存信息:\n");
            sb.append("      内存总量(G):" + df.format(total) + "\n");
            sb.append("      已用内存(G):" + df.format(used) + "\n");
            sb.append("      剩余内存(G):" + df.format(free) + "\n");
            return sb.toString() ;
        }
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysSysUtil.java
New file
@@ -0,0 +1,68 @@
package com.dy.common.util;
import lombok.Data;
import java.util.Properties;
/**
 * @Author: liurunyu
 * @Date: 2024/8/2 13:46
 * @Description
 */
public class SysSysUtil {
    /**
     * 设置服务器信息
     */
    public static SysInfoVo info() {
        SysInfoVo vo = new SysInfoVo() ;
        Properties props = System.getProperties();
        vo.setComputerName(IPUtils.getHostName());
        vo.setComputerIp(IPUtils.getHostIp());
        vo.setOsName(props.getProperty("os.name"));
        vo.setOsArch(props.getProperty("os.arch"));
        vo.setUserDir(props.getProperty("user.dir"));
        return vo ;
    }
    @Data
    public static class  SysInfoVo{
        /**
         * 服务器名称
         */
        public String computerName;
        /**
         * 服务器Ip
         */
        public String computerIp;
        /**
         * 项目路径
         */
        public String userDir;
        /**
         * 操作系统
         */
        public String osName;
        /**
         * 系统架构
         */
        public String osArch;
        public String toString(){
            StringBuilder sb = new StringBuilder() ;
            sb.append("   系统信息:\n");
            sb.append("      主机名称:" + computerName + "\n");
            sb.append("      主机IP:" + computerIp + "\n");
            sb.append("      项目路径:" + userDir + "\n");
            sb.append("      操作系统:" + osName + "\n");
            sb.append("      系统架构:" + osArch + "\n");
            return sb.toString() ;
        }
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysUtil.java
New file
@@ -0,0 +1,64 @@
package com.dy.common.util;
import lombok.Data;
import oshi.SystemInfo;
import oshi.hardware.HardwareAbstractionLayer;
import java.util.LinkedList;
/**
 * @Author: liurunyu
 * @Date: 2024/8/2 15:37
 * @Description
 */
public class SysUtil {
    public static InfoVo info() throws Exception {
        InfoVo vo = new InfoVo() ;
        SystemInfo si = new SystemInfo();
        HardwareAbstractionLayer hal = si.getHardware();
        vo.cpuInfoVo = SysCpuUtil.info(hal.getProcessor());
        vo.memInfoVo = SysMemoryUtil.info(hal.getMemory());
        vo.sysInfoVo = SysSysUtil.info();
        vo.jvmInfoVo = SysJvmUtil.info();
        vo.sysFiles = SysFileSysUtil.info(si.getOperatingSystem());
        return vo ;
    }
    @Data
    public static class InfoVo {
        public SysCpuUtil.CpuInfoVo cpuInfoVo ;
        public SysJvmUtil.JvmInfoVo jvmInfoVo ;
        public SysMemoryUtil.MemInfoVo memInfoVo ;
        public LinkedList<SysFileSysUtil.SysFile> sysFiles ;
        public SysSysUtil.SysInfoVo sysInfoVo ;
        public String toString(){
            StringBuilder sb = new StringBuilder() ;
            sb.append("系统信息:\n");
            sb.append("  " + (cpuInfoVo != null?cpuInfoVo.toString():"") + "\n");
            sb.append("  " + (jvmInfoVo != null?jvmInfoVo.toString():"") + "\n");
            sb.append("  " + (memInfoVo != null?memInfoVo.toString():"") + "\n");
            if(sysFiles != null && sysFiles.size() > 0){
                for(SysFileSysUtil.SysFile f : sysFiles){
                    sb.append("  " + f.toString() + "\n");
                }
            }
            sb.append("  " + (sysInfoVo != null?sysInfoVo.toString():"") + "\n");
            return sb.toString() ;
        }
    }
    public static void main(String[] args) throws Exception{
        SysUtil.InfoVo vo = SysUtil.info() ;
        System.out.println(vo.toString());
    }
}
pipIrr-platform/pipIrr-global/pom.xml
@@ -146,6 +146,12 @@
            <groupId>com.aliyun</groupId>
            <artifactId>alibaba-dingtalk-service-sdk</artifactId>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportHistoryMapper.java
@@ -3,7 +3,6 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoRm.RmOnHourReportHistory;
import com.dy.pipIrrGlobal.voRm.VoOnHour;
import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow;
import com.dy.pipIrrGlobal.voSt.VoIntake;
import org.apache.ibatis.annotations.Mapper;
@@ -87,31 +86,4 @@
     */
    List<VoIntake> getNotOnlineIntakes(Map<?, ?> params);
    /**
     * 获取累计流量超过指定值的取水口数量
     * @param params
     * @return
     */
    Long getLargeFlowIntakesCount(Map<?, ?> params);
    /**
     * 获取累计流量超过指定值的取水口
     * @param params
     * @return
     */
    List<VoCumulativeFlow> getLargeFlowIntakes(Map<?, ?> params);
    /**
     * 获取累计流量低于指定值的取水口数量
     * @param params
     * @return
     */
    Long getSmallFlowIntakesCount(Map<?, ?> params);
    /**
     * 获取累计流量低于指定值的取水口
     * @param params
     * @return
     */
    List<VoCumulativeFlow> getSmallFlowIntakes(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportLastMapper.java
@@ -3,6 +3,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast;
import com.dy.pipIrrGlobal.voRm.VoOnHour;
import com.dy.pipIrrGlobal.voSt.VoBatteryVolt;
import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow;
import com.dy.pipIrrGlobal.voSt.VoSignalIntensity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@@ -79,4 +82,60 @@
     * @return
     */
    List<VoOnHour> getOnHourReports_last(Map<?, ?> params);
    /**
     * 获取累计流量超过指定值的取水口数量
     * @param params
     * @return
     */
    Long getLargeFlowIntakesCount(Map<?, ?> params);
    /**
     * 获取累计流量超过指定值的取水口
     * @param params
     * @return
     */
    List<VoCumulativeFlow> getLargeFlowIntakes(Map<?, ?> params);
    /**
     * 获取累计流量低于指定值的取水口数量
     * @param params
     * @return
     */
    Long getSmallFlowIntakesCount(Map<?, ?> params);
    /**
     * 获取累计流量低于指定值的取水口
     * @param params
     * @return
     */
    List<VoCumulativeFlow> getSmallFlowIntakes(Map<?, ?> params);
    /**
     * 获取欠压取水口数量
     * @param params
     * @return
     */
    Long getUnderVoltIntakesCount(Map<?, ?> params);
    /**
     * 获取欠压取水口
     * @param params
     * @return
     */
    List<VoBatteryVolt> getUnderVoltIntakes(Map<?, ?> params);
    /**
     * 获取指定信号强度的取水口数量
     * @param params
     * @return
     */
    Long getSpecifiedSignalIntakesCount(Map<?, ?> params);
    /**
     * 获取指定信号强度的取水口
     * @param params
     * @return
     */
    List<VoSignalIntensity> getSpecifiedSignalIntakes(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoOnLineIntake.java
@@ -1,6 +1,5 @@
package com.dy.pipIrrGlobal.voPr;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.dy.common.po.BaseEntity;
import lombok.Data;
@@ -31,6 +30,21 @@
    private String intakeNum;
    /**
     * 取水口经度
     */
    private Double lng;
    /**
     * 取水口纬度
     */
    private Double lat;
    /**
     * 累计流量
     */
    private Double totalAmount;
    /**
     * 是否在线
     */
    private Boolean isOnLine;
@@ -39,4 +53,10 @@
     * 是否绑定
     */
    private Boolean isBinded;
    /**
     * 报警信息Json数组
     */
    private String alarm;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoBatteryVolt.java
New file
@@ -0,0 +1,28 @@
package com.dy.pipIrrGlobal.voSt;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-08-03 10:10
 * @LastEditTime 2024-08-03 10:10
 * @Description 电池电压视图
 */
@Data
public class VoBatteryVolt extends VoIntake {
    /**
     * 电池电压
     */
    private Double batteryVolt;
    /**
     * 数据获取日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date getDate;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoCumulativeFlow.java
@@ -18,7 +18,7 @@
    /**
     * 累计流量
     */
    private Float cumulativeFlow;
    private Double cumulativeFlow;
    /**
     * 数据获取日期
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoSignalIntensity.java
New file
@@ -0,0 +1,27 @@
package com.dy.pipIrrGlobal.voSt;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-08-05 8:39
 * @LastEditTime 2024-08-05 8:39
 * @Description 信号强度视图
 */
@Data
public class VoSignalIntensity extends VoIntake {
    /**
     * 信号强度
     */
    private Integer signValue;
    /**
     * 数据获取日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date getDate;
}
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -72,7 +72,7 @@
pipIrr:
    global:
        dev: true   #是否开发阶段,true或false
        dev: flase   #是否开发阶段,true或false
        dsName: ym  #开发阶段,设置临时的数据库名称
    mw:
        webPort: 8070
@@ -175,4 +175,12 @@
        access-token: fecef8e7725998f8912af05419580861aafc73413c4920036c07c050fa33055f
        secret: SEC6042bc964d08899a5853eb321eb5a4d842a395982777f815bd07451c879228b7
    at-all: true
    mobile: 18602657034
    mobile: 18602657034
#阀控器参数
rtu:
    batteryVolt: 17
    signalIntensity:
        weak: 10
        ordinary: 20
#        strong: 20
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -1,499 +1,548 @@
<?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="com.dy.pipIrrGlobal.daoPr.PrIntakeMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrIntake">
    <!--@mbg.generated-->
    <!--@Table pr_intake-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="countyId" jdbcType="BIGINT" property="countyId" />
    <result column="townId" jdbcType="BIGINT" property="townId" />
    <result column="villageId" jdbcType="BIGINT" property="villageId" />
    <result column="divideId" jdbcType="BIGINT" property="divideId" />
    <result column="blockId" jdbcType="BIGINT" property="blockId" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="lng" jdbcType="DOUBLE" property="lng" />
    <result column="lat" jdbcType="DOUBLE" property="lat" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="operator" jdbcType="BIGINT" property="operator" />
    <result column="operateDt" jdbcType="TIMESTAMP" property="operateDt" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, countyId, townId, villageId, divideId, blockId, `name`, lng, lat, remarks, `operator`,
    operateDt, deleted
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from pr_intake
    where id = #{id,jdbcType=BIGINT} and deleted = 0
  </select>
  <delete id="deleteLogicById" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    update pr_intake
    set deleted = 1
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <select id="selectAll" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List"/>
    from pr_intake
    where deleted != 1
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from pr_intake
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake">
    <!--@mbg.generated-->
    insert into pr_intake (id, countyId, townId,
      villageId, divideId, blockId,
      `name`, lng, lat, remarks,
      `operator`, operateDt, deleted
      )
    values (#{id,jdbcType=BIGINT}, #{countyId,jdbcType=BIGINT}, #{townId,jdbcType=BIGINT},
      #{villageId,jdbcType=BIGINT}, #{divideId,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT},
      #{name,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, #{lat,jdbcType=DOUBLE}, #{remarks,jdbcType=VARCHAR},
      #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake">
    <!--@mbg.generated-->
    insert into pr_intake
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrIntake">
        <!--@mbg.generated-->
        <!--@Table pr_intake-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="countyId" jdbcType="BIGINT" property="countyId"/>
        <result column="townId" jdbcType="BIGINT" property="townId"/>
        <result column="villageId" jdbcType="BIGINT" property="villageId"/>
        <result column="divideId" jdbcType="BIGINT" property="divideId"/>
        <result column="blockId" jdbcType="BIGINT" property="blockId"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="lng" jdbcType="DOUBLE" property="lng"/>
        <result column="lat" jdbcType="DOUBLE" property="lat"/>
        <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
        <result column="operator" jdbcType="BIGINT" property="operator"/>
        <result column="operateDt" jdbcType="TIMESTAMP" property="operateDt"/>
        <result column="deleted" jdbcType="TINYINT" property="deleted"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id,
      </if>
      <if test="countyId != null">
        countyId,
      </if>
      <if test="townId != null">
        townId,
      </if>
      <if test="villageId != null">
        villageId,
      </if>
      <if test="divideId != null">
        divideId,
      </if>
      <if test="blockId != null">
        blockId,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="lng != null">
        lng,
      </if>
      <if test="lat != null">
        lat,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
      <if test="operator != null">
        `operator`,
      </if>
      <if test="operateDt != null">
        operateDt,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="countyId != null">
        #{countyId,jdbcType=BIGINT},
      </if>
      <if test="townId != null">
        #{townId,jdbcType=BIGINT},
      </if>
      <if test="villageId != null">
        #{villageId,jdbcType=BIGINT},
      </if>
      <if test="divideId != null">
        #{divideId,jdbcType=BIGINT},
      </if>
      <if test="blockId != null">
        #{blockId,jdbcType=BIGINT},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="lng != null">
        #{lng,jdbcType=DOUBLE},
      </if>
      <if test="lat != null">
        #{lat,jdbcType=DOUBLE},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="operator != null">
        #{operator,jdbcType=BIGINT},
      </if>
      <if test="operateDt != null">
        #{operateDt,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake">
    <!--@mbg.generated-->
    update pr_intake
    <set>
      <if test="countyId != null">
        countyId = #{countyId,jdbcType=BIGINT},
      </if>
      <if test="townId != null">
        townId = #{townId,jdbcType=BIGINT},
      </if>
      <if test="villageId != null">
        villageId = #{villageId,jdbcType=BIGINT},
      </if>
      <if test="divideId != null">
        divideId = #{divideId,jdbcType=BIGINT},
      </if>
      <if test="blockId != null">
        blockId = #{blockId,jdbcType=BIGINT},
      </if>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="lng != null">
        lng = #{lng,jdbcType=DOUBLE},
      </if>
      <if test="lat != null">
        lat = #{lat,jdbcType=DOUBLE},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="operator != null">
        `operator` = #{operator,jdbcType=BIGINT},
      </if>
      <if test="operateDt != null">
        operateDt = #{operateDt,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake">
    <!--@mbg.generated-->
    update pr_intake
    set countyId = #{countyId,jdbcType=BIGINT},
      townId = #{townId,jdbcType=BIGINT},
      villageId = #{villageId,jdbcType=BIGINT},
      divideId = #{divideId,jdbcType=BIGINT},
      blockId = #{blockId,jdbcType=BIGINT},
      `name` = #{name,jdbcType=VARCHAR},
      lng = #{lng,jdbcType=DOUBLE},
      lat = #{lat,jdbcType=DOUBLE},
      remarks = #{remarks,jdbcType=VARCHAR},
      `operator` = #{operator,jdbcType=BIGINT},
      operateDt = #{operateDt,jdbcType=TIMESTAMP},
      deleted = #{deleted,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
        deleted
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        <!--@mbg.generated-->
        select
        <include refid="Base_Column_List"/>
        from pr_intake
        where id = #{id,jdbcType=BIGINT}
          and deleted = 0
    </select>
  <!--根据指定条件获取取水口记录数-->
  <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
    SELECT COUNT(*) AS recordCount
    FROM pr_intake ge
    INNER JOIN pr_divide divi ON ge.divideId = divi.id
    INNER JOIN ba_block blo ON divi.blockId = blo.id
    LEFT JOIN ba_district country ON ge.countyId = country.id
    LEFT JOIN ba_district town ON ge.townId = town.id
    LEFT JOIN ba_district village ON ge.villageId = village.id
    LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
    <where>
      ge.deleted = 0
      AND divi.deleted = 0
      and blo.deleted = 0
      <if test="intakeName != null and intakeName != ''">
        AND ge.name LIKE CONCAT('%', #{intakeName}, '%')
      </if>
    <delete id="deleteLogicById" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        update pr_intake
        set deleted = 1
        where id = #{id,jdbcType=BIGINT}
    </delete>
      <if test = "divideId != null and divideId !=''">
        AND divi.id = #{divideId}
      </if>
    <select id="selectAll" resultMap="BaseResultMap">
        <!--@mbg.generated-->
        select
        <include refid="Base_Column_List"/>
        from pr_intake
        where deleted != 1
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        delete
        from pr_intake
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake">
        <!--@mbg.generated-->
        insert into pr_intake (id, countyId, townId,
                               villageId, divideId, blockId,
                               `name`, lng, lat, remarks,
                               `operator`, operateDt, deleted)
        values (#{id,jdbcType=BIGINT}, #{countyId,jdbcType=BIGINT}, #{townId,jdbcType=BIGINT},
                #{villageId,jdbcType=BIGINT}, #{divideId,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT},
                #{name,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, #{lat,jdbcType=DOUBLE}, #{remarks,jdbcType=VARCHAR},
                #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT})
    </insert>
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake">
        <!--@mbg.generated-->
        insert into pr_intake
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="countyId != null">
                countyId,
            </if>
            <if test="townId != null">
                townId,
            </if>
            <if test="villageId != null">
                villageId,
            </if>
            <if test="divideId != null">
                divideId,
            </if>
            <if test="blockId != null">
                blockId,
            </if>
            <if test="name != null">
                `name`,
            </if>
            <if test="lng != null">
                lng,
            </if>
            <if test="lat != null">
                lat,
            </if>
            <if test="remarks != null">
                remarks,
            </if>
            <if test="operator != null">
                `operator`,
            </if>
            <if test="operateDt != null">
                operateDt,
            </if>
            <if test="deleted != null">
                deleted,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="countyId != null">
                #{countyId,jdbcType=BIGINT},
            </if>
            <if test="townId != null">
                #{townId,jdbcType=BIGINT},
            </if>
            <if test="villageId != null">
                #{villageId,jdbcType=BIGINT},
            </if>
            <if test="divideId != null">
                #{divideId,jdbcType=BIGINT},
            </if>
            <if test="blockId != null">
                #{blockId,jdbcType=BIGINT},
            </if>
            <if test="name != null">
                #{name,jdbcType=VARCHAR},
            </if>
            <if test="lng != null">
                #{lng,jdbcType=DOUBLE},
            </if>
            <if test="lat != null">
                #{lat,jdbcType=DOUBLE},
            </if>
            <if test="remarks != null">
                #{remarks,jdbcType=VARCHAR},
            </if>
            <if test="operator != null">
                #{operator,jdbcType=BIGINT},
            </if>
            <if test="operateDt != null">
                #{operateDt,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                #{deleted,jdbcType=TINYINT},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake">
        <!--@mbg.generated-->
        update pr_intake
        <set>
            <if test="countyId != null">
                countyId = #{countyId,jdbcType=BIGINT},
            </if>
            <if test="townId != null">
                townId = #{townId,jdbcType=BIGINT},
            </if>
            <if test="villageId != null">
                villageId = #{villageId,jdbcType=BIGINT},
            </if>
            <if test="divideId != null">
                divideId = #{divideId,jdbcType=BIGINT},
            </if>
            <if test="blockId != null">
                blockId = #{blockId,jdbcType=BIGINT},
            </if>
            <if test="name != null">
                `name` = #{name,jdbcType=VARCHAR},
            </if>
            <if test="lng != null">
                lng = #{lng,jdbcType=DOUBLE},
            </if>
            <if test="lat != null">
                lat = #{lat,jdbcType=DOUBLE},
            </if>
            <if test="remarks != null">
                remarks = #{remarks,jdbcType=VARCHAR},
            </if>
            <if test="operator != null">
                `operator` = #{operator,jdbcType=BIGINT},
            </if>
            <if test="operateDt != null">
                operateDt = #{operateDt,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                deleted = #{deleted,jdbcType=TINYINT},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrIntake">
        <!--@mbg.generated-->
        update pr_intake
        set countyId   = #{countyId,jdbcType=BIGINT},
            townId     = #{townId,jdbcType=BIGINT},
            villageId  = #{villageId,jdbcType=BIGINT},
            divideId   = #{divideId,jdbcType=BIGINT},
            blockId    = #{blockId,jdbcType=BIGINT},
            `name`     = #{name,jdbcType=VARCHAR},
            lng        = #{lng,jdbcType=DOUBLE},
            lat        = #{lat,jdbcType=DOUBLE},
            remarks    = #{remarks,jdbcType=VARCHAR},
            `operator` = #{operator,jdbcType=BIGINT},
            operateDt  = #{operateDt,jdbcType=TIMESTAMP},
            deleted    = #{deleted,jdbcType=TINYINT}
        where id = #{id,jdbcType=BIGINT}
    </update>
      <if test = "blockId != null and blockId !=''">
        AND blo.id = #{blockId}
      </if>
    <!--根据指定条件获取取水口记录数-->
    <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM pr_intake ge
                 INNER JOIN pr_divide divi ON ge.divideId = divi.id
                 INNER JOIN ba_block blo ON divi.blockId = blo.id
                 LEFT JOIN ba_district country ON ge.countyId = country.id
                 LEFT JOIN ba_district town ON ge.townId = town.id
                 LEFT JOIN ba_district village ON ge.villageId = village.id
                 LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
        <where>
            ge.deleted = 0
              AND divi.deleted = 0
              and blo.deleted = 0
            <if test="intakeName != null and intakeName != ''">
                AND ge.name LIKE CONCAT('%', #{intakeName}, '%')
            </if>
      <if test="isBinded == 0">
        AND ge.id NOT IN(SELECT intakeId FROM pr_controller where deleted = 0)
      </if>
      <if test="isBinded == 1">
        AND ge.id IN(SELECT intakeId FROM pr_controller where deleted = 0)
      </if>
      <if test="isBinded == null">
            <if test="divideId != null and divideId != ''">
                AND divi.id = #{divideId}
            </if>
      </if>
      <if test="address != null and address != ''">
        AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%')
      </if>
    </where>
  </select>
            <if test="blockId != null and blockId != ''">
                AND blo.id = #{blockId}
            </if>
  <!--根据指定条件获取取水口记录-->
  <select id="getIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoIntake">
    SELECT
    CAST(ge.id AS char)                                 AS intakeId,
    ge.`name`                                           AS intakeName,
    CAST(divi.id AS char)                               AS divideId,
    divi.`name`                                         AS divideName,
    CAST(blo.id AS char)                                AS blockId,
    blo.`name`                                          AS blockName,
    CAST(cont.id AS char)                               AS controllerId,
    cont.rtuAddr                                        AS rtuAddr,
    ge.lng,
    ge.lat,
    ge.remarks,
    ge.operator,
    ge.operateDt                                        As operateDt,
    (CASE
    WHEN ge.id NOT IN(SELECT intakeId FROM pr_controller where deleted = 0)  THEN "未绑定"
    WHEN ge.id IN(SELECT intakeId FROM pr_controller  where deleted = 0)  THEN "已绑定"
    END) AS isBind,
    CONCAT(country.`name`, town.`name`, village.`name`) AS address
    FROM pr_intake ge
    INNER JOIN pr_divide divi ON ge.divideId = divi.id
    INNER JOIN ba_block blo ON divi.blockId = blo.id
    LEFT JOIN ba_district country ON ge.countyId = country.id
    LEFT JOIN ba_district town ON ge.townId = town.id
    LEFT JOIN ba_district village ON ge.villageId = village.id
    LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
    <where>
      ge.deleted = 0
      AND divi.deleted = 0
      and blo.deleted = 0
      <if test="intakeName != null and intakeName != ''">
        AND ge.name LIKE CONCAT('%', #{intakeName}, '%')
      </if>
            <if test="isBinded == 0">
                AND ge.id NOT IN (SELECT intakeId FROM pr_controller where deleted = 0)
            </if>
            <if test="isBinded == 1">
                AND ge.id IN (SELECT intakeId FROM pr_controller where deleted = 0)
            </if>
            <if test="isBinded == null">
            </if>
            <if test="address != null and address != ''">
                AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%')
            </if>
        </where>
    </select>
      <if test = "divideId != null and divideId !=''">
        AND divi.id = #{divideId}
      </if>
    <!--根据指定条件获取取水口记录-->
    <select id="getIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoIntake">
        SELECT CAST(ge.id AS char)                                 AS intakeId,
               ge.`name`                                           AS intakeName,
               CAST(divi.id AS char)                               AS divideId,
               divi.`name`                                         AS divideName,
               CAST(blo.id AS char)                                AS blockId,
               blo.`name`                                          AS blockName,
               CAST(cont.id AS char)                               AS controllerId,
               cont.rtuAddr                                        AS rtuAddr,
               ge.lng,
               ge.lat,
               ge.remarks,
               ge.operator,
               ge.operateDt                                        As operateDt,
               (CASE
                    WHEN ge.id NOT IN (SELECT intakeId FROM pr_controller where deleted = 0) THEN '未绑定'
                    WHEN ge.id IN (SELECT intakeId FROM pr_controller where deleted = 0) THEN '已绑定'
                   END)                                            AS isBind,
               CONCAT(country.`name`, town.`name`, village.`name`) AS address
        FROM pr_intake ge
                 INNER JOIN pr_divide divi ON ge.divideId = divi.id
                 INNER JOIN ba_block blo ON divi.blockId = blo.id
                 LEFT JOIN ba_district country ON ge.countyId = country.id
                 LEFT JOIN ba_district town ON ge.townId = town.id
                 LEFT JOIN ba_district village ON ge.villageId = village.id
                 LEFT JOIN pr_controller cont ON ge.id = cont.intakeId
        <where>
            ge.deleted = 0
              AND divi.deleted = 0
              and blo.deleted = 0
            <if test="intakeName != null and intakeName != ''">
                AND ge.name LIKE CONCAT('%', #{intakeName}, '%')
            </if>
      <if test = "blockId != null and blockId !=''">
        AND blo.id = #{blockId}
      </if>
            <if test="divideId != null and divideId != ''">
                AND divi.id = #{divideId}
            </if>
      <if test="isBinded == 0">
        AND ge.id NOT IN(SELECT intakeId FROM pr_controller where deleted = 0)
      </if>
      <if test="isBinded == 1">
        AND ge.id IN(SELECT intakeId FROM pr_controller where deleted = 0)
      </if>
      <if test="isBinded == null">
            <if test="blockId != null and blockId != ''">
                AND blo.id = #{blockId}
            </if>
      </if>
      <if test="address != null and address != ''">
        AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%')
      </if>
    </where>
    ORDER BY ge.operateDt DESC
    <if test="pageCurr != null and pageSize != null">
      LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
    </if>
  </select>
            <if test="isBinded == 0">
                AND ge.id NOT IN (SELECT intakeId FROM pr_controller where deleted = 0)
            </if>
            <if test="isBinded == 1">
                AND ge.id IN (SELECT intakeId FROM pr_controller where deleted = 0)
            </if>
            <if test="isBinded == null">
            </if>
            <if test="address != null and address != ''">
                AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%')
            </if>
        </where>
        ORDER BY ge.operateDt DESC
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
  <!--根据下级获取上一级地址-->
  <select id="getSupperByVillageId" parameterType="_long" resultType="java.lang.Long">
    select dis_tow.*
    from ba_district dis_vil
    inner join
    ba_district dis_tow
    on dis_vil.supperId = dis_tow.id
    where dis_vil.id = #{vaId,jdbcType=BIGINT}
  </select>
    <!--根据下级获取上一级地址-->
    <select id="getSupperByVillageId" parameterType="_long" resultType="java.lang.Long">
        select dis_tow.*
        from ba_district dis_vil
                 inner join
             ba_district dis_tow
             on dis_vil.supperId = dis_tow.id
        where dis_vil.id = #{vaId,jdbcType=BIGINT}
    </select>
  <!--根据取水口编号获取未删除的取水口数量-->
  <select id="getRecordCountOfIntake" resultType="java.lang.Integer">
    SELECT COUNT(*) AS recordCount FROM pr_intake WHERE deleted = 0 AND id = ${intakeId}
  </select>
    <!--根据取水口编号获取未删除的取水口数量-->
    <select id="getRecordCountOfIntake" resultType="java.lang.Integer">
        SELECT COUNT(*) AS recordCount
        FROM pr_intake
        WHERE deleted = 0
          AND id = #{intakeId}
    </select>
  <!--根据村ID获取全部地址-->
  <select id="getAddressByVillageId" parameterType="_long" resultType="java.lang.String">
    select
    CONCAT(dis_province.`name`, dis_city.`name`, dis_county.`name`, dis_town.`name`, dis_village.`name`) AS address
    from ba_district dis_village
    inner join ba_district dis_town    on dis_village.supperId = dis_town.id
    inner join ba_district dis_county    on dis_town.supperId = dis_county.id
    inner join ba_district dis_city    on dis_county.supperId = dis_city.id
    inner join ba_district dis_province    on dis_city.supperId = dis_province.id
    where dis_village.id = #{villageId,jdbcType=BIGINT}
  </select>
    <!--根据村ID获取全部地址-->
    <select id="getAddressByVillageId" parameterType="_long" resultType="java.lang.String">
        select CONCAT(dis_province.`name`, dis_city.`name`, dis_county.`name`, dis_town.`name`,
                      dis_village.`name`) AS address
        from ba_district dis_village
                 inner join ba_district dis_town on dis_village.supperId = dis_town.id
                 inner join ba_district dis_county on dis_town.supperId = dis_county.id
                 inner join ba_district dis_city on dis_county.supperId = dis_city.id
                 inner join ba_district dis_province on dis_city.supperId = dis_province.id
        where dis_village.id = #{villageId,jdbcType=BIGINT}
    </select>
  <!--根据区域Id获取区域等级-->
  <select id="getLevelByRegionId" parameterType="_long" resultType="java.lang.Integer">
    select
    region.level
    from ba_district region
    where region.id = #{regionId,jdbcType=BIGINT}
  </select>
    <!--根据区域Id获取区域等级-->
    <select id="getLevelByRegionId" parameterType="_long" resultType="java.lang.Integer">
        select region.level
        from ba_district region
        where region.id = #{regionId,jdbcType=BIGINT}
    </select>
  <!--获取未绑控制器的取水口列表-->
  <select id="getNoBindingIntakes" resultType="java.util.HashMap">
    SELECT
        CAST(inta.id AS char)AS intakeId,
        name AS intakeName
    FROM pr_intake inta
    WHERE id NOT IN(SELECT intakeId FROM pr_controller) AND deleted = 0
  </select>
    <!--获取未绑控制器的取水口列表-->
    <select id="getNoBindingIntakes" resultType="java.util.HashMap">
        SELECT CAST(inta.id AS char) AS intakeId,
               name                  AS intakeName
        FROM pr_intake inta
        WHERE id NOT IN (SELECT intakeId FROM pr_controller)
          AND deleted = 0
    </select>
  <!--获取取水口数量(在线和不在先)-->
  <select id="getOnLineIntakesCount" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM pr_controller con
        INNER JOIN pr_intake inta ON con.intakeId = inta.id
        left JOIN JSON_TABLE(
            <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
            #{onLineMap},
            '$[*]' COLUMNS(
                rtuAddr VARCHAR(20) PATH '$.rtuAddr',
                isOnLine BOOLEAN PATH '$.isOnLine'
            )
        ) rtus ON con.rtuAddr = rtus.rtuAddr
    <where>
      <if test="isOnLine != null">
        rtus.isOnLine = #{isOnLine}
      </if>
      <if test="intakeNum != null and intakeNum != ''">
        AND inta.name = #{intakeNum}
      </if>
      <if test="isBinded == 0">
        AND inta.id NOT IN(SELECT intakeId FROM pr_controller where deleted = 0)
      </if>
      <if test="isBinded == 1">
        AND inta.id IN(SELECT intakeId FROM pr_controller where deleted = 0)
      </if>
    </where>
  </select>
  <!--获取取水口列表(在线和不在先)-->
  <select id="getOnLineIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
    SELECT
    inta.id AS intakeId,
    con.rtuAddr,
    inta.name AS intakeNum,
    (CASE
    WHEN con.rtuAddr IS  NULL  THEN "false"
    WHEN con.rtuAddr IS NOT NULL THEN "true"
    END) AS isBinded,
    rtus.isOnLine
    FROM pr_intake inta
    LEFT JOIN pr_controller con ON con.intakeId = inta.id
    LEFT JOIN JSON_TABLE(
    <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
    #{onLineMap},
    '$[*]' COLUMNS(
    rtuAddr VARCHAR(20) PATH '$.rtuAddr',
    isOnLine BOOLEAN PATH '$.isOnLine'
    )
    ) rtus ON con.rtuAddr = rtus.rtuAddr
    <where>
      <if test="isOnLine != null">
        rtus.isOnLine = #{isOnLine}
      </if>
      <if test="intakeNum != null and intakeNum != ''">
        AND inta.name = #{intakeNum}
      </if>
      <if test="isBinded == false ">
        AND con.rtuAddr IS  NULL
      </if>
      <if test="isBinded == true ">
        AND con.rtuAddr IS NOT NULL
      </if>
    </where>
    order by con.id ASC
    <if test="pageCurr != null and pageSize != null">
      LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
    </if>
  </select>
  <!--根据取水口编号获取取水口对象-->
  <select id="getIntakeByName" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
    SELECT
      con.intakeId,
      con.rtuAddr,
      inta.name AS intakeNum,
      rtus.isOnLine
    FROM pr_controller con
      INNER JOIN pr_intake inta ON con.intakeId = inta.id
      left JOIN JSON_TABLE(
    <!--获取取水口数量(在线和不在先)-->
    <select id="getOnLineIntakesCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM pr_intake inta
            LEFT JOIN pr_controller con ON con.intakeId = inta.id
            LEFT JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
            LEFT JOIN(
            SELECT intake_id AS intakeId,
                   CONCAT(
                           IF(alarm_loss = 1, IF(alarm_water_meter_fault = 1, '流量计故障,', ''),
                              IF(alarm_water_meter_fault = 1, '流量计故障', '')),
                           IF(alarm_battery_volt = 1, IF(alarm_loss = 1, '漏损(偷水)报警,', ''),
                              IF(alarm_loss = 1, '漏损(偷水)报警', '')),
                           IF(alarm_valve = 1, IF(alarm_battery_volt = 1, '蓄电池电压报警,', ''),
                              IF(alarm_battery_volt = 1, '蓄电池电压报警', '')),
                           IF(alarm_valve = 1, '阀门报警', '')
                       )     AS alarm
            FROM rm_alarm_state_last
            WHERE (alarm_water_meter_fault = 1 OR alarm_loss = 1 OR alarm_battery_volt = 1 OR alarm_valve = 1)
              AND dt >= DATE_SUB(NOW(), INTERVAL 12 HOUR)
        ) alarm ON alarm.intakeId = inta.id
            LEFT JOIN JSON_TABLE(
        <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
        #{onLineMap},
        '$[*]' COLUMNS(
        rtuAddr VARCHAR(20) PATH '$.rtuAddr',
        isOnLine BOOLEAN PATH '$.isOnLine'
        )
      ) rtus ON con.rtuAddr = rtus.rtuAddr
    <where>
      <if test="intakeNum != null and intakeNum != ''">
        AND LOWER(inta.name) = #{intakeNum}
      </if>
    </where>
    LIMIT 0,1
        '$[*]' COLUMNS (
            rtuAddr VARCHAR(20) PATH '$.rtuAddr',
            isOnLine BOOLEAN PATH '$.isOnLine'
            )
            ) rtus ON con.rtuAddr = rtus.rtuAddr
        <where>
            <if test="isOnLine != null">
                rtus.isOnLine = #{isOnLine}
            </if>
            <if test="intakeNum != null and intakeNum != ''">
                AND inta.name = #{intakeNum}
            </if>
            <if test="isBinded == false">
                AND con.rtuAddr IS NULL
            </if>
            <if test="isBinded == true">
                AND con.rtuAddr IS NOT NULL
            </if>
        </where>
    </select>
  </select>
    <!--获取取水口列表(在线和不在先)-->
    <select id="getOnLineIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
        SELECT inta.id                     AS intakeId,
               con.rtuAddr,
               inta.name                   AS intakeNum,
               inta.lng,
               inta.lat,
               IFNULL(hou.total_amount, 0) AS totalAmount,
               (CASE
                    WHEN con.rtuAddr IS NULL THEN false
                    WHEN con.rtuAddr IS NOT NULL THEN true
                   END)                    AS isBinded,
               rtus.isOnLine,
               alarm.alarm
        FROM pr_intake inta
            LEFT JOIN pr_controller con ON con.intakeId = inta.id
            LEFT JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
            LEFT JOIN(
            SELECT intake_id AS intakeId,
                   CONCAT(
                           IF(alarm_loss = 1, IF(alarm_water_meter_fault = 1, '流量计故障,', ''),
                              IF(alarm_water_meter_fault = 1, '流量计故障', '')),
                           IF(alarm_battery_volt = 1, IF(alarm_loss = 1, '漏损(偷水)报警,', ''),
                              IF(alarm_loss = 1, '漏损(偷水)报警', '')),
                           IF(alarm_valve = 1, IF(alarm_battery_volt = 1, '蓄电池电压报警,', ''),
                              IF(alarm_battery_volt = 1, '蓄电池电压报警', '')),
                           IF(alarm_valve = 1, '阀门报警', '')
                       )     AS alarm
            FROM rm_alarm_state_last
            WHERE (alarm_water_meter_fault = 1 OR alarm_loss = 1 OR alarm_battery_volt = 1 OR alarm_valve = 1)
              AND dt >= DATE_SUB(NOW(), INTERVAL 12 HOUR)
        ) alarm ON alarm.intakeId = inta.id
            LEFT JOIN JSON_TABLE(
        <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
        #{onLineMap},
        '$[*]' COLUMNS (
            rtuAddr VARCHAR(20) PATH '$.rtuAddr',
            isOnLine BOOLEAN PATH '$.isOnLine'
            )
            ) rtus ON con.rtuAddr = rtus.rtuAddr
        <where>
            <if test="isOnLine != null">
                rtus.isOnLine = #{isOnLine}
            </if>
            <if test="intakeNum != null and intakeNum != ''">
                AND inta.name = #{intakeNum}
            </if>
            <if test="isBinded == false">
                AND con.rtuAddr IS NULL
            </if>
            <if test="isBinded == true">
                AND con.rtuAddr IS NOT NULL
            </if>
        </where>
        order by con.id ASC
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
  <!--根据操作员获取常用取水口-->
  <select id="getUsedIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
    SELECT
      DISTINCT con.intakeId,
    <!--根据取水口编号获取取水口对象-->
    <select id="getIntakeByName" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
        SELECT con.intakeId,
               con.rtuAddr,
               inta.name AS intakeNum,
               rtus.isOnLine
    FROM pr_controller con
           INNER JOIN pr_intake inta ON con.intakeId = inta.id
           INNER JOIN rm_command_history com ON con.rtuAddr = com.rtu_addr
           INNER JOIN JSON_TABLE(
            <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
            #{onLineMap},
            '$[*]' COLUMNS(
                rtuAddr VARCHAR(20) PATH '$.rtuAddr',
                isOnLine BOOLEAN PATH '$.isOnLine'
            )
      ) rtus ON con.rtuAddr = rtus.rtuAddr
    <where>
      <if test="operator != null">
        com.operator = #{operator}
      </if>
    </where>
  </select>
        FROM pr_controller con
                 INNER JOIN pr_intake inta ON con.intakeId = inta.id
                 left JOIN JSON_TABLE(
                #{onLineMap},
                '$[*]' COLUMNS (
                    rtuAddr VARCHAR(20) PATH '$.rtuAddr',
                    isOnLine BOOLEAN PATH '$.isOnLine'
                    )
            ) rtus ON con.rtuAddr = rtus.rtuAddr
        <where>
            <if test="intakeNum != null and intakeNum != ''">
                AND LOWER(inta.name) = #{intakeNum}
            </if>
        </where>
        LIMIT 0,1
    </select>
  <!--取水口名称换取水口ID,扫码开阀使用-->
  <select id="getIntakeIdByName" resultType="java.lang.Long">
    SELECT id AS intakeId FROM pr_intake WHERE `name` = #{intakeName}
  </select>
    <!--根据操作员获取常用取水口-->
    <select id="getUsedIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
        SELECT DISTINCT con.intakeId,
                        con.rtuAddr,
                        inta.name AS intakeNum,
                        rtus.isOnLine
        FROM pr_controller con
            INNER JOIN pr_intake inta ON con.intakeId = inta.id
            INNER JOIN rm_command_history com ON con.rtuAddr = com.rtu_addr
            INNER JOIN JSON_TABLE(
        <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
        #{onLineMap},
        '$[*]' COLUMNS (
            rtuAddr VARCHAR(20) PATH '$.rtuAddr',
            isOnLine BOOLEAN PATH '$.isOnLine'
            )
            ) rtus ON con.rtuAddr = rtus.rtuAddr
        <where>
            <if test="operator != null">
                com.operator = #{operator}
            </if>
        </where>
    </select>
  <!--取水口名称换取水口ID,验证是否重复名称使用-->
  <select id="getIntakeIdsByName" resultType="java.lang.Long">
    SELECT id AS intakeId FROM pr_intake WHERE `name` = #{intakeName}
  </select>
    <!--取水口名称换取水口ID,扫码开阀使用-->
    <select id="getIntakeIdByName" resultType="java.lang.Long">
        SELECT id AS intakeId
        FROM pr_intake
        WHERE `name` = #{intakeName}
    </select>
  <!--取水口名称换取水口ID,验证是否重复名称使用-->
  <select id="getIntakeIdByNameExcludeId" resultType="java.lang.Long">
    SELECT id AS intakeId FROM pr_intake WHERE id != #{id} and `name` = #{intakeName}
  </select>
    <!--取水口名称换取水口ID,验证是否重复名称使用-->
    <select id="getIntakeIdsByName" resultType="java.lang.Long">
        SELECT id AS intakeId
        FROM pr_intake
        WHERE `name` = #{intakeName}
    </select>
    <!--取水口名称换取水口ID,验证是否重复名称使用-->
    <select id="getIntakeIdByNameExcludeId" resultType="java.lang.Long">
        SELECT id AS intakeId
        FROM pr_intake
        WHERE id != #{id}
          and `name` = #{intakeName}
    </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
@@ -255,6 +255,9 @@
      LEFT JOIN se_client cli ON cli.id = his.operator
      LEFT JOIN ba_user  user ON user.id = his.operator
    <where>
      <if test="intakeId != null">
        AND his.intake_id = #{intakeId}
      </if>
      <if test = "commandName != null and commandName !=''">
        AND his.command_name LIKE CONCAT('%',#{commandName},'%')
      </if>
@@ -288,6 +291,9 @@
        LEFT JOIN se_client cli ON cli.id = his.operator
        LEFT JOIN ba_user  user ON user.id = his.operator
    <where>
      <if test="intakeId != null">
        AND his.intake_id = #{intakeId}
      </if>
      <if test = "commandName != null and commandName !=''">
        AND his.command_name LIKE CONCAT('%',#{commandName},'%')
      </if>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml
@@ -284,64 +284,6 @@
    </trim>
  </select>
  <!--获取累计流量超过指定值的取水口数量-->
  <select id="getLargeFlowIntakesCount" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM pr_intake inta
        INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
        INNER JOIN ba_block blo ON blo.id = inta.blockId
    WHERE inta.deleted = 0 AND hou.total_amount > #{totalAmount}
  </select>
  <!--获取累计流量超过指定值的取水口-->
  <select id="getLargeFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow">
    SELECT
      inta.id AS intakeId,
      inta.name AS intakeNum,
      blo.name AS blockName,
    CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow,
      hou.dt AS getDate
    FROM pr_intake inta
           INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
           INNER JOIN ba_block blo ON blo.id = inta.blockId
    WHERE inta.deleted = 0 AND hou.total_amount > #{totalAmount}
    ORDER BY hou.dt
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
  <!--获取累计流量低于指定值的取水口数量-->
  <select id="getSmallFlowIntakesCount" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM pr_intake inta
        INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
        INNER JOIN ba_block blo ON blo.id = inta.blockId
    WHERE inta.deleted = 0 AND hou.total_amount &lt; #{totalAmount}
  </select>
  <!--获取累计流量低于指定值的取水口-->
  <select id="getSmallFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow">
    SELECT
        inta.id AS intakeId,
        inta.name AS intakeNum,
        blo.name AS blockName,
<!--    FORMAT(hou.total_amount,2) AS cumulativeFlow,-->
        CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow,
        hou.dt AS getDate
    FROM pr_intake inta
        INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
        INNER JOIN ba_block blo ON blo.id = inta.blockId
    WHERE inta.deleted = 0 AND hou.total_amount &lt; #{totalAmount}
    ORDER BY hou.dt
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml
@@ -1,265 +1,420 @@
<?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="com.dy.pipIrrGlobal.daoRm.RmOnHourReportLastMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
    <!--@mbg.generated-->
    <!--@Table rm_on_hour_report_last-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="controller_id" jdbcType="BIGINT" property="controllerId" />
    <result column="intake_id" jdbcType="BIGINT" property="intakeId" />
    <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" />
    <result column="dt" jdbcType="TIMESTAMP" property="dt" />
    <result column="rtu_dt" jdbcType="TIMESTAMP" property="rtuDt" />
    <result column="instant_amount" jdbcType="FLOAT" property="instantAmount" />
    <result column="total_amount" jdbcType="FLOAT" property="totalAmount" />
    <result column="loss_amount" jdbcType="FLOAT" property="lossAmount" />
    <result column="water_press" jdbcType="FLOAT" property="waterPress" />
    <result column="battery_volt" jdbcType="FLOAT" property="batteryVolt" />
    <result column="signal_value" jdbcType="INTEGER" property="signalValue" />
    <result column="water_price" jdbcType="FLOAT" property="waterPrice" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, controller_id, intake_id, rtu_addr, dt, rtu_dt, instant_amount, total_amount,
    loss_amount, water_press, battery_volt, signal_value, water_price
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from rm_on_hour_report_last
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from rm_on_hour_report_last
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
    <!--@mbg.generated-->
    insert into rm_on_hour_report_last (id, controller_id, intake_id,
      rtu_addr, dt, rtu_dt,
      instant_amount, total_amount, loss_amount,
      water_press, battery_volt,
      signal_value, water_price)
    values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT},
      #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{rtuDt,jdbcType=TIMESTAMP},
      #{instantAmount,jdbcType=FLOAT}, #{totalAmount,jdbcType=FLOAT}, #{lossAmount,jdbcType=FLOAT},
      #{waterPress,jdbcType=FLOAT}, #{batteryVolt,jdbcType=FLOAT},
      #{signalValue,jdbcType=INTEGER}, #{waterPrice,jdbcType=FLOAT})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
    <!--@mbg.generated-->
    insert into rm_on_hour_report_last
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
        <!--@mbg.generated-->
        <!--@Table rm_on_hour_report_last-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="controller_id" jdbcType="BIGINT" property="controllerId"/>
        <result column="intake_id" jdbcType="BIGINT" property="intakeId"/>
        <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr"/>
        <result column="dt" jdbcType="TIMESTAMP" property="dt"/>
        <result column="rtu_dt" jdbcType="TIMESTAMP" property="rtuDt"/>
        <result column="instant_amount" jdbcType="FLOAT" property="instantAmount"/>
        <result column="total_amount" jdbcType="FLOAT" property="totalAmount"/>
        <result column="loss_amount" jdbcType="FLOAT" property="lossAmount"/>
        <result column="water_press" jdbcType="FLOAT" property="waterPress"/>
        <result column="battery_volt" jdbcType="FLOAT" property="batteryVolt"/>
        <result column="signal_value" jdbcType="INTEGER" property="signalValue"/>
        <result column="water_price" jdbcType="FLOAT" property="waterPrice"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id,
      </if>
      <if test="controllerId != null">
        controller_id,
      </if>
      <if test="intakeId != null">
        intake_id,
      </if>
      <if test="rtuAddr != null">
        rtu_addr,
      </if>
      <if test="dt != null">
        dt,
      </if>
      <if test="rtuDt != null">
        rtu_dt,
      </if>
      <if test="instantAmount != null">
        instant_amount,
      </if>
      <if test="totalAmount != null">
        total_amount,
      </if>
      <if test="lossAmount != null">
        loss_amount,
      </if>
      <if test="waterPress != null">
        water_press,
      </if>
      <if test="batteryVolt != null">
        battery_volt,
      </if>
      <if test="signalValue != null">
        signal_value,
      </if>
      <if test="waterPrice != null">
        water_price,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="controllerId != null">
        #{controllerId,jdbcType=BIGINT},
      </if>
      <if test="intakeId != null">
        #{intakeId,jdbcType=BIGINT},
      </if>
      <if test="rtuAddr != null">
        #{rtuAddr,jdbcType=VARCHAR},
      </if>
      <if test="dt != null">
        #{dt,jdbcType=TIMESTAMP},
      </if>
      <if test="rtuDt != null">
        #{rtuDt,jdbcType=TIMESTAMP},
      </if>
      <if test="instantAmount != null">
        #{instantAmount,jdbcType=FLOAT},
      </if>
      <if test="totalAmount != null">
        #{totalAmount,jdbcType=FLOAT},
      </if>
      <if test="lossAmount != null">
        #{lossAmount,jdbcType=FLOAT},
      </if>
      <if test="waterPress != null">
        #{waterPress,jdbcType=FLOAT},
      </if>
      <if test="batteryVolt != null">
        #{batteryVolt,jdbcType=FLOAT},
      </if>
      <if test="signalValue != null">
        #{signalValue,jdbcType=INTEGER},
      </if>
      <if test="waterPrice != null">
        #{waterPrice,jdbcType=FLOAT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
    <!--@mbg.generated-->
    update rm_on_hour_report_last
    <set>
      <if test="controllerId != null">
        controller_id = #{controllerId,jdbcType=BIGINT},
      </if>
      <if test="intakeId != null">
        intake_id = #{intakeId,jdbcType=BIGINT},
      </if>
      <if test="rtuAddr != null">
        rtu_addr = #{rtuAddr,jdbcType=VARCHAR},
      </if>
      <if test="dt != null">
        dt = #{dt,jdbcType=TIMESTAMP},
      </if>
      <if test="rtuDt != null">
        rtu_dt = #{rtuDt,jdbcType=TIMESTAMP},
      </if>
      <if test="instantAmount != null">
        instant_amount = #{instantAmount,jdbcType=FLOAT},
      </if>
      <if test="totalAmount != null">
        total_amount = #{totalAmount,jdbcType=FLOAT},
      </if>
      <if test="lossAmount != null">
        loss_amount = #{lossAmount,jdbcType=FLOAT},
      </if>
      <if test="waterPress != null">
        water_press = #{waterPress,jdbcType=FLOAT},
      </if>
      <if test="batteryVolt != null">
        battery_volt = #{batteryVolt,jdbcType=FLOAT},
      </if>
      <if test="signalValue != null">
        signal_value = #{signalValue,jdbcType=INTEGER},
      </if>
      <if test="waterPrice != null">
        water_price = #{waterPrice,jdbcType=FLOAT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
    <!--@mbg.generated-->
    update rm_on_hour_report_last
    set controller_id = #{controllerId,jdbcType=BIGINT},
      intake_id = #{intakeId,jdbcType=BIGINT},
      rtu_addr = #{rtuAddr,jdbcType=VARCHAR},
      dt = #{dt,jdbcType=TIMESTAMP},
      rtu_dt = #{rtuDt,jdbcType=TIMESTAMP},
      instant_amount = #{instantAmount,jdbcType=FLOAT},
      total_amount = #{totalAmount,jdbcType=FLOAT},
      loss_amount = #{lossAmount,jdbcType=FLOAT},
      water_press = #{waterPress,jdbcType=FLOAT},
      battery_volt = #{batteryVolt,jdbcType=FLOAT},
      signal_value = #{signalValue,jdbcType=INTEGER},
      water_price = #{waterPrice,jdbcType=FLOAT}
    where id = #{id,jdbcType=BIGINT}
  </update>
        water_price
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        <!--@mbg.generated-->
        select
        <include refid="Base_Column_List"/>
        from rm_on_hour_report_last
        where id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        delete
        from rm_on_hour_report_last
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
        <!--@mbg.generated-->
        insert into rm_on_hour_report_last (id, controller_id, intake_id,
                                            rtu_addr, dt, rtu_dt,
                                            instant_amount, total_amount, loss_amount,
                                            water_press, battery_volt,
                                            signal_value, water_price)
        values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT},
                #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{rtuDt,jdbcType=TIMESTAMP},
                #{instantAmount,jdbcType=FLOAT}, #{totalAmount,jdbcType=FLOAT}, #{lossAmount,jdbcType=FLOAT},
                #{waterPress,jdbcType=FLOAT}, #{batteryVolt,jdbcType=FLOAT},
                #{signalValue,jdbcType=INTEGER}, #{waterPrice,jdbcType=FLOAT})
    </insert>
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
        <!--@mbg.generated-->
        insert into rm_on_hour_report_last
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="controllerId != null">
                controller_id,
            </if>
            <if test="intakeId != null">
                intake_id,
            </if>
            <if test="rtuAddr != null">
                rtu_addr,
            </if>
            <if test="dt != null">
                dt,
            </if>
            <if test="rtuDt != null">
                rtu_dt,
            </if>
            <if test="instantAmount != null">
                instant_amount,
            </if>
            <if test="totalAmount != null">
                total_amount,
            </if>
            <if test="lossAmount != null">
                loss_amount,
            </if>
            <if test="waterPress != null">
                water_press,
            </if>
            <if test="batteryVolt != null">
                battery_volt,
            </if>
            <if test="signalValue != null">
                signal_value,
            </if>
            <if test="waterPrice != null">
                water_price,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="controllerId != null">
                #{controllerId,jdbcType=BIGINT},
            </if>
            <if test="intakeId != null">
                #{intakeId,jdbcType=BIGINT},
            </if>
            <if test="rtuAddr != null">
                #{rtuAddr,jdbcType=VARCHAR},
            </if>
            <if test="dt != null">
                #{dt,jdbcType=TIMESTAMP},
            </if>
            <if test="rtuDt != null">
                #{rtuDt,jdbcType=TIMESTAMP},
            </if>
            <if test="instantAmount != null">
                #{instantAmount,jdbcType=FLOAT},
            </if>
            <if test="totalAmount != null">
                #{totalAmount,jdbcType=FLOAT},
            </if>
            <if test="lossAmount != null">
                #{lossAmount,jdbcType=FLOAT},
            </if>
            <if test="waterPress != null">
                #{waterPress,jdbcType=FLOAT},
            </if>
            <if test="batteryVolt != null">
                #{batteryVolt,jdbcType=FLOAT},
            </if>
            <if test="signalValue != null">
                #{signalValue,jdbcType=INTEGER},
            </if>
            <if test="waterPrice != null">
                #{waterPrice,jdbcType=FLOAT},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
        <!--@mbg.generated-->
        update rm_on_hour_report_last
        <set>
            <if test="controllerId != null">
                controller_id = #{controllerId,jdbcType=BIGINT},
            </if>
            <if test="intakeId != null">
                intake_id = #{intakeId,jdbcType=BIGINT},
            </if>
            <if test="rtuAddr != null">
                rtu_addr = #{rtuAddr,jdbcType=VARCHAR},
            </if>
            <if test="dt != null">
                dt = #{dt,jdbcType=TIMESTAMP},
            </if>
            <if test="rtuDt != null">
                rtu_dt = #{rtuDt,jdbcType=TIMESTAMP},
            </if>
            <if test="instantAmount != null">
                instant_amount = #{instantAmount,jdbcType=FLOAT},
            </if>
            <if test="totalAmount != null">
                total_amount = #{totalAmount,jdbcType=FLOAT},
            </if>
            <if test="lossAmount != null">
                loss_amount = #{lossAmount,jdbcType=FLOAT},
            </if>
            <if test="waterPress != null">
                water_press = #{waterPress,jdbcType=FLOAT},
            </if>
            <if test="batteryVolt != null">
                battery_volt = #{batteryVolt,jdbcType=FLOAT},
            </if>
            <if test="signalValue != null">
                signal_value = #{signalValue,jdbcType=INTEGER},
            </if>
            <if test="waterPrice != null">
                water_price = #{waterPrice,jdbcType=FLOAT},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
        <!--@mbg.generated-->
        update rm_on_hour_report_last
        set controller_id  = #{controllerId,jdbcType=BIGINT},
            intake_id      = #{intakeId,jdbcType=BIGINT},
            rtu_addr       = #{rtuAddr,jdbcType=VARCHAR},
            dt             = #{dt,jdbcType=TIMESTAMP},
            rtu_dt         = #{rtuDt,jdbcType=TIMESTAMP},
            instant_amount = #{instantAmount,jdbcType=FLOAT},
            total_amount   = #{totalAmount,jdbcType=FLOAT},
            loss_amount    = #{lossAmount,jdbcType=FLOAT},
            water_press    = #{waterPress,jdbcType=FLOAT},
            battery_volt   = #{batteryVolt,jdbcType=FLOAT},
            signal_value   = #{signalValue,jdbcType=INTEGER},
            water_price    = #{waterPrice,jdbcType=FLOAT}
        where id = #{id,jdbcType=BIGINT}
    </update>
    <!--根据阀控器地址获取定点上报最新数据-->
    <select id="getRmOnHourReportLast" resultType="com.dy.pipIrrGlobal.pojoRm.RmOnHourReportLast">
        select
        <include refid="Base_Column_List" />
        <include refid="Base_Column_List"/>
        from rm_on_hour_report_last
        where intake_id = #{intakeId}
    </select>
  <!--根据指定条件获取整点报最新记录数量-->
  <select id="getOnHourReportsCount_last" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM rm_on_hour_report_last oh
    INNER JOIN pr_intake inta ON inta.id = oh.intake_id
    <where>
      <if test="intakeId != null and intakeId >0">
        AND oh.intake_id = #{intakeId}
      </if>
      <if test = "intakeNum != null and intakeNum !=''">
        AND inta.name LIKE CONCAT('%',#{intakeNum},'%')
      </if>
      <if test = "rtuAddr != null and rtuAddr !=''">
        AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%')
      </if>
      <if test = "timeStart != null and timeStop != null">
        AND oh.dt BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
  </select>
    <!--根据指定条件获取整点报最新记录数量-->
    <select id="getOnHourReportsCount_last" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM rm_on_hour_report_last oh
                 INNER JOIN pr_intake inta ON inta.id = oh.intake_id
        <where>
            <if test="intakeId != null and intakeId > 0">
                AND oh.intake_id = #{intakeId}
            </if>
            <if test="intakeNum != null and intakeNum != ''">
                AND inta.name LIKE CONCAT('%', #{intakeNum}, '%')
            </if>
            <if test="rtuAddr != null and rtuAddr != ''">
                AND oh.rtu_addr LIKE CONCAT('%', #{rtuAddr}, '%')
            </if>
            <if test="timeStart != null and timeStop != null">
                AND oh.dt BETWEEN #{timeStart} AND #{timeStop}
            </if>
        </where>
    </select>
  <!--根据指定条件获取整点报最新记录-->
  <select id="getOnHourReports_last" resultType="com.dy.pipIrrGlobal.voRm.VoOnHour">
    SELECT
      oh.intake_id AS intakeId,
      inta.`name` AS intakeNum,
      oh.rtu_addr AS rtuAddr,
      oh.dt AS receiveTime,
      oh.instant_amount AS instantAmount,
      oh.total_amount AS totalAmount,
      oh.loss_amount AS lossAmount,
      oh.water_press AS waterPress,
      oh.battery_volt AS batteryVolt,
      oh.signal_value AS signalValue,
      oh.water_price AS waterPrice
    FROM rm_on_hour_report_last oh
    INNER JOIN pr_intake inta ON inta.id = oh.intake_id
    <where>
      <if test="intakeId != null and intakeId >0">
        AND oh.intake_id = #{intakeId}
      </if>
      <if test = "intakeNum != null and intakeNum !=''">
        AND inta.name LIKE CONCAT('%',#{intakeNum},'%')
      </if>
      <if test = "rtuAddr != null and rtuAddr !=''">
        AND oh.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%')
      </if>
      <if test = "timeStart != null and timeStop != null">
        AND oh.dt BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
    ORDER BY oh.dt DESC
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
    <!--根据指定条件获取整点报最新记录-->
    <select id="getOnHourReports_last" resultType="com.dy.pipIrrGlobal.voRm.VoOnHour">
        SELECT oh.intake_id      AS intakeId,
               inta.`name`       AS intakeNum,
               oh.rtu_addr       AS rtuAddr,
               oh.dt             AS receiveTime,
               oh.instant_amount AS instantAmount,
               oh.total_amount   AS totalAmount,
               oh.loss_amount    AS lossAmount,
               oh.water_press    AS waterPress,
               oh.battery_volt   AS batteryVolt,
               oh.signal_value   AS signalValue,
               oh.water_price    AS waterPrice
        FROM rm_on_hour_report_last oh
                 INNER JOIN pr_intake inta ON inta.id = oh.intake_id
        <where>
            <if test="intakeId != null and intakeId > 0">
                AND oh.intake_id = #{intakeId}
            </if>
            <if test="intakeNum != null and intakeNum != ''">
                AND inta.name LIKE CONCAT('%', #{intakeNum}, '%')
            </if>
            <if test="rtuAddr != null and rtuAddr != ''">
                AND oh.rtu_addr LIKE CONCAT('%', #{rtuAddr}, '%')
            </if>
            <if test="timeStart != null and timeStop != null">
                AND oh.dt BETWEEN #{timeStart} AND #{timeStop}
            </if>
        </where>
        ORDER BY oh.dt DESC
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
    <!--获取累计流量超过指定值的取水口数量-->
    <select id="getLargeFlowIntakesCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM pr_intake inta
                 INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                 INNER JOIN ba_block blo ON blo.id = inta.blockId
        WHERE inta.deleted = 0
          AND hou.total_amount > #{totalAmount}
    </select>
    <!--获取累计流量超过指定值的取水口-->
    <select id="getLargeFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow">
        SELECT inta.id                                  AS intakeId,
               inta.name                                AS intakeNum,
               blo.name                                 AS blockName,
               CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow,
               hou.dt                                   AS getDate
        FROM pr_intake inta
                 INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                 INNER JOIN ba_block blo ON blo.id = inta.blockId
        WHERE inta.deleted = 0
          AND hou.total_amount > #{totalAmount}
        ORDER BY hou.dt
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
    <!--获取累计流量低于指定值的取水口数量-->
    <select id="getSmallFlowIntakesCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM pr_intake inta
                 INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                 INNER JOIN ba_block blo ON blo.id = inta.blockId
        WHERE inta.deleted = 0
          AND hou.total_amount &lt; #{totalAmount}
    </select>
    <!--获取累计流量低于指定值的取水口-->
    <select id="getSmallFlowIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoCumulativeFlow">
        SELECT inta.id   AS intakeId,
               inta.name AS intakeNum,
               blo.name  AS blockName,
        <!--    FORMAT(hou.total_amount,2) AS cumulativeFlow,-->
        CAST(hou.total_amount AS DECIMAL(10, 2)) AS cumulativeFlow,
        hou.dt                                   AS getDate
        FROM pr_intake inta
                 INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                 INNER JOIN ba_block blo ON blo.id = inta.blockId
        WHERE inta.deleted = 0
          AND hou.total_amount &lt; #{totalAmount}
        ORDER BY hou.dt
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
    <!--获取欠压取水口数量-->
    <select id="getUnderVoltIntakesCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM pr_intake inta
                 INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                 INNER JOIN ba_block blo ON blo.id = inta.blockId
        WHERE inta.deleted = 0
          AND hou.battery_volt &lt; #{batteryVolt}
    </select>
    <!--获取欠压取水口-->
    <select id="getUnderVoltIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoBatteryVolt">
        SELECT inta.id          AS intakeId,
               inta.name        AS intakeNum,
               blo.name         AS blockName,
               hou.battery_volt AS batteryVolt,
               hou.dt           AS getDate
        FROM pr_intake inta
                 INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                 INNER JOIN ba_block blo ON blo.id = inta.blockId
        WHERE inta.deleted = 0
          AND hou.battery_volt &lt; #{batteryVolt}
        ORDER BY hou.dt
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
    <!--获取指定信号强度的取水口数量-->
    <select id="getSpecifiedSignalIntakesCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM pr_intake inta
                 INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                 INNER JOIN ba_block blo ON blo.id = inta.blockId
        <where>
            AND inta.deleted = 0
            <if test="signalIntensity != null and signalIntensity == 1">
                AND hou.signal_value &gt; 0
                AND hou.signal_value &lt;= #{weak}
            </if>
            <if test="signalIntensity != null and signalIntensity == 2">
                AND hou.signal_value &gt; #{weak}
                AND hou.signal_value &lt;= #{ordinary}
            </if>
            <if test="signalIntensity != null and signalIntensity == 3">
                AND hou.signal_value &gt; #{ordinary}
            </if>
        </where>
    </select>
    <!--获取指定信号强度的取水口-->
    <select id="getSpecifiedSignalIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoSignalIntensity">
        SELECT inta.id          AS intakeId,
               inta.name        AS intakeNum,
               blo.name         AS blockName,
               hou.signal_value AS signValue,
               hou.dt           AS getDate
        FROM pr_intake inta
                 INNER JOIN rm_on_hour_report_last hou ON hou.intake_id = inta.id
                 INNER JOIN ba_block blo ON blo.id = inta.blockId
        <where>
            AND inta.deleted = 0
            <if test="signalIntensity != null and signalIntensity == 1">
                AND hou.signal_value &gt; 0
                AND hou.signal_value &lt;= #{weak}
            </if>
            <if test="signalIntensity != null and signalIntensity == 2">
                AND hou.signal_value &gt; #{weak}
                AND hou.signal_value &lt;= #{ordinary}
            </if>
            <if test="signalIntensity != null and signalIntensity == 3">
                AND hou.signal_value &gt; #{ordinary}
            </if>
        </where>
        ORDER BY hou.dt
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
</mapper>
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/pom.xml
@@ -130,6 +130,12 @@
            <groupId>com.aliyun</groupId>
            <artifactId>alibaba-dingtalk-service-sdk</artifactId>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
@@ -137,6 +143,22 @@
            <version>1.15</version>
        </dependency>
        <!-- 获得系统信息 -->
        <dependency>
            <groupId>com.github.oshi</groupId>
            <artifactId>oshi-core</artifactId>
            <version>6.6.2</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>5.12.1</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
            <version>5.12.1</version>
        </dependency>
        <!-- 测试 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java
@@ -60,11 +60,11 @@
//        try {
//            URL url = Server.class.getResource("/config/this.licence");
//            if(!new Lnp(null).parese(url.getPath())){
//                System.out.println("zhzc licence error!") ;
//                System.out.println("licence error!") ;
//                return ;
//            }
//        } catch (Exception e) {
//            System.out.println("zhzc licence error!") ;
//            System.out.println("licence error!") ;
//            return ;
//        }
        //Server sv = new Server();
@@ -295,7 +295,8 @@
            
            /////////////////
            //RMI模块
            //RMI模块 暂时不应用
            /*
            RmiConfigVo rmiVo = new RmiConfigVo();
            rmiVo.enable = conf.getSetAttrBoolean(doc, "config.rmi", "enable", null, null) ;
            if(rmiVo.enable){
@@ -311,7 +312,7 @@
                RmiSvUrl = "[ip]:" + rmiVo.port + "/" + rmiVo.context ;
                units.add(rmiUnit) ;
            }
            */
            /////////////////
            //RTU上行数据处理模块
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoDeal.java
@@ -1,10 +1,13 @@
package com.dy.rtuMw.server.local.localProtocol;
import com.dy.common.threadPool.TreadPoolFactory;
import com.dy.common.util.*;
import com.dy.rtuMw.server.forTcp.TcpDownCommandCache;
import com.dy.rtuMw.server.forTcp.TcpSessionCache;
import com.dy.rtuMw.server.rtuData.RtuDataCache;
import com.dy.rtuMw.server.rtuData.TaskPool;
import oshi.SystemInfo;
import oshi.hardware.HardwareAbstractionLayer;
/**
 * @Author: liurunyu
@@ -13,7 +16,7 @@
 */
public class MwInfoDeal {
    public MwInfoVo deal(){
    public MwInfoVo deal() throws Exception{
        MwInfoVo vo = new MwInfoVo() ;
        Integer[] info = TcpSessionCache.info() ;
        vo.rtuTotalConnect = info[0] ;
@@ -39,6 +42,12 @@
        vo.taskTreePoolTotalInstance = TaskPool.totalTasks() ;
        SystemInfo si = new SystemInfo();
        HardwareAbstractionLayer hal = si.getHardware();
        vo.memInfoVo = SysMemoryUtil.info(hal.getMemory());
        vo.sysInfoVo = SysSysUtil.info();
        vo.jvmInfoVo = SysJvmUtil.info();
        return vo ;
    }
}
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoVo.java
@@ -1,6 +1,9 @@
package com.dy.rtuMw.server.local.localProtocol;
import com.dy.common.util.*;
import lombok.Data;
import java.util.LinkedList;
/**
 * @Author: liurunyu
@@ -28,6 +31,10 @@
    public Integer taskTreePoolTotalInstance = 0 ;//任务树池任务实例总数
    public SysJvmUtil.JvmInfoVo jvmInfoVo ;
    public SysMemoryUtil.MemInfoVo memInfoVo ;
    public SysSysUtil.SysInfoVo sysInfoVo ;
    public String toString(){
        StringBuilder sb = new StringBuilder() ;
        sb.append("通信中间件运行信息:\n");
@@ -45,6 +52,15 @@
        sb.append("      长线程池配置最大线程数:" + longMaxThread + "\n");
        sb.append("      长线程池配置最小线程数:" + longMinThread + "\n");
        sb.append("   任务树池任务实例总数:" + taskTreePoolTotalInstance + "\n");
        if(jvmInfoVo != null){
            sb.append(jvmInfoVo.toString()) ;
        }
       if(memInfoVo != null){
            sb.append(memInfoVo.toString()) ;
        }
       if(sysInfoVo != null){
            sb.append(sysInfoVo.toString()) ;
        }
        sb.append("\n");
        return sb.toString() ;
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealAlarmStatus.java
@@ -103,15 +103,19 @@
            sv.saveRmAlarmStateLast(po) ;
        }else{
            if(po.sendMsTime == null){
                po.sendMsTime = System.currentTimeMillis() ;
                this.sendMessage(controller, alarmVo);
            }else{
                Long now = System.currentTimeMillis() ;
                if(((now - po.sendMsTime) / (1000 * 60)) > ServerProperties.sendDingDingAlarmMsInterval){
                    //大于规定的间隔时间
                    po.sendMsTime = System.currentTimeMillis() ;
                if(alarmVo.hasAlarm()) {
                    po.sendMsTime = System.currentTimeMillis();
                    this.sendMessage(controller, alarmVo);
                }
            }else{
                if(alarmVo.hasAlarm()){
                    Long now = System.currentTimeMillis() ;
                    if(((now - po.sendMsTime) / (1000 * 60)) > ServerProperties.sendDingDingAlarmMsInterval){
                        //大于规定的间隔时间
                        po.sendMsTime = System.currentTimeMillis() ;
                        this.sendMessage(controller, alarmVo);
                    }
                }
            }
            po = this.update(controller, po, rtuDt, dV1_0_1, alarmVo, stateVo) ;
            sv.updateRmAlarmStateLast(po);
pipIrr-platform/pipIrr-mw/pom.xml
@@ -122,6 +122,22 @@
            <artifactId>jdom2</artifactId>
        </dependency>
        <!-- 获得系统信息 -->
        <dependency>
            <groupId>com.github.oshi</groupId>
            <artifactId>oshi-core</artifactId>
            <version>6.6.2</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>5.12.1</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
            <version>5.12.1</version>
        </dependency>
        <!-- 测试 -->
        <dependency>
pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrOperationApplication.java
File was renamed from pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrWebOperationApplication.java
@@ -19,10 +19,10 @@
        }
)
@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoOp"})
public class PipIrrWebOperationApplication {
public class PipIrrOperationApplication {
    public static void main(String[] args) {
        SpringApplication.run(PipIrrWebOperationApplication.class, args);
        SpringApplication.run(PipIrrOperationApplication.class, args);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java
@@ -19,6 +19,11 @@
public class QoCommand extends QueryConditionVo {
    /**
     * 取水口ID
     */
    private Long intakeId;
    /**
     * 命令名称
     */
    private String commandName;
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
@@ -3,15 +3,21 @@
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoRm.RmOnHourReportHistoryMapper;
import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper;
import com.dy.pipIrrGlobal.daoRm.RmOnHourReportLastMapper;
import com.dy.pipIrrGlobal.voSt.VoBatteryVolt;
import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow;
import com.dy.pipIrrGlobal.voSt.VoIntake;
import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount;
import com.dy.pipIrrGlobal.voSt.VoSignalIntensity;
import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO;
import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO;
import com.dy.pipIrrStatistics.intake.qo.IntakeQO;
import com.dy.pipIrrStatistics.intake.qo.IntakeValueQO;
import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
@@ -34,6 +40,17 @@
    private RmOnHourReportHistoryMapper rmOnHourReportHistoryMapper;
    @Autowired
    private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper;
    @Autowired
    private RmOnHourReportLastMapper rmOnHourReportLastMapper;
    @Value("${rtu.batteryVolt}")
    private Double batteryVolt;
    @Value("${rtu.signalIntensity.weak}")
    private Integer weak;
    @Value("${rtu.signalIntensity.ordinary}")
    private Integer ordinary;
    /**
     * 获取指定时间段内未上线的取水口
@@ -84,7 +101,7 @@
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
        // 获取符合条件的记录数
        Long itemTotal = Optional.ofNullable(rmOnHourReportHistoryMapper.getLargeFlowIntakesCount(params)).orElse(0L);
        Long itemTotal = Optional.ofNullable(rmOnHourReportLastMapper.getLargeFlowIntakesCount(params)).orElse(0L);
        QueryResultVo<List<VoCumulativeFlow>> rsVo = new QueryResultVo<>() ;
@@ -92,7 +109,7 @@
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = rmOnHourReportHistoryMapper.getLargeFlowIntakes(params);
        rsVo.obj = rmOnHourReportLastMapper.getLargeFlowIntakes(params);
        return rsVo ;
    }
@@ -106,7 +123,7 @@
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
        // 获取符合条件的记录数
        Long itemTotal = Optional.ofNullable(rmOnHourReportHistoryMapper.getSmallFlowIntakesCount(params)).orElse(0L);
        Long itemTotal = Optional.ofNullable(rmOnHourReportLastMapper.getSmallFlowIntakesCount(params)).orElse(0L);
        QueryResultVo<List<VoCumulativeFlow>> rsVo = new QueryResultVo<>() ;
@@ -114,7 +131,55 @@
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = rmOnHourReportHistoryMapper.getSmallFlowIntakes(params);
        rsVo.obj = rmOnHourReportLastMapper.getSmallFlowIntakes(params);
        return rsVo ;
    }
    /**
     * 获取欠压取水口
     * @param qo
     * @return
     */
    public QueryResultVo<List<VoBatteryVolt>> getUnderVoltIntakes(BatteryVoltQO qo) {
        qo.setBatteryVolt(batteryVolt);
        // 生成查询参数
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
        // 获取符合条件的记录数
        Long itemTotal = Optional.ofNullable(rmOnHourReportLastMapper.getUnderVoltIntakesCount(params)).orElse(0L);
        QueryResultVo<List<VoBatteryVolt>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = qo.pageSize ;
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = rmOnHourReportLastMapper.getUnderVoltIntakes(params);
        return rsVo ;
    }
    /**
     * 获取指定信号强度的取水口
     * @param qo
     * @return
     */
    public QueryResultVo<List<VoSignalIntensity>> getSpecifiedSignalIntakes(SignalIntensityQO qo) {
        qo.setWeak(weak);
        qo.setOrdinary(ordinary);
        // 生成查询参数
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
        // 获取符合条件的记录数
        Long itemTotal = Optional.ofNullable(rmOnHourReportLastMapper.getSpecifiedSignalIntakesCount(params)).orElse(0L);
        QueryResultVo<List<VoSignalIntensity>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = qo.pageSize ;
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = rmOnHourReportLastMapper.getSpecifiedSignalIntakes(params);
        return rsVo ;
    }
@@ -230,4 +295,5 @@
        rsVo.obj = rmOpenCloseValveHistoryMapper.getOpenValveLtIntakes(params);
        return rsVo ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java
@@ -4,11 +4,15 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.voSt.VoBatteryVolt;
import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow;
import com.dy.pipIrrGlobal.voSt.VoIntake;
import com.dy.pipIrrGlobal.voSt.VoSignalIntensity;
import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO;
import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount;
import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO;
import com.dy.pipIrrStatistics.intake.qo.IntakeQO;
import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO;
import com.dy.pipIrrStatistics.intake.qo.IntakeValueQO;
import com.dy.pipIrrStatistics.result.StatisticlResultCode;
import lombok.RequiredArgsConstructor;
@@ -42,11 +46,7 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoIntake>>> getNotOnlineIntakes(IntakeQO qo) {
        try {
            QueryResultVo<List<VoIntake>> res = intakeSv.getNotOnlineIntakes(qo);
            if(res.itemTotal == 0) {
                return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage());
            }
            return BaseResponseUtils.buildSuccess(res);
            return BaseResponseUtils.buildSuccess(intakeSv.getNotOnlineIntakes(qo));
        } catch (Exception e) {
            log.error("获取开卡记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
@@ -62,11 +62,7 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getLargeFlowIntakes(CumulativeFlowQO qo) {
        try {
            QueryResultVo<List<VoCumulativeFlow>> res = intakeSv.getLargeFlowIntakes(qo);
            if(res.itemTotal == 0) {
                return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage());
            }
            return BaseResponseUtils.buildSuccess(res);
            return BaseResponseUtils.buildSuccess(intakeSv.getLargeFlowIntakes(qo));
        } catch (Exception e) {
            log.error("获取开卡记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
@@ -82,11 +78,39 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getSmallFlowIntakes(CumulativeFlowQO qo) {
        try {
            QueryResultVo<List<VoCumulativeFlow>> res = intakeSv.getSmallFlowIntakes(qo);
            if(res.itemTotal == 0) {
                return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.NO_RECORDS.getMessage());
            }
            return BaseResponseUtils.buildSuccess(res);
            return BaseResponseUtils.buildSuccess(intakeSv.getSmallFlowIntakes(qo));
        } catch (Exception e) {
            log.error("获取开卡记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 获取欠压取水口
     * @param qo
     * @return
     */
    @GetMapping(path = "/getUnderVoltIntakes")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoBatteryVolt>>> getUnderVoltIntakes(BatteryVoltQO qo) {
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.getUnderVoltIntakes(qo));
        } catch (Exception e) {
            log.error("获取开卡记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 获取指定信号强度的取水口
     * @param qo
     * @return
     */
    @GetMapping(path = "/getSpecifiedSignalIntakes")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoSignalIntensity>>> getSpecifiedSignalIntakes(SignalIntensityQO qo) {
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.getSpecifiedSignalIntakes(qo));
        } catch (Exception e) {
            log.error("获取开卡记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/BatteryVoltQO.java
New file
@@ -0,0 +1,20 @@
package com.dy.pipIrrStatistics.intake.qo;
import com.dy.common.webUtil.QueryConditionVo;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-08-03 10:47
 * @LastEditTime 2024-08-03 10:47
 * @Description
 */
@Data
public class BatteryVoltQO extends QueryConditionVo {
    /**
     * 电池电压
     */
    private Double batteryVolt;
}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/SignalIntensityQO.java
New file
@@ -0,0 +1,30 @@
package com.dy.pipIrrStatistics.intake.qo;
import com.dy.common.webUtil.QueryConditionVo;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-08-05 8:42
 * @LastEditTime 2024-08-05 8:42
 * @Description 信号强度查询对象
 */
@Data
public class SignalIntensityQO extends QueryConditionVo {
    /**
     * 信号强度:1-弱,2-一般,3-强
     */
    private Integer signalIntensity;
    /**
     * 弱信号最大值
     */
    private Integer weak;
    /**
     * 一般信号最大值
     */
    private Integer ordinary;
}