TASK: library关联分类;

This commit is contained in:
shahaibo
2023-11-14 14:33:56 +08:00
parent bcfcb5da12
commit 5dbf76c4e2
8 changed files with 188 additions and 170 deletions

View File

@@ -5,6 +5,7 @@ import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.enums.LoginTypeEnum;
import com.ai.da.common.enums.AuthenticationOperationTypeEnum;
import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.security.jwt.JWTTokenHelper;
import com.ai.da.common.utils.*;
import com.ai.da.mapper.AccountMapper;
@@ -64,7 +65,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountMapper.updateById(account);
} else {
if (!account.getUserPassword().equals(accountDTO.getPassword())) {
throw new BusinessException("password.error");
throw new BusinessException("password.error", ResultEnum.PROMPT.getCode());
}
}
/*发送邮件*/
@@ -72,7 +73,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
log.info(account.getUserEmail());
log.info(accountDTO.getEmail());
if (!account.getUserEmail().equals(accountDTO.getEmail())) {
throw new BusinessException("email.error");
throw new BusinessException("email.error", ResultEnum.PROMPT.getCode());
}
if (Objects.isNull(authenticationOperationTypeEnum)) {
throw new BusinessException("unknown.authentication.operation.type");
@@ -137,11 +138,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
//校验邮箱验证码
String verifyCode = LocalCacheUtils.getVerifyCodeCache(AuthenticationOperationTypeEnum.LOGIN.name() + "_" + accountLoginDTO.getEmail());
if (StringUtils.isBlank(verifyCode)) {
throw new BusinessException("the.verification.code.has.expired");
throw new BusinessException("the.verification.code.has.expired", ResultEnum.PROMPT.getCode());
}
if (!"921314".equals(accountLoginDTO.getEmailVerifyCode())) {
if (!verifyCode.equals(accountLoginDTO.getEmailVerifyCode())) {
throw new BusinessException("verification.code.error");
throw new BusinessException("verification.code.error", ResultEnum.PROMPT.getCode());
}
}
break;
@@ -211,7 +212,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
public Boolean bindEmail(AccountBindEmailDTO accountBindEmailDTO) {
Account account = baseMapper.selectById(accountBindEmailDTO.getUserId());
if (Objects.isNull(account)) {
throw new BusinessException("userName.does.not.exist");
throw new BusinessException("userName.does.not.exist", ResultEnum.PROMPT.getCode());
}
if (StringUtils.isNotBlank(account.getUserEmail())) {
throw new BusinessException("user.has.bound.mailbox");
@@ -219,10 +220,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
//校验邮箱验证码
String verifyCode = LocalCacheUtils.getVerifyCodeCache(AuthenticationOperationTypeEnum.BIND_MAILBOX.name() + "_" + accountBindEmailDTO.getUserEmail());
if (StringUtils.isBlank(verifyCode)) {
throw new BusinessException("the.verification.code.has.expired");
throw new BusinessException("the.verification.code.has.expired", ResultEnum.PROMPT.getCode());
}
if (!verifyCode.equals(accountBindEmailDTO.getEmailVerifyCode())) {
throw new BusinessException("verification.code.error");
throw new BusinessException("verification.code.error", ResultEnum.PROMPT.getCode());
}
//绑定
updatePwdByUserId(accountBindEmailDTO.getUserEmail(), accountBindEmailDTO.getUserId());
@@ -236,10 +237,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
//校验邮箱验证码
String verifyCode = LocalCacheUtils.getVerifyCodeCache(AuthenticationOperationTypeEnum.FORGET_PWD.name() + "_" + accountDTO.getEmail());
if (StringUtils.isBlank(verifyCode)) {
throw new BusinessException("the.verification.code.has.expired");
throw new BusinessException("the.verification.code.has.expired", ResultEnum.PROMPT.getCode());
}
if (!verifyCode.equals(accountDTO.getEmailVerifyCode())) {
throw new BusinessException("verification.code.error");
throw new BusinessException("verification.code.error", ResultEnum.PROMPT.getCode());
}
updatePwdByEmail(accountDTO.getPassword(), accountDTO.getEmail());
return Boolean.TRUE;
@@ -267,7 +268,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
queryWrapper.lambda().last("limit 1");
List<Account> accountList = accountMapper.selectList(queryWrapper);
if (CollectionUtil.isEmpty(accountList)) {
throw new BusinessException("email.does.not.exist");
throw new BusinessException("email.does.not.exist", ResultEnum.PROMPT.getCode());
}
return accountList.get(0);
}
@@ -278,7 +279,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
queryWrapper.lambda().last("limit 1");
List<Account> accountList = accountMapper.selectList(queryWrapper);
if (CollectionUtil.isEmpty(accountList)) {
throw new BusinessException("userName.does.not.exist");
throw new BusinessException("userName.does.not.exist", ResultEnum.PROMPT.getCode());
}
return accountList.get(0);
}

View File

@@ -6,6 +6,7 @@ package com.ai.da.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.utils.CopyUtil;
import com.ai.da.mapper.ClassificationMapper;
import com.ai.da.mapper.ClassificationRelLibraryMapper;
@@ -84,7 +85,7 @@ public class ClassificationServiceImpl implements ClassificationService {
if (0 == classificationDTO.getDeleteConfirm()) {
// 校验删除的分类是否有关联的library数据
if (CollectionUtil.isNotEmpty(classificationRelLibraryList)) {
throw new BusinessException("the.classification.you.deleted.has.associated.library");
throw new BusinessException("the.classification.you.deleted.has.associated.library", ResultEnum.WARNING.getCode());
}
}else {
if (CollectionUtil.isNotEmpty(classificationRelLibraryList)) {
@@ -229,7 +230,7 @@ public class ClassificationServiceImpl implements ClassificationService {
qw.lambda().eq(Classification::getClassificationName, classificationDTO.getClassificationName());
List<Classification> classificationList = classificationMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(classificationList)) {
throw new BusinessException("classificationName.already.exists");
throw new BusinessException("classificationName.already.exists", ResultEnum.WARNING.getCode());
}
}
}

View File

@@ -5,6 +5,7 @@ import com.ai.da.common.config.FileProperties;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.enums.*;
import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.utils.*;
import com.ai.da.mapper.CollectionElementMapper;
import com.ai.da.mapper.GenerateDetailMapper;
@@ -415,7 +416,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
.filter(skecth -> skecth.getIsPin() == 1
&& DesignPythonItem.OUTWEAR.contains(skecth.getLevel2Type())).count();
if (topNum > 8 || bottomNum > 8 || outerwearNum > 8) {
throw new BusinessException("the.number.of.PIN.top.or.bottom.or.outerwear.sketchBoard.cannot.be.more.than.8");
throw new BusinessException("the.number.of.PIN.top.or.bottom.or.outerwear.sketchBoard.cannot.be.more.than.8", ResultEnum.PROMPT.getCode());
}
//校验designType
Boolean result = designDTO.getSketchBoards().stream()

View File

@@ -8,6 +8,7 @@ import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.enums.*;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.utils.CopyUtil;
import com.ai.da.common.utils.DateUtil;
import com.ai.da.common.utils.MinioUtil;
@@ -133,8 +134,11 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
queryWrapper.like("name", query.getPictureName());
}
// 新增分类过滤
if (null != query.getClassificationId()) {
List<Long> libraryIdList = classificationService.getLibraryIdListByClassificationId(query.getClassificationId());
if (CollectionUtil.isNotEmpty(query.getClassificationIdList())) {
List<Long> libraryIdList = new ArrayList<>();
for (Long classificationId : query.getClassificationIdList()) {
libraryIdList.addAll(classificationService.getLibraryIdListByClassificationId(classificationId));
}
queryWrapper.lambda().in(Library::getId, libraryIdList);
}
queryWrapper.orderByDesc("id");
@@ -359,7 +363,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
List<Workspace> workspaceList = workspaceService.list(qw);
if (CollectionUtil.isNotEmpty(workspaceList)) {
if (deleteModelConfirm.equals(0)) {
throw new BusinessException("the.model.has.been.referenced.by.the.workspace");
throw new BusinessException("the.model.has.been.referenced.by.the.workspace", ResultEnum.WARNING.getCode());
}
if (value.equals(Sex.FEMALE.getValue())) {
QueryWrapper<SysFile> systemFemaleQw = new QueryWrapper<>();

View File

@@ -2,6 +2,7 @@ package com.ai.da.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.utils.CopyUtil;
import com.ai.da.common.utils.PantoneUtils;
import com.ai.da.mapper.entity.ColorLookupTable;
@@ -140,7 +141,7 @@ public class PanToneServiceImpl extends ServiceImpl<PanToneMapper, PanTone> impl
@Override
public List<PantoneVO> getRgbByHsvBatch(List<GetRgbByHsvBatchDTO> hsvBatch) {
if (hsvBatch.size() > 8) {
throw new BusinessException("hsv.value.cannot.exceed.the.maximum.of.8");
throw new BusinessException("hsv.value.cannot.exceed.the.maximum.of.8", ResultEnum.PROMPT.getCode());
}
List<Integer> colorValues = Lists.newArrayList();
Map<Integer, GetRgbByHsvBatchDTO> valueToHsv = Maps.newHashMap();

View File

@@ -6,6 +6,7 @@ import com.ai.da.common.enums.LibraryLevel1TypeEnum;
import com.ai.da.common.enums.SysFileLevel1TypeEnum;
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.ResultEnum;
import com.ai.da.common.utils.CopyUtil;
import com.ai.da.common.utils.FileUtil;
import com.ai.da.common.utils.MD5Utils;
@@ -135,7 +136,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
qw.lambda().eq(Workspace::getUserName, userName);
List<Workspace> workspaces = baseMapper.selectList(qw);
if (!CollectionUtils.isEmpty(workspaces)) {
throw new BusinessException("the.workspaceName.already.exists");
throw new BusinessException("the.workspaceName.already.exists", ResultEnum.WARNING.getCode());
}
}
@@ -474,7 +475,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
qw.lambda().eq(Workspace::getIsLastIndex, 1);
List<Workspace> workspaces = workspaceMapper.selectList(qw);
if (!CollectionUtils.isEmpty(workspaces)) {
throw new BusinessException("unable.to.delete.the.workspace.you.are.currently.using");
throw new BusinessException("unable.to.delete.the.workspace.you.are.currently.using", ResultEnum.WARNING.getCode());
}
workspaceMapper.deleteBatchIds(deleteIds);
return deleteIds;