Browse Source

重构代码

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

+ 2
- 18
tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/UpdateEmergencyMissionStatusService.java View File

*/ */
public void updateStatus(ThMission oldMission, Integer status) { public void updateStatus(ThMission oldMission, Integer status) {
log.info("修改应急任务数据, type:{}, emergencyDataMissionId:{}, status={}", oldMission.getType(), oldMission.getEmergencyDataMissionId(), status); log.info("修改应急任务数据, type:{}, emergencyDataMissionId:{}, status={}", oldMission.getType(), oldMission.getEmergencyDataMissionId(), status);
WarningRecord warningRecord = warningRecordMapper.selectOne(new LambdaQueryWrapper<WarningRecord>()
.eq(WarningRecord::getMissionId, oldMission.getId())
.eq(WarningRecord::getMark, MarkTypeEnum.VALID.getCode())
.orderByDesc(WarningRecord::getCreateTime)
.last(" limit 1"));
if (ObjectUtil.isNull(warningRecord)) {
log.info("修改应急任务数据,该巡检任务没有产生预警记录");
return;
}

ThMission emergencyMission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>() ThMission emergencyMission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getId, warningRecord.getEmergencyMissionId())
.eq(ThMission::getEmergencyDataMissionId, oldMission.getId())
.eq(ThMission::getMark, MarkEnum.VALID.getCode())); .eq(ThMission::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(emergencyMission)) { if (ObjectUtil.isNull(emergencyMission)) {
log.info("修改应急任务数据,应急任务不存在");
log.info("修改应急任务数据,该巡检任务没有对应的应急任务");
return; return;
} }

if (0 == emergencyMission.getEmergencyDataMissionId()) {
log.info("修改应急任务数据,该应急任务,作为独立的任务");
return;
}

// 在查询一次,保证数据是最新的 // 在查询一次,保证数据是最新的
ThMission mission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>() ThMission mission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getId, oldMission.getId()) .eq(ThMission::getId, oldMission.getId())

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



// 判断是否有正在执行的应急任务 // 判断是否有正在执行的应急任务
List<WarningRecord> warningRecordList = warningRecordMapper.selectList(new LambdaQueryWrapper<WarningRecord>() List<WarningRecord> warningRecordList = warningRecordMapper.selectList(new LambdaQueryWrapper<WarningRecord>()
.eq(WarningRecord::getWarningId, warning.getId())
.eq(WarningRecord::getMissionId, mission.getId()) .eq(WarningRecord::getMissionId, mission.getId())
.eq(WarningRecord::getMark, MarkTypeEnum.VALID.getCode())); .eq(WarningRecord::getMark, MarkTypeEnum.VALID.getCode()));
if (CollectionUtil.isNotEmpty(warningRecordList)) { if (CollectionUtil.isNotEmpty(warningRecordList)) {

Loading…
Cancel
Save