Quellcode durchsuchen

机场和飞手平台回调,有报告时,同步修改报告中的字段;

tags/v1.0.0^2^2
wanjing vor 1 Jahr
Ursprung
Commit
c571679600
2 geänderte Dateien mit 53 neuen und 5 gelöschten Zeilen
  1. +24
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/flyer/UpdateFlyerService.java
  2. +29
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateFlightStatusService.java

+ 24
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/flyer/UpdateFlyerService.java Datei anzeigen

@@ -135,8 +135,12 @@ public class UpdateFlyerService {
inspection.setFlightHand(request.getFlightHand());
inspection.setFlightHandName(request.getFlightHandName());
inspection.setExecutionStartTime(request.getFlightStartTime());
//更改

// 更改
inspectionMapper.updateById(inspection);

// 修改报告中的信息
this.updateReport(inspection);
}

private void updateComplete(UpdateTaskByCodeRequest request, Inspection inspection) {
@@ -145,9 +149,16 @@ public class UpdateFlyerService {
inspection.setExecutionEndTime(request.getFlightEndTime());
inspectionMapper.updateById(inspection);

// 修改报告中的信息
this.updateReport(inspection);
}

/**
* 修改报告中的信息,因为报告中的信息是随时生成的,在修改任务信息时,需同步修改
*
* @param inspection
*/

private void updateReport(Inspection inspection) {
Report report = reportMapper.selectOne(Wrappers.<Report>lambdaQuery()
.eq(Report::getInspectionId, inspection.getId())
@@ -156,7 +167,19 @@ public class UpdateFlyerService {
log.info("该任务还没有生成报告,不需要修改报告的完成时间和状态");
return;
}
if (1 == inspection.getIsLive()) {
report.setCloudBoxId(inspection.getCloudBoxId());
report.setCloudBoxName(inspection.getCloudBoxName());
report.setBoxSn(inspection.getBoxSn());
}
report.setEquipmentId(inspection.getEquipmentId());
report.setEquipmentName(inspection.getEquipmentName());
report.setEquipmentMountId(inspection.getEquipmentMountId());
report.setEquipmentMountName(inspection.getEquipmentMountName());
report.setFlightHand(inspection.getFlightHand());
report.setFlightHandName(inspection.getFlightHandName());
report.setStatus(inspection.getStatus());
report.setExecutionStartTime(inspection.getExecutionStartTime());
report.setExecutionEndTime(inspection.getExecutionEndTime());
reportMapper.updateById(report);
}

+ 29
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateFlightStatusService.java Datei anzeigen

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

Laden…
Abbrechen
Speichern