Sfoglia il codice sorgente

修改应急任务数据

tags/v1.2.0^2
wanjing 1 anno fa
parent
commit
bb110bbec8
1 ha cambiato i file con 15 aggiunte e 22 eliminazioni
  1. +15
    -22
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/UpdateEmergencyMissionStatusService.java

+ 15
- 22
tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/UpdateEmergencyMissionStatusService.java Vedi File

@@ -3,9 +3,8 @@ package com.tuoheng.admin.service.third;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.domain.ThMission;
import com.tuoheng.admin.entity.domain.WarningRecord;
import com.tuoheng.admin.enums.AccidentTaskEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.MarkTypeEnum;
import com.tuoheng.admin.mapper.ThMissionMapper;
import com.tuoheng.admin.mapper.WarningRecordMapper;
import lombok.extern.slf4j.Slf4j;
@@ -16,40 +15,33 @@ import org.springframework.stereotype.Service;
@Service
public class UpdateEmergencyMissionStatusService {

@Autowired
private WarningRecordMapper warningRecordMapper;

@Autowired
private ThMissionMapper thMissionMapper;

/**
* 修改应急任务数据
*
* @param oldMission
*/
public void updateStatus(ThMission oldMission) {
WarningRecord warningRecord = warningRecordMapper.selectOne(new LambdaQueryWrapper<WarningRecord>()
.eq(WarningRecord::getTenantId, oldMission.getTenantId())
.eq(WarningRecord::getMissionId, oldMission.getId())
.eq(WarningRecord::getMark, MarkTypeEnum.VALID.getCode())
.orderByDesc(WarningRecord::getCreateTime)
.last(" limit 1"));

if (ObjectUtil.isNull(warningRecord)) {
log.info("进入修改应急任务数据");
if (ObjectUtil.isNull(oldMission.getAccidentTask())) {
return;
}

if (AccidentTaskEnum.INSPECTION_TASK.getCode() == oldMission.getAccidentTask()) {
return;
}
if (0 == oldMission.getEmergencyDataMissionId()) {
return;
}
log.info("修改应急任务数据");
ThMission emergencyMission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getId, warningRecord.getEmergencyMissionId())
.eq(ThMission::getId, oldMission.getEmergencyDataMissionId())
.eq(ThMission::getMark, MarkEnum.VALID.getCode()));

if (ObjectUtil.isNull(emergencyMission)) {
log.info("修改应急任务数据,应急任务不存在");
return;
}

// 应急任务使用的是新的机场,不需要考虑
if (oldMission.getAirportId() != emergencyMission.getAirportId()) {
return;
}

// 在查询一次,保证数据是最新的
ThMission mission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getId, oldMission.getId())
@@ -65,6 +57,7 @@ public class UpdateEmergencyMissionStatusService {
emergencyMission.setVideoUrl(mission.getVideoUrl());
emergencyMission.setAiVideoUrl(mission.getAiVideoUrl());
thMissionMapper.updateById(emergencyMission);
log.info("修改应急任务数据完成");
}

}

Loading…
Annulla
Salva