From b3b2e51df83211dbb50e4d1b6242e9e076f53220 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 23 Mar 2021 14:19:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E3=80=81=E6=A0=87=E7=AD=BE=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-issue/gov-issue-server/pom.xml | 6 +++ .../IssueProjectCategoryDictServiceImpl.java | 51 ++++++++++++------- .../mapper/IssueProjectCategoryDictDao.xml | 1 + 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 673a33aeb9..54a2ff009c 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -102,6 +102,12 @@ 2.0.0 compile + + com.epmet + oper-crm-client + 2.0.0 + compile + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java index 0a9a266b67..1ba11ff550 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java @@ -30,10 +30,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IssueCategoryDao; import com.epmet.dao.IssueProjectCategoryDictDao; import com.epmet.dao.IssueProjectRelationDao; -import com.epmet.dto.IssueCategoryDTO; -import com.epmet.dto.IssueDTO; -import com.epmet.dto.IssueProjectCategoryDictDTO; -import com.epmet.dto.ProjectCategoryDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.CustomerCategoryListResultDTO; import com.epmet.dto.result.ProjectCategoryDTOResultDTO; @@ -42,6 +39,7 @@ import com.epmet.dto.result.ProjectIssueDTOResultDTO; import com.epmet.entity.IssueProjectCategoryDictEntity; import com.epmet.entity.IssueProjectTagDictEntity; import com.epmet.feign.GovProjectOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; import com.epmet.redis.IssueProjectCategoryDictRedis; import com.epmet.service.IssueProjectCategoryDictService; @@ -76,11 +74,12 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl page(Map params) { @@ -199,21 +198,35 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl list = baseDao.selectCategoryListByCustomer(formDTO.getCustomerId()); - if (CollectionUtils.isEmpty(list)) { - //分类初始化 - List categoryList = baseDao.selectCategoryListByCustomer("default"); - categoryList.forEach(item -> { - item.setCustomerId(formDTO.getCustomerId()); - }); - this.insertBatch(categoryList); - //标签初始化 - List tagList = issueProjectTagDictService.getTagListByCustomer("default"); - tagList.forEach(item -> { - item.setCustomerId(formDTO.getCustomerId()); - }); - issueProjectTagDictService.insertBatch(tagList); + //2021.3.23 sun 不传客户Id时默认查询所有有效客户列表 循环添加 + List customerIdList = new ArrayList<>(); + if(StringUtils.isBlank(formDTO.getCustomerId())){ + Result> resultList = operCrmOpenFeignClient.getAllCustomerList(); + if(!resultList.success()){ + throw new RuntimeException("crm库获取有效客户列表失败!"); + } + customerIdList = resultList.getData().stream().map(cu->cu.getId()).collect(Collectors.toList()); + }else { + customerIdList.add(formDTO.getCustomerId()); } + //end sun + customerIdList.forEach(cu->{ + List list = baseDao.selectCategoryListByCustomer(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(list)) { + //分类初始化 + List categoryList = baseDao.selectCategoryListByCustomer("default"); + categoryList.forEach(item -> { + item.setCustomerId(formDTO.getCustomerId()); + }); + this.insertBatch(categoryList); + //标签初始化 + List tagList = issueProjectTagDictService.getTagListByCustomer("default"); + tagList.forEach(item -> { + item.setCustomerId(formDTO.getCustomerId()); + }); + issueProjectTagDictService.insertBatch(tagList); + } + }); } /** diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml index 7752ab2c35..4d1bc0da0b 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml @@ -46,6 +46,7 @@ ID, PID, PIDS, + PARENT_CATEGORY_CODE, CATEGORY_CODE, CATEGORY_NAME, CATEGORY_TYPE,