Browse Source

重构代码

tags/v1.2.0^2
wanjing 1 year ago
parent
commit
9d9f3752a3
2 changed files with 28 additions and 7 deletions
  1. +3
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java
  2. +25
    -6
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java

+ 3
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java View File

@@ -87,7 +87,9 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper,
// 定点飞行
WarningRecord warningRecord = warningRecordMapper.selectOne(new LambdaQueryWrapper<WarningRecord>()
.eq(WarningRecord::getEmergencyMissionId, id)
.eq(WarningRecord::getMark, MarkTypeEnum.VALID.getCode()));
.eq(WarningRecord::getMark, MarkTypeEnum.VALID.getCode())
.orderByDesc(WarningRecord::getCreateTime)
.last(" limit 1"));
if (ObjectUtil.isNull(warningRecord)) {
throw new ServiceException("该应急任务没有对应的预警记录");
}

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

@@ -119,12 +119,31 @@ public class PointFlightService {
throw new ServiceException("原巡检任务不存在");
}

ThMission missionTmp = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getAirportId, request.getAirportId())
.eq(ThMission::getStatus, TaskStatusEnum.FLIGHT.getCode())
.eq(ThMission::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNotNull(missionTmp)) {
throw new ServiceException("该机场正在执行任务");
if (mission.getAirportId() == request.getAirportId()) {
WarningRecord warningRecord = warningRecordMapper.selectOne(new LambdaQueryWrapper<WarningRecord>()
.eq(WarningRecord::getMissionId, mission.getId())
.eq(WarningRecord::getMark, MarkTypeEnum.VALID.getCode())
.orderByDesc(WarningRecord::getCreateTime)
.last(" limit 1"));
if (ObjectUtil.isNotNull(warningRecord)) {
ThMission missionTmp = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getId, warningRecord.getEmergencyMissionId())
.eq(ThMission::getStatus, TaskStatusEnum.FLIGHT.getCode())
.eq(ThMission::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNotNull(missionTmp)) {
log.info("原机场正在执行任务");
throw new ServiceException("原机场正在执行任务");
}
}
} else {
ThMission missionTmp = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getAirportId, request.getAirportId())
.eq(ThMission::getStatus, TaskStatusEnum.FLIGHT.getCode())
.eq(ThMission::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNotNull(missionTmp)) {
log.info("新机场正在执行任务");
throw new ServiceException("新机场正在执行任务");
}
}
return JsonResult.success(mission);
}

Loading…
Cancel
Save