liurunyu
2024-09-07 9ad6b0179be4d351105f1507779d4f41a3a41953
1、完善代码;
2、江海协议时标(tp)实现中的bug修改。
18个文件已修改
1个文件已添加
1个文件已删除
140 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/UnitAdapterInterface.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/UnitCallbackInterface.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/UnitInterface.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/UnitStartedCallbackInterface.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/rmi/RmiUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_81_Down.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/global/GlCreate.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/resource/ResourceUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/CommandInnerDeaLer.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/RtuDataUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiClUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-mwTest-rtu/src/main/java/com/dy/pipIrrMwTestRtu/tcpClient/TcpClUnit.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/UnitAdapterInterface.java
@@ -2,8 +2,7 @@
/**
 * 模块单元适配器接口
 *
 * 单元适配器接口
 */
public interface UnitAdapterInterface {
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/UnitCallbackInterface.java
New file
@@ -0,0 +1,13 @@
package com.dy.common.mw;
/**
 * 单元启动或停止后回调接口
 */
public interface UnitCallbackInterface {
    /**
     * 回调方法
     * @param obj
     * @throws Exception
     */
    void call(Object obj) throws Exception ;
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/UnitInterface.java
@@ -1,7 +1,7 @@
package com.dy.common.mw;
/**
 * 模块单元接口
 * 单元接口
 *
 */
public interface UnitInterface {
@@ -9,14 +9,15 @@
     * 设置适配器
     * @throws Exception
     */
    public void setAdapter(UnitAdapterInterface adapter) throws Exception ;
    void setAdapter(UnitAdapterInterface adapter) throws Exception ;
    /**
     * 启动模块
     * 启动单元运行
     * @throws Exception
     */
    public void start(UnitStartedCallbackInterface callback) throws Exception  ;
    void start(UnitCallbackInterface callback) throws Exception  ;
    /**
     * 停止模块运行
     * 停止单元运行
     * @throws Exception
     */
    public void stop(UnitStartedCallbackInterface callback) throws Exception  ;
    void stop(UnitCallbackInterface callback) throws Exception  ;
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/UnitStartedCallbackInterface.java
File was deleted
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/rmi/RmiUnit.java
@@ -7,7 +7,7 @@
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
public class RmiUnit implements UnitInterface {
    
@@ -46,7 +46,7 @@
    /**
     * 启动模块
     */
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        if(!started){
            started = true ;
@@ -85,7 +85,7 @@
    }
    @Override
    public void stop(UnitStartedCallbackInterface callback) {
    public void stop(UnitCallbackInterface callback) {
    }
    
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpUnit.java
@@ -13,7 +13,7 @@
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
@SuppressWarnings("unused")
public class TcpUnit implements UnitInterface {
@@ -63,7 +63,7 @@
    /**
     * 启动模块
     */
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        if(!started){
            started = true ;
            /**
@@ -139,7 +139,7 @@
     * @throws Exception
     */
    @Override
    public void stop(UnitStartedCallbackInterface callback) throws Exception {
    public void stop(UnitCallbackInterface callback) throws Exception {
        this.tcpIoHandler.stop();
        this.dataCodecFactory.stop();
        this.adapter.newUnitStopCallback().callback();
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java
@@ -6,7 +6,7 @@
import com.dy.common.queue.Queue;
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
public class CoreUnit implements UnitInterface {
    
@@ -64,7 +64,7 @@
    }
    @Override
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        if(!started){
            started = true ;
            CoreThread ct = CoreThread.getInstance() ;
@@ -85,7 +85,7 @@
    }
    @Override
    public void stop(UnitStartedCallbackInterface callback) {
    public void stop(UnitCallbackInterface callback) {
    }
    
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java
@@ -5,7 +5,7 @@
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
public class ProtocolUnit implements UnitInterface {
@@ -39,7 +39,7 @@
    /**
     * 启动模块
     */
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        //得到唯一实例, 并在生成唯一实例时,扫描注解类
        AnnotationScan.getIntance() ;
        
@@ -75,7 +75,7 @@
    }
    @Override
    public void stop(UnitStartedCallbackInterface callback) {
    public void stop(UnitCallbackInterface callback) {
    }
    
    /*
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/Cd_81_Down.java
@@ -47,10 +47,10 @@
        byte[] bytes = GlCreate.createStart2Cd(para.rtuAddr, para.commandCode);
        if(para.param != null){
            DataCd81Vo cdData = (DataCd81Vo)para.param ;
            byte[] bs = new byte[8] ;
            byte[] bs = new byte[3] ;
            bs[0] = (byte)(Integer.parseInt(cdData.getControllerType(), 16));
            bs[1] = cdData.projectNo.byteValue() ;
            GlCreate.createTp(bs, 2) ;
            bs[2] = 0x01 ;//01:成功 81:失败
            bytes = ByteUtil.bytesMerge(bytes, bs) ;
        }else{
            throw new Exception("下行命令参数据为null") ;
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/parse/global/GlCreate.java
@@ -114,25 +114,8 @@
        ByteUtil.string2BCD_BE(bs, DateTime.mm(), index + 1) ;
        ByteUtil.string2BCD_BE(bs, DateTime.HH(), index + 2) ;
        ByteUtil.string2BCD_BE(bs, DateTime.dd(), index + 3) ;
        byte month = Byte.parseByte(DateTime.MM()) ;
        byte week = (byte)(DateTime.week_Int().byteValue() << 1)  ;
        String month1 = "0" ;
        String month2 = "0" ;
        if(month < 10){
            month1 = "" + month ;
        }else{
            if(month == 10){
                month1 = "0" ;
            }else if(month == 11){
                month1 = "1" ;
            }else if(month == 12){
                month1 = "2" ;
            }
            week = (byte)(week | 0x01) ;
        }
        month2 = "" + week ;
        ByteUtil.string2BCD_BE(bs, month2 + month1, index + 4) ;
        //以下写法自然也是BCD
        bs[index + 4] = (byte)((DateTime.week_Int().byteValue() << 5 | Byte.parseByte(DateTime.MM()))) ;
        ByteUtil.string2BCD_BE(bs, DateTime.yy(), index + 5) ;
        /*
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java
@@ -4,7 +4,7 @@
import com.dy.common.threadPool.TreadPoolFactory;
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
public class SupportUnit implements UnitInterface {
    
@@ -36,7 +36,7 @@
    }
    @Override
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        if(!started){
            started = true ;
            if(confVo.enableShortThreadPool) {
@@ -65,7 +65,7 @@
    }
    @Override
    public void stop(UnitStartedCallbackInterface callback) {
    public void stop(UnitCallbackInterface callback) {
    }
    
    /*
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java
@@ -423,7 +423,7 @@
                case "周四" -> 4;
                case "周五" -> 5;
                case "周六" -> 6;
                case "周七" -> 7;
                case "周七" -> 0;//根据协议要求星期天为0
                default -> 0;
            };
        }else{
@@ -434,7 +434,7 @@
                case "Thu" -> 4;
                case "Fri" -> 5;
                case "Sat" -> 6;
                case "Sun" -> 7;
                case "Sun" -> 0;//根据协议要求星期天为0
                default -> 0;
            };
        }
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java
@@ -328,7 +328,7 @@
            */
            /////////////////
            //RTU上行数据处理模块
            //RTU上行数据处理模块(任务树)
            RtuDataUnitConfigVo rducVo = new RtuDataUnitConfigVo();
            rducVo.resourceLoader = this.resourceLoader ;
            AdapterImp_RtuDataUnit rducAdap = new AdapterImp_RtuDataUnit();
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/resource/ResourceUnit.java
@@ -12,7 +12,7 @@
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
import com.dy.rtuMw.resource.rtuLog.RtuLogManager;
import com.dy.common.util.DateTime;
@@ -63,7 +63,7 @@
        ResourceUnit.springContext = springContext ;
    }
    @Override
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        if(ResourceUnit.springContext == null){
            throw new Exception("Spring上下文对象未设置!") ;
        }
@@ -72,7 +72,7 @@
    }
    @Override
    public void stop(UnitStartedCallbackInterface callback) {
    public void stop(UnitCallbackInterface callback) {
    }
    /**
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/local/CommandInnerDeaLer.java
@@ -1,6 +1,6 @@
package com.dy.rtuMw.server.local;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
import com.dy.common.mw.channel.tcp.TcpUnit;
import com.dy.common.mw.protocol.Command;
import com.dy.rtuMw.server.local.localProtocol.*;
@@ -67,7 +67,7 @@
     * @throws Exception
     */
    private Command stopTcpSv(Command command) throws Exception{
        TcpUnit.getInstance().stop(new UnitStartedCallbackInterface(){
        TcpUnit.getInstance().stop(new UnitCallbackInterface(){
            public void call(Object obj) throws Exception {
            }
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/RtuDataUnit.java
@@ -2,7 +2,7 @@
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
public class RtuDataUnit  implements UnitInterface {
@@ -33,14 +33,14 @@
     * 初始化上行数据处理任务池
     */
    @Override
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        TaskPool.setTaskTreeCofig(new TreeParse().parseConfig(confVo.resourceLoader));
        callback.call(null) ;
        System.out.println("RTU数据处理模块成功启动");
    }
    @Override
    public void stop(UnitStartedCallbackInterface callback) throws Exception {
    public void stop(UnitCallbackInterface callback) throws Exception {
    }
}
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiClUnit.java
@@ -6,7 +6,7 @@
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
import com.dy.common.mw.channel.rmi.RmiFrameWork;
public class RmiClUnit  implements UnitInterface {
@@ -43,14 +43,14 @@
    }
    @Override
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        System.out.println("Rmi Client模块成功启动");
        this.doStart();
        callback.call(null) ;
    }
    @Override
    public void stop(UnitStartedCallbackInterface callback) throws Exception {
    public void stop(UnitCallbackInterface callback) throws Exception {
        callback.call(null);
    }
    
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java
@@ -2,7 +2,7 @@
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
import com.dy.common.threadPool.ThreadPool;
import com.dy.common.threadPool.TreadPoolFactory;
import com.dy.common.util.Callback;
@@ -53,7 +53,7 @@
    }
    @Override
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        pool = TreadPoolFactory.getThreadPoolLong() ;
        System.out.println("Tcp Client模块成功启动");
        this.doStart();
@@ -61,7 +61,7 @@
    }
    @Override
    public void stop(UnitStartedCallbackInterface callback) throws Exception {
    public void stop(UnitCallbackInterface callback) throws Exception {
        callback.call(null);
    }
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java
@@ -9,7 +9,7 @@
import org.jdom2.Document;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
import com.dy.common.mw.channel.rmi.RmiConfigVo;
import com.dy.common.mw.channel.rmi.RmiUnit;
import com.dy.common.util.NumUtil;
@@ -154,7 +154,7 @@
                rmiAdap.setConfig(rmiVo);
                RmiUnit rmiUnit = RmiUnit.getInstance();
                rmiUnit.setAdapter(rmiAdap);
                rmiUnit.start(new UnitStartedCallbackInterface(){
                rmiUnit.start(new UnitCallbackInterface(){
                    @Override
                    public void call(Object obj) {
                    }
pipIrr-platform/pipIrr-web/pipIrr-mwTest-rtu/src/main/java/com/dy/pipIrrMwTestRtu/tcpClient/TcpClUnit.java
@@ -2,7 +2,7 @@
import com.dy.common.mw.UnitAdapterInterface;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.UnitCallbackInterface;
import com.dy.common.util.Callback;
import com.dy.pipIrrMwTestRtu.ServerProperties;
import com.dy.pipIrrMwTestRtu.tcpClient.upData.UpData;
@@ -42,14 +42,14 @@
    }
    @Override
    public void start(UnitStartedCallbackInterface callback) throws Exception {
    public void start(UnitCallbackInterface callback) throws Exception {
        System.out.println("Tcp Client模块成功启动");
        this.doStart();
        callback.call(null) ;
    }
    @Override
    public void stop(UnitStartedCallbackInterface callback) throws Exception {
    public void stop(UnitCallbackInterface callback) throws Exception {
        callback.call(null);
    }