From fd8e6fd2e88fa99104d929713911a995b6a2e93c Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 13 Jun 2025 17:03:07 +0800 Subject: [PATCH] =?UTF-8?q?BUGFIX:=20=E5=88=87=E6=8D=A2=E6=80=A7=E5=88=AB?= =?UTF-8?q?=20=E5=B9=B4=E9=BE=84=E6=AE=B5;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../da/service/impl/WorkspaceServiceImpl.java | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9c09ed19..f9fc25bc 100644 --- a/pom.xml +++ b/pom.xml @@ -162,7 +162,7 @@ com.tencentcloudapi - tencentcloud-sdk-java + tencentcloud-sdk-java-ses 3.1.572 diff --git a/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java b/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java index 774cb23b..cbf9c605 100644 --- a/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java @@ -703,11 +703,37 @@ public class WorkspaceServiceImpl extends ServiceImpl qw = new QueryWrapper<>(); qw.lambda().eq(Workspace::getProjectId, projectDTO.getId()); List 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 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 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 qw = new QueryWrapper<>();