Parcourir la source

测试 接口

master
PoffyZhang il y a 1 an
Parent
révision
f9a92cf310
3 fichiers modifiés avec 61 ajouts et 2 suppressions
  1. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  3. +38
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest2.java

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java Voir le fichier

@@ -14,6 +14,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

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

/**
@@ -87,4 +89,23 @@ public class DingInfoPullController {
public String init() {
return procDefManage.init();
}

@ApiOperation(value = "系统流程配置初始化", notes = "系统流程配置初始化")
@GetMapping("/test")
public String test() throws NoSuchAlgorithmException, UnsupportedEncodingException {
String appSecret = "e066f496194540afa829c66983d4710e";
String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96";
String dataName = URLEncoder.encode("丽水市数管公司","UTF-8");
long timestamp = System.currentTimeMillis();
String sign = CryptUtils.MD5Encode(appkey + appSecret + timestamp);
String url = "https://interface.ls.local/a/api/shared/1689239219101?data_name=" + dataName + "&appKey=" + appkey +
"&sign=" + sign + "&requestTime=" + timestamp;
RestTemplate restTemplate = new RestTemplate();
log.info("url:" + url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

System.out.println(JSON.toJSONString(forEntity));

return JSON.toJSONString(forEntity);
}
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Voir le fichier

@@ -684,13 +684,13 @@ public class ProjectLibManage {
// 如果是建设方案申报后的项目,过滤掉初步方案的应用信息
if (Boolean.TRUE.equals(projectInfo.getIsConstruct())){
applicationList = applications.stream()
.filter(a -> !projectIdList.contains(a.getProjectId()))
.filter(a -> !projectIdList.contains(a.getProjectCode()))
.collect(Collectors.toList());
}
// 如果不是,展示初步方案的应用信息
else {
applicationList = applications.stream()
.filter(a -> projectIdList.contains(a.getProjectId()))
.filter(a -> projectIdList.contains(a.getProjectCode()))
.collect(Collectors.toList());
}



+ 38
- 0
pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest2.java Voir le fichier

@@ -0,0 +1,38 @@
package com.ningdatech.pmapi.irs;

import com.alibaba.fastjson.JSON;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.RefreshKeyUtil;
import org.junit.Test;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

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

/**
* @Classname IrsTest2
* @Description
* @Date 2023/7/20 10:48
* @Author PoffyZhang
*/
public class IrsTest2 {

@Test
public void test() throws UnsupportedEncodingException, NoSuchAlgorithmException {
String appSecret = "e066f496194540afa829c66983d4710e";
String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96";
String dataName = URLEncoder.encode("丽水市大数据","UTF-8");
long timestamp = System.currentTimeMillis();
String sign = CryptUtils.MD5Encode(appkey + appSecret + timestamp);
String url = "https://interface.ls.local/a/api/shared/1689239219101?data_name=" + dataName + "&appKey=" + appkey +
"&sign=" + sign + "&requestTime=" + timestamp;
RestTemplate restTemplate = new RestTemplate();
System.out.println("url:" + url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

System.out.println(JSON.toJSONString(forEntity));
}

}

Chargement…
Annuler
Enregistrer