59339 法规技术评估导出数据有误修改。
This commit is contained in:
+56
-2
@@ -45,6 +45,9 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -298,10 +301,12 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl
|
||||
cell.setCellValue(titleArr[i]);
|
||||
}
|
||||
|
||||
List<FileSplitValImgExportDto> allImgList = new ArrayList<>(); // 存储文件数据
|
||||
|
||||
//设置导出数据
|
||||
if(CollectionUtils.isNotEmpty(exportData)) {
|
||||
List<FileSpiltValTableExportDto> allTableList = new ArrayList<>(); // 存储表格数据
|
||||
List<FileSplitValImgExportDto> allImgList = new ArrayList<>(); // 存储文件数据
|
||||
|
||||
SarFileSplitItemsEOPage page = new SarFileSplitItemsEOPage();
|
||||
|
||||
for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) {
|
||||
@@ -318,7 +323,11 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl
|
||||
List<SarFileSplitItemsValEO> getValList = this.sarFileSplitItemsValEOService.queryByList(valEOPage);
|
||||
List<FileSplitValExportDto> valContentList = this.fileSplitItemsEOService.combineItemValInfo(getValList,allTableList,allImgList,page); //TODO
|
||||
if(CollectionUtils.isNotEmpty(valContentList)){
|
||||
itemContent = valContentList.get(0).getValContent();
|
||||
String contents = "";
|
||||
for (FileSplitValExportDto fileSplitValExportDto : valContentList) {
|
||||
contents += fileSplitValExportDto.getValContent() + "\n";
|
||||
}
|
||||
itemContent = contents;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,6 +350,12 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl
|
||||
fileTemp.delete();
|
||||
}
|
||||
fileTemp.mkdirs();
|
||||
|
||||
//下载图片内容到导出的压缩包中
|
||||
if (allImgList != null && !allImgList.isEmpty()) {
|
||||
downLoadImgList(allImgList,path);
|
||||
}
|
||||
|
||||
//excel
|
||||
OutputStream excelOS = new FileOutputStream(path + File.separator + fileName);
|
||||
workbook.write(excelOS);
|
||||
@@ -434,4 +449,43 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl
|
||||
}
|
||||
return evaluationMethodsName;
|
||||
}
|
||||
|
||||
public void downLoadImgList(List<FileSplitValImgExportDto> allImgList, String fileNowPath) {
|
||||
for(FileSplitValImgExportDto imgExportDto : allImgList){
|
||||
String oldPath = imgExportDto.getImgPath();
|
||||
String newPath = fileNowPath + File.separator + imgExportDto.getImgName();
|
||||
if (CosBootUtil.doesObjectExist(oldPath)){
|
||||
try (InputStream in = CosBootUtil.download(oldPath);) {
|
||||
copyFile1(in, newPath);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void copyFile1(InputStream in, String destPath) throws IOException {
|
||||
BufferedInputStream bis = new BufferedInputStream(in);
|
||||
BufferedOutputStream bos =
|
||||
new BufferedOutputStream(Files.newOutputStream(Paths.get(destPath),
|
||||
StandardOpenOption.CREATE,
|
||||
StandardOpenOption.TRUNCATE_EXISTING,
|
||||
StandardOpenOption.WRITE));
|
||||
// 打开输入流
|
||||
// FileInputStream fis = new FileInputStream(srcPath);
|
||||
// 打开输出流
|
||||
// FileOutputStream fos = new FileOutputStream(destPath);
|
||||
// 读取和写入信息
|
||||
byte[] bytes = new byte[1024 * 1024];
|
||||
int len;
|
||||
while ((len = bis.read(bytes)) > 0) {
|
||||
bos.write(bytes, 0, len);
|
||||
}
|
||||
// 关闭流 先开后关 后开先关
|
||||
// 先开后关,先开的输入流,再开的输出流,那么应该先关输出流,再关输入流
|
||||
// 先关外层,再关内层。如BufferedInputStream包装了一个FileInputStream,那么先关BufferedInputStream,再关FileInputStream。
|
||||
bos.close(); // 后开先关
|
||||
bis.close(); // 先开后关
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1519,7 +1519,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
list1.add("</text>");
|
||||
mapTemp.put("pre_tags", list);
|
||||
mapTemp.put("post_tags", list1);
|
||||
mapTemp.put("fragment_size", 500);//高亮字段内容长度,去除html样式标签,统计字数,设置为200
|
||||
mapTemp.put("fragment_size", 320);//高亮字段内容长度,去除html样式标签,统计字数,设置为200
|
||||
mapTemp.put("number_of_fragments", 1);//高亮内容默认分为5段, 此处设置为一段
|
||||
mapTemp.put("type", "plain");
|
||||
mapHighlight.put(key, mapTemp);
|
||||
|
||||
+2
-1
@@ -3209,7 +3209,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
|
||||
} else if ("TEXT".equals(type)) {
|
||||
lastOne.setValContent(lastOne.getValContent()+itemsValEO.getItemContent() + "\n");
|
||||
//lastOne.setValContent(lastOne.getValContent()+itemsValEO.getItemContent() + "\n");
|
||||
lastOne.setValContent(itemsValEO.getItemContent() + "\n");
|
||||
valContent.add(lastOne);
|
||||
|
||||
//第一次
|
||||
|
||||
Reference in New Issue
Block a user