|
|
|
@ -478,7 +478,7 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
} |
|
|
|
lineIds = lineIds.stream().distinct().collect(Collectors.toList()); |
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=\"task_export_" + System.currentTimeMillis() + ".xlsx\""); |
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=\"InspectionReport_" + System.currentTimeMillis() + ".xlsx\""); |
|
|
|
// InspectionReport inspectionReport = new InspectionReport(); |
|
|
|
InspectionReport inspectionReport = patrolResultService.getInspectionReport(lineIds, patrolTaskResultMain); |
|
|
|
List<InspectionReportData> inspectionReportDataList = inspectionReport.getReportDatalist(); |
|
|
|
@ -520,13 +520,27 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
} |
|
|
|
Map<String, byte[]> streamHashMap = new HashMap<>(); |
|
|
|
|
|
|
|
images.parallelStream().forEach(imagePath -> { |
|
|
|
byte[] shm = streamHashMap.get(imagePath); |
|
|
|
byte[] bytes = downloadAndCompressImage(imagePath); |
|
|
|
if (shm == null) { |
|
|
|
streamHashMap.put(imagePath, bytes); |
|
|
|
// images.parallelStream().forEach(imagePath -> { |
|
|
|
// byte[] shm = streamHashMap.get(imagePath); |
|
|
|
// byte[] bytes = downloadAndCompressImage(imagePath); |
|
|
|
// if (shm == null) { |
|
|
|
// streamHashMap.put(imagePath, bytes); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
for (String algorithmBaseImagePath : images) { |
|
|
|
try { |
|
|
|
sftpClient.downLoad(algorithmBaseImagePath, (inputStream) -> { |
|
|
|
byte[] bytes = streamHashMap.get(algorithmBaseImagePath); |
|
|
|
byte[] byInputStream = getStringByInputStream(inputStream); |
|
|
|
if (bytes == null) { |
|
|
|
streamHashMap.put(algorithmBaseImagePath, byInputStream); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
try (SXSSFWorkbook sxssfWorkbook = getSXSSFWorkbookShaoxing(inspectionReport, streamHashMap); |
|
|
|
ServletOutputStream outputStream = response.getOutputStream()) { |
|
|
|
@ -601,7 +615,12 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
|
|
|
|
// 点位汇总 |
|
|
|
// List<String> statusList = Arrays.asList(MessageUtils.get("异常"), MessageUtils.get("待人工确认"), MessageUtils.get("正常")); |
|
|
|
List<String> statusList = Collections.singletonList(MessageUtils.get("缺陷")); |
|
|
|
List<String> statusList = new ArrayList<>(); |
|
|
|
statusList.add(MessageUtils.get("缺陷")); |
|
|
|
if ("1".equals(exportReportFlag)) { |
|
|
|
statusList.add(MessageUtils.get("正常")); |
|
|
|
statusList.add(MessageUtils.get("异常")); |
|
|
|
} |
|
|
|
for (String status : statusList) { |
|
|
|
addStatusSection(doc, report, status, images); |
|
|
|
} |
|
|
|
@ -832,10 +851,12 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
setTableHeaderStyle(table); |
|
|
|
// 填充数据 |
|
|
|
List<InspectionReportData> dataList = report.getReportDatalist(); |
|
|
|
|
|
|
|
for (InspectionReportData data : dataList) { |
|
|
|
XWPFTableRow row = table.createRow(); |
|
|
|
fillDataRow(row, data, images); |
|
|
|
if (dataList != null && dataList.size() > 0) { |
|
|
|
dataList = dataList.stream().filter(data -> status.equals(data.getPointStatus())).collect(Collectors.toList()); |
|
|
|
for (InspectionReportData data : dataList) { |
|
|
|
XWPFTableRow row = table.createRow(); |
|
|
|
fillDataRow(row, data, images); |
|
|
|
} |
|
|
|
} |
|
|
|
addEmptyParagraph(doc); |
|
|
|
} |
|
|
|
@ -1546,27 +1567,27 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, byte[]> streamHashMap = new HashMap<>(); |
|
|
|
// for (String algorithmBaseImagePath : images) { |
|
|
|
// try { |
|
|
|
// sftpClient.downLoad(algorithmBaseImagePath, (inputStream) -> { |
|
|
|
// byte[] bytes = streamHashMap.get(algorithmBaseImagePath); |
|
|
|
// byte[] byInputStream = getStringByInputStream(inputStream); |
|
|
|
// if (bytes == null) { |
|
|
|
// streamHashMap.put(algorithmBaseImagePath, byInputStream); |
|
|
|
// } |
|
|
|
// |
|
|
|
// }); |
|
|
|
// } catch (Exception e) { |
|
|
|
// e.printStackTrace(); |
|
|
|
// } |
|
|
|
// } |
|
|
|
images.parallelStream().forEach(imagePath -> { |
|
|
|
byte[] shm = streamHashMap.get(imagePath); |
|
|
|
byte[] bytes = downloadAndCompressImage(imagePath); |
|
|
|
if (shm == null) { |
|
|
|
streamHashMap.put(imagePath, bytes); |
|
|
|
for (String algorithmBaseImagePath : images) { |
|
|
|
try { |
|
|
|
sftpClient.downLoad(algorithmBaseImagePath, (inputStream) -> { |
|
|
|
byte[] bytes = streamHashMap.get(algorithmBaseImagePath); |
|
|
|
byte[] byInputStream = getStringByInputStream(inputStream); |
|
|
|
if (bytes == null) { |
|
|
|
streamHashMap.put(algorithmBaseImagePath, byInputStream); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// images.parallelStream().forEach(imagePath -> { |
|
|
|
// byte[] shm = streamHashMap.get(imagePath); |
|
|
|
// byte[] bytes = downloadAndCompressImage(imagePath); |
|
|
|
// if (shm == null) { |
|
|
|
// streamHashMap.put(imagePath, bytes); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2347,18 +2368,19 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
InspectionReportData inspectionReportData = new InspectionReportData(); |
|
|
|
|
|
|
|
List<InspectionReportData> list = new ArrayList(); |
|
|
|
// inspectionReportData.setPointStatus(MessageUtils.get("异常")); |
|
|
|
// list.add(inspectionReportData); |
|
|
|
// InspectionReportData inspection = new InspectionReportData(); |
|
|
|
// inspection.setPointStatus(MessageUtils.get("待人工确认")); |
|
|
|
// list.add(inspection); |
|
|
|
// InspectionReportData inection = new InspectionReportData(); |
|
|
|
// inection.setPointStatus(MessageUtils.get("正常")); |
|
|
|
// list.add(inection); |
|
|
|
inspectionReportData.setPointStatus(MessageUtils.get("缺陷")); |
|
|
|
list.add(inspectionReportData); |
|
|
|
InspectionReportData inspectionReportQxData = new InspectionReportData(); |
|
|
|
inspectionReportQxData.setPointStatus(MessageUtils.get("缺陷")); |
|
|
|
list.add(inspectionReportQxData); |
|
|
|
if ("1".equals(exportReportFlag)) { |
|
|
|
InspectionReportData inspectionReportZcData = new InspectionReportData(); |
|
|
|
inspectionReportZcData.setPointStatus(MessageUtils.get("正常")); |
|
|
|
list.add(inspectionReportZcData); |
|
|
|
InspectionReportData inspectionReportYcData = new InspectionReportData(); |
|
|
|
inspectionReportYcData.setPointStatus(MessageUtils.get("异常")); |
|
|
|
list.add(inspectionReportYcData); |
|
|
|
} |
|
|
|
int total = 0; |
|
|
|
|
|
|
|
label186: |
|
|
|
|