恢复修改设置会多一个模特fix判断模特是否存在的方式
This commit is contained in:
@@ -154,14 +154,14 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
rel.setWorkspaceId(workspace.getId());
|
||||
rel.setStyleId(workspaceDTO.getStyleId());
|
||||
workspaceRelStyleMapper.insert(rel);
|
||||
}else {
|
||||
} else {
|
||||
WorkspaceRelStyle workspaceRelStyle = workspaceRelStyles.get(0);
|
||||
if (!Objects.equals(workspaceRelStyle.getStyleId(), workspaceDTO.getStyleId())) {
|
||||
workspaceRelStyle.setStyleId(workspaceDTO.getStyleId());
|
||||
workspaceRelStyleMapper.updateById(workspaceRelStyle);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
QueryWrapper<WorkspaceRelStyle> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(WorkspaceRelStyle::getWorkspaceId, workspace.getId());
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(qw);
|
||||
@@ -344,7 +344,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
vo.setAllKeywordsByStyle(allKeywordsByStyle);
|
||||
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
||||
vo.setStyleName(styleEnum.getEnglish());
|
||||
}else {
|
||||
} else {
|
||||
vo.setStyleName(styleEnum.getChinese());
|
||||
}
|
||||
}
|
||||
@@ -401,7 +401,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
vo.setAllKeywordsByStyle(allKeywordsByStyle);
|
||||
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
||||
vo.setStyleName(styleEnum.getEnglish());
|
||||
}else {
|
||||
} else {
|
||||
vo.setStyleName(styleEnum.getChinese());
|
||||
}
|
||||
}
|
||||
@@ -685,7 +685,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
StyleEnum styleEnum = StyleEnum.fromName(styleVO.getName());
|
||||
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
|
||||
styleVO.setValue(styleEnum.getEnglish());
|
||||
}else {
|
||||
} else {
|
||||
styleVO.setValue(styleEnum.getChinese());
|
||||
}
|
||||
}
|
||||
@@ -713,7 +713,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
|
||||
if (CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("Lack of associated workspace.");
|
||||
}else {
|
||||
} else {
|
||||
Workspace workspace = workspaces.get(0);
|
||||
Workspace workspaceNew = CopyUtil.copyObject(projectDTO.getWorkspace(), Workspace.class);
|
||||
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);
|
||||
if (!workspaceNew.getSex().equals(workspace.getSex())) {
|
||||
// deleteSketchByProjectId(projectId);
|
||||
|
||||
LambdaQueryWrapper<CollectionElement> queryWrapper = new LambdaQueryWrapper<CollectionElement>().eq(CollectionElement::getProjectId, 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());
|
||||
SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup());
|
||||
if (!checkIfModelExistsInProject(sysFile.getMd5(), projectId)) {
|
||||
CollectionElement collectionElement = new CollectionElement();
|
||||
collectionElement.setAccountId(userInfo.getId());
|
||||
collectionElement.setProjectId(projectId);
|
||||
@@ -763,14 +759,14 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
rel.setWorkspaceId(projectDTO.getWorkspace().getId());
|
||||
rel.setStyleId(projectDTO.getStyleId());
|
||||
workspaceRelStyleMapper.insert(rel);
|
||||
}else {
|
||||
} else {
|
||||
WorkspaceRelStyle workspaceRelStyleOld = workspaceRelStyles.get(0);
|
||||
if (!Objects.equals(workspaceRelStyleOld.getStyleId(), projectDTO.getStyleId())) {
|
||||
workspaceRelStyleOld.setStyleId(projectDTO.getStyleId());
|
||||
workspaceRelStyleMapper.updateById(workspaceRelStyleOld);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
QueryWrapper<WorkspaceRelStyle> wRSQW = new QueryWrapper<>();
|
||||
wRSQW.lambda().eq(WorkspaceRelStyle::getWorkspaceId, projectDTO.getWorkspace().getId());
|
||||
List<WorkspaceRelStyle> workspaceRelStyles = workspaceRelStyleMapper.selectList(wRSQW);
|
||||
@@ -784,7 +780,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
}
|
||||
vo.setId(projectId);
|
||||
return vo;
|
||||
}else {
|
||||
} else {
|
||||
Project project = CopyUtil.copyObject(projectDTO, Project.class);
|
||||
project.setAccountId(userInfo.getId());
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -821,7 +817,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
if (projectDTO.getWorkspace().getSex().equals(Sex.FEMALE.getValue())) {
|
||||
workspace.setMannequinFemaleId(sysFile.getId());
|
||||
workspace.setMannequinFemaleType("System");
|
||||
}else {
|
||||
} else {
|
||||
workspace.setMannequinMaleId(sysFile.getId());
|
||||
workspace.setMannequinMaleType("System");
|
||||
}
|
||||
@@ -879,6 +875,17 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
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) {
|
||||
List<File> pngFiles = new ArrayList<>();
|
||||
File directory = new File(directoryPath);
|
||||
|
||||
Reference in New Issue
Block a user