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

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

parent 2ae5bbdd
...@@ -15,7 +15,7 @@ public class HttpPostDocQuery { ...@@ -15,7 +15,7 @@ public class HttpPostDocQuery {
postMethod.setRequestHeader("Authorization", token); postMethod.setRequestHeader("Authorization", token);
entity = new StringRequestEntity(data, "application/json", "UTF-8"); entity = new StringRequestEntity(data, "application/json", "UTF-8");
postMethod.setRequestEntity(entity); postMethod.setRequestEntity(entity);
System.out.println(data); // System.out.println(data);
httpClient.executeMethod(postMethod); httpClient.executeMethod(postMethod);
String result = postMethod.getResponseBodyAsString(); String result = postMethod.getResponseBodyAsString();
return result; return result;
......
<?xml version="1.0" encoding="UTF-8"?> <?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:service xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure> <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.io);
importPackage(java.util); 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 { try {
var sys_url_bm = $bm('cont.CON4000.get_sys_url'); var sys_url_bm = $bm('cont.CON4000.get_sys_url');
var parameter_code = 'TOKEN_POSTURL'; var parameter_code = 'TOKEN_POSTURL';
...@@ -24,57 +27,59 @@ ...@@ -24,57 +27,59 @@
var token_appsecret = SysappsecretQuery.getChildren()[0].parameter_value; var token_appsecret = SysappsecretQuery.getChildren()[0].parameter_value;
var parameter_code = 'FILE_QUERY_URL'; var parameter_code = 'FILE_QUERY_URL';
var FileQuery = sys_url_bm.queryAsMap({ var FileQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code parameter_code: parameter_code
}); });
var docUrl = FileQuery.getChildren()[0].parameter_value; var docUrl = FileQuery.getChildren()[0].parameter_value;
var token_savelogs_bm = $bm('efile.EFILE1000.efile_get_token'); var token_savelogs_bm = $bm('efile.EFILE1000.efile_get_token');
//token是否在有效期内,在有效期内直接获取表中的token //token是否在有效期内,在有效期内直接获取表中的token
var check_token_valid_bm = $bm('efile.EFILE1000.check_token_valid'); var check_token_valid_bm = $bm('efile.EFILE1000.check_token_valid');
var checkTokenQuery = check_token_valid_bm.queryAsMap(); var checkTokenQuery = check_token_valid_bm.queryAsMap();
var is_valid = checkTokenQuery.getChildren()[0].is_valid; var is_valid = checkTokenQuery.getChildren()[0].is_valid;
println('is_valid = ' + is_valid);
if (is_valid == 'true') { if (is_valid == 'true') {
println("=======有效期内======");
var SystokenQuery = token_savelogs_bm.queryAsMap(); var SystokenQuery = token_savelogs_bm.queryAsMap();
var access_token = SystokenQuery.getChildren()[0].access_token; 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 +'"' var files = '{"startCreatedDate": ' + '"' +startdate +'"'
+ ',"endCreatedDate":'+ '"' +enddate + '"' + ',"endCreatedDate":'+ '"' +enddate + '"'
+',"documentTypeCodeList": '+'["类型code1","类型code2","类型code3"]}'; +',"documentTypeCodeList": '+'["类型code3"]}';
access_token_n = 'Bearer'+ access_token; 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); 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 json_data = JSON.parse(data_result_n);
var statusCode =json_data.statusCode; var statusCode =json_data.statusCode;
var message =json_data.message; var message =json_data.message;
} else { } else {
println("=======有效期外======"); println("=======有效期外======");
var data = httpPostGetToken(posturl, token_appid, token_appsecret); var data = httpPostGetToken(posturl, token_appid, token_appsecret);
println(data); println('data = ' + data);
var json = JSON.parse(data); var json = JSON.parse(data);
var access_token = json.access_token; var access_token = json.access_token;
println('access_token = ' + access_token);
//如果获取 access_token 成功,则 不会返回 status,即 status = undefined
var status = json.status; var status = json.status;
println('status = ' + status);
if (access_token) { if (access_token) {
token_savelogs_bm.insert({ token_savelogs_bm.insert({
'json': data, 'json': data,
'status': 'success' 'status': 'success'
}) });
// 这个 expires_in 是从 access_token 接口获取过来的数据 有效持续时间
token_savelogs_bm.update({ token_savelogs_bm.update({
'system_source': 'hlcm', 'system_source': 'hlcm',
'expires_in': json.expires_in, 'expires_in': json.expires_in,
'access_token': access_token 'access_token': access_token
}) });
} }
if (status) { if (status) {
//这里为什么一个 传 json,一个传 data,可能是一样的
var token_savelogs_bm = $bm('efile.EFILE1000.token_savelogs'); var token_savelogs_bm = $bm('efile.EFILE1000.token_savelogs');
token_savelogs_bm.insert({ token_savelogs_bm.insert({
'json': json, 'json': json,
...@@ -82,23 +87,19 @@ ...@@ -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 +'"' var files = '{"startCreatedDate": ' + '"' +startdate +'"'
+ ',"endCreatedDate":'+ '"' +enddate + '"' + ',"endCreatedDate":'+ '"' +enddate + '"'
+',"documentTypeCodeList": '+'["类型code1","类型code2","类型code3"]}'; +',"documentTypeCodeList": '+'["类型code3"]}';
access_token_n = 'Bearer'+ access_token; 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); 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 json_data = JSON.parse(data_result_n);
var statusCode =json_data.statusCode; var statusCode =json_data.statusCode;
var message =json_data.message; var message =json_data.message;
println('data_result_n = ' + data_result_n);
println('data_result_n = ' + data_result_n);
}
}
} catch (e) { } catch (e) {
println('e:' + 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