Merge branch 'dev/dev' into dev/dev_xp
# Conflicts: # src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java
This commit is contained in:
@@ -27,7 +27,8 @@ public enum LibraryLevel1TypeEnum {
|
||||
/**
|
||||
* 模特
|
||||
*/
|
||||
MODELS("Models");
|
||||
MODELS("Models"),
|
||||
DESIGN_ELEMENTS("DesignElements");
|
||||
|
||||
private String realName;
|
||||
|
||||
|
||||
48
src/main/java/com/ai/da/model/enums/DesignElementsEnum.java
Normal file
48
src/main/java/com/ai/da/model/enums/DesignElementsEnum.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum DesignElementsEnum {
|
||||
EMBROIDERY("刺绣", "Embroidery"),
|
||||
BEADING("钉珠", "Beading"),
|
||||
PEARL("珍珠", "Pearl"),
|
||||
RIVET("铆钉", "Rivet"),
|
||||
BUTTON("纽扣", "Button"),
|
||||
BELT("腰带", "Belt"),
|
||||
CORSAGE("胸花", "Corsage"),
|
||||
ZIPPER("拉链", "Zipper"),
|
||||
POCKET("口袋", "Pocket");
|
||||
|
||||
private final String chinese;
|
||||
private final String english;
|
||||
|
||||
// 构造函数
|
||||
DesignElementsEnum(String chinese, String english) {
|
||||
this.chinese = chinese;
|
||||
this.english = english;
|
||||
}
|
||||
|
||||
// 获取中文描述
|
||||
public String getChinese() {
|
||||
return chinese;
|
||||
}
|
||||
|
||||
// 获取英文描述
|
||||
public String getEnglish() {
|
||||
return english;
|
||||
}
|
||||
|
||||
// 重写toString方法,返回格式化的描述
|
||||
@Override
|
||||
public String toString() {
|
||||
return chinese + " (" + english + ")";
|
||||
}
|
||||
public static DesignElementsEnum fromName(String name) {
|
||||
for (DesignElementsEnum designElement : DesignElementsEnum.values()) {
|
||||
if (designElement.name().equals(name)) {
|
||||
return designElement;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("No enum constant for name: " + name);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import lombok.Getter;
|
||||
* @Date: 2023/10/31 14:16
|
||||
* @Description: 语言
|
||||
*/
|
||||
@Getter
|
||||
public enum Language implements IEnumDisplay {
|
||||
|
||||
ENGLISH("en", "US"), // 英文
|
||||
@@ -29,7 +30,7 @@ public enum Language implements IEnumDisplay {
|
||||
ITALIAN("it", "IT"); // 意大利语
|
||||
|
||||
private String languageCode;
|
||||
@Getter
|
||||
|
||||
private String countryCode;
|
||||
|
||||
Language(String languageCode, String countryCode) {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
public enum PrintboardLevel2TypeEnum {
|
||||
SLOGAN("标语", "Slogan"),
|
||||
LOGO("标志", "Logo"),
|
||||
PATTERN("图案", "Pattern");
|
||||
|
||||
private final String chinese;
|
||||
private final String english;
|
||||
|
||||
// 构造函数
|
||||
PrintboardLevel2TypeEnum(String chinese, String english) {
|
||||
this.chinese = chinese;
|
||||
this.english = english;
|
||||
}
|
||||
|
||||
// 获取中文描述
|
||||
public String getChinese() {
|
||||
return chinese;
|
||||
}
|
||||
|
||||
// 获取英文描述
|
||||
public String getEnglish() {
|
||||
return english;
|
||||
}
|
||||
|
||||
// 重写toString方法,返回格式化的描述
|
||||
@Override
|
||||
public String toString() {
|
||||
return chinese + " (" + english + ")";
|
||||
}
|
||||
|
||||
// 根据名称获取枚举值
|
||||
public static PrintboardLevel2TypeEnum fromName(String name) {
|
||||
for (PrintboardLevel2TypeEnum designElement : PrintboardLevel2TypeEnum.values()) {
|
||||
if (designElement.name().equals(name)) {
|
||||
return designElement;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("No enum constant for name: " + name);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import com.ai.da.mapper.primary.ClassificationRelLibraryMapper;
|
||||
import com.ai.da.mapper.primary.entity.Classification;
|
||||
import com.ai.da.mapper.primary.entity.ClassificationRelLibrary;
|
||||
import com.ai.da.model.dto.ClassificationDTO;
|
||||
import com.ai.da.model.enums.DesignElementsEnum;
|
||||
import com.ai.da.model.enums.Language;
|
||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||
import com.ai.da.model.vo.ClassificationVO;
|
||||
import com.ai.da.service.ClassificationService;
|
||||
@@ -106,7 +108,19 @@ public class ClassificationServiceImpl implements ClassificationService {
|
||||
List<Classification> classificationList = classificationMapper.selectList(qw);
|
||||
if (CollectionUtil.isNotEmpty(classificationList)) {
|
||||
// 获取结果集
|
||||
return getClassificationVOList(classificationList);
|
||||
List<ClassificationVO> classificationVOList = getClassificationVOList(classificationList);
|
||||
if (classificationDTO.getType().equals("DesignElements")) {
|
||||
for (ClassificationVO classificationVO : classificationVOList) {
|
||||
String classificationName = classificationVO.getClassificationName();
|
||||
DesignElementsEnum designElementsEnum = DesignElementsEnum.fromName(classificationName);
|
||||
if (userHolder.getLanguage().equals(Language.ENGLISH.name())) {
|
||||
classificationVO.setClassificationName(designElementsEnum.getEnglish());
|
||||
}else {
|
||||
classificationVO.setClassificationName(designElementsEnum.getChinese());
|
||||
}
|
||||
}
|
||||
}
|
||||
return classificationVOList;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -130,10 +130,10 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
queryWrapper.eq("level2_type", query.getModelSex());
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getLevel2Type())) {
|
||||
CollectionLevel2TypeEnum level2TypeEnum = CollectionLevel2TypeEnum.of(query.getLevel2Type());
|
||||
if (Objects.isNull(level2TypeEnum)) {
|
||||
throw new BusinessException("unknown.parameter.level2Type");
|
||||
}
|
||||
// CollectionLevel2TypeEnum level2TypeEnum = CollectionLevel2TypeEnum.of(query.getLevel2Type());
|
||||
// if (Objects.isNull(level2TypeEnum)) {
|
||||
// throw new BusinessException("unknown.parameter.level2Type");
|
||||
// }
|
||||
queryWrapper.eq("level2_type", query.getLevel2Type());
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getType())) {
|
||||
@@ -228,13 +228,13 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
if (Objects.isNull(level1TypeEnum)) {
|
||||
throw new BusinessException("unknown.parameter.level1Type");
|
||||
}
|
||||
if (!StringUtils.isEmpty(libraryUploadDTO.getLevel2Type())) {
|
||||
CollectionLevel2TypeEnum level2TypeEnum = CollectionLevel2TypeEnum.of(libraryUploadDTO.getLevel2Type());
|
||||
if (Objects.isNull(level2TypeEnum)) {
|
||||
throw new BusinessException("unknown.parameter.level2Type");
|
||||
}
|
||||
}
|
||||
if (level1TypeEnum.equals(LibraryLevel1TypeEnum.SKETCH_BOARD) && StringUtils.isEmpty(libraryUploadDTO.getLevel2Type())) {
|
||||
// if (!StringUtils.isEmpty(libraryUploadDTO.getLevel2Type())) {
|
||||
// CollectionLevel2TypeEnum level2TypeEnum = CollectionLevel2TypeEnum.of(libraryUploadDTO.getLevel2Type());
|
||||
// if (Objects.isNull(level2TypeEnum)) {
|
||||
// throw new BusinessException("unknown.parameter.level2Type");
|
||||
// }
|
||||
// }
|
||||
if ((level1TypeEnum.equals(LibraryLevel1TypeEnum.SKETCH_BOARD) || level1TypeEnum.equals(LibraryLevel1TypeEnum.PRINT_BOARD) || level1TypeEnum.equals(LibraryLevel1TypeEnum.DESIGN_ELEMENTS)) && StringUtils.isEmpty(libraryUploadDTO.getLevel2Type())) {
|
||||
throw new BusinessException("level2Type.cannot.be.empty");
|
||||
}
|
||||
String path = calculateFileUrl(level1TypeEnum, libraryUploadDTO.getLevel2Type(), libraryUploadDTO.getModelSex(), userInfo.getId());
|
||||
@@ -244,6 +244,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
case MOOD_BOARD:
|
||||
case PRINT_BOARD:
|
||||
case SKETCH_BOARD:
|
||||
case DESIGN_ELEMENTS:
|
||||
bucketName = users;
|
||||
break;
|
||||
case MARKETING_SKETCH:
|
||||
|
||||
@@ -276,7 +276,6 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
|
||||
@Override
|
||||
public WorkspaceVO getByIdNew(Long id) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
QueryWrapper<Workspace> qwOld = new QueryWrapper<>();
|
||||
qwOld.lambda().eq(Workspace::getAccountId, accountId);
|
||||
@@ -287,21 +286,26 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
Workspace newIsLastIndex = workspaceMapper.selectById(id);
|
||||
newIsLastIndex.setIsLastIndex(1);
|
||||
workspaceMapper.updateById(newIsLastIndex);
|
||||
WorkspaceVO workspaceVO = CopyUtil.copyObject(newIsLastIndex, WorkspaceVO.class);
|
||||
QueryWrapper<WorkspaceRelStyle> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(WorkspaceRelStyle::getWorkspaceId, workspaceVO.getId());
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(qw);
|
||||
if (!CollectionUtils.isEmpty(workspaceRelStyles)) {
|
||||
Long styleId = workspaceRelStyles.get(0).getStyleId();
|
||||
Style style = styleMapper.selectById(styleId);
|
||||
StyleEnum styleEnum = StyleEnum.fromName(style.getName());
|
||||
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
||||
workspaceVO.setStyleName(styleEnum.getEnglish());
|
||||
}else {
|
||||
workspaceVO.setStyleName(styleEnum.getChinese());
|
||||
WorkspaceVO vo = CopyUtil.copyObject(newIsLastIndex, WorkspaceVO.class);
|
||||
if (vo.getMannequinFemaleId() != null) {
|
||||
if (vo.getMannequinFemaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
vo.setFemalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
} else if (vo.getMannequinFemaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
vo.setFemalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
return workspaceVO;
|
||||
if (vo.getMannequinMaleId() != null) {
|
||||
if (vo.getMannequinMaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
vo.setMalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
} else if (vo.getMannequinMaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
vo.setMalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
Sex sex = Sex.getSex(vo.getSex());
|
||||
Position position = Position.getPosition(vo.getPosition());
|
||||
vo.setSexEnum(new BizJson(sex.getValue(), sex.name(), BusinessException.getMessageFromResource(sex.name())));
|
||||
vo.setPositionEnum(new BizJson(position.getValue(), position.name(), BusinessException.getMessageFromResource(position.name())));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user