会员数据
This commit is contained in:
parent
543f840aaa
commit
6ecb41cbe9
|
|
@ -47,6 +47,7 @@ public class LoginFilter implements Filter {
|
|||
"cashierService/distirict/**",//首页其它接口
|
||||
"cashierService/login/**",//登录部分接口不校验
|
||||
"cashierService/product/queryProduct",
|
||||
"cashierService/product/queryProductSku",
|
||||
"cashierService/product/productInfo",
|
||||
"cashierService/notify/**",//登录部分接口不校验
|
||||
"notify/**",
|
||||
|
|
|
|||
|
|
@ -86,16 +86,16 @@ public class LoginService {
|
|||
userInfo.setLastLogInAt(System.currentTimeMillis());
|
||||
userInfo.setCreatedAt(System.currentTimeMillis());
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
tbUserInfoMapper.insert(userInfo);
|
||||
if(StringUtils.isNotBlank(telephone)){
|
||||
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
|
||||
if(CollectionUtils.isEmpty(tbShopUsers)){
|
||||
if(!CollectionUtils.isEmpty(tbShopUsers)){
|
||||
for (TbShopUser tbShopUser : tbShopUsers) {
|
||||
tbShopUser.setUserId(userInfo.getId() + "");
|
||||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
tbUserInfoMapper.insert(userInfo);
|
||||
}
|
||||
else {
|
||||
userInfo.setSearchWord(userInfo.getSearchWord() + "||微信用户");
|
||||
|
|
@ -116,28 +116,6 @@ public class LoginService {
|
|||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
}
|
||||
}
|
||||
|
||||
List<TbShopUser> tbShopUse= tbShopUserMapper.selectByPhone(telephone);
|
||||
if(ObjectUtil.isNotNull(tbShopUse)){
|
||||
TbUserInfo finalUserInfo = userInfo;
|
||||
tbShopUse.parallelStream().forEach(it->{
|
||||
if(ObjectUtil.isNull(it.getUserId())||ObjectUtil.isEmpty(it.getUserId())){
|
||||
it.setUserId(finalUserInfo.getId().toString());
|
||||
it.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKey(it);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//生成token 信息
|
||||
|
|
@ -299,7 +277,7 @@ public class LoginService {
|
|||
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, dynamicCode);
|
||||
return Result.success(CodeEnum.SUCCESS, "46"+dynamicCode);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ public class AppWebSocketServer {
|
|||
public static ConcurrentHashMap<String, Set<String>> userMap = new ConcurrentHashMap<>();
|
||||
// private static ConcurrentHashMap<String, AppWebSocketServer> userSocketMap = new ConcurrentHashMap<>();
|
||||
//购物车的记录,用于第一次扫码的人同步购物车
|
||||
private static ConcurrentHashMap<String, List<JSONObject>> recordMap = new ConcurrentHashMap<>();
|
||||
private static ConcurrentHashMap<String, Session> sessionMap = new ConcurrentHashMap<>();
|
||||
// private static ConcurrentHashMap<String, List<JSONObject>> recordMap = new ConcurrentHashMap<>();
|
||||
// private static ConcurrentHashMap<String, Session> sessionMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||
|
|
@ -164,13 +164,14 @@ public class AppWebSocketServer {
|
|||
ConcurrentHashMap<String, AppWebSocketServer> userSocketMap = webSocketMap.get(key);
|
||||
// 在放置新条目之前检查并清除同名userId的数据
|
||||
userSocketMap.remove(userId);
|
||||
log.info("存在的 {}用户数3为:{}",key,userSocketMap.size());
|
||||
}
|
||||
if (userMap.containsKey(tableId + "-" + shopId)){
|
||||
Set<String> userSet = userMap.get(tableId + "-" + shopId);
|
||||
if (userSet.isEmpty()){
|
||||
userMap.remove(tableId + "-" + shopId);
|
||||
}
|
||||
userSet.remove(userId);
|
||||
// if (userSet.isEmpty()){
|
||||
// userMap.remove(tableId + "-" + shopId);
|
||||
// }
|
||||
}
|
||||
session.close();
|
||||
}
|
||||
|
|
@ -198,6 +199,19 @@ public class AppWebSocketServer {
|
|||
jsonObject.put("shopId", this.shopId);
|
||||
log.info("tableId:"+this.tableId);
|
||||
log.info("shopId:"+this.shopId);
|
||||
if (userMap.containsKey(tableId + "-" + shopId)) {
|
||||
Set<String> userSet = userMap.get(tableId + "-" + shopId);
|
||||
userSet.add(userId);
|
||||
}
|
||||
if (webSocketMap.containsKey(tableId+"-"+shopId)) {
|
||||
ConcurrentHashMap<String, AppWebSocketServer> userSocketMap = webSocketMap.get(tableId+"-"+shopId);
|
||||
// 在放置新条目之前检查并清除同名userId的数据
|
||||
userSocketMap.put(userId,this);
|
||||
} else {
|
||||
ConcurrentHashMap<String, AppWebSocketServer> userSocketMap=new ConcurrentHashMap<>();
|
||||
userSocketMap.put(userId,this);
|
||||
webSocketMap.put(tableId+"-"+shopId,userSocketMap);
|
||||
}
|
||||
//这里采用责任链模式,每一个处理器对应一个前段发过来的请,这里还可以用工厂模式来生成对象
|
||||
// ChangeHandler changeHandler = new ChangeHandler();
|
||||
// CreateOrderHandler createOrderHandler = new CreateOrderHandler();
|
||||
|
|
@ -227,6 +241,8 @@ public class AppWebSocketServer {
|
|||
jsonObject1.put("data", new ArrayList<>());
|
||||
jsonObject1.put("amount", num);
|
||||
sendMessage(jsonObject1);
|
||||
}else if("close".equals(jsonObject.getString("type"))){
|
||||
onClose();
|
||||
}else {
|
||||
rabbitProducer.putCart(jsonObject.toJSONString());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue