Browse Source

议题标签修改/保存

dev_shibei_match
zxc 5 years ago
parent
commit
15a4f4d319
  1. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java
  2. 17
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java
  3. 6
      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

@ -51,7 +51,7 @@ public interface IssueProjectTagDictDao extends BaseDao<IssueProjectTagDictEntit
* @author zxc
* @date 2020/12/10 下午2:16
*/
List<IssueTagFormDTO> selectTagId(@Param("tags") List<IssueTagFormDTO> newTags, @Param("customerId")String customerId);
List<IssueTagFormDTO> selectTagId(@Param("list") List<IssueTagFormDTO> newTags);
/**
* 获取客户默认分类标签

17
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java

@ -179,7 +179,10 @@ public class IssueTagsServiceImpl extends BaseServiceImpl<IssueTagsDao, IssueTag
if (!CollectionUtils.isEmpty(tags)){
tags.forEach(t -> {
// 缓存标签 -1
dictRedis.editTagUseCount(customerId,t.getCategoryId(),t,NumConstant.ONE_STR);
IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO();
issueCategoryTagResultDTO.setName(t.getTagName());
issueCategoryTagResultDTO.setId(t.getId());
dictRedis.editTagUseCount(customerId,t.getCategoryId(),issueCategoryTagResultDTO,NumConstant.ONE_STR);
});
// 数据库有关标签使用次数 -1 0:+1 ; 1:-1;
issueProjectTagDictDao.updateTagsUseCount(tags,customerId,NumConstant.ONE_STR);
@ -189,14 +192,17 @@ public class IssueTagsServiceImpl extends BaseServiceImpl<IssueTagsDao, IssueTag
return;
}
List<IssueTagFormDTO> selectTags = form.getTagList();
List<IssueTagFormDTO> newTags = issueProjectTagDictDao.selectTagId(selectTags, customerId);
List<IssueTagFormDTO> newTags = issueProjectTagDictDao.selectTagId(selectTags);
IssueTagsDTO issueTagsDTO = baseDao.selectOneTagByIssueId(form.getIssueId());
if (!CollectionUtils.isEmpty(newTags)){
// 需要删除的标签
List<IssueTagFormDTO> delList = tags.stream().filter(tag -> !newTags.contains(tag)).collect(toList());
if (!CollectionUtils.isEmpty(delList)){
delList.forEach(d -> {
dictRedis.editTagUseCount(customerId,d.getCategoryId(),d,NumConstant.ONE_STR);
IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO();
issueCategoryTagResultDTO.setName(d.getTagName());
issueCategoryTagResultDTO.setId(d.getId());
dictRedis.editTagUseCount(customerId,d.getCategoryId(),issueCategoryTagResultDTO,NumConstant.ONE_STR);
});
// 数据库有关标签使用次数 -1 0:+1 ; 1:-1;
issueProjectTagDictDao.updateTagsUseCount(delList,customerId,NumConstant.ONE_STR);
@ -206,7 +212,10 @@ public class IssueTagsServiceImpl extends BaseServiceImpl<IssueTagsDao, IssueTag
if (!CollectionUtils.isEmpty(addList)){
addList.forEach(a -> {
// 缓存标签+1
dictRedis.editTagUseCount(customerId,a.getCategoryId(),a,NumConstant.ZERO_STR);
IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO();
issueCategoryTagResultDTO.setName(a.getTagName());
issueCategoryTagResultDTO.setId(a.getId());
dictRedis.editTagUseCount(customerId,a.getCategoryId(),issueCategoryTagResultDTO,NumConstant.ZERO_STR);
});
// 数据库对应标签 议题使用次数 +1
issueProjectTagDictDao.updateTagsUseCount(addList,customerId,NumConstant.ZERO_STR);

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

@ -14,11 +14,9 @@
</if>
<where>
DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
AND
<foreach collection="tags" item="t" open=" ( " separator=" OR " close=" ) ">
CATEGORY_ID = #{t.id}
AND TAG_NAME = #{t.tagName}
id = #{t.id}
</foreach>
</where>
</update>
@ -32,7 +30,7 @@
FROM issue_project_tag_dict
WHERE DEL_FLAG = 0
AND
<foreach collection="tags" item="t" separator="or" open="(" close=")">
<foreach collection="list" item="t" separator="or" open="(" close=")">
ID = #{t.id}
</foreach>
</select>

Loading…
Cancel
Save