远程调用 fix 修复入参问题,导致反射循环依赖。
This commit is contained in:
parent
e919a934dd
commit
b7b57d04d0
@ -11,6 +11,7 @@ import com.suisung.mall.common.utils.I18nUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -32,6 +33,7 @@ public class AccountBaseUserLevelController {
|
||||
@Autowired
|
||||
private AccountBaseUserLevelService accountBaseUserLevelService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
|
||||
@ -30,7 +30,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -235,9 +234,15 @@ public class AccountUserBaseController extends BaseControllerImpl {
|
||||
|
||||
@ApiOperation("注册商家账号,项目之间远程调用")
|
||||
@RequestMapping(value = "/merchant/inner-register", method = RequestMethod.POST)
|
||||
public Pair<Boolean, String> merchantInnerRegister(@Param("mobile") String mobile, @Param("regPwd") String regPwd) {
|
||||
public Pair<Boolean, String> merchantInnerRegister(@RequestParam("mobile") String mobile, @RequestParam("regPwd") String regPwd) {
|
||||
return accountUserBaseService.merchantInnerRegister(mobile, regPwd);
|
||||
}
|
||||
|
||||
@ApiOperation("更改分店商家的手机号(仅限于分店,尽量不要更高总店的手机号),项目之间远程调用")
|
||||
@RequestMapping(value = "/change/merchant/login-mobile", method = RequestMethod.POST)
|
||||
public Pair<Boolean, String> changeMerchantLoginMobile(@RequestParam("oldMobile") String oldMobile, @RequestParam("newMobile") String newMobile, @RequestParam("password") String password) {
|
||||
return accountUserBaseService.changeMerchantLoginMobile(oldMobile, newMobile, password);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -307,6 +307,16 @@ public interface AccountUserBaseService extends IBaseService<AccountUserBase> {
|
||||
*/
|
||||
Pair<Boolean, String> merchantInnerRegister(String mobile, String regPwd);
|
||||
|
||||
/**
|
||||
* 更改分店商家的手机号(仅限于分店,尽量不要更改总店的手机号),项目之间远程调用
|
||||
*
|
||||
* @param oldMobile 老的手机号
|
||||
* @param newMobile 新的手机号
|
||||
* @param password 新的登录密码(可选)
|
||||
* @return Pair<Boolean, String> 操作结果和提示信息,true表示成功,false表示失败
|
||||
*/
|
||||
Pair<Boolean, String> changeMerchantLoginMobile(String oldMobile, String newMobile, String password);
|
||||
|
||||
/**
|
||||
* 批量保存accountInfo
|
||||
*
|
||||
|
||||
@ -3338,6 +3338,104 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改分店商家的手机号(仅限于分店,尽量不要更改总店的手机号),项目之间远程调用
|
||||
*
|
||||
* @param oldMobile 老的手机号
|
||||
* @param newMobile 新的手机号
|
||||
* @param password 新的登录密码(可选)
|
||||
* @return Pair<Boolean, String> 操作结果和提示信息,true表示成功,false表示失败
|
||||
*/
|
||||
@Override
|
||||
public Pair<Boolean, String> changeMerchantLoginMobile(String oldMobile, String newMobile, String password) {
|
||||
log.debug("开始更改商家登录手机号,老手机号:{},新手机号:{},是否需要设置密码:{}", oldMobile, newMobile, StrUtil.isNotBlank(password));
|
||||
|
||||
try {
|
||||
// 验证输入参数
|
||||
if (StrUtil.isBlank(oldMobile) || StrUtil.isBlank(newMobile)) {
|
||||
log.warn("手机号参数为空,老手机号:{},新手机号:{}", oldMobile, newMobile);
|
||||
return Pair.of(false, "手机号不能为空");
|
||||
}
|
||||
|
||||
// 格式化手机号,添加国际区号
|
||||
String formattedOldMobile = PhoneNumberUtils.convZhPhoneNumber(oldMobile);
|
||||
String formattedNewMobile = PhoneNumberUtils.convZhPhoneNumber(newMobile);
|
||||
log.debug("格式化后的手机号:老:{} 新:{}", formattedOldMobile, formattedNewMobile);
|
||||
|
||||
// 查询老手机号是否绑定商家账号
|
||||
AccountUserBindConnect bindConnect = bindConnectService.getBindByBindId(formattedOldMobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
|
||||
if (bindConnect == null) {
|
||||
log.warn("该老手机号未绑定商家账号,手机号:{}", formattedOldMobile);
|
||||
return Pair.of(false, "该老手机号未绑定商家账号,无法进行更换");
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
Integer userId = bindConnect.getUser_id();
|
||||
log.debug("绑定记录中的用户ID:{}", userId);
|
||||
|
||||
AccountUserBase userBase = get(userId);
|
||||
if (userBase == null) {
|
||||
log.warn("用户信息不存在,用户ID:{}", userId);
|
||||
return Pair.of(false, "用户信息不存在,无法进行更换");
|
||||
}
|
||||
|
||||
// 验证用户确实是商家类型
|
||||
if (!userBase.getUser_is_admin().equals(CommonConstant.USER_TYPE_MCH)) {
|
||||
log.warn("该账号不是商家账号,用户ID:{},用户类型:{}", userId, userBase.getUser_is_admin());
|
||||
return Pair.of(false, "该账号不是商家账号,无法进行更换");
|
||||
}
|
||||
|
||||
// 检查目标手机号是否已被其他商家账号使用
|
||||
AccountUserBase existingNewUser = getByAccountAndType(formattedNewMobile, CommonConstant.USER_TYPE_MCH);
|
||||
if (existingNewUser != null && !existingNewUser.getUser_id().equals(userId)) {
|
||||
log.warn("目标手机号已被其他商家账号使用,手机号:{},用户ID:{}", formattedNewMobile, existingNewUser.getUser_id());
|
||||
return Pair.of(false, "该手机号已被其他商家账号使用");
|
||||
}
|
||||
|
||||
// 检查新手机号是否已被其他商家绑定
|
||||
AccountUserBindConnect newBindConnect = bindConnectService.getBindByBindId(formattedNewMobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
|
||||
if (newBindConnect != null && !newBindConnect.getUser_id().equals(userId)) {
|
||||
log.warn("该新手机号已被其他商家账号绑定,手机号:{},用户ID:{}", formattedNewMobile, newBindConnect.getUser_id());
|
||||
return Pair.of(false, "该手机号已被其他商家账号绑定");
|
||||
}
|
||||
|
||||
// 更新用户账号为新手机号
|
||||
log.debug("开始更新用户账号信息,用户ID:{},新手机号:{}", userId, formattedNewMobile);
|
||||
userBase.setUser_account(formattedNewMobile);
|
||||
|
||||
// 如果提供了密码,则更新密码
|
||||
if (StrUtil.isNotBlank(password)) {
|
||||
log.debug("需要更新用户密码");
|
||||
String user_salt = IdUtil.simpleUUID();
|
||||
String encryptedPassword = SecureUtil.md5(user_salt + SecureUtil.md5(password));
|
||||
userBase.setUser_password(encryptedPassword);
|
||||
userBase.setUser_salt(user_salt);
|
||||
}
|
||||
|
||||
// 更新用户基础信息
|
||||
boolean updateUserResult = saveOrUpdate(userBase);
|
||||
if (!updateUserResult) {
|
||||
log.error("更新用户账号信息失败,用户ID:{}", userId);
|
||||
return Pair.of(false, "更新用户账号信息失败");
|
||||
}
|
||||
|
||||
// 更新绑定表中的bind_id为新手机号
|
||||
log.debug("开始更新绑定信息,原绑定ID:{},新绑定ID:{}", bindConnect.getBind_id(), formattedNewMobile);
|
||||
bindConnect.setBind_id(formattedNewMobile);
|
||||
boolean updateBindResult = accountUserBindConnectService.saveOrUpdate(bindConnect);
|
||||
if (!updateBindResult) {
|
||||
log.error("更新绑定信息失败,绑定ID:{}", formattedNewMobile);
|
||||
return Pair.of(false, "更新绑定信息失败");
|
||||
}
|
||||
|
||||
log.info("更换商家登录手机号成功,用户ID:{},新手机号:{}", userId, formattedNewMobile);
|
||||
return Pair.of(true, "更换商家登录手机号成功");
|
||||
} catch (Exception e) {
|
||||
log.error("更改商家登录手机号过程中发生异常,老手机号:{},新手机号:{}", oldMobile, newMobile, e);
|
||||
return Pair.of(false, "系统异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> doAppConnectLogin(String bind_name, String code) {
|
||||
|
||||
@ -6,7 +6,6 @@ import com.suisung.mall.common.modules.push.PushTemplate;
|
||||
import com.suisung.mall.common.pojo.output.TimelineOutput;
|
||||
import com.suisung.mall.common.pojo.res.ThirdApiRes;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -329,6 +328,13 @@ public interface AccountService {
|
||||
* 服务间注册商家账号,项目之间远程调用
|
||||
*/
|
||||
@RequestMapping(value = "/admin/account/account-user-base/merchant/inner-register", method = RequestMethod.POST)
|
||||
Pair<Boolean, String> merchantInnerRegister(@Param("mobile") String mobile, @Param("regPwd") String regPwd);
|
||||
Pair<Boolean, String> merchantInnerRegister(@RequestParam("mobile") String mobile, @RequestParam("regPwd") String regPwd);
|
||||
|
||||
/**
|
||||
* 服务间注册商家账号,项目之间远程调用
|
||||
*/
|
||||
@RequestMapping(value = "/admin/account/account-user-base/merchant/inner-register", method = RequestMethod.POST)
|
||||
Pair<Boolean, String> changeMerchantLoginMobile(@RequestParam("oldMobile") String oldMobile, @RequestParam("newMobile") String newMobile, @RequestParam("password") String password);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -57,9 +57,11 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
@Service
|
||||
public class ShopActivityGroupbookingServiceImpl extends BaseServiceImpl<ShopActivityGroupbookingMapper, ShopActivityGroupbooking> implements ShopActivityGroupbookingService {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingHistoryService shopActivityGroupbookingHistoryService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopActivityGroupbookingService shopActivityGroupbookingService;
|
||||
|
||||
@ -67,9 +69,11 @@ public class ShopActivityGroupbookingServiceImpl extends BaseServiceImpl<ShopAct
|
||||
@Autowired
|
||||
private ShopStoreActivityBaseService shopStoreActivityBaseService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderInfoService shopOrderInfoService;
|
||||
|
||||
@ -77,6 +81,7 @@ public class ShopActivityGroupbookingServiceImpl extends BaseServiceImpl<ShopAct
|
||||
@Autowired
|
||||
private ShopUserVoucherService shopUserVoucherService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderReturnService shopOrderReturnService;
|
||||
|
||||
@ -84,6 +89,7 @@ public class ShopActivityGroupbookingServiceImpl extends BaseServiceImpl<ShopAct
|
||||
@Autowired
|
||||
private ShopOrderBaseService shopOrderBaseService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderDataService shopOrderDataService;
|
||||
|
||||
@ -91,9 +97,11 @@ public class ShopActivityGroupbookingServiceImpl extends BaseServiceImpl<ShopAct
|
||||
@Autowired
|
||||
private ShopStoreBaseService shopStoreBaseService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopOrderItemService shopOrderItemService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopProductItemService shopProductItemService;
|
||||
|
||||
|
||||
@ -54,6 +54,8 @@ public class AccountBaseConfigServiceImpl extends BaseServiceImpl<AccountBaseCon
|
||||
|
||||
public static Map<String, AccountBaseConfig> configMap;
|
||||
public static Long version = 0L;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
|
||||
@ -99,8 +99,10 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
private ShopStoreInfoService shopStoreInfoService;
|
||||
@Autowired
|
||||
private ShopDistributionUserCommissionService shopDistributionUserCommissionService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AccountBaseConfigService accountBaseConfigService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
@Autowired
|
||||
|
||||
@ -50,6 +50,7 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
@Service
|
||||
public class ShopStoreEmployeeServiceImpl extends BaseServiceImpl<ShopStoreEmployeeMapper, ShopStoreEmployee> implements ShopStoreEmployeeService {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user