#
18516761980
2022-08-10 61b35e3e6203cc43c444b85dae17daa5ce7b39b0
#
2个文件已修改
31 ■■■■■ 已修改文件
src/main/java/com/zy/core/netty/domain/fire/Fire_3030.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/netty/handle/PackageServerHandler.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/netty/domain/fire/Fire_3030.java
@@ -5,6 +5,7 @@
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.ByteBufUtil;
import lombok.Data;
import org.springframework.cache.annotation.SpringCacheAnnotationParser;
/**
 * 心跳 pac
@@ -14,7 +15,20 @@
@Data
public class Fire_3030 implements IMessageBody {
    /**
     * 机器号
     */
    private Integer no;
    /**
     * 回路
     */
    private Integer loop;
    /**
     * 部位号
     */
    private Integer partNo;
    private Integer year;
@@ -57,6 +71,8 @@
//        byteBuf.release();
//        System.out.println(byteBuf.refCnt());
        this.no = analyze(new byte[]{bytes[3], bytes[4]});
        this.loop = analyze(new byte[]{bytes[5], bytes[6]});
        this.partNo = analyze(new byte[]{bytes[7], bytes[8]});
        this.year = analyze(new byte[]{bytes[11], bytes[12]});
        this.month = analyze(new byte[]{bytes[13], bytes[14]});
        this.day = analyze(new byte[]{bytes[15], bytes[16]});
src/main/java/com/zy/core/netty/handle/PackageServerHandler.java
@@ -59,4 +59,19 @@
        }
        channel.writeAndFlush(chPackage);
    }
    /******************************************************************************************/
    /**************************************** 测试专用 *****************************************/
    /*****************************************************************************************/
    public static void main(String[] args){
        byte[] bytes = new byte[]{(byte)0x82, 0x38, 0x30, 0x32, 0x34, 0x30, 0x38, 0x38, 0x3B, 0x30, 0x31, 0x31, 0x31,
                                    0x30, 0x33, 0x30, 0x38, 0x31, 0x30, 0x30, 0x34, 0x30, 0x38, 0x38, 0x30, (byte)0x83};
        Fire_3030 fire3030 = new Fire_3030().readFromBytes(bytes);
        String now = "20" + fire3030.getYear() + "-" + fire3030.getMonth() + "-" + fire3030.getDay()
                + " " + fire3030.getHour() + ":" + fire3030.getMinute() + ":" + fire3030.getSeconds();
        //消防IO点编号
        String fireNo = fire3030.getNo().toString() + fire3030.getLoop().toString() + fire3030.getPartNo().toString();
        System.out.println(fireNo);
        String aa="";
    }
}