|
@@ -9,12 +9,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
import com.ningdatech.irs.service.IRefreshTokenService; |
|
|
import com.ningdatech.irs.service.IRefreshTokenService; |
|
|
import com.ningdatech.pmapi.common.enumeration.CommonEnum; |
|
|
import com.ningdatech.pmapi.common.enumeration.CommonEnum; |
|
|
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; |
|
|
|
|
|
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; |
|
|
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; |
|
|
import com.ningdatech.pmapi.common.util.CryptUtils; |
|
|
import com.ningdatech.pmapi.common.util.CryptUtils; |
|
|
import com.ningdatech.pmapi.common.util.HttpUtil; |
|
|
import com.ningdatech.pmapi.common.util.HttpUtil; |
|
|
import com.ningdatech.pmapi.common.util.RefreshKeyUtil; |
|
|
import com.ningdatech.pmapi.common.util.RefreshKeyUtil; |
|
|
import com.ningdatech.pmapi.irs.model.dto.*; |
|
|
|
|
|
|
|
|
import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult; |
|
|
|
|
|
import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; |
|
|
import com.ningdatech.pmapi.irs.model.res.ApiResponse; |
|
|
import com.ningdatech.pmapi.irs.model.res.ApiResponse; |
|
|
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; |
|
|
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
@@ -34,7 +35,6 @@ import org.springframework.web.client.RestTemplate; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.security.NoSuchAlgorithmException; |
|
|
import java.security.NoSuchAlgorithmException; |
|
|
import java.time.LocalDateTime; |
|
|
import java.time.LocalDateTime; |
|
|
import java.util.Collections; |
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Objects; |
|
|
import java.util.Objects; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
@@ -93,8 +93,23 @@ public class AppIrsManage { |
|
|
@Value("${irs.push-project-detail.appSecret}") |
|
|
@Value("${irs.push-project-detail.appSecret}") |
|
|
private String pushProjectAppSecret; |
|
|
private String pushProjectAppSecret; |
|
|
|
|
|
|
|
|
|
|
|
//=============数字资源指标获取======================================================================================== |
|
|
|
|
|
|
|
|
|
|
|
@Value("${irs.digital-resource-indicators.app-key}") |
|
|
|
|
|
private String driAppKey; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${irs.digital-resource-indicators.app-secret}") |
|
|
|
|
|
private String driAppSecret; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${irs.digital-resource-indicators.interface-name}") |
|
|
|
|
|
private String driInterfaceName; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${irs.digital-resource-indicators.url}") |
|
|
|
|
|
private String driUrl; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 推送 项目和应用关系 |
|
|
* 推送 项目和应用关系 |
|
|
|
|
|
* |
|
|
* @param dto |
|
|
* @param dto |
|
|
* @return |
|
|
* @return |
|
|
* @throws NoSuchAlgorithmException |
|
|
* @throws NoSuchAlgorithmException |
|
@@ -112,14 +127,14 @@ public class AppIrsManage { |
|
|
ApiApplyDTO apiApply = new ApiApplyDTO(); |
|
|
ApiApplyDTO apiApply = new ApiApplyDTO(); |
|
|
apiApply.setAppId(appCode); |
|
|
apiApply.setAppId(appCode); |
|
|
JSONObject jsonObject = this.searchApp(apiApply); |
|
|
JSONObject jsonObject = this.searchApp(apiApply); |
|
|
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject),ApiApplySearchResult.class); |
|
|
|
|
|
|
|
|
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject), ApiApplySearchResult.class); |
|
|
VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!"); |
|
|
VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!"); |
|
|
|
|
|
|
|
|
long timestamp = System.currentTimeMillis(); |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
String areaCode = project.getAreaCode(); |
|
|
String areaCode = project.getAreaCode(); |
|
|
String projectName = project.getProjectName(); |
|
|
String projectName = project.getProjectName(); |
|
|
String requestSecret = RefreshKeyUtil.getRequestSecret(pushAppKey, pushAppScret); |
|
|
String requestSecret = RefreshKeyUtil.getRequestSecret(pushAppKey, pushAppScret); |
|
|
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode,"bcb4fc0f517fc168ee543fcf4d231f3b"); |
|
|
|
|
|
|
|
|
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); |
|
|
String capTime = String.valueOf(timestamp); |
|
|
String capTime = String.valueOf(timestamp); |
|
|
String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp); |
|
|
String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp); |
|
|
String url = pushUrl + "?requestTime=" + timestamp + |
|
|
String url = pushUrl + "?requestTime=" + timestamp + |
|
@@ -134,14 +149,14 @@ public class AppIrsManage { |
|
|
|
|
|
|
|
|
ApiResponse body = forEntity.getBody(); |
|
|
ApiResponse body = forEntity.getBody(); |
|
|
|
|
|
|
|
|
if(Objects.isNull(body) || Objects.isNull(body.getCode()) |
|
|
|
|
|
|| 0 != body.getCode()){ |
|
|
|
|
|
|
|
|
if (Objects.isNull(body) || Objects.isNull(body.getCode()) |
|
|
|
|
|
|| 0 != body.getCode()) { |
|
|
return Boolean.FALSE; |
|
|
return Boolean.FALSE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//保存关系 |
|
|
//保存关系 |
|
|
app.setAppCode(appCode); |
|
|
app.setAppCode(appCode); |
|
|
if(applicationService.updateById(app)){ |
|
|
|
|
|
|
|
|
if (applicationService.updateById(app)) { |
|
|
/** |
|
|
/** |
|
|
* 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册 |
|
|
* 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册 |
|
|
* 如果都已经注册 要调用状态机 进入下一个状态 |
|
|
* 如果都已经注册 要调用状态机 进入下一个状态 |
|
@@ -150,8 +165,8 @@ public class AppIrsManage { |
|
|
.eq(ProjectApplication::getProjectId, project.getId())); |
|
|
.eq(ProjectApplication::getProjectId, project.getId())); |
|
|
//筛选出 初次新建的app 但是没有appCode的 |
|
|
//筛选出 初次新建的app 但是没有appCode的 |
|
|
apps = apps.stream().filter(a -> { |
|
|
apps = apps.stream().filter(a -> { |
|
|
if(CommonEnum.YES.getCode().equals(a.getIsFirst()) && |
|
|
|
|
|
StringUtils.isBlank(app.getAppCode())){ |
|
|
|
|
|
|
|
|
if (CommonEnum.YES.getCode().equals(a.getIsFirst()) && |
|
|
|
|
|
StringUtils.isBlank(app.getAppCode())) { |
|
|
return Boolean.TRUE; |
|
|
return Boolean.TRUE; |
|
|
} |
|
|
} |
|
|
return Boolean.FALSE; |
|
|
return Boolean.FALSE; |
|
@@ -159,7 +174,7 @@ public class AppIrsManage { |
|
|
.collect(Collectors.toList()); |
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
//如果筛选出来的 为空的话 就调用状态机 |
|
|
//如果筛选出来的 为空的话 就调用状态机 |
|
|
if(CollUtil.isEmpty(apps)){ |
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(apps)) { |
|
|
stateMachineUtils.pass(project); |
|
|
stateMachineUtils.pass(project); |
|
|
project.setUpdateOn(LocalDateTime.now()); |
|
|
project.setUpdateOn(LocalDateTime.now()); |
|
|
projectService.updateById(project); |
|
|
projectService.updateById(project); |
|
@@ -171,6 +186,7 @@ public class AppIrsManage { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询app |
|
|
* 查询app |
|
|
|
|
|
* |
|
|
* @param apply |
|
|
* @param apply |
|
|
* @return |
|
|
* @return |
|
|
* @throws NoSuchAlgorithmException |
|
|
* @throws NoSuchAlgorithmException |
|
@@ -184,27 +200,27 @@ public class AppIrsManage { |
|
|
"&appKey=" + searchAppKey + "&" + |
|
|
"&appKey=" + searchAppKey + "&" + |
|
|
"pageSize=10&pageNum=1&appCode=" + appCode + |
|
|
"pageSize=10&pageNum=1&appCode=" + appCode + |
|
|
"&areaCode=&deptCode=&name="; |
|
|
"&areaCode=&deptCode=&name="; |
|
|
log.info("url : {}",url); |
|
|
|
|
|
|
|
|
log.info("url : {}", url); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
|
|
|
|
|
|
log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); |
|
|
|
|
|
|
|
|
log.info("查询应用目录 : {}", JSON.toJSONString(forEntity)); |
|
|
|
|
|
|
|
|
if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())) { |
|
|
JSONObject body = JSON.parseObject(forEntity.getBody()); |
|
|
JSONObject body = JSON.parseObject(forEntity.getBody()); |
|
|
if(Objects.isNull(body)){ |
|
|
|
|
|
|
|
|
if (Objects.isNull(body)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
JSONObject datas = body.getJSONObject("datas"); |
|
|
JSONObject datas = body.getJSONObject("datas"); |
|
|
if(Objects.isNull(datas)){ |
|
|
|
|
|
|
|
|
if (Objects.isNull(datas)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
JSONObject data = datas.getJSONObject("data"); |
|
|
JSONObject data = datas.getJSONObject("data"); |
|
|
if(Objects.isNull(data)){ |
|
|
|
|
|
|
|
|
if (Objects.isNull(data)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); |
|
|
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); |
|
|
if(CollUtil.isEmpty(apiApplySearchResult)){ |
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(apiApplySearchResult)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
return apiApplySearchResult.getJSONObject(0); |
|
|
return apiApplySearchResult.getJSONObject(0); |
|
@@ -225,19 +241,19 @@ public class AppIrsManage { |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
|
|
|
|
|
|
log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); |
|
|
|
|
|
|
|
|
log.info("查询应用目录 : {}", JSON.toJSONString(forEntity)); |
|
|
|
|
|
|
|
|
if(Objects.nonNull(forEntity.getBody())){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(forEntity.getBody())) { |
|
|
JSONObject body = JSON.parseObject(forEntity.getBody()); |
|
|
JSONObject body = JSON.parseObject(forEntity.getBody()); |
|
|
if(Objects.isNull(body)){ |
|
|
|
|
|
|
|
|
if (Objects.isNull(body)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
JSONObject datas = body.getJSONObject("datas"); |
|
|
JSONObject datas = body.getJSONObject("datas"); |
|
|
if(Objects.isNull(datas)){ |
|
|
|
|
|
|
|
|
if (Objects.isNull(datas)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
JSONObject data = datas.getJSONObject("data"); |
|
|
JSONObject data = datas.getJSONObject("data"); |
|
|
if(Objects.isNull(data)){ |
|
|
|
|
|
|
|
|
if (Objects.isNull(data)) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); |
|
|
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); |
|
@@ -252,14 +268,14 @@ public class AppIrsManage { |
|
|
String appKey = "A331101453557202109017383"; |
|
|
String appKey = "A331101453557202109017383"; |
|
|
String method = "POST"; |
|
|
String method = "POST"; |
|
|
String interfaceName = "5crv7i4727abLCv0"; |
|
|
String interfaceName = "5crv7i4727abLCv0"; |
|
|
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method); |
|
|
|
|
|
log.info("secret :{}",secret); |
|
|
|
|
|
|
|
|
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method); |
|
|
|
|
|
log.info("secret :{}", secret); |
|
|
String sign = MD5.create().digestHex(appKey + secret + timestamp); |
|
|
String sign = MD5.create().digestHex(appKey + secret + timestamp); |
|
|
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); |
|
|
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); |
|
|
RestTemplate restTemplate; |
|
|
RestTemplate restTemplate; |
|
|
if(Objects.nonNull(factory)){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(factory)) { |
|
|
restTemplate = new RestTemplate(factory); |
|
|
restTemplate = new RestTemplate(factory); |
|
|
}else{ |
|
|
|
|
|
|
|
|
} else { |
|
|
restTemplate = new RestTemplate(); |
|
|
restTemplate = new RestTemplate(); |
|
|
} |
|
|
} |
|
|
String appId = "A330000100000202105005790"; |
|
|
String appId = "A330000100000202105005790"; |
|
@@ -269,7 +285,7 @@ public class AppIrsManage { |
|
|
"&sign=" + sign + "&appKey=" + appKey + |
|
|
"&sign=" + sign + "&appKey=" + appKey + |
|
|
"&capCode=" + capCode + "&capTime=" + timestamp + |
|
|
"&capCode=" + capCode + "&capTime=" + timestamp + |
|
|
"&appId=" + appId; |
|
|
"&appId=" + appId; |
|
|
log.info("url :{}",url); |
|
|
|
|
|
|
|
|
log.info("url :{}", url); |
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
log.info(forEntity.getBody()); |
|
|
log.info(forEntity.getBody()); |
|
|
return forEntity.getBody(); |
|
|
return forEntity.getBody(); |
|
@@ -277,6 +293,7 @@ public class AppIrsManage { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 推送项目详情 |
|
|
* 推送项目详情 |
|
|
|
|
|
* |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
public String pushProjectDetail(ProjectDTO projectDto) { |
|
|
public String pushProjectDetail(ProjectDTO projectDto) { |
|
@@ -285,14 +302,14 @@ public class AppIrsManage { |
|
|
String appKey = pushProjectAppKey; |
|
|
String appKey = pushProjectAppKey; |
|
|
String method = HttpMethod.POST.name(); |
|
|
String method = HttpMethod.POST.name(); |
|
|
String interfaceName = pushProjectInterfaceName; |
|
|
String interfaceName = pushProjectInterfaceName; |
|
|
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method); |
|
|
|
|
|
log.info("secret :{}",secret); |
|
|
|
|
|
|
|
|
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method); |
|
|
|
|
|
log.info("secret :{}", secret); |
|
|
String sign = MD5.create().digestHex(appKey + secret + timestamp); |
|
|
String sign = MD5.create().digestHex(appKey + secret + timestamp); |
|
|
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); |
|
|
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); |
|
|
RestTemplate restTemplate; |
|
|
RestTemplate restTemplate; |
|
|
if(Objects.nonNull(factory)){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(factory)) { |
|
|
restTemplate = new RestTemplate(factory); |
|
|
restTemplate = new RestTemplate(factory); |
|
|
}else{ |
|
|
|
|
|
|
|
|
} else { |
|
|
restTemplate = new RestTemplate(); |
|
|
restTemplate = new RestTemplate(); |
|
|
} |
|
|
} |
|
|
String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海" |
|
|
String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海" |
|
@@ -318,13 +335,13 @@ public class AppIrsManage { |
|
|
String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32"; |
|
|
String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32"; |
|
|
String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; |
|
|
String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; |
|
|
String capCode = null; |
|
|
String capCode = null; |
|
|
try{ |
|
|
|
|
|
|
|
|
try { |
|
|
capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); |
|
|
capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); |
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
log.error(e.getMessage()); |
|
|
log.error(e.getMessage()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
String url = pushProjectUrl+ "?" + |
|
|
|
|
|
|
|
|
String url = pushProjectUrl + "?" + |
|
|
"requestTime=" + timestamp + "&sign=" + sign + |
|
|
"requestTime=" + timestamp + "&sign=" + sign + |
|
|
"&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + |
|
|
"&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + |
|
|
"&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId + |
|
|
"&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId + |
|
@@ -337,9 +354,36 @@ public class AppIrsManage { |
|
|
"&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing + |
|
|
"&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing + |
|
|
"&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish + |
|
|
"&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish + |
|
|
"&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName; |
|
|
"&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName; |
|
|
log.info("url :{}",url); |
|
|
|
|
|
|
|
|
log.info("url :{}", url); |
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
log.info(forEntity.getBody()); |
|
|
log.info(forEntity.getBody()); |
|
|
return forEntity.getBody(); |
|
|
return forEntity.getBody(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JSONObject getDigitalResourceIndicatorsByAppCode(String appCode) { |
|
|
|
|
|
long timestamp = System.currentTimeMillis(); |
|
|
|
|
|
String appSecret = driAppSecret; |
|
|
|
|
|
String appKey = driAppKey; |
|
|
|
|
|
String method = HttpMethod.POST.name(); |
|
|
|
|
|
String interfaceName = driInterfaceName; |
|
|
|
|
|
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method); |
|
|
|
|
|
log.info("secret : {}", secret); |
|
|
|
|
|
String sign = MD5.create().digestHex(appKey + secret + timestamp); |
|
|
|
|
|
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); |
|
|
|
|
|
RestTemplate restTemplate; |
|
|
|
|
|
if (Objects.nonNull(factory)) { |
|
|
|
|
|
restTemplate = new RestTemplate(factory); |
|
|
|
|
|
} else { |
|
|
|
|
|
restTemplate = new RestTemplate(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String url = driUrl + "?" + |
|
|
|
|
|
"requestTime=" + timestamp + "&sign=" + sign + |
|
|
|
|
|
"&appKey=" + appKey + "&appCode=" + appCode; |
|
|
|
|
|
log.info("url :{}", url); |
|
|
|
|
|
ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class); |
|
|
|
|
|
log.info(Objects.requireNonNull(forEntity.getBody()).toJSONString()); |
|
|
|
|
|
return forEntity.getBody(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |