Browse Source

feat: 报告归档区分合并报告与任务单独报告

- 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=任务单独报告';
yanyuan
WangGuangYuan 4 weeks ago
parent
commit
2c38274941
16 changed files with 180 additions and 50 deletions
  1. +33
    -31
      inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java
  2. +11
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/domain/InspectionReport.java
  3. +10
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/mapper/InspectionReportMapper.java
  4. +8
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/IInspectionReportService.java
  5. +4
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/impl/InspectionReportServiceImpl.java
  6. +11
    -7
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java
  7. +11
    -3
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/DonghuanReportExportController.java
  8. +2
    -3
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/mapper/PatrolTaskResultMainMapper.java
  9. +1
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/IPatrolTaskResultMainService.java
  10. +32
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/util/ReportFileNameUtils.java
  11. +17
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java
  12. +5
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/domain/PatrolTaskStatus.java
  13. +22
    -1
      inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportMapper.xml
  14. +3
    -1
      inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportTaskMapper.xml
  15. +0
    -1
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskResultMainMapper.xml
  16. +10
    -2
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskStatusMapper.xml

+ 33
- 31
inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/controller/InspectionReportController.java View File

@ -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();


+ 11
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/domain/InspectionReport.java View File

@ -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<Long> lineIds;
List<InspectionReportData> ReportDatalist;
private List<InspectionReportData> 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;


+ 10
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/mapper/InspectionReportMapper.java View File

@ -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<InspectionReport> selectInspectionReportList(InspectionReport report);
List<InspectionReport> selectByAllList(InspectionReport report);


+ 8
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/IInspectionReportService.java View File

@ -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<InspectionReport> selectInspectionReportList(InspectionReport inspectionReport);
List<InspectionReport> selectByAllList(InspectionReport inspectionReport);


+ 4
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/insreport/service/impl/InspectionReportServiceImpl.java View File

@ -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<InspectionReport> selectInspectionReportList(InspectionReport inspectionReport) {
return this.inspectionReportMapper.selectInspectionReportList(inspectionReport);
}


+ 11
- 7
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java View File

@ -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<InspectionReportTask> 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));


+ 11
- 3
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/DonghuanReportExportController.java View File

@ -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<Void> 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);
}


+ 2
- 3
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/mapper/PatrolTaskResultMainMapper.java View File

