|
|
@@ -109,8 +109,21 @@ public class CallTianYiPlatformService { |
|
|
|
headers.setContentType(MediaType.APPLICATION_JSON); |
|
|
|
HttpEntity httpEntity = new HttpEntity(request, headers); |
|
|
|
String url = TZHLConfig.tzhlURL + TZHLConstant.TIAN_YI_API_TICKET_LOGIN; |
|
|
|
String dataJson = this.callGet(url, httpEntity); |
|
|
|
tokenResponse = JSONObject.parseObject(dataJson, TZHLTokenResponse.class); |
|
|
|
ResponseEntity<TZHLTokenResponse> response; |
|
|
|
try { |
|
|
|
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, TZHLTokenResponse.class); |
|
|
|
} catch (Exception e) { |
|
|
|
log.info("泰州海陵区城管,获取token接口异常, url:{}", url); |
|
|
|
log.info("泰州海陵区城管,获取token接口异常, httpEntity:{}", httpEntity); |
|
|
|
throw new ServiceException("南京海事局,获取token接口异常"); |
|
|
|
} |
|
|
|
if (null == response || !response.hasBody()) { |
|
|
|
log.info("泰州海陵区城管,获取token接口失败,response为空"); |
|
|
|
log.info("泰州海陵区城管,获取token接口失败, url:{}", url); |
|
|
|
log.info("泰州海陵区城管,获取token接口失败, httpEntity:{}", httpEntity); |
|
|
|
throw new ServiceException("泰州海陵区城管,获取token接口失败"); |
|
|
|
} |
|
|
|
tokenResponse = JSONObject.parseObject(JSONObject.toJSONString(response.getBody()), TZHLTokenResponse.class); |
|
|
|
if (!TZHLConstant.RESPONSE_SUCCESS_CODE.equals(tokenResponse.getCode())) { |
|
|
|
log.error("泰州海陵区城管,获取token接口失败,{}", tokenResponse); |
|
|
|
throw new ServiceException("泰州海陵区城管,获取token接口失败"); |