Pārlūkot izejas kodu

任务详情的vo展示航线名称和机场名称

pull/95/head
suqin pirms 10 mēnešiem
vecāks
revīzija
3c8fa3b025
3 mainītis faili ar 71 papildinājumiem un 6 dzēšanām
  1. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/report/GenerateReportWordService.java
  2. +15
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionByIdService.java
  3. +55
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionDetailsByIdService.java

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/report/GenerateReportWordService.java Parādīt failu

@@ -71,7 +71,7 @@ public class GenerateReportWordService {
}

/**
* 修改pm2.5和pm10的标题字段
* 修改pm2.5和pm10的标题字段wordUtils = {WordUtils@16452}
* @param airDataType
* @return
*/

+ 15
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionByIdService.java Parādīt failu

@@ -1,17 +1,32 @@
package com.tuoheng.admin.service.inspection.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.conver.InspectionConverMapper;
import com.tuoheng.admin.entity.domain.Inspection;
import com.tuoheng.admin.entity.vo.airport.AirportInfoVo;
import com.tuoheng.admin.entity.vo.airport.AirportLineVo;
import com.tuoheng.admin.entity.vo.inspection.InspectionVo;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionInfoByIdCodeEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.service.third.airport.AirportService;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* 根据Id查询巡检任务业务层处理
*
@@ -36,7 +51,6 @@ public class QueryInspectionByIdService {
}

Inspection inspection = (Inspection) result.getData();

return JsonResult.success(inspection);
}


+ 55
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionDetailsByIdService.java Parādīt failu

@@ -9,6 +9,9 @@ import com.tuoheng.admin.conver.InspectionConverMapper;
import com.tuoheng.admin.entity.domain.FlightData;
import com.tuoheng.admin.entity.domain.Inspection;
import com.tuoheng.admin.entity.domain.InspectionHistory;
import com.tuoheng.admin.entity.vo.airport.AirportInfoVo;
import com.tuoheng.admin.entity.vo.airport.AirportLineVo;
import com.tuoheng.admin.entity.vo.inspection.InspectionVo;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.InspectionTaskTypeEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
@@ -17,6 +20,7 @@ import com.tuoheng.admin.enums.code.inspection.QueryInspectionDetailsByIdCodeEnu
import com.tuoheng.admin.mapper.FlightDataMapper;
import com.tuoheng.admin.mapper.InspectionHistoryMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.service.third.airport.AirportService;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.entity.vo.inspection.InspectionDetailsVo;
import com.tuoheng.admin.utils.TimeUtil;
@@ -24,10 +28,15 @@ import com.tuoheng.common.core.utils.CommonNumberTypeUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;


/**
@@ -50,17 +59,19 @@ public class QueryInspectionDetailsByIdService {
@Autowired
private FlightDataMapper flightDataMapper;

@Autowired
private AirportService airportService;

public JsonResult getInspectionDetails(String id) {
log.info("进入查询巡检任务详情业务");
String tenantId = CurrentUserUtil.getTenantId();
JsonResult result = this.check(tenantId, id);

if (0 != result.getCode()) {
log.info("进入查询巡检任务详情业务:校验失败:{}", result.getMsg());
return result;
}

Inspection inspection = (Inspection) result.getData();

InspectionDetailsVo inspectionDetailsVo = InspectionConverMapper.INSTANCE.fromInspectionToInspectionDetailsVo(inspection);

//获取最后一次的飞行时间 获取飞行里程 只有机场任务才有里程和失败记录
@@ -75,12 +86,53 @@ public class QueryInspectionDetailsByIdService {
inspectionDetailsVo.setInspectionHistoryList(inspectionHistoryList);
}
}

}

List<Inspection> inspectionList = new ArrayList<>();
inspectionList.add(inspection);
AirportInfoVo airport = this.getAirport(inspection);
AirportLineVo airportLine = this.getAirportLine(inspectionList);

//机场名称
if (ObjectUtil.isNotEmpty(airport)) {
inspectionDetailsVo.setAirportName(airport.getName());
}
//航线名称
if (ObjectUtil.isNotEmpty(airportLine)) {
inspectionDetailsVo.setInspectionLineName(airportLine.getFileName());
}
return JsonResult.success(inspectionDetailsVo);
}

/**
* 查询机场
* @param inspection
* @return
*/
private AirportInfoVo getAirport(Inspection inspection) {
String airportIds = String.valueOf(inspection.getAirportId());
List<AirportInfoVo> airportInfoVoList = airportService.getAirportInfoList(airportIds);
if (CollectionUtil.isEmpty(airportInfoVoList)) {
return null;
}
return airportInfoVoList.get(0);
}

/**
* 查航线
* @param inspectionList
* @return
*/
private AirportLineVo getAirportLine(List<Inspection> inspectionList) {
List<Integer> airportLineIdList = inspectionList.stream().map(o -> o.getInspectionLine()).collect(Collectors.toList());
List<AirportLineVo> airportLineVoList = airportService.getAirportLineListByAirportIdAndLineIdList(null, airportLineIdList);
if (CollectionUtil.isEmpty(airportLineVoList)) {
return null;
}
return airportLineVoList.get(0);
}


private void getFlyTimeAndMileage(Inspection inspection, InspectionDetailsVo inspectionDetailsVo) {
//任务判断
if(inspectionDetailsVo.getStatus().equals(InspectionStatusEnum.FLIGHT_COMPLETED.getCode())
@@ -100,7 +152,6 @@ public class QueryInspectionDetailsByIdService {
inspectionDetailsVo.setMileage(round + "公里");
}
}

}

/**

Notiek ielāde…
Atcelt
Saglabāt