|
@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.ding.controller; |
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.crypto.SecureUtil; |
|
|
import cn.hutool.crypto.SecureUtil; |
|
|
|
|
|
import cn.hutool.crypto.digest.MD5; |
|
|
import com.google.common.collect.Maps; |
|
|
import com.google.common.collect.Maps; |
|
|
import com.ningdatech.irs.service.IRefreshTokenService; |
|
|
import com.ningdatech.irs.service.IRefreshTokenService; |
|
|
import com.ningdatech.pmapi.common.util.CryptUtils; |
|
|
import com.ningdatech.pmapi.common.util.CryptUtils; |
|
@@ -109,14 +110,14 @@ public class DingInfoPullController { |
|
|
|
|
|
|
|
|
@ApiOperation(value = "测试项目归并", notes = "测试项目归并") |
|
|
@ApiOperation(value = "测试项目归并", notes = "测试项目归并") |
|
|
@GetMapping("/test-guibing") |
|
|
@GetMapping("/test-guibing") |
|
|
public String testGuibing() throws NoSuchAlgorithmException { |
|
|
|
|
|
|
|
|
public String testGuibing() { |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; |
|
|
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; |
|
|
String appKey = "A331101453557202109017383"; |
|
|
String appKey = "A331101453557202109017383"; |
|
|
String method = "POST"; |
|
|
String method = "POST"; |
|
|
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); |
|
|
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); |
|
|
log.info("secret :{}",secret); |
|
|
log.info("secret :{}",secret); |
|
|
String sign = CryptUtils.MD5Encode(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)){ |
|
@@ -126,7 +127,7 @@ public class DingInfoPullController { |
|
|
} |
|
|
} |
|
|
String appId = "A330000100000202105005790"; |
|
|
String appId = "A330000100000202105005790"; |
|
|
String updateTime = "2023-07-26 00:00:00"; |
|
|
String updateTime = "2023-07-26 00:00:00"; |
|
|
String capCode = CryptUtils.MD5Encode(timestamp + updateTime + appId); |
|
|
|
|
|
|
|
|
String capCode = MD5.create().digestHex(timestamp + updateTime + appId); |
|
|
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + |
|
|
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + |
|
|
"dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + |
|
|
"dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + |
|
|
"&sign=" + sign + "&appKey=" + appKey + |
|
|
"&sign=" + sign + "&appKey=" + appKey + |
|
@@ -137,4 +138,33 @@ public class DingInfoPullController { |
|
|
log.info(forEntity.getBody()); |
|
|
log.info(forEntity.getBody()); |
|
|
return forEntity.getBody(); |
|
|
return forEntity.getBody(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "测试项目详情推送", notes = "测试项目详情推送") |
|
|
|
|
|
@GetMapping("/test-push-project") |
|
|
|
|
|
public String testPushProject() { |
|
|
|
|
|
long timestamp = System.currentTimeMillis(); |
|
|
|
|
|
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; |
|
|
|
|
|
String appKey = "A331101453557202109017383"; |
|
|
|
|
|
String method = "POST"; |
|
|
|
|
|
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,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 appId = "A330000100000202105005790"; |
|
|
|
|
|
String updateTime = "2023-07-26 00:00:00"; |
|
|
|
|
|
String capCode = MD5.create().digestHex(timestamp + updateTime + appId); |
|
|
|
|
|
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm?" + |
|
|
|
|
|
"requestTime=" + timestamp + "&sign=" + sign + |
|
|
|
|
|
"&appKey=" + appKey + "&baseProjPrincipal=abc&baseProjSetYear=abc&baseProjId=abc&baseManDeprt=abc&baseProjBasis=abc&baseLowestLevel=abc&ProjPrincipalCall=abc&baseConstructionType=abc&baseProjType=abc&baseProjContacts=abc&isEffective=abc&baseConsDeprtDing=abc&baseProjSetProg=abc&baseProjContactsCall=abc&baseProjName=abc&baseProjConsClass=abc&capCode=abc&baseManDeprtDing=abc&baseProvManDeprtDing=abc&baseBasisEstablish=abc&baseAreaCode=abc&capTime=abc&baseAreaName=abc"; |
|
|
|
|
|
log.info("url :{}",url); |
|
|
|
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
|
|
|
log.info(forEntity.getBody()); |
|
|
|
|
|
return forEntity.getBody(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |