Browse Source

标签查询时的补偿机制修改

dev_shibei_match
wangchao 4 years ago
parent
commit
19fbf37800
  1. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java
  2. 13
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java
  3. 23
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml

2
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java

@ -85,7 +85,7 @@ public interface IssueProjectTagDictDao extends BaseDao<IssueProjectTagDictEntit
List<IssueProjectTagDictEntity> selectTagListByCustomer(@Param("customerId") String customerId);
/**
* @Description 根据类别查询客户下标签
* @Description 根据类别查询客户下默认标签
* @param categories
* @param customerId
* @return java.util.List<com.epmet.entity.IssueProjectTagDictEntity>

13
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java

@ -269,26 +269,31 @@ public class IssueProjectTagDictRedis {
CategoryTagInitFormDTO customerIdParam = new CategoryTagInitFormDTO();
customerIdParam.setCustomerId(customerId);
if (!CollectionUtils.isEmpty(redisUtils.keys(GovIssueRedisKeys.getGovernmentTagKey(customerId, null)))){
//缓存不为空
if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME))) {
if (ifOtherOnly || CollectionUtils.isEmpty(category)) {
//补偿全部默认标签
categoryDictService.init(customerIdParam);
db.addAll(poolDao.selectTagListByCustomer(customerId));
db.addAll(poolDao.selectTagByCategory(null, customerId, customerId));
} else {
if (NumConstant.ZERO <= poolDao.selectCountByCustomerId(customerId)) {
categoryDictService.init(customerIdParam);
} else {
//只插入category中的标签
tagDictService.insertBatch(poolDao.selectTagByCategory(category, "default", customerId));
db.addAll(poolDao.selectTagsByCustomerIdAndTagIds(customerId, category));
List<IssueProjectTagDictEntity> missingTags = poolDao.selectTagByCategory(category, "default", customerId);
if(!CollectionUtils.isEmpty(missingTags)){
tagDictService.insertBatch(missingTags);
db.addAll(missingTags);}
}
}
}
}else{
//缓存为空
if (NumConstant.ZERO <= poolDao.selectCountByCustomerId(customerId)) {
categoryDictService.init(customerIdParam);
}
db.addAll(poolDao.selectTagListByCustomer(customerId));
db.addAll(poolDao.selectTagByCategory(null, customerId, customerId));
}
if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))){

23
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml

@ -92,16 +92,31 @@
<if test='null != targetCustomerId and "" != targetCustomerId'>
#{targetCustomerId} as customerId,
</if>
TAG_NAME,CATEGORY_ID,IS_DEFAULT,ISSUE_USE_COUNT,PROJECT_USE_COUNT,IS_DISABLE,DEL_FLAG,REVISION
TAG_NAME,CATEGORY_ID,IS_DEFAULT,
<choose>
<when test='"default" == customerId'>
ISSUE_USE_COUNT,
</when>
<otherwise>
IFNULL(ISSUE_USE_COUNT,0)+IFNULL(PROJECT_USE_COUNT,0) AS issueUseCount,
</otherwise>
</choose>
PROJECT_USE_COUNT,
IS_DISABLE,DEL_FLAG,REVISION
FROM
ISSUE_PROJECT_TAG_DICT
WHERE
DEL_FLAG = '0'
AND
CUSTOMER_ID = #{customerId}
<foreach collection="categories" item="categoryId" open="AND ( " separator=" OR " close=" )">
CATEGORY_ID = #{categoryId}
</foreach>
AND
IS_DEFAULT = '0'
<if test="null != categories and categories.size() > 0">
<foreach collection="categories" item="categoryId" open="AND ( " separator=" OR " close=" )">
CATEGORY_ID = #{categoryId}
</foreach>
</if>
</select>
<select id="selectCountByCustomerId" resultType="int">

Loading…
Cancel
Save