|
|
@@ -79,6 +79,9 @@ public class DspCallbackServiceImpl implements IDspCallbackService { |
|
|
|
@Autowired |
|
|
|
private NoticeWeChatMiniProgramService noticeWeChatMiniProgramService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private FlightDataHlMapper flightDataHlMapper; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 保存DSP回调数据 |
|
|
@@ -176,15 +179,12 @@ public class DspCallbackServiceImpl implements IDspCallbackService { |
|
|
|
boolean online_condition = AiAnalyseTypeEnum.ONLINE.getCode() == inspection.getIsLive(); |
|
|
|
boolean offline_condition = AiAnalyseTypeEnum.OFFLINE.getCode() == inspection.getIsLive(); |
|
|
|
log.info("在线:{}, 离线:{}", online_condition, offline_condition); |
|
|
|
List<FlightData> flightDataList = flightDataMapper.selectList(new LambdaQueryWrapper<FlightData>() |
|
|
|
.eq(FlightData::getInspectionId, business.getTypeId()) |
|
|
|
.notLike(online_condition, FlightData::getLng, "E-") |
|
|
|
.notLike(online_condition, FlightData::getLng, "0.0") |
|
|
|
.notLike(online_condition, FlightData::getLat, "E-") |
|
|
|
.notLike(online_condition, FlightData::getLat, "0.0") |
|
|
|
.orderByDesc(FlightData::getTimestamp)); |
|
|
|
if (!CollectionUtil.isEmpty(flightDataList)) { |
|
|
|
log.info("飞行坐标大小:{}", flightDataList.size()); |
|
|
|
List<FlightDataHl> flightDataHlList = flightDataHlMapper.selectList(new LambdaQueryWrapper<FlightDataHl>() |
|
|
|
.eq(FlightDataHl::getInspectionId, business.getTypeId()) |
|
|
|
.orderByDesc(FlightDataHl::getTime)); |
|
|
|
|
|
|
|
if (!CollectionUtil.isEmpty(flightDataHlList)) { |
|
|
|
log.info("飞行坐标大小:{}", flightDataHlList.size()); |
|
|
|
} |
|
|
|
List<InspectionFile> thirstyQuestionFiles = questionFiles.stream().map(questionFile -> { |
|
|
|
// 遍历创建巡检图片信息 |
|
|
@@ -249,8 +249,8 @@ public class DspCallbackServiceImpl implements IDspCallbackService { |
|
|
|
int second = Integer.parseInt(startFrame) / 25; |
|
|
|
// 解决离线视频分析的问题都是一个坐标问题 |
|
|
|
// long shootTime = inspection.getExecutionStartTime().getTime() + second; |
|
|
|
long shootTime = Long.parseLong(flightDataList.get(flightDataList.size() - 1).getTimestamp()) + second * 1000; |
|
|
|
FlightData flightData_off = getFlightDataByTime(flightDataList, shootTime); |
|
|
|
long shootTime = flightDataHlList.get(flightDataHlList.size() - 1).getTime() + second * 1000; |
|
|
|
FlightDataHl flightData_off = getFlightDataByTime(flightDataHlList, shootTime); |
|
|
|
if (ObjectUtil.isNotNull(flightData_off)) { |
|
|
|
inspectionFile.setLongitude(flightData_off.getLng()); |
|
|
|
inspectionFile.setLatitude(flightData_off.getLat()); |
|
|
@@ -270,7 +270,7 @@ public class DspCallbackServiceImpl implements IDspCallbackService { |
|
|
|
// 实时直播处理 |
|
|
|
log.info("实时直播坐标分析处理..."); |
|
|
|
// long time = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, questionFile.getAnalyseTime()).getTime(); |
|
|
|
FlightData flightData_live = getFlightDataByTime(flightDataList, questionFile.getAnalyseTime().getTime()); |
|
|
|
FlightDataHl flightData_live = getFlightDataByTime(flightDataHlList, questionFile.getAnalyseTime().getTime()); |
|
|
|
log.info("实时坐标:{}", JacksonUtil.obj2StringPretty(flightData_live)); |
|
|
|
if (ObjectUtil.isNotNull(flightData_live)) { |
|
|
|
inspectionFile.setLatitude(flightData_live.getLat()); |
|
|
@@ -358,27 +358,27 @@ public class DspCallbackServiceImpl implements IDspCallbackService { |
|
|
|
/** |
|
|
|
* 获取飞行坐标 |
|
|
|
* |
|
|
|
* @param flightDataList 飞行坐标集合 |
|
|
|
* @param flightDataHlList 飞行坐标集合 |
|
|
|
* @param time 当前时间 |
|
|
|
* @return 当前飞行对象 |
|
|
|
*/ |
|
|
|
private FlightData getFlightDataByTime(List<FlightData> flightDataList, long time) { |
|
|
|
if (CollectionUtil.isEmpty(flightDataList)) { |
|
|
|
private FlightDataHl getFlightDataByTime(List<FlightDataHl> flightDataHlList, long time) { |
|
|
|
if (CollectionUtil.isEmpty(flightDataHlList)) { |
|
|
|
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!"); |
|
|
|
} |
|
|
|
List<FlightData> flightData = flightDataList.stream().filter(data -> { |
|
|
|
List<FlightDataHl> flightDataHls = flightDataHlList.stream().filter(data -> { |
|
|
|
try { |
|
|
|
return Long.valueOf(data.getTimestamp()) <= time; |
|
|
|
return Long.valueOf(data.getTime()) <= time; |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("获取飞行数据异常:", e); |
|
|
|
log.error("批量插入问题图片数据:{}", JacksonUtil.obj2StringPretty(data)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
if (CollectionUtil.isEmpty(flightData)) { |
|
|
|
if (CollectionUtil.isEmpty(flightDataHls)) { |
|
|
|
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!"); |
|
|
|
} |
|
|
|
return flightData.get(0); |
|
|
|
return flightDataHls.get(0); |
|
|
|
} |
|
|
|
|
|
|
|
} |