From 1e83714d06985bdfa8c5faa70a72b16be45de300 Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期一, 05 八月 2024 15:35:12 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoVo.java | 16 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysSysUtil.java | 68 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportHistoryMapper.java | 28 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java | 5 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoOnLineIntake.java | 22 pipIrr-platform/pipIrr-mw/pom.xml | 16 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataAlarmVo.java | 13 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java | 9 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/SignalIntensityQO.java | 30 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysJvmUtil.java | 78 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java | 54 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java | 74 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/BatteryVoltQO.java | 20 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysFileSysUtil.java | 113 ++ pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java | 341 ++++++ pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DoubleUtil.java | 103 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml | 635 +++++++---- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA0Vo.java | 4 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA1Vo.java | 4 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA2Vo.java | 4 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoDeal.java | 11 pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrOperationApplication.java | 4 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoCumulativeFlow.java | 2 pipIrr-platform/pipIrr-global/pom.xml | 6 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCd99Vo.java | 4 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoBatteryVolt.java | 28 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml | 6 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysUtil.java | 64 + pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java | 16 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealAlarmStatus.java | 18 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysMemoryUtil.java | 58 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoSignalIntensity.java | 27 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml | 963 +++++++++-------- pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml | 58 - pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/pom.xml | 22 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportLastMapper.java | 59 + pipIrr-platform/pipIrr-common/pom.xml | 17 pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 12 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysCpuUtil.java | 110 ++ 39 files changed, 2,282 insertions(+), 840 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/pom.xml b/pipIrr-platform/pipIrr-common/pom.xml index cbb2762..6ec010b 100644 --- a/pipIrr-platform/pipIrr-common/pom.xml +++ b/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鏄竴涓皬鑰屽叏鐨凧ava宸ュ叿绫诲簱(https://github.com/dromara/hutool) --> <dependency> <groupId>cn.hutool</groupId> diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java index 9f3b91f..963b2f0 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java +++ b/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) ? "鑷姤(鏁寸偣)瀹炴椂鏁版嵁" : ""))))))))))))))))))))))))))))))))))))))))))) ; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataAlarmVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataAlarmVo.java index 575caae..9dbf290 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataAlarmVo.java +++ b/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 ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCd99Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCd99Vo.java index 1360407..34a546c 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCd99Vo.java +++ b/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"); diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA0Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA0Vo.java index cca055f..519fe64 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA0Vo.java +++ b/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"); diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA1Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA1Vo.java index 9e682e0..0d7f5e8 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA1Vo.java +++ b/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"); diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA2Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA2Vo.java index 8499e77..2134a16 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/upVos/DataCdA2Vo.java +++ b/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"); diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DoubleUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DoubleUtil.java new file mode 100644 index 0000000..b40e2dd --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DoubleUtil.java @@ -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 绮惧噯鐨刣ouble璁$畻 + */ +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); + } + + /** + * 鎻愪緵锛堢浉瀵癸級绮剧‘鐨勯櫎娉曡繍绠椼�傚綋鍙戠敓闄や笉灏界殑鎯呭喌鏃讹紝鐢眘cale鍙傛暟鎸� + * 瀹氱簿搴︼紝浠ュ悗鐨勬暟瀛楀洓鑸嶄簲鍏ャ�� + * @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(); + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java new file mode 100644 index 0000000..c9fdac3 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IPUtils.java @@ -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 { + + /** + * 妫�鏌P鏄惁鍚堟硶 + * + * @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涓巐inux + * + * @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; + } + /** + * 鑾峰彇瀹㈡埛绔疘P + * + * @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; + } + } + /** + * 鎶奿p杞寲涓烘暣鏁� + * + * @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]; + } + /** + * 灏咺Pv4鍦板潃杞崲鎴愬瓧鑺� + * + * @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 鑾峰緱鐨処P鍦板潃 + * @return 绗竴涓潪unknown IP鍦板潃 + */ + public static String getMultistageReverseProxyIp(String ip) + { + // 澶氱骇鍙嶅悜浠g悊妫�娴� + 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; + } + + /** + * 妫�娴嬬粰瀹氬瓧绗︿覆鏄惁涓烘湭鐭ワ紝澶氱敤浜庢娴婬TTP璇锋眰鐩稿叧 + * + * @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(); + } +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysCpuUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysCpuUtil.java new file mode 100644 index 0000000..5675ae6 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysCpuUtil.java @@ -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锛圫oftIRQ锛夛級锛�6锛夋垨绐冨彇锛�7锛夌姸鎬佷笅鑺辫垂鐨勬绉掓暟銆備娇鐢� + * {@link-shi.hardware.TickType#getIndex锛堬級}妫�绱㈢浉搴旂殑绱㈠紩銆傞�氳繃娴嬮噺涓�涓椂闂撮棿 + * 闅斿唴婊寸瓟澹颁箣闂寸殑宸紓锛屽彲浠ヨ绠楀嚭璇ユ椂闂撮棿闅斿唴鐨凜PU璐熻浇銆� + * 鍦ㄦ煇浜涢�昏緫澶勭悊鍣ㄦ暟閲忓彲鍙樼殑鎿嶄綔绯荤粺涓婏紝姝ら樀鍒楃殑澶у皬鍙兘浼氬彂鐢熷彉鍖栵紝骞朵笖鍙兘涓庡叾浠栨瘡澶勭悊鍣ㄦ柟娉曚笉涓�鑷淬�� + * 璇锋敞鎰忥紝铏界劧婊寸瓟璁℃暟鍣ㄤ互姣涓哄崟浣嶏紝浣嗗畠浠彲鑳戒細闅忕潃锛堜緷璧栦簬骞冲彴鐨勶級鏃堕挓婊寸瓟澹颁互鏇村ぇ鐨勫閲忓墠杩涖�備緥濡傦紝榛樿 + * 鎯呭喌涓嬶紝Windows鏃堕挓鑺傛媿涓�1/64绉掞紙绾�15鎴�16姣锛夛紝Linux鏃堕挓鑺傛媿鍙栧喅浜庡垎甯冨拰閰嶇疆锛屼絾閫氬父涓�1/100绉掞紙10 + * 姣锛夈�� + * Windows涓婃病鏈塏ice鍜孖OWait淇℃伅锛宮acOS涓婃病鏈塈OWait鍜孖RQ淇℃伅锛屽洜姝よ繖浜涙爣璁板皢濮嬬粓涓洪浂銆� + * 瑕佷娇鐢ㄦ鏂规硶璁$畻鎬荤┖闂叉椂闂达紝璇峰悓鏃跺寘鎷琁dle鍜孖OWait鏍囪銆傚悓鏍凤紝搴斿皢IRQ銆丼oftIRQ鍜孲teal鏍囪娣诲姞鍒扮郴缁熷�� + * 涓互鑾峰緱鎬诲拰銆傜郴缁熻鏃惰繕鍖呮嫭鎵ц鍏朵粬铏氭嫙涓绘満锛堢獌鍙栵級鐨勬椂闂淬�� + * * + * @return涓�涓敱8涓暱鍊肩粍鎴愮殑鏁扮粍锛岃〃绀哄湪User銆丯ice銆丼ystem銆両dle銆両Owait銆両RQ銆丼oftIRQ鍜孲teal鐘舵�佷笅鑺辫垂鐨勬椂闂淬�� + */ + 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() ; + } + + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysFileSysUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysFileSysUtil.java new file mode 100644 index 0000000..fc1976a --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysFileSysUtil.java @@ -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() ; + } + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysJvmUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysJvmUtil.java new file mode 100644 index 0000000..fa0e1e0 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysJvmUtil.java @@ -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() ; + } + } + + + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysMemoryUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysMemoryUtil.java new file mode 100644 index 0000000..62955bd --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysMemoryUtil.java @@ -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() ; + } + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysSysUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysSysUtil.java new file mode 100644 index 0000000..bbaee01 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysSysUtil.java @@ -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; + + /** + * 鏈嶅姟鍣↖p + */ + 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() ; + } + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysUtil.java new file mode 100644 index 0000000..40895ea --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/SysUtil.java @@ -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()); + } +} diff --git a/pipIrr-platform/pipIrr-global/pom.xml b/pipIrr-platform/pipIrr-global/pom.xml index f780609..a494f6e 100644 --- a/pipIrr-platform/pipIrr-global/pom.xml +++ b/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> diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportHistoryMapper.java index 88ac1f1..ac3353d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportHistoryMapper.java +++ b/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); - /** - * 鑾峰彇绱娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲� - * @param params - * @return - */ - Long getLargeFlowIntakesCount(Map<?, ?> params); - - /** - * 鑾峰彇绱娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙� - * @param params - * @return - */ - List<VoCumulativeFlow> getLargeFlowIntakes(Map<?, ?> params); - - /** - * 鑾峰彇绱娴侀噺浣庝簬鎸囧畾鍊肩殑鍙栨按鍙f暟閲� - * @param params - * @return - */ - Long getSmallFlowIntakesCount(Map<?, ?> params); - - /** - * 鑾峰彇绱娴侀噺浣庝簬鎸囧畾鍊肩殑鍙栨按鍙� - * @param params - * @return - */ - List<VoCumulativeFlow> getSmallFlowIntakes(Map<?, ?> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportLastMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportLastMapper.java index 63ccf0a..d4604e2 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOnHourReportLastMapper.java +++ b/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); + + /** + * 鑾峰彇绱娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲� + * @param params + * @return + */ + Long getLargeFlowIntakesCount(Map<?, ?> params); + + /** + * 鑾峰彇绱娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙� + * @param params + * @return + */ + List<VoCumulativeFlow> getLargeFlowIntakes(Map<?, ?> params); + + /** + * 鑾峰彇绱娴侀噺浣庝簬鎸囧畾鍊肩殑鍙栨按鍙f暟閲� + * @param params + * @return + */ + Long getSmallFlowIntakesCount(Map<?, ?> params); + + /** + * 鑾峰彇绱娴侀噺浣庝簬鎸囧畾鍊肩殑鍙栨按鍙� + * @param params + * @return + */ + List<VoCumulativeFlow> getSmallFlowIntakes(Map<?, ?> params); + + /** + * 鑾峰彇娆犲帇鍙栨按鍙f暟閲� + * @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); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoOnLineIntake.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoOnLineIntake.java index c0c3512..015acd2 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoOnLineIntake.java +++ b/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; /** + * 鍙栨按鍙g粡搴� + */ + private Double lng; + + /** + * 鍙栨按鍙g含搴� + */ + private Double lat; + + /** + * 绱娴侀噺 + */ + private Double totalAmount; + + /** * 鏄惁鍦ㄧ嚎 */ private Boolean isOnLine; @@ -39,4 +53,10 @@ * 鏄惁缁戝畾 */ private Boolean isBinded; + + + /** + * 鎶ヨ淇℃伅Json鏁扮粍 + */ + private String alarm; } diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoBatteryVolt.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoBatteryVolt.java new file mode 100644 index 0000000..f5c7b81 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoBatteryVolt.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoCumulativeFlow.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoCumulativeFlow.java index d4c362f..74cfe54 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoCumulativeFlow.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoCumulativeFlow.java @@ -18,7 +18,7 @@ /** * 绱娴侀噺 */ - private Float cumulativeFlow; + private Double cumulativeFlow; /** * 鏁版嵁鑾峰彇鏃ユ湡 diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoSignalIntensity.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoSignalIntensity.java new file mode 100644 index 0000000..323a49f --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoSignalIntensity.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml index 3fd34ef..1c09121 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -72,7 +72,7 @@ pipIrr: global: - dev: true #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse + dev: flase #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse dsName: ym #寮�鍙戦樁娈碉紝璁剧疆涓存椂鐨勬暟鎹簱鍚嶇О mw: webPort: 8070 @@ -175,4 +175,12 @@ access-token: fecef8e7725998f8912af05419580861aafc73413c4920036c07c050fa33055f secret: SEC6042bc964d08899a5853eb321eb5a4d842a395982777f815bd07451c879228b7 at-all: true - mobile: 18602657034 \ No newline at end of file + mobile: 18602657034 + +#闃�鎺у櫒鍙傛暟 +rtu: + batteryVolt: 17 + signalIntensity: + weak: 10 + ordinary: 20 +# strong: 20 \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml index afcd2da..60412c5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml +++ b/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> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰曟暟--> - <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> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰曟暟--> + <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> - <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰�--> - <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> + <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍙栨按鍙h褰�--> + <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> - <!--鏍规嵁鍙栨按鍙g紪鍙疯幏鍙栨湭鍒犻櫎鐨勫彇姘村彛鏁伴噺--> - <select id="getRecordCountOfIntake" resultType="java.lang.Integer"> - SELECT COUNT(*) AS recordCount FROM pr_intake WHERE deleted = 0 AND id = ${intakeId} - </select> + <!--鏍规嵁鍙栨按鍙g紪鍙疯幏鍙栨湭鍒犻櫎鐨勫彇姘村彛鏁伴噺--> + <select id="getRecordCountOfIntake" resultType="java.lang.Integer"> + SELECT COUNT(*) AS recordCount + FROM pr_intake + WHERE deleted = 0 + AND id = #{intakeId} + </select> - <!--鏍规嵁鏉慖D鑾峰彇鍏ㄩ儴鍦板潃--> - <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> + <!--鏍规嵁鏉慖D鑾峰彇鍏ㄩ儴鍦板潃--> + <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> - <!--鑾峰彇鏈粦鎺у埗鍣ㄧ殑鍙栨按鍙e垪琛�--> - <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> + <!--鑾峰彇鏈粦鎺у埗鍣ㄧ殑鍙栨按鍙e垪琛�--> + <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> - <!--鑾峰彇鍙栨按鍙f暟閲忥紙鍦ㄧ嚎鍜屼笉鍦ㄥ厛锛�--> - <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> - - <!--鑾峰彇鍙栨按鍙e垪琛紙鍦ㄧ嚎鍜屼笉鍦ㄥ厛锛�--> - <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> - - <!--鏍规嵁鍙栨按鍙g紪鍙疯幏鍙栧彇姘村彛瀵硅薄--> - <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( + <!--鑾峰彇鍙栨按鍙f暟閲忥紙鍦ㄧ嚎鍜屼笉鍦ㄥ厛锛�--> + <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> + <!--鑾峰彇鍙栨按鍙e垪琛紙鍦ㄧ嚎鍜屼笉鍦ㄥ厛锛�--> + <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, + <!--鏍规嵁鍙栨按鍙g紪鍙疯幏鍙栧彇姘村彛瀵硅薄--> + <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> - <!--鍙栨按鍙e悕绉版崲鍙栨按鍙D锛屾壂鐮佸紑闃�浣跨敤--> - <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> - <!--鍙栨按鍙e悕绉版崲鍙栨按鍙D锛岄獙璇佹槸鍚﹂噸澶嶅悕绉颁娇鐢�--> - <select id="getIntakeIdsByName" resultType="java.lang.Long"> - SELECT id AS intakeId FROM pr_intake WHERE `name` = #{intakeName} - </select> + <!--鍙栨按鍙e悕绉版崲鍙栨按鍙D锛屾壂鐮佸紑闃�浣跨敤--> + <select id="getIntakeIdByName" resultType="java.lang.Long"> + SELECT id AS intakeId + FROM pr_intake + WHERE `name` = #{intakeName} + </select> - <!--鍙栨按鍙e悕绉版崲鍙栨按鍙D锛岄獙璇佹槸鍚﹂噸澶嶅悕绉颁娇鐢�--> - <select id="getIntakeIdByNameExcludeId" resultType="java.lang.Long"> - SELECT id AS intakeId FROM pr_intake WHERE id != #{id} and `name` = #{intakeName} - </select> + <!--鍙栨按鍙e悕绉版崲鍙栨按鍙D锛岄獙璇佹槸鍚﹂噸澶嶅悕绉颁娇鐢�--> + <select id="getIntakeIdsByName" resultType="java.lang.Long"> + SELECT id AS intakeId + FROM pr_intake + WHERE `name` = #{intakeName} + </select> - - + <!--鍙栨按鍙e悕绉版崲鍙栨按鍙D锛岄獙璇佹槸鍚﹂噸澶嶅悕绉颁娇鐢�--> + <select id="getIntakeIdByNameExcludeId" resultType="java.lang.Long"> + SELECT id AS intakeId + FROM pr_intake + WHERE id != #{id} + and `name` = #{intakeName} + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml index be493a4..0f4282c 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml +++ b/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> diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml index edfd7d1..461c263 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportHistoryMapper.xml @@ -284,64 +284,6 @@ </trim> </select> - <!--鑾峰彇绱娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲�--> - <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> - <!--鑾峰彇绱娴侀噺浣庝簬鎸囧畾鍊肩殑鍙栨按鍙f暟閲�--> - <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 < #{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 < #{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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml index 2d91d54..29f966b 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml +++ b/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> + + <!--鑾峰彇绱娴侀噺瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙f暟閲�--> + <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> + + <!--鑾峰彇绱娴侀噺浣庝簬鎸囧畾鍊肩殑鍙栨按鍙f暟閲�--> + <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 < #{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 < #{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> + + <!--鑾峰彇娆犲帇鍙栨按鍙f暟閲�--> + <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 < #{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 < #{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 > 0 + AND hou.signal_value <= #{weak} + </if> + <if test="signalIntensity != null and signalIntensity == 2"> + AND hou.signal_value > #{weak} + AND hou.signal_value <= #{ordinary} + </if> + <if test="signalIntensity != null and signalIntensity == 3"> + AND hou.signal_value > #{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 > 0 + AND hou.signal_value <= #{weak} + </if> + <if test="signalIntensity != null and signalIntensity == 2"> + AND hou.signal_value > #{weak} + AND hou.signal_value <= #{ordinary} + </if> + <if test="signalIntensity != null and signalIntensity == 3"> + AND hou.signal_value > #{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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/pom.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/pom.xml index 29cb1cb..1597595 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/pom.xml +++ b/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> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java index 3d71ead..777c277 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java +++ b/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涓婅鏁版嵁澶勭悊妯″潡 diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoDeal.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoDeal.java index 43658e2..b979ff1 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoDeal.java +++ b/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 ; } } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoVo.java index 9a9f330..44a85ec 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/localProtocol/MwInfoVo.java +++ b/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() ; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealAlarmStatus.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealAlarmStatus.java index 03f1eeb..ccb127c 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/p206V1_0_0/TkDealAlarmStatus.java +++ b/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); diff --git a/pipIrr-platform/pipIrr-mw/pom.xml b/pipIrr-platform/pipIrr-mw/pom.xml index 2d08fea..95e7429 100644 --- a/pipIrr-platform/pipIrr-mw/pom.xml +++ b/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> diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrWebOperationApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrOperationApplication.java similarity index 90% rename from pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrWebOperationApplication.java rename to pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrOperationApplication.java index afaf09e..276dfb9 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrWebOperationApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/PipIrrOperationApplication.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); } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java index 8491229..b75755f 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/qo/QoCommand.java +++ b/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 { /** + * 鍙栨按鍙D + */ + private Long intakeId; + + /** * 鍛戒护鍚嶇О */ private String commandName; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java index 5133da8..caa045a 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java +++ b/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 ; } + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java index 01bd5ae..e212e51 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java +++ b/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()) ; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/BatteryVoltQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/BatteryVoltQO.java new file mode 100644 index 0000000..a5be4ac --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/BatteryVoltQO.java @@ -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; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/SignalIntensityQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/SignalIntensityQO.java new file mode 100644 index 0000000..69a66a0 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/SignalIntensityQO.java @@ -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; +} -- Gitblit v1.8.0