Browse Source

Merge branch 'develop' of gitadmin/tuoheng_lc into release

tags/v1.2.0^2
wanjing 1 year ago
parent
commit
3fc46e7ce0
3 changed files with 45 additions and 9 deletions
  1. +2
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/QuestionServiceImpl.java
  2. +4
    -5
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java
  3. +39
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warningrecord/query/QueryWarningRecordListByWarningIdService.java

+ 2
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/QuestionServiceImpl.java View File

lambdaQueryWrapper lambdaQueryWrapper
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()) .eq(ThMission::getMark, MarkTypeEnum.VALID.getCode())
.eq(ThMission::getRequestId, requestId) .eq(ThMission::getRequestId, requestId)
.eq(ThMission::getStatus, TaskStatusEnum.FLIGHT.getCode()).orderByDesc(ThMission::getExecutionStartTime);
.eq(ThMission::getStatus, TaskStatusEnum.COMPLETE.getCode())
.orderByDesc(ThMission::getExecutionStartTime);
List<ThMission> thMissions = missionMapper.selectList(lambdaQueryWrapper); List<ThMission> thMissions = missionMapper.selectList(lambdaQueryWrapper);
if (ObjectUtil.isEmpty(thMissions) || thMissions.size() == 0) { if (ObjectUtil.isEmpty(thMissions) || thMissions.size() == 0) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "正在执行的任务不存在!"); throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "正在执行的任务不存在!");

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

import com.tuoheng.admin.entity.request.airport.PointFlightRequest; import com.tuoheng.admin.entity.request.airport.PointFlightRequest;
import com.tuoheng.admin.enums.AirportFlyTypeEnum; import com.tuoheng.admin.enums.AirportFlyTypeEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum; import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.TaskStatusEnum;
import com.tuoheng.admin.enums.UpdateOrCreateEnum; import com.tuoheng.admin.enums.UpdateOrCreateEnum;
import com.tuoheng.admin.mapper.TenantMapper; import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.mapper.ThMissionMapper; import com.tuoheng.admin.mapper.ThMissionMapper;
ThMission oldMission = (ThMission) result.getData(); ThMission oldMission = (ThMission) result.getData();
if (oldMission.getAirportId().equals(request.getAirportId())) { if (oldMission.getAirportId().equals(request.getAirportId())) {
log.info("原机场执行定点飞行"); log.info("原机场执行定点飞行");
// this.callOldAirpor(tenant, request);
this.callOldAirpor(tenant, request);
} else { } else {
log.info("新机场执行定点飞行"); log.info("新机场执行定点飞行");
// this.callNewAirpor(tenant, request, mission.getId());
this.callNewAirpor(tenant, request, mission.getId());
} }


// 创建预警记录 // 创建预警记录
throw new ServiceException("纬度为空"); throw new ServiceException("纬度为空");
} }
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>() Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>()
.eq(Warning::getId, request.getWarningId())
.eq(Warning::getMark, 1));
.eq(Warning::getId, request.getWarningId())
.eq(Warning::getMark, 1));
if (ObjectUtil.isNull(warning)) { if (ObjectUtil.isNull(warning)) {
throw new ServiceException("该预警信息不存在"); throw new ServiceException("该预警信息不存在");
} }

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

import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.conver.WarningConverMapper;
import com.tuoheng.admin.conver.WarningRecordConverMapper;
import com.tuoheng.admin.entity.domain.Question;
import com.tuoheng.admin.entity.domain.ThMission;
import com.tuoheng.admin.entity.domain.Warning; import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.entity.domain.WarningRecord; import com.tuoheng.admin.entity.domain.WarningRecord;
import com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest; import com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest;
import com.tuoheng.admin.entity.vo.warning.WarningListVo;
import com.tuoheng.admin.entity.vo.warning.WarningRecordVo;
import com.tuoheng.admin.enums.MarkEnum; import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.TaskStatusEnum;
import com.tuoheng.admin.enums.UpdateOrCreateEnum;
import com.tuoheng.admin.mapper.ThMissionMapper;
import com.tuoheng.admin.mapper.WarningMapper; import com.tuoheng.admin.mapper.WarningMapper;
import com.tuoheng.admin.mapper.WarningRecordMapper; import com.tuoheng.admin.mapper.WarningRecordMapper;
import com.tuoheng.common.exception.ServiceException; import com.tuoheng.common.exception.ServiceException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.util.List; import java.util.List;
import java.util.Map;


/** /**
* 查询预警记录业务层处理 * 查询预警记录业务层处理
@Autowired @Autowired
private WarningRecordMapper warningRecordMapper; private WarningRecordMapper warningRecordMapper;


@Autowired
private ThMissionMapper missionMapper;

public JsonResult getListByWarningId(QueryWarningRecordListByWarningIdRequest request) { public JsonResult getListByWarningId(QueryWarningRecordListByWarningIdRequest request) {
// log.info("进入根据预警ID查询预警记录列表业务"); // log.info("进入根据预警ID查询预警记录列表业务");

User user = ShiroUtils.getUserInfo(); User user = ShiroUtils.getUserInfo();
Integer tenantId = user.getTenantId(); Integer tenantId = user.getTenantId();
request.setTenantId(tenantId); request.setTenantId(tenantId);
if (CollectionUtil.isEmpty(warningRecordList)) { if (CollectionUtil.isEmpty(warningRecordList)) {
log.info("预警记录列表数据为空"); log.info("预警记录列表数据为空");
} }
return JsonResult.success(warningRecordList);

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

return JsonResult.success(warningRecordVoList);
} }


/** /**
*/ */
private JsonResult check(Integer tenantId, QueryWarningRecordListByWarningIdRequest request) { private JsonResult check(Integer tenantId, QueryWarningRecordListByWarningIdRequest request) {
// 判断预警id是否为空 // 判断预警id是否为空
if (ObjectUtil.isNotNull(request.getWarningId())) {
if (ObjectUtil.isNull(request.getWarningId())) {
throw new ServiceException("预警ID为空"); throw new ServiceException("预警ID为空");
} }
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>() Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>()
return JsonResult.success(); return JsonResult.success();
} }


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

} }

Loading…
Cancel
Save