|
|
@ -33,12 +33,7 @@ import java.io.InputStream; |
|
|
import java.io.UnsupportedEncodingException; |
|
|
import java.io.UnsupportedEncodingException; |
|
|
import java.net.URLEncoder; |
|
|
import java.net.URLEncoder; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.Iterator; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.zip.Adler32; |
|
|
import java.util.zip.Adler32; |
|
|
import java.util.zip.CheckedOutputStream; |
|
|
import java.util.zip.CheckedOutputStream; |
|
|
@ -127,7 +122,6 @@ public class InspectionReportController extends BaseController { |
|
|
|
|
|
|
|
|
@GetMapping({"/{lineId}/{filter}"}) |
|
|
@GetMapping({"/{lineId}/{filter}"}) |
|
|
public AjaxResult getInfo(@PathVariable("lineId") Long lineId, @PathVariable(value = "filter",required = false) String filter) { |
|
|
public AjaxResult getInfo(@PathVariable("lineId") Long lineId, @PathVariable(value = "filter",required = false) String filter) { |
|
|
Map<String, String> map = getImgMap(); |
|
|
|
|
|
InspectionReport inspectionReport = inspectionReportService.selectInspectionReportByLineId(lineId); |
|
|
InspectionReport inspectionReport = inspectionReportService.selectInspectionReportByLineId(lineId); |
|
|
if(inspectionReport == null) { |
|
|
if(inspectionReport == null) { |
|
|
// 暂时这么处理(进度条报告入口,lineId传的是patrolTaskStatus的lineId) |
|
|
// 暂时这么处理(进度条报告入口,lineId传的是patrolTaskStatus的lineId) |
|
|
@ -149,16 +143,45 @@ public class InspectionReportController extends BaseController { |
|
|
inspectionReportData.setReportId(String.valueOf(lineId)); |
|
|
inspectionReportData.setReportId(String.valueOf(lineId)); |
|
|
List<InspectionReportData> inspectionReportDataList = |
|
|
List<InspectionReportData> inspectionReportDataList = |
|
|
inspectionReportDataService.selectInspectionReportDataList(inspectionReportData); |
|
|
inspectionReportDataService.selectInspectionReportDataList(inspectionReportData); |
|
|
|
|
|
// 收集所有需要查询的lineId |
|
|
|
|
|
List<String> lineIds = inspectionReportDataList.stream() |
|
|
|
|
|
.map(InspectionReportData::getLineId) |
|
|
|
|
|
.filter(StringUtils::isNotBlank) |
|
|
|
|
|
.distinct() |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
// 批量查询图片数据 |
|
|
|
|
|
Map<String, String> imageMap = Collections.emptyMap(); |
|
|
|
|
|
if (!lineIds.isEmpty()) { |
|
|
|
|
|
// 批量查询 |
|
|
|
|
|
List<InspectionReportImg> allImages = inspectionReportImgService.selectByReportInfoIds(lineIds); |
|
|
|
|
|
|
|
|
|
|
|
// 按reportInfoId分组,拼接图片URL |
|
|
|
|
|
imageMap = allImages.stream() |
|
|
|
|
|
.filter(img -> StringUtils.isNotBlank(img.getReportInfoId())) |
|
|
|
|
|
.filter(img -> StringUtils.isNotBlank(img.getImg())) |
|
|
|
|
|
.collect(Collectors.groupingBy( |
|
|
|
|
|
InspectionReportImg::getReportInfoId, |
|
|
|
|
|
Collectors.mapping( |
|
|
|
|
|
InspectionReportImg::getImg, |
|
|
|
|
|
Collectors.joining(StringUtils.COMMA) |
|
|
|
|
|
) |
|
|
|
|
|
)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 设置图片数据 |
|
|
for (InspectionReportData reportData : inspectionReportDataList) { |
|
|
for (InspectionReportData reportData : inspectionReportDataList) { |
|
|
logger.info("reportData: {}", reportData); |
|
|
|
|
|
if(reportData == null || StringUtils.isEmpty(reportData.getReportId())) { |
|
|
|
|
|
return AjaxResult.error("报告已损坏: " + lineId); |
|
|
|
|
|
} |
|
|
|
|
|
if (map != null && map.get((reportData.getLineId()).trim()) != null) { |
|
|
|
|
|
reportData.setInspectionImg(map.get((reportData.getLineId()).trim())); |
|
|
|
|
|
|
|
|
// 记录日志(根据实际情况调整日志级别,避免生产环境过多日志) |
|
|
|
|
|
logger.debug("reportData: {}", reportData); |
|
|
|
|
|
|
|
|
|
|
|
// 从缓存中获取图片URL |
|
|
|
|
|
String imgUrls = imageMap.get(reportData.getLineId()); |
|
|
|
|
|
if (StringUtils.isNotBlank(imgUrls)) { |
|
|
|
|
|
reportData.setInspectionImg(imgUrls); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inspectionReport.setInfo(inspectionReportDataList); |
|
|
inspectionReport.setInfo(inspectionReportDataList); |
|
|
return AjaxResult.success(inspectionReport); |
|
|
return AjaxResult.success(inspectionReport); |
|
|
} |
|
|
} |
|
|
|