-- 任务表 | -- 任务表 | ||||
alter table tuoheng_airmonitor.th_inspection add airport_task_id int default 0 not null comment '机场任务ID' after inspection_type; | alter table tuoheng_airmonitor.th_inspection add airport_task_id int default 0 not null comment '机场任务ID' after inspection_type; | ||||
alter table tuoheng_airmonitor.th_inspection drop column airport_name; | |||||
alter table tuoheng_airmonitor.th_inspection drop column inspection_line_name; | |||||
*/ | */ | ||||
String API_AIRPORT_STATUS = "/airportInterface/getAirportStatus"; | String API_AIRPORT_STATUS = "/airportInterface/getAirportStatus"; | ||||
/** | |||||
* 机场平台:根据id获取机场信息 | |||||
*/ | |||||
String API_AIRPORT_MSG_BY_AIRPORT_ID = "/airportInterface/queryAirportList"; | |||||
/** | /** | ||||
* 机场平台:周期性任务创建/修改 | * 机场平台:周期性任务创建/修改 | ||||
*/ | */ |
package com.tuoheng.admin.controller; | package com.tuoheng.admin.controller; | ||||
import com.tuoheng.admin.entity.request.inspection.AirportLineRequest; | import com.tuoheng.admin.entity.request.inspection.AirportLineRequest; | ||||
import com.tuoheng.admin.entity.vo.AirportLineVo; | |||||
import com.tuoheng.admin.service.airportline.IAirportLineService; | import com.tuoheng.admin.service.airportline.IAirportLineService; | ||||
import com.tuoheng.admin.service.third.airport.AirportService; | |||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import java.util.List; | |||||
/** | /** | ||||
* 航线前端控制器 | * 航线前端控制器 | ||||
* | * |
*/ | */ | ||||
private Integer droneId; | private Integer droneId; | ||||
/** | |||||
* 巡检机场名称 | |||||
*/ | |||||
private String airportName; | |||||
/** | /** | ||||
* 巡检线路id | * 巡检线路id | ||||
*/ | */ | ||||
private Integer inspectionLine; | private Integer inspectionLine; | ||||
/** | |||||
* 巡检线路名称 | |||||
*/ | |||||
private String inspectionLineName; | |||||
/** | /** | ||||
* 飞行设备 | * 飞行设备 | ||||
*/ | */ |
*/ | */ | ||||
private Integer inspectionLine; | private Integer inspectionLine; | ||||
/** | |||||
* 巡检线路名称 | |||||
*/ | |||||
private String inspectionLineName; | |||||
/** | /** | ||||
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞 | * 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞 | ||||
*/ | */ |
*/ | */ | ||||
@NoArgsConstructor | @NoArgsConstructor | ||||
@Data | @Data | ||||
public class AirPortStatusVO implements Serializable { | |||||
public class AirPortStatusVo implements Serializable { | |||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
package com.tuoheng.admin.entity.vo.airport; | |||||
import lombok.Data; | |||||
import lombok.NoArgsConstructor; | |||||
import java.io.Serializable; | |||||
/** | |||||
* @Author ChengWang | |||||
* @Date 2023/7/27 | |||||
*/ | |||||
@Data | |||||
@NoArgsConstructor | |||||
public class AirportInfoVo implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
/** | |||||
* 机场id | |||||
*/ | |||||
private String id; | |||||
/** | |||||
* 机场代码 | |||||
*/ | |||||
private String code; | |||||
/** | |||||
* 机场名称 | |||||
*/ | |||||
private String name; | |||||
/** | |||||
* 机场图片 | |||||
*/ | |||||
private String image; | |||||
/** | |||||
* 机场外部监控地址 | |||||
*/ | |||||
private String externalMonitorUrl; | |||||
/** | |||||
* 机场外部监控FLV地址 | |||||
*/ | |||||
private String flvExternalMonitorUrl; | |||||
/** | |||||
* 机场内部监控地址 | |||||
*/ | |||||
private String internalMonitorUrl; | |||||
/** | |||||
* 覆盖范围(km) | |||||
*/ | |||||
private String coverage; | |||||
/** | |||||
* 排序 | |||||
*/ | |||||
private Integer sort; | |||||
/** | |||||
* 备注 | |||||
*/ | |||||
private String note; | |||||
/** | |||||
* 经度 | |||||
*/ | |||||
private String longitude; | |||||
/** | |||||
* 纬度 | |||||
*/ | |||||
private String latitude; | |||||
/** | |||||
* 无人机id | |||||
*/ | |||||
private Integer droneId; | |||||
/** | |||||
* 无人机名称 | |||||
*/ | |||||
private String groundStationUrl; | |||||
/** | |||||
* 创建人 | |||||
*/ | |||||
private String createUser; | |||||
/** | |||||
* 创建时间 | |||||
*/ | |||||
private String createTime; | |||||
/** | |||||
* 修改人 | |||||
*/ | |||||
private String updateUser; | |||||
/** | |||||
* 修改时间 | |||||
*/ | |||||
private String updateTime; | |||||
} |
package com.tuoheng.admin.entity.vo; | |||||
package com.tuoheng.admin.entity.vo.airport; | |||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; |
import com.tuoheng.admin.entity.domain.AirportLine; | import com.tuoheng.admin.entity.domain.AirportLine; | ||||
import com.tuoheng.admin.entity.request.inspection.AirportLineRequest; | import com.tuoheng.admin.entity.request.inspection.AirportLineRequest; | ||||
import com.tuoheng.admin.entity.vo.AirportLineVo; | |||||
import com.tuoheng.admin.entity.vo.airport.AirportLineVo; | |||||
import com.tuoheng.admin.mapper.AirportLineMapper; | import com.tuoheng.admin.mapper.AirportLineMapper; | ||||
import com.tuoheng.admin.service.airportline.add.AddAirportLineService; | import com.tuoheng.admin.service.airportline.add.AddAirportLineService; | ||||
import com.tuoheng.admin.service.airportline.query.inspection.QueryAirportLineByInspectionIdFactory; | import com.tuoheng.admin.service.airportline.query.inspection.QueryAirportLineByInspectionIdFactory; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.web.bind.annotation.PathVariable; | |||||
import java.util.List; | import java.util.List; | ||||
import com.tuoheng.admin.constant.SystemConstant; | import com.tuoheng.admin.constant.SystemConstant; | ||||
import com.tuoheng.admin.entity.domain.Inspection; | import com.tuoheng.admin.entity.domain.Inspection; | ||||
import com.tuoheng.admin.entity.vo.airport.AirPortLineLocationVo; | import com.tuoheng.admin.entity.vo.airport.AirPortLineLocationVo; | ||||
import com.tuoheng.admin.entity.vo.airport.AirPortStatusVO; | |||||
import com.tuoheng.admin.enums.InspectionTypeEnum; | import com.tuoheng.admin.enums.InspectionTypeEnum; | ||||
import com.tuoheng.common.core.config.common.CommonConfig; | import com.tuoheng.common.core.config.common.CommonConfig; | ||||
import com.tuoheng.common.core.exception.ServiceException; | import com.tuoheng.common.core.exception.ServiceException; |
return JsonResult.error(AddInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), AddInspectionCodeEnum.AIRPORT_IS_NULL.getMsg()); | return JsonResult.error(AddInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), AddInspectionCodeEnum.AIRPORT_IS_NULL.getMsg()); | ||||
} | } | ||||
if (null == addInspectionRequest.getInspectionLine() || StringUtils.isEmpty(addInspectionRequest.getInspectionLineName())) { | |||||
if (null == addInspectionRequest.getInspectionLine()) { | |||||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg()); | return JsonResult.error(AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg()); | ||||
} | } | ||||
if(StringUtils.isEmpty(addInspectionRequest.getFlyHeight())){ | if(StringUtils.isEmpty(addInspectionRequest.getFlyHeight())){ |
import com.tuoheng.admin.constant.SystemConstant; | import com.tuoheng.admin.constant.SystemConstant; | ||||
import com.tuoheng.admin.entity.domain.Inspection; | import com.tuoheng.admin.entity.domain.Inspection; | ||||
import com.tuoheng.admin.entity.domain.User; | import com.tuoheng.admin.entity.domain.User; | ||||
import com.tuoheng.admin.entity.vo.airport.AirPortStatusVO; | |||||
import com.tuoheng.admin.entity.vo.airport.AirPortStatusVo; | |||||
import com.tuoheng.admin.entity.vo.inspection.InspectionScrollbarVo; | import com.tuoheng.admin.entity.vo.inspection.InspectionScrollbarVo; | ||||
import com.tuoheng.admin.enums.InspectionStatusEnum; | import com.tuoheng.admin.enums.InspectionStatusEnum; | ||||
import com.tuoheng.admin.enums.InspectionTypeEnum; | import com.tuoheng.admin.enums.InspectionTypeEnum; | ||||
inspectionVoList.add(vo); | inspectionVoList.add(vo); | ||||
} | } | ||||
//机场状态 | //机场状态 | ||||
Map<Integer, AirPortStatusVO> airPortStatusVOMap = this.getAirPortStatusMap(inspectionList); | |||||
AirPortStatusVO airPortStatusVO; | |||||
Map<Integer, AirPortStatusVo> airPortStatusVOMap = this.getAirPortStatusMap(inspectionList); | |||||
AirPortStatusVo airPortStatusVO; | |||||
for (InspectionScrollbarVo inspectionScrollbarVo : inspectionVoList) { | for (InspectionScrollbarVo inspectionScrollbarVo : inspectionVoList) { | ||||
if(ObjectUtil.isNotNull(airPortStatusVOMap)){ | if(ObjectUtil.isNotNull(airPortStatusVOMap)){ | ||||
airPortStatusVO = airPortStatusVOMap.get(inspectionScrollbarVo.getAirportId()); | airPortStatusVO = airPortStatusVOMap.get(inspectionScrollbarVo.getAirportId()); | ||||
return JsonResult.success(inspectionVoList); | return JsonResult.success(inspectionVoList); | ||||
} | } | ||||
private Map<Integer, AirPortStatusVO> getAirPortStatusMap(List<Inspection> inspectionList) { | |||||
private Map<Integer, AirPortStatusVo> getAirPortStatusMap(List<Inspection> inspectionList) { | |||||
StringBuffer ids = new StringBuffer(); | StringBuffer ids = new StringBuffer(); | ||||
String airportIds; | String airportIds; | ||||
Set<Integer> set = new HashSet<>(); | Set<Integer> set = new HashSet<>(); | ||||
} | } | ||||
//List<AirPortStatusVO> airPortStatusVOList = (List<AirPortStatusVO>) jsonResult.getData(); | //List<AirPortStatusVO> airPortStatusVOList = (List<AirPortStatusVO>) jsonResult.getData(); | ||||
List<AirPortStatusVO> airPortStatusVOList = com.alibaba.fastjson.JSONObject.parseArray(JSONObject.toJSONString(jsonResult.getData()), AirPortStatusVO.class); | |||||
Map<Integer,AirPortStatusVO> map = new HashMap<>(); | |||||
for (AirPortStatusVO airPortStatusVO : airPortStatusVOList) { | |||||
List<AirPortStatusVo> airPortStatusVOList = com.alibaba.fastjson.JSONObject.parseArray(JSONObject.toJSONString(jsonResult.getData()), AirPortStatusVo.class); | |||||
Map<Integer, AirPortStatusVo> map = new HashMap<>(); | |||||
for (AirPortStatusVo airPortStatusVO : airPortStatusVOList) { | |||||
map.put(airPortStatusVO.getAirportId(),airPortStatusVO); | map.put(airPortStatusVO.getAirportId(),airPortStatusVO); | ||||
} | } | ||||
return map; | return map; |
package com.tuoheng.admin.service.inspection.query; | 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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.tuoheng.admin.conver.InspectionConverMapper; | import com.tuoheng.admin.conver.InspectionConverMapper; | ||||
import com.tuoheng.admin.entity.domain.Inspection; | import com.tuoheng.admin.entity.domain.Inspection; | ||||
import com.tuoheng.admin.entity.domain.User; | import com.tuoheng.admin.entity.domain.User; | ||||
import com.tuoheng.admin.entity.vo.airport.AirportInfoVo; | |||||
import com.tuoheng.admin.entity.vo.airport.AirportLineVo; | |||||
import com.tuoheng.admin.mapper.InspectionMapper; | import com.tuoheng.admin.mapper.InspectionMapper; | ||||
import com.tuoheng.admin.mapper.UserMapper; | import com.tuoheng.admin.mapper.UserMapper; | ||||
import com.tuoheng.admin.entity.request.inspection.QueryInspectionPageListRequest; | import com.tuoheng.admin.entity.request.inspection.QueryInspectionPageListRequest; | ||||
import com.tuoheng.admin.service.third.airport.AirportService; | |||||
import com.tuoheng.admin.utils.CurrentUserUtil; | import com.tuoheng.admin.utils.CurrentUserUtil; | ||||
import com.tuoheng.admin.entity.vo.inspection.InspectionVo; | import com.tuoheng.admin.entity.vo.inspection.InspectionVo; | ||||
import com.tuoheng.common.core.config.common.CommonConfig; | import com.tuoheng.common.core.config.common.CommonConfig; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | |||||
import java.util.function.Function; | |||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* 查询巡检任务分页列表业务层处理 | * 查询巡检任务分页列表业务层处理 | ||||
@Autowired | @Autowired | ||||
private InspectionMapper inspectionMapper; | private InspectionMapper inspectionMapper; | ||||
@Autowired | |||||
private AirportService airportService; | |||||
public JsonResult getPageList(QueryInspectionPageListRequest request) { | public JsonResult getPageList(QueryInspectionPageListRequest request) { | ||||
// log.info("进入查询巡检任务分页列表业务"); | // log.info("进入查询巡检任务分页列表业务"); | ||||
} | } | ||||
/** | /** | ||||
* 1)、查找已确认问题数、发现问题数字段 | |||||
* 2)、判断是否有操作权限:立即执行、直播、回放、问题详情、问题核实、重新提交 | |||||
* | |||||
* @param user | * @param user | ||||
* @param inspectionList | * @param inspectionList | ||||
* @return | * @return | ||||
*/ | */ | ||||
private List<InspectionVo> buildIspectionVoList(User user, List<Inspection> inspectionList) { | private List<InspectionVo> buildIspectionVoList(User user, List<Inspection> inspectionList) { | ||||
List<InspectionVo> inspectionVoList = InspectionConverMapper.INSTANCE.fromInspectionListToInspectionVoList(inspectionList); | List<InspectionVo> inspectionVoList = InspectionConverMapper.INSTANCE.fromInspectionListToInspectionVoList(inspectionList); | ||||
Map<String, AirportInfoVo> airportMap = this.getAirportMap(inspectionList); | |||||
Map<Integer, AirportLineVo> airportLineMap = this.getAirportLineMap(inspectionList); | |||||
for (InspectionVo inspectionVo : inspectionVoList) { | for (InspectionVo inspectionVo : inspectionVoList) { | ||||
//机场名称 | |||||
if (CollectionUtil.isNotEmpty(airportMap)) { | |||||
if (ObjectUtil.isNotEmpty(airportMap.get(String.valueOf(inspectionVo.getAirportId())))) { | |||||
inspectionVo.setAirportName(airportMap.get(String.valueOf(inspectionVo.getAirportId())).getName()); | |||||
} | |||||
} | |||||
//航线名称 | |||||
if (CollectionUtil.isNotEmpty(airportLineMap)) { | |||||
if (ObjectUtil.isNotEmpty(airportLineMap.get(inspectionVo.getInspectionLine()))) { | |||||
inspectionVo.setInspectionLineName(airportLineMap.get(inspectionVo.getInspectionLine()).getFileName()); | |||||
} | |||||
} | |||||
if (StringUtils.isNotEmpty(inspectionVo.getAiVideoUrl())) { | if (StringUtils.isNotEmpty(inspectionVo.getAiVideoUrl())) { | ||||
inspectionVo.setAiVideoUrl(CommonConfig.videoURL + inspectionVo.getAiVideoUrl()); | inspectionVo.setAiVideoUrl(CommonConfig.videoURL + inspectionVo.getAiVideoUrl()); | ||||
} | } | ||||
return inspectionVoList; | return inspectionVoList; | ||||
} | } | ||||
private Map<String, AirportInfoVo> getAirportMap(List<Inspection> inspectionList) { | |||||
List<Integer> airportIdList = inspectionList.stream().map(o -> o.getAirportId()).collect(Collectors.toList()); | |||||
String airportIds = airportIdList.stream().distinct().map(x -> String.valueOf(x)).collect(Collectors.joining(",", "", "")); | |||||
List<AirportInfoVo> airportInfoVoList = airportService.getAirportInfoList(airportIds); | |||||
if (CollectionUtil.isEmpty(airportInfoVoList)) { | |||||
return null; | |||||
} | |||||
Map<String, AirportInfoVo> airportMap = airportInfoVoList.stream().collect(Collectors.toMap(AirportInfoVo::getId, Function.identity())); | |||||
return airportMap; | |||||
} | |||||
private Map<Integer, AirportLineVo> getAirportLineMap(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; | |||||
} | |||||
Map<Integer, AirportLineVo> airportLineMap = airportLineVoList.stream().collect(Collectors.toMap(AirportLineVo::getId, Function.identity())); | |||||
return airportLineMap; | |||||
} | |||||
} | } |
import com.tuoheng.admin.entity.domain.Inspection; | import com.tuoheng.admin.entity.domain.Inspection; | ||||
import com.tuoheng.admin.entity.request.airport.DroneHoverRequest; | import com.tuoheng.admin.entity.request.airport.DroneHoverRequest; | ||||
import com.tuoheng.admin.entity.request.airport.ReversalFlightRequest; | import com.tuoheng.admin.entity.request.airport.ReversalFlightRequest; | ||||
import com.tuoheng.admin.entity.vo.AirportLineVo; | |||||
import com.tuoheng.admin.entity.vo.airport.AirportInfoVo; | |||||
import com.tuoheng.admin.entity.vo.airport.AirportLineVo; | |||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import java.util.List; | import java.util.List; | ||||
public interface AirportService { | public interface AirportService { | ||||
List<AirportInfoVo> getAirportInfoList(String airportIds); | |||||
List<AirportLineVo> getAirportLineListByAirportIdAndLineIdList(String airportId, List<Integer> airportLineIdList); | List<AirportLineVo> getAirportLineListByAirportIdAndLineIdList(String airportId, List<Integer> airportLineIdList); | ||||
JsonResult getAirportList(); | JsonResult getAirportList(); |
import com.tuoheng.admin.entity.domain.Inspection; | import com.tuoheng.admin.entity.domain.Inspection; | ||||
import com.tuoheng.admin.entity.request.airport.DroneHoverRequest; | import com.tuoheng.admin.entity.request.airport.DroneHoverRequest; | ||||
import com.tuoheng.admin.entity.request.airport.ReversalFlightRequest; | import com.tuoheng.admin.entity.request.airport.ReversalFlightRequest; | ||||
import com.tuoheng.admin.entity.vo.AirportLineVo; | |||||
import com.tuoheng.admin.entity.vo.airport.AirportInfoVo; | |||||
import com.tuoheng.admin.entity.vo.airport.AirportLineVo; | |||||
import com.tuoheng.admin.service.third.airport.drone.DroneService; | import com.tuoheng.admin.service.third.airport.drone.DroneService; | ||||
import com.tuoheng.admin.service.third.airport.reversal.ReversalFlightService; | import com.tuoheng.admin.service.third.airport.reversal.ReversalFlightService; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
@Service | @Service | ||||
public class AirportServiceImpl implements AirportService { | public class AirportServiceImpl implements AirportService { | ||||
@Autowired | |||||
private GetAirportListByAirportIds getAirportListByAirportIds; | |||||
@Autowired | @Autowired | ||||
private GetAirportListService getAirportListService; | private GetAirportListService getAirportListService; | ||||
@Autowired | @Autowired | ||||
private ReversalFlightService reversalFlightService; | private ReversalFlightService reversalFlightService; | ||||
@Override | |||||
public List<AirportInfoVo> getAirportInfoList(String airportIds) { | |||||
return getAirportListByAirportIds.getAirportInfo(airportIds); | |||||
} | |||||
@Override | @Override | ||||
public List<AirportLineVo> getAirportLineListByAirportIdAndLineIdList(String airportId, List<Integer> airportLineIdList) { | public List<AirportLineVo> getAirportLineListByAirportIdAndLineIdList(String airportId, List<Integer> airportLineIdList) { | ||||
return getAirLineListService.getList(airportId, airportLineIdList); | return getAirLineListService.getList(airportId, airportLineIdList); |
import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
import com.tuoheng.admin.constant.SystemConstant; | import com.tuoheng.admin.constant.SystemConstant; | ||||
import com.tuoheng.admin.entity.domain.Tenant; | import com.tuoheng.admin.entity.domain.Tenant; | ||||
import com.tuoheng.admin.entity.vo.AirportLineVo; | |||||
import com.tuoheng.admin.entity.vo.airport.AirportLineVo; | |||||
import com.tuoheng.admin.enums.code.AriportCodeEnum; | import com.tuoheng.admin.enums.code.AriportCodeEnum; | ||||
import com.tuoheng.admin.mapper.TenantMapper; | import com.tuoheng.admin.mapper.TenantMapper; | ||||
import com.tuoheng.admin.utils.CurrentUserUtil; | import com.tuoheng.admin.utils.CurrentUserUtil; | ||||
import com.tuoheng.admin.entity.vo.AirLineVO; | |||||
import com.tuoheng.common.core.config.common.CommonConfig; | import com.tuoheng.common.core.config.common.CommonConfig; | ||||
import com.tuoheng.common.core.exception.ServiceException; | import com.tuoheng.common.core.exception.ServiceException; | ||||
import com.tuoheng.common.core.utils.HttpUtils; | |||||
import com.tuoheng.common.core.utils.JacksonUtil; | |||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; |
package com.tuoheng.admin.service.third.airport; | |||||
import cn.hutool.core.util.ObjectUtil; | |||||
import com.alibaba.fastjson.JSONObject; | |||||
import com.tuoheng.admin.constant.SystemConstant; | |||||
import com.tuoheng.admin.entity.domain.Tenant; | |||||
import com.tuoheng.admin.entity.vo.airport.AirPortStatusVo; | |||||
import com.tuoheng.admin.entity.vo.airport.AirportInfoVo; | |||||
import com.tuoheng.admin.mapper.TenantMapper; | |||||
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.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Qualifier; | |||||
import org.springframework.stereotype.Service; | |||||
import org.springframework.web.client.RestTemplate; | |||||
import org.springframework.web.util.UriComponentsBuilder; | |||||
import java.util.List; | |||||
@Slf4j | |||||
@Service | |||||
public class GetAirportListByAirportIds { | |||||
@Autowired | |||||
private TenantMapper tenantMapper; | |||||
@Autowired | |||||
@Qualifier("restTemplate") | |||||
private RestTemplate restTemplate; | |||||
public List<AirPortStatusVo> getList(String airportIds) { | |||||
String url = UriComponentsBuilder.fromHttpUrl(CommonConfig.airportURL + SystemConstant.API_AIRPORT_STATUS_BY_AIRPORT_ID) | |||||
.queryParam("airportIds", airportIds) | |||||
.toUriString(); | |||||
JsonResult jsonResult; | |||||
try { | |||||
jsonResult = restTemplate.getForObject(url, JsonResult.class); | |||||
} catch (Exception e) { | |||||
log.info("调用机场平台,查询飞行状态异常, url:{}", url); | |||||
return null; | |||||
} | |||||
List<AirPortStatusVo> airPortStatusVOList = JSONObject.parseArray(JSONObject.toJSONString(jsonResult.getData()), AirPortStatusVo.class); | |||||
return airPortStatusVOList; | |||||
} | |||||
public List<AirportInfoVo> getAirportInfo(String airportIds) { | |||||
//读取不同租户的机场平台url | |||||
Tenant tenant = tenantMapper.selectById(CurrentUserUtil.getTenantId()); | |||||
if (ObjectUtil.isEmpty(tenant) && StringUtils.isEmpty(tenant.getCode())) { | |||||
return null; | |||||
} | |||||
String tenantCode = tenant.getCode(); | |||||
String url = UriComponentsBuilder.fromHttpUrl(CommonConfig.airportURL + SystemConstant.API_AIRPORT_MSG_BY_AIRPORT_ID) | |||||
.queryParam("airportIds", airportIds) | |||||
.queryParam("tenantCode", tenantCode) | |||||
.toUriString(); | |||||
JsonResult jsonResult; | |||||
try { | |||||
jsonResult = restTemplate.getForObject(url, JsonResult.class); | |||||
} catch (Exception e) { | |||||
log.info("调用机场平台,查询机场信息异常,url:{}", url); | |||||
return null; | |||||
} | |||||
if (jsonResult.getCode() != 0) { | |||||
log.info("调用机场平台,查询机场信息,失败,jsonResult:{}", jsonResult.getMsg()); | |||||
return null; | |||||
} | |||||
List<AirportInfoVo> airPortStatusVOList = JSONObject.parseArray(JSONObject.toJSONString(jsonResult.getData()), AirportInfoVo.class); | |||||
return airPortStatusVOList; | |||||
} | |||||
} |
<result property="inspectionType" column="inspection_type" /> | <result property="inspectionType" column="inspection_type" /> | ||||
<result property="airportTaskId" column="airport_task_id" /> | <result property="airportTaskId" column="airport_task_id" /> | ||||
<result property="airportId" column="airport_id" /> | <result property="airportId" column="airport_id" /> | ||||
<result property="airportName" column="airport_name" /> | |||||
<result property="droneId" column="drone_id" /> | <result property="droneId" column="drone_id" /> | ||||
<result property="inspectionLine" column="inspection_line" /> | <result property="inspectionLine" column="inspection_line" /> | ||||
<result property="inspectionLineName" column="inspection_line_name" /> | |||||
<result property="equipmentId" column="equipment_id" /> | <result property="equipmentId" column="equipment_id" /> | ||||
<result property="equipmentName" column="equipment_name" /> | <result property="equipmentName" column="equipment_name" /> | ||||
<result property="equipmentMountId" column="equipment_mount_id" /> | <result property="equipmentMountId" column="equipment_mount_id" /> | ||||
<sql id="Base_Column_list"> | <sql id="Base_Column_list"> | ||||
id, tenant_id, code, name, type, inspection_type, | id, tenant_id, code, name, type, inspection_type, | ||||
airport_task_id, airport_id, airport_name, drone_id, inspection_line, inspection_line_name, equipment_id, | |||||
airport_task_id, airport_id, drone_id, inspection_line, equipment_id, | |||||
equipment_name, equipment_mount_id, equipment_mount_type, equipment_mount_code | equipment_name, equipment_mount_id, equipment_mount_type, equipment_mount_code | ||||
equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, | equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, | ||||
execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, | execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, | ||||
<sql id="selectInspectionVo"> | <sql id="selectInspectionVo"> | ||||
select id, tenant_id, code, name, type, inspection_type, | select id, tenant_id, code, name, type, inspection_type, | ||||
airport_task_id, airport_id, airport_name, drone_id, inspection_line, inspection_line_name, equipment_id, equipment_name, equipment_mount_id, | |||||
airport_task_id, airport_id, drone_id, inspection_line, equipment_id, equipment_name, equipment_mount_id, | |||||
equipment_mount_name, equipment_mount_type,equipment_mount_code,cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, | equipment_mount_name, equipment_mount_type,equipment_mount_code,cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, | ||||
execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, | execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, | ||||
status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status, | status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status, | ||||
<if test="inspectionType != null">inspection_type = #{inspectionType},</if> | <if test="inspectionType != null">inspection_type = #{inspectionType},</if> | ||||
<if test="airportTaskId != null">airport_task_id = #{airportTaskId},</if> | <if test="airportTaskId != null">airport_task_id = #{airportTaskId},</if> | ||||
<if test="airportId != null">airport_id = #{airportId},</if> | <if test="airportId != null">airport_id = #{airportId},</if> | ||||
<if test="airportName != null">airport_name = #{airportName},</if> | |||||
<if test="droneId != null"> drone_id = #{droneId},</if> | <if test="droneId != null"> drone_id = #{droneId},</if> | ||||
<if test="inspectionLine != null">inspection_line = #{inspectionLine},</if> | <if test="inspectionLine != null">inspection_line = #{inspectionLine},</if> | ||||
<if test="inspectionLineName != null">inspection_line_name = #{inspectionLineName},</if> | |||||
<if test="equipmentId != null">equipment_id = #{equipmentId},</if> | <if test="equipmentId != null">equipment_id = #{equipmentId},</if> | ||||
<if test="equipmentName != null">equipment_name = #{equipmentName},</if> | <if test="equipmentName != null">equipment_name = #{equipmentName},</if> | ||||
<if test="equipmentMountId != null">equipment_mount_id = #{equipmentMountId},</if> | <if test="equipmentMountId != null">equipment_mount_id = #{equipmentMountId},</if> | ||||
<if test="airportId != null"> | <if test="airportId != null"> | ||||
airport_id = #{airportId}, | airport_id = #{airportId}, | ||||
</if> | </if> | ||||
<if test="airportName != null"> | |||||
airport_name = #{airportName}, | |||||
</if> | |||||
<if test="inspectionLine != null"> | <if test="inspectionLine != null"> | ||||
inspection_line = #{inspectionLine}, | inspection_line = #{inspectionLine}, | ||||
</if> | </if> | ||||
<if test="inspectionLineName != null"> | |||||
inspection_line_name = #{inspectionLineName}, | |||||
</if> | |||||
<if test="progressbar != null"> | <if test="progressbar != null"> | ||||
progressbar = #{progressbar}, | progressbar = #{progressbar}, | ||||
</if> | </if> |