Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

master
WendyYang 1 vuosi sitten
vanhempi
commit
bc07e6ecb9
9 muutettua tiedostoa jossa 175 lisäystä ja 107 poistoa
  1. +7
    -107
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +123
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java
  3. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.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. +5
    -0
      pmapi/src/test/resources/application-dev.yml
  8. +5
    -0
      pmapi/src/test/resources/application-pre.yml
  9. +5
    -0
      pmapi/src/test/resources/application-prod.yml

+ 7
- 107
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java Näytä tiedosto

@@ -11,7 +11,10 @@ import com.ningdatech.pmapi.common.util.HttpUtil;
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask;
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask;
import com.ningdatech.pmapi.irs.manage.AppIrsManage;
import com.ningdatech.pmapi.organization.manage.ProcDefManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.sun.crypto.provider.HmacMD5;
import com.sun.crypto.provider.HmacMD5KeyGenerator;
import io.swagger.annotations.ApiOperation;
@@ -57,6 +60,8 @@ public class DingInfoPullController {
@Value("${irs.interface-refresh.refresh-token-url}")
private String govRefreshTokenUrl;

private final AppIrsManage appIrsManage;

@GetMapping("/employee")
public void employeeBatchGet() {
employeeBatchGetTask.batchGetEmployeeTask();
@@ -114,114 +119,9 @@ public class DingInfoPullController {
return procDefManage.initByArea(areaCode);
}

@ApiOperation(value = "测试项目归并", notes = "测试项目归并")
@GetMapping("/test-guibing")
public String testGuibing() throws Exception {
long timestamp = System.currentTimeMillis();
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String method = "POST";
String interfaceName = "5crv7i4727abLCv0";
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 appId = "A330000100000202105005790";
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 +
"&capCode=" + capCode + "&capTime=" + timestamp +
"&appId=" + appId;
log.info("url :{}",url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
}

@ApiOperation(value = "测试项目详情推送", notes = "测试项目详情推送")
@GetMapping("/test-push-project")
public String testPushProject() throws Exception {
long timestamp = System.currentTimeMillis();
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String method = "POST";
String interfaceName = "3XN9R93Pva6db7sf";
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 baseProjPrincipal = "蒋国海";
String baseProjSetYear = "2022";
String baseProjId = "331123220130969000000";
String baseManDeprt = "遂昌县大数据和金融发展中心";
String baseProjBasis = "2";
String baseLowestLevel = "C";
String ProjPrincipalCall = "13884366607";
//内容类别
String baseConstructionType = "01";
String baseProjType = "1";
String baseProjContacts = "毛以林";
String isEffective = "1";
String baseConsDeprtDing = "GO_9a7dce7fbaf54787998fa004f1b7c0e1";
String baseProjSetProg = "04";
String baseProjContactsCall = "13857049999";
String baseProjName = "遂昌县大数据和金融发展中心天工系统";
String baseProjConsClass = "C";
String areaCode = "331123000";
String baseAreaName = "遂昌县";
String baseManDeprtDing = "GO_9a7dce7fbaf54787998fa004f1b7c0e1";
String baseProvManDeprtDing = "GO_6c383c049d95461f9a0df780140ceb32";
String baseBasisEstablish = "中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函";
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 + "" +
"&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId +
"&baseManDeprt=" + baseManDeprt + "&baseProjBasis=" + baseProjBasis +
"&baseLowestLevel=" + baseLowestLevel + "&ProjPrincipalCall=" + ProjPrincipalCall +
"&baseConstructionType=" + baseConstructionType + "&baseProjType=" + baseProjType +
"&baseProjContacts=" + baseProjContacts + "&isEffective=" + isEffective +
"&baseConsDeprtDing=" + baseConsDeprtDing + "&baseProjSetProg=" + baseProjSetProg +
"&baseProjContactsCall=" + baseProjContactsCall + "&baseProjName=" + baseProjName +
"&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing +
"&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish +
"&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName;
log.info("url :{}",url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
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数组
* @return 十六进制字符串
*/
private static String bytesToHex(byte[] bytes) {
StringBuilder hex = new StringBuilder();
for (byte b : bytes) {
hex.append(String.format("%02x", b));
}
return hex.toString();
public String testPushProject(@ModelAttribute ProjectDTO projectDto) throws Exception {
return appIrsManage.pushProjectDetail(projectDto);
}
}

+ 123
- 0
pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java Näytä tiedosto

@@ -1,18 +1,22 @@
package com.ningdatech.pmapi.irs.manage;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.irs.service.IRefreshTokenService;
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.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
import com.ningdatech.pmapi.common.util.RefreshKeyUtil;
import com.ningdatech.pmapi.irs.model.dto.*;
import com.ningdatech.pmapi.irs.model.res.ApiResponse;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
@@ -21,10 +25,13 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
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.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.util.Collections;
@@ -66,6 +73,25 @@ public class AppIrsManage {

@Value("${irs.search-app.url}")
private String searchUrl;
@Resource(name = "refreshToken")
private IRefreshTokenService refreshTokenService;

@Value("${irs.interface-refresh.request-token-url}")
private String govRequestTokenUrl;
@Value("${irs.interface-refresh.refresh-token-url}")
private String govRefreshTokenUrl;

@Value("${irs.push-project-detail.url}")
private String pushProjectUrl;

@Value("${irs.push-project-detail.interfaceName}")
private String pushProjectInterfaceName;

@Value("${irs.push-project-detail.appKey}")
private String pushProjectAppKey;

@Value("${irs.push-project-detail.appSecret}")
private String pushProjectAppSecret;

/**
* 推送 项目和应用关系
@@ -219,4 +245,101 @@ public class AppIrsManage {
}
return null;
}

public String testGuibing() throws Exception {
long timestamp = System.currentTimeMillis();
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String method = "POST";
String interfaceName = "5crv7i4727abLCv0";
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 appId = "A330000100000202105005790";
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 +
"&capCode=" + capCode + "&capTime=" + timestamp +
"&appId=" + appId;
log.info("url :{}",url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
}

/**
* 推送项目详情
* @return
*/
public String pushProjectDetail(ProjectDTO projectDto) {
long timestamp = System.currentTimeMillis();
String appSecret = pushProjectAppSecret;
String appKey = pushProjectAppKey;
String method = HttpMethod.POST.name();
String interfaceName = pushProjectInterfaceName;
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 baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海"
String baseProjSetYear = String.valueOf(projectDto.getProjectYear());//"2022"
String baseProjId = projectDto.getProjectCode();//"331123220130969000000"
String baseManDeprt = projectDto.getBuildOrgName();//"遂昌县大数据和金融发展中心"
String baseProjBasis = projectDto.getBaseProjBasis();//"2"
String baseLowestLevel = projectDto.getBaseLowestLevel();//"C"
String ProjPrincipalCall = projectDto.getResponsibleManMobile();//"13884366607"
//内容类别
String baseConstructionType = projectDto.getBaseConstructionType();//"01"
String baseProjType = String.valueOf(projectDto.getProjectType());//"1"
String baseProjContacts = projectDto.getContactName();//"毛以林"
String isEffective = "1";
String baseConsDeprtDing = projectDto.getBuildOrgCode();//"GO_9a7dce7fbaf54787998fa004f1b7c0e1";
String baseProjSetProg = projectDto.getBaseProjSetProg();//"04"
String baseProjContactsCall = projectDto.getContactPhone();//"13857049999"
String baseProjName = projectDto.getProjectName();//"遂昌县大数据和金融发展中心天工系统"
String baseProjConsClass = projectDto.getBaseProjConsClass();//"C"
String areaCode = projectDto.getAreaCode() + "000";//"331123000"
String baseAreaName = projectDto.getArea();//"遂昌县";
String baseManDeprtDing = projectDto.getSuperOrgCode();//"GO_9a7dce7fbaf54787998fa004f1b7c0e1";
String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32";
String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函";
String capCode = null;
try{
capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b");
}catch (Exception e){
log.error(e.getMessage());
}

String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm?" +
"requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" +
"&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId +
"&baseManDeprt=" + baseManDeprt + "&baseProjBasis=" + baseProjBasis +
"&baseLowestLevel=" + baseLowestLevel + "&ProjPrincipalCall=" + ProjPrincipalCall +
"&baseConstructionType=" + baseConstructionType + "&baseProjType=" + baseProjType +
"&baseProjContacts=" + baseProjContacts + "&isEffective=" + isEffective +
"&baseConsDeprtDing=" + baseConsDeprtDing + "&baseProjSetProg=" + baseProjSetProg +
"&baseProjContactsCall=" + baseProjContactsCall + "&baseProjName=" + baseProjName +
"&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing +
"&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish +
"&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName;
log.info("url :{}",url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
}
}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java Näytä tiedosto

@@ -299,4 +299,19 @@ public class ProjectDTO implements Serializable {
private String finalAcceptanceMaterials;

private Map<String,Object> dynamicForm;

//P省级,M市级,C县(市、区)级,T乡镇(街道、办事处)级,V村(社区)级
private String baseLowestLevel;

//01软件,02硬件,03服务,多个时用中文;分割
private String baseConstructionType;

//01评审中;02待立项;03已驳回;04已立项;05已采购;06已初验;07已终验;00已终止
private String baseProjSetProg;

//P省级,M市级,C县(市、区)级,T乡镇(街道、办事处)级,V村(社区)级
private String baseProjConsClass;

//01政策、法规,02规划或决策部署,03上级下达任务,04领导批示,05单位核心业务或单位职能,00其他,多个时用中文;分割
private String baseProjBasis;
}

+ 5
- 0
pmapi/src/main/resources/application-dev.yml Näytä tiedosto

@@ -230,6 +230,11 @@ irs:
interfaceName: 62vd5jAdM0b7Gr00
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
push-project-detail:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm
interfaceName: 3XN9R93Pva6db7sf
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
interface-refresh:
method: POST
request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign}


+ 5
- 0
pmapi/src/main/resources/application-pre.yml Näytä tiedosto

@@ -233,6 +233,11 @@ irs:
interfaceName: 62vd5jAdM0b7Gr00
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
push-project-detail:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm
interfaceName: 3XN9R93Pva6db7sf
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
interface-refresh:
method: POST
request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign}


+ 5
- 0
pmapi/src/main/resources/application-prod.yml Näytä tiedosto

@@ -233,6 +233,11 @@ irs:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
push-project-detail:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm
interfaceName: 3XN9R93Pva6db7sf
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
interface-refresh:
method: POST
request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign}


+ 5
- 0
pmapi/src/test/resources/application-dev.yml Näytä tiedosto

@@ -230,6 +230,11 @@ irs:
interfaceName: 62vd5jAdM0b7Gr00
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
push-project-detail:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm
interfaceName: 3XN9R93Pva6db7sf
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
interface-refresh:
method: POST
request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign}


+ 5
- 0
pmapi/src/test/resources/application-pre.yml Näytä tiedosto

@@ -233,6 +233,11 @@ irs:
interfaceName: 62vd5jAdM0b7Gr00
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
push-project-detail:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm
interfaceName: 3XN9R93Pva6db7sf
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
interface-refresh:
method: POST
request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign}


+ 5
- 0
pmapi/src/test/resources/application-prod.yml Näytä tiedosto

@@ -233,6 +233,11 @@ irs:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
push-project-detail:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm
interfaceName: 3XN9R93Pva6db7sf
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
interface-refresh:
method: POST
request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign}


Loading…
Peruuta
Tallenna