Browse Source

Merge remote-tracking branch 'origin/master'

master
PoffyZhang 1 year ago
parent
commit
7ec5cc0b30
9 changed files with 133 additions and 55 deletions
  1. +7
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java
  2. +4
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java
  3. +80
    -36
      pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java
  4. +5
    -0
      pmapi/src/main/resources/application-dev.yml
  5. +5
    -0
      pmapi/src/main/resources/application-pre.yml
  6. +5
    -0
      pmapi/src/main/resources/application-prod.yml
  7. +16
    -9
      pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java
  8. +5
    -0
      pmapi/src/test/resources/application-dev.yml
  9. +6
    -1
      pmapi/src/test/resources/application-pre.yml

+ 7
- 3
pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java View File

@@ -1,19 +1,17 @@
package com.ningdatech.pmapi.irs.controller; package com.ningdatech.pmapi.irs.controller;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ningdatech.log.annotation.WebLog; import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.irs.manage.AppIrsManage; import com.ningdatech.pmapi.irs.manage.AppIrsManage;
import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO;
import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult;
import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

import javax.validation.Valid; import javax.validation.Valid;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.List;


/** /**
* @Classname ApplicationController * @Classname ApplicationController
@@ -45,4 +43,10 @@ public class ApplicationController {
public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException {
return appIrsManage.searchApps(apply); return appIrsManage.searchApps(apply);
} }

@GetMapping("/digitalResourcesIndicators/{appCode}")
public JSONObject getDigitalResourcesIndicators(@PathVariable String appCode) {
return appIrsManage.getDigitalResourceIndicatorsByAppCode(appCode);
}

} }

+ 4
- 6
pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java View File

@@ -1,9 +1,6 @@
package com.ningdatech.pmapi.irs.controller; package com.ningdatech.pmapi.irs.controller;


import com.ningdatech.log.annotation.WebLog; import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
import com.ningdatech.pmapi.irs.utils.RefreshTokenUtil;
import com.ningdatech.pmapi.projectdeclared.manage.IrsManage; import com.ningdatech.pmapi.projectdeclared.manage.IrsManage;
import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO; import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO; import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO;
@@ -11,10 +8,11 @@ import io.swagger.annotations.Api;
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.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;


+ 80
- 36
pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java View File

@@ -9,12 +9,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.function.VUtils;
import com.ningdatech.irs.service.IRefreshTokenService; import com.ningdatech.irs.service.IRefreshTokenService;
import com.ningdatech.pmapi.common.enumeration.CommonEnum; import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
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 com.ningdatech.pmapi.common.util.RefreshKeyUtil; import com.ningdatech.pmapi.common.util.RefreshKeyUtil;
import com.ningdatech.pmapi.irs.model.dto.*;
import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO;
import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult;
import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO;
import com.ningdatech.pmapi.irs.model.res.ApiResponse; import com.ningdatech.pmapi.irs.model.res.ApiResponse;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.Project;
@@ -34,7 +35,6 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -93,8 +93,23 @@ public class AppIrsManage {
@Value("${irs.push-project-detail.appSecret}") @Value("${irs.push-project-detail.appSecret}")
private String pushProjectAppSecret; private String pushProjectAppSecret;


//=============数字资源指标获取========================================================================================

@Value("${irs.digital-resource-indicators.app-key}")
private String driAppKey;

@Value("${irs.digital-resource-indicators.app-secret}")
private String driAppSecret;

@Value("${irs.digital-resource-indicators.interface-name}")
private String driInterfaceName;

@Value("${irs.digital-resource-indicators.url}")
private String driUrl;

/** /**
* 推送 项目和应用关系 * 推送 项目和应用关系
*
* @param dto * @param dto
* @return * @return
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
@@ -112,14 +127,14 @@ public class AppIrsManage {
ApiApplyDTO apiApply = new ApiApplyDTO(); ApiApplyDTO apiApply = new ApiApplyDTO();
apiApply.setAppId(appCode); apiApply.setAppId(appCode);
JSONObject jsonObject = this.searchApp(apiApply); JSONObject jsonObject = this.searchApp(apiApply);
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject),ApiApplySearchResult.class);
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject), ApiApplySearchResult.class);
VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!"); VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!");


long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
String areaCode = project.getAreaCode(); String areaCode = project.getAreaCode();
String projectName = project.getProjectName(); String projectName = project.getProjectName();
String requestSecret = RefreshKeyUtil.getRequestSecret(pushAppKey, pushAppScret); String requestSecret = RefreshKeyUtil.getRequestSecret(pushAppKey, pushAppScret);
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode,"bcb4fc0f517fc168ee543fcf4d231f3b");
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b");
String capTime = String.valueOf(timestamp); String capTime = String.valueOf(timestamp);
String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp); String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp);
String url = pushUrl + "?requestTime=" + timestamp + String url = pushUrl + "?requestTime=" + timestamp +
@@ -134,14 +149,14 @@ public class AppIrsManage {


ApiResponse body = forEntity.getBody(); ApiResponse body = forEntity.getBody();


if(Objects.isNull(body) || Objects.isNull(body.getCode())
|| 0 != body.getCode()){
if (Objects.isNull(body) || Objects.isNull(body.getCode())
|| 0 != body.getCode()) {
return Boolean.FALSE; return Boolean.FALSE;
} }


//保存关系 //保存关系
app.setAppCode(appCode); app.setAppCode(appCode);
if(applicationService.updateById(app)){
if (applicationService.updateById(app)) {
/** /**
* 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册 * 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册
* 如果都已经注册 要调用状态机 进入下一个状态 * 如果都已经注册 要调用状态机 进入下一个状态
@@ -150,8 +165,8 @@ public class AppIrsManage {
.eq(ProjectApplication::getProjectId, project.getId())); .eq(ProjectApplication::getProjectId, project.getId()));
//筛选出 初次新建的app 但是没有appCode的 //筛选出 初次新建的app 但是没有appCode的
apps = apps.stream().filter(a -> { apps = apps.stream().filter(a -> {
if(CommonEnum.YES.getCode().equals(a.getIsFirst()) &&
StringUtils.isBlank(app.getAppCode())){
if (CommonEnum.YES.getCode().equals(a.getIsFirst()) &&
StringUtils.isBlank(app.getAppCode())) {
return Boolean.TRUE; return Boolean.TRUE;
} }
return Boolean.FALSE; return Boolean.FALSE;
@@ -159,7 +174,7 @@ public class AppIrsManage {
.collect(Collectors.toList()); .collect(Collectors.toList());


//如果筛选出来的 为空的话 就调用状态机 //如果筛选出来的 为空的话 就调用状态机
if(CollUtil.isEmpty(apps)){
if (CollUtil.isEmpty(apps)) {
stateMachineUtils.pass(project); stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now());
projectService.updateById(project); projectService.updateById(project);
@@ -171,6 +186,7 @@ public class AppIrsManage {


/** /**
* 查询app * 查询app
*
* @param apply * @param apply
* @return * @return
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
@@ -184,27 +200,27 @@ public class AppIrsManage {
"&appKey=" + searchAppKey + "&" + "&appKey=" + searchAppKey + "&" +
"pageSize=10&pageNum=1&appCode=" + appCode + "pageSize=10&pageNum=1&appCode=" + appCode +
"&areaCode=&deptCode=&name="; "&areaCode=&deptCode=&name=";
log.info("url : {}",url);
log.info("url : {}", url);
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);


log.info("查询应用目录 : {}",JSON.toJSONString(forEntity));
log.info("查询应用目录 : {}", JSON.toJSONString(forEntity));


if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())){
if (Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())) {
JSONObject body = JSON.parseObject(forEntity.getBody()); JSONObject body = JSON.parseObject(forEntity.getBody());
if(Objects.isNull(body)){
if (Objects.isNull(body)) {
return null; return null;
} }
JSONObject datas = body.getJSONObject("datas"); JSONObject datas = body.getJSONObject("datas");
if(Objects.isNull(datas)){
if (Objects.isNull(datas)) {
return null; return null;
} }
JSONObject data = datas.getJSONObject("data"); JSONObject data = datas.getJSONObject("data");
if(Objects.isNull(data)){
if (Objects.isNull(data)) {
return null; return null;
} }
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult");
if(CollUtil.isEmpty(apiApplySearchResult)){
if (CollUtil.isEmpty(apiApplySearchResult)) {
return null; return null;
} }
return apiApplySearchResult.getJSONObject(0); return apiApplySearchResult.getJSONObject(0);
@@ -225,19 +241,19 @@ public class AppIrsManage {
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);


log.info("查询应用目录 : {}",JSON.toJSONString(forEntity));
log.info("查询应用目录 : {}", JSON.toJSONString(forEntity));


if(Objects.nonNull(forEntity.getBody())){
if (Objects.nonNull(forEntity.getBody())) {
JSONObject body = JSON.parseObject(forEntity.getBody()); JSONObject body = JSON.parseObject(forEntity.getBody());
if(Objects.isNull(body)){
if (Objects.isNull(body)) {
return null; return null;
} }
JSONObject datas = body.getJSONObject("datas"); JSONObject datas = body.getJSONObject("datas");
if(Objects.isNull(datas)){
if (Objects.isNull(datas)) {
return null; return null;
} }
JSONObject data = datas.getJSONObject("data"); JSONObject data = datas.getJSONObject("data");
if(Objects.isNull(data)){
if (Objects.isNull(data)) {
return null; return null;
} }
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult"); JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult");
@@ -252,14 +268,14 @@ public class AppIrsManage {
String appKey = "A331101453557202109017383"; String appKey = "A331101453557202109017383";
String method = "POST"; String method = "POST";
String interfaceName = "5crv7i4727abLCv0"; String interfaceName = "5crv7i4727abLCv0";
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method);
log.info("secret :{}",secret);
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method);
log.info("secret :{}", secret);
String sign = MD5.create().digestHex(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)) {
restTemplate = new RestTemplate(factory); restTemplate = new RestTemplate(factory);
}else{
} else {
restTemplate = new RestTemplate(); restTemplate = new RestTemplate();
} }
String appId = "A330000100000202105005790"; String appId = "A330000100000202105005790";
@@ -269,7 +285,7 @@ public class AppIrsManage {
"&sign=" + sign + "&appKey=" + appKey + "&sign=" + sign + "&appKey=" + appKey +
"&capCode=" + capCode + "&capTime=" + timestamp + "&capCode=" + capCode + "&capTime=" + timestamp +
"&appId=" + appId; "&appId=" + appId;
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();
@@ -277,6 +293,7 @@ public class AppIrsManage {


/** /**
* 推送项目详情 * 推送项目详情
*
* @return * @return
*/ */
public String pushProjectDetail(ProjectDTO projectDto) { public String pushProjectDetail(ProjectDTO projectDto) {
@@ -285,14 +302,14 @@ public class AppIrsManage {
String appKey = pushProjectAppKey; String appKey = pushProjectAppKey;
String method = HttpMethod.POST.name(); String method = HttpMethod.POST.name();
String interfaceName = pushProjectInterfaceName; String interfaceName = pushProjectInterfaceName;
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,interfaceName,method);
log.info("secret :{}",secret);
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, method);
log.info("secret :{}", secret);
String sign = MD5.create().digestHex(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)) {
restTemplate = new RestTemplate(factory); restTemplate = new RestTemplate(factory);
}else{
} else {
restTemplate = new RestTemplate(); restTemplate = new RestTemplate();
} }
String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海" String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海"
@@ -318,13 +335,13 @@ public class AppIrsManage {
String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32"; String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32";
String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函"; String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函";
String capCode = null; String capCode = null;
try{
try {
capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b"); capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b");
}catch (Exception e){
} catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }


