手机号同步

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.setSex(tbUserInfo.getSex());
shopUser.setBirthDay(tbUserInfo.getBirthDay()); shopUser.setBirthDay(tbUserInfo.getBirthDay());
shopUser.setLevel(Byte.parseByte("1")); shopUser.setLevel(Byte.parseByte("1"));
String code= RandomUtil.randomNumbers(6); String dynamicCode = RandomUtil.randomNumbers(8);
shopUser.setCode(code); shopUser.setCode(dynamicCode);
shopUser.setTelephone(tbUserInfo.getTelephone()); shopUser.setTelephone(tbUserInfo.getTelephone());
shopUser.setAmount(BigDecimal.ZERO); shopUser.setAmount(BigDecimal.ZERO);
shopUser.setIsVip(Byte.parseByte("1")); shopUser.setIsVip(Byte.parseByte("1"));

View File

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

View File

@ -82,7 +82,7 @@ public class ProductService {
tbShopUser.setSex(tbUserInfo.getSex()); tbShopUser.setSex(tbUserInfo.getSex());
tbShopUser.setBirthDay(tbUserInfo.getBirthDay()); tbShopUser.setBirthDay(tbUserInfo.getBirthDay());
tbShopUser.setLevel(Byte.parseByte("1")); tbShopUser.setLevel(Byte.parseByte("1"));
tbShopUser.setCode(RandomUtil.randomNumbers(6)); tbShopUser.setCode(RandomUtil.randomNumbers(8));
tbShopUser.setTelephone(tbUserInfo.getTelephone()); tbShopUser.setTelephone(tbUserInfo.getTelephone());
tbShopUser.setAmount(BigDecimal.ZERO); tbShopUser.setAmount(BigDecimal.ZERO);
tbShopUser.setIsVip(Byte.parseByte("1")); 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 * from tb_shop_user where user_id=#{userId} and shop_id=#{shopId}
</select> </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 id="selectByOpenId" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopUser">
select * from tb_shop_user where mini_open_id = #{openId} select * from tb_shop_user where mini_open_id = #{openId}
</select> </select>