zhubaomin
2024-11-29 515b39791a7fbd18cd4026aa358c7354272c92af
Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
5个文件已修改
54 ■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voUg/VoUgResult.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/com/CommandCtrl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java
@@ -57,20 +57,15 @@
     * 向通信中间件发送rtu远程升级任务
     * @param restTemplate SpringBoot的RestTemplate
     * @param toMwUrl 到通信中间件的web请求Url
     * @param param 请求参数
     * @param body 请求数据
     * @return
     */
    protected BaseResponse sendRequest2Mw(RestTemplate restTemplate, String toMwUrl, Object param) {
    protected BaseResponse sendPostRequest2Mw(RestTemplate restTemplate, String toMwUrl, Object body) {
        String url = UriComponentsBuilder.fromUriString(toMwUrl)
                .build()
                .toUriString();
        HttpHeaders headers = new HttpHeaders();
        HttpEntity<?> httpEntity ;
        if(param != null){
            httpEntity = new HttpEntity<>(param, headers);
        }else{
            httpEntity = new HttpEntity<>(headers);
        }
        HttpEntity<?> httpEntity = new HttpEntity<>(body, headers);
        ResponseEntity<BaseResponse> response = null;
        try {
            // 通过Post方式调用接口
@@ -87,6 +82,33 @@
    }
    /**
     * 向通信中间件发送rtu远程升级任务
     * @param restTemplate SpringBoot的RestTemplate
     * @param toMwUrl 到通信中间件的web请求Url
     * @return
     */
    protected BaseResponse sendGetRequest2Mw(RestTemplate restTemplate, String toMwUrl) {
        String url = UriComponentsBuilder.fromUriString(toMwUrl)
                .build()
                .toUriString();
        HttpHeaders headers = new HttpHeaders();
        HttpEntity<?> httpEntity = new HttpEntity<>(headers);
        ResponseEntity<BaseResponse> response = null;
        try {
            // 通过Post方式调用接口
            response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, BaseResponse.class);
        } catch (Exception e) {
            e.printStackTrace();
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }
        if(response == null){
            return BaseResponseUtils.buildError("后端系统出错,中间件调用异常");
        }else{
            return response.getBody();
        }
    }
    /**
     * 创建外部命令(发给控制器)
     * @param code 命令code
     * @return
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voUg/VoUgResult.java
@@ -67,7 +67,7 @@
     */
    @Schema(description = "升级是否结束" )
    @ExcelProperty("升级结束")
    @ColumnWidth(10)
    @ColumnWidth(14)
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    public String isOverStr;
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/com/CommandCtrl.java
@@ -165,7 +165,7 @@
     * 接收web系统发来强制结束升级任务
     * @return
     */
    @PostMapping(path = "ugForceOver", consumes = MediaType.APPLICATION_JSON_VALUE)
    @GetMapping(path = "ugForceOver", consumes = MediaType.APPLICATION_JSON_VALUE)
    public BaseResponse<String> ugForceOver() {
        log.info("收到停止RTU升级任务命令") ;
        try{
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java
@@ -77,7 +77,7 @@
            Command com = this.createInnerCommand(CodeLocal.onLinePart);
            com.setParam(rtuAddrs) ;
            String rqUrl = this.get2MwRequestUrl(this.env, ContextComSend) ;
            BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, com) ;
            BaseResponse res = sendPostRequest2Mw(restTemplate, rqUrl, com) ;
            if(res != null){
                if(res.isSuccess()){
                    Command reCom = JSON.parseObject(res.getContent() == null ? null : JSON.toJSONString(res.getContent()), Command.class) ;
@@ -115,7 +115,7 @@
        //向通信中间件发关命令,查询部分RTU在线情况
        Command com = this.createInnerCommand(CodeLocal.onLineAll);
        String rqUrl = this.get2MwRequestUrl(this.env, ContextComSend) ;
        BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, com) ;
        BaseResponse res = sendPostRequest2Mw(restTemplate, rqUrl, com) ;
        if(res != null){
            if(res.isSuccess()){
                Command reCom = JSON.parseObject(res.getContent() == null ? null : JSON.toJSONString(res.getContent()), Command.class) ;
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
@@ -106,7 +106,7 @@
        vo.callbackWebUrl = ugCallbackUrl_rm ;
        String rqUrl = this.get2MwRequestUrl(this.env, ContextUgTaskSend) ;
        BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, vo) ;
        BaseResponse res = sendPostRequest2Mw(restTemplate, rqUrl, vo) ;
        if(res != null){
            if(res.isSuccess()){
                this.sv.setUpgradeTaskExecuted(id);
@@ -116,8 +116,8 @@
                if(msg == null){
                    msg = res.getMsg() ;
                }
                log.error("通信中间件执行下发升级任务失败" + msg) ;
                return BaseResponseUtils.buildErrorMsg("通信中间件执行失败" + msg) ;
                log.error("通信中间件执行下发升级任务失败," + msg) ;
                return BaseResponseUtils.buildErrorMsg("通信中间件执行失败," + msg) ;
            }
        }else{
            log.error("通信中间件返回结果为null") ;
@@ -141,7 +141,7 @@
    @SsoAop()
    public BaseResponse<String> forceOver() {
        String rqUrl = this.get2MwRequestUrl(this.env, ContextUgForceOver) ;
        BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, null) ;
        BaseResponse res = sendGetRequest2Mw(restTemplate, rqUrl) ;
        if(res != null){
            if(res.isSuccess()){
                return BaseResponseUtils.buildSuccess(true) ;