String url = pushProjectUrl+ "?" +
String url = pushProjectUrl + "?" +
"requestTime=" + timestamp + "&sign=" + sign + "requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" + "&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" +
"&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId + "&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId +
@@ -337,9 +354,36 @@ public class AppIrsManage {
"&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing + "&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing +
"&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish + "&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish +
"&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName; "&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName;
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();
} }

public JSONObject getDigitalResourceIndicatorsByAppCode(String appCode) {
long timestamp = System.currentTimeMillis();
String appSecret = driAppSecret;
String appKey = driAppKey;
String method = HttpMethod.POST.name();
String interfaceName = driInterfaceName;
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, interfaceName, 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 url = driUrl + "?" +
"requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + appKey + "&appCode=" + appCode;
log.info("url :{}", url);
ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class);
log.info(Objects.requireNonNull(forEntity.getBody()).toJSONString());
return forEntity.getBody();
}

} }

+ 5
- 0
pmapi/src/main/resources/application-dev.yml View File

@@ -206,6 +206,11 @@ provincial:
#天印服务器接口信息 #天印服务器接口信息
irs: irs:
is-search-app: false is-search-app: false
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interface-name: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform: seal-platform:
project-id: 330001110 project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a project-secret: 70e512d40c8f440484db4acab181570a


