|
@@ -87,6 +87,8 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
DeptVitalFacade deptVitalFacade;
|
|
DeptVitalFacade deptVitalFacade;
|
|
@Autowired
|
|
@Autowired
|
|
KnowledgemanServiceClient knowledgemanServiceClient;
|
|
KnowledgemanServiceClient knowledgemanServiceClient;
|
|
|
|
+ @Autowired
|
|
|
|
+ CacheFacade cacheFacade;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 标签保存
|
|
* 标签保存
|
|
@@ -117,6 +119,38 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
default:
|
|
default:
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请选择标签显示类型");
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请选择标签显示类型");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 删除标签缓存信息
|
|
|
|
+ if (param.getInsertOrUpdate() == InsertOrUpdateEnum.Update.getKey()) {
|
|
|
|
+ clearAllCacheByIds(questionWrapper.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除关联的id信息
|
|
|
|
+ *
|
|
|
|
+ * @param ids
|
|
|
|
+ */
|
|
|
|
+ public void clearAllCacheByIds(List<Long> ids) {
|
|
|
|
+ if (ListUtil.isNotEmpty(ids)) {
|
|
|
|
+ for (Long id : ids) {
|
|
|
|
+ cacheFacade.clearCache(id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除关联的id信息
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ */
|
|
|
|
+ public void clearAllCacheByIds(Long id) {
|
|
|
|
+ if (id != null) {
|
|
|
|
+ List<Long> ids = getDeleteId(id);
|
|
|
|
+ clearAllCacheByIds(ids);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -424,6 +458,9 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
Date now = DateUtil.now();
|
|
Date now = DateUtil.now();
|
|
String person = UserUtils.getCurrentPrincipleID();
|
|
String person = UserUtils.getCurrentPrincipleID();
|
|
for (String id : idList) {
|
|
for (String id : idList) {
|
|
|
|
+ //删除缓存中的关联的标签信息
|
|
|
|
+ clearAllCacheByIds(Long.parseLong(id));
|
|
|
|
+
|
|
Map paramMap = new HashMap<>();
|
|
Map paramMap = new HashMap<>();
|
|
paramMap.put("delete", IsDeleteEnum.Y.getKey());
|
|
paramMap.put("delete", IsDeleteEnum.Y.getKey());
|
|
paramMap.put("ids", Arrays.asList(ids.split(",")));
|
|
paramMap.put("ids", Arrays.asList(ids.split(",")));
|
|
@@ -631,4 +668,35 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
}
|
|
}
|
|
return data;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取所有需要删除的缓存id列表
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<Long> getDeleteId(Long id) {
|
|
|
|
+ List<Long> list = new ArrayList<>();
|
|
|
|
+ list.add(id); //添加自身id
|
|
|
|
+ getParent(id, list); //添加父级
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void getParent(Long id, List<Long> list) {
|
|
|
|
+ List<QuestionMapping> questionMappingList = questionMappingFacade.list(
|
|
|
|
+ new QueryWrapper<QuestionMapping>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("son_question", id)
|
|
|
|
+ );
|
|
|
|
+ if (ListUtil.isNotEmpty(questionMappingList)) {
|
|
|
|
+ for (QuestionMapping questionMapping : questionMappingList) {
|
|
|
|
+ Long parentId = questionMapping.getParentQuestion();
|
|
|
|
+ if (!list.contains(parentId)) {
|
|
|
|
+ list.add(parentId);
|
|
|
|
+ getParent(parentId, list);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|