Commit 66b9b342 authored by 陆正友's avatar 陆正友

农行回单功能

parent 1a5ab51e
package com.hand.hlcm;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import com.alibaba.fastjson.JSON;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class HttpPostDocQuery {
public static String httpPostDocImport(String postUrl, String data, String token) {
public HttpPostDocQuery() {
}
public static String httpPostDocImport(String postUrl, String data, String token, String tokentype) {
HttpClient client = null;
String result = "error";
try {
PostMethod postMethod = null;
HttpClient httpClient = new HttpClient();
postMethod = new PostMethod(postUrl);
RequestEntity entity = null;
postMethod.setRequestHeader("Content-Type", "application/json");
postMethod.setRequestHeader("Authorization", token);
entity = new StringRequestEntity(data, "application/json", "UTF-8");
postMethod.setRequestEntity(entity);
// System.out.println(data);
httpClient.executeMethod(postMethod);
String result = postMethod.getResponseBodyAsString();
return result;
} catch (Exception var9) {
return "{\n \"error\": \"interError\",\n \"message\": \"请求接口失败\",\n \"path\": \"/oauth/token\"\n}";
client = new DefaultHttpClient();
HttpPost post = new HttpPost(postUrl);
//设置超时时间
HttpParams params = client.getParams();
HttpConnectionParams.setConnectionTimeout(params, (int) 10 * 1000);
HttpConnectionParams.setSoTimeout(params, 10 * 1000);
post.setHeader("Content-Type", "application/json");
post.setHeader("Authorization", tokentype + " " + token);
post.setEntity(new StringEntity(data, "UTF-8"));
HttpResponse response = null;
response = client.execute(post);
HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity, "UTF-8");
EntityUtils.consume(entity); //1. 关闭响应流
if (entity != null) {
InputStream instream = entity.getContent();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(instream, "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
} finally {
instream.close();
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
client.getConnectionManager().shutdown(); // 关闭连接.
}
return result;
}
public static void main(String[] args) throws Exception {
String data="{\n" +
" \"startCreatedDate\":\"2022-04-01 12:30:00\",\n" +
" \"endCreatedDate\":\"2022-07-01 12:30:00\",\n" +
" \"documentTypeCodeList\":[\"3\",\"3\",\"3\"]\n" +
"}";
String resPonse = httpPostDocImport("http://apistage.huilianyi.com/gateway/e-archives/api/open/v1/documents/query?page=1&size=20", data, "Bearer4557fa35-d2da-479a-be68-323b6be619d9");
System.out.println(resPonse);
Map<String, Object> map = new HashMap<>();
map.put("startCreatedDate", "2023-06-20 00:00:00");
map.put("endCreatedDate", "2023-06-21 00:00:00");
List<String> list = new ArrayList<>();
list.add("receiptD");
map.put("documentTypeCodeList", list);
String json = JSON.toJSONString(map);
System.out.println("--------------------" + json);
String response = httpPostDocImport("http://apistage.huilianyi.com/gateway/e-archives/api/open/v1/documents/query?page=1&size=20", json, "6de63d6c-1acd-4b1c-89b8-e91c19442ab9", "Bearer");
System.out.println(response);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="execute">
<bm:update-sql><![CDATA[
begin
csh_abc_import_pkg.abc_save(
p_receipt_no =>${@receipt_no},
p_user_id =>${/session/@user_id},
p_paid_byother_flag_desc =>${@paid_byother_flag_desc},
p_payer_name =>${@payer_name},
p_collection_classes_desc =>${@collection_classes_desc},
p_guarantor_name_duty =>${@guarantor_name_duty},
p_bank_receipt_date =>to_date(${@bank_receipt_date},'yyyy-MM-dd'),
p_bank_num =>${@bank_num},
p_payer_number =>${@payer_number},
p_bank_name =>${@bank_name},
p_beneficiary_name =>${@beneficiary_name},
p_total_amount =>${@total_amount},
p_import_itfc_id =>${@import_itfc_id});
end;
]]>
</bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT t1.*
FROM (SELECT li.line_id,
li.error_message,
li.status,
li.header_id,
li.line_number,
hd.created_by,
li.source_table,
'03399500040009165' bank_num, --update by xsh35973
'人民币' currency_type, --update by xsh35973
li.attribute_1,
li.attribute_2,
li.attribute_3,
li.attribute_4,
li.attribute_5,
li.attribute_6,
li.attribute_7,
li.attribute_8,
li.attribute_9,
li.attribute_10,
li.attribute_11,
li.attribute_12,
li.attribute_13,
li.attribute_14,
li.attribute_15,
li.attribute_16,
li.attribute_17,
li.attribute_18,
li.attribute_19,
li.attribute_20,
li.attribute_21,
li.attribute_22,
li.attribute_23,
li.attribute_24,
li.attribute_25,
li.attribute_26,
t.csh_bank_account_num,
t.transaction_date,
t.bank_slip_num,
t.bp_bank_account_num,
t.bp_bank_account_name,
t.bp_bank_name,
t.bp_category,
t.transaction_amount,
t.collection_classes,
(select v.code_value_name from sys_code_values_v v where v.code='DS_COLLECTION_CLASSES'and v.code_value=t.collection_classes)collection_classes_desc,
t.bp_id ,
(select bp_name from hls_bp_master where bp_id = t.bp_id) bp_name,
t.paid_byother_flag,
decode(t.paid_byother_flag,'T','是','F','否')paid_byother_flag_desc,
t.csh_bank_account_id bank_account_id,
t.exists_flag,
t.temp_id,
(
case when
(select count(v.unit_id) from hls_bp_master v where v.enabled_flag = 'Y' and v.bp_id = t.bp_id) = 1
then
(Select u.unit_name From exp_org_unit_v u Where u.unit_id = (select v.unit_id from hls_bp_master v where v.enabled_flag = 'Y' and v.bp_id = t.bp_id))
else
' '
end
) extra_nam,
(Select u.bp_code From hls_bp_master u Where u.unit_id = (select v.unit_id from hls_bp_master v where v.enabled_flag = 'Y' and v.bp_id = t.bp_id) and u.bp_type = 'AGENT') bp_code,
t.guarantor_name_duty,
decode(t.guarantor_name_duty,'Y','是','N','否') guarantor_name_duty_desc
FROM fnd_interface_headers hd,
fnd_interface_lines li,
csh_transaction_import_temp t
WHERE hd.header_id = li.header_id and li.line_id = t.line_id and hd.header_id = t.header_id
AND hd.template_code = 'CSH_TRX_BANK'
AND li.line_number >0
AND HD.CREATED_BY = ${/session/@user_id}
) t1
#WHERE_CLAUSE#
order by t1.line_number
]]></bm:query-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
csh_transaction_pkg.csh_transaction_import_check(
p_header_id => ${/model/header/record/@header_id},
p_user_id => ${/session/@user_id}
);
end;
]]></bm:update-sql>
</bm:operation>
<bm:operation name="insert">
<bm:update-sql><![CDATA[
begin
delete from csh_transaction_import_temp where header_id = ${@header_id};
csh_abc_import_pkg.save_abc_import(
p_transaction_id =>${@transaction_id},
p_transaction_num =>${@transaction_num},
p_transaction_category =>'BUSINESS',
p_transaction_type =>${@transaction_type},
p_transaction_date =>to_date(${@transaction_date}, 'yyyy-mm-dd'),
p_penalty_calc_date =>to_date(${@transaction_date}, 'yyyy-mm-dd'),
p_bank_slip_num =>${@bank_slip_num},
p_company_id =>${/session/@company_id},
p_internal_period_num =>${@internal_period_num},
p_period_name =>${@period_name},
p_payment_method_id =>${@payment_method_id},
p_distribution_set_id =>${@distribution_set_id},
p_cashflow_amount =>${@transaction_amount},
p_currency_code =>${@currency_code},
p_transaction_amount =>${@transaction_amount},
p_exchange_rate_type =>${@exchange_rate_type},
p_exchange_rate_quotation =>${@exchange_rate_quotation},
p_exchange_rate =>${@exchange_rate},
p_bank_account_id =>${@bank_account_id},
p_bp_category =>${@bp_category},
p_bp_id =>${@bp_id},
p_bp_bank_account_id =>${@bp_bank_account_id},
p_bp_bank_account_num =>${@bp_bank_account_num},
p_description =>${@description},
p_handling_charge =>${@handling_charge},
p_posted_flag =>nvl(${@posted_flag}, 'N'),
p_reversed_flag =>nvl(${@reversed_flag}, 'N'),
p_reversed_date =>to_date(${@reversed_date}, 'yyyy-mm-dd 24hh:mi:ss'),
p_returned_flag =>nvl(${@returned_flag}, 'NOT'),
p_returned_amount =>${@returned_amount},
p_write_off_flag =>nvl(${@write_off_flag}, 'NOT'),
p_write_off_amount =>${@write_off_amount},
p_full_write_off_date =>to_date(${@full_write_off_date}, 'yyyy-mm-dd 24hh:mi:ss'),
p_twin_csh_trx_id =>${@twin_csh_trx_id},
p_return_from_csh_trx_id =>${@return_from_csh_trx_id},
p_reversed_csh_trx_id =>${@reversed_csh_trx_id},
p_source_csh_trx_type =>${@source_csh_trx_type},
p_source_csh_trx_id =>${@source_csh_trx_id},
p_source_doc_category =>${@source_doc_category},
p_source_doc_type =>${@source_doc_type},
p_source_doc_id =>${@source_doc_id},
p_source_doc_line_id =>${@source_doc_line_id},
p_create_je_mothed =>${@create_je_mothed},
p_create_je_flag =>nvl(${@create_je_flag}, 'N'),
p_gld_interface_flag =>nvl(${@gld_interface_flag}, 'N'),
p_user_id =>${/session/@user_id},
p_ref_contract_id => ${@ref_contract_id},
p_receipt_type => ${@receipt_type},
p_csh_bp_name => ${@csh_bp_name},
p_bp_name => ${@bp_name},
p_ref_n01 =>${@ref_n01},
p_bp_bank_name =>${@bp_bank_name},
p_bp_bank_branch_name =>${@bp_bank_branch_name},
p_collection_classes =>${@collection_classes},
p_bp_bank_account_name =>${@bp_bank_account_name},
p_opposite_band_na =>${@opposite_band_na},
p_banka =>${@banka},
p_purpose =>${@purpose},
p_gsber =>${@gsber},
p_sus_belnr =>${@sus_belnr},
p_bp_virtual_bank_account =>${@bp_virtual_bank_account},
p_zuonr =>${@bank_slip_num},
p_paid_byother_flag =>${@paid_byother_flag},
p_ref_v05 =>${@ref_v05},
p_status =>${@status},
p_bank_account_num =>${@bank_account_num},
p_guarantor_name_duty =>${@guarantor_name_duty},
p_bank_receipt_date =>${@bank_receipt_date},
p_paid_byother_flag_desc =>${@paid_byother_flag_desc},
p_collection_classes_desc =>${@collection_classes_desc},
p_extra_nam =>${@extra_nam},
p_import_source => 'EXCEL_ADD'
);
end;
]]></bm:update-sql>
</bm:operation>
<bm:operation name="execute">
<bm:update-sql><![CDATA[
begin
csh_transaction_pkg.get_bank_account_id(p_bank_account_num =>${@bank_account_num},
p_bp_bank_account_num =>${@bp_bank_account_num},
p_bank_account_id =>${@bank_account_id},
p_bp_category =>${@bp_category},
p_bp_id =>${@bp_id},
p_csh_bp_name =>${@csh_bp_name},
p_user_id =>${session/@user_id}
);
end;
]]></bm:update-sql>
<bm:parameters>
<bm:parameter name="bank_account_id" dataType="java.lang.Long" output="true"
outputPath="@bank_account_id"/>
<bm:parameter name="bp_category" dataType="java.lang.String" output="true" outputPath="@bp_category"/>
<bm:parameter name="bp_id" dataType="java.lang.Long" output="true" outputPath="@bp_id"/>
<bm:parameter name="csh_bp_name" dataType="java.lang.String" output="true" outputPath="@csh_bp_name"/>
</bm:parameters>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="header_id" queryExpression="t1.header_id=${@header_id}"/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="execute">
<bm:update-sql><![CDATA[
begin
csh_abc_import_pkg.import_transaction(
p_transaction_id =>${@transaction_id},
p_transaction_num =>${@transaction_num},
p_transaction_category =>'BUSINESS',
p_transaction_type =>${@transaction_type},
p_transaction_date =>to_date(${@bank_receipt_date}, 'yyyy-mm-dd'),
p_penalty_calc_date =>to_date(${@bank_receipt_date}, 'yyyy-mm-dd'),
p_bank_slip_num =>${@bank_slip_num},
p_company_id =>${/session/@company_id},
p_internal_period_num =>${@internal_period_num},
p_period_name =>${@period_name},
p_payment_method_id =>${@payment_method_id},
p_distribution_set_id =>${@distribution_set_id},
p_cashflow_amount =>${@transaction_amount},
p_currency_code =>${@currency_code},
p_transaction_amount =>${@transaction_amount},
p_exchange_rate_type =>${@exchange_rate_type},
p_exchange_rate_quotation =>${@exchange_rate_quotation},
p_exchange_rate =>${@exchange_rate},
p_bank_account_id =>${@bank_account_id},
p_bp_category =>${@bp_category},
p_bp_id =>${@bp_id},
p_bp_bank_account_id =>${@bp_bank_account_id},
p_bp_bank_account_num =>${@bp_bank_account_num},
p_description =>${@description},
p_handling_charge =>${@handling_charge},
p_posted_flag =>nvl(${@posted_flag}, 'N'),
p_reversed_flag =>nvl(${@reversed_flag}, 'N'),
p_reversed_date =>to_date(${@reversed_date}, 'yyyy-mm-dd 24hh:mi:ss'),
p_returned_flag =>nvl(${@returned_flag}, 'NOT'),
p_returned_amount =>${@returned_amount},
p_write_off_flag =>nvl(${@write_off_flag}, 'NOT'),
p_write_off_amount =>${@write_off_amount},
p_full_write_off_date =>to_date(${@full_write_off_date}, 'yyyy-mm-dd 24hh:mi:ss'),
p_twin_csh_trx_id =>${@twin_csh_trx_id},
p_return_from_csh_trx_id =>${@return_from_csh_trx_id},
p_reversed_csh_trx_id =>${@reversed_csh_trx_id},
p_source_csh_trx_type =>${@source_csh_trx_type},
p_source_csh_trx_id =>${@source_csh_trx_id},
p_source_doc_category =>${@source_doc_category},
p_source_doc_type =>${@source_doc_type},
p_source_doc_id =>${@source_doc_id},
p_source_doc_line_id =>${@source_doc_line_id},
p_create_je_mothed =>${@create_je_mothed},
p_create_je_flag =>nvl(${@create_je_flag}, 'N'),
p_gld_interface_flag =>nvl(${@gld_interface_flag}, 'N'),
p_user_id =>${/session/@user_id},
p_ref_contract_id => ${@ref_contract_id},
p_receipt_type => ${@receipt_type},
p_csh_bp_name => ${@csh_bp_name},
p_bp_name => ${@bp_name},
p_ref_n01 =>${@ref_n01},
p_bp_bank_name =>${@bp_bank_name},
p_bp_bank_branch_name =>${@bp_bank_branch_name},
p_collection_classes =>${@collection_classes},
p_bp_bank_account_name =>${@bp_bank_account_name},
p_opposite_band_na =>${@opposite_band_na},
p_banka =>${@banka},
p_purpose =>${@purpose},
p_gsber =>${@gsber},
p_sus_belnr =>${@sus_belnr},
p_bp_virtual_bank_account =>${@bp_virtual_bank_account},
p_zuonr =>${@bank_slip_num},
p_paid_byother_flag =>${@paid_byother_flag_desc},
p_ref_v05 =>${@ref_v05},
p_status =>${@status},
p_bank_account_num =>${@bank_account_num},
p_guarantor_name_duty =>${@guarantor_name_duty},
p_bank_receipt_date =>${@bank_receipt_date},
p_paid_byother_flag_desc =>${@paid_byother_flag_desc},
p_collection_classes_desc =>${@collection_classes_desc},
p_extra_nam =>${@extra_nam},
p_import_source => 'EXCEL_ADD'
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select *
from SYS_ROLE_VL t1
#WHERE_CLAUSE#
]]>
</bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="role_code" queryOperator="="/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT *
FROM (SELECT hc.import_itfc_id,
hc.bank_num,
hc.beneficiary_number,
to_char(hc.bank_receipt_date, 'yyyy-MM-dd') bank_receipt_date,
hc.receipt_no,
hc.payer_number,
hc.payer_name,
hc.bank_name,
hc.beneficiary_name,
decode(hc.paid_byother_flag_desc, 'Y', '是', 'N', '否') paid_byother_flag_desc,
decode(hc.collection_classes_desc,
'DEPOSIT',
'保证金类',
'NON_DEPOSIT',
'非保证金类',
'COMBINED',
'混合类',
'REFUND',
'日立为优质客户付租金') collection_classes_desc,
hc.total_amount,
hc.zy,
hc.remark,
hc.extra_nam,
decode(hc.guarantor_name_duty, 'Y', '是', 'N', '否') guarantor_name_duty,
hc.create_trx_flag,
hc.creation_date,
hc.created_by,
hc.last_update_date,
hc.last_updated_by,
hc.bp_id,
hc.bank_account_id,
'N' re_flag,
NULL AS bank_num_r,
NULL AS bank_receipt_date_r,
NULL AS payer_number_r,
NULL AS payer_name_r,
NULL AS bank_name_r,
NULL AS total_amount_r
FROM hlcm_ele_trx_import_itfc hc
where hc.create_trx_flag = 'Y'
and not exists (select 1
from hlcm_ele_abc_bank_slip_trx a
where a.receipt_no = hc.receipt_no)
union all
SELECT hc.import_itfc_id,
hc.bank_num,
hc.beneficiary_number,
to_char(hc.bank_receipt_date, 'yyyy-MM-dd') bank_receipt_date,
hc.receipt_no,
hc.payer_number,
hc.payer_name,
hc.bank_name,
hc.beneficiary_name,
decode(hc.paid_byother_flag_desc, 'Y', '是', 'N', '否') paid_byother_flag_desc,
decode(hc.collection_classes_desc,
'DEPOSIT',
'保证金类',
'NON_DEPOSIT',
'非保证金类',
'COMBINED',
'混合类',
'REFUND',
'日立为优质客户付租金') collection_classes_desc,
hc.total_amount,
hc.zy,
hc.remark,
hc.extra_nam,
decode(hc.guarantor_name_duty, 'Y', '是', 'N', '否') guarantor_name_duty,
hc.create_trx_flag,
hc.creation_date,
hc.created_by,
hc.last_update_date,
hc.last_updated_by,
hc.bp_id,
hc.bank_account_id,
'Y' re_flag,
a.bank_num bank_num_r,
to_char(a.bank_receipt_date, 'yyyy-MM-dd') bank_receipt_date_r,
a.payer_number payer_number_r,
a.payer_name payer_name_r,
a.bank_name bank_name_r,
a.total_amount total_amount_r
FROM hlcm_ele_trx_import_itfc hc, hlcm_ele_abc_bank_slip_trx a
where hc.create_trx_flag = 'Y'
and a.receipt_no = hc.receipt_no
order by receipt_no desc) t1
#WHERE_CLAUSE#
]]>
</bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<!-- <bm:query-field name="exchange_hour_from" queryExpression="t1.bank_receipt_date &gt;= to_date(${@exchange_hour_from},&apos;yyyy-mm-dd&apos;)"/>-->
<!-- <bm:query-field name="exchange_hour_to" queryExpression="t1.bank_receipt_date &lt;= to_date(${@exchange_hour_to},&apos;yyyy-mm-dd&apos;)"/>-->
<bm:query-field name="exchange_hour_from" queryExpression="t1.bank_receipt_date &gt;= ${@exchange_hour_from} "/>
<bm:query-field name="exchange_hour_to" queryExpression="t1.bank_receipt_date &lt;= ${@exchange_hour_to} "/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false" >
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
sELECT t1.*
FROM (SELECT to_char(hx.bank_receipt_date, 'yyyy-MM-dd') bank_receipt_date,
hx.slip_trx_id,
hx.receipt_no,
hx.payer_name,
hx.payer_number,
hx.bank_name,
(case
when (select count(bp_name)
from hls_bp_master
where bp_name = hx.payer_name) = 1 then
(select bp_name
from hls_bp_master
where bp_name = hx.payer_name)
else
' '
end) bp_name,
(case
when (select count(bp_name)
from hls_bp_master
where bp_name = hx.payer_name) = 1 then
(Select u.unit_name
From exp_org_unit_v u
Where u.unit_id =
(select v.unit_id
from hls_bp_master v
where v.enabled_flag = 'Y'
and v.bp_id =
(select bp_id
from hls_bp_master
where bp_name = hx.payer_name)))
else
' '
end) extra_nam,
(case
when (select count(bp_name)
from hls_bp_master
where bp_name = hx.payer_name) = 1 then
'否'
else
' '
end) paid_byother_flag_desc,
hx.total_amount,
hx.zy,
hx.remark,
hx.bank_num,
'N' re_flag,
NULL AS bank_num_r,
NULL AS bank_receipt_date_r,
NULL AS payer_number_r,
NULL AS payer_name_r,
NULL AS bank_name_r,
NULL AS total_amount_r,
COALESCE((SELECT v.code_value_name
FROM sys_code_values_v v,
csh_transaction_import_temp ct
WHERE v.code = 'DS_COLLECTION_CLASSES'
AND v.code_value = ct.collection_classes
and ct.bp_bank_name = hx.payer_name),
'非保证金类') AS collection_classes_desc,
(SELECT ct.guarantor_name_duty
FROM csh_transaction_import_temp ct
WHERE ct.bp_bank_name = hx.payer_name) guarantor_name_duty
FROM hlcm_ele_abc_bank_slip_trx hx
where hx.create_trx_flag = 'Y'
and not exists (select 1
from hlcm_ele_trx_import_itfc a
where hx.receipt_no = a.receipt_no)
union all
SELECT to_char(hx.bank_receipt_date, 'yyyy-MM-dd') bank_receipt_date,
hx.slip_trx_id,
hx.receipt_no,
hx.payer_name,
hx.payer_number,
hx.bank_name,
(case
when (select count(bp_name)
from hls_bp_master
where bp_name = hx.payer_name) = 1 then
(select bp_name
from hls_bp_master
where bp_name = hx.payer_name)
else
' '
end) bp_name,
(case
when (select count(bp_name)
from hls_bp_master
where bp_name = hx.payer_name) = 1 then
(Select u.unit_name
From exp_org_unit_v u
Where u.unit_id =
(select v.unit_id
from hls_bp_master v
where v.enabled_flag = 'Y'
and v.bp_id =
(select bp_id
from hls_bp_master
where bp_name = hx.payer_name)))
else
' '
end) extra_nam,
(case
when (select count(bp_name)
from hls_bp_master
where bp_name = hx.payer_name) = 1 then
'否'
else
' '
end) paid_byother_flag_desc,
hx.total_amount,
hx.zy,
hx.remark,
hx.bank_num,
'Y' re_flag,
a.bank_num bank_num_r,
to_char(a.bank_receipt_date, 'yyyy-MM-dd') bank_receipt_date_r,
a.payer_number payer_number_r,
a.payer_name payer_name_r,
a.bank_name bank_name_r,
a.total_amount total_amount_r,
COALESCE((SELECT v.code_value_name
FROM sys_code_values_v v,
csh_transaction_import_temp ct
WHERE v.code = 'DS_COLLECTION_CLASSES'
AND v.code_value = ct.collection_classes
and ct.bp_bank_name = hx.payer_name),
'非保证金类') AS collection_classes_desc,
(SELECT ct.guarantor_name_duty
FROM csh_transaction_import_temp ct
WHERE ct.bp_bank_name = hx.payer_name) guarantor_name_duty
FROM hlcm_ele_abc_bank_slip_trx hx, hlcm_ele_trx_import_itfc a
where hx.create_trx_flag = 'Y'
and a.receipt_no = hx.receipt_no
order by receipt_no desc) t1
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<!-- <bm:query-field name="exchange_hour_from" queryExpression="t1.bank_receipt_date &gt;= to_date(${@exchange_hour_from},&apos;yyyy-mm-dd&apos;)"/>-->
<!-- <bm:query-field name="exchange_hour_to" queryExpression="t1.bank_receipt_date &lt;= to_date(${@exchange_hour_to},&apos;yyyy-mm-dd&apos;)"/>-->
<bm:query-field name="exchange_hour_from" queryExpression="t1.bank_receipt_date &gt;= ${@exchange_hour_from} "/>
<bm:query-field name="exchange_hour_to" queryExpression="t1.bank_receipt_date &lt;= ${@exchange_hour_to} "/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="insert">
<bm:update-sql><![CDATA[
BEGIN
csh_abc_import_pkg.att_import_bank(
p_start_date => TO_DATE(${@start_date}, 'YYYY-MM-DD HH24:MI:SS'),
p_end_date => TO_DATE(${@end_date}, 'YYYY-MM-DD HH24:MI:SS'),
p_request_url => ${@request_url},
p_request_json => ${@request_json},
p_page_number => ${@page_number},
p_user_id =>${/session/@user_id}
);
END;
]]>
</bm:update-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
BEGIN
csh_abc_import_pkg.att_import_bank_update(
p_code => ${@code},
p_message => ${@message},
p_response_json => ${@response_json},
p_return_page_size => ${@return_page_size},
p_page_size => ${@page_size},
p_user_id =>${/session/@user_id}
);
END;
]]>
</bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="insert">
<bm:update-sql><![CDATA[
BEGIN
csh_abc_import_pkg.att_import_bank_update_trx(
p_doc_code => ${@doc_code},
p_receipt_no => ${@receipt_no},
p_bank_name => ${@bank_name},
p_beneficiary_name => ${@beneficiary_name},
p_bank_num => ${@bank_num},
p_beneficiary_bank => ${@beneficiary_bank},
p_payer_name => ${@payer_name},
p_payer_number => ${@payer_number},
p_payer_bank => ${@payer_bank},
p_bank_receipt_date =>to_date(${@bank_receipt_date}, 'YYYY-MM-DD'),
p_total_amount => ${@total_amount},
p_purpose => ${@purpose},
p_remark => ${@remark},
p_zy => ${@zy},
p_business_type => ${@business_type},
p_contract1 => ${@contract1},
p_gl_code => ${@gl_code},
p_agencycode => ${@agencycode},
p_client => ${@client},
p_preprocess_code => ${@preprocess_code},
p_agency => ${@agency},
p_blcode => ${@blcode},
p_slip_batch_id => ${@slip_batch_id},
p_user_id => ${/session/@user_id}
);
END;
]]>
</bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT *
FROM hlcm_ele_abc_bank_slip_bacth b
WHERE b.start_date = TO_DATE('${:@parameter_code}', 'YYYY-MM-DD')
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
importClass(Packages.com.hand.hl.HttpPostUtilNew);
importPackage(Packages.java.io);
importPackage(Packages.java.util);
//importClass(Packages.leaf.plugin.util.Base64);
function httpPostDocImportBank(postUrl,data,token,tokentype) {
try {
var result = new HttpPostDocQuery().httpPostDocImport(postUrl,data,token,tokentype);
return result;
} catch (e) {
println(e);
return false;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: sf
$Date: 2015-4-8 上午09:03:15
$Revision: 1.0
$Purpose: excel导入收款
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
<a:init-procedure>
<a:model-query defaultWhereClause="t1.code = &apos;CSH_TRX_IMPORT_TEMPLATE&apos;" model="sys.SYS120.hls_attachment_module" rootPath="template_path"/>
</a:init-procedure>
<a:view>
<a:link id="downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
<script type="text/javascript"><![CDATA[
function downloadFile() {
new Leaf.Window({
url: $('downloadFile_id').getUrl(),
title: '${l:HLS.SUPPORTING_DOCUMENT}',
params: {
'table_name': 'HLS_ATTACHMENT_MODULE',
'header_id': '${/model/template_path/record/@attachment_module_id}'
},
width: 850,
height: 400
});
}
function saveClick() {
if (document.getElementById('importFile').value) {
var fileName = document.getElementById('importFile').value;
var fileType = fileName.substr(fileName.lastIndexOf("."));
if (fileType != '.xls' && fileType != '.xlsx' && fileType != '.xlsm') {
alert('${l:SELECT_CORRECT_IMPORT_FILE}');
} else {
doSubmit();
}
}
}
var _input_window;
function doSubmit() {
_input_window = new $L.Window({
title: '${l:HLS.IMPORT}',
width: 1050,
height: 500
});
new Ext.Template('<iframe id ="_input_window" name="_input_window" border="0" frameborder="0" height="100%" width="100%" style="border:none;padding:0px;margin:0px;"></iframe>').insertFirst(_input_window.body.dom, {}, true);
var form = document.getElementById('importForm');
var url = '${/request/@context_path}/modules/csh/CSH1400/csh_abc_excel_import.lview?session_id=${/parameter/@session_id}&winid=${/parameter/@winid}&batch_id=${/parameter/@batch_id}&_csrf=${/session/@_csrf.token}';
form.action = url;
form.submit();
$('${/parameter/@winid}').close();
_input_window.on('close', function() {
// $('${/parameter/@parent_ds_id}').setQueryParameter('batch_id','${/parameter/@batch_id}');
$('${/parameter/@parent_ds_id}').query();
});
}
]]></script>
<a:dataSets>
<a:dataSet id="label_ds" autoCreate="true">
<a:fields>
<!--<a:field name="label1" defaultValue="注意:"/>-->
<a:field name="label2" defaultValue="${l:STRICT_IMPORTED_TEMPLATE_DATA}"/>
<a:field name="label3" defaultValue="${l:PRODUCT_MASTER_DATA_IMPORT}"/>
<a:field name="label4" defaultValue="${l:IMPORTER_ONLY_SUPPORTS}"/>
<a:field name="label5" defaultValue="${l:READ_THE_ABOVE_CAREFULLY}"/>
<a:field name="label6" defaultValue="${l:THE_IMPORT_IS_COMPLETE}"/>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:fieldSet style="margin-left:10px;margin-top:10px;" title="IMPORT_CONSIDERATIONS" width="400">
<!--<a:label name="label1" bindTarget="label_ds" width="380"/>-->
<a:label name="label2" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
<a:label name="label3" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
<a:label name="label4" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
<a:label name="label5" bindTarget="label_ds" style="color:#055A78;font-weight:bold;margin-left:10px;" width="380"/>
<a:label name="label6" bindTarget="label_ds" style="color:#055A78;font-weight:bold;margin-left:10px;" width="380"/>
</a:fieldSet>
<a:fieldSet style="margin-left:10px;margin-top:10px;" title="TMPLT_IMPORT_FILE" width="400">
<form name="upload" id="importForm" enctype="multipart/form-data" method="post" target="_input_window">
<label style="margin-left:10px;margin-top:10px;font-size:13px"><![CDATA[${l:PLEASE_SELECT_A_FILE}]]></label>
<input name="CONTENT" id="importFile" style="font-size:15px" type="file"/>
<!-- <input onclick="downloadFile()" style="margin-left:10px;margin-top:10px;width:60px;height:23px" type="button" value="模板下载"/>-->
<input onclick="saveClick()" style="margin-left:25px;margin-top:10px;width:60px;height:23px" type="button" value="${l:TMPLT_IMPORT}"/>
</form>
</a:fieldSet>
</a:view>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
<a:init-procedure outputPath="/parameter">
<a:model-query model="basic.hls_fnd_attribute_sequence" rootPath="header"/>
<a:import-excel header_id="${/model/header/record/@header_id}" separator=","
status_field="/parameter/@ImportSuccess" template_code="CSH_TRX_BANK"
user_id="${/session/@user_id}"/>
<a:model-query
defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;CSH_TRX_BANK&apos;"
model="basic.hls_fnd_attribute_status" rootPath="status"/>
<a:model-update model="csh.CSH510N.csh_transaction_list_tmp"/>
</a:init-procedure>
<a:view>
<a:link id="import_csh_transaction_receipt_data_link_id" model="csh.CSH510N.csh_transaction_list_tmp"
modelaction="execute"/>
<a:link id="save_abc_import_link" model="csh.CSH1400.csh_abc_import_transaction"
modelaction="batch_update"/>
<a:link id="get_period_name_id" model="csh.CSH511.csh_transaction_get_period_name" modelaction="query"/>
<a:link id="update_import_csh_transaction_receipt_data_link_id"
model="csh.CSH510N.csh_transaction_list_tmp_update" modelaction="batch_update"/>
<a:link id="extra_nam_csh_transaction_receipt_data_link_id"
model="csh.CSH511.check_extra_nam_count" modelaction="update"/>
<a:link id="get_extra_nam_csh_transaction_receipt_data_link_id"
model="csh.CSH511.query_extra_nam_data" modelaction="update"/>
<a:link id="get_extra_code_csh_transaction_receipt_data_link_id"
model="csh.CSH511.query_extra_nam_code" modelaction="update"/>
<script type="text/javascript"><![CDATA[
//导出
// window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
// var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'fnd_interface_headers');
// var grid_id = ds_id.replace('ds', 'layout_grid_id');
// $(grid_id)._export();
// };
function backBtn() {
//关闭页面
parent._input_window.close();
}
function returnBack() {
// 刷新页面
top.refreshFrame();
}
var _input_window;
var import_flag = 0;
function import_btn() {
var ds = $('trx_abc_import');
var records = ds.getAll();
var saveData = [];
if (import_flag == 0) {
for (var i = 0; i < records.length; i++) {
var record = records[i];
console.log(record.get('status'));
if (record.get('status') == 'ERROR') {
//不将这条数据传递到数组中
continue;
}
if (record.get('collection_classes') == 'COMBINED') {
if (record.get('paid_byother_flag') != 'T'||record.get('bp_category')!='AGENT') {
Leaf.showMessage('${l:PROMPT}', '混合类款项为代理店代付,请检查代付标志和所选商业伙伴!');
return;
}
}
//否则的话添加必要的字段
record.set('receipt_type', 'IMPORT');
record.set('bank_account_num', record.get('bank_num'));
// record.set('transaction_date', Leaf.formatDate(record.get('attribute_3')));
record.set('bank_slip_num', record.get('attribute_17'));
record.set('currency_code', 'CNY');
record.set('transaction_amount', record.get('attribute_3'));
record.set('exchange_rate', 1);
record.set('bp_bank_account_num', record.get('attribute_11'));
record.set('bp_bank_account_name', record.get('attribute_12'));
record.set('opposite_band_na', record.get('attribute_8'));
record.set('description', record.get('attribute_14'));
record.set('ref_v05', record.get('attribute_15'));
record.set('bp_name', record.get('bp_name'));
record.set('bank_receipt_date', record.get('attribute_1'));
record.set('write_off_flag', 'DISABLED');
record.set('paid_byother_flag_desc', record.get('paid_byother_flag_desc'));
record.set('guarantor_name_duty',record.get('guarantor_name_duty_desc'));
record.set('collection_classes_desc',record.get('collection_classes_desc'));
record.set('extra_nam',record.get('extra_nam'));
if (record.get('collection_classes') == 'DEPOSIT') {
record.set('transaction_type', 'DEPOSIT');
} else {
record.set('transaction_type', 'RECEIPT');
}
console.log('-----');
console.log(record.get('transaction_type'));
if (!record.get('transaction_type')) {
continue;
}
record.set('_status', 'insert');
saveData.push(record.data);
}
//开始导入数据
Leaf.showConfirm('提示', '确定要导入信息吗,<font color="red">有错误信息的数据将不会被导入</font>', function () {
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
Leaf.request({
url: $('save_abc_import_link').getUrl(),
para: saveData,
scope: this,
success: function () {
import_flag = import_flag + 1;
$('trx_abc_import').query();
Leaf.Masker.unmask(Ext.getBody());
Leaf.SideBar.show({
msg: '操作成功',
duration: 2000
});
//关闭该导入的界面
backBtn();
returnBack();
// location.href = "${/request/@context_path}/modules/csh/CSH1400/csh_agricultural_bank_check.lview";
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
}
});
});
} else {
Leaf.showMessage('${l:PROMPT}', '数据已导入不能重复导入!');
}
}
//当也没变动时候,触发事件
function update_import_data(ds, record, name, value, oldvalue) {
if (name =='paid_byother_flag'){
var paid_byother_flag = record.get('paid_byother_flag');
//深圳美鹏
var bp_code = record.get('bp_code');
//dev环境下的深圳美鹏的code bp_code == 'C00010168'
//uat 和生产环境下深圳美鹏的code D00010001 D00000009
if (paid_byother_flag == 'T'){
//判断是否是深圳美鹏code
if (bp_code == 'D00010001' || bp_code == 'D00000009'){
record.set('guarantor_name_duty','Y');
record.set('guarantor_name_duty_desc','是');
record.getField('guarantor_name_duty_desc').setReadOnly(false);
}else if (bp_code == 'C00010168'){
record.set('guarantor_name_duty','Y');
record.set('guarantor_name_duty_desc','是');
record.getField('guarantor_name_duty_desc').setReadOnly(false);
}else {
record.set('guarantor_name_duty_desc',' ');
record.set('guarantor_name_duty','NULL');
record.getField('guarantor_name_duty_desc').setReadOnly(true);
}
}else{
if (bp_code == 'D00010001' || bp_code == 'D00000009' || bp_code == 'C00010168'){
record.set('guarantor_name_duty_desc','否');
record.set('guarantor_name_duty','N');
record.getField('guarantor_name_duty_desc').setReadOnly(true);
}else{
record.set('guarantor_name_duty_desc','');
record.set('guarantor_name_duty','NULL');
record.getField('guarantor_name_duty_desc').setReadOnly(true);
}
}
}else if (name == 'bp_name_code'){
var bp_id = record.get('bp_id');
var paid_byother_flag = record.get('paid_byother_flag');
Leaf.request({
url: $('extra_nam_csh_transaction_receipt_data_link_id').getUrl(),
para: {bp_id : bp_id},
scope: this,
success: function (res) {
//先查询数量
var count = res.result.extra_name_count;
if (count == 1){
//根据数量,一个直接查询显示,多个显示空
Leaf.request({
url: $('get_extra_nam_csh_transaction_receipt_data_link_id').getUrl(),
para: {bp_id : bp_id},
scope: this,
success: function (res) {
var extra_name = res.result.extra_name;
record.set('extra_nam',extra_name);
var extra_id = bp_id;
Leaf.request({
url: $('get_extra_code_csh_transaction_receipt_data_link_id').getUrl(),
para: {bp_id : extra_id},
scope: this,
success: function (res) {
var unit_code = res.result.unit_code;
// alert(unit_code);
if (unit_code == 241 || unit_code == 610){
if (paid_byother_flag == null){
//dev环境code --- C00010168(每次部署uat或者生产,需要将下面代码注释)
// record.set('bp_code','C00010168');
//uat和生产有两个深圳美鹏code(每次部署uat或者生产,需求解除下面代码注释)
if (unit_code == 241){
record.set('bp_code','D00010001');
}else if (unit_code == 610){
record.set('bp_code','D00000009');
}
record.getField('guarantor_name_duty_desc').setReadOnly(true);
record.set('guarantor_name_duty_desc','否');
record.set('guarantor_name_duty','N');
}else if (paid_byother_flag == 'T'){
//dev环境code --- C00010168(每次部署uat或者生产,需要将下面代码注释)
// record.set('bp_code','C00010168');
//uat和生产有两个深圳美鹏code(每次部署uat或者生产,需求解除下面代码注释)
if (unit_code == 241){
record.set('bp_code','D00010001');
}else if (unit_code == 610){
record.set('bp_code','D00000009');
}
record.set('guarantor_name_duty','Y');
record.set('guarantor_name_duty_desc','是');
record.getField('guarantor_name_duty_desc').setReadOnly(false);
}else {
//dev环境code --- C00010168(每次部署uat或者生产,需要将下面代码注释)
// if (unit_code == 241 || unit_code == 610){
// record.set('bp_code','C00010168');
// }else{
// record.set('bp_code','C00000000');
// }
//uat和生产有两个深圳美鹏code(每次部署uat或者生产,需求解除下面代码注释)
if (unit_code == 241){
record.set('bp_code','D00010001');
}else if (unit_code == 610){
record.set('bp_code','D00000009');
}else{
record.set('bp_code','C00000000');
}
record.getField('guarantor_name_duty_desc').setReadOnly(true);
record.set('guarantor_name_duty_desc','否');
record.set('guarantor_name_duty','N');
}
}else {
record.set('bp_code','C00000000');
record.getField('guarantor_name_duty_desc').setReadOnly(true);
record.set('guarantor_name_duty_desc',' ');
record.set('guarantor_name_duty','NULL');
}
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
}
});
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
}
});
}
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
}
});
}
// else if (name == 'extra_nam'){
// var bp_id = record.get('bp_id');
// var paid_byother_flag = record.get('paid_byother_flag');
// Leaf.request({
// url: $('get_extra_code_csh_transaction_receipt_data_link_id').getUrl(),
// para: {bp_id : bp_id},
// scope: this,
// success: function (res) {
// var unit_code = res.result.unit_code;
// if (unit_code == 241 || unit_code == 610){
// if (paid_byother_flag == 'T'){
// record.set('guarantor_name_duty','Y');
// record.set('guarantor_name_duty_desc','是');
// record.getField('guarantor_name_duty_desc').setReadOnly(false);
// }else {
// record.getField('guarantor_name_duty_desc').setReadOnly(true);
// record.set('guarantor_name_duty_desc','否');
// record.set('guarantor_name_duty','N');
// }
// }else{
// record.getField('guarantor_name_duty_desc').setReadOnly(true);
// record.set('guarantor_name_duty_desc','否');
// record.set('guarantor_name_duty','N');
// }
// },
// failure: function () {
// Leaf.Masker.unmask(Ext.getBody());
// },
// error: function () {
// Leaf.Masker.unmask(Ext.getBody());
// }
// });
// }
}
//页面加载时触发事件
function onload_import_data(ds) {
var records = ds.getAll();
for (var i = 0;i < records.length;i++) {
var record = records[i];
var bp_code = record.get('bp_code');
var paid_byother_flag = record.get('paid_byother_flag');
// record.getField('extra_nam').setRequired(true);
//dev环境的深圳美鹏code ---- C00010168
//uat和生产环境深圳美鹏的code --- D00010001 D00000009
if (bp_code == 'D00010001' || bp_code == 'D00000009' ){
if (paid_byother_flag == 'T'){
record.set('guarantor_name_duty','Y');
record.set('guarantor_name_duty_desc','是');
record.getField('guarantor_name_duty_desc').setReadOnly(false);
}else{
record.set('guarantor_name_duty','N');
record.set('guarantor_name_duty_desc','否');
record.getField('guarantor_name_duty_desc').setReadOnly(true);
}
}else if(bp_code == 'C00010168'){
if (paid_byother_flag == 'T'){
record.set('guarantor_name_duty','Y');
record.set('guarantor_name_duty_desc','是');
record.getField('guarantor_name_duty_desc').setReadOnly(false);
}else{
record.set('guarantor_name_duty','N');
record.set('guarantor_name_duty_desc','否');
record.getField('guarantor_name_duty_desc').setReadOnly(true);
}
}else{
record.set('guarantor_name_duty','NULL');
record.set('guarantor_name_duty_desc',' ');
record.getField('guarantor_name_duty_desc').setReadOnly(true);
}
}
}
function change_background_color(record) {
if (record.get('error_message')) {
return 'background-color:#fc9492;';
}
}
function indexchange_data(ds, record) {
if (record.get('exists_flag') == 'Y') {
var field = record.getField('bp_name');
field.setLovService('basic.csh_transaction_bp_temp_for_lov');
field.setLovPara('temp_id', record.get('temp_id'));
}
}
function export_btn() {
var ds = $('trx_abc_import');
var records = ds.getAll();
var saveData = [];
for (var i = 0; i < records.length; i++) {
saveData.push({
'bp_id': records[i].get('bp_id'),
'paid_byother_flag': records[i].get('paid_byother_flag'),
'collection_classes': records[i].get('collection_classes'),
'guarantor_name_duty': records[i].get('guarantor_name_duty'),
'temp_id': records[i].get('temp_id'),
'_status': 'update'
});
}
Leaf.request({
url: $('update_import_csh_transaction_receipt_data_link_id').getUrl(),
para: saveData,
scope: this,
success: function () {
$('tre_withdraw_subscriber_import_grid_id')._export();
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
}
});
}
]]></script>
<a:dataSets>
<a:dataSet id="yes_no_ds" lookupCode="YES_NO"/>
<a:dataSet id="collection_classes_ds" lookupCode="DS_COLLECTION_CLASSES">
</a:dataSet>
<a:dataSet id="paid_byother_flag_ds">
<a:datas>
<a:record code_value="T" code_value_name="是"/>
<a:record code_value="F" code_value_name="否"/>
</a:datas>
</a:dataSet>
<a:dataSet id="trx_abc_import" autoQuery="true" fetchAll="true"
model="csh.CSH1400.csh_abc_import_transaction"
queryUrl="${/request/@context_path}/autocrud/csh.CSH1400.csh_abc_import_transaction/query?header_id=${/model/header/record/@header_id}">
<a:fields>
<a:field name="error_message" readOnly="true"/>
<a:field name="attribute_4" readOnly="true"/>
<a:field name="paid_byother_flag_desc" required="true" options="paid_byother_flag_ds"
returnField="paid_byother_flag" displayField="code_value_name" valueField="code_value"/>
<a:field name="guarantor_name_duty_desc" displayField="code_value_name" options="yes_no_ds" prompt="担保人履行担保义务" returnField="guarantor_name_duty" valueField="code_value"/>
<a:field name="guarantor_name_duty" required="true"/>
<a:field name="paid_byother_flag" required="true"/>
<a:field name="collection_classes_desc" required="true" options="collection_classes_ds"
displayField="code_value_name" returnField="collection_classes" valueField="code_value"/>
<a:field name="collection_classes"/>
<a:field name="bp_name" required="true" lovGridHeight="350" lovHeight="500" lovLabelWidth="90"
lovService="basic.hls_bp_master_v_for_agent_lov" lovWidth="550" title="HLS.BP_TITLE">
<a:mapping>
<a:map from="bp_id" to="bp_id"/>
<a:map from="bp_code" to="bp_name_code"/>
<a:map from="bp_name" to="bp_name"/>
<a:map from="bp_name" to="csh_bp_name"/>
<a:map from="bp_category" to="bp_category"/>
<a:map from="bp_category_name" to="bp_category_display"/>
</a:mapping>
</a:field>
<a:field name="extra_nam" required="true" lovGridHeight="350" lovHeight="500" lovLabelWidth="90"
lovService="csh.CSH510.csh_extra_nam_add_lov" lovWidth="550" title="代理店简称" readOnly="true">
<a:mapping>
<a:map from="extra_nam" to="extra_nam"/>
<a:map from="bp_code" to="bp_code"/>
</a:mapping>
</a:field>
<a:field name="bp_code"/>
<a:field name="bp_id"/>
<a:field name="bp_category"/>
<a:field name="transaction_date" datatype="date"/>
</a:fields>
<a:events>
<a:event name="load" handler="onload_import_data"/>
<a:event name="update" handler="update_import_data"/>
<a:event name="indexchange" handler="indexchange_data"/>
</a:events>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:form id="success_form" height="400" title="THE_IMPORTED_DATA" width="980">
<a:screenTopToolbar>
<a:gridButton click="backBtn" text="退出"/>
<a:gridButton click="import_btn" text="导入"/>
<a:gridButton click="export_btn" text="导出"/>
</a:screenTopToolbar>
<a:grid id="tre_withdraw_subscriber_import_grid_id" bindTarget="trx_abc_import"
height="340" navBar="false"
width="980" rowRenderer="change_background_color">
<a:columns>
<a:column name="error_message" editor="textArea_e" prompt="错误信息" width="180"/>
<a:column name="bank_num" prompt="账号" width="80"/>
<a:column name="currency_type" prompt="货币" width="80"/>
<a:column name="attribute_1" prompt="交易时间" renderer="Leaf.formatDate" width="80"/>
<!-- <a:column name="attribute_4" prompt="交易时间" width="80"/>-->
<a:column name="attribute_17" prompt="日志号" width="80"/>
<a:column name="attribute_11" prompt="对方账号" width="80"/>
<a:column name="attribute_12" prompt="对方账号户名" width="80"/>
<a:column name="attribute_8" prompt="对方银行名称" width="80"/>
<a:column name="bp_name" prompt="收款对象" editor="grid_lov" width="120"/>
<a:column name="paid_byother_flag_desc" prompt="是否代付" editor="grid_cb"/>
<a:column name="attribute_3" prompt="收款金额" renderer="Leaf.formatMoney" align="right"
width="80"/>
<a:column name="attribute_14" prompt="摘要" width="80"/>
<a:column name="collection_classes_desc" prompt="款项分类" editor="grid_cb"/>
<a:column name="attribute_15" prompt="附言" width="80"/>
<a:column name="extra_nam" prompt="代理店简称" width="80" editor="grid_lov" />
<a:column name="bp_code" prompt="代理店简称code" hidden="true"/>
<a:column name="guarantor_name_duty_desc" prompt="担保人履行担保义务" width="80" editor="grid_cb"/>
</a:columns>
<a:editors>
<a:textArea id="textArea_e" height="50" width="240"/>
<a:comboBox id="grid_cb"/>
<a:lov id="grid_lov"/>
</a:editors>
</a:grid>
</a:form>
</a:screenBody>
<script type="text/javascript"><![CDATA[
Leaf.onReady(init);
function init() {
if (document.getElementById("tre_withdraw_subscriber_import_grid_id_tb")) {
document.getElementById("tre_withdraw_subscriber_import_grid_id_tb").style.display = "none";
}
}
]]></script>
</a:view>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
<a:init-procedure>
<p:echo/>
<a:batch-apply sourcePath="/parameter">
<p:echo/>
<a:batch-apply sourcePath="@current_parameter/AbcOrc">
<a:model-execute model="csh.CSH1400.csh_abc_import_save"/>
</a:batch-apply>
</a:batch-apply>
</a:init-procedure>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
<a:init-procedure>
<p:echo/>
<a:batch-apply sourcePath="/parameter">
<p:echo/>
<a:batch-apply sourcePath="@current_parameter/AbcOrc">
<a:model-execute model="csh.CSH1400.csh_abc_import_transaction_s"/>
</a:batch-apply>
</a:batch-apply>
</a:init-procedure>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true"
dynamiccreateenabled="true" trace="true">
<a:init-procedure>
<a:model-query defaultWhereClause="t1.role_id=${/session/@role_id}" fetchAll="true"
model="csh.CSH1400.csh_abc_query_role_code" rootPath="role_code"/>
</a:init-procedure>
<a:view>
<a:link id="agricultural_bank_import_link"
url="${/request/@context_path}/modules/csh/CSH1400/agricultural_bank_import.lview"/>
<a:link id="csh_abc_import_save_link"
url="${/request/@context_path}/modules/csh/CSH1400/csh_abc_import_save.lsc"/>
<a:link id="csh_abc_import_transaction_link"
url="${/request/@context_path}/modules/csh/CSH1400/csh_abc_import_transaction.lsc"/>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function () {
//只开放按钮权限给债权内勤
var role_code = '${/model/role_code/record/@role_code}';
if (role_code == '0009') {
$('agricultural_bank_save_id').enable(); // 启用按钮
$('agricultural_bank_import_id').enable(); // 启用按钮
$('agricultural_bank_submit_id').enable(); // 启用按钮
} else {
$('agricultural_bank_save_id').disable(); // 禁用按钮
$('agricultural_bank_import_id').disable(); // 禁用按钮
$('agricultural_bank_submit_id').disable(); // 禁用按钮
}
});
function returnAbc() {
// 刷新页面
$("OcrQueryDs").query();
$("AbcBankDs").query();
}
function returnBack() {
// 刷新页面
top.refreshFrame();
}
//查询按钮
function agricultural_bank_query() {
$("OcrQueryDs").query();
$("AbcBankDs").query();
}
// 背景渲染农行回单
function change_background_color(record) {
if (record.get('re_flag') == 'Y') {
return 'background-color:#DC143C;'
}
}
// 字段渲染农行回单
function checkOcrRender(value, record, name) {
if (record.get('re_flag') == 'Y') {
var name_r = name + '_r';
var value_r = record.get(name_r);//OCR数据
if (value != value_r) {
if (name == 'total_amount') {
return '<font color="yellow">' + Leaf.formatMoney(value) + '</font>'
} else if (name == 'bank_receipt_date') {
return '<font color="yellow">' + Leaf.formatDate(value) + '</font>'
} else {
return '<font color="yellow">' + value + '</font>'
}
} else {
if (name == 'total_amount') {
return '<font color="black">' + Leaf.formatMoney(value) + '</font>'
} else if (name == 'bank_receipt_date') {
return '<font color="black">' + Leaf.formatDate(value) + '</font>'
} else {
return '<font color="black">' + value + '</font>'
}
}
} else {
if (name == 'total_amount') {
return '<font color="black">' + Leaf.formatMoney(value) + '</font>'
} else if (name == 'bank_receipt_date') {
return '<font color="black">' + Leaf.formatDate(value) + '</font>'
} else {
return '<font color="black">' + value + '</font>'
}
}
}
// 保存按钮
function agricultural_bank_save() {
var orc_save = $('AbcBankDs').getSelected();
var param = {};
var saveOrc = [];
if (orc_save.length <= 0) {
Leaf.showMessage('提示', '请至少选择一条数据!');
} else {
for (var i = 0; i < orc_save.length; i++) {
var lineOrc = {};
lineOrc['receipt_no'] = orc_save[i].get('receipt_no');
lineOrc['import_itfc_id'] = orc_save[i].get('import_itfc_id');
lineOrc['paid_byother_flag_desc'] = orc_save[i].get('paid_byother_flag_desc');
lineOrc['payer_name'] = orc_save[i].get('payer_name');
lineOrc['collection_classes_desc'] = orc_save[i].get('collection_classes_desc');
lineOrc['guarantor_name_duty'] = orc_save[i].get('guarantor_name_duty');
lineOrc['bank_receipt_date'] = orc_save[i].get('bank_receipt_date');
lineOrc['bank_num'] = orc_save[i].get('bank_num');
lineOrc['payer_number'] = orc_save[i].get('payer_number');
lineOrc['bank_name'] = orc_save[i].get('bank_name');
lineOrc['beneficiary_name'] = orc_save[i].get('beneficiary_name');
lineOrc['total_amount'] = orc_save[i].get('total_amount');
saveOrc.push(lineOrc);
}
param['AbcOrc'] = saveOrc;
Leaf.request({
url: $('csh_abc_import_save_link').getUrl(),
para: {
param: param
},
success: function () {
Leaf.SideBar.show({
msg: '${l:HLS.SUBMIT_SUCCESS}',
duration: 2000
});
returnAbc();
},
scope: this
});
}
}
function btn001_renderer_button_authority_detail(value, record, name) {
if (record.isNew==true){
return Leaf.showMessage('提示', '请至少选择一条数据!');
}
}
// 提交按钮
function agricultural_bank_submit() {
var orc_save = $('AbcBankDs').getSelected();
var abc_save = $('OcrQueryDs').getSelected();
var param = {};
var saveOrc = [];
if (orc_save.length <= 0) {
Leaf.showMessage('提示', '请至少选择一条数据!');
} else {
for (var i = 0; i < orc_save.length; i++) {
var lineOrc = {};
lineOrc['write_off_flag'] = 'DISABLED';
lineOrc['exchange_rate'] = '1';
lineOrc['currency_code'] = 'CNY';
lineOrc['receipt_type'] = 'IMPORT';
lineOrc['_status'] = 'insert';
lineOrc['bank_account_num'] = orc_save[i].get('bank_num');//收款账号
lineOrc['bank_slip_num'] = orc_save[i].get('receipt_no');//银行流水号
lineOrc['transaction_amount'] = orc_save[i].get('total_amount');//交易金额
lineOrc['bank_receipt_date'] = orc_save[i].get('bank_receipt_date');//交易时间
lineOrc['bp_bank_account_num'] = orc_save[i].get('payer_number');//付款账号
lineOrc['bp_bank_account_name'] = orc_save[i].get('payer_name');//付款人
lineOrc['opposite_band_na'] = orc_save[i].get('bank_name');//付款开户银行
lineOrc['description'] = orc_save[i].get('zy');//摘要
lineOrc['ref_v05'] = orc_save[i].get('remark');//附言
lineOrc['bp_name'] = orc_save[i].get('beneficiary_name');//收款人
lineOrc['paid_byother_flag_desc'] = orc_save[i].get('paid_byother_flag_desc');//是否代付
lineOrc['guarantor_name_duty'] = orc_save[i].get('guarantor_name_duty');//担保人承担义务
lineOrc['collection_classes_desc'] = orc_save[i].get('collection_classes_desc');//款项分类
lineOrc['extra_nam'] = orc_save[i].get('extra_nam');//代理店简称
lineOrc['bank_account_id'] = orc_save[i].get('bank_account_id');//id
lineOrc['bp_id'] = orc_save[i].get('bp_id');//id
// lineOrc['transaction_type'] = 'DEPOSIT';//
saveOrc.push(lineOrc);
}
param['AbcOrc'] = saveOrc;
Leaf.request({
url: $('csh_abc_import_transaction_link').getUrl(),
para: {
param: param
},
success: function () {
Leaf.SideBar.show({
msg: '${l:HLS.SUBMIT_SUCCESS}',
duration: 2000
});
$('AbcBankDs').query();
$("OcrQueryDs").query();
returnBack();
},
scope: this
});
}
if (abc_save.length > 0) {
Leaf.showMessage('提示', '农行回单OCR页面的单据无法提交!');
}
}
//明细上传按钮
function agricultural_bank_import() {
new Leaf.Window({
id: 'agricultural_bank_import_wind',
params: {
winid: 'agricultural_bank_import_wind',
},
url: $('agricultural_bank_import_link').getUrl(),
title: '农行回单',
width: 430,
height: 390
});
// win.on('close', function () {
// debugger
// var createWin = $('agricultural_bank_import');
// createWin.close();
// returnAbc();
// });
}
]]></script>
<a:dataSets>
<!-- 是否代付、担保人履行担保义务下拉框-->
<a:dataSet id="yes_no_ds" lookupCode="YES_NO"/>
<!-- 款项分类下拉框-->
<a:dataSet id="collection_classes_ds" lookupCode="DS_COLLECTION_CLASSES"/>
<a:dataSet id="query_time">
</a:dataSet>
<a:dataSet id="OcrQueryDs" autoQuery="true" autoPageSize="true" queryDataSet="query_time"
model="csh.CSH1400.csh_ocr_abc_bank"
queryUrl="${/request/@context_path}/autocrud/csh.CSH1400.csh_ocr_abc_bank/query"
selectable="true">
</a:dataSet>
<a:dataSet id="AbcBankDs" autoQuery="true" autoPageSize="true" queryDataSet="query_time"
model="csh.CSH1400.csh_import_abc_bank"
queryUrl="${/request/@context_path}/autocrud/csh.CSH1400.csh_import_abc_bank/query"
selectable="true">
<a:fields>
<!-- 是否代付-->
<a:field name="paid_byother_flag_desc" required="true" options="yes_no_ds"
returnField="paid_byother_flag" displayField="code_value_name" valueField="code_value"/>
<a:field name="paid_byother_flag" required="true"/>
<!-- 担保人履行担保义务-->
<a:field name="guarantor_name_duty" options="yes_no_ds"
returnField="paid_byother_flag" displayField="code_value_name" valueField="code_value"/>
<a:field name="paid_byother_flag"/>
<!-- 款项分类-->
<a:field name="collection_classes_desc" required="true" options="collection_classes_ds"
displayField="code_value_name" returnField="collection_classes" valueField="code_value"/>
<a:field name="collection_classes"/>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<a:screenTitle/>
<a:gridButton id="Ocr_Bank_Query" click="agricultural_bank_query" text="HLS.QUERY"/>
<a:gridButton id="agricultural_bank_save_id" click="agricultural_bank_save" text="保存"/>
<a:gridButton id="agricultural_bank_import_id" click="agricultural_bank_import" text="明细上传"/>
<a:gridButton id="agricultural_bank_submit_id" click="agricultural_bank_submit" text="提交"/>
</a:screenTopToolbar>
<a:form column="2" title="查询条件">
<a:datePicker name="exchange_hour_from" bindTarget="query_time" prompt="交易时间从"
renderer="Leaf.formatDate"/>
<a:datePicker name="exchange_hour_to" bindTarget="query_time" prompt="交易时间到"
renderer="Leaf.formatDate"/>
</a:form>
<a:tabPanel marginHeight="220" marginWidth="50">
<a:tabs>
<a:tab prompt="OCR数据" width="110">
<a:grid id="ocr" bindTarget="OcrQueryDs" marginHeight="200" marginWidth="80" navBar="true" rowRenderer="change_background_color">
<a:columns>
<a:column name="bank_num" prompt="收款账号" width="150" align="center" renderer="checkOcrRender"/>
<a:column name="bank_receipt_date" prompt="交易时间" width="100" align="center"
renderer="checkOcrRender"/>
<a:column name="receipt_no" prompt="回单编号" width="80" align="left"/>
<a:column name="payer_number" prompt="付款方账号" width="100" align="center" renderer="checkOcrRender"/>
<a:column name="payer_name" prompt="付款方户名" width="100" align="left" renderer="checkOcrRender"/>
<a:column name="bank_name" prompt="付款方开户行" width="100" align="left" renderer="checkOcrRender"/>
<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="total_amount" prompt="金额" width="100" align="right" renderer="checkOcrRender"/>
<a:column name="zy" prompt="摘要" width="80" 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="extra_nam" prompt="代理店简称" width="100" align="center"/>
<a:column name="guarantor_name_duty" prompt="担保人履行担保义务" width="145"
align="center"/>
</a:columns>
</a:grid>
</a:tab>
<a:tab prompt="农行回单" width="110">
<a:grid id="abc_bank" bindTarget="AbcBankDs" marginHeight="200" marginWidth="80"
rowRenderer="change_background_color" navBar="true">
<a:columns>
<a:column name="bank_num" prompt="账号" width="150" editor="txt" align="center"
renderer="checkOcrRender"/>
<a:column name="bank_receipt_date" prompt="交易时间" width="100" editor="grid_date"
renderer="checkOcrRender" align="center"/>
<a:column name="receipt_no" prompt="日志号" width="80" editor="txt" align="left"/>
<a:column name="payer_number" prompt="对方账号" width="100" editor="txt" align="center" renderer="checkOcrRender"/>
<a:column name="payer_name" prompt="对方账号户名" width="100" editor="txt" align="left"
renderer="checkOcrRender"
required="true"/>
<a:column name="bank_name" prompt="对方银行名称" width="100" editor="txt" align="left"
renderer="checkOcrRender"/>
<a:column name="beneficiary_name" prompt="收款对象" width="100" editor="txt" align="left"/>
<a:column name="paid_byother_flag_desc" prompt="是否代付" width="70" editor="grid_cb"
required="true"
align="center"/>
<a:column name="total_amount" prompt="收款金额" width="100" editor="txt" align="right"
renderer="checkOcrRender"/>
<a:column name="zy" prompt="摘要" width="80" editor="txt" align="center"/>
<a:column name="collection_classes_desc" prompt="款项分类" width="90" editor="grid_cb"
required="true"
align="center"/>
<a:column name="remark" prompt="附言" width="80" align="center" readonly="true"/>
<a:column name="extra_nam" prompt="代理店简称" width="100" align="center" readonly="true"/>
<a:column name="guarantor_name_duty" prompt="担保人履行担保义务" width="145" editor="grid_cb"
align="center"/>
</a:columns>
<a:editors>
<a:textField id="txt"/>
<a:comboBox id="grid_cb"/>
<a:lov id="grid_lov"/>
<a:datePicker id="grid_date"/>
</a:editors>
</a:grid>
</a:tab>
</a:tabs>
</a:tabPanel>
</a:screenBody>
</a:view>
</a:screen>
......@@ -32,6 +32,7 @@
<a:link id="csh510_csh_transaction_import_link" url="${/request/@context_path}/modules/csh/CSH510N/csh_transaction_import.lview"/>
<a:link id="csh_margin_check_id" url="${/request/@context_path}/modules/csh/CSH531F/csh_bank_recoi_margin_check.lview"/>
<a:link id="hls_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="agricultural_bank_link" url="${/request/@context_path}/modules/csh/CSH1400/csh_agricultural_bank_check.lview"/>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function(){
......@@ -498,6 +499,21 @@
param['url_title']='控制茂甲保证金校验';
hls_doc_get_layout_code('hls_get_layout_code_link_id',param,'csh_margin_check_id');
}
function agricultural_bank() {
new Leaf.Window({
id: 'agricultural_bank_wind',
params: {
winid:'agricultural_bank_wind',
sessionId: '${/session/@session_id}',
role_id: '${/session/@role_id}',
},
url:$('agricultural_bank_link').getUrl(),
title: '农行回单',
width: 1500,
height: 590
});
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
......@@ -726,7 +742,7 @@
<!-- <a:gridButton click="csh510_csh_trx_bank_drop" text="CSH510.CSH_TRANSACTION.DROP_BTN" id="csh510_csh_trx_bank_drop"/>-->
<a:gridButton click="csh510_receipt_reset" text="HLS.RESET"/>
<a:gridButton id="csh531_margin_check_id" click="csh531_margin_check" text="茂甲保证金校验"/>
<a:gridButton id="Ocr_Bank_id" click="agricultural_bank" text="农行回单"/>
<!-- <a:gridButton click="csh510_csh_transaction_batch_update" text="批量过账"/>-->
<!-- <a:gridButton click="csh510_receipt" text="财务认领"/> -->
</a:screenTopToolbar>
......
<?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;bank_import.js"><![CDATA[
importPackage(java.io);
importPackage(java.util);
importPackage(Packages.com.hand.hlcm);
var logger = $logger('server-script');
// 获取当前日期
var currentDate = new Date();
// 设置开始时间为明天的凌晨整点(目标时区为UTC)
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 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 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=20; //每次请求当前页条数
try {
var sys_url_bm = $bm('cont.CON4000.get_sys_url');
var parameter_code = 'TOKEN_POSTURL';
var SysposturlQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var posturl = SysposturlQuery.getChildren()[0].parameter_value;
var parameter_code = 'TOKEN_APPID';
var SysappidQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var token_appid = SysappidQuery.getChildren()[0].parameter_value;
var parameter_code = 'TOKEN_APPSECRET';
var SysappsecretQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var token_appsecret = SysappsecretQuery.getChildren()[0].parameter_value;
var parameter_code = 'OCR_AGRICULTURAL_BANK';
var FileQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var docUrl = FileQuery.getChildren()[0].parameter_value;
var parameter_code = 'TOKEN_TYPE';
var tokenTypeyQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var token_type = tokenTypeyQuery.getChildren()[0].parameter_value;
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 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 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();
let p_user_id;
var userid = p_user_id;
att_import_bank_bm.insert({
'start_date' : startdate,
'end_date' : enddate,
'request_json' : request_files,
'page_number' : page_number,
'request_url' : docUrl,
'p_user_id': userid
})
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[1].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,
})
}
}
} else {
println("=======有效期外======");
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);
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.efile_get_token');
token_savelogs_bm.insert({
'json': data,
'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;
}
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[1].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);
}
]]>
</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