Browse Source

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/v1.2.0^2
wanjing 1 year ago
parent
commit
4bf9f1d28c
1 changed files with 31 additions and 6 deletions
  1. +31
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyService.java

+ 31
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyService.java View File

@@ -8,7 +8,10 @@ import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.*;
import com.tuoheng.admin.enums.AccidentStatusEnum;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
@@ -43,7 +46,6 @@ public class AccidentVerifyService {
private InspectionFileMapper inspectionFileMapper;

/**
*
* 1、向机场起降平台推送指令,无人机前往事故发生地点,即获取拍摄到事故照片时所处的经纬度,并在事故地点上方悬停
* 2、修改该事故状态为处理中
*
@@ -62,9 +64,9 @@ public class AccidentVerifyService {
return result;
}
Accident accident = (Accident) result.getData();
Inspection oldInspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getId, accident.getInspectionId())
.eq(Inspection::getMark, MarkEnum.VALID.getCode()));
Inspection oldInspection = this.getInspection(accident);
// 无人机前往事故发生地点,事故地点上方悬停
this.callAirpor(accident, oldInspection);

@@ -100,6 +102,27 @@ public class AccidentVerifyService {
return JsonResult.success(accident);
}

/**
* 获取巡检任务
*
* @param accident
* @return
*/
private Inspection getInspection(Accident accident) {
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getId, accident.getInspectionId())
.eq(Inspection::getMark, MarkEnum.VALID.getCode()));
if (InspectionStatusEnum.FLIGHT_COMPLETED.getCode() == inspection.getStatus()) {
log.info("该任务已完成,不能在核实:inspectionId={}, status={}", inspection.getId(), inspection.getStatus());
throw new ServiceException("该任务已完成,不能在核实");
}
if (InspectionStatusEnum.FLIGHT_FAILED.getCode() == inspection.getStatus()) {
log.info("该任务已失败,不能在核实:inspectionId={}, status={}", inspection.getId(), inspection.getStatus());
throw new ServiceException("该任务已失败,不能在核实");
}
return inspection;
}

/**
* 创建应急任务
*
@@ -109,7 +132,8 @@ public class AccidentVerifyService {
*/
private Inspection createInspection(String userid, Inspection oldInspection) {
Inspection inspection = new Inspection();
String code = DateUtils.generateCode("XJRW");;
String code = DateUtils.generateCode("XJRW");
;
inspection.setCode(code);
inspection.setName("应急任务" + code);
inspection.setDeptId(oldInspection.getDeptId());
@@ -140,6 +164,7 @@ public class AccidentVerifyService {

/**
* 调用机场平台,执行指点飞行
*
* @param accident
* @param inspection
*/

Loading…
Cancel
Save