Merge remote-tracking branch 'origin/dev' into zs
This commit is contained in:
@@ -208,6 +208,7 @@ public class LoginContoller {
|
||||
return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
|
||||
}
|
||||
} catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
log.info("登录传参 获取手机号失败 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,data);
|
||||
}
|
||||
return Result.fail("获取手机号失败,请重试!");
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||
@@ -416,23 +417,33 @@ public class LoginService {
|
||||
@Transactional
|
||||
public Result upPhone(String openId, String phone, String shopId) {
|
||||
TbUserInfo userInfo = tbUserInfoMapper.selectByOpenId(openId);
|
||||
boolean isup = false;
|
||||
if(StringUtils.isNotBlank(userInfo.getTelephone())){
|
||||
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(userInfo.getTelephone());
|
||||
for (TbShopUser tbShopUser : tbShopUsers) {
|
||||
if (tbShopUser.getShopId().equals(shopId)) {
|
||||
isup = true;
|
||||
}
|
||||
tbShopUser.setTelephone(phone);
|
||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
}
|
||||
if(!isup){
|
||||
registerShopUser(userInfo,shopId);
|
||||
}
|
||||
}else {
|
||||
TbShopUser shopUser = tbShopUserMapper.selectByUserIdAndShopId(userInfo.getId().toString(), shopId);
|
||||
if (shopUser != null) {
|
||||
shopUser.setTelephone(phone);
|
||||
shopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKey(shopUser);
|
||||
}else {
|
||||
registerShopUser(userInfo,shopId);
|
||||
}
|
||||
}
|
||||
userInfo.setTelephone(phone);
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||
TbShopUser shopUser = tbShopUserMapper.selectByUserIdAndShopId(userInfo.getId().toString(), shopId);
|
||||
if (shopUser != null) if (!shopUser.getIsVip().equals(1) && shopUser.getAmount().equals(BigDecimal.ZERO)) {
|
||||
tbShopUserMapper.deleteByPrimaryKey(shopUser.getId());
|
||||
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(phone);
|
||||
if (!CollectionUtils.isEmpty(tbShopUsers)) {
|
||||
for (TbShopUser tbShopUser : tbShopUsers) {
|
||||
tbShopUser.setUserId(userInfo.getId() + "");
|
||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
||||
registerShopUser(userInfo,shopId);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user