Merge remote-tracking branch 'origin/dev/dev' into dev/dev

This commit is contained in:
2025-06-16 11:04:34 +08:00
2 changed files with 41 additions and 1 deletions

View File

@@ -703,11 +703,37 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
QueryWrapper<Workspace> qw = new QueryWrapper<>();
qw.lambda().eq(Workspace::getProjectId, projectDTO.getId());
List<Workspace> workspaces = workspaceMapper.selectList(qw);
if (CollectionUtils.isEmpty(workspaces)) {
throw new BusinessException("Lack of associated workspace.");
}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())) {
if (!workspaceNew.getAgeGroup().equals(workspace.getAgeGroup()) || !workspaceNew.getSex().equals(workspace.getSex())) {
// 性别变更 清理sketch及模特
deleteMannequinByProjectId(projectId);
if (!workspaceNew.getSex().equals(workspace.getSex())) {
deleteSketchByProjectId(projectId);
}
}
SysFile sysFile = sysFileService.getOneBySex(projectDTO.getStyleId(), projectDTO.getWorkspace().getSex(), projectDTO.getWorkspace().getAgeGroup());
CollectionElement collectionElement = new CollectionElement();
collectionElement.setAccountId(userInfo.getId());
collectionElement.setProjectId(projectId);
collectionElement.setLevel1Type(CollectionLevel1TypeEnum.MODEL.getRealName());
collectionElement.setName(sysFile.getName());
collectionElement.setUrl(sysFile.getUrl());
collectionElement.setMd5(sysFile.getMd5());
collectionElement.setCreateDate(new Date());
collectionElement.setHasPin((byte) 0);
collectionElementMapper.insert(collectionElement);
CollectionElementRelModel collectionElementRelModel = new CollectionElementRelModel();
collectionElementRelModel.setCollectionElementId(collectionElement.getId());
collectionElementRelModel.setRelationId(sysFile.getId());
collectionElementRelModel.setRelationType("System");
collectionElementRelModelMapper.insert(collectionElementRelModel);
}
workspaceNew.setId(workspace.getId());
workspace.setUpdateTime(LocalDateTime.now());
workspaceMapper.updateById(workspaceNew);
@@ -801,6 +827,20 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
}
}
private void deleteSketchByProjectId(Long projectId) {
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
qw.lambda().eq(CollectionElement::getProjectId, projectId);
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
collectionElementMapper.delete(qw);
}
private void deleteMannequinByProjectId(Long projectId) {
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
qw.lambda().eq(CollectionElement::getProjectId, projectId);
qw.lambda().eq(CollectionElement::getLevel1Type, CollectionLevel1TypeEnum.MODEL.getRealName());
collectionElementMapper.delete(qw);
}
@Override
public Long getByProjectId(Long projectId) {
QueryWrapper<Workspace> qw = new QueryWrapper<>();