恢复修改设置会多一个模特fix判断模特是否存在的方式
This commit is contained in:
@@ -154,14 +154,14 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
rel.setWorkspaceId(workspace.getId());
|
rel.setWorkspaceId(workspace.getId());
|
||||||
rel.setStyleId(workspaceDTO.getStyleId());
|
rel.setStyleId(workspaceDTO.getStyleId());
|
||||||
workspaceRelStyleMapper.insert(rel);
|
workspaceRelStyleMapper.insert(rel);
|
||||||
}else {
|
} else {
|
||||||
WorkspaceRelStyle workspaceRelStyle = workspaceRelStyles.get(0);
|
WorkspaceRelStyle workspaceRelStyle = workspaceRelStyles.get(0);
|
||||||
if (!Objects.equals(workspaceRelStyle.getStyleId(), workspaceDTO.getStyleId())) {
|
if (!Objects.equals(workspaceRelStyle.getStyleId(), workspaceDTO.getStyleId())) {
|
||||||
workspaceRelStyle.setStyleId(workspaceDTO.getStyleId());
|
workspaceRelStyle.setStyleId(workspaceDTO.getStyleId());
|
||||||
workspaceRelStyleMapper.updateById(workspaceRelStyle);
|
workspaceRelStyleMapper.updateById(workspaceRelStyle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
QueryWrapper<WorkspaceRelStyle> qw = new QueryWrapper<>();
|
QueryWrapper<WorkspaceRelStyle> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(WorkspaceRelStyle::getWorkspaceId, workspace.getId());
|
qw.lambda().eq(WorkspaceRelStyle::getWorkspaceId, workspace.getId());
|
||||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(qw);
|
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(qw);
|
||||||
@@ -344,7 +344,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
vo.setAllKeywordsByStyle(allKeywordsByStyle);
|
vo.setAllKeywordsByStyle(allKeywordsByStyle);
|
||||||
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
||||||
vo.setStyleName(styleEnum.getEnglish());
|
vo.setStyleName(styleEnum.getEnglish());
|
||||||
}else {
|
} else {
|
||||||
vo.setStyleName(styleEnum.getChinese());
|
vo.setStyleName(styleEnum.getChinese());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -401,7 +401,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
vo.setAllKeywordsByStyle(allKeywordsByStyle);
|
vo.setAllKeywordsByStyle(allKeywordsByStyle);
|
||||||
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
||||||
vo.setStyleName(styleEnum.getEnglish());
|
vo.setStyleName(styleEnum.getEnglish());
|
||||||
}else {
|
} else {
|
||||||
vo.setStyleName(styleEnum.getChinese());
|
vo.setStyleName(styleEnum.getChinese());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -685,7 +685,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
StyleEnum styleEnum = StyleEnum.fromName(styleVO.getName());
|
StyleEnum styleEnum = StyleEnum.fromName(styleVO.getName());
|
||||||
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
||||||
styleVO.setValue(styleEnum.getEnglish());
|
styleVO.setValue(styleEnum.getEnglish());
|
||||||
}else {
|
} else {
|
||||||
styleVO.setValue(styleEnum.getChinese());
|
styleVO.setValue(styleEnum.getChinese());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -713,7 +713,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
|
|
||||||
if (CollectionUtils.isEmpty(workspaces)) {
|
if (CollectionUtils.isEmpty(workspaces)) {
|
||||||
throw new BusinessException("Lack of associated workspace.");
|
throw new BusinessException("Lack of associated workspace.");
|
||||||
}else {
|
} else {
|
||||||
Workspace workspace = workspaces.get(0);
|
Workspace workspace = workspaces.get(0);
|
||||||
Workspace workspaceNew = CopyUtil.copyObject(projectDTO.getWorkspace(), Workspace.class);
|
Workspace workspaceNew = CopyUtil.copyObject(projectDTO.getWorkspace(), Workspace.class);
|
||||||
if (projectDTO.getProcess().equals(DesignProcess.SERIES_DESIGN.name()) || projectDTO.getProcess().equals(DesignProcess.SKETCH_COLLAGE_PROCESS.name())) {
|
if (projectDTO.getProcess().equals(DesignProcess.SERIES_DESIGN.name()) || projectDTO.getProcess().equals(DesignProcess.SKETCH_COLLAGE_PROCESS.name())) {
|
||||||
@@ -722,12 +722,8 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
// deleteMannequinByProjectId(projectId);
|
// deleteMannequinByProjectId(projectId);
|
||||||
if (!workspaceNew.getSex().equals(workspace.getSex())) {
|
if (!workspaceNew.getSex().equals(workspace.getSex())) {
|
||||||
// deleteSketchByProjectId(projectId);
|
// deleteSketchByProjectId(projectId);
|
||||||
|
SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup());
|
||||||
LambdaQueryWrapper<CollectionElement> queryWrapper = new LambdaQueryWrapper<CollectionElement>().eq(CollectionElement::getProjectId, projectId)
|
if (!checkIfModelExistsInProject(sysFile.getMd5(), projectId)) {
|
||||||
.eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MODEL.getRealName())
|
|
||||||
.eq(CollectionElement::getLevel3Type, workspaceNew.getSex());
|
|
||||||
if (collectionElementMapper.selectCount(queryWrapper) == 0){
|
|
||||||
SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup());
|
|
||||||
CollectionElement collectionElement = new CollectionElement();
|
CollectionElement collectionElement = new CollectionElement();
|
||||||
collectionElement.setAccountId(userInfo.getId());
|
collectionElement.setAccountId(userInfo.getId());
|
||||||
collectionElement.setProjectId(projectId);
|
collectionElement.setProjectId(projectId);
|
||||||
@@ -763,14 +759,14 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
rel.setWorkspaceId(projectDTO.getWorkspace().getId());
|
rel.setWorkspaceId(projectDTO.getWorkspace().getId());
|
||||||
rel.setStyleId(projectDTO.getStyleId());
|
rel.setStyleId(projectDTO.getStyleId());
|
||||||
workspaceRelStyleMapper.insert(rel);
|
workspaceRelStyleMapper.insert(rel);
|
||||||
}else {
|
} else {
|
||||||
WorkspaceRelStyle workspaceRelStyleOld = workspaceRelStyles.get(0);
|
WorkspaceRelStyle workspaceRelStyleOld = workspaceRelStyles.get(0);
|
||||||
if (!Objects.equals(workspaceRelStyleOld.getStyleId(), projectDTO.getStyleId())) {
|
if (!Objects.equals(workspaceRelStyleOld.getStyleId(), projectDTO.getStyleId())) {
|
||||||
workspaceRelStyleOld.setStyleId(projectDTO.getStyleId());
|
workspaceRelStyleOld.setStyleId(projectDTO.getStyleId());
|
||||||
workspaceRelStyleMapper.updateById(workspaceRelStyleOld);
|
workspaceRelStyleMapper.updateById(workspaceRelStyleOld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
QueryWrapper<WorkspaceRelStyle> wRSQW = new QueryWrapper<>();
|
QueryWrapper<WorkspaceRelStyle> wRSQW = new QueryWrapper<>();
|
||||||
wRSQW.lambda().eq(WorkspaceRelStyle::getWorkspaceId, projectDTO.getWorkspace().getId());
|
wRSQW.lambda().eq(WorkspaceRelStyle::getWorkspaceId, projectDTO.getWorkspace().getId());
|
||||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(wRSQW);
|
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(wRSQW);
|
||||||
@@ -784,7 +780,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
}
|
}
|
||||||
vo.setId(projectId);
|
vo.setId(projectId);
|
||||||
return vo;
|
return vo;
|
||||||
}else {
|
} else {
|
||||||
Project project = CopyUtil.copyObject(projectDTO, Project.class);
|
Project project = CopyUtil.copyObject(projectDTO, Project.class);
|
||||||
project.setAccountId(userInfo.getId());
|
project.setAccountId(userInfo.getId());
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
@@ -821,7 +817,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
if (projectDTO.getWorkspace().getSex().equals(Sex.FEMALE.getValue())) {
|
if (projectDTO.getWorkspace().getSex().equals(Sex.FEMALE.getValue())) {
|
||||||
workspace.setMannequinFemaleId(sysFile.getId());
|
workspace.setMannequinFemaleId(sysFile.getId());
|
||||||
workspace.setMannequinFemaleType("System");
|
workspace.setMannequinFemaleType("System");
|
||||||
}else {
|
} else {
|
||||||
workspace.setMannequinMaleId(sysFile.getId());
|
workspace.setMannequinMaleId(sysFile.getId());
|
||||||
workspace.setMannequinMaleType("System");
|
workspace.setMannequinMaleType("System");
|
||||||
}
|
}
|
||||||
@@ -879,6 +875,17 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 由于在数据库中表设计问题,目前只能通过路径来判断项目中是否存在某一个模特
|
||||||
|
public Boolean checkIfModelExistsInProject(String md5, Long projectId) {
|
||||||
|
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||||
|
qw.lambda().eq(CollectionElement::getProjectId, projectId)
|
||||||
|
.eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MODEL.getRealName())
|
||||||
|
.eq(CollectionElement::getMd5, md5);
|
||||||
|
|
||||||
|
List<CollectionElement> collectionElements = collectionElementMapper.selectList(qw);
|
||||||
|
return collectionElements != null && !collectionElements.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
public static List<File> getPNGFiles(String directoryPath) {
|
public static List<File> getPNGFiles(String directoryPath) {
|
||||||
List<File> pngFiles = new ArrayList<>();
|
List<File> pngFiles = new ArrayList<>();
|
||||||
File directory = new File(directoryPath);
|
File directory = new File(directoryPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user