Преглед изворни кода

修改dsp回调接口中获取问题经纬度

tags/v1.3.1
chengwang пре 1 година
родитељ
комит
eee2417c85
1 измењених фајлова са 19 додато и 19 уклоњено
  1. +19
    -19
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java

+ 19
- 19
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java Прегледај датотеку

@Autowired @Autowired
private NoticeWeChatMiniProgramService noticeWeChatMiniProgramService; private NoticeWeChatMiniProgramService noticeWeChatMiniProgramService;


@Autowired
private FlightDataHlMapper flightDataHlMapper;



/** /**
* 保存DSP回调数据 * 保存DSP回调数据
boolean online_condition = AiAnalyseTypeEnum.ONLINE.getCode() == inspection.getIsLive(); boolean online_condition = AiAnalyseTypeEnum.ONLINE.getCode() == inspection.getIsLive();
boolean offline_condition = AiAnalyseTypeEnum.OFFLINE.getCode() == inspection.getIsLive(); boolean offline_condition = AiAnalyseTypeEnum.OFFLINE.getCode() == inspection.getIsLive();
log.info("在线:{}, 离线:{}", online_condition, offline_condition); 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 -> { List<InspectionFile> thirstyQuestionFiles = questionFiles.stream().map(questionFile -> {
// 遍历创建巡检图片信息 // 遍历创建巡检图片信息
int second = Integer.parseInt(startFrame) / 25; int second = Integer.parseInt(startFrame) / 25;
// 解决离线视频分析的问题都是一个坐标问题 // 解决离线视频分析的问题都是一个坐标问题
// long shootTime = inspection.getExecutionStartTime().getTime() + second; // 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)) { if (ObjectUtil.isNotNull(flightData_off)) {
inspectionFile.setLongitude(flightData_off.getLng()); inspectionFile.setLongitude(flightData_off.getLng());
inspectionFile.setLatitude(flightData_off.getLat()); inspectionFile.setLatitude(flightData_off.getLat());
// 实时直播处理 // 实时直播处理
log.info("实时直播坐标分析处理..."); log.info("实时直播坐标分析处理...");
// long time = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, questionFile.getAnalyseTime()).getTime(); // 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)); log.info("实时坐标:{}", JacksonUtil.obj2StringPretty(flightData_live));
if (ObjectUtil.isNotNull(flightData_live)) { if (ObjectUtil.isNotNull(flightData_live)) {
inspectionFile.setLatitude(flightData_live.getLat()); inspectionFile.setLatitude(flightData_live.getLat());
/** /**
* 获取飞行坐标 * 获取飞行坐标
* *
* @param flightDataList 飞行坐标集合
* @param flightDataHlList 飞行坐标集合
* @param time 当前时间 * @param time 当前时间
* @return 当前飞行对象 * @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(), "获取无人机飞行坐标失败!"); throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!");
} }
List<FlightData> flightData = flightDataList.stream().filter(data -> {
List<FlightDataHl> flightDataHls = flightDataHlList.stream().filter(data -> {
try { try {
return Long.valueOf(data.getTimestamp()) <= time;
return Long.valueOf(data.getTime()) <= time;
} catch (Exception e) { } catch (Exception e) {
log.error("获取飞行数据异常:", e); log.error("获取飞行数据异常:", e);
log.error("批量插入问题图片数据:{}", JacksonUtil.obj2StringPretty(data)); log.error("批量插入问题图片数据:{}", JacksonUtil.obj2StringPretty(data));
return false; return false;
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (CollectionUtil.isEmpty(flightData)) {
if (CollectionUtil.isEmpty(flightDataHls)) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!"); throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!");
} }
return flightData.get(0);
return flightDataHls.get(0);
} }


} }

Loading…
Откажи
Сачувај