@@ -10,7 +10,6 @@ import com.ningdatech.pmapi.organization.manage.ProcDefManage; | |||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
import org.springframework.http.ResponseEntity; | import org.springframework.http.ResponseEntity; | ||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | ||||
@@ -146,7 +145,7 @@ public class DingInfoPullController { | |||||
String appKey = "A331101453557202109017383"; | String appKey = "A331101453557202109017383"; | ||||
String dataName = "大数据管理局"; | String dataName = "大数据管理局"; | ||||
String method = "POST"; | String method = "POST"; | ||||
String secret = refreshTokenService.refreshToken(appKey,appSecret,requestTokenUrl,refreshTokenUrl,method); | |||||
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); | |||||
String sign = CryptUtils.MD5Encode(appKey + secret + timestamp); | String sign = CryptUtils.MD5Encode(appKey + secret + timestamp); | ||||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | ||||
RestTemplate restTemplate; | RestTemplate restTemplate; | ||||
@@ -155,13 +154,17 @@ public class DingInfoPullController { | |||||
}else{ | }else{ | ||||
restTemplate = new RestTemplate(); | restTemplate = new RestTemplate(); | ||||
} | } | ||||
String appId = "A330000100000202105005790"; | |||||
String updateTime = "2023-07-26 00:00:00"; | |||||
String capCode = 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=1494485467272&sign=11b39a2989f781d9a7eb50abeaeaac53&appKey=7520d721086111e7985b008cfaeb3d74&capCode=abc&appId=abc&capTime=abc"; | |||||
"dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + | |||||
"&sign=" + sign + "&appKey=" + appKey + | |||||
"&capCode=abc&appId=abc&capTime=" + timestamp + | |||||
"&appId=" + appId + "&updateTime=" + updateTime; | |||||
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(); | ||||
} | } | ||||
} | } |
@@ -50,7 +50,7 @@ public class Project implements Serializable { | |||||
private String projectName; | private String projectName; | ||||
@ApiModelProperty("是否临时增补 0:否 1:是") | @ApiModelProperty("是否临时增补 0:否 1:是") | ||||
@Compare("是否临时增补 0:否 1:是") | |||||
@Compare("是否临时增补") | |||||
private Integer isTemporaryAugment; | private Integer isTemporaryAugment; | ||||
@ApiModelProperty("项目负责人") | @ApiModelProperty("项目负责人") | ||||
@@ -86,11 +86,11 @@ public class Project implements Serializable { | |||||
private String buildOrgZheJiangGovDingId; | private String buildOrgZheJiangGovDingId; | ||||
@ApiModelProperty("项目类型 1:建设 2:运维") | @ApiModelProperty("项目类型 1:建设 2:运维") | ||||
@Compare("项目类型 1:建设 2:运维") | |||||
@Compare("项目类型") | |||||
private Integer projectType; | private Integer projectType; | ||||
@ApiModelProperty("是否首次新建 0:否 1:是") | @ApiModelProperty("是否首次新建 0:否 1:是") | ||||
@Compare("是否首次新建 0:否 1:是") | |||||
@Compare("是否首次新建") | |||||
private Integer isFirst; | private Integer isFirst; | ||||
@ApiModelProperty("项目预算年度") | @ApiModelProperty("项目预算年度") | ||||
@@ -1,12 +1,17 @@ | |||||
package com.ningdatech.pmapi.irs; | package com.ningdatech.pmapi.irs; | ||||
import com.ningdatech.irs.service.IRefreshTokenService; | |||||
import com.ningdatech.pmapi.AppTests; | |||||
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 lombok.extern.slf4j.Slf4j; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.http.ResponseEntity; | import org.springframework.http.ResponseEntity; | ||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | ||||
import org.springframework.web.client.RestTemplate; | import org.springframework.web.client.RestTemplate; | ||||
import javax.annotation.Resource; | |||||
import java.security.NoSuchAlgorithmException; | import java.security.NoSuchAlgorithmException; | ||||
import java.util.Objects; | import java.util.Objects; | ||||
@@ -16,7 +21,21 @@ import java.util.Objects; | |||||
* @Date 2023/7/25 9:52 | * @Date 2023/7/25 9:52 | ||||
* @Author PoffyZhang | * @Author PoffyZhang | ||||
*/ | */ | ||||
public class irsTest3 { | |||||
@Slf4j | |||||
public class irsTest3 extends AppTests { | |||||
@Resource(name = "refreshToken") | |||||
private IRefreshTokenService refreshTokenService; | |||||
@Value("${irs.interface-local-refresh.request-token-url}") | |||||
private String requestTokenUrl; | |||||
@Value("${irs.interface-local-refresh.refresh-token-url}") | |||||
private String refreshTokenUrl; | |||||
@Value("${irs.interface-refresh.request-token-url}") | |||||
private String govRequestTokenUrl; | |||||
@Value("${irs.interface-refresh.refresh-token-url}") | |||||
private String govRefreshTokenUrl; | |||||
@Test | @Test | ||||
public void test1() throws NoSuchAlgorithmException { | public void test1() throws NoSuchAlgorithmException { | ||||
@@ -40,4 +59,32 @@ public class irsTest3 { | |||||
System.out.println(forEntity.getBody()); | System.out.println(forEntity.getBody()); | ||||
} | } | ||||
@Test | |||||
public void test2() throws NoSuchAlgorithmException { | |||||
long timestamp = System.currentTimeMillis(); | |||||
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; | |||||
String appKey = "A331101453557202109017383"; | |||||
String method = "POST"; | |||||
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); | |||||
String sign = CryptUtils.MD5Encode(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 = timestamp + updateTime + appId; | |||||
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + | |||||
"dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp + | |||||
"&sign=" + sign + "&appKey=" + appKey + | |||||
"&capCode=abc&appId=abc&capTime=" + timestamp + | |||||
"&appId=" + appId + "&updateTime=" + updateTime; | |||||
log.info("url :{}",url); | |||||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||||
log.info(forEntity.getBody()); | |||||
} | |||||
} | } |