diff --git a/src/main/java/com/ai/da/common/RabbitMQ/SRConsumer.java b/src/main/java/com/ai/da/common/RabbitMQ/SRConsumer.java index 0bd56344..6b904714 100644 --- a/src/main/java/com/ai/da/common/RabbitMQ/SRConsumer.java +++ b/src/main/java/com/ai/da/common/RabbitMQ/SRConsumer.java @@ -208,7 +208,7 @@ public class SRConsumer { redisUtil.removeFromZSet(consumptionOrderKey, uniqueId); } catch (Exception exception) { log.error("手动确认,取消返回队列,不再重新消费"); - throw new BusinessException("发生错误,手动确认消息"); + throw new BusinessException("message.confirm.fail"); } // 将入参和错误信息存入redis String exceptionMessage = JSONObject.toJSONString(superResolutionDTO) + diff --git a/src/main/java/com/ai/da/common/utils/MinioUtil.java b/src/main/java/com/ai/da/common/utils/MinioUtil.java index 39927ff5..a2946fb1 100644 --- a/src/main/java/com/ai/da/common/utils/MinioUtil.java +++ b/src/main/java/com/ai/da/common/utils/MinioUtil.java @@ -2,6 +2,7 @@ package com.ai.da.common.utils; import com.ai.da.common.config.exception.BusinessException; import com.ai.da.common.constant.CommonConstant; +import com.ai.da.common.response.ResultEnum; import com.ai.da.mapper.primary.entity.ObjectItem; import io.minio.*; import io.minio.errors.*; @@ -361,7 +362,7 @@ public class MinioUtil { public void deleteObject(String path) { if (!path.contains("/")) { - throw new BusinessException("The path is error!"); + throw new BusinessException("the.path.is.error"); } int index = path.indexOf("/"); String bucketName = path.substring(0, index); @@ -420,7 +421,7 @@ public class MinioUtil { return LocalCacheUtils.getPresignedUrlCache(path); } else { if (!path.contains("/")) { - throw new BusinessException("The path is error!"); + throw new BusinessException("the.path.is.error"); } int index = path.indexOf("/"); String bucketName = path.substring(0, index); @@ -434,7 +435,7 @@ public class MinioUtil { public String getPreSignedUrl(String path, int expiry, boolean resetCache) { if (resetCache || LocalCacheUtils.getPresignedUrlCache(path) == null) { if (!path.contains("/")) { - throw new BusinessException("The path is error!"); + throw new BusinessException("the.path.is.error"); } int index = path.indexOf("/"); String bucketName = path.substring(0, index); @@ -675,7 +676,7 @@ public class MinioUtil { .build()); } catch (MinioException | IOException | NoSuchAlgorithmException | InvalidKeyException e){ log.error("图片上传到minio出错,{}", e.getMessage()); - throw new BusinessException("file upload exception"); + throw new BusinessException("file.upload.fail"); } } @@ -713,7 +714,7 @@ public class MinioUtil { // return base64Image; } catch (Exception e) { log.error(e.getMessage()); - throw new BusinessException("透明图添加白色背景失败"); + throw new BusinessException("white.bg.add.fail", ResultEnum.PROMPT.getCode()); } } diff --git a/src/main/java/com/ai/da/common/utils/S3Util.java b/src/main/java/com/ai/da/common/utils/S3Util.java index 7e084f6f..da00c388 100644 --- a/src/main/java/com/ai/da/common/utils/S3Util.java +++ b/src/main/java/com/ai/da/common/utils/S3Util.java @@ -215,7 +215,7 @@ public class S3Util { public void deleteObject(String path) { if (!path.contains("/")) { - throw new BusinessException("The path is error!"); + throw new BusinessException("the.path.is.error"); } int index = path.indexOf("/"); String bucketName = path.substring(0, index); @@ -244,7 +244,7 @@ public class S3Util { return LocalCacheUtils.getPresignedUrlCache(path); } else { if (!path.contains("/")) { - throw new BusinessException("The path is error!"); + throw new BusinessException("the.path.is.error"); } int index = path.indexOf("/"); String bucketName = path.substring(0, index); @@ -258,7 +258,7 @@ public class S3Util { public String getPreSignedUrl(String path, int expiry, boolean resetCache) { if (resetCache || LocalCacheUtils.getPresignedUrlCache(path) == null) { if (!path.contains("/")) { - throw new BusinessException("The path is error!"); + throw new BusinessException("the.path.is.error"); } int index = path.indexOf("/"); String bucketName = path.substring(0, index); diff --git a/src/main/java/com/ai/da/model/dto/ProjectQueryDTO.java b/src/main/java/com/ai/da/model/dto/ProjectQueryDTO.java index 9cc869aa..916c254c 100644 --- a/src/main/java/com/ai/da/model/dto/ProjectQueryDTO.java +++ b/src/main/java/com/ai/da/model/dto/ProjectQueryDTO.java @@ -38,8 +38,8 @@ public class ProjectQueryDTO extends PageQueryBaseVo { private Integer intersection; // todo 获取历史列表,允许传入多个类型 -// private List process; - private String process; + private List process; +// private String process; private Integer asc; } diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java index 45d8a75a..10dad374 100644 --- a/src/main/java/com/ai/da/python/PythonService.java +++ b/src/main/java/com/ai/da/python/PythonService.java @@ -631,7 +631,7 @@ public class PythonService { case SYS_FILE: return processNoPinOrSysFileAttributeRecognition(attributeRecognition, elementVO, styleCategory, systemScale); default: - throw new BusinessException("unknown designPictureType"); + throw new BusinessException("unknown.designPictureType"); } } @@ -674,7 +674,7 @@ public class PythonService { String recommendSystemSketch = recommentdUrlList.get(0); return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, styleCategory, elementVO); }else { - throw new BusinessException("Failed to obtain system sketch recommendation."); + throw new BusinessException("failed.to.obtain.system.sketch.recommendation"); } }else { if (CollectionUtil.isNotEmpty(collectionElements)) { @@ -688,7 +688,7 @@ public class PythonService { String recommendSystemSketch = recommentdUrlList.get(0); return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, styleCategory, elementVO); }else { - throw new BusinessException("Failed to obtain system sketch recommendation."); + throw new BusinessException("failed.to.obtain.system.sketch.recommendation"); } } } @@ -1044,7 +1044,7 @@ public class PythonService { String recommendSystemSketch = recommentdUrlList.get(0); return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO); }else { - throw new BusinessException("Failed to obtain system sketch recommendation."); + throw new BusinessException("failed.to.obtain.system.sketch.recommendation"); } // JSONObject attributeRecognition = getAttributeRecognitionBySameCategory(element, validateElementVO.getModelSex()); // return processAttributeRecognitionBySameCategory(attributeRecognition, validateElementVO, element.getLevel2Type()); @@ -1067,7 +1067,7 @@ public class PythonService { String recommendSystemSketch = recommentdUrlList.get(0); return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO); }else { - throw new BusinessException("Failed to obtain system sketch recommendation."); + throw new BusinessException("failed.to.obtain.system.sketch.recommendation"); } // String tableName = getTableName(validateElementVO.getModelSex(), category); @@ -1103,7 +1103,7 @@ public class PythonService { String recommendSystemSketch = recommentdUrlList.get(0); return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO); }else { - throw new BusinessException("Failed to obtain system sketch recommendation."); + throw new BusinessException("failed.to.obtain.system.sketch.recommendation"); } // JSONObject attributeRecognition = getAttributeRecognitionBySameCategory(element, validateElementVO.getModelSex()); // return processAttributeRecognitionBySameCategory(attributeRecognition, validateElementVO, element.getLevel2Type()); @@ -1127,7 +1127,7 @@ public class PythonService { String recommendSystemSketch = recommentdUrlList.get(0); return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO); }else { - throw new BusinessException("Failed to obtain system sketch recommendation."); + throw new BusinessException("failed.to.obtain.system.sketch.recommendation"); } // String tableName = getTableName(validateElementVO.getModelSex(), category); // @@ -2848,7 +2848,7 @@ public class PythonService { if (!Objects.isNull(designSingleItem.getGradient())) { String colorImg = designSingleItem.getGradient().getColorImg(); if (StringUtil.isNullOrEmpty(colorImg)) { - throw new BusinessException("The base64 data of the image is empty"); + throw new BusinessException("base64.data.empty"); } minioPath = minioUtil.base64UploadToPath(colorImg, gradientBucketName, null); designSingleItem.getGradient().setColorImg(null); @@ -2978,7 +2978,7 @@ public class PythonService { } } 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"); } } } @@ -3425,7 +3425,7 @@ public class PythonService { return response; } - private List setGenerateImageList(JSONObject jsonObject) { +/* private List setGenerateImageList(JSONObject jsonObject) { List imageUrlList = JSONObject.parseArray(jsonObject.get("list").toString(), String.class); if (imageUrlList.isEmpty()) { log.error("PythonService##generateSketchOrPrint异常###{}", "diffusion response list is null"); @@ -3434,7 +3434,7 @@ public class PythonService { } return imageUrlList; - } + }*/ /** 废弃状态 */ public String composeLayers(List layersDetail) { HashMap> layers = new HashMap<>(); diff --git a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java index c9b4d716..0306243e 100644 --- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java @@ -152,7 +152,7 @@ public class AccountServiceImpl extends ServiceImpl 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 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 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 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 impl List 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 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 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 qw = new QueryWrapper<>(); qw.lambda().eq(AccountExtend::getAuth, unionId); diff --git a/src/main/java/com/ai/da/service/impl/CreditsServiceImpl.java b/src/main/java/com/ai/da/service/impl/CreditsServiceImpl.java index 49547583..1cfbc068 100644 --- a/src/main/java/com/ai/da/service/impl/CreditsServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/CreditsServiceImpl.java @@ -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 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 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 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(); diff --git a/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java b/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java index e483fcf9..c6c0e485 100644 --- a/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java @@ -307,7 +307,8 @@ public class GenerateServiceImpl extends ServiceImpl 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 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 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 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) { diff --git a/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java b/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java index bff32d27..ed3e042f 100644 --- a/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java @@ -84,7 +84,7 @@ public class MessageCenterServiceImpl extends ServiceImpl 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(); // 查动态 diff --git a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java index 25e40f40..82396755 100644 --- a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java @@ -159,7 +159,7 @@ public class PortfolioServiceImpl extends ServiceImpl 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 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 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()); } } } diff --git a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java index 8c8b0bf4..fc75e4fe 100644 --- a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java @@ -359,7 +359,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl qw = new QueryWrapper<>(); @@ -410,7 +410,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl