From 42aed5804b724947a24c06e18ed9189ec21a8621 Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 8 Oct 2025 21:04:19 +0800 Subject: [PATCH] =?UTF-8?q?BUGFIX:1.=E7=94=9F=E6=88=90=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E6=A1=88=E5=9C=A8design=E6=97=B6=E6=9C=AA=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=88=B0library=202.=E8=8E=B7=E5=8F=96=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=90=8D=E6=97=B6=E5=87=BA=E7=8E=B0=E7=A9=BA=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=20TASK:1.=20=E5=85=81=E8=AE=B8=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=8C=89=E7=BB=84=E7=BB=87=E5=90=8D?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7design=E9=A2=91=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConvenientInquiryController.java | 5 +-- .../com/ai/da/model/dto/ProjectQueryDTO.java | 4 +-- .../com/ai/da/service/AccountService.java | 2 ++ .../da/service/ConvenientInquiryService.java | 3 +- .../da/service/impl/AccountServiceImpl.java | 19 ++++++++++++ .../impl/CollectionElementServiceImpl.java | 9 +++++- .../impl/ConvenientInquiryServiceImpl.java | 12 ++++--- .../ai/da/service/impl/DesignServiceImpl.java | 31 ++++++++++++------- .../impl/UserLikeGroupServiceImpl.java | 8 ++--- src/main/resources/application-dev.properties | 3 +- .../resources/mapper/primary/DesignMapper.xml | 4 +-- 11 files changed, 72 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/ai/da/controller/ConvenientInquiryController.java b/src/main/java/com/ai/da/controller/ConvenientInquiryController.java index eb07c365..f3707db8 100644 --- a/src/main/java/com/ai/da/controller/ConvenientInquiryController.java +++ b/src/main/java/com/ai/da/controller/ConvenientInquiryController.java @@ -52,7 +52,8 @@ public class ConvenientInquiryController { @ApiOperation("获取指定时间区间内所有用户design的使用情况") @GetMapping("/getDesignStatistic") public Response> getDesignStatistic(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, - @RequestParam(required = false) List ids, @RequestParam(required = false) String email) { + @RequestParam(required = false) List ids, @RequestParam(required = false) String email, + @RequestParam(required = false) String organizationName) { /*Long accountId = UserContext.getUserHolder().getId(); String userEmail = accountService.getById(accountId).getUserEmail(); if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) @@ -75,7 +76,7 @@ public class ConvenientInquiryController { } else { return Response.fail("Sorry, you don't have permission"); }*/ - return Response.success(convenientInquiryService.getDesignStatistic(startTime, endTime, ids, email)); + return Response.success(convenientInquiryService.getDesignStatistic(startTime, endTime, ids, email, organizationName)); } diff --git a/src/main/java/com/ai/da/model/dto/ProjectQueryDTO.java b/src/main/java/com/ai/da/model/dto/ProjectQueryDTO.java index 9cc869aa..916c254c 100644 --- a/src/main/java/com/ai/da/model/dto/ProjectQueryDTO.java +++ b/src/main/java/com/ai/da/model/dto/ProjectQueryDTO.java @@ -38,8 +38,8 @@ public class ProjectQueryDTO extends PageQueryBaseVo { private Integer intersection; // todo 获取历史列表,允许传入多个类型 -// private List process; - private String process; + private List process; +// private String process; private Integer asc; } diff --git a/src/main/java/com/ai/da/service/AccountService.java b/src/main/java/com/ai/da/service/AccountService.java index c94eb3b6..cc44688e 100644 --- a/src/main/java/com/ai/da/service/AccountService.java +++ b/src/main/java/com/ai/da/service/AccountService.java @@ -244,4 +244,6 @@ public interface AccountService extends IService { void checkEduAdminExpireStatus(); void setEduAdminToExpire(Account adminAccount); + + String getOrganizationTypeByRole(Integer roleNum); } diff --git a/src/main/java/com/ai/da/service/ConvenientInquiryService.java b/src/main/java/com/ai/da/service/ConvenientInquiryService.java index fe55b959..0f18da5c 100644 --- a/src/main/java/com/ai/da/service/ConvenientInquiryService.java +++ b/src/main/java/com/ai/da/service/ConvenientInquiryService.java @@ -21,7 +21,8 @@ public interface ConvenientInquiryService extends IService { IPage getTrial(QueryUserConditionsVO queryUserConditionsVO); - List getDesignStatistic(String startTime, String endTime, List ids, String email); + List getDesignStatistic(String startTime, String endTime, List ids, + String email, String organizationName); QuestionnaireFeedbackVO getQuestionnaireInfo(); diff --git a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java index c1f4c0d1..d5a2daee 100644 --- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java @@ -3570,6 +3570,7 @@ public class AccountServiceImpl extends ServiceImpl impl @Override public Set organizationNameSearch(String type, String name) { QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().ne(Account::getOrganizationName, "").isNotNull(Account::getOrganizationName); if (!StringUtil.isNullOrEmpty(name)) { qw.lambda().like(Account::getOrganizationName, name); } @@ -3657,6 +3658,9 @@ public class AccountServiceImpl extends ServiceImpl impl } else { return; } + if (Objects.isNull(organization)){ + organization = convenientInquiryService.addOrganization(adminAcc.getOrganizationName(), getOrganizationTypeByRole(adminAcc.getSystemUser())); + } if (isActive){ organization.setStatus(1); } else { @@ -3666,4 +3670,19 @@ public class AccountServiceImpl extends ServiceImpl impl organizationMapper.updateById(organization); } + public String getOrganizationTypeByRole(Integer roleNum){ + String type; + switch (roleNum){ + case 5: + type = "Enterprise"; + break; + case 7: + type = "Education"; + break; + default: + type = null; + } + return type; + } + } 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 045800df..6acff360 100644 --- a/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java @@ -581,13 +581,20 @@ public class CollectionElementServiceImpl extends ServiceImpl().eq(CollectionElement::getId, sketchBoard.getSketchBoardId()).select(CollectionElement::getLevel3Type)).getLevel3Type(); } else if ("Library".equals(sketchBoard.getDesignType())){ level3Type = libraryService.getById(sketchBoard.getSketchBoardId()).getLevel3Type(); + } else if ("Generate".equals(sketchBoard.getDesignType())){ + GenerateDetail generateDetail = generateDetailMapper.selectById(sketchBoard.getSketchBoardId()); + assert generateDetail != null; + Generate generate = generateMapper.selectById(generateDetail.getGenerateId()); + assert generate != null; + level3Type = GenerateServiceImpl.extractGender(generate.getGenerateType()); } //判断性别和当前project性别是否一致,不一致则移除 + assert level3Type != null; if (!level3Type.equalsIgnoreCase(designDTO.getModelSex())) { sketchIterator.remove(); } diff --git a/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java b/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java index ae2b78f6..63acfb1d 100644 --- a/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java @@ -138,7 +138,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl getDesignStatistic(String startTime, String endTime, List ids, - String email) { + String email, String organizationName) { Long accountId = UserContext.getUserHolder().getId(); Account account = accountService.getById(accountId); // 允许查看数据的用户id @@ -166,6 +166,8 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl impleme // 生成library - 根据设计元素生成设计库信息 startTime = System.currentTimeMillis(); - String ageGroup = getAgeGroupByCollectionId(collectionId); + String ageGroup = getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId); generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup); //处理关联关系,修复element覆盖得情况 // List relationElements = collectionElementService.getByOnlyCollectionId(collectionId); @@ -420,14 +419,21 @@ public class DesignServiceImpl extends ServiceImpl impleme return requestId; } - private String getAgeGroupByCollectionId(Long collectionId){ - List byCollectionId = collectionElementService.getByCollectionId(collectionId); - if (byCollectionId != null && !byCollectionId.isEmpty()){ - Long projectId = byCollectionId.get(0).getProjectId(); - if (projectId != null && projectId != 0L){ - Workspace workspace = workspaceService.getWSByProjectId(projectId); - if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){ - return workspace.getAgeGroup(); + private String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId){ + if (Objects.nonNull(projectId)){ + Workspace workspace = workspaceService.getWSByProjectId(projectId); + if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){ + return workspace.getAgeGroup(); + } + } else if (Objects.nonNull(collectionId) && collectionId != 0){ + List byCollectionId = collectionElementService.getByCollectionId(collectionId); + if (byCollectionId != null && !byCollectionId.isEmpty()){ + projectId = byCollectionId.get(0).getProjectId(); + if (projectId != null && projectId != 0L){ + Workspace workspace = workspaceService.getWSByProjectId(projectId); + if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){ + return workspace.getAgeGroup(); + } } } } @@ -706,6 +712,9 @@ public class DesignServiceImpl extends ServiceImpl impleme if (!CollectionUtils.isEmpty(elementVO.getMarketingSketchElements())) { elements.addAll(elementVO.getMarketingSketchElements()); } + if (!CollectionUtils.isEmpty(elementVO.getGenerateCollectionElements())) { + elements.addAll(elementVO.getGenerateCollectionElements()); + } collectionElementService.saveLibraryByCollectionElement(elements, timeZone, elementVO.getModelSex(), ageGroup); } @@ -2516,7 +2525,7 @@ public class DesignServiceImpl extends ServiceImpl impleme log.info("design python端运行时间:" + totalTimeInSeconds + " 秒"); //生成library startTime = System.currentTimeMillis(); - String ageGroup = getAgeGroupByCollectionId(collectionId); + String ageGroup = getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId); generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup); //处理关联关系,修复element覆盖得情况 // List relationElements = collectionElementService.getByOnlyCollectionId(collectionId); diff --git a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java index c147cf35..297a31ce 100644 --- a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java @@ -1929,11 +1929,11 @@ public class UserLikeGroupServiceImpl extends ServiceImpl a.system_user IN (7, 8) - + AND a.organization_name = #{organizationName}