+ 5
- 0
pmapi/src/main/resources/application-pre.yml View File

@@ -209,6 +209,11 @@ provincial:
#天印服务器接口信息 #天印服务器接口信息
irs: irs:
is-search-app: true is-search-app: true
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interfaceName: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform: seal-platform:
project-id: 330001110 project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a project-secret: 70e512d40c8f440484db4acab181570a


+ 5
- 0
pmapi/src/main/resources/application-prod.yml View File

@@ -209,6 +209,11 @@ provincial:
#天印服务器接口信息 #天印服务器接口信息
irs: irs:
is-search-app: true is-search-app: true
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interfaceName: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform: seal-platform:
project-id: 330001110 project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a project-secret: 70e512d40c8f440484db4acab181570a


+ 16
- 9
pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java View File

@@ -7,6 +7,7 @@ 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.HmacAuthUtil; import com.ningdatech.pmapi.common.util.HmacAuthUtil;
import com.ningdatech.pmapi.common.util.RefreshKeyUtil; import com.ningdatech.pmapi.common.util.RefreshKeyUtil;
import com.ningdatech.pmapi.irs.manage.AppIrsManage;
import com.ningdatech.zwdd.ZwddIntegrationProperties; import com.ningdatech.zwdd.ZwddIntegrationProperties;
import com.ningdatech.zwdd.client.ZwddAuthClient; import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient; import com.ningdatech.zwdd.client.ZwddClient;
@@ -20,12 +21,14 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;

