|
|
@@ -4,7 +4,9 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.tuoheng.admin.entity.domain.AirData; |
|
|
|
import com.tuoheng.admin.entity.domain.Inspection; |
|
|
|
import com.tuoheng.admin.entity.request.inspection.AirportLineRequest; |
|
|
|
import com.tuoheng.admin.entity.third.LingXiuDataResponse; |
|
|
|
import com.tuoheng.admin.enums.AirportLineEnum; |
|
|
|
import com.tuoheng.admin.enums.InspectionStatusEnum; |
|
|
|
import com.tuoheng.admin.enums.MarkEnum; |
|
|
|
import com.tuoheng.admin.mapper.AirDataMapper; |
|
|
@@ -34,26 +36,17 @@ public class SyncAirDataService { |
|
|
|
|
|
|
|
public JsonResult sync(LingXiuDataResponse response) { |
|
|
|
log.info("收到灵嗅设备推送数据"); |
|
|
|
// if (ObjectUtil.isEmpty(response)) { |
|
|
|
// log.info("灵嗅设备推送数据为空"); |
|
|
|
// return JsonResult.error("灵嗅设备推送数据为空"); |
|
|
|
// } |
|
|
|
// if (StringUtils.isEmpty(response.getSerial())) { |
|
|
|
// log.info("灵嗅设备推送数据,serial为空"); |
|
|
|
// return JsonResult.error("灵嗅设备推送数据,serial为空"); |
|
|
|
// } |
|
|
|
// Inspection inspection = this.getInspection(response.getSerial()); |
|
|
|
// if (ObjectUtil.isNull(inspection)) { |
|
|
|
// log.info("该灵嗅设备没有正在飞行的任务,serial={}", response.getSerial()); |
|
|
|
// return JsonResult.error("该灵嗅设备没有正在飞行的任务"); |
|
|
|
// } |
|
|
|
//校验参数值 |
|
|
|
JsonResult jsonResult = this.check(response); |
|
|
|
if(jsonResult.getCode() != 0){ |
|
|
|
log.info("校验失败:{}",jsonResult.getMsg()); |
|
|
|
return jsonResult; |
|
|
|
} |
|
|
|
Inspection inspection = (Inspection) jsonResult.getData(); |
|
|
|
|
|
|
|
AirData airData = new AirData(); |
|
|
|
|
|
|
|
// if (ObjectUtil.isNotEmpty(inspection)) { |
|
|
|
// airData.setInspectionId(inspection.getId()); // 任务ID |
|
|
|
// airData.setTenantId(inspection.getTenantId()); // 租户ID |
|
|
|
// } |
|
|
|
airData.setInspectionId(inspection.getId()); // 任务ID |
|
|
|
airData.setTenantId(inspection.getTenantId()); // 租户ID |
|
|
|
airData.setSateNum(response.getSateNum()); // 卫星编号 |
|
|
|
airData.setSequence(response.getSequence()); // 序号 |
|
|
|
airData.setSerial(response.getSerial()); // 序列号 |
|
|
@@ -120,7 +113,29 @@ public class SyncAirDataService { |
|
|
|
|
|
|
|
Integer count = airDataMapper.insert(airData); |
|
|
|
if (count <= 0) { |
|
|
|
log.info("灵嗅设备推送数据插入失败"); |
|
|
|
log.info("拉取灵嗅设备推送数据,插入失败"); |
|
|
|
} |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @param response |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private JsonResult check(LingXiuDataResponse response) { |
|
|
|
if (ObjectUtil.isEmpty(response)) { |
|
|
|
log.info("灵嗅设备推送数据为空"); |
|
|
|
return JsonResult.error("灵嗅设备推送数据为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isEmpty(response.getSerial())) { |
|
|
|
log.info("灵嗅设备推送数据,serial为空"); |
|
|
|
return JsonResult.error("灵嗅设备推送数据,serial为空"); |
|
|
|
} |
|
|
|
Inspection inspection = this.getInspection(response.getSerial()); |
|
|
|
if (ObjectUtil.isNull(inspection)) { |
|
|
|
log.info("没有正在飞行的任务,serial={}", response.getSerial()); |
|
|
|
return JsonResult.error("没有正在飞行的任务"); |
|
|
|
} |
|
|
|
return JsonResult.success(); |
|
|
|
} |