|
|
@ -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<IssueProjectTagDictDao, IssueProjectTagDictEntity> implements IssueProjectTagDictService { |
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(IssueProjectTagDictServiceImpl.class); |
|
|
|
@Autowired |
|
|
|
private IssueProjectTagDictRedis issueProjectTagDictRedis; |
|
|
|
@Autowired |
|
|
|
private IssueProjectCategoryDictService issueProjectCategoryDictService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IssueProjectTagDictDTO> page(Map<String, Object> params) { |
|
|
@ -125,6 +131,20 @@ public class IssueProjectTagDictServiceImpl extends BaseServiceImpl<IssueProject |
|
|
|
Map<String,List<IssueCategoryTagResultDTO>> 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<String,List<IssueCategoryTagResultDTO>> 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<IssueCategoryTagResultDTO> list = map.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
result.setCustomized(list.stream().limit(NumConstant.TEN).collect(Collectors.toList())); |
|
|
|