Commit 7117cfc1 authored by 陆正友's avatar 陆正友

农行LSC代码格式化

parent dc3bac9b
<?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" <a:service xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script"
trace="true"> trace="true">
<a:init-procedure> <a:init-procedure>
<s:server-script import="token_record.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);
importPackage(Packages.com.hand.hl); importPackage(Packages.com.hand.hl);
var logger = $logger('server-script'); var logger = $logger('server-script');
function query_next_query(batch_id){ function query_next_query(batch_id) {
send_query(batch_id); send_query(batch_id);
} }
function send_query (batch_id){ function send_query(batch_id) {
// 获取当前日期 // 获取当前日期
var currentDate = new Date(); var currentDate = new Date();
// 设置开始时间为明天的凌晨整点 // 设置开始时间为明天的凌晨整点
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
// 提取开始时间的日期部分 // 提取开始时间的日期部分
var starttime = startdate_n.toISOString().slice(0, 10); var starttime = startdate_n.toISOString().slice(0, 10);
//var starttime = '2023-12-13'; //var starttime = '2023-12-13';
var att_import_bank_bm=$bm('efile.EFILE1100.att_import_bank'); var att_import_bank_bm = $bm('efile.EFILE1100.att_import_bank');
var att_import_bank_trx_bm=$bm('efile.EFILE1100.att_import_bank_trx'); var att_import_bank_trx_bm = $bm('efile.EFILE1100.att_import_bank_trx');
var init_page_number=100; //每次请求当前页条数 var init_page_number = 100; //每次请求当前页条数
try { try {
var sys_url_bm = $bm('cont.CON4000.get_sys_url'); var sys_url_bm = $bm('cont.CON4000.get_sys_url');
...@@ -73,9 +73,9 @@ ...@@ -73,9 +73,9 @@
var parameter_code = starttime; var parameter_code = starttime;
var response_json_list = bank_list_bm.queryAsMap({ var response_json_list = bank_list_bm.queryAsMap({
parameter_code: parameter_code, parameter_code: parameter_code,
batch_id : batch_id batch_id: batch_id
}); });
var list =response_json_list.getChildren().length; var list = response_json_list.getChildren().length;
var record = response_json_list.getChildren(); var record = response_json_list.getChildren();
logger.info(typeof (record)); logger.info(typeof (record));
...@@ -90,40 +90,40 @@ ...@@ -90,40 +90,40 @@
println("=======有效期内======"); 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 files = '{"startCreatedDate": ' + '"' +startdate +'"' var files = '{"startCreatedDate": ' + '"' + startdate + '"'
+ ',"endCreatedDate":'+ '"' +enddate + '"' + ',"endCreatedDate":' + '"' + enddate + '"'
+',"documentTypeCodeList": '+'["receiptD"]}'; + ',"documentTypeCodeList": ' + '["receiptD"]}';
access_token = access_token; access_token = access_token;
var request_files_n = files + access_token + token_type ; var request_files_n = files + access_token + token_type;
var request_files = JSON.stringify(request_files_n); var request_files = JSON.stringify(request_files_n);
var token_type = token_type; var token_type = token_type;
var page_number = 1; var page_number = 1;
if(list==0){ if (list == 0) {
// 说明当前没有发起查询,从第一页开始查 // 说明当前没有发起查询,从第一页开始查
page_number=1; page_number = 1;
} else{ } else {
if(record[0].RETURN_PAGE_SIZE>=record[0].PAGE_SIZE){ if (record[0].RETURN_PAGE_SIZE >= record[0].PAGE_SIZE) {
page_number=record[0].PAGE_NUMBER+1; page_number = record[0].PAGE_NUMBER + 1;
} else {
page_number = record[0].PAGE_NUMBER;
} }
else{
page_number=record[0].PAGE_NUMBER;
} }
}; ;
var page = page_number; var page = page_number;
var size = init_page_number; var size = init_page_number;
var doc = "http://apistage.huilianyi.com/gateway/e-archives/api/open/v1/documents/query?page=" + page + var doc = "http://apistage.huilianyi.com/gateway/e-archives/api/open/v1/documents/query?page=" + page +
"&size="+size; "&size=" + size;
var docUrl = doc.toString(); var docUrl = doc.toString();
att_import_bank_bm.insert({ att_import_bank_bm.insert({
'start_date' : startdate, 'start_date': startdate,
'end_date' : enddate, 'end_date': enddate,
'request_json' : request_files, 'request_json': request_files,
'page_number' : page_number, 'page_number': page_number,
'request_url' : docUrl 'request_url': docUrl
}) })
var bank_list_bm = $bm('efile.EFILE1100.get_bank_list'); var bank_list_bm = $bm('efile.EFILE1100.get_bank_list');
...@@ -131,12 +131,12 @@ ...@@ -131,12 +131,12 @@
var response_json_list = bank_list_bm.queryAsMap({ var response_json_list = bank_list_bm.queryAsMap({
parameter_code: parameter_code parameter_code: parameter_code
}); });
var list =response_json_list.getChildren().length; var list = response_json_list.getChildren().length;
var record = response_json_list.getChildren(); var record = response_json_list.getChildren();
logger.info(typeof (record)); logger.info(typeof (record));
var doc_import=new com.hand.hlcm.HttpPostDocQuery(); var doc_import = new com.hand.hlcm.HttpPostDocQuery();
var data_result_n = doc_import.httpPostDocImport(docUrl,files,access_token,token_type); var data_result_n = doc_import.httpPostDocImport(docUrl, files, access_token, token_type);
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;
...@@ -145,18 +145,18 @@ ...@@ -145,18 +145,18 @@
$ctx.parameter.page_number = page_number; $ctx.parameter.page_number = page_number;
$ctx.parameter.total = total; $ctx.parameter.total = total;
var result=json_data.result; var result = json_data.result;
// var result_list=JSON.stringify(result); // var result_list=JSON.stringify(result);
var result_list = result.length; var result_list = result.length;
var return_page_size = JSON.stringify(result_list); var return_page_size = JSON.stringify(result_list);
att_import_bank_bm.update({ att_import_bank_bm.update({
'code' : statusCode, 'code': statusCode,
'message' : message, 'message': message,
'response_json' : data_result_n, 'response_json': data_result_n,
'return_page_size' : return_page_size, 'return_page_size': return_page_size,
'page_size' : size, 'page_size': size,
'slip_batch_id' : record[0].SLIP_BATCH_ID 'slip_batch_id': record[0].SLIP_BATCH_ID
}) })
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
} }
} else { } else {
println("=======有效期外======"); println("=======有效期外======");
var token_get=new com.hand.hlcm.HttpPostUtil(); var token_get = new com.hand.hlcm.HttpPostUtil();
var data = token_get.httpPostGetToken(posturl, token_appid, token_appsecret); var data = token_get.httpPostGetToken(posturl, token_appid, token_appsecret);
println('data = ' + data); println('data = ' + data);
var json = JSON.parse(data); var json = JSON.parse(data);
...@@ -222,40 +222,40 @@ ...@@ -222,40 +222,40 @@
logger.info('--------------------------------------------------------------------------------------------'); logger.info('--------------------------------------------------------------------------------------------');
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 files = '{"startCreatedDate": ' + '"' +startdate +'"' var files = '{"startCreatedDate": ' + '"' + startdate + '"'
+ ',"endCreatedDate":'+ '"' +enddate + '"' + ',"endCreatedDate":' + '"' + enddate + '"'
+',"documentTypeCodeList": '+'["receiptD"]}'; + ',"documentTypeCodeList": ' + '["receiptD"]}';
access_token = access_token; access_token = access_token;
var request_files_n = files + access_token + token_type ; var request_files_n = files + access_token + token_type;
var request_files = JSON.stringify(request_files_n); var request_files = JSON.stringify(request_files_n);
var token_type = token_type; var token_type = token_type;
var page_number = 1; var page_number = 1;
if(list==0){ if (list == 0) {
// 说明当前没有发起查询,从第一页开始查 // 说明当前没有发起查询,从第一页开始查
page_number=1; page_number = 1;
} else{ } else {
if(record[0].RETURN_PAGE_SIZE>=record[0].PAGE_SIZE){ if (record[0].RETURN_PAGE_SIZE >= record[0].PAGE_SIZE) {
page_number=record[0].PAGE_NUMBER+1; page_number = record[0].PAGE_NUMBER + 1;
} else {
page_number = record[0].PAGE_NUMBER;
} }
else{
page_number=record[0].PAGE_NUMBER;
} }
}; ;
var page = page_number; var page = page_number;
var size = init_page_number; var size = init_page_number;
var doc = "http://apistage.huilianyi.com/gateway/e-archives/api/open/v1/documents/query?page=" + page + var doc = "http://apistage.huilianyi.com/gateway/e-archives/api/open/v1/documents/query?page=" + page +
"&size="+size; "&size=" + size;
var docUrl = doc.toString(); var docUrl = doc.toString();
att_import_bank_bm.insert({ att_import_bank_bm.insert({
'start_date' : startdate, 'start_date': startdate,
'end_date' : enddate, 'end_date': enddate,
'request_json' : request_files, 'request_json': request_files,
'page_number' : page_number, 'page_number': page_number,
'request_url' : docUrl 'request_url': docUrl
}) })
...@@ -264,12 +264,12 @@ ...@@ -264,12 +264,12 @@
var response_json_list = bank_list_bm.queryAsMap({ var response_json_list = bank_list_bm.queryAsMap({
parameter_code: parameter_code parameter_code: parameter_code
}); });
var list =response_json_list.getChildren().length; var list = response_json_list.getChildren().length;
var record = response_json_list.getChildren(); var record = response_json_list.getChildren();
logger.info(typeof (record)); logger.info(typeof (record));
var doc_import=new com.hand.hlcm.HttpPostDocQuery(); var doc_import = new com.hand.hlcm.HttpPostDocQuery();
var data_result_n = doc_import.httpPostDocImport(docUrl,files,access_token,token_type); var data_result_n = doc_import.httpPostDocImport(docUrl, files, access_token, token_type);
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;
...@@ -278,21 +278,21 @@ ...@@ -278,21 +278,21 @@
$ctx.parameter.page_number = page_number; $ctx.parameter.page_number = page_number;
$ctx.parameter.total = total; $ctx.parameter.total = total;
var result=json_data.result; var result = json_data.result;
var result_list = result.length; var result_list = result.length;
var return_page_size = JSON.stringify(result_list); var return_page_size = JSON.stringify(result_list);
att_import_bank_bm.update({ att_import_bank_bm.update({
'code' : statusCode, 'code': statusCode,
'message' : message, 'message': message,
'response_json' : data_result_n, 'response_json': data_result_n,
'return_page_size' : return_page_size, 'return_page_size': return_page_size,
'page_size' : size, 'page_size': size,
'slip_batch_id' : record[0].SLIP_BATCH_ID, 'slip_batch_id': record[0].SLIP_BATCH_ID,
}) })
for (var i = 0; i < result_list;i++) { for (var i = 0; i < result_list; i++) {
var docFormFieldValueVOList = result[i].docFormFieldValueVOList; var docFormFieldValueVOList = result[i].docFormFieldValueVOList;
var fieldValueMap = {}; var fieldValueMap = {};
...@@ -322,27 +322,27 @@ ...@@ -322,27 +322,27 @@
} }
} }
} }
}catch (e) { } catch (e) {
println('e:' + e); println('e:' + e);
} }
if (total/100>page_number){ if (total / 100 > page_number) {
var batch_id = record[0].SLIP_BATCH_ID; var batch_id = record[0].SLIP_BATCH_ID;
logger.info('19981988'); logger.info('19981988');
logger.info(batch_id); logger.info(batch_id);
logger.info('19981988'); logger.info('19981988');
query_next_query(batch_id); query_next_query(batch_id);
} }
} }
function main(){ function main() {
send_query(); send_query();
} }
main(); main();
]]> ]]>
</s:server-script> </s:server-script>
</a:init-procedure> </a:init-procedure>
<a:service-output output="/parameter"/> <a:service-output output="/parameter"/>
</a:service> </a:service>
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