Commit ee407452 authored by 陆正友's avatar 陆正友

农行回单匹配规则调整 及git完善

parent e1a98242
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<bm:field name="bp_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS"/> <bm:field name="bp_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS"/>
<bm:field name="bp_class_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS_NAME"/> <bm:field name="bp_class_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS_NAME"/>
<bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG"/> <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG"/>
<bm:field name="extra_nam" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXTRA_NAM"/>
<!--<bm:field name="id_card_no" displayWidth="200" forDisplay="true" prompt="身份证"/>--> <!--<bm:field name="id_card_no" displayWidth="200" forDisplay="true" prompt="身份证"/>-->
</bm:fields> </bm:fields>
<bm:features> <bm:features>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
p_payer_number =>${@payer_number}, p_payer_number =>${@payer_number},
p_bank_name =>${@bank_name}, p_bank_name =>${@bank_name},
p_beneficiary_name =>${@beneficiary_name}, p_beneficiary_name =>${@beneficiary_name},
p_bp_id =>${@bp_id},
p_total_amount =>${@total_amount}, p_total_amount =>${@total_amount},
p_import_itfc_id =>${@import_itfc_id}); p_import_itfc_id =>${@import_itfc_id});
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
p_response_json => ${@response_json}, p_response_json => ${@response_json},
p_return_page_size => ${@return_page_size}, p_return_page_size => ${@return_page_size},
p_page_size => ${@page_size}, p_page_size => ${@page_size},
p_user_id =>${/session/@user_id} p_user_id =>${/session/@user_id},
p_slip_batch_id => ${@slip_batch_id}
); );
END; END;
]]> ]]>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
SELECT * SELECT *
FROM hlcm_ele_abc_bank_slip_bacth b FROM hlcm_ele_abc_bank_slip_bacth b
WHERE b.start_date = TO_DATE('${:@parameter_code}', 'YYYY-MM-DD') WHERE b.start_date = TO_DATE('${:@parameter_code}', 'YYYY-MM-DD')
ORDER BY b.slip_batch_id desc
]]></bm:query-sql> ]]></bm:query-sql>
</bm:operation> </bm:operation>
</bm:operations> </bm:operations>
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
<a:link id="csh_abc_import_transaction_link" <a:link id="csh_abc_import_transaction_link"
url="${/request/@context_path}/modules/csh/CSH1400/csh_abc_import_transaction.lsc"/> url="${/request/@context_path}/modules/csh/CSH1400/csh_abc_import_transaction.lsc"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
Leaf.onReady(function () { Leaf.onReady(function () {
//只开放按钮权限给债权内勤 //只开放按钮权限给债权内勤
var role_code = '${/model/role_code/record/@role_code}'; var role_code = '${/model/role_code/record/@role_code}';
...@@ -30,7 +29,6 @@ ...@@ -30,7 +29,6 @@
} }
}); });
function returnAbc() { function returnAbc() {
// 刷新页面 // 刷新页面
$("OcrQueryDs").query(); $("OcrQueryDs").query();
...@@ -48,13 +46,15 @@ ...@@ -48,13 +46,15 @@
$("AbcBankDs").query(); $("AbcBankDs").query();
} }
// 背景渲染农行回单 // var record = $('OcrQueryDs').getSelected();
// var record = $('AbcBankDs').getSelected();
function change_background_color(record) { function change_background_color(record) {
if (record.get('re_flag') == 'Y') { if (record.get('re_flag') == 'Y') {
return 'background-color:#DC143C;' return 'background-color:#DC143C;'
} }
} }
// 字段渲染农行回单 // 字段渲染农行回单
function checkOcrRender(value, record, name) { function checkOcrRender(value, record, name) {
if (record.get('re_flag') == 'Y' && !Ext.isEmpty(value)) { if (record.get('re_flag') == 'Y' && !Ext.isEmpty(value)) {
...@@ -87,18 +87,14 @@ ...@@ -87,18 +87,14 @@
return '<font color="black">' + value + '</font>' return '<font color="black">' + value + '</font>'
} }
} }
} }
} }
// 保存按钮 // 保存按钮
function agricultural_bank_save() { function agricultural_bank_save() {
var orc_save = $('AbcBankDs').getSelected(); var orc_save = $('AbcBankDs').getAll();
var param = {}; var param = {};
var saveOrc = []; var saveOrc = [];
if (orc_save.length <= 0) {
Leaf.showMessage('提示', '请至少选择一条数据!');
} else {
for (var i = 0; i < orc_save.length; i++) { for (var i = 0; i < orc_save.length; i++) {
var lineOrc = {}; var lineOrc = {};
lineOrc['receipt_no'] = orc_save[i].get('receipt_no'); lineOrc['receipt_no'] = orc_save[i].get('receipt_no');
...@@ -113,6 +109,7 @@ ...@@ -113,6 +109,7 @@
lineOrc['bank_name'] = orc_save[i].get('bank_name'); lineOrc['bank_name'] = orc_save[i].get('bank_name');
lineOrc['beneficiary_name'] = orc_save[i].get('beneficiary_name'); lineOrc['beneficiary_name'] = orc_save[i].get('beneficiary_name');
lineOrc['total_amount'] = orc_save[i].get('total_amount'); lineOrc['total_amount'] = orc_save[i].get('total_amount');
lineOrc['bp_id'] = orc_save[i].get('bp_id');
saveOrc.push(lineOrc); saveOrc.push(lineOrc);
} }
param['AbcOrc'] = saveOrc; param['AbcOrc'] = saveOrc;
...@@ -130,17 +127,12 @@ ...@@ -130,17 +127,12 @@
}, },
scope: this scope: this
}); });
} // }
} }
// function btn001_renderer_button_authority_detail(value, record, name) {
// if (record.isNew==true){
// return Leaf.showMessage('提示', '请至少选择一条数据!');
// }
// }
// 提交按钮 // 提交按钮
function agricultural_bank_submit(ro) { function agricultural_bank_submit() {
var orc_save = $('AbcBankDs').getSelected(); var orc_save = $('AbcBankDs').getSelected();
var abc_save = $('OcrQueryDs').getSelected(); var abc_save = $('OcrQueryDs').getSelected();
var param = {}; var param = {};
...@@ -176,8 +168,8 @@ ...@@ -176,8 +168,8 @@
recode = orc_save[i]; recode = orc_save[i];
} }
param['AbcOrc'] = saveOrc; param['AbcOrc'] = saveOrc;
if (recode.get('re_flag') == 'N') { if(recode.get('re_flag')=='N'){
Leaf.showConfirm('特别注意', '日志号, <font color="red">' + recode.get('receipt_no') + '</font>,的单据未匹配到对应回单数据,是否确认提交?', function () { Leaf.showConfirm('特别注意', '日志号, <font color="red">'+recode.get('receipt_no')+'</font>,的单据未匹配到对应回单数据,是否确认提交?', function () {
Leaf.request({ Leaf.request({
url: $('csh_abc_import_transaction_link').getUrl(), url: $('csh_abc_import_transaction_link').getUrl(),
para: { para: {
...@@ -195,7 +187,7 @@ ...@@ -195,7 +187,7 @@
scope: this scope: this
}); });
}); });
} else { }else {
Leaf.request({ Leaf.request({
url: $('csh_abc_import_transaction_link').getUrl(), url: $('csh_abc_import_transaction_link').getUrl(),
para: { para: {
...@@ -208,12 +200,14 @@ ...@@ -208,12 +200,14 @@
}); });
$('AbcBankDs').query(); $('AbcBankDs').query();
$("OcrQueryDs").query(); $("OcrQueryDs").query();
// returnBack(); //returnBack();
}, },
scope: this scope: this
}); });
} }
} }
if (abc_save.length > 0) { if (abc_save.length > 0) {
Leaf.showMessage('提示', '农行回单OCR页面的单据无法提交!'); Leaf.showMessage('提示', '农行回单OCR页面的单据无法提交!');
} }
...@@ -231,7 +225,12 @@ ...@@ -231,7 +225,12 @@
width: 430, width: 430,
height: 390 height: 390
}); });
// win.on('close', function () {
// debugger
// var createWin = $('agricultural_bank_import');
// createWin.close();
// returnAbc();
// });
} }
...@@ -270,13 +269,16 @@ ...@@ -270,13 +269,16 @@
displayField="code_value_name" returnField="collection_classes" valueField="code_value"/> displayField="code_value_name" returnField="collection_classes" valueField="code_value"/>
<a:field name="collection_classes"/> <a:field name="collection_classes"/>
<a:field name="beneficiary_name" lovGridHeight="350" lovHeight="500" lovLabelWidth="90" <a:field name="beneficiary_name" lovGridHeight="350" lovHeight="500" lovLabelWidth="90"
lovService="basic.hls_bp_master_v_for_agent_lov" lovWidth="550" title="HLS.BP_TITLE"> lovService="basic.hls_bp_master_v_for_agent_lov" lovWidth="550" title="HLS.BP_TITLE">
<a:mapping> <a:mapping>
<a:map from="bp_name" to="beneficiary_name"/> <a:map from="bp_name" to="beneficiary_name"/>
<a:map from="bp_id" to="bp_id"/>
<a:map from="extra_nam" to="extra_nam"/>
</a:mapping> </a:mapping>
</a:field> </a:field>
</a:fields> </a:fields>
</a:dataSet> </a:dataSet>
...@@ -307,24 +309,18 @@ ...@@ -307,24 +309,18 @@
<a:tabs> <a:tabs>
<a:tab prompt="OCR数据" width="110"> <a:tab prompt="OCR数据" width="110">
<a:grid id="ocr" bindTarget="OcrQueryDs" marginHeight="200" marginWidth="80" navBar="true" <a:grid id="ocr" bindTarget="OcrQueryDs" marginHeight="200" marginWidth="80" navBar="true" rowRenderer="change_background_color">
rowRenderer="change_background_color">
<a:columns> <a:columns>
<a:column name="bank_num" prompt="收款账号" width="150" align="center" <a:column name="bank_num" prompt="收款账号" width="150" align="center" renderer="checkOcrRender"/>
renderer="checkOcrRender"/>
<a:column name="bank_receipt_date" prompt="交易时间" width="100" align="center" <a:column name="bank_receipt_date" prompt="交易时间" width="100" align="center"
renderer="checkOcrRender"/> renderer="checkOcrRender"/>
<a:column name="receipt_no" prompt="回单编号" width="80" align="left"/> <a:column name="receipt_no" prompt="回单编号" width="80" align="left"/>
<a:column name="payer_number" prompt="付款方账号" width="100" align="center" <a:column name="payer_number" prompt="付款方账号" width="100" align="center" renderer="checkOcrRender"/>
renderer="checkOcrRender"/> <a:column name="payer_name" prompt="付款方户名" width="100" align="left" renderer="checkOcrRender"/>
<a:column name="payer_name" prompt="付款方户名" width="100" align="left" <a:column name="payer_bank" prompt="付款方开户行" width="100" align="left" renderer="checkOcrRender"/>
renderer="checkOcrRender"/>
<a:column name="payer_bank" prompt="付款方开户行" width="100" align="left"
renderer="checkOcrRender"/>
<a:column name="bp_name" prompt="收款对象" width="100" align="left"/> <a:column name="bp_name" prompt="收款对象" width="100" align="left"/>
<a:column name="paid_byother_flag_desc" prompt="是否代付" width="70" align="center"/> <a:column name="paid_byother_flag_desc" prompt="是否代付" width="70" align="center"/>
<a:column name="total_amount" prompt="金额" width="100" align="right" <a:column name="total_amount" prompt="金额" width="100" align="right" renderer="checkOcrRender"/>
renderer="checkOcrRender"/>
<a:column name="zy" prompt="摘要" width="80" align="center"/> <a:column name="zy" prompt="摘要" width="80" align="center"/>
<a:column name="collection_classes_desc" prompt="款项分类" width="90" align="center"/> <a:column name="collection_classes_desc" prompt="款项分类" width="90" align="center"/>
<a:column name="remark" prompt="附言" width="80" align="center"/> <a:column name="remark" prompt="附言" width="80" align="center"/>
...@@ -334,30 +330,28 @@ ...@@ -334,30 +330,28 @@
</a:columns> </a:columns>
</a:grid> </a:grid>
</a:tab> </a:tab>
<a:tab prompt="农行回单" width="110"> <a:tab prompt="农行导入" width="110">
<a:grid id="abc_bank" bindTarget="AbcBankDs" marginHeight="200" marginWidth="80" <a:grid id="abc_bank" bindTarget="AbcBankDs" marginHeight="200" marginWidth="80"
rowRenderer="change_background_color" navBar="true"> rowRenderer="change_background_color" navBar="true">
<a:columns> <a:columns>
<a:column name="bank_num" prompt="账号" width="150" align="center" <a:column name="bank_num" prompt="账号" width="150" align="center"
renderer="checkOcrRender"/> renderer="checkOcrRender"/>
<a:column name="bank_receipt_date" prompt="交易时间" width="100" <a:column name="bank_receipt_date" prompt="交易时间" width="100"
renderer="checkOcrRender" align="center"/> renderer="checkOcrRender" align="center"/>
<a:column name="receipt_no" prompt="日志号" width="80" align="left"/> <a:column name="receipt_no" prompt="日志号" width="80" align="left"/>
<a:column name="payer_number" prompt="对方账号" width="100" align="center" <a:column name="payer_number" prompt="对方账号" width="100" align="center" renderer="checkOcrRender"/>
<a:column name="payer_name" prompt="对方账号户名" width="100" align="left"
renderer="checkOcrRender"/> renderer="checkOcrRender"/>
<a:column name="payer_name" prompt="对方账号户名" width="100" align="left" <a:column name="bank_name" prompt="对方银行名称" width="100" align="left"
renderer="checkOcrRender"
required="true"/>
<a:column name="bank_name" prompt="对方银行名称" width="100" align="left"
renderer="checkOcrRender"/> renderer="checkOcrRender"/>
<a:column name="beneficiary_name" prompt="收款对象" width="100" editor="grid_lov" <a:column name="beneficiary_name" prompt="收款对象" width="100" editor="grid_lov" align="left" required="true"/>
align="left"/> <a:column name="bp_id" prompt="收款对象" />
<a:column name="paid_byother_flag_desc" prompt="是否代付" width="70" editor="grid_cb" <a:column name="paid_byother_flag_desc" prompt="是否代付" width="70" editor="grid_cb"
required="true" required="true"
align="center"/> align="center"/>
<a:column name="total_amount" prompt="收款金额" width="100" align="right" <a:column name="total_amount" prompt="收款金额" width="100" align="right"
renderer="checkOcrRender"/> renderer="checkOcrRender"/>
<a:column name="zy" prompt="摘要" width="80" align="center"/> <a:column name="zy" prompt="摘要" width="80" align="center"/>
<a:column name="collection_classes_desc" prompt="款项分类" width="90" editor="grid_cb" <a:column name="collection_classes_desc" prompt="款项分类" width="90" editor="grid_cb"
required="true" required="true"
align="center"/> align="center"/>
......
<?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;bank_import.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 logger = $logger('server-script'); importPackage(Packages.com.hand.hl);
var logger = $logger('server-script');
// 获取当前日期
var currentDate = new Date(); // 获取当前日期
// 设置开始时间为明天的凌晨整点(目标时区为UTC) var currentDate = new Date();
var startdate_n = new Date(Date.UTC(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() // 设置开始时间为明天的凌晨整点
, 0, 0, 0)); var startdate_n = new Date(Date.UTC(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()
, 0, 0, 0));
// 设置结束时间为后天的凌晨整点(目标时区为UTC)
var enddate_n = new Date(Date.UTC(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() + // 设置结束时间为后天的凌晨整点
1, 0, 0, 0)); var enddate_n = new Date(Date.UTC(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() +
1, 0, 0, 0));
// 格式化日期为字符串
var startdate = startdate_n.toISOString().slice(0, 19).replace('T', ' '); // 格式化日期为字符串
var enddate = enddate_n.toISOString().slice(0, 19).replace('T', ' '); var startdate = startdate_n.toISOString().slice(0, 19).replace('T', ' ');
// 提取开始时间的日期部分 var enddate = enddate_n.toISOString().slice(0, 19).replace('T', ' ');
var starttime = startdate_n.toISOString().slice(0, 10); //var startdate = '2023-12-13 00:00:00';
//var enddate = '2023-12-20 00:00:00';
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 starttime = startdate_n.toISOString().slice(0, 10);
var init_page_number=20; //每次请求当前页条数 //var starttime = '2023-12-13';
var att_import_bank_bm=$bm('efile.EFILE1100.att_import_bank');
try { var att_import_bank_trx_bm=$bm('efile.EFILE1100.att_import_bank_trx');
var sys_url_bm = $bm('cont.CON4000.get_sys_url'); var init_page_number=20; //每次请求当前页条数
var parameter_code = 'TOKEN_POSTURL';
var SysposturlQuery = sys_url_bm.queryAsMap({ try {
parameter_code: parameter_code var sys_url_bm = $bm('cont.CON4000.get_sys_url');
}); var parameter_code = 'TOKEN_POSTURL';
var posturl = SysposturlQuery.getChildren()[0].parameter_value; var SysposturlQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
var parameter_code = 'TOKEN_APPID'; });
var SysappidQuery = sys_url_bm.queryAsMap({ var posturl = SysposturlQuery.getChildren()[0].parameter_value;
parameter_code: parameter_code
}); var parameter_code = 'TOKEN_APPID';
var token_appid = SysappidQuery.getChildren()[0].parameter_value; var SysappidQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
var parameter_code = 'TOKEN_APPSECRET'; });
var SysappsecretQuery = sys_url_bm.queryAsMap({ var token_appid = SysappidQuery.getChildren()[0].parameter_value;
parameter_code: parameter_code
}); var parameter_code = 'TOKEN_APPSECRET';
var token_appsecret = SysappsecretQuery.getChildren()[0].parameter_value; var SysappsecretQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
var parameter_code = 'OCR_AGRICULTURAL_BANK'; });
var FileQuery = sys_url_bm.queryAsMap({ var token_appsecret = SysappsecretQuery.getChildren()[0].parameter_value;
parameter_code: parameter_code
}); var parameter_code = 'OCR_AGRICULTURAL_BANK';
var docUrl = FileQuery.getChildren()[0].parameter_value; var FileQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
var parameter_code = 'TOKEN_TYPE'; });
var tokenTypeyQuery = sys_url_bm.queryAsMap({ var docUrl = FileQuery.getChildren()[0].parameter_value;
parameter_code: parameter_code
}); var parameter_code = 'TOKEN_TYPE';
var token_type = tokenTypeyQuery.getChildren()[0].parameter_value; var tokenTypeyQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
var bank_list_bm = $bm('efile.EFILE1100.get_bank_list'); });
var parameter_code = starttime; var token_type = tokenTypeyQuery.getChildren()[0].parameter_value;
var response_json_list = bank_list_bm.queryAsMap({
parameter_code: parameter_code var bank_list_bm = $bm('efile.EFILE1100.get_bank_list');
}); var parameter_code = starttime;
var list =response_json_list.getChildren().length; var response_json_list = bank_list_bm.queryAsMap({
var record = response_json_list.getChildren(); parameter_code: parameter_code
logger.info(typeof (record)); });
var list =response_json_list.getChildren().length;
var token_savelogs_bm = $bm('efile.EFILE1000.efile_get_token'); var record = response_json_list.getChildren();
//token是否在有效期内,在有效期内直接获取表中的token logger.info(typeof (record));
var check_token_valid_bm = $bm('efile.EFILE1000.check_token_valid');
var checkTokenQuery = check_token_valid_bm.queryAsMap(); var token_savelogs_bm = $bm('efile.EFILE1000.efile_get_token');
var is_valid = checkTokenQuery.getChildren()[0].is_valid; //token是否在有效期内,在有效期内直接获取表中的token
println('is_valid = ' + is_valid); var check_token_valid_bm = $bm('efile.EFILE1000.check_token_valid');
var checkTokenQuery = check_token_valid_bm.queryAsMap();
if (is_valid == 'true') { var is_valid = checkTokenQuery.getChildren()[0].is_valid;
println("=======有效期内======"); println('is_valid = ' + is_valid);
var SystokenQuery = token_savelogs_bm.queryAsMap();
var access_token = SystokenQuery.getChildren()[0].access_token; if (is_valid == 'true') {
var files = '{"startCreatedDate": ' + '"' +startdate +'"' println("=======有效期内======");
var SystokenQuery = token_savelogs_bm.queryAsMap();
var access_token = SystokenQuery.getChildren()[0].access_token;
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{ else{
page_number=record[0].PAGE_NUMBER; 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();
let p_user_id;
var userid = p_user_id; 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
'p_user_id': userid })
})
var bank_list_bm = $bm('efile.EFILE1100.get_bank_list'); var bank_list_bm = $bm('efile.EFILE1100.get_bank_list');
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
}); });
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 data = new com.hand.hlcm.HttpPostDocQuery();
var data_result_n = httpPostDocImportBank(docUrl,files,access_token,token_type); var doc_import=new com.hand.hlcm.HttpPostDocQuery();
var json_data = JSON.parse(data_result_n); var data_result_n = doc_import.httpPostDocImport(docUrl,files,access_token,token_type);
var statusCode = json_data.statusCode; var json_data = JSON.parse(data_result_n);
var message = json_data.message; var statusCode = json_data.statusCode;
var total = json_data.total; var message = json_data.message;
var total = json_data.total;
var result=json_data.result;
var result_list = result.length; var result=json_data.result;
var return_page_size = JSON.stringify(result_list); // var result_list=JSON.stringify(result);
var result_list = result.length;
att_import_bank_bm.update({ var return_page_size = JSON.stringify(result_list);
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
})
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;
if(result[i].docFormFieldValueVOList[2].fieldValue=='中国农业银行' var fieldValueMap = {};
&& result[i].docFormFieldValueVOList[2].fieldValue != null){ // 构建字段映射
var receipt_no = docFormFieldValueVOList[0].fieldValue; for (var j = 0; j < docFormFieldValueVOList.length; j++) {
var modified_receipt_no = receipt_no.substring(4, 13); var fieldCode = docFormFieldValueVOList[j].fieldCode;
att_import_bank_trx_bm.insert({ var fieldValue = docFormFieldValueVOList[j].fieldValue;
'doc_code' : docFormFieldValueVOList[0].fieldValue,//单据编号 fieldValueMap[fieldCode] = fieldValue;
'receipt_no' : modified_receipt_no,//银行流水号
'bank_name' : docFormFieldValueVOList[2].fieldValue,//回单银行名称
'beneficiary_name' : docFormFieldValueVOList[3].fieldValue,//收款方户名
'bank_num' : docFormFieldValueVOList[4].fieldValue,//收款方账号
'beneficiary_bank' : docFormFieldValueVOList[5].fieldValue,//收款方银行
'payer_name' : docFormFieldValueVOList[6].fieldValue,//付款方户名
'payer_number' : docFormFieldValueVOList[7].fieldValue,//付款方账号
'payer_bank' : docFormFieldValueVOList[8].fieldValue,//付款方银行
'bank_receipt_date' : docFormFieldValueVOList[9].fieldValue,//回单日期
'total_amount' : docFormFieldValueVOList[10].fieldValue,//金额
'purpose' : docFormFieldValueVOList[11].fieldValue,//用途
'remark' : docFormFieldValueVOList[12].fieldValue,//备注
'zy' : docFormFieldValueVOList[13].fieldValue,//摘要
'business_type' :docFormFieldValueVOList[14].fieldValue,//业务类型
'contract1' : docFormFieldValueVOList[15].fieldValue,//合同号
'gl_code' : docFormFieldValueVOList[16].fieldValue,//营业系统凭证号
'agencycode' : docFormFieldValueVOList[17].fieldValue,//代理店编号
'client' : docFormFieldValueVOList[18].fieldValue,//客户
'preprocess_code' :docFormFieldValueVOList[19].fieldValue,//SBO凭证号
'agency' : docFormFieldValueVOList[20].fieldValue,//代理店
'blcode' : docFormFieldValueVOList[21].fieldValue,//保理号
'slip_batch_id' : record[0].SLIP_BATCH_ID,
})
} }
if (fieldValueMap['BENEFICIARY_ACCOUNT'] == '216084872610001') {
att_import_bank_trx_bm.insert({
'bank_receipt_date': fieldValueMap['BANK_RECEIPT_DATE'],//回单时间
'total_amount': fieldValueMap['TOTAL_AMOUNT'],//收入金额
'payer_bank': fieldValueMap['PAYER_BANK'],//付款方银行
'payer_number': fieldValueMap['PAYER_ACCOUNT'],//付款方账户
'payer_name': fieldValueMap['PAYER_NAME'],//付款方户名
'zy': fieldValueMap['ZY'],//摘要
'receipt_no': fieldValueMap['DOC_CODE'].substring(4, 13),//回单编号
'beneficiary_bank': fieldValueMap['BENEFICIARY_BANK'],//收款方银行
'bank_num': fieldValueMap['BENEFICIARY_ACCOUNT'],//收款方账户
'beneficiary_name': fieldValueMap['BENEFICIARY_NAME'],//收款方户名
//'receipt_no': fieldValueMap['RECEIPT_NO'].substring(4, 13),
'slip_batch_id': record[0].SLIP_BATCH_ID,
});
} }
} else { }
println("=======有效期外======"); } else {
var token_get=new com.hand.hlcm.HttpPostUtil(); println("=======有效期外======");
var data = token_get.httpPostGetToken(posturl, token_appid, token_appsecret); var token_get=new com.hand.hlcm.HttpPostUtil();
println('data = ' + data); var data = token_get.httpPostGetToken(posturl, token_appid, token_appsecret);
var json = JSON.parse(data); println('data = ' + data);
var access_token = json.access_token; var json = JSON.parse(data);
println('access_token = ' + access_token); var access_token = json.access_token;
//如果获取 access_token 成功,则 不会返回 status,即 status = undefined println('access_token = ' + access_token);
var status = json.status; //如果获取 access_token 成功,则 不会返回 status,即 status = undefined
println('status = ' + status); var status = json.status;
if (access_token) { println('status = ' + status);
if (access_token) {
token_savelogs_bm.insert({ token_savelogs_bm.insert({
'json': data, 'json': data,
'status': 'success' 'status': 'success'
}); });
// 这个 expires_in 是从 access_token 接口获取过来的数据 有效持续时间 // 这个 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,可能是一样的 //这里为什么一个 json,一个传 data,可能是一样的
var token_savelogs_bm = $bm('efile.EFILE1000.efile_get_token'); var token_savelogs_bm = $bm('efile.EFILE1000.efile_get_token');
token_savelogs_bm.insert({ token_savelogs_bm.insert({
'json': data, 'json': data,
'status': 'fail' 'status': 'fail'
}); });
}
logger.info('--------------------------------------------------------------------------------------------');
var SystokenQuery = token_savelogs_bm.queryAsMap();
var access_token = SystokenQuery.getChildren()[0].access_token;
var files = '{"startCreatedDate": ' + '"' +startdate +'"'
+ ',"endCreatedDate":'+ '"' +enddate + '"'
+',"documentTypeCodeList": '+'["receiptD"]}';
access_token = access_token;
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){
// 说明当前没有发起查询,从第一页开始查
page_number=1;
} else{
if(record[0].RETURN_PAGE_SIZE>=record[0].PAGE_SIZE){
page_number=record[0].PAGE_NUMBER+1;
} }
logger.info('--------------------------------------------------------------------------------------------'); else{
var SystokenQuery = token_savelogs_bm.queryAsMap(); page_number=record[0].PAGE_NUMBER;
var access_token = SystokenQuery.getChildren()[0].access_token;
var files = '{"startCreatedDate": ' + '"' +startdate +'"'
+ ',"endCreatedDate":'+ '"' +enddate + '"'
+',"documentTypeCodeList": '+'["receiptD"]}';
access_token = access_token;
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){
// 说明当前没有发起查询,从第一页开始查
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;
}
};
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;
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
})
var bank_list_bm = $bm('efile.EFILE1100.get_bank_list');
var parameter_code = starttime;
var response_json_list = bank_list_bm.queryAsMap({
parameter_code: parameter_code
});
var list =response_json_list.getChildren().length;
var record = response_json_list.getChildren();
logger.info(typeof (record));
// var data = new com.hand.hlcm.HttpPostDocQuery();
var data_result_n = httpPostDocImportBank(docUrl,files,access_token,token_type);
var json_data = JSON.parse(data_result_n);
var statusCode = json_data.statusCode;
var message = json_data.message;
var total = json_data.total;
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
})
for (var i = 0; i < result_list;i++) {
var docFormFieldValueVOList = result[i].docFormFieldValueVOList;
if(result[i].docFormFieldValueVOList[2].fieldValue=='中国农业银行'
&& result[i].docFormFieldValueVOList[2].fieldValue != null){
var receipt_no = docFormFieldValueVOList[0].fieldValue;
var modified_receipt_no = receipt_no.substring(4, 13);
att_import_bank_trx_bm.insert({
'doc_code' : docFormFieldValueVOList[0].fieldValue,//单据编号
'receipt_no' : modified_receipt_no,//银行流水号
'bank_name' : docFormFieldValueVOList[2].fieldValue,//回单银行名称
'beneficiary_name' : docFormFieldValueVOList[3].fieldValue,//收款方户名
'bank_num' : docFormFieldValueVOList[4].fieldValue,//收款方账号
'beneficiary_bank' : docFormFieldValueVOList[5].fieldValue,//收款方银行
'payer_name' : docFormFieldValueVOList[6].fieldValue,//付款方户名
'payer_number' : docFormFieldValueVOList[7].fieldValue,//付款方账号
'payer_bank' : docFormFieldValueVOList[8].fieldValue,//付款方银行
'bank_receipt_date' : docFormFieldValueVOList[9].fieldValue,//回单日期
'total_amount' : docFormFieldValueVOList[10].fieldValue,//金额
'purpose' : docFormFieldValueVOList[11].fieldValue,//用途
'remark' : docFormFieldValueVOList[12].fieldValue,//备注
'zy' : docFormFieldValueVOList[13].fieldValue,//摘要
'business_type' :docFormFieldValueVOList[14].fieldValue,//业务类型
'contract1' : docFormFieldValueVOList[15].fieldValue,//合同号
'gl_code' : docFormFieldValueVOList[16].fieldValue,//营业系统凭证号
'agencycode' : docFormFieldValueVOList[17].fieldValue,//代理店编号
'client' : docFormFieldValueVOList[18].fieldValue,//客户
'preprocess_code' :docFormFieldValueVOList[19].fieldValue,//SBO凭证号
'agency' : docFormFieldValueVOList[20].fieldValue,//代理店
'blcode' : docFormFieldValueVOList[21].fieldValue,//保理号
'slip_batch_id' : record[0].SLIP_BATCH_ID,
})
}
}
} }
} catch (e) { };
println('e:' + e);
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;
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
})
var bank_list_bm = $bm('efile.EFILE1100.get_bank_list');
var parameter_code = starttime;
var response_json_list = bank_list_bm.queryAsMap({
parameter_code: parameter_code
});
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 json_data = JSON.parse(data_result_n);
var statusCode = json_data.statusCode;
var message = json_data.message;
var total = json_data.total;
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,
})
for (var i = 0; i < result_list;i++) {
var docFormFieldValueVOList = result[i].docFormFieldValueVOList;
var fieldValueMap = {};
logger.info(docFormFieldValueVOList);
// 构建字段映射
for (var j = 0; j < docFormFieldValueVOList.length; j++) {
var fieldCode = docFormFieldValueVOList[j].fieldCode;
var fieldValue = docFormFieldValueVOList[j].fieldValue;
fieldValueMap[fieldCode] = fieldValue;
}
if (fieldValueMap['BENEFICIARY_ACCOUNT'] == '216084872610001') {
att_import_bank_trx_bm.insert({
'bank_receipt_date': fieldValueMap['BANK_RECEIPT_DATE'],//回单时间
'total_amount': fieldValueMap['TOTAL_AMOUNT'],//收入金额
'payer_bank': fieldValueMap['PAYER_BANK'],//付款方银行
'payer_number': fieldValueMap['PAYER_ACCOUNT'],//付款方账户
'payer_name': fieldValueMap['PAYER_NAME'],//付款方户名
'zy': fieldValueMap['ZY'],//摘要
'receipt_no': fieldValueMap['DOC_CODE'].substring(4, 13),//回单编号
'beneficiary_bank': fieldValueMap['BENEFICIARY_BANK'],//收款方银行
'bank_num': fieldValueMap['BENEFICIARY_ACCOUNT'],//收款方账户
'beneficiary_name': fieldValueMap['BENEFICIARY_NAME'],//收款方户名
//'receipt_no': fieldValueMap['RECEIPT_NO'].substring(4, 13),
'slip_batch_id': record[0].SLIP_BATCH_ID,
});
} }
]]> }
</s:server-script> }
</a:init-procedure> }catch (e) {
<a:service-output output="/parameter"/> println('e:' + e);
}
]]>
</s:server-script>
</a:init-procedure>
<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