From 2c3827494194d1386a3a7d1eeaf76917106d0659 Mon Sep 17 00:00:00 2001 From: WangGuangYuan Date: Wed, 14 Oct 2026 11:13:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8A=A5=E5=91=8A=E5=BD=92=E6=A1=A3?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E5=90=88=E5=B9=B6=E6=8A=A5=E5=91=8A=E4=B8=8E?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8D=95=E7=8B=AC=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - inspection_report 新增 report_scope:merge=合并报告,single=任务单独报告 - 归档时写入报告粒度;单任务归档仍置 file_status=1,合并报告头存逗号拼接的多个任务执行标识 - 进度条查看报告优先取该任务自己的报告(report_scope=single),没有才回退合并报告 - 报告列表支持按报告粒度筛选;对外只推送合并报告,任务单独报告仅站内查看/下载 - 任务列表/进度条返回报告下载地址:新增 inspect.file.url-prefix,与场站编码、file_path 拼接 - 报告名去除空白字符,避免拼进下载地址后不可用 - 定时归档查询不再按 file_status 过滤(合并归档不再逐任务置归档状态) - 新增 sql,需在目标库手工执行一次,ALTER TABLE inspection_report ADD COLUMN report_scope VARCHAR(16) NULL COMMENT '报告粒度:merge=合并报告,single=任务单独报告'; --- .../InspectionReportController.java | 64 ++++++++++--------- .../insreport/domain/InspectionReport.java | 11 ++++ .../mapper/InspectionReportMapper.java | 10 +++ .../service/IInspectionReportService.java | 8 +++ .../impl/InspectionReportServiceImpl.java | 4 ++ .../service/impl/PatrolResultServiceImpl.java | 18 ++++-- .../DonghuanReportExportController.java | 14 +++- .../mapper/PatrolTaskResultMainMapper.java | 5 +- .../service/IPatrolTaskResultMainService.java | 2 +- .../resultmain/util/ReportFileNameUtils.java | 32 ++++++++++ .../PatrolTaskStatusController.java | 17 +++++ .../taskstatus/domain/PatrolTaskStatus.java | 5 ++ .../mapper/task/InspectionReportMapper.xml | 23 ++++++- .../task/InspectionReportTaskMapper.xml | 4 +- .../task/PatrolTaskResultMainMapper.xml | 1 - .../mapper/task/PatrolTaskStatusMapper.xml | 12 +++- 16 files changed, 180 insertions(+), 50 deletions(-) create mode 100644 inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/util/ReportFileNameUtils.java diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java index 98b2621..af4f1b9 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java @@ -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 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 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 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 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(); diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/domain/InspectionReport.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/domain/InspectionReport.java index 053aa21..5788f05 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/domain/InspectionReport.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/domain/InspectionReport.java @@ -102,6 +102,10 @@ public class InspectionReport extends BaseEntity { private Date cycleEndTime; private String taskPatrolledId; private String filter; + /** + * 报告粒度:{@code merge} = 合并报告(一次归档覆盖多个任务执行,本字段所在的 + */ + private String reportScope; private List lineIds; List ReportDatalist; private List info; @@ -115,6 +119,13 @@ public class InspectionReport extends BaseEntity { public InspectionReport() { } + /** + * 是否「任务单独报告」(report_scope=single)。 + */ + public boolean isSingleReport() { + return "single".equals(reportScope); + } + @Override public boolean equals(Object object) { if (this == object) return true; diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/mapper/InspectionReportMapper.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/mapper/InspectionReportMapper.java index f5b2b9a..4aaa707 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/mapper/InspectionReportMapper.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/mapper/InspectionReportMapper.java @@ -2,6 +2,7 @@ package com.inspect.insreport.mapper; import com.inspect.insreport.domain.InspectionReport; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -9,6 +10,15 @@ import java.util.List; public interface InspectionReportMapper { InspectionReport selectInspectionReportByLineId(Long lineId); + /** + * 该任务执行"自己的"报告(任务单独归档产物,report_scope 为空或 single)。 + * + * @param taskPatrolledId 任务执行标识 + * @param filter 报告类型(0/1…),为空则不限制 + */ + InspectionReport selectSingleReportByTaskPatrolledId(@Param("taskPatrolledId") String taskPatrolledId, + @Param("filter") String filter); + List selectInspectionReportList(InspectionReport report); List selectByAllList(InspectionReport report); diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/IInspectionReportService.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/IInspectionReportService.java index 5e9f7a1..66478dd 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/IInspectionReportService.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/IInspectionReportService.java @@ -7,6 +7,14 @@ import java.util.List; public interface IInspectionReportService { InspectionReport selectInspectionReportByLineId(Long lineId); + /** + * 该任务执行"自己的"报告(任务单独归档产物)。 + * + * @param taskPatrolledId 任务执行标识 + * @param filter 报告类型,为空则不限制 + */ + InspectionReport selectSingleReportByTaskPatrolledId(String taskPatrolledId, String filter); + List selectInspectionReportList(InspectionReport inspectionReport); List selectByAllList(InspectionReport inspectionReport); diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/impl/InspectionReportServiceImpl.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/impl/InspectionReportServiceImpl.java index 7563ca7..2c8744e 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/impl/InspectionReportServiceImpl.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/impl/InspectionReportServiceImpl.java @@ -21,6 +21,10 @@ public class InspectionReportServiceImpl implements IInspectionReportService { return this.inspectionReportMapper.selectInspectionReportByLineId(lineId); } + public InspectionReport selectSingleReportByTaskPatrolledId(String taskPatrolledId, String filter) { + return this.inspectionReportMapper.selectSingleReportByTaskPatrolledId(taskPatrolledId, filter); + } + public List selectInspectionReportList(InspectionReport inspectionReport) { return this.inspectionReportMapper.selectInspectionReportList(inspectionReport); } diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java index 144cd63..fd76985 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java @@ -747,18 +747,19 @@ public class PatrolResultServiceImpl implements IPatrolResultService { } else { patrolStatistics = String.format(messageUtils.get("本次任务巡视总结果数量:%d个,正常结果数量:%d个,缺陷结果数量:%d个"), total, okNum, defectNum); } - // 一次归档(单个任务 / 多个任务合并归档)只生成一份报告: - // 1) 报告头(inspection_report)只插一条,明细数据(inspection_report_data)覆盖本次归档的全部任务; - // 2) 被归档的每个任务执行都通过 inspection_report_task 关联到这一条报告, - // 任务粒度与明细行中的 task_patrolled_id / task_name 保持一致, - // 便于从任意任务/进度入口定位到这条合并报告。 + + boolean singleScope = !isMultipleTasks; + List reportTasks = new ArrayList<>(); Long reportLineId = null; for (int idx = 0; idx < lineIds.size(); idx++) { Long lineId = lineIds.get(idx); resultMain.setLineId(lineId); resultMain.setCheckTime(new Date()); - resultMain.setFileStatus("1"); + if (singleScope) { + // 单任务归档:置归档状态,进度条"查看报告"入口据此展示该任务自己的报告 + resultMain.setFileStatus("1"); + } String mainId = String.valueOf(resultMain.getLineId()); PatrolTaskResultMain main = patrolTaskResultMainMapper.selectPatrolTaskResultMainByLineId(lineId); @@ -791,7 +792,9 @@ public class PatrolResultServiceImpl implements IPatrolResultService { report.setInspectionEndTime(DateUtils.parseDate(endTimes.get(endTimes.size() - 1))); report.setTaskId(task.getTaskId() == null ? "" : String.valueOf(task.getTaskId())); report.setEnvInfo(StringUtils.join(envoList, ",")); - report.setTaskPatrolledId(taskPatrolId); + // 合并报告:存全部任务执行标识(逗号拼接) + // 单任务归档:只存该任务自己的执行标识 + report.setTaskPatrolledId(singleScope ? taskPatrolId : StringUtils.join(taskPatrolledIds, ",")); report.setInspectionTaskName(taskName); report.setDescription(resultMain.getTaskResult()); report.setCheckPerson(resultMain.getCheckPerson()); @@ -799,6 +802,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService { report.setStationName(stationName); report.setVoltLevel(StringUtils.isEmpty(voltLevel) ? voltage : voltLevel); report.setFilter("0"); + report.setReportScope(singleScope ? "single" : "merge"); report.setStationType(stationType); // 位置 = 省份 + 地市(如 四川省成都市) report.setLocation(buildLocation(provinceName, cityName)); diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/DonghuanReportExportController.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/DonghuanReportExportController.java index 7041334..5eeab8f 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/DonghuanReportExportController.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/DonghuanReportExportController.java @@ -23,6 +23,7 @@ import com.inspect.reportpush.config.ReportPushProperties; import com.inspect.reportpush.service.ReportPushService; import com.inspect.resultmain.domain.PatrolTaskResultMain; import com.inspect.resultmain.service.IPatrolTaskResultMainService; +import com.inspect.resultmain.util.ReportFileNameUtils; import org.apache.commons.io.function.IOConsumer; import org.apache.poi.xwpf.usermodel.*; import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; @@ -559,7 +560,8 @@ public class DonghuanReportExportController extends BaseController { // } else if ("0".equals(inspectionReport.getFilter())) { // namePrefix = messageUtils.get("大模型") + "_"; // } - String reportName = inspectionReport.getInspectionTaskName() + "_" + timestamp; + // 报告名不带空格 + String reportName = ReportFileNameUtils.removeWhitespace(inspectionReport.getInspectionTaskName() + "_" + timestamp); // 上传图片 ZIP CompletableFuture zipUploadFuture = CompletableFuture.runAsync(() -> { @@ -600,8 +602,14 @@ public class DonghuanReportExportController extends BaseController { inspectionReport.setTaskPatrolledId( taskPatrolledIds == null ? null : StringUtils.join(taskPatrolledIds, ",")); inspectionReportService.updateInspectionReportFilePath(inspectionReport); - // 报告生成并上传完成后,发布消息到 RabbitMQ,由消费者异步 HTTP 上传外部平台(自动归档与手动归档均推送) - reportPushService.pushReport(inspectionReport, username); + // 报告生成并上传完成后,发布消息到 RabbitMQ,由消费者异步 HTTP 上传外部平台。 + // 只推「合并报告」(report_scope=merge):任务单独报告(single)仅站内查看/下载。 + if (inspectionReport.isSingleReport()) { + logger.info("[ARCHIVE] 任务单独报告不推送外部平台: reportId={}, taskPatrolledId={}", + inspectionReport.getLineId(), inspectionReport.getTaskPatrolledId()); + } else { + reportPushService.pushReport(inspectionReport, username); + } } finally { closeResources(finalWordDocument, tempFiles); } diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/mapper/PatrolTaskResultMainMapper.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/mapper/PatrolTaskResultMainMapper.java index 50a3694..3eb2e8d 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/mapper/PatrolTaskResultMainMapper.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/mapper/PatrolTaskResultMainMapper.java @@ -36,11 +36,10 @@ public interface PatrolTaskResultMainMapper { List selectLineIdsByList(@Param("lineIds") List lineIds); /** - * 定时归档用:查询指定时间窗口内“已完成且未归档”的巡检执行(patrol_task_result_main.line_id)。 + * 定时归档用:查询指定时间窗口内“已完成”的巡检执行(patrol_task_result_main.line_id)。 *

* 判定口径(按任务状态开始时间归批次): - * 任务状态已完成(patrol_task_status.task_state='1')且开始时间落在 [startTime, endTime), - * 且该执行尚未归档(file_status 不为 1)。 + * 任务状态已完成(patrol_task_status.task_state='1')且开始时间落在 [startTime, endTime)。 * * @param startTime 窗口开始时间(含) * @param endTime 窗口结束时间(不含) diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/IPatrolTaskResultMainService.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/IPatrolTaskResultMainService.java index 0bce61b..8256655 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/IPatrolTaskResultMainService.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/IPatrolTaskResultMainService.java @@ -33,7 +33,7 @@ public interface IPatrolTaskResultMainService { List selectLineIdsByList(List lineIds); /** - * 定时归档:查询指定时间窗口内“已完成且未归档”的巡检执行 lineId 列表。 + * 定时归档:查询指定时间窗口内“已完成”的巡检执行 lineId 列表。 * * @param startTime 窗口开始时间(含) * @param endTime 窗口结束时间(不含) diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/util/ReportFileNameUtils.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/util/ReportFileNameUtils.java new file mode 100644 index 0000000..12af6d2 --- /dev/null +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/util/ReportFileNameUtils.java @@ -0,0 +1,32 @@ +package com.inspect.resultmain.util; + +/** + * 报告文件名工具。 + *

+ * 报告文件名会被拼进文件访问地址(形如 {@code {url-prefix}{场站编码}{file_path}}), + * 文件名里带空格会让这个地址不可用(浏览器/接口都会因空格截断或需要转义), + * 因此生成报告名时统一去掉空白字符。 + * + * @author inspect + */ +public final class ReportFileNameUtils { + + /** + * 需要剔除的空白:常规空白(空格、Tab 等)、不间断空格(\u00A0)、 + * 全角/表意空格(\u3000,中文输入法下常见) + */ + private static final String WHITESPACE = "[\\s\\u00A0\\u3000]+"; + + private ReportFileNameUtils() { + } + + /** + * 去掉文件名中的空白字符。 + * + * @param fileName 原始文件名(可为 null) + * @return 去空白后的文件名;入参为 null 时返回 null + */ + public static String removeWhitespace(String fileName) { + return fileName == null ? null : fileName.replaceAll(WHITESPACE, ""); + } +} diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java index c3b493d..25b40f8 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java @@ -43,6 +43,8 @@ import com.inspect.taskstatus.domain.TaskCount; import com.inspect.taskstatus.service.IPatrolTaskStatusService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -54,11 +56,18 @@ import java.util.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +@RefreshScope @RestController @RequestMapping({"/taskstatus"}) public class PatrolTaskStatusController extends BaseController { private final Logger log = LoggerFactory.getLogger(PatrolTaskStatusController.class); + /** + * 报告文件访问地址前缀,最终地址 = 本前缀 + 场站编码 + inspection_report.file_path。 + */ + @Value("${inspect.file.url-prefix:http://192.168.129.17:18891/file/}") + private String fileUrlPrefix; + private final IPatrolTaskStatusService patrolTaskStatusService; private final IPatrolResultService patrolResultService; private final IPatrolTaskService patrolTaskService; @@ -255,9 +264,17 @@ public class PatrolTaskStatusController extends BaseController { }, (item) -> { return String.valueOf(item.get("num")); })); + String staticCode = (String) redisService.redisTemplate.opsForValue().get("sys_config:STATION_CODE"); + log.info("taskStatus staticCode: {}, fileUrlPrefix: {}", staticCode, fileUrlPrefix); + // 地址前缀统一保证以 "/" 结尾,避免配置漏写斜杠导致拼出的地址不可用 + String fileUrlPre = StringUtils.isEmpty(fileUrlPrefix) || fileUrlPrefix.endsWith("/") + ? fileUrlPrefix : fileUrlPrefix + "/"; // 填充每个任务的扩展统计信息 list.forEach((item) -> { item.setPatrolStatus("1"); + if (StringUtils.isNotEmpty(item.getFilePath()) && StringUtils.isNotEmpty(staticCode)) { + item.setFilePath(fileUrlPre + staticCode + item.getFilePath()); + } item.setPointCount(pointMap.get(item.getTaskCode())); // 任务指定算法类型:当为纠偏时,返回值便于前端做样式处理 if (AlgConstants.CORRECTION.equals(item.getSpecifiedAlg())) { diff --git a/inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/domain/PatrolTaskStatus.java b/inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/domain/PatrolTaskStatus.java index 829015e..50bdddf 100644 --- a/inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/domain/PatrolTaskStatus.java +++ b/inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/domain/PatrolTaskStatus.java @@ -101,6 +101,11 @@ public class PatrolTaskStatus extends BaseEntity { private String execType; private String fileStatus; + /** + * 该任务「自己的报告」(任务单独归档产物,report_scope=single)的文件地址; + * 进度条/任务列表用它给出报告下载地址,没有单独报告时为 null。 + */ + private String filePath; private String filter; private String pointName; private String deviceName; diff --git a/inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportMapper.xml b/inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportMapper.xml index 5569dd8..8108605 100644 --- a/inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportMapper.xml +++ b/inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportMapper.xml @@ -24,6 +24,7 @@ + @@ -45,7 +46,8 @@ check_person, check_time, description, - filter + filter, + report_scope from inspection_report @@ -100,6 +102,8 @@ and a.inspection_task_name like concat('%',#{inspectionTaskName},'%') + + and a.report_scope = #{reportScope} ORDER BY a.inspection_date DESC @@ -109,6 +113,21 @@ where line_id = #{lineId} + + + insert into inspection_report @@ -130,6 +149,7 @@ task_result_id, file_path, filter, + report_scope, #{stationName}, @@ -150,6 +170,7 @@ #{taskResultId}, #{filePath}, #{filter}, + #{reportScope}, diff --git a/inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportTaskMapper.xml b/inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportTaskMapper.xml index f5828fc..aa273b3 100644 --- a/inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportTaskMapper.xml +++ b/inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportTaskMapper.xml @@ -24,6 +24,7 @@ + @@ -54,7 +55,8 @@ r.check_person, r.check_time, r.description, - r.filter + r.filter, + r.report_scope from inspection_report_task t join inspection_report r on r.line_id = t.report_line_id where t.task_patrolled_id = #{taskPatrolledId} diff --git a/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskResultMainMapper.xml b/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskResultMainMapper.xml index 65a81f4..52f442f 100644 --- a/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskResultMainMapper.xml +++ b/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskResultMainMapper.xml @@ -168,7 +168,6 @@ from patrol_task_result_main m join patrol_task_status s on s.task_patrolled_id = m.task_patrolled_id where s.task_state = '1' - and (m.file_status is null or m.file_status <> '1') and s.start_time >= #{startTime} and s.start_time < #{endTime} order by m.line_id diff --git a/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskStatusMapper.xml b/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskStatusMapper.xml index 9878b9c..d447d54 100644 --- a/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskStatusMapper.xml +++ b/inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskStatusMapper.xml @@ -25,6 +25,7 @@ + + @@ -161,7 +169,7 @@ and date_format(a.start_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') - ORDER BY line_id desc + ORDER BY a.line_id desc