Browse Source

修改飞行航线坐标返回数据

tags/v1.1.0
qiujinyang 2 years ago
parent
commit
a34a051949
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java

+ 10
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java View File

@@ -2,6 +2,7 @@ package com.tuoheng.admin.service.impl;

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.domain.ThInspection;
@@ -108,7 +109,7 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper,
String param="page=1&limit=100&droneId="+droneId;
String airPortStr = HttpUtils.sendGet(url, param);
JsonResult<AirLineVO> jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);
if(ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(jsonResult.getData()) && jsonResult.getCode() != 0)) {
if(ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取航线信息失败,请重试");
}
return JSONObject.parseArray(JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData())).get("records").toString(), AirLineVO.class);
@@ -169,6 +170,14 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper,
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取标准航线信息失败,请重试");
}

JSONArray resultData = JSONArray.parseArray(JSONObject.toJSONString( jsonResult.getData()));
for (Object o : resultData) {
JSONObject jsonObject=(JSONObject)o;
jsonObject.put("lng",jsonObject.getString("lon"));
jsonObject.remove("lon");
}
jsonResult.setData(resultData);

System.out.println(jsonResult.getData().toString());
return jsonResult;
}

Loading…
Cancel
Save