手机号同步

This commit is contained in:
wangw 2024-05-30 11:45:05 +08:00
parent 2e1755404e
commit 00710c3ee8
5 changed files with 13 additions and 8 deletions

View File

@ -86,8 +86,8 @@ public class UserContoller {
shopUser.setSex(tbUserInfo.getSex());
shopUser.setBirthDay(tbUserInfo.getBirthDay());
shopUser.setLevel(Byte.parseByte("1"));
String code= RandomUtil.randomNumbers(6);
shopUser.setCode(code);
String dynamicCode = RandomUtil.randomNumbers(8);
shopUser.setCode(dynamicCode);
shopUser.setTelephone(tbUserInfo.getTelephone());
shopUser.setAmount(BigDecimal.ZERO);
shopUser.setIsVip(Byte.parseByte("1"));

View File

@ -27,6 +27,7 @@ public interface TbShopUserMapper {
TbShopUser selectByUserIdAndShopId(@Param("userId") String userId,@Param("shopId") String shopId);
List<TbShopUser> selectAllByUserId(@Param("userId") String userId);
List<Map<String,Object>> selectByUserId(@Param("userId") String userId,@Param("shopId") String shopId);

View File

@ -105,13 +105,13 @@ public class LoginService {
userInfo.setUpdatedAt(System.currentTimeMillis());
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
}
}else {
}
else {
String phone = userInfo.getTelephone();
if (StringUtils.isBlank(phone) || !phone.equals(telephone)) {
userInfo.setTelephone(telephone);
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
}else {
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectAllByUserId(userInfo.getId().toString());
for (TbShopUser tbShopUser : tbShopUsers) {
tbShopUser.setTelephone(phone);
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
@ -183,8 +183,8 @@ public class LoginService {
userInfo.setSex(tbShopUser.getSex());
userInfo.setBirthDay(tbShopUser.getBirthDay());
tbShopUser.setLevel(Byte.parseByte("1"));
String code= RandomUtil.randomNumbers(6);
tbShopUser.setCode(code);
String dynamicCode = RandomUtil.randomNumbers(8);
tbShopUser.setCode(dynamicCode);
tbShopUser.setUserId(userInfo.getId() + "");
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
}

View File

@ -82,7 +82,7 @@ public class ProductService {
tbShopUser.setSex(tbUserInfo.getSex());
tbShopUser.setBirthDay(tbUserInfo.getBirthDay());
tbShopUser.setLevel(Byte.parseByte("1"));
tbShopUser.setCode(RandomUtil.randomNumbers(6));
tbShopUser.setCode(RandomUtil.randomNumbers(8));
tbShopUser.setTelephone(tbUserInfo.getTelephone());
tbShopUser.setAmount(BigDecimal.ZERO);
tbShopUser.setIsVip(Byte.parseByte("1"));

View File

@ -384,6 +384,10 @@
select * from tb_shop_user where user_id=#{userId} and shop_id=#{shopId}
</select>
<select id="selectAllByUserId" resultMap="BaseResultMap">
select * from tb_shop_user where user_id=#{userId}
</select>
<select id="selectByOpenId" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopUser">
select * from tb_shop_user where mini_open_id = #{openId}
</select>