From 3e902a42c1aeae2ffe68d22bbb0bc69281c2496c Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Fri, 12 May 2023 15:45:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../netty/handler/LoginRequestHandler.java | 65 +++++++++---------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/LoginRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/LoginRequestHandler.java index 33817202b..448e6d4c3 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/LoginRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/LoginRequestHandler.java @@ -138,50 +138,47 @@ public class LoginRequestHandler extends AbstractHandler{ if (pileInfoVO != null) { flag = Constants.zeroByteArray; - // 登录成功,保存桩号和channel的关系 PileChannelEntity.put(pileSn, channel); - // 更改桩和该桩下的枪口状态分别为 在线、空闲 公共方法修改状态 pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, null, null, null); - } - - // 充电桩使用的sim卡,把信息存库 - if (StringUtils.equals("00", internetConnection)) { - try { - pileBasicInfoService.updatePileSimInfo(pileSn, iccid); - } catch (Exception e) { - log.error("更新充电桩sim卡信息失败", e); + // 充电桩使用的sim卡,把信息存库 + if (StringUtils.equals("00", internetConnection)) { + try { + pileBasicInfoService.updatePileSimInfo(pileSn, iccid); + } catch (Exception e) { + log.error("更新充电桩sim卡信息失败", e); + } } + + CompletableFuture.runAsync(() -> { + try { + Thread.sleep(200); + } catch (InterruptedException e) { + e.printStackTrace(); + } + // 对时 + ProofreadTimeCommand command = ProofreadTimeCommand.builder().pileSn(pileSn).build(); + ykcPushCommandService.pushProofreadTimeCommand(command); + }); + + // log.info("下面进行下发二维码 pileSn:{}, thread:{}", pileSn, Thread.currentThread().getName()); + CompletableFuture.runAsync(() -> { + try { + Thread.sleep(600); + } catch (InterruptedException e) { + e.printStackTrace(); + } + // 下发二维码 + IssueQRCodeCommand issueQRCodeCommand = IssueQRCodeCommand.builder().pileSn(pileSn).build(); + ykcPushCommandService.pushIssueQRCodeCommand(issueQRCodeCommand); + }); } - // 保存报文 + // 保存报文 TODO 没有登录认证通过还要不要保存报文? String jsonMsg = JSONObject.toJSONString(loginRequestData); pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, ykcDataProtocol.getHEXString()); - CompletableFuture.runAsync(() -> { - try { - Thread.sleep(200); - } catch (InterruptedException e) { - e.printStackTrace(); - } - // 对时 - ProofreadTimeCommand command = ProofreadTimeCommand.builder().pileSn(pileSn).build(); - ykcPushCommandService.pushProofreadTimeCommand(command); - }); - - // log.info("下面进行下发二维码 pileSn:{}, thread:{}", pileSn, Thread.currentThread().getName()); - CompletableFuture.runAsync(() -> { - try { - Thread.sleep(600); - } catch (InterruptedException e) { - e.printStackTrace(); - } - // 下发二维码 - IssueQRCodeCommand issueQRCodeCommand = IssueQRCodeCommand.builder().pileSn(pileSn).build(); - ykcPushCommandService.pushIssueQRCodeCommand(issueQRCodeCommand); - }); - // 消息体 byte[] messageBody = Bytes.concat(pileSnByte, flag); return getResult(ykcDataProtocol, messageBody);