socket为空时 报错问题
登录时 获取手机号乱码
This commit is contained in:
@@ -110,7 +110,6 @@ public class LoginContoller {
|
|||||||
String encryptedData = map.get("encryptedData");
|
String encryptedData = map.get("encryptedData");
|
||||||
String ivStr = map.get("iv");
|
String ivStr = map.get("iv");
|
||||||
// String phone = map.get("phone");
|
// String phone = map.get("phone");
|
||||||
log.info("登录传参:入参:{}",JSONUtil.toJSONString(map));
|
|
||||||
// 用户非敏感信息:rawData
|
// 用户非敏感信息:rawData
|
||||||
// 签名:signature
|
// 签名:signature
|
||||||
JSONObject rawDataJson = JSON.parseObject(rawData);
|
JSONObject rawDataJson = JSON.parseObject(rawData);
|
||||||
@@ -128,10 +127,11 @@ public class LoginContoller {
|
|||||||
}
|
}
|
||||||
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||||
String phone = "";
|
String phone = "";
|
||||||
log.info("登录传参:解码获取手机号{}",data);
|
try{
|
||||||
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
|
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
|
||||||
phone =JSONObject.parseObject(data).get("phoneNumber").toString();
|
phone =JSONObject.parseObject(data).get("phoneNumber").toString();
|
||||||
}else {
|
}
|
||||||
|
}catch (Exception e){
|
||||||
log.info("登录传参:获取手机号失败{}",data);
|
log.info("登录传参:获取手机号失败{}",data);
|
||||||
}
|
}
|
||||||
String nickName = rawDataJson.getString("nickName");
|
String nickName = rawDataJson.getString("nickName");
|
||||||
|
|||||||
@@ -57,7 +57,9 @@ public class LoginService {
|
|||||||
public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String ip) throws Exception {
|
public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String ip) throws Exception {
|
||||||
TbUserInfo userInfo = tbUserInfoMapper.selectByOpenId(openId);
|
TbUserInfo userInfo = tbUserInfoMapper.selectByOpenId(openId);
|
||||||
if (ObjectUtil.isNull(userInfo)) {
|
if (ObjectUtil.isNull(userInfo)) {
|
||||||
userInfo = tbUserInfoMapper.selectByPhone(telephone);
|
if(StringUtils.isNotBlank(telephone)){
|
||||||
|
userInfo = tbUserInfoMapper.selectByPhone(telephone);
|
||||||
|
}
|
||||||
if (ObjectUtil.isNull(userInfo)) {
|
if (ObjectUtil.isNull(userInfo)) {
|
||||||
userInfo = new TbUserInfo();
|
userInfo = new TbUserInfo();
|
||||||
userInfo.setAmount(BigDecimal.ZERO);
|
userInfo.setAmount(BigDecimal.ZERO);
|
||||||
@@ -84,17 +86,19 @@ public class LoginService {
|
|||||||
userInfo.setLastLogInAt(System.currentTimeMillis());
|
userInfo.setLastLogInAt(System.currentTimeMillis());
|
||||||
userInfo.setCreatedAt(System.currentTimeMillis());
|
userInfo.setCreatedAt(System.currentTimeMillis());
|
||||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||||
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
|
if(StringUtils.isNotBlank(telephone)){
|
||||||
if(CollectionUtils.isEmpty(tbShopUsers)){
|
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
|
||||||
for (TbShopUser tbShopUser : tbShopUsers) {
|
if(CollectionUtils.isEmpty(tbShopUsers)){
|
||||||
userInfo.setNickName(tbShopUser.getName());
|
for (TbShopUser tbShopUser : tbShopUsers) {
|
||||||
userInfo.setSex(tbShopUser.getSex());
|
userInfo.setNickName(tbShopUser.getName());
|
||||||
userInfo.setBirthDay(tbShopUser.getBirthDay());
|
userInfo.setSex(tbShopUser.getSex());
|
||||||
tbShopUser.setLevel(Byte.parseByte("1"));
|
userInfo.setBirthDay(tbShopUser.getBirthDay());
|
||||||
String dynamicCode = RandomUtil.randomNumbers(8);
|
tbShopUser.setLevel(Byte.parseByte("1"));
|
||||||
tbShopUser.setCode(dynamicCode);
|
String dynamicCode = RandomUtil.randomNumbers(8);
|
||||||
tbShopUser.setUserId(userInfo.getId() + "");
|
tbShopUser.setCode(dynamicCode);
|
||||||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
tbShopUser.setUserId(userInfo.getId() + "");
|
||||||
|
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tbUserInfoMapper.insert(userInfo);
|
tbUserInfoMapper.insert(userInfo);
|
||||||
@@ -108,13 +112,15 @@ public class LoginService {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String phone = userInfo.getTelephone();
|
String phone = userInfo.getTelephone();
|
||||||
if (StringUtils.isBlank(phone) || !phone.equals(telephone)) {
|
if(StringUtils.isNotBlank(telephone)){
|
||||||
userInfo.setTelephone(telephone);
|
if (StringUtils.isBlank(phone) || !phone.equals(telephone)) {
|
||||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
userInfo.setTelephone(telephone);
|
||||||
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectAllByUserId(userInfo.getId().toString());
|
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||||
for (TbShopUser tbShopUser : tbShopUsers) {
|
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectAllByUserId(userInfo.getId().toString());
|
||||||
tbShopUser.setTelephone(phone);
|
for (TbShopUser tbShopUser : tbShopUsers) {
|
||||||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
tbShopUser.setTelephone(phone);
|
||||||
|
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,12 +275,16 @@ public class AppWebSocketServer {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static void AppSendInfo(Object message, String tableId,String userId, boolean userFlag) throws IOException {
|
public static void AppSendInfo(Object message, String tableId,String userId, boolean userFlag) throws IOException {
|
||||||
log.info("发送消息 tableId:{} \n userFlag:{}\n message:{}",tableId,userFlag,JSONUtil.toJSONString(message));
|
log.info("发送消息 tableId:{} \n userId:{}\n userFlag:{}\n message:{}",tableId,userId,userFlag,JSONUtil.toJSONString(message));
|
||||||
if (userFlag) {
|
if (userFlag) {
|
||||||
if (webSocketMap.containsKey(tableId)) {
|
if (webSocketMap.containsKey(tableId)) {
|
||||||
ConcurrentHashMap<String, AppWebSocketServer> userSocketMap = webSocketMap.get(tableId);
|
ConcurrentHashMap<String, AppWebSocketServer> userSocketMap = webSocketMap.get(tableId);
|
||||||
if(StringUtils.isNotBlank(userId)){
|
if(!userSocketMap.isEmpty()){
|
||||||
userSocketMap.get(userId).sendMessage(message);
|
if(StringUtils.isNotBlank(userId)){
|
||||||
|
userSocketMap.get(userId).sendMessage(message);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
log.error("请求的tableId:"+tableId+"用户连接为空");
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
log.error("请求的tableId:"+tableId+" userId:" + userId + "不在该服务器上");
|
log.error("请求的tableId:"+tableId+" userId:" + userId + "不在该服务器上");
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ mybatis:
|
|||||||
ysk:
|
ysk:
|
||||||
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
||||||
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
||||||
callBackGroupurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBackGroup
|
callBackGroupurl: https://wxcashiertest.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
|
||||||
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
||||||
default: 18710449883
|
default: 18710449883
|
||||||
server:
|
server:
|
||||||
|
|||||||
@@ -402,6 +402,7 @@
|
|||||||
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||||
WHERE
|
WHERE
|
||||||
pro.type_enum = 'group'
|
pro.type_enum = 'group'
|
||||||
|
AND pro.is_combo = '1'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
sku.product_id
|
sku.product_id
|
||||||
ORDER BY
|
ORDER BY
|
||||||
@@ -421,6 +422,7 @@
|
|||||||
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||||
WHERE
|
WHERE
|
||||||
pro.type_enum = 'group'
|
pro.type_enum = 'group'
|
||||||
|
AND pro.is_combo = '1'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
sku.product_id
|
sku.product_id
|
||||||
ORDER BY
|
ORDER BY
|
||||||
|
|||||||
Reference in New Issue
Block a user