BUGFIX:检查所有异常提示的语言是否都做了多语言
This commit is contained in:
@@ -152,7 +152,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setUserPassword(accountDTO.getPassword());
|
||||
accountMapper.updateById(account);
|
||||
} else if ("Third-000000".equals(account.getUserPassword())){
|
||||
throw new BusinessException("Password cannot be empty");
|
||||
throw new BusinessException("password.cannot.be.empty");
|
||||
} else {
|
||||
if (!account.getUserPassword().equals(accountDTO.getPassword())) {
|
||||
throw new BusinessException("password.error", ResultEnum.PROMPT.getCode());
|
||||
@@ -632,13 +632,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Override
|
||||
public Boolean editUser(AccountEditDTO accountEditDTO) {
|
||||
if (Objects.isNull(accountEditDTO) || ObjectUtils.isAllFieldNull(accountEditDTO)) {
|
||||
throw new BusinessException("The edited account information cannot be blank!");
|
||||
throw new BusinessException("edited.account.information.cannot.be.blank");
|
||||
}
|
||||
QueryWrapper<Account> queryTotal = new QueryWrapper<>();
|
||||
Account account = new Account();
|
||||
//校验
|
||||
if (StringUtils.isNotBlank(accountEditDTO.getNewEmail())) {
|
||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldEmail()), "oldEmail cannot be empty!");
|
||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldEmail()), "oldEmail.cannot.be.empty");
|
||||
queryTotal.eq("user_email", accountEditDTO.getOldEmail());
|
||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||
Assert.notNull(accountSelect, "oldEmail does not exist!");
|
||||
@@ -646,31 +646,31 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setUserEmail(accountEditDTO.getNewEmail());
|
||||
}
|
||||
if (StringUtils.isNotBlank(accountEditDTO.getNewUserName())) {
|
||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()), "oldUserName cannot be empty!");
|
||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()), "oldUserName.cannot.be.empty");
|
||||
queryTotal.eq("user_name", accountEditDTO.getOldUserName());
|
||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||
Assert.notNull(accountSelect, "oldUserName does not exist!");
|
||||
Assert.notNull(accountSelect, "oldUserName.does.not.exist");
|
||||
|
||||
account.setUserName(accountEditDTO.getNewUserName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(accountEditDTO.getNewValidStartTime())) {
|
||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()), "oldUserName cannot be empty!");
|
||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()), "oldUserName.cannot.be.empty");
|
||||
queryTotal.eq("user_name", accountEditDTO.getOldUserName());
|
||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||
Assert.notNull(accountSelect, "oldUserName does not exist!");
|
||||
Assert.notNull(accountSelect, "oldUserName.does.not.exist");
|
||||
|
||||
account.setValidStartTime(Long.valueOf(accountEditDTO.getNewValidStartTime()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(accountEditDTO.getNewValidEndTime())) {
|
||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()), "oldUserName cannot be empty!");
|
||||
Assert.isTrue(StringUtils.isNotBlank(accountEditDTO.getOldUserName()), "oldUserName.cannot.be.empty");
|
||||
queryTotal.eq("user_name", accountEditDTO.getOldUserName());
|
||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||
Assert.notNull(accountSelect, "oldUserName does not exist!");
|
||||
Assert.notNull(accountSelect, "oldUserName.does.not.exist");
|
||||
|
||||
account.setValidEndTime(toDayEnd(Long.parseLong(accountEditDTO.getNewValidEndTime())));
|
||||
}
|
||||
Account accountSelect = accountMapper.selectOne(queryTotal);
|
||||
Assert.notNull(accountSelect, "oldAccount does not exist!");
|
||||
Assert.notNull(accountSelect, "oldAccount.does.not.exist");
|
||||
accountMapper.update(account, queryTotal);
|
||||
return null;
|
||||
}
|
||||
@@ -3165,7 +3165,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
List<AccountExtend> accountExtends = accountExtendMapper.selectList(qw);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(accountExtends)) {
|
||||
throw new BusinessException("The Google has been bound.");
|
||||
throw new BusinessException("the.Google.has.been.bound");
|
||||
}
|
||||
|
||||
AccountExtend accountExtendInsert = new AccountExtend();
|
||||
@@ -3194,7 +3194,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
String openId = accessTokenResponse.getString("openid");
|
||||
|
||||
if (StringUtils.isEmpty(accessToken) || StringUtils.isEmpty(openId)) {
|
||||
throw new RuntimeException("微信接口返回数据缺失: " + accessTokenResponse.toJSONString());
|
||||
log.error("微信接口返回数据缺失: {}", accessTokenResponse.toJSONString());
|
||||
throw new BusinessException("Unable.to.obtain.WeChat.account.information");
|
||||
}
|
||||
|
||||
// 2. 获取用户信息
|
||||
@@ -3205,7 +3206,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
String userName = userInfoResponse.getString("nickname");
|
||||
String headimgurl = userInfoResponse.getString("headimgurl");
|
||||
if (unionId == null) {
|
||||
throw new IllegalArgumentException("无法获取 unionid,请检查微信开发平台配置");
|
||||
log.error("无法获取 unionid,请检查微信开发平台配置");
|
||||
throw new BusinessException("Unable.to.obtain.WeChat.account.information");
|
||||
}
|
||||
QueryWrapper<AccountExtend> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(AccountExtend::getAuth, unionId);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.ai.da.common.constant.CommonConstant;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.enums.CreditsEventsEnum;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.ResultEnum;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.mapper.primary.AccountMapper;
|
||||
import com.ai.da.mapper.primary.CreditsDetailMapper;
|
||||
@@ -183,7 +184,7 @@ public class CreditsServiceImpl extends ServiceImpl<CreditsDetailMapper, Credits
|
||||
Account account = accountMapper.selectById(accountId);
|
||||
if (account == null) {
|
||||
log.error("账户:{} 不存在", accountId);
|
||||
throw new BusinessException("账户不存在");
|
||||
throw new BusinessException("user.has.no.account", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
BigDecimal existingCredits = Optional.ofNullable(account.getCredits()).orElse(BigDecimal.ZERO);
|
||||
BigDecimal subtract = existingCredits.subtract(sum);
|
||||
|
||||
@@ -970,7 +970,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
}
|
||||
} else {
|
||||
log.error("designType为Generate的印花path传值为空 :{}", print.getPath());
|
||||
throw new BusinessException("The path for the print is empty.");
|
||||
throw new BusinessException("path.cannot.be.empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1848,7 +1848,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
// 判断用户当前积分是否够本次生成消耗
|
||||
Boolean preDeduction = creditsService.creditsPreDeduction(CreditsEventsEnum.TO_PRODUCT_IMAGE, cloudTaskDTO.getNums());
|
||||
if (!preDeduction) {
|
||||
throw new BusinessException("Your remaining credits are insufficient for this generation. Please recharge.", ResultEnum.WARNING.getCode());
|
||||
throw new BusinessException("remaining.credits.insufficient", ResultEnum.WARNING.getCode());
|
||||
}
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
|
||||
@@ -2036,7 +2036,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
// 判断用户当前积分是否够本次生成消耗
|
||||
Boolean preDeduction = creditsService.creditsPreDeduction(CreditsEventsEnum.RELIGHT, cloudTaskDTO.getNums());
|
||||
if (!preDeduction) {
|
||||
throw new BusinessException("Your remaining credits are insufficient for this generation. Please recharge.", ResultEnum.WARNING.getCode());
|
||||
throw new BusinessException("remaining.credits.insufficient", ResultEnum.WARNING.getCode());
|
||||
}
|
||||
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
@@ -2206,7 +2206,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
|
||||
Boolean preDeduction = creditsService.creditsPreDeduction(CreditsEventsEnum.POSE_TRANSFORMATION, cloudTaskDTO.getNums());
|
||||
if (!preDeduction) {
|
||||
throw new BusinessException("Your remaining credits are insufficient for this generation. Please recharge.", ResultEnum.WARNING.getCode());
|
||||
throw new BusinessException("remaining.credits.insufficient", ResultEnum.WARNING.getCode());
|
||||
}
|
||||
|
||||
Long projectId = cloudTaskDTO.getProjectId();
|
||||
|
||||
@@ -307,7 +307,8 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
if (e.getMessage().equals("One record is expected, but the query result is multiple records")) {
|
||||
generate = selectListByUniqueId(taskId).get(0);
|
||||
} else {
|
||||
throw new BusinessException("There are some problems with database query, please try again.");
|
||||
log.error("There are some problems with database query, please try again.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Generate generate = selectByUniqueId(taskId);
|
||||
@@ -617,7 +618,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
*/
|
||||
private void validateRequiredParams(GenerateThroughImageTextDTO generateDTO) {
|
||||
if (Objects.isNull(generateDTO.getUserId())) {
|
||||
throw new BusinessException("userId cannot be empty");
|
||||
throw new BusinessException("userId.cannot.be.empty");
|
||||
}
|
||||
|
||||
// Printboard必须要有level2Type
|
||||
@@ -1552,6 +1553,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
poseTransformationMapper.insert(poseTransformation);
|
||||
// 当需要默认like
|
||||
ToProductImageResultVO toProductImageResultVO = new ToProductImageResultVO();
|
||||
toProductImageResultVO.setId(poseTransformation.getId());
|
||||
toProductImageResultVO.setParentId(poseTransformDTO.getParentId());
|
||||
toProductImageResultVO.setResultType(Module.poseTransfer.getValue());
|
||||
toProductImageResultVO.setTaskId(taskId);
|
||||
@@ -1585,7 +1587,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
projectService.modifyProjectUpdateTime(projectId);
|
||||
return toProductImageResultVO;
|
||||
}
|
||||
throw new BusinessException("pose transformation error", ResultEnum.ERROR.getCode());
|
||||
throw new BusinessException("pose.transformation.error", ResultEnum.ERROR.getCode());
|
||||
}
|
||||
|
||||
private CollectionSort addPoseTransferLike(PoseTransformDTO poseTransformDTO, Long poseTransformationId) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
public PageBaseResponse<NotificationVO> getHistoryNotification(GetNotificationDTO getNotificationDTO) {
|
||||
log.info("获取历史消息:parameter => {}", getNotificationDTO);
|
||||
if (StringUtil.isNullOrEmpty(getNotificationDTO.getType())){
|
||||
throw new BusinessException("type cannot be empty");
|
||||
throw new BusinessException("type.cannot.be.empty");
|
||||
}
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
// 查动态
|
||||
|
||||
@@ -159,7 +159,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
existSameNameQw.lambda().eq(Portfolio::getAccountId, authPrincipalVo.getId());
|
||||
List<Portfolio> portfoliosSameName = portfolioMapper.selectList(existSameNameQw);
|
||||
if (!CollectionUtils.isEmpty(portfoliosSameName)) {
|
||||
throw new BusinessException("The title of the published work has been used.");
|
||||
throw new BusinessException("title.has.been.used");
|
||||
}
|
||||
// 判断用户是否参与#RCAworkshop_2024的活动
|
||||
// if (hasParticipatedRCAWorkshop(authPrincipalVo.getId(), portfolioDTO.getTagsDTO(), portfolioDTO.getId(), portfolioDTO.getUserLikeGroupId())){
|
||||
@@ -307,7 +307,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
existSameNameQw.lambda().eq(Portfolio::getAccountId, authPrincipalVo.getId());
|
||||
List<Portfolio> portfoliosSameName = portfolioMapper.selectList(existSameNameQw);
|
||||
if (!CollectionUtils.isEmpty(portfoliosSameName)) {
|
||||
throw new BusinessException("The title of the published work has been used.");
|
||||
throw new BusinessException("title.has.been.used");
|
||||
}
|
||||
if (portfolioDTO.getPortfolioType().equals("History")) {
|
||||
Long userLikeGroupId;
|
||||
@@ -986,7 +986,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
if (!Objects.equals(portfolio.getAccountId(), userHolder.getId())) {
|
||||
if (!Objects.equals(comment.getAccountId(), userHolder.getId())) {
|
||||
throw new BusinessException("You do not have the permission to delete this comment");
|
||||
throw new BusinessException("do.not.have.the.permission.to.delete.this.comment");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public class StripeServiceImpl implements StripeService {
|
||||
productEnum = ProductEnum.DailySubscription;
|
||||
break;
|
||||
default:
|
||||
throw new BusinessException("unknown subscription type");
|
||||
throw new BusinessException("unknown.subscription.type");
|
||||
}
|
||||
|
||||
// 添加优惠券(只允许在订阅时使用优惠券)
|
||||
@@ -137,7 +137,7 @@ public class StripeServiceImpl implements StripeService {
|
||||
// sessionBuilder.setAllowPromotionCodes(true);
|
||||
break;
|
||||
default:
|
||||
throw new BusinessException("unknown product type");
|
||||
throw new BusinessException("unknown.product.type");
|
||||
}
|
||||
log.info("生成订单");
|
||||
String payType;
|
||||
@@ -1501,7 +1501,7 @@ public class StripeServiceImpl implements StripeService {
|
||||
public ProductCoupons updateCouponsInfo(Long id, String paidCommission, String cooperator, String remark, Long startTime){
|
||||
ProductCoupons productCoupons = productCouponsMapper.selectById(id);
|
||||
if (Objects.isNull(productCoupons)){
|
||||
throw new BusinessException("Unknown Promotion Code");
|
||||
throw new BusinessException("unknown.Promotion.Code");
|
||||
}
|
||||
boolean flag = false;
|
||||
if (!StringUtil.isNullOrEmpty(cooperator)){
|
||||
@@ -1691,7 +1691,7 @@ public class StripeServiceImpl implements StripeService {
|
||||
Stripe.apiKey = privateKey;
|
||||
ProductCoupons productCoupons = productCouponsMapper.selectById(id);
|
||||
if (Objects.isNull(productCoupons)){
|
||||
throw new BusinessException("unknown promotion code");
|
||||
throw new BusinessException("unknown.Promotion.Code");
|
||||
}
|
||||
try {
|
||||
Coupon coupon = Coupon.retrieve(productCoupons.getCouponId());
|
||||
|
||||
@@ -77,11 +77,11 @@ public class TrialOrderServiceImpl extends ServiceImpl<TrialOrderMapper, TrialOr
|
||||
List<Account> accountList = accountMapper.selectList(qw);
|
||||
if (CollectionUtil.isNotEmpty(accountList) && !accountList.get(0).getSystemUser().equals(0)) {
|
||||
if (accountList.get(0).getIsTrial() == 1) {
|
||||
throw new BusinessException("The email has already been registered", ResultEnum.PROMPT.getCode());
|
||||
throw new BusinessException("email.has.been.registered", ResultEnum.PROMPT.getCode());
|
||||
} else {
|
||||
Account account = accountList.get(0);
|
||||
if (null == account.getValidEndTime() || account.getValidEndTime() > System.currentTimeMillis()) {
|
||||
throw new BusinessException("The email has already been registered", ResultEnum.PROMPT.getCode());
|
||||
throw new BusinessException("email.has.been.registered", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
if (Objects.isNull(projectId) && !module.equals("designItemDetail")){
|
||||
log.warn("用户 {} 保存 {} 模块的画布时, projectId为空", userHolder.getId(), module);
|
||||
throw new BusinessException("project id cannot be empty", ResultEnum.PROMPT.getCode());
|
||||
throw new BusinessException("project.id.cannot.be.empty", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
|
||||
QueryWrapper<ExportFile> qw = new QueryWrapper<>();
|
||||
@@ -410,7 +410,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
CreditsEventsEnum creditsEventsEnum = fluxTask ? CreditsEventsEnum.TO_PRODUCT_IMAGE_FLUX : CreditsEventsEnum.TO_PRODUCT_IMAGE;
|
||||
Boolean preDeduction = creditsService.creditsPreDeduction(creditsEventsEnum, toProductImageDTO.getToProductImageVOList().size());
|
||||
if (!preDeduction) {
|
||||
throw new BusinessException("Your remaining credits are insufficient for this generation. Please recharge.", ResultEnum.WARNING.getCode());
|
||||
throw new BusinessException("remaining.credits.insufficient", ResultEnum.WARNING.getCode());
|
||||
}
|
||||
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
@@ -738,7 +738,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectOne(qw);
|
||||
if (Objects.isNull(toProductImageResult)) {
|
||||
throw new BusinessException("The source image does not exist.");
|
||||
throw new BusinessException("source.image.does.not.exist");
|
||||
}
|
||||
ToProductImageRecord toProductImageRecord = toProductImageRecordMapper.selectById(toProductImageResult.getToProductImageRecordId());
|
||||
if (Objects.isNull(toProductImageRecord)) {
|
||||
@@ -1090,7 +1090,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
CreditsEventsEnum creditsEventsEnum = fluxTask ? CreditsEventsEnum.RELIGHT_FLUX : CreditsEventsEnum.RELIGHT;
|
||||
Boolean preDeduction = creditsService.creditsPreDeduction(creditsEventsEnum, toProductImageDTO.getToProductImageVOList().size());
|
||||
if (!preDeduction) {
|
||||
throw new BusinessException("Your remaining credits are insufficient for this generation. Please recharge.", ResultEnum.WARNING.getCode());
|
||||
throw new BusinessException("remaining.credits.insufficient", ResultEnum.WARNING.getCode());
|
||||
}
|
||||
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
@@ -1257,7 +1257,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectOne(qw);
|
||||
if (Objects.isNull(toProductImageResult)) {
|
||||
throw new BusinessException("The source image does not exist.");
|
||||
throw new BusinessException("source.image.does.not.exist");
|
||||
}
|
||||
ToProductImageRecord toProductImageRecord = toProductImageRecordMapper.selectById(toProductImageResult.getToProductImageRecordId());
|
||||
if (Objects.isNull(toProductImageRecord)) {
|
||||
@@ -1726,10 +1726,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
if (Objects.nonNull(query.getEndDate())) {
|
||||
queryWrapper.le("update_time", new Date(query.getEndDate()));
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getProcess())) {
|
||||
if (Objects.nonNull(query.getProcess()) && !query.getProcess().isEmpty()) {
|
||||
// todo 获取历史列表,允许传入多个类型
|
||||
// queryWrapper.in("process", query.getProcess());
|
||||
queryWrapper.eq("process", query.getProcess());
|
||||
queryWrapper.in("process", query.getProcess());
|
||||
// queryWrapper.eq("process", query.getProcess());
|
||||
}
|
||||
// 新增分类过滤
|
||||
if (CollectionUtil.isNotEmpty(query.getClassificationIdList())) {
|
||||
|
||||
Reference in New Issue
Block a user