Browse Source

批量插入飞行数据

tags/v1.3.1
chengwang 1 year ago
parent
commit
b91413ef34
1 changed files with 15 additions and 14 deletions
  1. +15
    -14
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateWaittStatusService.java

+ 15
- 14
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateWaittStatusService.java View File

import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.constant.SystemConstant; import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.FlightData; import com.tuoheng.admin.entity.FlightData;
import com.tuoheng.admin.entity.FlightDataHl;
import com.tuoheng.admin.entity.Inspection; import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.Report; import com.tuoheng.admin.entity.Report;
import com.tuoheng.admin.enums.MarkEnum; import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.TaskStatusEnum; import com.tuoheng.admin.enums.TaskStatusEnum;
import com.tuoheng.admin.enums.code.inspection.EditInspectionStatusCodeEnum; import com.tuoheng.admin.enums.code.inspection.EditInspectionStatusCodeEnum;
import com.tuoheng.admin.mapper.FlightDataMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.ReportMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.service.third.dsp.IDspService; import com.tuoheng.admin.service.third.dsp.IDspService;
import com.tuoheng.admin.utils.AirWeatherUtil; import com.tuoheng.admin.utils.AirWeatherUtil;
import com.tuoheng.admin.vo.AirWeatherVO; import com.tuoheng.admin.vo.AirWeatherVO;
@Autowired @Autowired
private FlightDataMapper flightDataMapper; private FlightDataMapper flightDataMapper;


@Autowired
private FlightDataHlMapper flightDataHlMapper;

@Autowired @Autowired
private ReportMapper reportMapper; private ReportMapper reportMapper;


log.info("修改任务状态业务接口:获取天气信息:weatherStr={}", weatherStr); log.info("修改任务状态业务接口:获取天气信息:weatherStr={}", weatherStr);
inspectionUpdate.setWeather(weatherStr); inspectionUpdate.setWeather(weatherStr);


Integer flightDataCount = flightDataMapper.selectCount(new LambdaQueryWrapper<FlightData>()
.eq(FlightData::getInspectionId, inspection.getId())
.eq(FlightData::getTenantId, inspection.getTenantId())
.eq(FlightData::getMark, MarkEnum.VALID.getCode()));
Integer flightDataCount = flightDataHlMapper.selectCount(new LambdaQueryWrapper<FlightDataHl>()
.eq(FlightDataHl::getInspectionId, inspection.getId())
.eq(FlightDataHl::getTenantId, inspection.getTenantId())
.eq(FlightDataHl::getMark, MarkEnum.VALID.getCode()));
log.info("坐标数据,flightDataCount:{}", flightDataCount); log.info("坐标数据,flightDataCount:{}", flightDataCount);
if (flightDataCount > 0) { if (flightDataCount > 0) {
int index = (int) Math.ceil((double) flightDataCount / 2); int index = (int) Math.ceil((double) flightDataCount / 2);
FlightData flightData = flightDataMapper.selectOne(new LambdaQueryWrapper<FlightData>()
.eq(FlightData::getInspectionId, inspection.getId())
.eq(FlightData::getTenantId, inspection.getTenantId())
.eq(FlightData::getMark, MarkEnum.VALID.getCode())
.orderByDesc(FlightData::getTimestamp)
FlightDataHl flightData = flightDataHlMapper.selectOne(new LambdaQueryWrapper<FlightDataHl>()
.eq(FlightDataHl::getInspectionId, inspection.getId())
.eq(FlightDataHl::getTenantId, inspection.getTenantId())
.eq(FlightDataHl::getMark, MarkEnum.VALID.getCode())
.orderByDesc(FlightDataHl::getTime)
.last("limit " + index + ",1")); .last("limit " + index + ",1"));
if (ObjectUtil.isNotNull(flightData)) { if (ObjectUtil.isNotNull(flightData)) {
inspectionUpdate.setFlyHeight(flightData.getUltrasonic());
inspectionUpdate.setFlyHeight(flightData.getAlt());
} }
} }



Loading…
Cancel
Save