@@ -41,8 +41,10 @@ public class CallTianYiPlatformService { | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.add("Authorization", properties); | |||
HttpEntity<Object> httpEntity = new HttpEntity<>(request, headers); | |||
log.info("泰州海陵区城管,url:{}", url); | |||
log.info("泰州海陵区城管,request:{}", request); | |||
HttpEntity<Object> httpEntity = new HttpEntity<>(request, headers); | |||
ResponseEntity<JsonResult> response; | |||
try { | |||
response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JsonResult.class); | |||
@@ -64,6 +66,9 @@ public class CallTianYiPlatformService { | |||
log.info("泰州海陵区城管,接口返回失败, request:{}", request); | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "泰州海陵区城管,接口返回失败"); | |||
} | |||
log.info("泰州海陵区城管,接口返回, response={}", response); | |||
return JSONObject.toJSONString(response.getBody().getData()); | |||
} | |||
@@ -104,6 +109,9 @@ public class CallTianYiPlatformService { | |||
log.info("泰州海陵区城管,接口返回失败, request:{}", request); | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "泰州海陵区城管,接口返回失败"); | |||
} | |||
log.info("泰州海陵区城管,接口返回, response={}", response); | |||
return JSONObject.toJSONString(response.getBody().getData()); | |||
} | |||
@@ -43,7 +43,7 @@ public class FlyLogBySuccessService { | |||
TZHLOnlineUavResponse tzhlOnlineUavResponse = onlineUavService.getOnlineUav(); | |||
if (ObjectUtil.isEmpty(tzhlOnlineUavResponse)) { | |||
log.info("泰州海陵区城管,执行任务,获取推流地址失败"); | |||
log.info("泰州海陵区城管,执行任务,获取推流地址失败,inspectionId={}", inspection.getId()); | |||
return; | |||
} | |||
@@ -1,5 +1,6 @@ | |||
package com.tuoheng.admin.tzhl.service.fly.onlineuav; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.tzhl.constant.TZHLConstant; | |||
@@ -8,6 +9,7 @@ import com.tuoheng.admin.tzhl.response.TZHLFlyDataResponse; | |||
import com.tuoheng.admin.tzhl.response.TZHLOnlineUavResponse; | |||
import com.tuoheng.admin.tzhl.service.CallTianYiPlatformService; | |||
import com.tuoheng.common.core.utils.RedisUtils; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Qualifier; | |||
@@ -34,7 +36,13 @@ public class OnlineUavService { | |||
public TZHLOnlineUavResponse getOnlineUav() { | |||
String apiPath = TZHLConstant.TIAN_YI_API_FLIGHT_SCREEN; | |||
String dataJson = callTianYiPlatformService.callGet(apiPath, null); | |||
if (StringUtils.isEmpty(dataJson)) { | |||
return null; | |||
} | |||
TZHLOnlineUavResponse onlineUavResponse = JSON.parseObject(dataJson, TZHLOnlineUavResponse.class); | |||
if (ObjectUtil.isEmpty(onlineUavResponse)) { | |||
return null; | |||
} | |||
return onlineUavResponse; | |||
} | |||