|
|
|
@ -109,26 +109,27 @@ public class InspectionReportController extends BaseController { |
|
|
|
if ("report".equals(type)) { |
|
|
|
inspectionReport = inspectionReportService.selectInspectionReportByLineId(lineId); |
|
|
|
} else if("taskStatus".equals(type)) { |
|
|
|
// 暂时这么处理(进度条报告入口,lineId传的是patrolTaskStatus的lineId) |
|
|
|
// 进度条报告入口,lineId传的是patrolTaskStatus的lineId |
|
|
|
PatrolTaskStatus patrolTaskStatus = patrolTaskStatusService.selectPatrolTaskStatusByLineId(lineId); |
|
|
|
String taskPatrolledId = patrolTaskStatus.getTaskPatrolledId(); |
|
|
|
logger.info("进度条报告查看,filter:{},taskPatrolledId:{}", filter, taskPatrolledId); |
|
|
|
// 合并归档后一次归档只生成一条报告,多个任务经 inspection_report_task 关联同一条报告, |
|
|
|
// 故先按任务执行标识查关联报告 |
|
|
|
List<InspectionReport> inspectionReports = |
|
|
|
inspectionReportTaskService.selectInspectionReportsByTaskPatrolledId(taskPatrolledId, filter); |
|
|
|
if (inspectionReports.isEmpty()) { |
|
|
|
// 兼容历史数据:旧归档按任务各生成一条报告,回退按报告头 task_patrolled_id 等值匹配 |
|
|
|
inspectionReport = new InspectionReport(); |
|
|
|
inspectionReport.setTaskPatrolledId(taskPatrolledId); |
|
|
|
inspectionReport.setFilter(filter); |
|
|
|
inspectionReports = inspectionReportService.selectInspectionReportList(inspectionReport); |
|
|
|
} |
|
|
|
if (inspectionReports.size() > 0) { |
|
|
|
inspectionReport = inspectionReports.get(0); |
|
|
|
lineId = inspectionReport.getLineId(); |
|
|
|
// 1) 有该任务「自己的」报告(任务单独归档产物,report_scope=single)就展示它 |
|
|
|
InspectionReport ownReport = |
|
|
|
inspectionReportService.selectSingleReportByTaskPatrolledId(taskPatrolledId, filter); |
|
|
|
if (ownReport != null) { |
|
|
|
inspectionReport = ownReport; |
|
|
|
lineId = ownReport.getLineId(); |
|
|
|
} else { |
|
|
|
return AjaxResult.error("报告不存在: " + lineId); |
|
|
|
// 2) 没有则展示「合并报告」:一次归档生成一条报告,多个任务经 |
|
|
|
// inspection_report_task 关联同一条报告 |
|
|
|
List<InspectionReport> inspectionReports = |
|
|
|
inspectionReportTaskService.selectInspectionReportsByTaskPatrolledId(taskPatrolledId, filter); |
|
|
|
if (inspectionReports.size() > 0) { |
|
|
|
inspectionReport = inspectionReports.get(0); |
|
|
|
lineId = inspectionReport.getLineId(); |
|
|
|
} else { |
|
|
|
return AjaxResult.error("报告不存在: " + lineId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
InspectionReportData inspectionReportData = new InspectionReportData(); |
|
|
|
@ -184,25 +185,26 @@ public class InspectionReportController extends BaseController { |
|
|
|
if ("report".equals(type)) { |
|
|
|
inspectionReport = inspectionReportService.selectInspectionReportByLineId(lineId); |
|
|
|
} else if("taskStatus".equals(type)) { |
|
|
|
// 暂时这么处理(进度条报告入口,lineId传的是patrolTaskStatus的lineId) |
|
|
|
// 进度条报告入口,lineId传的是patrolTaskStatus的lineId |
|
|
|
PatrolTaskStatus patrolTaskStatus = patrolTaskStatusService.selectPatrolTaskStatusByLineId(lineId); |
|
|
|
String taskPatrolledId = patrolTaskStatus.getTaskPatrolledId(); |
|
|
|
logger.info("进度条报告查看,filter:{},taskPatrolledId:{}", filter, taskPatrolledId); |
|
|
|
// 合并归档后一次归档只生成一条报告,多个任务经 inspection_report_task 关联同一条报告, |
|
|
|
// 故先按任务执行标识查关联报告 |
|
|
|
List<InspectionReport> inspectionReports = |
|
|
|
inspectionReportTaskService.selectInspectionReportsByTaskPatrolledId(taskPatrolledId, filter); |
|
|
|
if (inspectionReports.isEmpty()) { |
|
|
|
// 兼容历史数据:旧归档按任务各生成一条报告,回退按报告头 task_patrolled_id 等值匹配 |
|
|
|
inspectionReport.setTaskPatrolledId(taskPatrolledId); |
|
|
|
inspectionReport.setFilter(filter); |
|
|
|
inspectionReports = inspectionReportService.selectInspectionReportList(inspectionReport); |
|
|
|
} |
|
|
|
if (inspectionReports.size() > 0) { |
|
|
|
inspectionReport = inspectionReports.get(0); |
|
|
|
lineId = inspectionReport.getLineId(); |
|
|
|
// 1) 有该任务「自己的」报告(任务单独归档产物,report_scope=single)就展示它 |
|
|
|
InspectionReport ownReport = |
|
|
|
inspectionReportService.selectSingleReportByTaskPatrolledId(taskPatrolledId, filter); |
|
|
|
if (ownReport != null) { |
|
|
|
inspectionReport = ownReport; |
|
|
|
lineId = ownReport.getLineId(); |
|
|
|
} else { |
|
|
|
return AjaxResult.error("报告不存在: " + lineId); |
|
|
|
// 2) 没有则展示「合并报告」:一次归档生成一条报告,多个任务经inspection_report_task 关联同一条报告 |
|
|
|
List<InspectionReport> inspectionReports = |
|
|
|
inspectionReportTaskService.selectInspectionReportsByTaskPatrolledId(taskPatrolledId, filter); |
|
|
|
if (inspectionReports.size() > 0) { |
|
|
|
inspectionReport = inspectionReports.get(0); |
|
|
|
lineId = inspectionReport.getLineId(); |
|
|
|
} else { |
|
|
|
return AjaxResult.error("报告不存在: " + lineId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
InspectionReportData inspectionReportData = new InspectionReportData(); |
|
|
|
|