Merge branch 'caihaohan'
This commit is contained in:
+1
-1
@@ -109,7 +109,7 @@ public class IReportContentServiceImpl extends ServiceImpl<ReportContentDao, Rep
|
||||
//将内容存入
|
||||
ReportContentEntity reportContent = query().eq("report_id", reportId).one();
|
||||
if (reportContent == null) {
|
||||
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, reportContentFileIds,content.toString());
|
||||
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, reportContentFileIds, content.toString());
|
||||
save(reportContentEntity);
|
||||
} else {
|
||||
reportContent.setReportContent(content.toString());
|
||||
|
||||
@@ -262,8 +262,8 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
//修改报表内容表(先删后增)
|
||||
iReportContentService.removeByReportId(reportId);
|
||||
try {
|
||||
iReportContentService.insertReportContent(reportId);
|
||||
log.info("抽取reportId为{}报告内容", reportId);
|
||||
iReportContentService.insertReportContent(reportId);
|
||||
count++;
|
||||
} catch (IOException e) {
|
||||
log.error("获取reportId为{}的报告内容失败", reportId);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.adc.da.report.util;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.adc.da.report.constant.ReportConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -92,9 +94,21 @@ public class FileContentUtil {
|
||||
fis.close();
|
||||
log.info("文件内容抽取失败,原因可能是上传的文件为空文件");
|
||||
}
|
||||
return content.toString();
|
||||
return cleanInvalidCharacters(content.toString());
|
||||
}
|
||||
|
||||
public static String cleanInvalidCharacters(String input) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder();
|
||||
for (char ch : input.toCharArray()) {
|
||||
if (encoder.canEncode(ch)) {
|
||||
stringBuilder.append(ch);
|
||||
}
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
|
||||
private static String readExcelContent(org.apache.poi.ss.usermodel.Workbook workbook) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int numberOfSheets = workbook.getNumberOfSheets();
|
||||
|
||||
Reference in New Issue
Block a user