Commit 65b8fd9b authored by alex yao's avatar alex yao

feat:获取知识库列表添加文档详情字段

parent 72075138
......@@ -20,6 +20,7 @@ import cn.com.poc.common.constant.CommonConstant;
import cn.com.poc.common.constant.XLangConstant;
import cn.com.poc.common.utils.StringUtils;
import cn.com.yict.framemax.core.exception.BusinessException;
import cn.com.yict.framemax.core.i18n.I18nMessageException;
import org.springframework.stereotype.Component;
import cn.com.poc.agent_application.rest.BizAgentApplicationMallRest;
import cn.com.poc.agent_application.service.BizAgentApplicationMallService;
......@@ -172,6 +173,8 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
case XLangConstant.ZH_TW:
result.add(entity.getCategoryTw());
break;
default:
throw new I18nMessageException("不支持的语言");
}
}
return result;
......
......@@ -2,6 +2,7 @@ package cn.com.poc.knowledge.convert;
import cn.com.poc.common.utils.JsonUtils;
import cn.com.poc.common.utils.StringUtils;
import cn.com.poc.knowledge.dto.BizKnowledgeDocumentDto;
import cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity;
import cn.com.poc.knowledge.model.BizKnowledgeDocumentModel;
import cn.com.poc.thirdparty.resource.demand.ai.entity.knowledge.SegmentationConfigRequest;
......@@ -58,4 +59,20 @@ public class KnowledgeDocumentConvert {
return bizKnowledgeDocumentModel;
}
public static BizKnowledgeDocumentDto entityToDto(BizKnowledgeDocumentEntity entity) {
BizKnowledgeDocumentDto bizKnowledgeDocumentDto = new BizKnowledgeDocumentDto();
bizKnowledgeDocumentDto.setKdId(entity.getKdId());
bizKnowledgeDocumentDto.setOwner(entity.getOwner());
bizKnowledgeDocumentDto.setKnowledgeType(entity.getKnowledgeType());
bizKnowledgeDocumentDto.setDocumentName(entity.getDocumentName());
bizKnowledgeDocumentDto.setDocumentUrl(entity.getDocumentUrl());
bizKnowledgeDocumentDto.setDocumentSize(String.valueOf(entity.getDocumentSize()));
bizKnowledgeDocumentDto.setCharCount(entity.getCharCount());
bizKnowledgeDocumentDto.setUploadTime(entity.getUploadTime());
bizKnowledgeDocumentDto.setIsEnable(entity.getIsEnable());
bizKnowledgeDocumentDto.setKnowledgeId(entity.getKnowledgeId());
bizKnowledgeDocumentDto.setTrainStatus(entity.getTrainStatus());
bizKnowledgeDocumentDto.setSegmentationConfig(entity.getSegmentationConfig());
return bizKnowledgeDocumentDto;
}
}
......@@ -5,13 +5,13 @@ import java.util.List;
public class QueryKnowledgeDocumentDto extends BizKnowledgeInfoDto {
private List<String> documentNames;
private List<BizKnowledgeDocumentDto> documentInfos;
public List<String> getDocumentNames() {
return documentNames;
public List<BizKnowledgeDocumentDto> getDocumentInfos() {
return documentInfos;
}
public void setDocumentNames(List<String> documentNames) {
this.documentNames = documentNames;
public void setDocumentInfos(List<BizKnowledgeDocumentDto> documentInfos) {
this.documentInfos = documentInfos;
}
}
......@@ -7,6 +7,7 @@ import cn.com.poc.common.utils.JsonUtils;
import cn.com.poc.knowledge.aggregate.KnowledgeService;
import cn.com.poc.knowledge.constant.KnowledgeConstant;
import cn.com.poc.knowledge.convert.BizKnowledgeInfoConvert;
import cn.com.poc.knowledge.convert.KnowledgeDocumentConvert;
import cn.com.poc.knowledge.dto.*;
import cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity;
import cn.com.poc.knowledge.entity.BizKnowledgeInfoEntity;
......@@ -203,8 +204,9 @@ public class KnowledgeRestImpl implements KnowledgeRest {
}.getType());
if (CollectionUtils.isNotEmpty(kdIdList)) {
List<BizKnowledgeDocumentEntity> entities = knowledgeService.getListByKdIds(kdIdList);
List<String> documentNames = entities.stream().map(BizKnowledgeDocumentEntity::getDocumentName).collect(Collectors.toList());
dto.setDocumentNames(documentNames);
if (CollectionUtils.isNotEmpty(entities)) {
dto.setDocumentInfos(entities.stream().map(KnowledgeDocumentConvert::entityToDto).collect(Collectors.toList()));
}
}
return dto;
}).collect(Collectors.toList());
......
......@@ -71,3 +71,6 @@ tencent.speech.synthesizer.secretKey=4yg9kIdpoptnmP9nFUaadnt32QEqEOOB
#email send
project.name="poc-api"
#18n
i18n.disable = false
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment