|
|
@@ -2425,17 +2425,52 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
if (jdTenant == null) {
|
|
|
throw new SecurityException("当前租户未配置凭证信息");
|
|
|
}
|
|
|
+
|
|
|
+ /*ApigwConfig config = new ApigwConfig();
|
|
|
+ //设置client_id 245905
|
|
|
+ String client_id = "245905";
|
|
|
+ config.setClientID(client_id);
|
|
|
+ //设置client_secret
|
|
|
+ String client_secret = "a4ae57bc06ea205a013acbf7ec753139";
|
|
|
+ config.setClientSecret(client_secret);//
|
|
|
+ ApigwClient apigwClient = ApigwClient.getInstance();
|
|
|
+ //初始化API网关客户端
|
|
|
+ apigwClient.init(config);
|
|
|
+
|
|
|
+ //获得当天的appSecret
|
|
|
+ ApiRequest requestSecret = new ApiRequest(HttpMethod.POST_FORM, "api.kingdee.com", "/jdyconnector/app_management/push_app_authorize");
|
|
|
+ Map<String, String> querysSecret = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ querysSecret.put("outerInstanceId", "127580462150455296");
|
|
|
+
|
|
|
+ requestSecret.setQuerys(querysSecret);
|
|
|
+ ApiResult resultsSecret = ApigwClient.getInstance().send(requestSecret);
|
|
|
+
|
|
|
+ token2DTO token2DTO = JSONObject.parseObject(resultsSecret.getBody(), token2DTO.class);
|
|
|
+
|
|
|
+ //获得token
|
|
|
+ ApiRequest request = new ApiRequest(HttpMethod.GET, "api.kingdee.com", "/jdyconnector/app_management/kingdee_auth_token");
|
|
|
+
|
|
|
+ String key = token2DTO.getData().get(0).appKey;
|
|
|
+ String secret = token2DTO.getData().get(0).appSecret;
|
|
|
+
|
|
|
+ String s = MD5Util.hashMAC(key, secret);
|
|
|
+ Map<String, String> querys = new LinkedHashMap<>();
|
|
|
+ querys.put("app_key", key);
|
|
|
+ querys.put("app_signature",s);
|
|
|
+ request.setQuerys(querys);
|
|
|
+ ApiResult results = ApigwClient.getInstance().send(request);
|
|
|
+ System.out.println("金蝶返回数据======》"+results.getBody());
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(results.getBody());
|
|
|
+ System.out.println("app-token======>"+jsonObject.getJSONObject("data").getString("app-token"));*/
|
|
|
+
|
|
|
//获取测试账套token的url
|
|
|
- //String getTokenUrl="https://api.kingdee.com/auth/user/access_token";
|
|
|
String getTokenUrl = "https://api.kingdee.com/auth/user/access_token?client_id=" + jdTenant.getClientId() +
|
|
|
"&client_secret=" + jdTenant.getClientSecret() +
|
|
|
"&username=" + jdTenant.getUsername() +
|
|
|
"&password=" + jdTenant.getPassword();
|
|
|
Map<String, String> urlParams = new HashMap<>();
|
|
|
- /*urlParams.put("clientId",jdTenant.getClientId());
|
|
|
- urlParams.put("client_secret",jdTenant.getClientSecret());
|
|
|
- urlParams.put("username",jdTenant.getUsername());
|
|
|
- urlParams.put("password",jdTenant.getPassword());*/
|
|
|
+
|
|
|
String result = this.doGet(getTokenUrl, urlParams);
|
|
|
tokenDTO tokenDTO = JSONObject.parseObject(result, tokenDTO.class);
|
|
|
if (tokenDTO.errcode == 1006) {
|