添加会员生成会员码

This commit is contained in:
张松
2025-03-06 13:59:11 +08:00
parent fdb00148b5
commit 76a1cc0130
2 changed files with 5 additions and 0 deletions

View File

@@ -106,6 +106,10 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean add(ShopInfoAddDTO shopInfoAddDTO) {
shopInfoAddDTO.setPhone(shopInfoAddDTO.getPhone().trim());
if (StrUtil.isBlank(shopInfoAddDTO.getPhone())) {
throw new ApiNotPrintException("请输入手机号");
}
long count = sysUserService.queryChain().eq(SysUser::getAccount, shopInfoAddDTO.getAccountName()).count();
if (count > 0) {
throw new CzgException("账户已存在");

View File

@@ -153,6 +153,7 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
}
ShopUser shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class);
shopUser.setCode(generateCode(shopId));
shopUser.setShopId(shopId);
shopUser.setUserId(userInfo.getId());
shopUser.setJoinTime(shopUser.getIsVip() != null && shopUser.getIsVip() == 1 ? DateUtil.date().toLocalDateTime() : null);