|
|
@@ -1,20 +1,20 @@ |
|
|
|
package com.tuoheng.admin.service.inspection.update.status; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.tuoheng.admin.entity.Business; |
|
|
|
import com.tuoheng.admin.entity.Inspection; |
|
|
|
import com.tuoheng.admin.entity.LiveChannel; |
|
|
|
import com.tuoheng.admin.entity.Report; |
|
|
|
import com.tuoheng.admin.enums.InspectionStatusEnum; |
|
|
|
import com.tuoheng.admin.enums.MarkTypeEnum; |
|
|
|
import com.tuoheng.admin.enums.TaskStatusEnum; |
|
|
|
import com.tuoheng.admin.enums.code.inspection.EditInspectionStatusCodeEnum; |
|
|
|
import com.tuoheng.admin.mapper.BusinessMapper; |
|
|
|
import com.tuoheng.admin.mapper.InspectionMapper; |
|
|
|
import com.tuoheng.admin.mapper.LiveChannelMapper; |
|
|
|
import com.tuoheng.admin.mapper.TenantMapper; |
|
|
|
import com.tuoheng.admin.mapper.*; |
|
|
|
import com.tuoheng.admin.request.inspection.MissionStatusRequest; |
|
|
|
import com.tuoheng.admin.service.third.dsp.IDspService; |
|
|
|
import com.tuoheng.admin.vo.DspCallbackVo; |
|
|
@@ -43,6 +43,9 @@ public class UpdateFlightStatusService { |
|
|
|
@Autowired |
|
|
|
private BusinessMapper businessMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ReportMapper reportMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IDspService dspService; |
|
|
|
|
|
|
@@ -54,7 +57,12 @@ public class UpdateFlightStatusService { |
|
|
|
//如果调用DSP失败就直接失败! |
|
|
|
log.info("修改任务状态业务接口:调用DSP数据失败:{}", result.getMsg()); |
|
|
|
inspectionUpdate.setStatus(InspectionStatusEnum.FLIGHT_FAILED.getCode()); |
|
|
|
inspectionUpdate.setExecutionStartTime(DateUtils.now()); |
|
|
|
inspectionMapper.updateById(inspectionUpdate); |
|
|
|
|
|
|
|
// 修改报告状态和开始时间 |
|
|
|
this.updateReport(inspection); |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
JSONObject jsonObject = (JSONObject) result.getData(); |
|
|
@@ -63,6 +71,7 @@ public class UpdateFlightStatusService { |
|
|
|
|
|
|
|
log.info("修改inspection status 开始"); |
|
|
|
inspectionUpdate.setStatus(InspectionStatusEnum.IN_FLIGHT.getCode()); |
|
|
|
inspectionUpdate.setExecutionStartTime(DateUtils.now()); |
|
|
|
inspectionUpdate.setUpdateTime(DateUtils.now()); |
|
|
|
log.info("inspectionUpdate:{}", inspectionUpdate); |
|
|
|
Integer count = inspectionMapper.updateStatus(inspectionUpdate); |
|
|
@@ -79,6 +88,9 @@ public class UpdateFlightStatusService { |
|
|
|
// 将请求id和业务id消息存入数据库,用于监听获取任务信息 |
|
|
|
this.businessHandle(inspection, dspCallbackVo); |
|
|
|
|
|
|
|
// 修改报告状态和开始时间 |
|
|
|
this.updateReport(inspection); |
|
|
|
|
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|
|
|
@@ -130,4 +142,17 @@ public class UpdateFlightStatusService { |
|
|
|
business.setCreateTime(DateUtils.now()); |
|
|
|
businessMapper.insert(business); |
|
|
|
} |
|
|
|
|
|
|
|
private void updateReport(Inspection inspection) { |
|
|
|
Report report = reportMapper.selectOne(Wrappers.<Report>lambdaQuery() |
|
|
|
.eq(Report::getInspectionId, inspection.getId()) |
|
|
|
.eq(Report::getMark, 1)); |
|
|
|
if (ObjectUtil.isNull(report)) { |
|
|
|
log.info("该任务还没有生成报告,不需要修改报告的完成时间和状态"); |
|
|
|
return; |
|
|
|
} |
|
|
|
report.setStatus(inspection.getStatus()); |
|
|
|
report.setExecutionStartTime(inspection.getExecutionStartTime()); |
|
|
|
reportMapper.updateById(report); |
|
|
|
} |
|
|
|
} |