From 6307c50bc573019df3aa24d436f686c8097531ec Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 28 Jul 2023 13:48:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=20debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/ding/controller/DingInfoPullController.java | 17 +++++++++++------ .../pmapi/projectlib/manage/ProjectLibManage.java | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java index ba7fd3c..7166180 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java @@ -116,7 +116,7 @@ public class DingInfoPullController { @ApiOperation(value = "测试项目归并", notes = "测试项目归并") @GetMapping("/test-guibing") - public String testGuibing() throws NoSuchAlgorithmException, InvalidKeyException { + public String testGuibing() throws Exception { long timestamp = System.currentTimeMillis(); String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; String appKey = "A331101453557202109017383"; @@ -133,8 +133,7 @@ public class DingInfoPullController { restTemplate = new RestTemplate(); } String appId = "A330000100000202105005790"; - String capCode = bytesToHex(CryptUtils.hmacMd5((timestamp + appId).getBytes(StandardCharsets.UTF_8), - "bcb4fc0f517fc168ee543fcf4d231f3b".getBytes(StandardCharsets.UTF_8))); + String capCode = CryptUtils.encryptHMAC(timestamp + appId, "bcb4fc0f517fc168ee543fcf4d231f3b"); String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + "dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + @@ -148,7 +147,7 @@ public class DingInfoPullController { @ApiOperation(value = "测试项目详情推送", notes = "测试项目详情推送") @GetMapping("/test-push-project") - public String testPushProject() throws NoSuchAlgorithmException, InvalidKeyException { + public String testPushProject() throws Exception { long timestamp = System.currentTimeMillis(); String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; String appKey = "A331101453557202109017383"; @@ -186,8 +185,7 @@ public class DingInfoPullController { String baseManDeprtDing = "GO_9a7dce7fbaf54787998fa004f1b7c0e1"; String baseProvManDeprtDing = "GO_6c383c049d95461f9a0df780140ceb32"; String baseBasisEstablish = "中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; - String capCode = bytesToHex(CryptUtils.hmacMd5((timestamp + areaCode).getBytes(StandardCharsets.UTF_8), - "bcb4fc0f517fc168ee543fcf4d231f3b".getBytes(StandardCharsets.UTF_8))); + String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm?" + "requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + @@ -207,6 +205,13 @@ public class DingInfoPullController { return forEntity.getBody(); } + public static void main(String[] args) throws Exception { + long timestamp = System.currentTimeMillis(); + String areaCode = "331123000"; + String res = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); + System.out.println(res); + } + /** * 将byte数组转为十六进制字符串 * @param bytes byte数组 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index cbb8f78..811acbc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -518,6 +518,7 @@ public class ProjectLibManage { ProjectApplication app = BeanUtil.copyProperties(a, ProjectApplication.class); app.setId(null); app.setProjectId(project.getId()); + app.setProjectCode(project.getProjectCode()); app.setBuildOrgName(project.getBuildOrgName()); app.setBuildOrgCode(project.getBuildOrgCode()); app.setIsConstruct(isConstruct);