Browse Source

修改绍兴站机器狗无人机下发周期,间隔任务不执行问题

master
wangguangyuan 3 months ago
parent
commit
e9a6c48804
2 changed files with 34 additions and 40 deletions
  1. +33
    -39
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/PatrolTaskResultMainController.java
  2. +1
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/task/controller/PatrolTaskController.java

+ 33
- 39
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/PatrolTaskResultMainController.java View File

@ -479,55 +479,36 @@ 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=\"InspectionReport_" + System.currentTimeMillis() + ".xlsx\"");
// InspectionReport inspectionReport = new InspectionReport();
InspectionReport inspectionReport = patrolResultService.getInspectionReport(lineIds, patrolTaskResultMain);
List<InspectionReportData> inspectionReportDataList = inspectionReport.getReportDatalist();
List<String> images = new ArrayList<>();
Map<String, String> imgSrcToFileNameMap = new HashMap<>();
for (InspectionReportData reportData : inspectionReportDataList) {
// InspectionReportImg inspectionReportImg = new InspectionReportImg();
// inspectionReportImg.setReportInfoId(reportData.getLineId());
// List<InspectionReportImg> reportImgList =
// inspectionReportImgService.selectInspectionReportImgList(inspectionReportImg);
// reportData.setReportImgList(reportImgList);
List<InspectionReportImg> reportImgList = reportData.getReportImgList();
int imgIndex = 1; // 每个报告数据项下的图片索引
for (InspectionReportImg reportImg : reportImgList) {
if (StringUtils.isNotEmpty(reportImg.getImgSrc()) && reportImg.getImgType().equals("0")) {
String originalImgSrc = reportImg.getImgSrc();
images.add(originalImgSrc);
// String pointName = reportData.getPointName();
// pointName = (pointName != null) ? pointName : "unnamed";
// // 提取文件扩展名
// String extension = "";
// int dotIndex = originalImgSrc.lastIndexOf('.');
// if (dotIndex > 0) {
// extension = originalImgSrc.substring(dotIndex);
// }
//
// // 生成唯一文件名包含 lineId 防止重复
// String uniqueFileName = String.format("%s_%s_%d%s",
// originalImgSrc.split("_")[2],
// pointName,
// imgIndex,
// extension);
//
// imgSrcToFileNameMap.put(originalImgSrc, uniqueFileName);
// imgIndex++;
}
}
}
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);
// 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();
// }
// });
for (String algorithmBaseImagePath : images) {
// }
images.parallelStream().forEach(algorithmBaseImagePath -> {
try {
sftpClient.downLoad(algorithmBaseImagePath, (inputStream) -> {
byte[] bytes = streamHashMap.get(algorithmBaseImagePath);
@ -538,10 +519,10 @@ public class PatrolTaskResultMainController extends BaseController {
});
} catch (Exception e) {
logger.info("报告导出下载图片失败: {}", algorithmBaseImagePath, e);
e.printStackTrace();
}
}
});
try (SXSSFWorkbook sxssfWorkbook = getSXSSFWorkbookShaoxing(inspectionReport, streamHashMap);
ServletOutputStream outputStream = response.getOutputStream()) {
sxssfWorkbook.write(outputStream);
@ -1567,7 +1548,7 @@ public class PatrolTaskResultMainController extends BaseController {
}
Map<String, byte[]> streamHashMap = new HashMap<>();
for (String algorithmBaseImagePath : images) {
images.parallelStream().forEach(algorithmBaseImagePath -> {
try {
sftpClient.downLoad(algorithmBaseImagePath, (inputStream) -> {
byte[] bytes = streamHashMap.get(algorithmBaseImagePath);
@ -1575,12 +1556,26 @@ public class PatrolTaskResultMainController extends BaseController {
if (bytes == null) {
streamHashMap.put(algorithmBaseImagePath, byInputStream);
}
});
} catch (Exception e) {
logger.info("报告归档下载图片失败: {}", algorithmBaseImagePath, e);
e.printStackTrace();
}
}
});
// 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);
@ -3511,7 +3506,6 @@ public class PatrolTaskResultMainController extends BaseController {
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 8, 8));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 9, 10));
sheet.addMergedRegion(new CellRangeAddress(7 + total, 7 + total + ((List) imgList).size(), 11, 11));
new ArrayList();
Iterator var93 = ((List) imgList).iterator();
while (var93.hasNext()) {


+ 1
- 1
inspect-main/inspect-main-task/src/main/java/com/inspect/task/controller/PatrolTaskController.java View File

@ -1214,7 +1214,7 @@ public class PatrolTaskController extends BaseController {
}
private PatrolSendTask handleFixTypeTask(PatrolSendTask patrolSendTask) {
if (null != patrolSendTask.getFixedStartTime()) {
if (StringUtils.isNotEmpty(patrolSendTask.getFixedStartTime())) {
patrolSendTask.setCycleEndTime("");
patrolSendTask.setCycleExecuteTime("");
patrolSendTask.setCycleMonth("");


Loading…
Cancel
Save