import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.Map;
import java.util.Objects;


/** /**
* @Classname IrsTest * @Classname IrsTest
@@ -40,9 +43,11 @@ public class IrsTest extends AppTests {


@Autowired @Autowired
private ZwddClient zwddClient; private ZwddClient zwddClient;
@Autowired
private AppIrsManage appIrsManage;


@Test @Test
public void test1(){
public void test1() {
String method = "GET"; String method = "GET";
String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" + String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" +
"?appCode=A331101453557202109017383"; "?appCode=A331101453557202109017383";
@@ -53,14 +58,14 @@ public class IrsTest extends AppTests {
//请求头 //请求头
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();


for(Map.Entry<String, String> entry : header.entrySet()){
for (Map.Entry<String, String> entry : header.entrySet()) {
headers.add(entry.getKey(), entry.getValue()); headers.add(entry.getKey(), entry.getValue());
} }
//封装请求头 //封装请求头
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers); HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);


RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity, String.class);
ResponseEntity<String> forEntity = restTemplate.exchange(url, HttpMethod.GET, formEntity, String.class);


System.out.println(JSON.toJSONString(forEntity)); System.out.println(JSON.toJSONString(forEntity));
} }
@@ -100,7 +105,7 @@ public class IrsTest extends AppTests {
String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp);
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp +
"&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime + "&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime +
"&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId +
"&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId +
"&isEffective=1&baseProjSysCode=" + baseProjSysCode; "&isEffective=1&baseProjSysCode=" + baseProjSysCode;
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
@@ -116,7 +121,7 @@ public class IrsTest extends AppTests {
} }


@Test @Test
public void test4(){
public void test4() {
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
try { try {
String api = "/media/download"; String api = "/media/download";
@@ -147,7 +152,7 @@ public class IrsTest extends AppTests {
fos.close(); fos.close();
} catch (Exception e) { } catch (Exception e) {
System.out.println(e); System.out.println(e);
}finally {
} finally {
if (response != null) { if (response != null) {
try { try {
//特别提醒:需要调用response的close方法关闭网络连接!!! //特别提醒:需要调用response的close方法关闭网络连接!!!
@@ -160,7 +165,7 @@ public class IrsTest extends AppTests {
} }


@Test @Test
public void test5(){
public void test5() {
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
try { try {
String api = "/media/download"; String api = "/media/download";
@@ -191,7 +196,7 @@ public class IrsTest extends AppTests {
fos.close(); fos.close();
} catch (Exception e) { } catch (Exception e) {
System.out.println(e); System.out.println(e);
}finally {
} finally {
if (response != null) { if (response != null) {
try { try {
//特别提醒:需要调用response的close方法关闭网络连接!!! //特别提醒:需要调用response的close方法关闭网络连接!!!
@@ -206,6 +211,7 @@ public class IrsTest extends AppTests {
private static ExecutableClient zwddExecutableClient; private static ExecutableClient zwddExecutableClient;
@Autowired @Autowired
private ZwddIntegrationProperties zwddProperties; private ZwddIntegrationProperties zwddProperties;

public ExecutableClient getZwddExecutableClient() { public ExecutableClient getZwddExecutableClient() {
if (Objects.isNull(zwddExecutableClient)) { if (Objects.isNull(zwddExecutableClient)) {
synchronized (ZwddAuthClientProvider.class) { synchronized (ZwddAuthClientProvider.class) {
@@ -224,4 +230,5 @@ public class IrsTest extends AppTests {
} }
return zwddExecutableClient; return zwddExecutableClient;
} }

} }

+ 5
- 0
pmapi/src/test/resources/application-dev.yml View File

@@ -206,6 +206,11 @@ provincial:
#天印服务器接口信息 #天印服务器接口信息
irs: irs:
is-search-app: false is-search-app: false
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interfaceName: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform: seal-platform:
project-id: 330001110 project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a project-secret: 70e512d40c8f440484db4acab181570a


+ 6
- 1
pmapi/src/test/resources/application-pre.yml View File

@@ -145,7 +145,7 @@ flowable:
async-executor-activate: true async-executor-activate: true
#关闭一些不需要的功能服务 #关闭一些不需要的功能服务
rest-api-enabled: false rest-api-enabled: false
# database-schema-update: false
# database-schema-update: false
idm: idm:
enabled: false enabled: false
common: common:
@@ -209,6 +209,11 @@ provincial:
#天印服务器接口信息 #天印服务器接口信息
irs: irs:
is-search-app: true is-search-app: true
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interfaceName: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform: seal-platform:
project-id: 330001110 project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a project-secret: 70e512d40c8f440484db4acab181570a


Loading…
Cancel
Save