账号绑定表,增减两个字段 时间

This commit is contained in:
Jack 2025-08-07 10:36:13 +08:00
parent bd063cc859
commit 867969266e
6 changed files with 63 additions and 7 deletions

View File

@ -284,6 +284,12 @@ public class AccountController {
return CommonResult.success(data);
}
/**
* 新用户注册供后台远程调用
*
* @param userInfo
* @return
*/
@RequestMapping(value = "/register", method = RequestMethod.POST)
public CommonResult register(@RequestBody Map userInfo) {
return CommonResult.success(accountUserBaseService.register(userInfo));
@ -441,7 +447,7 @@ public class AccountController {
@RequestMapping(value = "/getAccountsMapByMobile", method = RequestMethod.POST)
public Map<String,Integer> getAccountsMapByMobile(@RequestBody List<String> mobiles) {
public Map<String, Integer> getAccountsMapByMobile(@RequestBody List<String> mobiles) {
return accountUserBaseService.getAccountBaseMapByMobile(mobiles);
}
@ -458,7 +464,7 @@ public class AccountController {
@RequestMapping(value = "/saveBatchAccountInfo", method = RequestMethod.POST)
public ThirdApiRes saveBatchAccountInfo(@RequestBody List<AccountUserInfo> accountUserInfoList) {
return accountUserBaseService.saveBatchAccountInfo( accountUserInfoList);
return accountUserBaseService.saveBatchAccountInfo(accountUserInfoList);
}
@ -466,7 +472,7 @@ public class AccountController {
public AccountUserBase findOneAccountUserBase(@RequestBody AccountUserBase accountUserBase) {
QueryWrapper<AccountUserBase> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_is_admin", accountUserBase.getUser_is_admin());
queryWrapper.eq("store_ids",accountUserBase.getStore_ids());
queryWrapper.eq("store_ids", accountUserBase.getStore_ids());
queryWrapper.last("limit 1");
return accountUserBaseService.getOne(queryWrapper);
}

View File

@ -225,6 +225,15 @@ public interface AccountUserBaseService extends IBaseService<AccountUserBase> {
*/
Boolean existByMobile(String userAccount, String storeId);
/**
* 判断某类型的用户账号是否存在
*
* @param userAccount
* @param userIsAdmin
* @return
*/
Boolean existByUserAccount(String userAccount, Integer userIsAdmin);
Pair<Boolean, AccountUserBase> saveOrUpdate2(AccountUserBase entity);

View File

@ -1698,9 +1698,22 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
user_mobile = PhoneNumberUtils.convWithIDDCodePhoneNumber(user_mobile, user_intl);
// 如果注册账号是手机号
if (CheckUtil.isMobile(user_account, user_intl)) {
// 注册账号手机号增加国家码
user_account = PhoneNumberUtils.convWithIDDCodePhoneNumber(user_account, user_intl);
}
// 检查账号是否已经存在
if (existByUserAccount(user_account, userIsAdmin)) {
throw new ApiException(_("账号已存在,请用另一账号名注册!"));
}
// 有手机参数优先手机注册
if ((StrUtil.isNotBlank(user_mobile))
|| (CheckUtil.isMobile(user_account, user_intl) && StrUtil.equals(user_account, user_mobile))) {
// if ((StrUtil.isNotBlank(user_mobile))
// || (CheckUtil.isMobile(user_account, user_intl) && StrUtil.equals(user_account, user_mobile))) {
if (StrUtil.isNotBlank(user_mobile) && CheckUtil.isMobile(user_mobile, user_intl)) {
if (StrUtil.isNotBlank(rand_key) && StrUtil.isNotBlank(verifyCode)) {
// 手机验证校验
@ -3507,6 +3520,24 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
return count(queryWrapper) > 0;
}
/**
* 判断某类型的用户账号是否存在
*
* @param userAccount
* @param userIsAdmin
* @return
*/
@Override
public Boolean existByUserAccount(String userAccount, Integer userIsAdmin) {
if (StrUtil.isBlank(userAccount) && ObjectUtil.isEmpty(userIsAdmin)) {
return false;
}
LambdaQueryWrapper<AccountUserBase> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AccountUserBase::getUser_account, userAccount).eq(AccountUserBase::getUser_is_admin, userIsAdmin);
return count(queryWrapper) > 0;
}
@Override
public Pair<Boolean, AccountUserBase> saveOrUpdate2(AccountUserBase entity) {
Boolean flag = false;

View File

@ -99,5 +99,10 @@ public class AccountUserBindConnect implements Serializable {
@ApiModelProperty(value = "是否激活(BOOL):0-未激活;1-激活")
private Integer bind_active;
@ApiModelProperty(value = "新增时间")
private Date created_at;
@ApiModelProperty(value = "更新时间")
private Date updated_at;
}

View File

@ -86,7 +86,7 @@ public class CheckUtil {
}
/**
* 手机号码校验(三大运营商最新号段 合作版 2021-03)
* 手机号码校验(三大运营商最新号段 合作版 2021-03), 手机号去掉国家码之后验证手机号段是否属于三大运营商
* 移动号段
* 134 135 136 137 138 139 147 148 150 151 152 157 158 159 172 178 182 183 184 187 188 195 198
* <p>

View File

@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.suisung.mall.common.api.BindCode;
import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.api.ResultCode;
import com.suisung.mall.common.api.StateCode;
@ -155,10 +156,14 @@ public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmplo
if (user.isStore() && employee_id == null) {
userInfo.put("auto_login", false);
userInfo.put("rights_group_id", 1);
userInfo.put("user_is_admin", CommonConstant.USER_TYPE_ADMIN);
userInfo.put("user_is_admin", CommonConstant.USER_TYPE_MCH);
userInfo.put("store_ids", store_id);
// 账号指定用户的手机号
userInfo.put("bind_type", BindCode.MOBILE);
// userInfo.put("user_account", userInfo.get("user_mobile"));
// 新用户注册
CommonResult result = accountService.register(userInfo);
AccountUserBase userBase = result.getFenResult(AccountUserBase.class);
if (userBase == null) {