Browse Source

重构根据预警ID获取预警记录列表代码

tags/v1.2.0^2
wanjing 1 year ago
parent
commit
92f16e325b
1 changed files with 3 additions and 20 deletions
  1. +3
    -20
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warningrecord/query/QueryWarningRecordListByWarningIdService.java

+ 3
- 20
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warningrecord/query/QueryWarningRecordListByWarningIdService.java View File



// 构造返回结果对象 // 构造返回结果对象
List<WarningRecordVo> warningRecordVoList = this.buildWarningRecordVoList(warningRecordList); List<WarningRecordVo> warningRecordVoList = this.buildWarningRecordVoList(warningRecordList);

for (WarningRecordVo warningRecordVo : warningRecordVoList) {
log.info("预警记录, warningRecordVo = {}", warningRecordVo);
}

return JsonResult.success(warningRecordVoList); return JsonResult.success(warningRecordVoList);
} }




private List<WarningRecordVo> buildWarningRecordVoList(List<WarningRecord> warningRecordList) { private List<WarningRecordVo> buildWarningRecordVoList(List<WarningRecord> warningRecordList) {
List<WarningRecordVo> warningRecordVoList = WarningRecordConverMapper.INSTANCE.fromWarningRecordListToWarningRecordListVoList(warningRecordList); List<WarningRecordVo> warningRecordVoList = WarningRecordConverMapper.INSTANCE.fromWarningRecordListToWarningRecordListVoList(warningRecordList);
ThMission oldMission;
ThMission newMission;
ThMission mission;
for (WarningRecordVo warningRecordVo : warningRecordVoList) { for (WarningRecordVo warningRecordVo : warningRecordVoList) {
oldMission = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getId, warningRecordVo.getMissionId())
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()));
newMission = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
mission = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getId, warningRecordVo.getEmergencyMissionId()) .eq(ThMission::getId, warningRecordVo.getEmergencyMissionId())
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode())); .eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()));
if (oldMission.getAirportId().equals(newMission.getAirportId())) {
if (0 == oldMission.getEmergencyDataMissionId()) {
warningRecordVo.setStatus(oldMission.getStatus());
} else {
warningRecordVo.setStatus(newMission.getStatus());
}
} else {
warningRecordVo.setStatus(newMission.getStatus());
}
warningRecordVo.setStatus(mission.getStatus());
} }
return warningRecordVoList; return warningRecordVoList;
} }

Loading…
Cancel
Save