Browse Source

fix: 推送合并任务报告推送多个任务id用逗号拼接

yanyuan
wangguangyuan 23 hours ago
parent
commit
952d3b4290
4 changed files with 24 additions and 2 deletions
  1. +8
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/insreporttask/mapper/InspectionReportTaskMapper.java
  2. +2
    -2
      inspect-main/inspect-main-task/src/main/java/com/inspect/reportpush/service/ReportPushService.java
  3. +9
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/DonghuanReportExportController.java
  4. +5
    -0
      inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportTaskMapper.xml

+ 8
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/insreporttask/mapper/InspectionReportTaskMapper.java View File

@ -25,4 +25,12 @@ public interface InspectionReportTaskMapper {
*/
List<InspectionReport> selectInspectionReportsByTaskPatrolledId(@Param("taskPatrolledId") String taskPatrolledId,
@Param("filter") String filter);
/**
* 按报告主键查询该报告关联的所有任务执行标识
*
* @param reportLineId 报告主键 inspection_report.line_id
* @return 任务执行标识列表 inspection_report_task.task_patrolled_id
*/
List<String> selectTaskPatrolledIdsByReportLineId(@Param("reportLineId") Long reportLineId);
}

+ 2
- 2
inspect-main/inspect-main-task/src/main/java/com/inspect/reportpush/service/ReportPushService.java View File

@ -101,8 +101,8 @@ public class ReportPushService {
message.setFilePath(filePath);
message.setReportInfo(reportInfo.toJSONString());
reportPushPublisher.publish(message);
log.info("[REPORT_PUSH] 报告推送消息已发布: reportId={}, filePath={}, username={}",
report.getLineId(), filePath, username);
log.info("[REPORT_PUSH] 报告推送消息已发布: reportId={}, filePath={}, username={}, message={}",
report.getLineId(), filePath, username, message);
}
/**


+ 9
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/DonghuanReportExportController.java View File

@ -13,6 +13,7 @@ import com.inspect.insreport.domain.InspectionReport;
import com.inspect.insreport.service.IInspectionReportService;
import com.inspect.insreportdata.domain.InspectionReportData;
import com.inspect.insreportdata.service.IInspectionReportDataService;
import com.inspect.insreporttask.mapper.InspectionReportTaskMapper;
import com.inspect.message.MessageUtils;
import com.inspect.partrolresult.domain.PatrolResult;
import com.inspect.partrolresult.service.IPatrolResultService;
@ -279,6 +280,7 @@ public class DonghuanReportExportController extends BaseController {
private final IInspectionReportDataService inspectionReportDataService;
private final IInspectionReportImgService inspectionReportImgService;
private final IInspectionReportService inspectionReportService;
private final InspectionReportTaskMapper inspectionReportTaskMapper;
private final SftpClient sftpClient;
private final ReportPushService reportPushService;
private final ReportPushProperties reportPushProperties;
@ -294,6 +296,7 @@ public class DonghuanReportExportController extends BaseController {
IInspectionReportDataService inspectionReportDataService,
IInspectionReportImgService inspectionReportImgService,
IInspectionReportService inspectionReportService,
InspectionReportTaskMapper inspectionReportTaskMapper,
SftpClient sftpClient,
ReportPushService reportPushService,
ReportPushProperties reportPushProperties,
@ -303,6 +306,7 @@ public class DonghuanReportExportController extends BaseController {
this.inspectionReportDataService = inspectionReportDataService;
this.inspectionReportImgService = inspectionReportImgService;
this.inspectionReportService = inspectionReportService;
this.inspectionReportTaskMapper = inspectionReportTaskMapper;
this.sftpClient = sftpClient;
this.reportPushService = reportPushService;
this.reportPushProperties = reportPushProperties;
@ -589,6 +593,11 @@ public class DonghuanReportExportController extends BaseController {
try {
inspectionReport.setFilePath(basePath + reportName + ".docx");
inspectionReport.setLineIds(reportIds);
// 报告的 task_patrolled_id report_line_id inspection_report_task 下所有任务执行标识
List<String> taskPatrolledIds = inspectionReportTaskMapper
.selectTaskPatrolledIdsByReportLineId(lineId);
inspectionReport.setTaskPatrolledId(
taskPatrolledIds == null ? null : StringUtils.join(taskPatrolledIds, ","));
inspectionReportService.updateInspectionReportFilePath(inspectionReport);
// 报告生成并上传完成后发布消息到 RabbitMQ由消费者异步 HTTP 上传外部平台自动归档与手动归档均推送
reportPushService.pushReport(inspectionReport, username);


+ 5
- 0
inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportTaskMapper.xml View File

@ -61,4 +61,9 @@
<if test="filter != null and filter != ''">and r.filter = #{filter}</if>
order by r.line_id desc
</select>
<select id="selectTaskPatrolledIdsByReportLineId" resultType="java.lang.String">
select task_patrolled_id from inspection_report_task
where report_line_id = #{reportLineId} order by id
</select>
</mapper>

Loading…
Cancel
Save