1、远程模块remote模块实现:
(1、系统启动时向通信中间件注册消息接收者;
(2、消息接收者ctr实现(测试阶段);
2、在配置文件增加配置Springboot RestTemplate网络请求超时时长;
3、其他一些测试与优化。
15个文件已修改
2个文件已添加
364 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_83_Up.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/OrgListenerSupport.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global(166web文件花生壳).yml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global(mj梅江系统).yml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global(mq民勤系统).yml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global(sp沙盘系统).yml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global(test测试系统).yml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global(ym元谋系统).yml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/PipIrrMwRtuApplication.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/msCenter/TestMsResource.java 3 ●●●● 补丁 | 查看 | 原始文档 | 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/msCenter/CenterMsReceiveCtrl.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/Register2MwMsCenterListener.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/Cd_83_Up.java
@@ -216,7 +216,8 @@
        Cd_83_Up obj = new Cd_83_Up() ;
        //下面两条上报数据,IC卡编码都是非BCD编码而异常
        //String hex = "683C68B08485353448830200000000001000282353FE739444000001000313000101211615000101210000000000000000000200019000011518000101210A7B16";
        String hex = "683C68B05301154CEA8306001000000004343638483BBBB9E0001000001603000101215907000101210000000000000000000500019000015308000101210AF716";
        //String hex = "683C68B05301154CEA8306001000000004343638483BBBB9E0001000001603000101215907000101210000000000000000000500019000015308000101210AF716";
        String hex = "683868B0532328B90083074065840000FE00061010282353535B7F7691590100404022231024737F3F3F1FFF957296944239050000390001900000F916";
        byte[] bs = ByteUtil.hex2Bytes(hex) ;
        Data data = new Data() ;
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/Web2RtuMw.java
@@ -5,6 +5,7 @@
import com.dy.common.mw.protocol.CommandType;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.util.OrgListenerSupport;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -13,12 +14,15 @@
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.util.Iterator;
import java.util.Map;
/**
 * @Author: liurunyu
 * @Date: 2024/10/23 11:45
 * @Description
 */
public abstract class Web2RtuMw {
public abstract class Web2RtuMw extends OrgListenerSupport {
    /**
     * pro_mw:属性
     * tag从控制器中获取
@@ -32,6 +36,7 @@
    protected static final String ContextRtuLogFile = "/rtuMw/com/rtuLogFile";
    protected static final String ContextRtuLogText = "/rtuMw/com/rtuLogText";
    protected static final String ContextRegisterMsReceiverWebUrl = "/rtuMw/com/registerMsReceiverWebUrl";
    protected static final String ContextUgTaskSend = "/rtuMw/com/upgradeRtu";
    protected static final String ContextUgForceOver = "/rtuMw/com/ugForceOver";
    /**
@@ -43,14 +48,33 @@
        return env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + pro_url);
    }
    /**
     * å¾—到向通信中间件发送数据的URL
     * @param env
     * @param orgTag
     * @return
     */
    protected String get2MwUrl(Environment env, String orgTag) {
        return env.getProperty(pro_mw + "." + orgTag + "." + pro_url);
    }
    /**
     * å¾—到向通信中间件发送强制停止升级的命令URL
     * @param env
     * @param context
     * @return
     */
    protected String get2MwRequestUrl(Environment env, String context) {
        return get2MwUrl(env) + context;
    }
    /**
     * å¾—到向通信中间件发送强制停止升级的命令URL
     * @param env
     * @param orgTag
     * @param context
     * @return
     */
    protected String get2MwRequestUrl(Environment env, String orgTag, String context) {
        return get2MwUrl(env, orgTag) + context;
    }
    /**
     * å‘通信中间件发送rtu远程升级任务
@@ -87,15 +111,61 @@
     * @return
     */
    protected BaseResponse sendGetRequest2Mw(RestTemplate restTemplate, String toMwUrl) {
        return sendGetRequest2Mw(restTemplate, toMwUrl, null);
    }
    /**
     * å‘通信中间件发送rtu远程升级任务
     * @param restTemplate SpringBoot的RestTemplate
     * @param toMwUrl åˆ°é€šä¿¡ä¸­é—´ä»¶çš„web请求Url
     * @param paramName å‚数名称
     * @param paramValue å‚æ•°
     * @return
     */
    protected BaseResponse sendGetRequest2Mw(RestTemplate restTemplate, String toMwUrl, String paramName, String paramValue) {
        String url = UriComponentsBuilder.fromUriString(toMwUrl)
                .build()
                .toUriString();
        //UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url)
        //        .queryParam("test", test);
        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url) ;
        if(paramName != null && !paramName.trim().equals("")){
            builder.queryParam(paramName, paramValue==null?"":paramValue) ;
        }
        return sendGetRequest2Mw(restTemplate, builder);
    }
        ResponseEntity<BaseResponse> response = null;
    /**
     * å‘通信中间件发送rtu远程升级任务
     * @param restTemplate SpringBoot的RestTemplate
     * @param toMwUrl åˆ°é€šä¿¡ä¸­é—´ä»¶çš„web请求Url
     * @param params å‚数集合,参数名称是key,参数是value
     * @return
     */
    protected BaseResponse sendGetRequest2Mw(RestTemplate restTemplate, String toMwUrl, Map<String, String> params) {
        String url = UriComponentsBuilder.fromUriString(toMwUrl)
                .build()
                .toUriString();
        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url) ;
        if(params != null && params.size() > 0){
            Iterator<String> it = params.keySet().iterator() ;
            String key ;
            while (it.hasNext()){
                key = it.next() ;
                builder.queryParam(key, params.get(key)) ;
            }
        }
        return sendGetRequest2Mw(restTemplate, builder);
    }
    /**
     * å‘通信中间件发送rtu远程升级任务
     * @param restTemplate SpringBoot的RestTemplate
     * @param builder
     * @return
     */
    protected BaseResponse sendGetRequest2Mw(RestTemplate restTemplate, UriComponentsBuilder builder) {
        ResponseEntity<BaseResponse> response;
        try {
            // é€šè¿‡Get方式调用接口
            response = restTemplate.exchange(builder.toUriString(),
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/OrgListenerSupport.java
@@ -4,6 +4,9 @@
import org.jdom2.Document;
import org.springframework.core.io.ResourceLoader;
import java.util.ArrayList;
import java.util.List;
/**
 * @Author: liurunyu
 * @Date: 2024/7/24 13:41
@@ -52,4 +55,55 @@
            }
        }
    }
    /////////////////////////////////
    // å¾—到
    ////////////////////////////////
    /**
     * å®žå§‹åŒ–
     */
    @SuppressWarnings("unused ")
    protected List<Org.OrgVo> get(ResourceLoader resourceLoader) {
        return this.doGet(resourceLoader);
    }
    /**
     * å®žå§‹åŒ–
     */
    @SuppressWarnings("unused ")
    protected List<Org.OrgVo> doGet(ResourceLoader resourceLoader) {
        List<Org.OrgVo> list = null ;
        try {
            ConfigXml4Springboot configXml = new ConfigXml4Springboot() ;
            Document doc = configXml.createDom(resourceLoader, "init-config.xml") ;
            list = this.doGet(configXml, doc);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list ;
    }
    private List<Org.OrgVo> doGet(ConfigXml4Springboot configXml, Document doc) throws Exception {
        List<Org.OrgVo> list = null ;
        if (configXml != null && doc != null) {
            list = new ArrayList<>();
            for (int num = 1; num <= 10000; num++) {
                if (configXml.existElement(doc, "config.orgs.org" + num)) {
                    String orgTag = configXml.getSetAttrTxt(doc, "config.orgs.org" + num, "tag", null, false, null);
                    String orgName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num, "name", null, false, null);
                    Boolean enable = configXml.getSetAttrBoolean(doc, "config.orgs.org" + num, "enable", null, null);
                    if(enable != null && enable.booleanValue()){
                        Org.OrgVo vo = new Org().new OrgVo() ;
                        vo.tag = orgTag ;
                        vo.name = orgName ;
                        list.add(vo) ;
                    }
                }else{
                    break ;
                }
            }
        }
        return list ;
    }
}
pipIrr-platform/pipIrr-global/src/main/resources/application-global(166webÎļþ»¨Éú¿Ç).yml
@@ -4,6 +4,11 @@
            # å‰ç«¯ä¸Šä¼ æ–‡ä»¶ï¼Œé™åˆ¶å•个文件的大小和限制所有文件的大小
            max-file-size: 500MB
            max-request-size: 5000MB
    http:
        client:
            # spring restTemplate å¯¹å¤–http访问时
            connect-timeout: 3000 # è¿žæŽ¥è¶…æ—¶æ—¶é—´
            read-timeout: 3000 # è¯»å–è¶…æ—¶æ—¶é—´
logging:
    charset:
        console: UTF-8
@@ -337,6 +342,8 @@
        comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send"
    #Rtu远程命令结果回调地址
    rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive"
    #接收通信中间件消息中心消息的地址
    mwMsCenterReceiveUrl_rm: "http://127.0.0.1:8081/remote/msCenter/receive"
    #rtu远程升级状态信息回调地址
    ugCallbackUrl_rm: "http://127.0.0.1:8081/remote/rtuUpgradeStateReceiver/receive"
    #微信小程序应用中Rtu远程命令结果回调地址
@@ -347,6 +354,7 @@
    urls:
        - /sso/sso
        - /remote/comRes/receive
        - /remote/msCenter/receive
        - /remote/rtuUpgradeStateReceiver/receive
        - /remote/websocket
        - /wx/comRes/receive
pipIrr-platform/pipIrr-global/src/main/resources/application-global(mj÷½­ÏµÍ³).yml
@@ -4,6 +4,11 @@
            # å‰ç«¯ä¸Šä¼ æ–‡ä»¶ï¼Œé™åˆ¶å•个文件的大小和限制所有文件的大小
            max-file-size: 500MB
            max-request-size: 5000MB
    http:
        client:
            # spring restTemplate å¯¹å¤–http访问时
            connect-timeout: 3000 # è¿žæŽ¥è¶…æ—¶æ—¶é—´
            read-timeout: 3000 # è¯»å–è¶…æ—¶æ—¶é—´
logging:
    charset:
        console: UTF-8
@@ -337,6 +342,8 @@
        comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send"
    #Rtu远程命令结果回调地址
    rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive"
    #接收通信中间件消息中心消息的地址
    mwMsCenterReceiveUrl_rm: "http://127.0.0.1:8081/remote/msCenter/receive"
    #rtu远程升级状态信息回调地址
    ugCallbackUrl_rm: "http://127.0.0.1:8081/remote/rtuUpgradeStateReceiver/receive"
    #微信小程序应用中Rtu远程命令结果回调地址
@@ -347,6 +354,7 @@
    urls:
        - /sso/sso
        - /remote/comRes/receive
        - /remote/msCenter/receive
        - /remote/rtuUpgradeStateReceiver/receive
        - /remote/websocket
        - /wx/comRes/receive
pipIrr-platform/pipIrr-global/src/main/resources/application-global(mqÃñÇÚϵͳ).yml
@@ -4,6 +4,11 @@
            # å‰ç«¯ä¸Šä¼ æ–‡ä»¶ï¼Œé™åˆ¶å•个文件的大小和限制所有文件的大小
            max-file-size: 500MB
            max-request-size: 5000MB
    http:
        client:
            # spring restTemplate å¯¹å¤–http访问时
            connect-timeout: 3000 # è¿žæŽ¥è¶…æ—¶æ—¶é—´
            read-timeout: 3000 # è¯»å–è¶…æ—¶æ—¶é—´
logging:
    charset:
        console: UTF-8
@@ -337,6 +342,8 @@
        comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send"
    #Rtu远程命令结果回调地址
    rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive"
    #接收通信中间件消息中心消息的地址
    mwMsCenterReceiveUrl_rm: "http://127.0.0.1:8081/remote/msCenter/receive"
    #rtu远程升级状态信息回调地址
    ugCallbackUrl_rm: "http://127.0.0.1:8081/remote/rtuUpgradeStateReceiver/receive"
    #微信小程序应用中Rtu远程命令结果回调地址
@@ -347,6 +354,7 @@
    urls:
        - /sso/sso
        - /remote/comRes/receive
        - /remote/msCenter/receive
        - /remote/rtuUpgradeStateReceiver/receive
        - /remote/websocket
        - /wx/comRes/receive
pipIrr-platform/pipIrr-global/src/main/resources/application-global(spɳÅÌϵͳ).yml
@@ -4,6 +4,11 @@
            # å‰ç«¯ä¸Šä¼ æ–‡ä»¶ï¼Œé™åˆ¶å•个文件的大小和限制所有文件的大小
            max-file-size: 500MB
            max-request-size: 5000MB
    http:
        client:
            # spring restTemplate å¯¹å¤–http访问时
            connect-timeout: 3000 # è¿žæŽ¥è¶…æ—¶æ—¶é—´
            read-timeout: 3000 # è¯»å–è¶…æ—¶æ—¶é—´
logging:
    charset:
        console: UTF-8
@@ -337,6 +342,8 @@
        comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send"
    #Rtu远程命令结果回调地址
    rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive"
    #接收通信中间件消息中心消息的地址
    mwMsCenterReceiveUrl_rm: "http://127.0.0.1:8081/remote/msCenter/receive"
    #rtu远程升级状态信息回调地址
    ugCallbackUrl_rm: "http://127.0.0.1:8081/remote/rtuUpgradeStateReceiver/receive"
    #微信小程序应用中Rtu远程命令结果回调地址
@@ -347,6 +354,7 @@
    urls:
        - /sso/sso
        - /remote/comRes/receive
        - /remote/msCenter/receive
        - /remote/rtuUpgradeStateReceiver/receive
        - /remote/websocket
        - /wx/comRes/receive
pipIrr-platform/pipIrr-global/src/main/resources/application-global(test²âÊÔϵͳ).yml
@@ -4,6 +4,11 @@
            # å‰ç«¯ä¸Šä¼ æ–‡ä»¶ï¼Œé™åˆ¶å•个文件的大小和限制所有文件的大小
            max-file-size: 500MB
            max-request-size: 5000MB
    http:
        client:
            # spring restTemplate å¯¹å¤–http访问时
            connect-timeout: 3000 # è¿žæŽ¥è¶…æ—¶æ—¶é—´
            read-timeout: 3000 # è¯»å–è¶…æ—¶æ—¶é—´
logging:
    charset:
        console: UTF-8
@@ -337,6 +342,8 @@
        comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send"
    #Rtu远程命令结果回调地址
    rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive"
    #接收通信中间件消息中心消息的地址
    mwMsCenterReceiveUrl_rm: "http://127.0.0.1:8081/remote/msCenter/receive"
    #rtu远程升级状态信息回调地址
    ugCallbackUrl_rm: "http://127.0.0.1:8081/remote/rtuUpgradeStateReceiver/receive"
    #微信小程序应用中Rtu远程命令结果回调地址
@@ -347,6 +354,7 @@
    urls:
        - /sso/sso
        - /remote/comRes/receive
        - /remote/msCenter/receive
        - /remote/rtuUpgradeStateReceiver/receive
        - /remote/websocket
        - /wx/comRes/receive
pipIrr-platform/pipIrr-global/src/main/resources/application-global(ymԪıϵͳ).yml
@@ -4,6 +4,11 @@
            # å‰ç«¯ä¸Šä¼ æ–‡ä»¶ï¼Œé™åˆ¶å•个文件的大小和限制所有文件的大小
            max-file-size: 500MB
            max-request-size: 5000MB
    http:
        client:
            # spring restTemplate å¯¹å¤–http访问时
            connect-timeout: 3000 # è¿žæŽ¥è¶…æ—¶æ—¶é—´
            read-timeout: 3000 # è¯»å–è¶…æ—¶æ—¶é—´
logging:
    charset:
        console: UTF-8
@@ -337,6 +342,8 @@
        comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send"
    #Rtu远程命令结果回调地址
    rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive"
    #接收通信中间件消息中心消息的地址
    mwMsCenterReceiveUrl_rm: "http://127.0.0.1:8081/remote/msCenter/receive"
    #rtu远程升级状态信息回调地址
    ugCallbackUrl_rm: "http://127.0.0.1:8081/remote/rtuUpgradeStateReceiver/receive"
    #微信小程序应用中Rtu远程命令结果回调地址
@@ -347,6 +354,7 @@
    urls:
        - /sso/sso
        - /remote/comRes/receive
        - /remote/msCenter/receive
        - /remote/rtuUpgradeStateReceiver/receive
        - /remote/websocket
        - /wx/comRes/receive
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -4,6 +4,11 @@
            # å‰ç«¯ä¸Šä¼ æ–‡ä»¶ï¼Œé™åˆ¶å•个文件的大小和限制所有文件的大小
            max-file-size: 500MB
            max-request-size: 5000MB
    http:
        client:
            # spring restTemplate å¯¹å¤–http访问时
            connect-timeout: 3000 # è¿žæŽ¥è¶…æ—¶æ—¶é—´
            read-timeout: 3000 # è¯»å–è¶…æ—¶æ—¶é—´
logging:
    charset:
        console: UTF-8
@@ -83,7 +88,7 @@
    nginx:
        root: E:/apps/pipIrr/nginx-1.27.0
        webPort: 54321
        webFilePort: 64321
        webFilePort: 19913
    mw:
        webPort: 8070 #通信中间件中应用,不能在web模块系统中应用
        actutorPort: 9070 #通信中间件中应用,不能在web模块系统中应用
@@ -337,6 +342,8 @@
        comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send"
    #Rtu远程命令结果回调地址
    rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive"
    #接收通信中间件消息中心消息的地址
    mwMsCenterReceiveUrl_rm: "http://127.0.0.1:8081/remote/msCenter/receive"
    #rtu远程升级状态信息回调地址
    ugCallbackUrl_rm: "http://127.0.0.1:8081/remote/rtuUpgradeStateReceiver/receive"
    #微信小程序应用中Rtu远程命令结果回调地址
@@ -347,6 +354,7 @@
    urls:
        - /sso/sso
        - /remote/comRes/receive
        - /remote/msCenter/receive
        - /remote/rtuUpgradeStateReceiver/receive
        - /remote/websocket
        - /wx/comRes/receive
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/PipIrrMwRtuApplication.java
@@ -8,7 +8,9 @@
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.FilterType;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
@EnableAspectJAutoProxy
@ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.rtuMw"},
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/msCenter/TestMsResource.java
@@ -1,6 +1,7 @@
package com.dy.rtuMw.server.msCenter;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
 * @Author: liurunyu
@@ -8,7 +9,7 @@
 * @Description
 */
//使起作用,本类注解@Component,并在PipIrrMwRtuApplication注解@EnableScheduling
//@Component
@Component
public class TestMsResource {
    // è®¾ç½®å®šæ—¶åç§’一次
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/web/com/CommandCtrl.java
@@ -153,7 +153,7 @@
     * @return
     */
    @GetMapping("/registerMsReceiverWebUrl")
    public BaseResponse<List<String>> registerMsReceiverWebUrl(String msReceiverWebUrl){
    public BaseResponse<Boolean> registerMsReceiverWebUrl(String msReceiverWebUrl){
        try{
            MsCenterUnit.getInstance().registerMsReceiver(msReceiverWebUrl);
        }catch (Exception e){
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/CenterMsReceiveCtrl.java
New file
@@ -0,0 +1,61 @@
package com.dy.pipIrrRemote.msCenter;
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.contant.Constant;
import com.dy.common.multiDataSource.DataSourceContext;
import com.dy.common.webUtil.BaseResponse;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Iterator;
import java.util.List;
/**
 * @Author: liurunyu
 * @Date: 2025/2/12 17:34
 * @Description
 */
@Slf4j
@Tag(name = "通信中间消息中心推送消息接收方", description = "通信中间消息中心推送消息接收方")
@RestController
@RequestMapping(path="msCenter")
public class CenterMsReceiveCtrl{
    /**
     * é€šä¿¡ä¸­é—´æ¶ˆæ¯ä¸­å¿ƒæŽ¨é€æ¶ˆæ¯æŽ¥æ”¶
     * @param list æ¶ˆæ¯é›†åˆ
     * @return æ“ä½œç»“æžœ
     */
    @Hidden //不公开接口,其只有通信中间件调用
    @PostMapping(path = "receive", consumes = MediaType.APPLICATION_JSON_VALUE)
    public BaseResponse<Boolean> receive(@RequestBody List<JSONObject> list, HttpServletRequest req, HttpServletResponse rep) {
        //通信中间件传过来的机构tag,以用于查找数据源
        String token = req.getHeader(Constant.UserTokenKeyInHeader);
        DataSourceContext.set(token);
        if(list != null && list.size() > 0){
            for (JSONObject jo : list) {
                if(jo != null){
                    log.info("----------------start " + token + " æ¶ˆæ¯æ•°æ®--------------") ;
                    Iterator<String> it = jo.keySet().iterator() ;
                    String key ;
                    while (it.hasNext()){
                        key = it.next() ;
                        log.info(key + ":" + jo.get(key));
                    }
                    log.info("----------------end " + token + " æ¶ˆæ¯æ•°æ®--------------") ;
                }
            }
        }
        return null ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/Register2MwMsCenterListener.java
New file
@@ -0,0 +1,97 @@
package com.dy.pipIrrRemote.msCenter;
import com.dy.pipIrrGlobal.rtuMw.Web2RtuMw;
import com.dy.pipIrrGlobal.util.Org;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ResourceLoader;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
/**
 * @Author: liurunyu
 * @Date: 2025/2/13 9:47
 * @Description
 */
@Slf4j
@Component
public class Register2MwMsCenterListener extends Web2RtuMw implements ApplicationListener<ApplicationReadyEvent> {
    @Autowired
    private Environment env;
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    protected ResourceLoader resourceLoader;
    @Value("${mw.mwMsCenterReceiveUrl_rm}")
    protected String mwMsCenterReceiveUrl;//消息接收网址
    private static final String mwParamName = "msReceiverWebUrl" ;
    private List<Org.OrgVo> orgs;
    private Timer timer;
    /**
     * SpringBoot容器已经准备好了,执行下面方法
     *
     * @param event äº‹ä»¶
     */
    @Override
    public void onApplicationEvent(@NonNull ApplicationReadyEvent event) {
        try {
            //等1秒,等待com.alibaba.druid.pool.DruidDataSource实始化完成
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            try {
                this.start(event);
            } catch (Exception e) {
                log.error("向通信中间件注册消息接收者出错", e);
            }
        }
    }
    /**
     * æ‰§è¡Œä¸šåŠ¡é€»è¾‘
     * @param event
     * @throws Exception
     */
    private void start(ApplicationReadyEvent event) throws Exception {
        if(mwMsCenterReceiveUrl == null || mwMsCenterReceiveUrl.trim().equals("")){
            throw new Exception("通信中间件消息接收网址未配置");
        }
        orgs = super.get(resourceLoader);
        if(orgs != null && orgs.size() > 0) {
            this.timer = new Timer();
            this.timer.schedule(new TimerTask() {
                public void run() {
                    register(event) ;
                }
            }, 100 , 5 * 60 * 1000);
        }
    }
    /**
     * å‘通信中间件注册消息接收者
     * @param event
     */
    private void register(ApplicationReadyEvent event){
        for (Org.OrgVo vo : this.orgs){
            String rqUrl = this.get2MwRequestUrl(this.env, vo.tag, ContextRegisterMsReceiverWebUrl) ;
            sendGetRequest2Mw(restTemplate, rqUrl, mwParamName, mwMsCenterReceiveUrl) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtuUpgrage/RtuUpgradeCtrl.java
@@ -51,7 +51,7 @@
    private RtuUpgradeSv sv ;
    @Autowired
    RtuUpgradeResSv resSv ;
    private RtuUpgradeResSv resSv ;
    @Autowired
    private Environment env;
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java
@@ -18,7 +18,7 @@
 * @Author: liurunyu
 * @Date: 2024/7/22 14:39
 * @Description
 * ç›‘听器,实现功能:在系统启动时初始化,向数据库中插入数据
 * ç›‘听器,实现功能:启动日统计定时任务
 * æœ¬ç›‘听器不能采用ServletContextListener方式,因为Servlet上下文Context创建后
 * Spring容器并没有创建完,而本类中用了Spring容器中的Bean,即*Dao ã€‚
 * æ‰€ä»¥é‡‡ç”¨äº†Spring事件监听器来实现