Browse Source

定点飞行,增加对已存在正在执行的应急任务的判断

tags/v1.2.0^2
wanjing 1 year ago
parent
commit
bfa77048a1
1 changed files with 21 additions and 0 deletions
  1. +21
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java

+ 21
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java View File

@@ -1,5 +1,6 @@
package com.tuoheng.admin.service.third.airport;

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;
@@ -28,6 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Slf4j
@Service
public class PointFlightService {
@@ -132,6 +137,22 @@ public class PointFlightService {
throw new ServiceException("原巡检任务不存在");
}

// 判断是否有正在执行的应急任务
List<WarningRecord> warningRecordList = warningRecordMapper.selectList(new LambdaQueryWrapper<WarningRecord>()
.eq(WarningRecord::getMissionId, mission.getId())
.eq(WarningRecord::getMark, MarkTypeEnum.VALID.getCode()));
if (CollectionUtil.isNotEmpty(warningRecordList)) {
List<Integer> missionIdList = warningRecordList.stream().map(WarningRecord::getEmergencyMissionId).collect(Collectors.toList());
List<ThMission> missionList = missionMapper.selectList(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getMark, MarkEnum.VALID.getCode())
.in(ThMission::getId, missionIdList));
for (ThMission missionTmp : missionList) {
if (TaskStatusEnum.FLIGHT.getCode() == missionTmp.getStatus()) {
throw new ServiceException("已存在正在执行的应急任务");
}
}
}

if (mission.getAirportId() == request.getAirportId()) {
WarningRecord warningRecord = warningRecordMapper.selectOne(new LambdaQueryWrapper<WarningRecord>()
.eq(WarningRecord::getMissionId, mission.getId())

Loading…
Cancel
Save