Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @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 { | 
|---|
|  |  |  | 
|---|
|  |  |  | @ColumnWidth(15) | 
|---|
|  |  |  | private String blockName; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(title = "ç»å®è®¾å¤") | 
|---|
|  |  |  | @ExcelProperty(value = {"${title}", "ç»å®è®¾å¤"}) | 
|---|
|  |  |  | @Schema(title = "æ¯å¦ç»å®è®¾å¤") | 
|---|
|  |  |  | @ExcelProperty(value = {"${title}", "æ¯å¦ç»å®è®¾å¤"}) | 
|---|
|  |  |  | @ColumnWidth(10) | 
|---|
|  |  |  | private String isBind; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @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; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | # æ°æ®æºé
ç½® | 
|---|
|  |  |  | spring: | 
|---|
|  |  |  | #夿°æ®æºéè¦é
ç½® | 
|---|
|  |  |  | main: | 
|---|
|  |  |  | allow-bean-definition-overriding: true #设置为trueæ¶ï¼åå®ä¹çbeanä¼è¦çä¹åå®ä¹çç¸ååç§°çbean | 
|---|
|  |  |  | datasource: #é
ç½®æ°æ®æº | 
|---|
|  |  |  | #å¤ä¸ªæ°æ®æºåç§°å¨æ¤é
ç½®ï¼è¦æ±ä¸springãdatasourceã[ym][pj]ä¸çä¸è´ | 
|---|
|  |  |  | names: ym | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | 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äºå
¨é¨ï¼ç¶ååexcludeæå®çendpoint | 
|---|
|  |  |  | 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/[åç³»ç»ä¸ä¸æï¼baseï¼]/swagger-ui/index.html | 
|---|
|  |  |  | path: /swagger-ui | 
|---|
|  |  |  | operationsSorter: method # HTTP æ¹æ³æåº | 
|---|
|  |  |  | tagsSorter: alpha # API æåº | 
|---|
|  |  |  | api-docs: | 
|---|
|  |  |  | path: /v3/apiDocs | 
|---|
|  |  |  | groups: | 
|---|
|  |  |  | enabled: true | 
|---|
|  |  |  | show-actuator: true #å¨actuatoré
ç½®ç端å£åä¸ä¸æä¸è®¿é® SpringDoc-OpenApi | 
|---|
|  |  |  | use-management-port: true #åºç¨actuatoré
ç½®ç端å£ï¼ä½ä¸é¢çswagger-ui:pathåªä¼éç¨é»è®¤å¼swagger-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è¯å¥çæ å°æä»¶çä½ç½®ï¼classpath代表å¨resourcesä¸ | 
|---|
|  |  |  | mapper-locations: classpath:mapper/*.xml | 
|---|
|  |  |  | #以ä¸ä¸¤ä¸ªé
ç½®å¯ä»¥çç¥ï¼å¨mapperæ å°æä»¶ä¸é
ç½®â@Mapperâ乿¯å¯ä»¥çã | 
|---|
|  |  |  | #使ç¨type-aliases-package䏿å®entityæ«æå
è·¯å¾ï¼è®©mybatisèªå¨æ«æèªå®ä¹ç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 | 
|---|
|  |  |  | #å¼å¯é©¼å³°uNameèªå¨æ å°å°u_name | 
|---|
|  |  |  | #2023-10-24ç»å®éªï¼ä¸é¢é
ç½®trueæfalseï¼é½è½ä»u_nameæ å°å°uName | 
|---|
|  |  |  | #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æfalse | 
|---|
|  |  |  | 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: | 
|---|
|  |  |  | #å½ä»¤åéå°å(ä¸ç¼æ¯æºætagï¼å
¶ä¹æ¯æ°æ®æºåç¼åç§°) | 
|---|
|  |  |  | 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" | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #ä¸è¿è¡userTokenè¿æ»¤çURLï¼@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 | 
|---|
|  |  |  | 
|---|
|  |  |  | divisionCode: 120114403100 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #é讯åè®® | 
|---|
|  |  |  | #é讯ä¸é´ä»¶ç¸å
³é
ç½® | 
|---|
|  |  |  | #protocol: DYJS_2023,DYJS_2024 | 
|---|
|  |  |  | mw: | 
|---|
|  |  |  | #å½ä»¤åéå°å(ä¸ç¼æ¯æºætagï¼å
¶ä¹æ¯æ°æ®æºåç¼åç§°) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | 
|---|
|  |  |  | </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> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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, | 
|---|
|  |  |  | 
|---|
|  |  |  | 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> | 
|---|
|  |  |  | 
|---|
|  |  |  | <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 "> | 
|---|
|  |  |  | 
|---|
|  |  |  | <!--            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> | 
|---|
|  |  |  | 
|---|
|  |  |  | private Environment env = null; | 
|---|
|  |  |  | private String pro_mw = "mw"; | 
|---|
|  |  |  | private String key_mw = "comSendUrl"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | public IntakeSv(Environment env) { | 
|---|
|  |  |  | this.env = env; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | 
|---|
|  |  |  | * @return åæ°´å£è®°å½å表 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * è·ååæ°´å£å表 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @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); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * æ ¹æ®æä½åè·å常ç¨åæ°´å£ | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @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); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * åéå½ä»¤ | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | protected BaseResponse sendCom2Mw(Command com){ | 
|---|
|  |  |  | protected BaseResponse sendCom2Mw(Command com) { | 
|---|
|  |  |  | String url = UriComponentsBuilder.fromUriString(comSendUrl) | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .toUriString(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * åæ°´å£åç§°æ¢åæ°´å£IDï¼éªè¯æ¯å¦éå¤åç§°ä½¿ç¨ | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param intakeName | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * åæ°´å£åç§°æ¢åæ°´å£IDï¼éªè¯æ¯å¦éå¤åç§°ä½¿ç¨ | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param intakeName | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @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; | 
|---|
|  |  |  | } | 
|---|