From 1870996244b1661810b03e1f811f5c014f11ce50 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Thu, 21 Sep 2023 11:35:58 +0800 Subject: [PATCH] =?UTF-8?q?TASK:workspace=E3=80=81design=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BB=A3=E7=A0=81;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/da/controller/WorkspaceController.java | 6 ++-- .../java/com/ai/da/python/PythonService.java | 4 +-- .../da/service/CollectionElementService.java | 1 + .../impl/CollectionElementServiceImpl.java | 36 +++++++++++++++---- .../ai/da/service/impl/DesignServiceImpl.java | 1 + .../da/service/impl/WorkspaceServiceImpl.java | 28 ++++++++++----- 6 files changed, 55 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/ai/da/controller/WorkspaceController.java b/src/main/java/com/ai/da/controller/WorkspaceController.java index d2c630a5..1b7eed71 100644 --- a/src/main/java/com/ai/da/controller/WorkspaceController.java +++ b/src/main/java/com/ai/da/controller/WorkspaceController.java @@ -76,11 +76,11 @@ public class WorkspaceController { /** * 删除 */ - @PostMapping("/remove") + @DeleteMapping("/remove") @ApiOperationSupport(order = 4) @ApiOperation(value = "删除", notes = "传入id") - public Response remove(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) { - return Response.success(workspaceService.removeById(id)); + public Response remove(@Valid @RequestBody List workspaceList) { + return Response.success(workspaceService.removeBatchByIds(workspaceList)); } @GetMapping("/enumValues") diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java index 8c6efe7a..a849d3b4 100644 --- a/src/main/java/com/ai/da/python/PythonService.java +++ b/src/main/java/com/ai/da/python/PythonService.java @@ -432,7 +432,7 @@ public class PythonService { pythonItem.setBody_path(designLibraryModelPoint.getTemplateUrl()); } else { // pythonItem.setBody_path("/workspace/python_code/Multi-layer-Virtual-Try-on/dataset_for_test/Img_model.png"); - pythonItem.setBody_path("aida-mannequins/model_1693218345.2714431.png"); + pythonItem.setBody_path("aida-mannequins/model_1693218345.2714432.png"); } } else { SysFileVO sysFileVO = getRandomSysFileByLevel2Type(type, Lists.newArrayList()); @@ -1354,7 +1354,7 @@ public class PythonService { bodyPath = designLibraryModelPoint.getTemplateUrl(); } else { // bodyPath = "/workspace/python_code/Multi-layer-Virtual-Try-on/dataset_for_test/Img_model.png"; - bodyPath = "aida-mannequins/model_1693218345.2714431.png"; + bodyPath = "aida-mannequins/model_1693218345.2714432.png"; } response.add(new DesignPythonItem(SysFileLevel2TypeEnum.BODY.getRealName(),bodyPath,pythonTAllInfoService.getImageIdByPath(bodyPath))); return response; diff --git a/src/main/java/com/ai/da/service/CollectionElementService.java b/src/main/java/com/ai/da/service/CollectionElementService.java index 2b1c27c1..8f41f3a0 100644 --- a/src/main/java/com/ai/da/service/CollectionElementService.java +++ b/src/main/java/com/ai/da/service/CollectionElementService.java @@ -109,6 +109,7 @@ public interface CollectionElementService extends IService { List getByOnlyCollectionId(Long collectionId); DesignLibraryModelPointVO calculateTemplatePoint(LibraryModelPoint modelPoint, Integer high, Integer width, String templateUrl); + DesignLibraryModelPointVO calculateTemplatePointTemplate(LibraryModelPoint modelPoint, Integer high, Integer width, String templateUrl); /** * 刷新历史数据 diff --git a/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java b/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java index b14a254f..7784d093 100644 --- a/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java @@ -415,13 +415,14 @@ public class CollectionElementServiceImpl extends ServiceImpl calculateTemplatePointOne(String template,Integer high,Integer width){ List originRatioList = JSON.parseObject(template,List.class); originRatioList.set(0,originRatioList.get(0).multiply(BigDecimal.valueOf(width))); diff --git a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java index cd711a84..48d0f0c6 100644 --- a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java @@ -438,6 +438,7 @@ public class DesignServiceImpl extends ServiceImpl impleme designPythonOutfit.setUserId(userInfo.getId()); designPythonOutfit.setDesignId(designId); designPythonOutfit.setCollectionId(collectionId); + designPythonOutfit.setDesignUrl(outfit.getString("synthesis_url")); designPythonOutfitService.save(designPythonOutfit); JSONArray layers = outfit.getJSONArray("layers"); 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 a5683671..47a121e2 100644 --- a/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/WorkspaceServiceImpl.java @@ -58,13 +58,20 @@ public class WorkspaceServiceImpl extends ServiceImpl selectWorkspacePage(IPage page, WorkspaceVO workspace) { return page.setRecords(baseMapper.selectWorkspacePage(page, workspace)); } + private final static String WORKSPACE_NAME = "默认workspace名称"; + private final static Integer SYSTEM_DESIGNER_PERCENTAGE = 30; @Override public boolean saveOrUpdate(Workspace workspace) { AuthPrincipalVo userInfo = UserContext.getUserHolder(); workspace.setUserName(userInfo.getUsername()); - workspace.setIsLastIndex(0); if (null == workspace.getId()) { + workspace.setIsLastIndex(0); + workspace.setMannequinUrl("aida-mannequins/model_1693218345.2714432.png"); + workspace.setMannequinType(MannequinType.SYSTEM.getValue()); + workspace.setSex(Sex.MALE.getValue()); + workspace.setPosition(Position.OVERALL.getValue()); + workspace.setSystemDesignerPercentage(SYSTEM_DESIGNER_PERCENTAGE); int insert = workspaceMapper.insert(workspace); if (insert <= 0) { throw new BusinessException("insert workspace failed"); @@ -79,9 +86,6 @@ public class WorkspaceServiceImpl extends ServiceImpl(query.getPage(), query.getSize()), qw); page.getRecords().forEach(o -> { - o.setMannequinUrl(minioUtil.getPresignedUrl(o.getMannequinUrl(), 10)); + String url = o.getMannequinUrl(); + if (url.startsWith("aida-")) { + o.setMannequinUrl(minioUtil.getPresignedUrl(o.getMannequinUrl(), 10)); + } }); vo.setPage(PageBaseResponse.success(page)); vo.setId(workspace.getId()); return vo; } page.getRecords().forEach(o -> { - o.setMannequinUrl(minioUtil.getPresignedUrl(o.getMannequinUrl(), 10)); + String url = o.getMannequinUrl(); + if (url.startsWith("aida-")) { + o.setMannequinUrl(minioUtil.getPresignedUrl(o.getMannequinUrl(), 10)); + } }); vo.setPage(PageBaseResponse.success(page)); QueryWrapper qwIsLastIndex = new QueryWrapper<>(); @@ -169,7 +179,7 @@ public class WorkspaceServiceImpl extends ServiceImpl