|
@ -45,14 +45,19 @@ public class LuzhouGridPlatformApiService extends ApiService { |
|
|
params.put("appKey", platformKey); |
|
|
params.put("appKey", platformKey); |
|
|
params.put("appSecret", platformSecret); |
|
|
params.put("appSecret", platformSecret); |
|
|
Result<String> result = HttpClientManager.getInstance().sendGet(baseUrl.concat(actionEntity.getApiUrl()), params); |
|
|
Result<String> result = HttpClientManager.getInstance().sendGet(baseUrl.concat(actionEntity.getApiUrl()), params); |
|
|
|
|
|
|
|
|
if (result == null) { |
|
|
if (result == null) { |
|
|
throw new RenException("请求第三方平台,获取AccessToken失败。result为null"); |
|
|
throw new RenException("请求第三方平台,获取AccessToken失败。result为null"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!result.success()) { |
|
|
if (!result.success()) { |
|
|
throw new RenException("请求第三方平台,获取AccessToken失败。"); |
|
|
throw new RenException("请求第三方平台,获取AccessToken失败。"); |
|
|
} |
|
|
} |
|
|
judgeResultSuccess(result.getData()); |
|
|
|
|
|
token = result.getData(); |
|
|
LZGridPlatformBaseResult<String> platformResult = JSON.parseObject(result.getData(), LZGridPlatformBaseResult.class); |
|
|
|
|
|
judgeResultSuccess(platformResult); |
|
|
|
|
|
|
|
|
|
|
|
token = platformResult.getResult(); |
|
|
rt.opsForValue().set(RedisKeys.getThirdPlatformAccessTokenKey(platformId), token); |
|
|
rt.opsForValue().set(RedisKeys.getThirdPlatformAccessTokenKey(platformId), token); |
|
|
} |
|
|
} |
|
|
return token; |
|
|
return token; |
|
@ -63,28 +68,28 @@ public class LuzhouGridPlatformApiService extends ApiService { |
|
|
String platformId = formDTO.getPlatformId(); |
|
|
String platformId = formDTO.getPlatformId(); |
|
|
|
|
|
|
|
|
// 正式调用第三方平台
|
|
|
// 正式调用第三方平台
|
|
|
//String result1 = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, "{}", null);
|
|
|
String argsStr = JSON.toJSONString(formDTO); |
|
|
|
|
|
String result = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, argsStr, null); |
|
|
|
|
|
|
|
|
// 开发阶段临时写死
|
|
|
// 开发阶段临时写死
|
|
|
String result = "{\"eventId\":\"test-task-id\"}"; |
|
|
//String result = "{\"eventId\":\"test-task-id\"}";
|
|
|
ProjectAssistResult projectAssistResult = new ProjectAssistResult(); |
|
|
ProjectAssistResult projectAssistResult = new ProjectAssistResult(); |
|
|
if (!StringUtils.isBlank(result)) { |
|
|
if (!StringUtils.isBlank(result)) { |
|
|
// 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是
|
|
|
// 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是
|
|
|
// 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体,
|
|
|
// 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体,
|
|
|
// 所有apiService都要想办法转化成这个类型。
|
|
|
// 所有apiService都要想办法转化成这个类型。
|
|
|
LZGridPlatformProjectAssistResult lzResult = JSON.parseObject(result, LZGridPlatformProjectAssistResult.class); |
|
|
LZGridPlatformBaseResult<String> lzResult = JSON.parseObject(result, LZGridPlatformBaseResult.class); |
|
|
|
|
|
|
|
|
// 此处设置为第三方系统返回的唯一id
|
|
|
// 此处设置为第三方系统返回的唯一id
|
|
|
projectAssistResult.setTaskId(lzResult.getEventId()); |
|
|
projectAssistResult.setTaskId(lzResult.getResult()); |
|
|
} |
|
|
} |
|
|
System.out.println("泸州网格化平台项目协助发送成功"); |
|
|
System.out.println("泸州网格化平台项目协助发送成功"); |
|
|
return projectAssistResult; |
|
|
return projectAssistResult; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void judgeResultSuccess(String stringData) { |
|
|
public void judgeResultSuccess(LZGridPlatformBaseResult result) { |
|
|
//LZGridPlatformBaseResult;
|
|
|
//LZGridPlatformBaseResult;
|
|
|
LZGridPlatformBaseResult result = JSON.parseObject(stringData, LZGridPlatformBaseResult.class); |
|
|
|
|
|
if (!"200".equalsIgnoreCase(result.getCode())) { |
|
|
if (!"200".equalsIgnoreCase(result.getCode())) { |
|
|
throw new RenException("泸州网格化平台:返回失败结果,错误码:" + result.getCode()); |
|
|
throw new RenException("泸州网格化平台:返回失败结果,错误码:" + result.getCode()); |
|
|
} |
|
|
} |
|
|