|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.hive.communication.netty.server.handler;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
|
|
import com.hive.bee.entity.BeeHive;
|
|
|
|
|
import com.hive.communication.netty.server.dataprocessing.HandlerDateProcessing;
|
|
|
|
@ -17,6 +18,7 @@ import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.net.InetSocketAddress;
|
|
|
|
|
import java.net.SocketAddress;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
@ -54,13 +56,14 @@ public class EchoServerHandler extends ChannelInboundHandlerAdapter {
|
|
|
|
|
stringBuilder.append(start);
|
|
|
|
|
stringBuilder.append("8561");
|
|
|
|
|
stringBuilder.append(beeHive.getDateUploadTimeHex());
|
|
|
|
|
stringBuilder.append("0b01");
|
|
|
|
|
stringBuilder.append("0801");
|
|
|
|
|
// String paddedString = String.format("%4s", code).replace(' ', '0');
|
|
|
|
|
//获取十分钟后的时间秒数,
|
|
|
|
|
// 转换为16进制
|
|
|
|
|
String hexSeconds = Long.toHexString(getCurrentSeconds()).toUpperCase();
|
|
|
|
|
stringBuilder.append(hexSeconds);
|
|
|
|
|
stringBuilder.append("0000ff000000");
|
|
|
|
|
// String hexSeconds = Long.toHexString(getCurrentSeconds()).toUpperCase();
|
|
|
|
|
String upperCase = Long.toHexString(DateUtil.offsetHour(new Date(), -8).toInstant().getEpochSecond()).toUpperCase();
|
|
|
|
|
stringBuilder.append(upperCase);
|
|
|
|
|
stringBuilder.append("0000ff");
|
|
|
|
|
|
|
|
|
|
byte[] dataSum = hexStringToByteArray(stringBuilder.toString());
|
|
|
|
|
// 计算校验码1
|
|
|
|
|