|
|
|
@ -7,10 +7,16 @@ import com.project.base.domain.exception.BusinessErrorException; |
|
|
|
import com.project.base.domain.result.Result; |
|
|
|
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.ProductLineEntity; |
|
|
|
import com.project.information.domain.enums.InformationParseStatusEnum; |
|
|
|
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.ProductLineBaseService; |
|
|
|
import com.project.information.mapper.InformationMapper; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@ -22,6 +28,12 @@ import java.util.stream.Collectors; |
|
|
|
public class GetTreeListProductLineDomainServiceImpl implements GetTreeListProductLineDomainService { |
|
|
|
@Autowired |
|
|
|
private ProductLineBaseService productLineBaseService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private InformationBaseService informationBaseService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private KnowledgeClusterBaseService knowledgeClusterBaseService; |
|
|
|
@Override |
|
|
|
public Result<List<ProductLineDTO>> treeList(ProductLineParam param){ |
|
|
|
LambdaQueryWrapper<ProductLineEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
@ -31,6 +43,21 @@ public class GetTreeListProductLineDomainServiceImpl implements GetTreeListProdu |
|
|
|
List<ProductLineDTO> res = productLineBaseService.list(queryWrapper) |
|
|
|
.stream().map(entity -> entity.toDTO(ProductLineDTO::new)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
for (ProductLineDTO productLineDTO : res) { |
|
|
|
if (!productLineDTO.getLeaf()) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
Long count = informationBaseService.lambdaQuery() |
|
|
|
.eq(InformationEntity::getSubLineId, productLineDTO.getId()) |
|
|
|
.count(); |
|
|
|
productLineDTO.setDocumentNum(count.intValue()); |
|
|
|
productLineDTO.setHasDocument(count > 0); |
|
|
|
Long inProgressCount = informationBaseService.lambdaQuery() |
|
|
|
.eq(InformationEntity::getSubLineId, productLineDTO.getId()) |
|
|
|
.eq(InformationEntity::getParseStatus, InformationParseStatusEnum.InProgress.getValue()) |
|
|
|
.count(); |
|
|
|
productLineDTO.setExistInProgress(inProgressCount > 0); |
|
|
|
} |
|
|
|
return Result.success(TreeUtils.buildLongTree(res , ProductLineDTO::getId , ProductLineDTO::getParentId , |
|
|
|
ProductLineDTO::setChildrenList)); |
|
|
|
|
|
|
|
|