Explorar el Código

重构代码

tags/v1.2.0^2
wanjing hace 1 año
padre
commit
1d1435d142
Se han modificado 2 ficheros con 3 adiciones y 18 borrados
  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 Ver fichero

@@ -29,29 +29,13 @@ public class UpdateEmergencyMissionStatusService {
*/
public void updateStatus(ThMission oldMission, Integer 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>()
.eq(ThMission::getId, warningRecord.getEmergencyMissionId())
.eq(ThMission::getEmergencyDataMissionId, oldMission.getId())
.eq(ThMission::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(emergencyMission)) {
log.info("修改应急任务数据,应急任务不存在");
log.info("修改应急任务数据,该巡检任务没有对应的应急任务");
return;
}

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

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

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

@@ -139,6 +139,7 @@ public class PointFlightService {

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

Cargando…
Cancelar
Guardar