提交 400ed60c 作者: chenshiqiang

adjust

上级 b5dbf984
...@@ -255,7 +255,7 @@ public class Constants { ...@@ -255,7 +255,7 @@ public class Constants {
//招投标索引 //招投标索引
public final static String TENDER = "tender"; public final static String TENDER = "tender";
public static final Integer MAX_FILE_SIZE = 5 * 1024 * 1024; public static final Integer MAX_FILE_SIZE = 50 * 1024 * 1024;
public static final Integer CONVERT_TIMEOUT_MS = 120000; public static final Integer CONVERT_TIMEOUT_MS = 120000;
public static final String CONVERTATION_ERROR_MESSAGE_TEMPLATE = "Error occurred in the ConvertService: "; public static final String CONVERTATION_ERROR_MESSAGE_TEMPLATE = "Error occurred in the ConvertService: ";
public static final Long FULL_LOADING_IN_PERCENT = 100L; public static final Long FULL_LOADING_IN_PERCENT = 100L;
......
...@@ -93,12 +93,24 @@ class KnowledgeServiceImpl implements IKnowledgeService { ...@@ -93,12 +93,24 @@ class KnowledgeServiceImpl implements IKnowledgeService {
String html = null; String html = null;
try { try {
File file = new File(filesStorage + knowledge.getFiles().get(0).getFilePath()); File file = new File(filesStorage + knowledge.getFiles().get(0).getFilePath());
html =DocUtil.convertDocStream2Html(new FileInputStream(file)); html = DocUtil.convertDocStream2Html(new FileInputStream(file));
String htmlWithTable = html.replace("</p>", "######</p>"); String htmlWithTable = html.replace("</p>", "######</p>");
contentStringList = Arrays.asList(htmlWithTable.split("######")); contentStringList = Arrays.asList(htmlWithTable.split("######"));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if (null == knowledge.getTitle()) {
for (String tem : contentStringList) {
String text = Jsoup.parse(tem).text();
log.info("info:{}", text);
if ((!tem.contains("<title>"))&&(!text.isEmpty())) {
knowledge.setTitle(text);
break;
}
}
}
List<String> messageContentList = contentStringList.stream() List<String> messageContentList = contentStringList.stream()
.filter(item -> !item.contains("<img")) .filter(item -> !item.contains("<img"))
.filter(item -> !item.contains("<table")) .filter(item -> !item.contains("<table"))
...@@ -108,21 +120,12 @@ class KnowledgeServiceImpl implements IKnowledgeService { ...@@ -108,21 +120,12 @@ class KnowledgeServiceImpl implements IKnowledgeService {
.filter(item -> !item.contains("</td>")) .filter(item -> !item.contains("</td>"))
.map(item -> Jsoup.parse(item).text()) .map(item -> Jsoup.parse(item).text())
.collect(Collectors.toList()); .collect(Collectors.toList());
messageContentList = messageContentList. messageContentList = messageContentList.
stream().filter(item -> item.length() > 17) stream().filter(item -> item.length() > 10)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (!messageContentList.isEmpty()) { if (!messageContentList.isEmpty()) {
boolean mark = true;
if (null != knowledge.getTitle()) {
mark = false;
}
for (String tem : messageContentList) { for (String tem : messageContentList) {
log.info("info:{}", tem);
if (mark && (!tem.isEmpty())) {
knowledge.setTitle(tem);
mark = false;
}
contentList.add(Content.builder() contentList.add(Content.builder()
.contentId(codeGenerateUtil.geneIdNo(Constants.FINANCE, 8)) .contentId(codeGenerateUtil.geneIdNo(Constants.FINANCE, 8))
.content(tem) .content(tem)
...@@ -298,7 +301,7 @@ class KnowledgeServiceImpl implements IKnowledgeService { ...@@ -298,7 +301,7 @@ class KnowledgeServiceImpl implements IKnowledgeService {
boolQuery.must(QueryBuilders.termsQuery("knowledgeProjectId", catList)); boolQuery.must(QueryBuilders.termsQuery("knowledgeProjectId", catList));
} }
if (StringUtils.isNotEmpty(knowledgeParam.getTypeIds())) { if (StringUtils.isNotEmpty(knowledgeParam.getTypeIds())) {
boolQuery.must(QueryBuilders.termsQuery("typeId",Arrays.asList(knowledgeParam.getTypeIds().split(",")) )); boolQuery.must(QueryBuilders.termsQuery("typeId", Arrays.asList(knowledgeParam.getTypeIds().split(","))));
} }
if (null != knowledgeParam.getVerifyStatus()) { if (null != knowledgeParam.getVerifyStatus()) {
boolQuery.must(QueryBuilders.termQuery("verifyStatus", knowledgeParam.getVerifyStatus())); boolQuery.must(QueryBuilders.termQuery("verifyStatus", knowledgeParam.getVerifyStatus()));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论