update:
1. RuntimeException改用org.springblade.core.log.exception.ServiceException
This commit is contained in:
@@ -110,9 +110,13 @@ public class AppRegisterTokenGranter extends PasswordTokenGranter {
|
|||||||
user.setPassword(DigestUtil.encrypt(ParamCache.getValue(INIT_PASSWD_VALUE)));
|
user.setPassword(DigestUtil.encrypt(ParamCache.getValue(INIT_PASSWD_VALUE)));
|
||||||
|
|
||||||
String code = request.getCode();
|
String code = request.getCode();
|
||||||
Assert.isTrue(code.contains(StringPool.COMMA), ExceptionCode.INVALID_USER.getMessage());
|
if (!code.contains(StringPool.COMMA)) {
|
||||||
|
throw new UserInvalidException("无效验证码");
|
||||||
|
}
|
||||||
String[] splitCode = code.split(StringPool.COMMA);
|
String[] splitCode = code.split(StringPool.COMMA);
|
||||||
Assert.isTrue(splitCode.length == 2, ExceptionCode.INVALID_USER.getMessage());
|
if (splitCode.length != 2) {
|
||||||
|
throw new UserInvalidException("无效验证码");
|
||||||
|
}
|
||||||
String smsCode = splitCode[0];
|
String smsCode = splitCode[0];
|
||||||
String invitationCode = splitCode[1];
|
String invitationCode = splitCode[1];
|
||||||
if (StringUtil.isBlank(smsCode)) {
|
if (StringUtil.isBlank(smsCode)) {
|
||||||
@@ -128,9 +132,13 @@ public class AppRegisterTokenGranter extends PasswordTokenGranter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
invitor = service.getByPhone(invitorCode);
|
invitor = service.getByPhone(invitorCode);
|
||||||
Assert.notNull(invitor, "无效邀请码");
|
if (invitor == null) {
|
||||||
|
throw new UserInvalidException("无效邀请码");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!dynpsService.verifySms(request.getPhone(), smsCode)) {
|
||||||
|
throw new UserInvalidException("验证码验证失败");
|
||||||
}
|
}
|
||||||
Assert.isTrue(dynpsService.verifySms(request.getPhone(), smsCode), "验证码验证失败");
|
|
||||||
|
|
||||||
// 执行用户注册
|
// 执行用户注册
|
||||||
if (service.registerAppUser(user)) {
|
if (service.registerAppUser(user)) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
|||||||
import io.jsonwebtoken.lang.Assert;
|
import io.jsonwebtoken.lang.Assert;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.modules.common.eums.BusinessModule;
|
import org.springblade.modules.common.eums.BusinessModule;
|
||||||
import org.springblade.modules.common.eums.UserPointFlowType;
|
import org.springblade.modules.common.eums.UserPointFlowType;
|
||||||
@@ -64,7 +65,7 @@ public class CommonUserPointServiceImpl extends BaseServiceImpl<CommonUserPointM
|
|||||||
pointsAmount = order.getActualAmount().multiply(BigDecimal.valueOf(0.3));
|
pointsAmount = order.getActualAmount().multiply(BigDecimal.valueOf(0.3));
|
||||||
sourceType = SELF_OPERATED_MALL.getCode();
|
sourceType = SELF_OPERATED_MALL.getCode();
|
||||||
}
|
}
|
||||||
default -> throw new RuntimeException("无效订单类型");
|
default -> throw new ServiceException("无效订单类型");
|
||||||
}
|
}
|
||||||
CommonUserPointEntity userPoint = getById(order.getUserId());
|
CommonUserPointEntity userPoint = getById(order.getUserId());
|
||||||
BigDecimal lastAmount = userPoint.getAmount();
|
BigDecimal lastAmount = userPoint.getAmount();
|
||||||
@@ -75,7 +76,7 @@ public class CommonUserPointServiceImpl extends BaseServiceImpl<CommonUserPointM
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new RuntimeException("奖励用户积分失败");
|
throw new ServiceException("奖励用户积分失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -93,7 +94,7 @@ public class CommonUserPointServiceImpl extends BaseServiceImpl<CommonUserPointM
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new RuntimeException("消费用户积分失败");
|
throw new ServiceException("消费用户积分失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springblade.common.cache.ParamCache;
|
import org.springblade.common.cache.ParamCache;
|
||||||
import org.springblade.common.constant.CommonConstant;
|
import org.springblade.common.constant.CommonConstant;
|
||||||
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
import org.springblade.core.tool.utils.DateUtil;
|
import org.springblade.core.tool.utils.DateUtil;
|
||||||
import org.springblade.core.tool.utils.DigestUtil;
|
import org.springblade.core.tool.utils.DigestUtil;
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
@@ -101,8 +102,8 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
|
|||||||
if (save(info) && userPointService.save(userPoint) && cashCouponService.save(cashCoupon) && benefitPointService.save(benefitPoint) && commissionService.save(commission)) {
|
if (save(info) && userPointService.save(userPoint) && cashCouponService.save(cashCoupon) && benefitPointService.save(benefitPoint) && commissionService.save(commission)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
log.error("用户信息初始化失败,id: {}", user.getId());
|
log.error("用户资产初始化失败,id: {}", user.getId());
|
||||||
throw new RuntimeException("初始化失败");
|
throw new ServiceException("用户资产初始化失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user