Commit 8ec14f8f authored by TIANZHI.HU's avatar TIANZHI.HU

农行回单初始化调整 add by 39135 HuTianzhi

parent 2ae5bbdd
......@@ -15,7 +15,7 @@ public class HttpPostDocQuery {
postMethod.setRequestHeader("Authorization", token);
entity = new StringRequestEntity(data, "application/json", "UTF-8");
postMethod.setRequestEntity(entity);
System.out.println(data);
// System.out.println(data);
httpClient.executeMethod(postMethod);
String result = postMethod.getResponseBodyAsString();
return result;
......
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<s:server-script import="token_record.js;file_query.js"><![CDATA[
<s:server-script import="token_record.js"><![CDATA[
importPackage(java.io);
importPackage(java.util);
importPackage(Packages.com.hand.hlcm);
importPackage(Packages.com.hand.hlcm);
var startdate = '2022-04-01 12:30:00';
var enddate = '2023-04-01 12:30:00';
try {
var sys_url_bm = $bm('cont.CON4000.get_sys_url');
var parameter_code = 'TOKEN_POSTURL';
......@@ -24,57 +27,59 @@
var token_appsecret = SysappsecretQuery.getChildren()[0].parameter_value;
var parameter_code = 'FILE_QUERY_URL';
var FileQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var docUrl = FileQuery.getChildren()[0].parameter_value;
var parameter_code = 'FILE_QUERY_URL';
var FileQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var docUrl = FileQuery.getChildren()[0].parameter_value;
var token_savelogs_bm = $bm('efile.EFILE1000.efile_get_token');
//token是否在有效期内,在有效期内直接获取表中的token
var check_token_valid_bm = $bm('efile.EFILE1000.check_token_valid');
var checkTokenQuery = check_token_valid_bm.queryAsMap();
var is_valid = checkTokenQuery.getChildren()[0].is_valid;
println('is_valid = ' + is_valid);
if (is_valid == 'true') {
println("=======有效期内======");
var SystokenQuery = token_savelogs_bm.queryAsMap();
var access_token = SystokenQuery.getChildren()[0].access_token;
var doc_data=[];
var startdate = '2022-04-01 12:30:00';
var enddate = '2022-07-01 12:30:00';
var files = '{"startCreatedDate": ' + '"' +startdate +'"'
+ ',"endCreatedDate":'+ '"' +enddate + '"'
+',"documentTypeCodeList": '+'["类型code1","类型code2","类型code3"]}';
+',"documentTypeCodeList": '+'["类型code3"]}';
access_token_n = 'Bearer'+ access_token;
println('access_token_n' + access_token_n);
println('access_token_n = ' + access_token_n);
var data_result_n = HttpPostDocQuery.httpPostDocImport(docUrl,files,access_token_n);
println(22333333);
println('请求资料的结果:');
println('data_result_n = ' + data_result_n);
var json_data = JSON.parse(data_result_n);
var statusCode =json_data.statusCode;
var message =json_data.message;
} else {
println("=======有效期外======");
var data = httpPostGetToken(posturl, token_appid, token_appsecret);
println(data);
println('data = ' + data);
var json = JSON.parse(data);
var access_token = json.access_token;
println('access_token = ' + access_token);
//如果获取 access_token 成功,则 不会返回 status,即 status = undefined
var status = json.status;
println('status = ' + status);
if (access_token) {
token_savelogs_bm.insert({
'json': data,
'status': 'success'
})
});
// 这个 expires_in 是从 access_token 接口获取过来的数据 有效持续时间
token_savelogs_bm.update({
'system_source': 'hlcm',
'expires_in': json.expires_in,
'access_token': access_token
})
});
}
if (status) {
//这里为什么一个 传 json,一个传 data,可能是一样的
var token_savelogs_bm = $bm('efile.EFILE1000.token_savelogs');
token_savelogs_bm.insert({
'json': json,
......@@ -82,23 +87,19 @@
});
}
var doc_data=[];
var startdate = '2022-04-01 12:30:00';
var enddate = '2022-07-01 12:30:00';
var files = '{"startCreatedDate": ' + '"' +startdate +'"'
+ ',"endCreatedDate":'+ '"' +enddate + '"'
+',"documentTypeCodeList": '+'["类型code1","类型code2","类型code3"]}';
+',"documentTypeCodeList": '+'["类型code3"]}';
access_token_n = 'Bearer'+ access_token;
println('access_token_n' + access_token_n);
println('access_token_n = ' + access_token_n);
var data_result_n = HttpPostDocQuery.httpPostDocImport(docUrl,files,access_token_n);
println(22333333);
println('请求资料的结果:');
println('data_result_n = ' + data_result_n);
var json_data = JSON.parse(data_result_n);
var statusCode =json_data.statusCode;
var message =json_data.message;
println('data_result_n = ' + data_result_n);
println('data_result_n = ' + data_result_n);
}
}
} catch (e) {
println('e:' + e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment