From a0f7637ae64c2b13567ecc6f41dcc0ef1d564a33 Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期六, 29 六月 2024 09:47:53 +0800 Subject: [PATCH] 2024-06-29 朱宝民 优化命令处理代码,mw相关地址改为配置文件存储 --- pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml | 1 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java | 12 ++++++------ pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java | 15 +++++++++------ pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java | 15 +++++++++------ pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 11 +++++++++-- pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml | 1 + 6 files changed, 35 insertions(+), 20 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java index ad83980..c4931dc 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java @@ -19,6 +19,7 @@ import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard; import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -45,7 +46,8 @@ */ public class ComSupport { - protected static String mwUrlSendCom = "http://127.0.0.1:8070/rtuMw/com/send" ; + @Value("${mw.comSendUrl}") + private String comSendUrl; protected static String controllerType = null; protected static Integer projectNo = null; @@ -209,7 +211,7 @@ * @return */ protected BaseResponse sendCom2Mw(Command com){ - String url = UriComponentsBuilder.fromUriString(mwUrlSendCom) + String url = UriComponentsBuilder.fromUriString(comSendUrl) .build() .toUriString(); HttpHeaders headers = new HttpHeaders(); @@ -248,14 +250,12 @@ // 鍙戦�佸懡浠� JSONObject response_SendCom= (JSONObject) JSON.toJSON(sendCom2Mw(com)); if(response_SendCom != null && response_SendCom.getString("code").equals("0001")) { - // 璇锋眰鎴愬姛 + // 璇锋眰鎴愬姛, 澶勭悊鍥炶皟 + BaseResponse response_CallBack = dealWithCallBack(comId); // 鍒涘缓鍛戒护鏃ュ織瀵硅薄骞舵坊鍔犲埌鏁版嵁搴撲腑 RmCommandHistory rmCommandHistory = getComHistory(comId, commandCode, commandName, intakeId, rtuAddr, protocol, param, operator); rmCommandHistoryMapper.insert(rmCommandHistory); - - // 澶勭悊鍥炶皟 - BaseResponse response_CallBack = dealWithCallBack(comId); // 鍥炶皟寮傚父 if(!response_CallBack.getCode().equals("0001")) { diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml index 700142f..3b1c640 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml @@ -7,6 +7,7 @@ driverClassName: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull # url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull +# url: jdbc:mysql://8.140.179.55:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull username: root password: dysql,;.abc!@# druid: 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 edd5c60..df7db14 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: false #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse + dev: true #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse dsName: ym #寮�鍙戦樁娈碉紝璁剧疆涓存椂鐨勬暟鎹簱鍚嶇О mw: webPort: 8070 @@ -131,4 +131,11 @@ # pj: 101 #閫氳鍗忚 -#protocol: DYJS_2023,DYJS_2024 \ No newline at end of file +#protocol: DYJS_2023,DYJS_2024 +mw: + #鍛戒护鍙戦�佸湴鍧� + comSendUrl: "http://127.0.0.1:8070/rtuMw/com/send" + #鐩戞祴鎺у埗妯″潡鍥炶皟鍦板潃 + rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive" + #寰俊灏忕▼搴忓洖璋冨湴鍧� + rtuCallbackUrl_wx: "http://127.0.0.1:8087/wx/comRes/receive" \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml index fcd9d78..34bb341 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/application-database.yml @@ -5,6 +5,7 @@ driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull # url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull +# url: jdbc:mysql://8.140.179.55:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull username: root password: dysql,;.abc!@# druid: diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java index d9a8602..15af450 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java @@ -29,6 +29,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.RandomStringUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.MediaType; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.BindingResult; @@ -55,7 +56,9 @@ private final CommandSv commandSv; private final SeVirtualCardMapper seVirtualCardMapper; private final IDLongGenerator idLongGenerator; - private String rtuResultSendWebUrl = "http://127.0.0.1:8081/remote/comRes/receive" ; + + @Value("${mw.rtuCallbackUrl_rm}") + private String rtuCallbackUrl_rm; /** * 骞冲彴杩滅▼寮�闃� @@ -148,7 +151,7 @@ myParam.setProtocol(protocol); myParam.setVcId(vcId); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_rm); myParam.setOperator(operator); return dealWithCommandResult(myParam); } else if(protocol.equals("p206V1_0_1")) { @@ -177,7 +180,7 @@ myParam.setProtocol(protocol); myParam.setVcId(vcId); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_rm); myParam.setOperator(operator); return dealWithCommandResult(myParam); } else { @@ -258,7 +261,7 @@ myParam.setProtocol(protocol); myParam.setVcId(vcId); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_rm); myParam.setOperator(operator); return dealWithCommandResult(myParam); } else if(protocol.equals("p206V1_0_1")) { @@ -285,7 +288,7 @@ myParam.setProtocol(protocol); myParam.setVcId(vcId); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_rm); myParam.setOperator(operator); return dealWithCommandResult(myParam); } else { @@ -381,7 +384,7 @@ myParam.setRtuAddr(rtuAddr); myParam.setProtocol(protocol); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_rm); myParam.setOperator(operator); return dealWithCommandResult(myParam); } else if(protocol.equals("p206V1_0_1")) { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java index f5825b3..59f32ed 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java @@ -26,6 +26,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.RandomStringUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.MediaType; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.BindingResult; @@ -51,7 +52,9 @@ private final CommandSv commandSv; private final SeVirtualCardMapper seVirtualCardMapper; private final IDLongGenerator idLongGenerator; - private String rtuResultSendWebUrl = "http://127.0.0.1:8087/wx/comRes/receive"; + + @Value("${mw.rtuCallbackUrl_wx}") + private String rtuCallbackUrl_wx; /** * 灏忕▼搴忚繙绋嬪紑闃� @@ -142,7 +145,7 @@ myParam.setProtocol(protocol); myParam.setVcId(vcId); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); myParam.setOperator(operator); return dealWithCommandResult(myParam); @@ -172,7 +175,7 @@ myParam.setProtocol(protocol); myParam.setVcId(vcId); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); myParam.setOperator(operator); return dealWithCommandResult(myParam); } else { @@ -241,7 +244,7 @@ myParam.setProtocol(protocol); myParam.setVcId(vcId); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); myParam.setOperator(operator); return dealWithCommandResult(myParam); } else if (protocol.equals("p206V1_0_1")) { @@ -268,7 +271,7 @@ myParam.setProtocol(protocol); myParam.setVcId(vcId); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); myParam.setOperator(operator); return dealWithCommandResult(myParam); } else { @@ -363,7 +366,7 @@ myParam.setRtuAddr(rtuAddr); myParam.setProtocol(protocol); myParam.setParam(param); - myParam.setRtuResultSendWebUrl(rtuResultSendWebUrl); + myParam.setRtuResultSendWebUrl(rtuCallbackUrl_wx); myParam.setOperator(operator); return dealWithCommandResult(myParam); } else if(protocol.equals("p206V1_0_1")) { -- Gitblit v1.8.0