|
@@ -20,6 +20,9 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.client.RestTemplate; |
|
|
import org.springframework.web.client.RestTemplate; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
|
import java.security.InvalidKeyException; |
|
|
import java.security.NoSuchAlgorithmException; |
|
|
import java.security.NoSuchAlgorithmException; |
|
|
import java.util.Objects; |
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
@@ -110,7 +113,7 @@ public class DingInfoPullController { |
|
|
|
|
|
|
|
|
@ApiOperation(value = "测试项目归并", notes = "测试项目归并") |
|
|
@ApiOperation(value = "测试项目归并", notes = "测试项目归并") |
|
|
@GetMapping("/test-guibing") |
|
|
@GetMapping("/test-guibing") |
|
|
public String testGuibing() { |
|
|
|
|
|
|
|
|
public String testGuibing() throws NoSuchAlgorithmException, InvalidKeyException { |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; |
|
|
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; |
|
|
String appKey = "A331101453557202109017383"; |
|
|
String appKey = "A331101453557202109017383"; |
|
@@ -127,7 +130,8 @@ public class DingInfoPullController { |
|
|
restTemplate = new RestTemplate(); |
|
|
restTemplate = new RestTemplate(); |
|
|
} |
|
|
} |
|
|
String appId = "A330000100000202105005790"; |
|
|
String appId = "A330000100000202105005790"; |
|
|
String capCode = MD5.create().digestHex(timestamp + appId); |
|
|
|
|
|
|
|
|
String capCode = bytesToHex(CryptUtils.hmacMd5((timestamp + appId).getBytes(StandardCharsets.UTF_8), |
|
|
|
|
|
"bcb4fc0f517fc168ee543fcf4d231f3b".getBytes(StandardCharsets.UTF_8))); |
|
|
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 + |
|
@@ -141,7 +145,7 @@ public class DingInfoPullController { |
|
|
|
|
|
|
|
|
@ApiOperation(value = "测试项目详情推送", notes = "测试项目详情推送") |
|
|
@ApiOperation(value = "测试项目详情推送", notes = "测试项目详情推送") |
|
|
@GetMapping("/test-push-project") |
|
|
@GetMapping("/test-push-project") |
|
|
public String testPushProject() { |
|
|
|
|
|
|
|
|
public String testPushProject() throws NoSuchAlgorithmException, InvalidKeyException { |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; |
|
|
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; |
|
|
String appKey = "A331101453557202109017383"; |
|
|
String appKey = "A331101453557202109017383"; |
|
@@ -179,7 +183,8 @@ public class DingInfoPullController { |
|
|
String baseManDeprtDing = "GO_9a7dce7fbaf54787998fa004f1b7c0e1"; |
|
|
String baseManDeprtDing = "GO_9a7dce7fbaf54787998fa004f1b7c0e1"; |
|
|
String baseProvManDeprtDing = "GO_6c383c049d95461f9a0df780140ceb32"; |
|
|
String baseProvManDeprtDing = "GO_6c383c049d95461f9a0df780140ceb32"; |
|
|
String baseBasisEstablish = "中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; |
|
|
String baseBasisEstablish = "中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; |
|
|
String capCode = MD5.create().digestHex(timestamp + areaCode); |
|
|
|
|
|
|
|
|
String capCode = bytesToHex(CryptUtils.hmacMd5((timestamp + areaCode).getBytes(StandardCharsets.UTF_8), |
|
|
|
|
|
"bcb4fc0f517fc168ee543fcf4d231f3b".getBytes(StandardCharsets.UTF_8))); |
|
|
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm?" + |
|
|
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm?" + |
|
|
"requestTime=" + timestamp + "&sign=" + sign + |
|
|
"requestTime=" + timestamp + "&sign=" + sign + |
|
|
"&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + |
|
|
"&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + |
|
@@ -198,4 +203,17 @@ public class DingInfoPullController { |
|
|
log.info(forEntity.getBody()); |
|
|
log.info(forEntity.getBody()); |
|
|
return forEntity.getBody(); |
|
|
return forEntity.getBody(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 将byte数组转为十六进制字符串 |
|
|
|
|
|
* @param bytes byte数组 |
|
|
|
|
|
* @return 十六进制字符串 |
|
|
|
|
|
*/ |
|
|
|
|
|
private static String bytesToHex(byte[] bytes) { |
|
|
|
|
|
StringBuilder hex = new StringBuilder(); |
|
|
|
|
|
for (byte b : bytes) { |
|
|
|
|
|
hex.append(String.format("%02x", b)); |
|
|
|
|
|
} |
|
|
|
|
|
return hex.toString(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |