|
|
@@ -164,6 +164,72 @@ public class WorkKnowledgeBaseShareService extends CrudService<WorkKnowledgeBase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 查询同名文件的目录路径及审核状态列表(排除问答答疑分类)
|
|
|
+ * @param name 文件名称
|
|
|
+ * @param excludeId 排除的文件ID(编辑时排除自身)
|
|
|
+ * @return 包含 path(目录路径)和 auditStatus(审核状态值)的列表
|
|
|
+ */
|
|
|
+ public List<Map<String, Object>> findDuplicateFilePaths(String name, String excludeId) {
|
|
|
+ List<Map<String, Object>> duplicates = dao.findDuplicateFilePaths(name, excludeId);
|
|
|
+ List<Map<String, Object>> results = new ArrayList<>();
|
|
|
+ for (Map<String, Object> dup : duplicates) {
|
|
|
+ String treeNodeId = dup.get("treeNodeId") != null ? dup.get("treeNodeId").toString() : null;
|
|
|
+ if (StringUtils.isNotBlank(treeNodeId)) {
|
|
|
+ String path = buildTreePath(treeNodeId);
|
|
|
+ if (StringUtils.isNotBlank(path)) {
|
|
|
+ // 同一目录路径不重复添加
|
|
|
+ boolean pathExists = false;
|
|
|
+ for (Map<String, Object> r : results) {
|
|
|
+ if (path.equals(r.get("path"))) {
|
|
|
+ pathExists = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!pathExists) {
|
|
|
+ Map<String, Object> item = new HashMap<>();
|
|
|
+ item.put("path", path);
|
|
|
+ Object auditStatusObj = dup.get("auditStatus");
|
|
|
+ item.put("auditStatus", auditStatusObj != null ? auditStatusObj.toString() : "");
|
|
|
+ results.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据树节点ID构建完整目录路径(从根节点到当前节点)
|
|
|
+ */
|
|
|
+ private String buildTreePath(String treeNodeId) {
|
|
|
+ WorkKnowledgeBaseTreeInfo node = treeInfoDao.get(treeNodeId);
|
|
|
+ if (node == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ List<String> names = new ArrayList<>();
|
|
|
+ names.add(node.getTreeName());
|
|
|
+ // 通过parent_ids向上追溯祖先节点
|
|
|
+ String parentIds = node.getParentIds();
|
|
|
+ if (StringUtils.isNotBlank(parentIds)) {
|
|
|
+ // parentIds格式: ,rootId,node1,node2,
|
|
|
+ String cleaned = parentIds.replaceAll("^,+", "").replaceAll(",+$", "");
|
|
|
+ if (StringUtils.isNotBlank(cleaned)) {
|
|
|
+ String[] ids = cleaned.split(",");
|
|
|
+ // 从最近的祖先节点向根节点遍历
|
|
|
+ for (int i = ids.length - 1; i >= 0; i--) {
|
|
|
+ if (StringUtils.isNotBlank(ids[i])) {
|
|
|
+ WorkKnowledgeBaseTreeInfo ancestor = treeInfoDao.get(ids[i].trim());
|
|
|
+ if (ancestor != null && StringUtils.isNotBlank(ancestor.getTreeName())) {
|
|
|
+ names.add(0, ancestor.getTreeName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return StringUtils.join(names, "-");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 根据分类名称查询分类列表
|
|
|
*/
|
|
|
public List<com.jeeplus.modules.WorkKnowledgeBase.entity.WorkKnowledgePointCategory> findCategoriesByName(String categoryName) {
|