Przeglądaj źródła

debug 下标越界

master
PoffyZhang 1 rok temu
rodzic
commit
72460d9ce2
2 zmienionych plików z 88 dodań i 9 usunięć
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java
  2. +87
    -8
      pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java Wyświetl plik

@@ -124,7 +124,7 @@ public class HandlerManage {
if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) {
List<ProgressNode> children = currentNode.getChildren();
// 获取子流程当前审核人节点
ProgressNode subCurrentNode = children.get(children.size() - 1);
ProgressNode subCurrentNode = CollUtil.isEmpty(children) ? new ProgressNode() : children.get(children.size() - 1);
// 获取节点ID相同地审核节点
List<ProgressNode> nodeList = children.stream()
.filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId()))


+ 87
- 8
pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java Wyświetl plik

@@ -1,24 +1,31 @@
package com.ningdatech.pmapi.irs;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient;
import com.alibaba.xxpt.gateway.shared.client.http.GetClient;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HmacAuthUtil;
import com.ningdatech.pmapi.common.util.RefreshKeyUtil;
import com.ningdatech.zwdd.ZwddIntegrationProperties;
import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.client.provider.ZwddAuthClientProvider;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.NoSuchAlgorithmException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;

/**
* @Classname IrsTest
@@ -26,7 +33,13 @@ import java.util.Set;
* @Date 2023/6/26 17:42
* @Author PoffyZhang
*/
public class IrsTest {
public class IrsTest extends AppTests {

@Autowired
private ZwddAuthClient zwddAuthClient;

@Autowired
private ZwddClient zwddClient;

@Test
public void test1(){
@@ -78,4 +91,70 @@ public class IrsTest {
String areaCode = "331121";
System.out.println(CryptUtils.MD5Encode(timestamp + areaCode));
}

@Test
public void test4(){
CloseableHttpResponse response = null;
try {
String api = "/media/download";
GetClient getClient = getZwddExecutableClient().newGetClient(api);
//设置参数
getClient.addParameter("access_token", zwddClient.getAccessToken().getData());
getClient.addParameter("media_id", "$hQHNKaUCo2pwZwMGDAEN2gBAK2Z2YUVMb0xYZnFJSGRuZ1h3OVZGd3hadDNrTXlYNWlQOXF0OERrZTc0b2M5UU0xeExsUVFkalBQNFVJakZ0aA");
//调用API
//String result = getClient.get();
//System.err.println(result);
response = getClient.getB();
org.apache.http.HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
System.out.println(is);
File voice = new File("C:\\Users\\PoffyZhang\\Desktop\\log1.jpg");
OutputStream fos = new FileOutputStream(voice);
int cache = 10 * 1024;
byte[] buffer = new byte[cache];
int ch = 0;
StringBuffer sb = new StringBuffer();
while ((ch = is.read(buffer)) != -1) {
fos.write(buffer, 0, ch);
sb.append(buffer);
}
System.out.println(sb.toString());
is.close();
fos.flush();
fos.close();
} catch (Exception e) {
System.out.println(e);
}finally {
if (response != null) {
try {
//特别提醒:需要调用response的close方法关闭网络连接!!!
response.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
}

private static ExecutableClient zwddExecutableClient;
@Autowired
private ZwddIntegrationProperties zwddProperties;
public ExecutableClient getZwddExecutableClient() {
if (Objects.isNull(zwddExecutableClient)) {
synchronized (ZwddAuthClientProvider.class) {
if (Objects.isNull(zwddExecutableClient)) {
zwddExecutableClient = ExecutableClient.getInstance();
//DomainName不同环境对应不同域名,示例为sass域名
zwddExecutableClient.setDomainName(zwddProperties.getDomain());
zwddExecutableClient.setProtocal("https");
//应用App Key
zwddExecutableClient.setAccessKey(zwddProperties.getAppKey());
//应用App Secret
zwddExecutableClient.setSecretKey(zwddProperties.getAppSecret());
zwddExecutableClient.init();
}
}
}
return zwddExecutableClient;
}
}

Ładowanie…
Anuluj
Zapisz