@@ -51,7 +51,7 @@ public class DingInfoPullController { | |||||
private final ProcDefManage procDefManage; | private final ProcDefManage procDefManage; | ||||
@Resource(name = "refreshToken") | |||||
@Resource | |||||
private IRefreshTokenService refreshTokenService; | private IRefreshTokenService refreshTokenService; | ||||
@Value("${irs.interface-refresh.request-token-url}") | @Value("${irs.interface-refresh.request-token-url}") | ||||
@@ -73,7 +73,7 @@ public class AppIrsManage { | |||||
@Value("${irs.search-app.url}") | @Value("${irs.search-app.url}") | ||||
private String searchUrl; | private String searchUrl; | ||||
@Resource(name = "refreshToken") | |||||
@Resource | |||||
private IRefreshTokenService refreshTokenService; | private IRefreshTokenService refreshTokenService; | ||||
@Value("${irs.interface-refresh.request-token-url}") | @Value("${irs.interface-refresh.request-token-url}") | ||||
@@ -50,7 +50,7 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc | |||||
@Autowired | @Autowired | ||||
private RestTemplate restTemplate; | private RestTemplate restTemplate; | ||||
@Resource(name = "refreshToken") | |||||
@Resource | |||||
private IRefreshTokenService refreshTokenService; | private IRefreshTokenService refreshTokenService; | ||||
@Value("${irs.interface-refresh.request-token-url}") | @Value("${irs.interface-refresh.request-token-url}") | ||||
@@ -1,12 +1,22 @@ | |||||
package com.ningdatech.pmapi.wps.controller; | package com.ningdatech.pmapi.wps.controller; | ||||
import com.ningdatech.irs.service.IRefreshTokenService; | |||||
import com.ningdatech.pmapi.common.util.CryptUtils; | |||||
import com.ningdatech.pmapi.common.util.HttpUtil; | |||||
import com.wps.manage.WpsConvertManage; | import com.wps.manage.WpsConvertManage; | ||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import lombok.AllArgsConstructor; | |||||
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.http.HttpMethod; | |||||
import org.springframework.http.ResponseEntity; | |||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | |||||
import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||
import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
import org.springframework.web.client.RestTemplate; | |||||
import java.security.NoSuchAlgorithmException; | |||||
import java.util.Objects; | |||||
/** | /** | ||||
* @Classname WpsConvertController | * @Classname WpsConvertController | ||||
@@ -16,13 +26,45 @@ import org.springframework.web.bind.annotation.RestController; | |||||
*/ | */ | ||||
@Slf4j | @Slf4j | ||||
@RestController | @RestController | ||||
@AllArgsConstructor | |||||
@Api(tags = "待办中心控制器") | @Api(tags = "待办中心控制器") | ||||
@RequestMapping("/api/v1/wps-convert") | @RequestMapping("/api/v1/wps-convert") | ||||
public class WpsConvertController { | public class WpsConvertController { | ||||
@Autowired | |||||
private IRefreshTokenService refreshTokenService; | |||||
@Value("${irs.interface-refresh.request-token-url}") | |||||
private String govRequestTokenUrl; | |||||
@Value("${irs.interface-refresh.refresh-token-url}") | |||||
private String govRefreshTokenUrl; | |||||
@GetMapping("/office2pdf") | @GetMapping("/office2pdf") | ||||
public String office2pdf(){ | public String office2pdf(){ | ||||
return WpsConvertManage.offs2Pdf(); | return WpsConvertManage.offs2Pdf(); | ||||
} | } | ||||
@GetMapping("/test-core") | |||||
public String testCore() throws NoSuchAlgorithmException { | |||||
long timestamp = System.currentTimeMillis(); | |||||
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; | |||||
String appKey = "A331101453557202109017383"; | |||||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, | |||||
"Fc3re2cq7r64Qfa7", HttpMethod.POST.name()); | |||||
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 url = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm?" + | |||||
"dingCode=&matterName=&oid=&useState=1&limit=1000&page=1" + | |||||
"&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; | |||||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||||
log.info(forEntity.getBody()); | |||||
return forEntity.getBody(); | |||||
} | |||||
} | } |
@@ -36,6 +36,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
ignore-csrf-urls: | ignore-csrf-urls: | ||||
- /api/v1/user/auth/** | - /api/v1/user/auth/** | ||||
- /v2/api-docs | - /v2/api-docs | ||||
@@ -64,6 +65,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
role-map: | role-map: | ||||
"engineer": | "engineer": | ||||
"project_manager": | "project_manager": | ||||
@@ -36,6 +36,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
ignore-csrf-urls: | ignore-csrf-urls: | ||||
- /api/v1/user/auth/** | - /api/v1/user/auth/** | ||||
- /v2/api-docs | - /v2/api-docs | ||||
@@ -64,6 +65,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
role-map: | role-map: | ||||
"engineer": | "engineer": | ||||
"project_manager": | "project_manager": | ||||
@@ -36,6 +36,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
ignore-csrf-urls: | ignore-csrf-urls: | ||||
- /api/v1/user/auth/** | - /api/v1/user/auth/** | ||||
- /v2/api-docs | - /v2/api-docs | ||||
@@ -64,6 +65,7 @@ security: | |||||
- /file/download | - /file/download | ||||
- /api/v1/zwdd/pull/** | - /api/v1/zwdd/pull/** | ||||
- /api/v1/irs/** | - /api/v1/irs/** | ||||
- /api/v1/wps-convert/** | |||||
role-map: | role-map: | ||||
"engineer": | "engineer": | ||||
"project_manager": | "project_manager": | ||||
@@ -0,0 +1,60 @@ | |||||
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.HttpUtil; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.junit.Test; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.http.HttpMethod; | |||||
import org.springframework.http.ResponseEntity; | |||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | |||||
import org.springframework.web.client.RestTemplate; | |||||
import javax.annotation.Resource; | |||||
import java.security.NoSuchAlgorithmException; | |||||
import java.util.Objects; | |||||
/** | |||||
* @Classname irsTest3 | |||||
* @Description | |||||
* @Date 2023/7/25 9:52 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Slf4j | |||||
public class irsTest4 extends AppTests { | |||||
@Resource | |||||
private IRefreshTokenService refreshTokenService; | |||||
@Value("${irs.interface-refresh.request-token-url}") | |||||
private String govRequestTokenUrl; | |||||
@Value("${irs.interface-refresh.refresh-token-url}") | |||||
private String govRefreshTokenUrl; | |||||
@Test | |||||
public void test1() throws NoSuchAlgorithmException { | |||||
long timestamp = System.currentTimeMillis(); | |||||
String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; | |||||
String appKey = "A331101453557202109017383"; | |||||
String dataName = "大数据管理局"; | |||||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, | |||||
"Fc3re2cq7r64Qfa7", HttpMethod.POST.name()); | |||||
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 url = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm?" + | |||||
"dingCode=&matterName=&oid=&useState=1&limit=1000&page=1" + | |||||
"&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; | |||||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||||
System.out.println(forEntity.getBody()); | |||||
} | |||||
} |