Merge branch 'dev-new' into dev-new-rabbitmq

This commit is contained in:
Guoqs
2024-11-25 16:07:08 +08:00
7 changed files with 112 additions and 11 deletions

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);

View File

@@ -57,7 +57,7 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
if (StringUtils.isBlank(pileSn)) {
return;
}
log.info("充电桩退出:{}, channelId:{}", pileSn, PileChannelEntity.getChannelByPileSn(pileSn).channel().id());
log.info("充电桩退出:{}, 类型:主动断开链接, channelId:{}", pileSn, PileChannelEntity.getChannelByPileSn(pileSn).channel().id());
// 充电桩断开连接,所有枪口都设置为【离线】
pileConnectorInfoService.updateConnectorStatusByPileSn(pileSn, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue());
@@ -68,7 +68,7 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
// 记录充电桩退出msg
// 保存报文
String type = YKCFrameTypeCode.PILE_LOG_OUT.getCode() + "";
String jsonMsg = YKCFrameTypeCode.PILE_LOG_OUT.getValue();
String jsonMsg = YKCFrameTypeCode.PILE_LOG_OUT.getValue() + ": 充电桩主动断开链接";
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, "");
// 删除桩编号和channel的关系