From e3a585f2e592a96d2f5251db43af55abe6699970 Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期二, 15 十月 2024 17:58:29 +0800 Subject: [PATCH] 优化代码 控制器查询 最近未报数的取水口分页优化 取水口管理与测控一体阀合并 --- pipIrr-platform/pipIrr-global/src/main/resources/application-database(开发测试---单数据库).yml | 8 + pipIrr-platform/pipIrr-global/src/main/resources/application-global(开发测试---166PC机).yml | 217 +++++++++++++++++++++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java | 72 ++++++-- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java | 29 +++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml | 5 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/QueryVo.java | 23 ++ pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 2 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml | 2 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml | 78 +++++++-- 9 files changed, 392 insertions(+), 44 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java index 530f5ad..6b902c9 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoIntake.java @@ -22,7 +22,7 @@ */ @Data -@JsonPropertyOrder({ "intakeId", "intakeName", "divideId", "divideName", "blockId", "blockName", "isBind", "address", "lng", "lat", "operator", "operateDt", "remarks", "controllerId", "rtuAddr"}) +@JsonPropertyOrder({ "intakeId", "intakeName", "divideId", "divideName", "blockId", "blockName", "isBind", "address", "lng", "lat", "operator", "operateDt", "remarks", "controllerId", "rtuAddr", "protocol", "findDt", "isOnLine", "bindNumber"}) @HeadRowHeight(30) @ContentRowHeight(20) public class VoIntake implements BaseEntity { @@ -55,8 +55,8 @@ @ColumnWidth(15) private String blockName; - @Schema(title = "缁戝畾璁惧") - @ExcelProperty(value = {"${title}", "缁戝畾璁惧"}) + @Schema(title = "鏄惁缁戝畾璁惧") + @ExcelProperty(value = {"${title}", "鏄惁缁戝畾璁惧"}) @ColumnWidth(10) private String isBind; @@ -98,4 +98,27 @@ @ExcelProperty(value = {"${title}", "鎺у埗鍣ㄥ湴鍧�"}) @ColumnWidth(15) private String rtuAddr; + + @Schema(title = "閫氳鍗忚") + @ExcelIgnore + private String protocol; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(title = "鍙戠幇鏃ユ湡鏃堕棿") + @ExcelProperty(value = {"${title}", "鍙戠幇鏃堕棿"}) + @ColumnWidth(20) + private Date findDt; + + /** + * 鏄惁鍦ㄧ嚎 + */ + @ExcelIgnore + private Boolean isOnLine; + + @Schema(title = "缁戝畾娆℃暟") + @ExcelProperty(value = {"${title}", "缁戝畾娆℃暟"}) + @ColumnWidth(10) + private Integer bindNumber; + } diff --git "a/pipIrr-platform/pipIrr-global/src/main/resources/application-database\050\345\274\200\345\217\221\346\265\213\350\257\225---\345\215\225\346\225\260\346\215\256\345\272\223\051.yml" "b/pipIrr-platform/pipIrr-global/src/main/resources/application-database\050\345\274\200\345\217\221\346\265\213\350\257\225---\345\215\225\346\225\260\346\215\256\345\272\223\051.yml" new file mode 100644 index 0000000..a291bd2 --- /dev/null +++ "b/pipIrr-platform/pipIrr-global/src/main/resources/application-database\050\345\274\200\345\217\221\346\265\213\350\257\225---\345\215\225\346\225\260\346\215\256\345\272\223\051.yml" @@ -0,0 +1,8 @@ +# 鏁版嵁婧愰厤缃� +spring: + #澶氭暟鎹簮闇�瑕侀厤缃� + main: + allow-bean-definition-overriding: true #璁剧疆涓簍rue鏃讹紝鍚庡畾涔夌殑bean浼氳鐩栦箣鍓嶅畾涔夌殑鐩稿悓鍚嶇О鐨刡ean + datasource: #閰嶇疆鏁版嵁婧� + #澶氫釜鏁版嵁婧愬悕绉板湪姝ら厤缃紝瑕佹眰涓巗pring銆俤atasource銆俒ym][pj]涓殑涓�鑷� + names: ym \ No newline at end of file diff --git "a/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050\345\274\200\345\217\221\346\265\213\350\257\225---166PC\346\234\272\051.yml" "b/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050\345\274\200\345\217\221\346\265\213\350\257\225---166PC\346\234\272\051.yml" new file mode 100644 index 0000000..7c8cdc5 --- /dev/null +++ "b/pipIrr-platform/pipIrr-global/src/main/resources/application-global\050\345\274\200\345\217\221\346\265\213\350\257\225---166PC\346\234\272\051.yml" @@ -0,0 +1,217 @@ +logging: + charset: + console: UTF-8 + config: + classpath: log4j2.yml +#绂佺敤鐧芥爣閿欒椤甸潰 +server: + error: + whitelabel: + enabled: false + #servlet閰嶇疆 + servlet: + encoding: + #鍙栨秷榛樿鐨勫瓧绗﹂泦缂栫爜 + enabled: true + #璁剧疆寮哄埗浣跨敤鎸囧畾瀛楃缂栫爜闆� + force: true + #浣跨敤鐨勫瓧绗︾紪鐮� + charset: utf-8 +# actuator閰嶇疆锛屽厛include浜嗗叏閮紝鐒跺悗鍐峞xclude鎸囧畾鐨別ndpoint +management: + endpoints: + web: + exposure: + include: '*' + #exclude: beans + .shutdown: + enabled: true #鏄惁寮�鍚�/actuator/shutdown + +# SpringDoc-OpenApi 閰嶇疆 +springdoc: + swagger-ui: + #搴旂敤actuator鏃讹紝璁块棶: http://[IP]:[port]/actuator/swagger-ui/index.html 渚嬪http://127.0.0.1:9080/actuator/swagger-ui/index.html + #鏈敤actuator鏃讹紝璁块棶: http://[IP]:[port]/[context]/swagger-ui/index.html 渚嬪http://127.0.0.1:8080/[瀛愮郴缁熶笂涓嬫枃锛坆ase锛塢/swagger-ui/index.html + path: /swagger-ui + operationsSorter: method # HTTP 鏂规硶鎺掑簭 + tagsSorter: alpha # API 鎺掑簭 + api-docs: + path: /v3/apiDocs + groups: + enabled: true + show-actuator: true #鍦╝ctuator閰嶇疆鐨勭鍙e強涓婁笅鏂囦腑璁块棶 SpringDoc-OpenApi + use-management-port: true #搴旂敤actuator閰嶇疆鐨勭鍙o紝浣嗕笂闈㈢殑swagger-ui:path鍙細閲囩敤榛樿鍊約wagger-ui + packages-to-scan: com.dy + #paths-to-match: /sys/**, /demo/**, /** + paths-to-match: /** + web: + title: 澶х鑺傛按绠$亴鐩戞帶绯荤粺API + description: 澶х鑺傛按绠$亴鐩戞帶绯荤粺鏈嶅姟绔� Restfull API + version: v1.0.0 + license-name: 澶х鑺傛按鐮旂┒闄� + +#MybatisPlus 閰嶇疆鏃ュ織鏄剧ず鎵цSQL +mybatis-plus: + #鍖归厤sql璇彞鐨勬槧灏勬枃浠剁殑浣嶇疆锛宑lasspath浠h〃鍦╮esources涓� + mapper-locations: classpath:mapper/*.xml + #浠ヤ笅涓や釜閰嶇疆鍙互鐪佺暐锛屽湪mapper鏄犲皠鏂囦欢涓厤缃�淍Mapper鈥濅篃鏄彲浠ョ殑銆� + #浣跨敤type-aliases-package涓寚瀹歟ntity鎵弿鍖呰矾寰勶紝璁﹎ybatis鑷姩鎵弿鑷畾涔夌殑entity + #type-aliases-package: com.dy.pipIrrGlobal.daoBa + configuration: + #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #鏃惰�岃緭鍑烘棩蹇楋紝鏃惰�屼笉杈撳嚭鏃ュ織 + log-impl: org.apache.ibatis.logging.log4j2.Log4j2Impl + #寮�鍚┘宄皍Name鑷姩鏄犲皠鍒皍_name + #2023-10-24缁忓疄楠岋紝涓嬮潰閰嶇疆true鎴杅alse锛岄兘鑳戒粠u_name鏄犲皠鍒皍Name + #map-underscore-to-camel-case: true + lazyLoadingEnabled: true # 寮�鍚欢鏃跺姞杞藉紑鍏� + aggressiveLazyLoading: false # 灏嗙Н鏋佸姞杞芥敼涓烘秷鏋佸姞杞斤紙鍗虫寜闇�鍔犺浇锛夛紝榛樿鍊兼槸false + lazy-load-trigger-methods: "" # 闃绘尅涓嶇浉骞茬殑鎿嶄綔瑙﹀彂锛屽疄鐜版噿鍔犺浇 + cache-enabled: true #鎵撳紑鍏ㄥ眬缂撳瓨寮�鍏筹紙浜岀骇鐜锛夛紝榛樿鍊兼槸true + default-enum-type-handler: com.dy.common.mybatis.envm.EnumCodeTypeHandler + +pipIrr: + global: + dev: true #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse + dsName: ym #寮�鍙戦樁娈碉紝璁剧疆涓存椂鐨勬暟鎹簱鍚嶇О + mw: + webPort: 8070 + actutorPort: 9070 + idSuffix: 0 + sso: + cacheMaximumSize: 10000 #鐧诲綍鐢ㄦ埛缂撳瓨鍙紦瀛樼敤鎴风殑鏈�澶у�� + cacheDuration: 720 #缂撳瓨鐧诲綍鐢ㄦ埛鍙戝憜鏈�澶ф椂闀匡紙鍒嗛挓锛� + checkUrl: http://127.0.0.1:8079/sso/sso/ssoCheck + webPort: 8079 + actutorPort: 9079 + idSuffix: 1 + base: + webPort: 8080 + actutorPort: 9080 + idSuffix: 2 + remote: + webPort: 8081 + actutorPort: 9081 + idSuffix: 3 + statistics: + webPort: 8082 + actutorPort: 9082 + idSuffix: 4 + gis: + webPort: 8083 + actutorPort: 9083 + idSuffix: 5 + demo: + webPort: 8000 + actutorPort: 9000 + idSuffix: 99 + sell: + webPort: 8084 + actutorPort: 9084 + idSuffix: 6 + project: + webPort: 8085 + actutorPort: 9085 + idSuffix: 7 + irrigate: + webPort: 8086 + actutorPort: 9086 + idSuffix: 8 + wechat: + webPort: 8087 + actutorPort: 9087 + idSuffix: 9 + app: + webPort: 8088 + actutorPort: 9088 + idSuffix: 10 + operation: + webPort: 8089 + actutorPort: 9089 + idSuffix: 11 +#椤圭洰缂栧彿 +#projectCode: +# ym: 100 +# pj: 101 + +#椤圭洰閰嶇疆 +project: + #椤圭洰缂栫爜 + projectNo: 10 + #鎺у埗鍣ㄧ被鍨� + controllerType: 57 + #榛樿琛屾斂鍖哄垝缂栫爜锛堝ぉ娲�-澶╂触甯�-姝︽竻鍖�-浜花宸ヤ笟鍥�-澶х鑺傛按锛� + divisionCode: 120114403100 + + +#閫氳涓棿浠剁浉鍏抽厤缃� +#protocol: DYJS_2023,DYJS_2024 +mw: + #鍛戒护鍙戦�佸湴鍧�(涓紑鏄満鏋則ag锛屽叾涔熸槸鏁版嵁婧愬悗缂�鍚嶇О) + ym: + comSendUrl: "http://192.168.40.166:8070/rtuMw/com/send" + rtuLogFileUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogFile" + rtuLogTextUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogText" + pj: + comSendUrl: "http://127.0.0.1:8071/rtuMw/com/send" + rtuLogFileUrl: "http://127.0.0.1:8071/rtuMw/com/rtuLogFile" + rtuLogTextUrl: "http://127.0.0.1:8071/rtuMw/com/rtuLogText" + test: + comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send" + rtuLogFileUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogFile" + rtuLogTextUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogText" + #鐩戞祴鎺у埗妯″潡鍥炶皟鍦板潃 + rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive" + #寰俊灏忕▼搴忓洖璋冨湴鍧� + rtuCallbackUrl_wx: "http://127.0.0.1:8087/wx/comRes/receive" + +#涓嶈繘琛寀serToken杩囨护鐨刄RL锛孈ConfigurationProperties瑕佹眰tokennofilter涓墍鏈夊瓧姣嶉兘灏忓啓 +tokennofilter: + urls: + - /sso/sso + - /remote/comRes/receive + - /wx/comRes/receive + - /app/captcha/get +#鑷姩缁熻閰嶇疆锛岃嚜鍔ㄧ粺璁″畾鏃朵换鍔′細姣忓ぉ瀹氭椂杩涜 +auto-statistics: + startHour: 0 #寮�濮嬪皬鏃� 0 + startMinute: 5 #寮�濮嬪垎閽� 5 + +#閽夐拤娑堟伅鎺ㄩ�� +dingtalk: + ym: + enable: true #鏄惁鍚敤 + robot: + url: https://oapi.dingtalk.com/robot/send + access-token: fecef8e7725998f8912af05419580861aafc73413c4920036c07c050fa33055f + secret: SEC6042bc964d08899a5853eb321eb5a4d842a395982777f815bd07451c879228b7 + at-all: true + mobile: 18602657034 + pj: + enable: true #鏄惁鍚敤 + robot: + url: https://oapi.dingtalk.com/robot/send + access-token: fecef8e7725998f8912af05419580861aafc73413c4920036c07c050fa33055f + secret: SEC6042bc964d08899a5853eb321eb5a4d842a395982777f815bd07451c879228b7 + at-all: true + mobile: 18602657034 + test: + enable: true #鏄惁鍚敤 + robot: + url: https://oapi.dingtalk.com/robot/send + access-token: fecef8e7725998f8912af05419580861aafc73413c4920036c07c050fa33055f + secret: SEC6042bc964d08899a5853eb321eb5a4d842a395982777f815bd07451c879228b7 + at-all: true + mobile: 18602657034 + +#闃�鎺у櫒鍙傛暟 +rtu: + batteryVolt: 17 + signalIntensity: + weak: 10 + ordinary: 20 +# strong: 20 + +#铏氭嫙鍗¢厤缃弬鏁� +vc: + #铏氭嫙鍗℃渶浣庝綑棰濇姤璀﹀�� + alarmValue: 10 \ No newline at end of file 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 2c4c521..777fbf4 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -143,7 +143,7 @@ divisionCode: 120114403100 -#閫氳鍗忚 +#閫氳涓棿浠剁浉鍏抽厤缃� #protocol: DYJS_2023,DYJS_2024 mw: #鍛戒护鍙戦�佸湴鍧�(涓紑鏄満鏋則ag锛屽叾涔熸槸鏁版嵁婧愬悗缂�鍚嶇О) diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml index fbd2fd8..ca7efed 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml @@ -243,7 +243,7 @@ AND rtus.isOnLine = #{isOnLine} </if> <if test = "bindNumber != null and bindNumber > 0"> - AND (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) = ${bindNumber} + AND (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND operateType = 1) = ${bindNumber} </if> </where> ORDER BY con.operateDt DESC 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 60412c5..61ec6b3 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml @@ -225,16 +225,25 @@ <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 + 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 + 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 cont.rtuAddr = rtus.rtuAddr <where> ge.deleted = 0 - AND divi.deleted = 0 - and blo.deleted = 0 + AND divi.deleted = 0 + AND blo.deleted = 0 + AND cont.deleted = 0 <if test="intakeName != null and intakeName != ''"> AND ge.name LIKE CONCAT('%', #{intakeName}, '%') </if> @@ -257,6 +266,18 @@ </if> <if test="address != null and address != ''"> AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%') + </if> + <if test = "rtuAddr != null and rtuAddr !=''"> + AND cont.rtuAddr like CONCAT('%',#{rtuAddr},'%') + </if> + <if test="isOnLine != null and isOnLine !='' "> + AND rtus.isOnLine = #{isOnLine} + </if> + <if test="protocol != null and protocol !='' "> + AND cont.protocol = #{protocol} + </if> + <if test = "bindNumber != null and bindNumber > 0"> + AND (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) = ${bindNumber} </if> </where> </select> @@ -271,6 +292,10 @@ blo.`name` AS blockName, CAST(cont.id AS char) AS controllerId, cont.rtuAddr AS rtuAddr, + cont.protocol AS protocol, + cont.findDt AS findDt, + rtus.isOnLine AS isOnLine, + (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) AS bindNumber, ge.lng, ge.lat, ge.remarks, @@ -282,16 +307,25 @@ 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 + 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 + 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 cont.rtuAddr = rtus.rtuAddr <where> ge.deleted = 0 - AND divi.deleted = 0 - and blo.deleted = 0 + AND divi.deleted = 0 + AND blo.deleted = 0 + AND cont.deleted = 0 <if test="intakeName != null and intakeName != ''"> AND ge.name LIKE CONCAT('%', #{intakeName}, '%') </if> @@ -315,6 +349,18 @@ <if test="address != null and address != ''"> AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%') </if> + <if test = "rtuAddr != null and rtuAddr !=''"> + AND cont.rtuAddr like CONCAT('%',#{rtuAddr},'%') + </if> + <if test="isOnLine != null and isOnLine !='' "> + AND rtus.isOnLine = #{isOnLine} + </if> + <if test="protocol != null and protocol !='' "> + AND cont.protocol = #{protocol} + </if> + <if test = "bindNumber != null and bindNumber > 0"> + AND (SELECT COUNT(*) FROM pr_intake_controller WHERE intakeId = ge.id AND operateType = 1) = ${bindNumber} + </if> </where> ORDER BY ge.operateDt DESC <trim prefix="limit "> 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 d6dbe83..8559512 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOnHourReportLastMapper.xml @@ -450,5 +450,10 @@ <!-- OR rohrl.rtu_dt > #{timeStop}--> <!-- </if>--> ORDER BY rtu_dt ASC + <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-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java index f35f3f1..016a084 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java @@ -58,6 +58,7 @@ private Environment env = null; private String pro_mw = "mw"; private String key_mw = "comSendUrl"; + @Autowired public IntakeSv(Environment env) { this.env = env; @@ -85,7 +86,7 @@ Integer addIntake(PrIntake po) { Long villageId = Optional.ofNullable(po.getVillageId()).orElse(0L); - if (villageId != 0){ + if (villageId != 0) { if (po.getTownId() == null || po.getTownId() == 0) { Long townId = getSupperByVillageId(po.getVillageId()); po.setTownId(townId); @@ -133,21 +134,41 @@ * @return 鍙栨按鍙h褰曞垪琛� */ public QueryResultVo<List<VoIntake>> getIntakes(QueryVo queryVo) { -// String isBinded = queryVo.getIsBinded(); -// -// if(isBinded == null || isBinded.length() <= 0) { -// -// } + Command com = new Command(); + com.id = Command.defaultId; + com.code = "LCD0001"; + com.type = "innerCommand"; + comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); + BaseResponse baseResponse = sendCom2Mw(com); + JSONObject response = (JSONObject) JSON.toJSON(baseResponse); - Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); - Long itemTotal = prIntakeMapper.getRecordCount(params); + if (response != null && response.getString("code").equals("0001")) { + JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap"); + HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class); - QueryResultVo<List<VoIntake>> rsVo = new QueryResultVo<>(); - rsVo.pageSize = queryVo.pageSize; - rsVo.pageCurr = queryVo.pageCurr; - rsVo.calculateAndSet(itemTotal, params); - rsVo.obj = prIntakeMapper.getIntakes(params); - return rsVo; + JSONArray jsonArray = new JSONArray(); + for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("rtuAddr", entry.getKey()); + jsonObject.put("isOnLine", entry.getValue()); + jsonArray.add(jsonObject); + } + + queryVo.setOnLineMap(jsonArray.toJSONString()); + + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + Long itemTotal = prIntakeMapper.getRecordCount(params); + + QueryResultVo<List<VoIntake>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = queryVo.pageSize; + rsVo.pageCurr = queryVo.pageCurr; + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = prIntakeMapper.getIntakes(params); + return rsVo; + } else { + QueryResultVo<List<VoIntake>> rsVo = new QueryResultVo<>(); + return rsVo; + } } /** @@ -226,17 +247,18 @@ /** * 鑾峰彇鍙栨按鍙e垪琛� + * * @return */ public QueryResultVo<List<VoOnLineIntake>> selectOnLineIntakes(OnLineIntakesQO qo) { - Command com = new Command() ; + Command com = new Command(); com.id = Command.defaultId; com.code = "LCD0001"; com.type = "innerCommand"; comSendUrl = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); - if(response != null && response.getString("code").equals("0001")) { + if (response != null && response.getString("code").equals("0001")) { JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap"); HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class); @@ -249,12 +271,12 @@ } qo.setOnLineMap(jsonArray.toJSONString()); - Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); Long itemTotal = prIntakeMapper.getOnLineIntakesCount(params); - QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>() ; - rsVo.pageSize = qo.pageSize ; - rsVo.pageCurr = qo.pageCurr ; + QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = qo.pageSize; + rsVo.pageCurr = qo.pageCurr; rsVo.calculateAndSet(itemTotal, params); rsVo.obj = prIntakeMapper.getOnLineIntakes(params); return rsVo; @@ -266,17 +288,18 @@ /** * 鏍规嵁鎿嶄綔鍛樿幏鍙栧父鐢ㄥ彇姘村彛 + * * @param operator * @return */ public List<VoOnLineIntake> getUsedIntakes(Long operator) { - Command com = new Command() ; + Command com = new Command(); com.id = Command.defaultId; com.code = "LCD0001"; com.type = "innerCommand"; JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); - if(response != null && response.getString("code").equals("0001")) { + if (response != null && response.getString("code").equals("0001")) { JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap"); HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class); @@ -295,9 +318,10 @@ /** * 鍙戦�佸懡浠� + * * @return */ - protected BaseResponse sendCom2Mw(Command com){ + protected BaseResponse sendCom2Mw(Command com) { String url = UriComponentsBuilder.fromUriString(comSendUrl) .build() .toUriString(); @@ -316,6 +340,7 @@ /** * 鍙栨按鍙e悕绉版崲鍙栨按鍙D锛岄獙璇佹槸鍚﹂噸澶嶅悕绉颁娇鐢� + * * @param intakeName * @return */ @@ -325,6 +350,7 @@ /** * 鍙栨按鍙e悕绉版崲鍙栨按鍙D锛岄獙璇佹槸鍚﹂噸澶嶅悕绉颁娇鐢� + * * @param intakeName * @return */ diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/QueryVo.java index e56ba28..d12f140 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/QueryVo.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/QueryVo.java @@ -2,6 +2,8 @@ import com.dy.common.webUtil.QueryConditionVo; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; import lombok.*; /** @@ -34,4 +36,25 @@ @Schema(description = "鍦板潃") public String address; + + @Schema(description = "鎺у埗鍣ㄥ湴鍧�") + private String rtuAddr; + + /** + * 涓棿浠惰繑鍥炵殑RTU鍦ㄧ嚎鎯呭喌瀵硅薄鏁扮粍 + */ + private String onLineMap; + + /** + * 鏄惁鍦ㄧ嚎 + */ + @Max(value = 1,message = "鏄惁鍦ㄧ嚎浠呭厑璁镐负鐪熸垨鍋�") + @Min(value = 0,message = "鏄惁鍦ㄧ嚎浠呭厑璁镐负鐪熸垨鍋�") + private Boolean isOnLine; + + @Schema(description = "閫氫俊鍗忚") + private String protocol; + + @Schema(description = "缁戝畾娆℃暟") + public Integer bindNumber; } -- Gitblit v1.8.0