添加会员生成会员码
This commit is contained in:
@@ -106,6 +106,10 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean add(ShopInfoAddDTO shopInfoAddDTO) {
|
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();
|
long count = sysUserService.queryChain().eq(SysUser::getAccount, shopInfoAddDTO.getAccountName()).count();
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw new CzgException("账户已存在");
|
throw new CzgException("账户已存在");
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShopUser shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class);
|
ShopUser shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class);
|
||||||
|
shopUser.setCode(generateCode(shopId));
|
||||||
shopUser.setShopId(shopId);
|
shopUser.setShopId(shopId);
|
||||||
shopUser.setUserId(userInfo.getId());
|
shopUser.setUserId(userInfo.getId());
|
||||||
shopUser.setJoinTime(shopUser.getIsVip() != null && shopUser.getIsVip() == 1 ? DateUtil.date().toLocalDateTime() : null);
|
shopUser.setJoinTime(shopUser.getIsVip() != null && shopUser.getIsVip() == 1 ? DateUtil.date().toLocalDateTime() : null);
|
||||||
|
|||||||
Reference in New Issue
Block a user