From b494af3443a84c0cfab701e04b24216c23995992 Mon Sep 17 00:00:00 2001 From: zy <276996223@qq.com> Date: Mon, 17 Feb 2025 16:33:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BC=81=E4=B8=9A=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enterprise/EnterpriseController.java | 22 ++++++++++++++++--- .../enterprise/EnterpriseServiceImpl.java | 10 ++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java index a654e96..51ad83b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java @@ -138,8 +138,24 @@ public class EnterpriseController { } //获取标签 - final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); - enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList())); +// final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); +// enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList())); + + // 获取标签 + List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); + if (tagLibraryDOS != null) { + enterprise.setTagList(tagLibraryDOS.stream() + .map(TagLibraryDO::getTagName) + .collect(Collectors.toList())); + } else { + // 处理 tagLibraryDOS 为 null 的情况,这里可以设置一个空列表 + enterprise.setTagList(Collections.emptyList()); + } + + + + //通过userID获取专管人 + enterprise.setInviterName(adminUserService.getUser(Long.valueOf(enterprise.getUserId())).getNickname()); //获取资质 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -163,7 +179,7 @@ public class EnterpriseController { enterprise.setQualificationList(enterpriseQualificationList); } - //获取企业标签 + return success(BeanUtils.toBean(enterprise, EnterpriseRespVO.class)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java index d26d8e2..c5781f8 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java @@ -59,6 +59,8 @@ public class EnterpriseServiceImpl implements EnterpriseService { private EnterpriseTagMapper enterpriseTagMapper; @Resource private UserRoleMapper userRoleMapper; + @Resource + private AdminUserService adminUserService; @Override @Transactional @@ -106,8 +108,14 @@ public class EnterpriseServiceImpl implements EnterpriseService { @Override @Transactional public Long pccreateEnterprise(EnterpriseSaveReqVO createReqVO) { + //专管员所属部门 + final AdminUserDO user = adminUserService.getUser(createReqVO.getUserId()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + createReqVO.setDeptId(user.getDeptId()); EnterpriseDO enterprise = BeanUtils.toBean(createReqVO, EnterpriseDO.class); - enterprise.setDepartmentId(1L); + enterprise.setDepartmentId(createReqVO.getDeptId()); enterpriseMapper.insert(enterprise); if (createReqVO.getFileIds() != null && createReqVO.getFileIds().length > 0) { for (Long fileId : createReqVO.getFileIds()) {