|
|
@@ -4,26 +4,18 @@ import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.tuoheng.admin.constant.SystemConstant; |
|
|
|
import com.tuoheng.admin.entity.Business; |
|
|
|
import com.tuoheng.admin.entity.FlightData; |
|
|
|
import com.tuoheng.admin.entity.Inspection; |
|
|
|
import com.tuoheng.admin.entity.Tenant; |
|
|
|
import com.tuoheng.admin.entity.*; |
|
|
|
import com.tuoheng.admin.enums.AiAnalyseStatusEnum; |
|
|
|
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.FlightDataMapper; |
|
|
|
import com.tuoheng.admin.mapper.InspectionMapper; |
|
|
|
import com.tuoheng.admin.mapper.TenantMapper; |
|
|
|
import com.tuoheng.admin.mapper.*; |
|
|
|
import com.tuoheng.admin.service.third.dsp.IDspService; |
|
|
|
import com.tuoheng.admin.utils.AirWeatherUtil; |
|
|
|
import com.tuoheng.admin.vo.AirWeatherVO; |
|
|
|
import com.tuoheng.common.core.utils.HttpUtils; |
|
|
|
import com.tuoheng.common.core.utils.JacksonUtil; |
|
|
|
import com.tuoheng.common.core.utils.JsonResult; |
|
|
|
import com.tuoheng.common.core.utils.StringUtils; |
|
|
|
import com.tuoheng.common.core.utils.*; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
@@ -48,6 +40,9 @@ public class UpdateWaittStatusService { |
|
|
|
@Autowired |
|
|
|
private FlightDataMapper flightDataMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ReportMapper reportMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IDspService dspService; |
|
|
|
|
|
|
@@ -55,6 +50,7 @@ public class UpdateWaittStatusService { |
|
|
|
Inspection inspectionUpdate = new Inspection(); |
|
|
|
inspectionUpdate.setId(inspection.getId()); |
|
|
|
inspectionUpdate.setStatus(TaskStatusEnum.COMPLETE.getCode()); |
|
|
|
inspectionUpdate.setExecutionEndTime(DateUtils.now()); |
|
|
|
|
|
|
|
List<Business> businessList = businessMapper.selectList(new LambdaQueryWrapper<Business>() |
|
|
|
.eq(Business::getTypeId, inspection.getId()) |
|
|
@@ -102,7 +98,10 @@ public class UpdateWaittStatusService { |
|
|
|
inspectionUpdate.setFlyHeight(flightData.getUltrasonic()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
inspectionMapper.updateById(inspectionUpdate); |
|
|
|
|
|
|
|
this.updateReport(inspection); |
|
|
|
} |
|
|
|
|
|
|
|
public JsonResult getWeather(String airportUrl, Integer airportId) { |
|
|
@@ -124,4 +123,18 @@ public class UpdateWaittStatusService { |
|
|
|
return JsonResult.error(EditInspectionStatusCodeEnum.GET_WEATHER_FAILED.getCode(), EditInspectionStatusCodeEnum.GET_WEATHER_FAILED.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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.setExecutionEndTime(inspection.getExecutionEndTime()); |
|
|
|
reportMapper.updateById(report); |
|
|
|
} |
|
|
|
|
|
|
|
} |