|
@@ -144,29 +144,40 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
saveDisType(param, questionSaveVO.getDisTypeVO().getType());
|
|
|
}
|
|
|
|
|
|
- if (param.getInsertOrUpdate() == InsertOrUpdateEnum.Update.getKey()){
|
|
|
- List<Long> ids = new ArrayList<>();
|
|
|
- ids.add(questionWrapper.getId());
|
|
|
- clearAllCacheByIds(ids);
|
|
|
+ // 删除标签缓存信息
|
|
|
+ if (param.getInsertOrUpdate() == InsertOrUpdateEnum.Update.getKey()) {
|
|
|
+ clearAllCacheByIds(questionWrapper.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void clearAllCacheByIds(List<Long> ids){
|
|
|
- if (ListUtil.isNotEmpty(ids)){
|
|
|
- for (Long id : ids){
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除关联的id信息
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ */
|
|
|
+ public void clearAllCacheByIds(List<Long> ids) {
|
|
|
+ if (ListUtil.isNotEmpty(ids)) {
|
|
|
+ for (Long id : ids) {
|
|
|
cacheFacade.clearCache(id);
|
|
|
}
|
|
|
- //取父级
|
|
|
- QueryWrapper<QuestionMapping> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("son_question", ids);
|
|
|
-
|
|
|
- List<Long> pIds = questionMappingFacade.list(queryWrapper).stream()
|
|
|
- .map(r->r.getParentQuestion())
|
|
|
- .distinct().collect(Collectors.toList());
|
|
|
- clearAllCacheByIds(pIds);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除关联的id信息
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ public void clearAllCacheByIds(Long id) {
|
|
|
+ if (id != null) {
|
|
|
+ List<Long> ids = getDeleteId(id);
|
|
|
+ clearAllCacheByIds(ids);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 初始化参数
|
|
|
*
|
|
@@ -479,6 +490,9 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
Date now = DateUtil.now();
|
|
|
String person = UserUtils.getCurrentPrincipleID();
|
|
|
for (String id : idList) {
|
|
|
+ //删除缓存中的关联的标签信息
|
|
|
+ clearAllCacheByIds(Long.parseLong(id));
|
|
|
+
|
|
|
// 查询映射关系中是否存在父级
|
|
|
/* List<QuestionInfo> info = this.getParentQuestion(Long.parseLong(id));
|
|
|
for (QuestionInfo bean : info) {
|
|
@@ -550,7 +564,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
.set("is_deleted", IsDeleteEnum.Y.getKey()));
|
|
|
//删除慢病模板
|
|
|
QueryWrapper<ModuleInfo> moduleInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- moduleInfoQueryWrapper.eq("relation_id",id)
|
|
|
+ moduleInfoQueryWrapper.eq("relation_id", id)
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
List<ModuleInfo> moduleInfoList = moduleInfoFacade.list(moduleInfoQueryWrapper);
|
|
|
List<Long> moduleIds = moduleInfoList.stream().map(ModuleInfo::getId).collect(Collectors.toList());
|
|
@@ -620,7 +634,6 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
Set<Long> ids = scaleContents.stream().map(row -> row.getScaleId()).collect(Collectors.toSet());
|
|
|
for (int i = 0; i < res.size(); i++) {
|
|
|
if (ids.contains(res.get(i).getId())) {
|
|
|
- res.remove(i--);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -667,6 +680,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
|
|
|
/**
|
|
|
* 根据主标签id 检索子标签
|
|
|
+ *
|
|
|
* @param questionIndexSubVO
|
|
|
* @return
|
|
|
*/
|
|
@@ -857,4 +871,37 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
}
|
|
|
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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|