|
|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.project.information.domain.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
@ -9,6 +10,7 @@ import com.project.base.domain.utils.TreeUtils; |
|
|
|
import com.project.information.domain.dto.ProductLineDTO; |
|
|
|
import com.project.information.domain.entity.InformationEntity; |
|
|
|
import com.project.information.domain.entity.KnowledgeClusterEntity; |
|
|
|
import com.project.information.domain.entity.KnowledgePointEntity; |
|
|
|
import com.project.information.domain.entity.ProductLineEntity; |
|
|
|
import com.project.information.domain.enums.DraftStatusEnum; |
|
|
|
import com.project.information.domain.enums.InformationParseStatusEnum; |
|
|
|
@ -16,12 +18,15 @@ import com.project.information.domain.param.ProductLineParam; |
|
|
|
import com.project.information.domain.service.GetTreeListProductLineDomainService; |
|
|
|
import com.project.information.domain.service.InformationBaseService; |
|
|
|
import com.project.information.domain.service.KnowledgeClusterBaseService; |
|
|
|
import com.project.information.domain.service.KnowledgePointBaseService; |
|
|
|
import com.project.information.domain.service.ProductLineBaseService; |
|
|
|
import com.project.information.mapper.InformationMapper; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -34,7 +39,7 @@ public class GetTreeListProductLineDomainServiceImpl implements GetTreeListProdu |
|
|
|
private InformationBaseService informationBaseService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private KnowledgeClusterBaseService knowledgeClusterBaseService; |
|
|
|
private KnowledgePointBaseService knowledgePointBaseService; |
|
|
|
@Override |
|
|
|
public Result<List<ProductLineDTO>> treeList(ProductLineParam param){ |
|
|
|
return Result.success(buildTree(param)); |
|
|
|
@ -73,6 +78,35 @@ public class GetTreeListProductLineDomainServiceImpl implements GetTreeListProdu |
|
|
|
.eq(InformationEntity::getDraftStatus, DraftStatusEnum.PENDING.getValue()) |
|
|
|
.count(); |
|
|
|
productLineDTO.setExistPendingReview(pendingCount > 0); |
|
|
|
|
|
|
|
// 查询聚类完成和审核完成情况:该子产品线下已解析成功的文件中,
|
|
|
|
// 有知识点但未分配簇的文件视为未完成聚类,没有知识点的文件除外
|
|
|
|
List<InformationEntity> successFiles = informationBaseService.lambdaQuery() |
|
|
|
.eq(InformationEntity::getSubLineId, productLineDTO.getId()) |
|
|
|
.eq(InformationEntity::getParseStatus, InformationParseStatusEnum.Success.getValue()) |
|
|
|
.eq(InformationEntity::getDraftStatus, DraftStatusEnum.APPROVED.getValue()) |
|
|
|
.list(); |
|
|
|
if (CollUtil.isNotEmpty(successFiles)) { |
|
|
|
List<Long> fileIds = successFiles.stream().map(InformationEntity::getId).toList(); |
|
|
|
List<KnowledgePointEntity> allKps = knowledgePointBaseService.lambdaQuery() |
|
|
|
.in(KnowledgePointEntity::getInformationId, fileIds) |
|
|
|
.list(); |
|
|
|
Map<Long, List<KnowledgePointEntity>> kpsByFile = allKps.stream() |
|
|
|
.collect(Collectors.groupingBy(KnowledgePointEntity::getInformationId)); |
|
|
|
|
|
|
|
boolean hasClusteringIncomplete = false; |
|
|
|
for (Long fileId : fileIds) { |
|
|
|
List<KnowledgePointEntity> fileKps = kpsByFile.getOrDefault(fileId, Collections.emptyList()); |
|
|
|
if (fileKps.isEmpty()) { |
|
|
|
continue; // 没有知识点的文件不参与判断
|
|
|
|
} |
|
|
|
if (fileKps.stream().anyMatch(kp -> kp.getClusterId() == null)) { |
|
|
|
hasClusteringIncomplete = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
productLineDTO.setExistClusteringIncomplete(hasClusteringIncomplete); |
|
|
|
} |
|
|
|
} |
|
|
|
return TreeUtils.buildLongTree(res , ProductLineDTO::getId , ProductLineDTO::getParentId , |
|
|
|
ProductLineDTO::setChildrenList); |
|
|
|
|