@ -36,11 +36,10 @@ public interface PatrolTaskResultMainMapper {
List<Long> selectLineIdsByList(@Param("lineIds") List<Long> lineIds);
/**
* 定时归档用:查询指定时间窗口内“已完成且未归档”的巡检执行(patrol_task_result_main.line_id)。
* 定时归档用:查询指定时间窗口内“已完成”的巡检执行(patrol_task_result_main.line_id)。
* <p>
* 判定口径(按任务状态开始时间归批次):
* 任务状态已完成(patrol_task_status.task_state='1')且开始时间落在 [startTime, endTime),
* 且该执行尚未归档(file_status 不为 1)。
* 任务状态已完成(patrol_task_status.task_state='1')且开始时间落在 [startTime, endTime)。
*
* @param startTime 窗口开始时间(含)
* @param endTime 窗口结束时间(不含)


+ 1
- 1
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/IPatrolTaskResultMainService.java View File

@ -33,7 +33,7 @@ public interface IPatrolTaskResultMainService {
List<Long> selectLineIdsByList(List<Long> lineIds);
/**
* 定时归档:查询指定时间窗口内“已完成且未归档”的巡检执行 lineId 列表。
* 定时归档:查询指定时间窗口内“已完成”的巡检执行 lineId 列表。
*
* @param startTime 窗口开始时间(含)
* @param endTime 窗口结束时间(不含)


+ 32
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/util/ReportFileNameUtils.java View File

@ -0,0 +1,32 @@
package com.inspect.resultmain.util;
/**
* 报告文件名工具。
* <p>
* 报告文件名会被拼进文件访问地址(形如 {@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, "");
}
}

+ 17
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java View File

@ -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())) {


+ 5
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/domain/PatrolTaskStatus.java View File

@ -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;


+ 22
- 1
inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportMapper.xml View File

@ -24,6 +24,7 @@
<result property="filePath" column="file_path"/>
<result property="filter" column="filter"/>
<result property="location" column="location"/>
<result property="reportScope" column="report_scope"/>
</resultMap>
<sql id="selectInspectionReportVo">
@ -45,7 +46,8 @@
check_person,
check_time,
description,
filter
filter,
report_scope
from inspection_report
</sql>
@ -100,6 +102,8 @@
<if test="inspectionTaskName != null and inspectionTaskName != ''">and a.inspection_task_name like
concat('%',#{inspectionTaskName},'%')
</if>
<!-- 报告粒度筛选:merge=合并报告,single=任务单独报告(不传则两类都返回) -->
<if test="reportScope != null and reportScope != ''">and a.report_scope = #{reportScope}</if>
</where>
ORDER BY a.inspection_date DESC
</select>
@ -109,6 +113,21 @@
where line_id = #{lineId}
</select>
<!--
该任务执行"自己的"报告(任务单独归档产物):
- 合并报告不参与匹配:新数据 report_scope=merge,历史合并报告已回填为 merge;
且合并报告头的 task_patrolled_id 存逗号拼接串,等值匹配天然不命中。
- report_scope 为空的历史数据按任务单独报告处理。
-->
<select id="selectSingleReportByTaskPatrolledId" resultMap="InspectionReportResult">
<include refid="selectInspectionReportVo"/>
where task_patrolled_id = #{taskPatrolledId}
and (report_scope is null or report_scope = 'single')
<if test="filter != null and filter != ''">and filter = #{filter}</if>
order by line_id desc
limit 1
</select>
<insert id="insertInspectionReport" parameterType="InspectionReport" useGeneratedKeys="true" keyProperty="lineId">
insert into inspection_report
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -130,6 +149,7 @@
<if test="taskResultId != null">task_result_id,</if>
<if test="filePath != null">file_path,</if>
<if test="filter != null">filter,</if>
<if test="reportScope != null">report_scope,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stationName != null">#{stationName},</if>
@ -150,6 +170,7 @@
<if test="taskResultId != null">#{taskResultId},</if>
<if test="filePath != null">#{filePath},</if>
<if test="filter != null">#{filter},</if>
<if test="reportScope != null">#{reportScope},</if>
</trim>
</insert>


+ 3
- 1
inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportTaskMapper.xml View File

@ -24,6 +24,7 @@
<result property="filePath" column="file_path"/>
<result property="filter" column="filter"/>
<result property="location" column="location"/>
<result property="reportScope" column="report_scope"/>
</resultMap>
<insert id="batchInsertInspectionReportTask" parameterType="java.util.List">
@ -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}


+ 0
- 1
inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskResultMainMapper.xml View File

@ -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 &lt;&gt; '1')
and s.start_time &gt;= #{startTime}
and s.start_time &lt; #{endTime}
order by m.line_id


+ 10
- 2
inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskStatusMapper.xml View File

@ -25,6 +25,7 @@
<result property="taskType" column="task_type"/>
<result property="mainId" column="main_id"/>
<result property="specifiedAlg" column="specified_alg"/>
<result property="filePath" column="file_path"/>
<collection property="children"
ofType="PatrolTaskStatus"
select="selectPatrolTaskStatusListByMainId"
@ -53,6 +54,7 @@
<result property="beginTime" column="beginTime"/>
<result property="mainId" column="main_id"/>
<result property="specifiedAlg" column="specified_alg"/>
<result property="filePath" column="file_path"/>
<collection property="children"
ofType="PatrolTaskStatus"
select="selectPatrolTaskStatusListByMainId"
@ -122,7 +124,13 @@
a.main_id,
a.summary,
b.execution_status as exec_type,
b.specified_alg
b.specified_alg,
(SELECT r.file_path
FROM inspection_report r
WHERE r.task_patrolled_id = a.task_patrolled_id
AND r.report_scope = 'single'
ORDER BY r.line_id DESC
LIMIT 1) AS file_path
from patrol_task_status a
LEFT JOIN patrol_task b on a.task_code=b.task_code
<where>
@ -161,7 +169,7 @@
and date_format(a.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
</where>
ORDER BY line_id desc
ORDER BY a.line_id desc
</select>
<select id="selectPatrolTaskStatusPage" resultType="com.inspect.taskstatus.domain.PatrolTaskStatus">


Loading…
Cancel
Save