打印日志

This commit is contained in:
Guoqs
2024-11-25 11:27:08 +08:00
parent 9e3c518346
commit 6c3eee800e

View File

@@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;
import java.math.BigDecimal;
import java.util.List;
@@ -122,6 +123,8 @@ public class LoginRequestHandler extends AbstractYkcHandler {
// 阻止重复帧
return null;
}
StopWatch stopWatch = new StopWatch("LoginRequestHandler");
stopWatch.start("解析数据");
// 获取消息体
byte[] msgBody = ykcDataProtocol.getMsgBody();
@@ -190,10 +193,10 @@ public class LoginRequestHandler extends AbstractYkcHandler {
.iccid(iccid)
.business(business)
.build();
stopWatch.stop();
// 结果(默认 0x01:登录失败)
byte[] flag = Constants.oneByteArray;
stopWatch.start("登录逻辑");
// 通过桩编码SN查询数据库如果有数据则登录成功否则登录失败
PileBasicInfo pileBasicInfo = null;
try {
@@ -276,7 +279,8 @@ public class LoginRequestHandler extends AbstractYkcHandler {
log.error("保存报文失败pileSn:{}", pileSn, e);
}
}, executor);
stopWatch.stop();
log.info("0x01登录耗时:{}, 详细信息:{}", stopWatch.getTotalTimeMillis(), stopWatch.prettyPrint());
// 消息体
byte[] messageBody = Bytes.concat(pileSnByte, flag);
return getResult(ykcDataProtocol, messageBody);