From 88ac6d948fa7cc2c56191450046a096e9e7a244c Mon Sep 17 00:00:00 2001 From: wangchao Date: Wed, 24 Mar 2021 14:32:05 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=9B=B4=E6=96=B0=E6=97=B6=E7=9A=84=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/ProjectTagsServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTagsServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTagsServiceImpl.java index 4154c9bd24..87edc5e00b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTagsServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTagsServiceImpl.java @@ -41,6 +41,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.Arrays; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -142,8 +143,9 @@ public class ProjectTagsServiceImpl extends BaseServiceImpl replaceNews = new LinkedList<>(newIds); differentSet.setPlus(newIds.removeAll(orientIds) ? newIds : null); - differentSet.setMinus(orientIds.removeAll(newIds) ? orientIds : null); + differentSet.setMinus(orientIds.removeAll(replaceNews) ? orientIds : null); } Result result = issueClient.updateCitations(differentSet); if(!result.success()) throw new RenException(result.getInternalMsg()); From 9f8e27e61b5fbff4dd211643fb28e0165a879095 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Wed, 24 Mar 2021 16:25:50 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IssueProjectCategoryDictServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 5bdf0a58fe..6a21d19c46 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 @@ -345,7 +345,7 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl Date: Wed, 24 Mar 2021 17:16:03 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E3=80=81=E6=A0=87=E7=AD=BE=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E9=97=AE=E9=A2=98=E4=B8=8D=E6=94=BE=E5=9C=A8=E6=96=B0?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=9B=E5=BB=BA=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=20=E5=B5=8C=E5=85=A5=E5=85=B7=E4=BD=93=E7=9A=84=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E9=80=BB=E8=BE=91=E4=B8=AD=EF=BC=8C=E9=99=8D=E4=BD=8E?= =?UTF-8?q?=E6=96=B0=E5=AE=A2=E6=88=B7=E5=88=9D=E5=A7=8B=E5=8C=96=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=8E=8B=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IssueProjectCategoryDictServiceImpl.java | 59 ++++++++++--------- .../impl/IssueProjectTagDictServiceImpl.java | 24 +++++++- 2 files changed, 52 insertions(+), 31 deletions(-) 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 6a21d19c46..d78c3a3458 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 @@ -31,7 +31,10 @@ import com.epmet.dao.IssueCategoryDao; import com.epmet.dao.IssueProjectCategoryDictDao; import com.epmet.dao.IssueProjectRelationDao; import com.epmet.dao.IssueProjectTagDictDao; -import com.epmet.dto.*; +import com.epmet.dto.IssueCategoryDTO; +import com.epmet.dto.IssueDTO; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.IssueProjectCategoryDictEntity; @@ -145,6 +148,18 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl categoryList(String customerId) { List resultList = baseDao.selectCustomerCategoryList(customerId); + //2021.3.24 sun 客户初始化分类标签的接口不想加到新客户创建的程序里,因此加到这里 在标签列表的查询方法中也有关于初始化分类标签的逻辑 + try { + if(CollectionUtils.isEmpty(resultList)){ + CategoryTagInitFormDTO dto = new CategoryTagInitFormDTO(); + dto.setCustomerId(customerId); + init(dto); + resultList = baseDao.selectCustomerCategoryList(customerId); + } + } catch (Exception e) { + logger.error("客户初始化分类、标签失败,客户Id->"+customerId, e); + } + //end return resultList; } @@ -201,35 +216,21 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl 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()); + 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); } - //end sun - customerIdList.forEach(cu->{ - List list = baseDao.selectCategoryListByCustomer(cu); - if (CollectionUtils.isEmpty(list)) { - //分类初始化 - List categoryList = baseDao.selectCategoryListByCustomer("default"); - categoryList.forEach(item -> { - item.setCustomerId(cu); - }); - this.insertBatch(categoryList); - //标签初始化 - List tagList = issueProjectTagDictService.getTagListByCustomer("default"); - tagList.forEach(item -> { - item.setCustomerId(cu); - }); - issueProjectTagDictService.insertBatch(tagList); - } - }); } /** diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java index 5919990477..ee06f971d3 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java @@ -20,25 +20,28 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.constant.GovIssueRedisKeys; import com.epmet.dao.IssueProjectTagDictDao; import com.epmet.dto.IssueProjectTagDictDTO; +import com.epmet.dto.form.CategoryTagInitFormDTO; import com.epmet.dto.form.TagDifferentSetFormDTO; import com.epmet.dto.form.TagListFormDTO; import com.epmet.dto.result.IssueCategoryTagResultDTO; -import com.epmet.dto.result.IssueProjectTagsResultDTO; import com.epmet.dto.result.TagListResultDTO; import com.epmet.entity.IssueProjectTagDictEntity; import com.epmet.redis.IssueProjectTagDictRedis; +import com.epmet.service.IssueProjectCategoryDictService; import com.epmet.service.IssueProjectTagDictService; import com.epmet.utils.ModuleConstants; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -55,8 +58,11 @@ import java.util.stream.Collectors; @Service public class IssueProjectTagDictServiceImpl extends BaseServiceImpl implements IssueProjectTagDictService { + private static Logger logger = LoggerFactory.getLogger(IssueProjectTagDictServiceImpl.class); @Autowired private IssueProjectTagDictRedis issueProjectTagDictRedis; + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; @Override public PageData page(Map params) { @@ -125,6 +131,20 @@ public class IssueProjectTagDictServiceImpl extends BaseServiceImpl> map = issueProjectTagDictRedis.getDefaultTagsSortedByCategoryAndCustomizedTagsOrderByRank(tokenDto.getCustomerId(), formDTO.getCategoryIdList()); result.setDefaulted(map.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)); + //2021.3.24 sun 客户初始化分类标签的接口不想加到新客户创建的程序里,因此加到这里 在分类列表的查询方法中也有关于初始化分类标签的逻辑 + try { + if(CollectionUtils.isEmpty(result.getDefaulted())){ + CategoryTagInitFormDTO dto = new CategoryTagInitFormDTO(); + dto.setCustomerId(tokenDto.getCustomerId()); + issueProjectCategoryDictService.init(dto); + Map> map1 = issueProjectTagDictRedis.getDefaultTagsSortedByCategoryAndCustomizedTagsOrderByRank(tokenDto.getCustomerId(), + formDTO.getCategoryIdList()); + result.setDefaulted(map1.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)); + } + } catch (Exception e) { + logger.error("客户初始化分类、标签失败,客户Id->"+tokenDto.getCustomerId(), e); + } + //end List list = map.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME); if (CollectionUtils.isNotEmpty(list)) { result.setCustomized(list.stream().limit(NumConstant.TEN).collect(Collectors.toList()));