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