修改人:邹江涛

修改内容:API映射公共单据
修改时间:2024/11/28
This commit is contained in:
zoujiangtao 2024-11-29 09:49:39 +08:00
parent 6353c79f8f
commit 2dfab2fd22
3 changed files with 10 additions and 5 deletions

View File

@ -31,7 +31,7 @@ import java.util.*;
public class ApiService {
private static final Log logger = LogFactory.getLog(ApiService.class);
public static String getBIPToken() {
public static String getBIPToken(String domainName) {
String access_token = null;
long currentTimeMillis = System.currentTimeMillis();
try {
@ -43,7 +43,7 @@ public class ApiService {
String signature = generateSignature("appKey" + appKey + "timestamp" + timestamp);
// 构建URL
String urlString = "https://biptest.ctny.com.cn/iuap-api-auth/open-auth/selfAppAuth/getAccessToken" +
String urlString = domainName + "/iuap-api-auth/open-auth/selfAppAuth/getAccessToken" +
"?appKey=22564a240d3140d0b15582aca71a748c" +
"&timestamp=" + currentTimeMillis +
"&signature=" + signature;

View File

@ -162,15 +162,19 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
}
if ("shkd_testapi".equals(itemKey)) {
String domainName = dataEntity.getString("shkd_domainname");
String url = dataEntity.getString("shkd_url");
ApiEntity apiEntity = new ApiEntity();
apiEntity.setURL(url);
apiEntity.setURL(domainName + url);
apiEntity.setMethod("POST");
Map<String, Object> headMap = new HashMap<>();
headMap.put("Content-Type", "application/json");
apiEntity.setHeaders(headMap);
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("access_token", ApiService.getBIPToken());
String old_url = "https://biptest.ctny.com.cn";
paramsMap.put("access_token", ApiService.getBIPToken(domainName));
apiEntity.setQueryParams(paramsMap);
apiEntity.setRequestBody(codeEdit.getText());
JSONObject responseBody = ApiEntity.getResponseBody(apiEntity);

View File

@ -32,7 +32,8 @@ public class ApiTestBillPlugin extends AbstractBillPlugIn implements Plugin {
String key = evt.getItemKey();
if ("shkd_token".equals(key)) {
String bipToken = ApiService.getBIPToken();
String url = this.getModel().getValue("shkd_url").toString();
String bipToken = ApiService.getBIPToken(url);
this.getView().showTipNotification(bipToken);
}