From 94f769e091e0c4d490707251437e128a8e415c63 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 21 Jun 2024 11:17:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E6=89=8B=E6=9C=BA=E5=8F=B7?= =?UTF-8?q?=E6=97=B6=20=E4=BC=9A=E5=91=98=E5=85=B3=E7=B3=BB=20=E8=A7=A3?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../netty/PushToClientChannelHandlerAdapter.java | 4 ++++ .../system/cashierservice/service/HomePageService.java | 2 -- .../system/cashierservice/service/LoginService.java | 8 +------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/netty/PushToClientChannelHandlerAdapter.java b/src/main/java/com/chaozhanggui/system/cashierservice/netty/PushToClientChannelHandlerAdapter.java index d092661..ff709fc 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/netty/PushToClientChannelHandlerAdapter.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/netty/PushToClientChannelHandlerAdapter.java @@ -113,6 +113,10 @@ public class PushToClientChannelHandlerAdapter extends NettyChannelHandlerAdapte this.shopId=shopId; if (webSocketMap.containsKey(shopId)) { ConcurrentHashMap clientSocketMap = webSocketMap.get(shopId); + ChannelHandlerContext channelHandlerContext = clientSocketMap.get(clientId); + if (channelHandlerContext != null) { + channelHandlerContext.close(); + } clientSocketMap.put(clientId, ctx); } else { ConcurrentHashMap clientSocketMap = new ConcurrentHashMap<>(); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/HomePageService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/HomePageService.java index 3b4f539..35b2e8c 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/HomePageService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/HomePageService.java @@ -22,10 +22,8 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; -import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.ExecutionException; /** * @author lyf diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java index db6db01..9b6eba9 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java @@ -116,16 +116,10 @@ public class LoginService { tbUserInfoMapper.updateByPrimaryKeySelective(userInfo); List tbShopUsers = tbShopUserMapper.selectAllByUserId(userInfo.getId().toString()); for (TbShopUser tbShopUser : tbShopUsers) { - tbShopUser.setUserId(""); + tbShopUser.setUserId(null); tbShopUser.setUpdatedAt(System.currentTimeMillis()); tbShopUserMapper.upUserBYId(tbShopUser); } - List tbShopUsers1 = tbShopUserMapper.selectByPhone(telephone); - for (TbShopUser tbShopUser : tbShopUsers1) { - tbShopUser.setUpdatedAt(System.currentTimeMillis()); - tbShopUser.setUserId(userInfo.getId().toString()); - tbShopUserMapper.upUserBYId(tbShopUser); - } } } }