优化登录认证逻辑

This commit is contained in:
2023-05-12 15:45:44 +08:00
parent 738c9fde3d
commit 3e902a42c1

View File

@@ -138,14 +138,10 @@ public class LoginRequestHandler extends AbstractHandler{
if (pileInfoVO != null) { if (pileInfoVO != null) {
flag = Constants.zeroByteArray; flag = Constants.zeroByteArray;
// 登录成功保存桩号和channel的关系 // 登录成功保存桩号和channel的关系
PileChannelEntity.put(pileSn, channel); PileChannelEntity.put(pileSn, channel);
// 更改桩和该桩下的枪口状态分别为 在线、空闲 公共方法修改状态 // 更改桩和该桩下的枪口状态分别为 在线、空闲 公共方法修改状态
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, null, null, null); pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, null, null, null);
}
// 充电桩使用的sim卡把信息存库 // 充电桩使用的sim卡把信息存库
if (StringUtils.equals("00", internetConnection)) { if (StringUtils.equals("00", internetConnection)) {
try { try {
@@ -155,10 +151,6 @@ public class LoginRequestHandler extends AbstractHandler{
} }
} }
// 保存报文
String jsonMsg = JSONObject.toJSONString(loginRequestData);
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, ykcDataProtocol.getHEXString());
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
try { try {
Thread.sleep(200); Thread.sleep(200);
@@ -181,6 +173,11 @@ public class LoginRequestHandler extends AbstractHandler{
IssueQRCodeCommand issueQRCodeCommand = IssueQRCodeCommand.builder().pileSn(pileSn).build(); IssueQRCodeCommand issueQRCodeCommand = IssueQRCodeCommand.builder().pileSn(pileSn).build();
ykcPushCommandService.pushIssueQRCodeCommand(issueQRCodeCommand); ykcPushCommandService.pushIssueQRCodeCommand(issueQRCodeCommand);
}); });
}
// 保存报文 TODO 没有登录认证通过还要不要保存报文?
String jsonMsg = JSONObject.toJSONString(loginRequestData);
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, ykcDataProtocol.getHEXString());
// 消息体 // 消息体
byte[] messageBody = Bytes.concat(pileSnByte, flag); byte[] messageBody = Bytes.concat(pileSnByte, flag);