Commit 38216b96 authored by 38823's avatar 38823

Merge remote-tracking branch 'origin/remote_dev' into remote_dev

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