Commit 46e3d2d4 authored by chenzhuo's avatar chenzhuo

Merge remote-tracking branch 'origin/feature/建机电子合同开发' into feature/建机电子合同开发

parents d7ea2319 cc6e1098
......@@ -50,7 +50,7 @@
m.table_pk_value = lt.templet_id AND
lt.templet_id = t.doc_template_id AND
t.doc_plugin_flag = 'Y' AND
t.templet_usage in ('CON_SALE', 'CONTRACT', 'CHANGE_REQ') and
t.templet_usage in ('CON_SALE', 'CONTRACT', 'CHANGE_REQ','AGENT_CONTRACT') and
t.templet_id = cc.templet_id AND
(
cc.content_id =${/parameter/@content_id} OR
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: zc
$Date: 2020年11月18日 14点02分
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
update CON_CONTRACT_ELE_FLOW cf
set cf.revoke_flag = 'Y',
cf.last_update_date = sysdate
where cf.contract_id = ${@contract_id}
and cf.ele_flow_id = ${@flow_id};
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -19,8 +19,10 @@
</bm:operation>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select t.ele_flow_id
FROM con_contract t
select * from (select cf.ele_flow_id,cf.contract_id
FROM CON_CONTRACT_ELE_FLOW cf
where cf.ele_flow_type in ('CE','AE')
and cf.revoke_flag is null) t
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
......@@ -35,15 +37,17 @@
where c.contract_id = ${@contract_id};
delete from con_contract_ele_signer cs where cs.contract_id = ${@contract_id};
delete from CON_CONTRACT_ELE_FLOW t where t.ele_flow_type in ('CE','AE') and t.contract_id = ${@contract_id};
commit;
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field name="ele_flow_id"/>
<bm:field name="ele_flow_id" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ELE_FLOW_ID"/>
<bm:field name="contract_id"/>
</bm:fields>
<bm:query-fields>
<bm:query-field name="contract_id" queryExpression="(t.contract_id = ${@contract_id})"/>
<bm:query-field name="contract_id" queryExpression="t.contract_id = ${@contract_id}"/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: zc
$Date: 2020年11月9日
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:fields>
<bm:field name="file_name"/>
<bm:field name="file_path"/>
<bm:field name="file_size"/>
</bm:fields>
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select fa.file_name,fa.file_path,fa.file_size
from fnd_atm_attachment fa, fnd_atm_attachment_multi fm
where fa.attachment_id = fm.attachment_id
and fm.table_name = 'CON_CONTRACT_CONTENT'
and fm.table_pk_value in
(select t.content_id
from con_contract_content t,con_ele_signer_file cf,con_contract_ele_signer cs,con_contract_bp cb,hls_doc_file_templet_signer hs
where t.contract_id = ${@contract_id}
and t.templet_id = cf.templet_id
and t.clause_usage = 'AGENT_CONTRACT'
and cf.con_ele_signer_id = ${@con_ele_signer_id}
and cf.con_ele_signer_id = cs.con_ele_signer_id
and t.con_contract_bp_id = cb.record_id
and cb.bp_id = cs.bp_id
and cf.templet_code != 'SETTLE_ADVANCE_OEC'
and cs.templet_signer_id = hs.templet_signer_id
and hs.signer_category in ('GUARANTOR_NP','GUARANTOR_SP','GUARANTOR_ORG_SIGN','GUARANTOR_ORG_SEAL')
union all
select t.content_id
from con_contract_content t,con_ele_signer_file cf,con_contract_ele_signer cs,hls_doc_file_templet_signer hs
where t.contract_id = ${@contract_id}
and t.templet_id = cf.templet_id
and t.clause_usage = 'AGENT_CONTRACT'
and cf.con_ele_signer_id = ${@con_ele_signer_id}
and cf.con_ele_signer_id = cs.con_ele_signer_id
and cf.templet_code != 'SETTLE_ADVANCE_OEC'
and cs.templet_signer_id = hs.templet_signer_id
and hs.signer_category not in ('GUARANTOR_NP','GUARANTOR_SP','GUARANTOR_ORG_SIGN','GUARANTOR_ORG_SEAL'))
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<!-- (select t.content_id
from con_contract_content t,con_ele_signer_file cf
where t.contract_id = ${@contract_id}
and t.templet_id = cf.templet_id
and cf.con_ele_signer_id = ${@con_ele_signer_id}
and cf.templet_code != 'SETTLE_ADVANCE_OEC')-->
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: zc
$Date: 2020年11月11日
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:fields>
<bm:field name="file_name"/>
<bm:field name="file_path"/>
<bm:field name="file_size"/>
</bm:fields>
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select fa.file_name,fa.file_path,fa.file_size,ct.order_seq
from fnd_atm_attachment fa, fnd_atm_attachment_multi fm,con_contract_content cc,con_clause_templet ct
where fa.attachment_id = fm.attachment_id
and fm.table_name = 'CON_CONTRACT_CONTENT'
and cc.content_id = fm.table_pk_value
and cc.templet_id = ct.templet_id
and ct.templet_usage = 'AGENT_CONTRACT'
and fm.table_pk_value in
(select t.content_id
from con_contract_content t
where t.contract_id = ${@contract_id}
and t.clause_usage != 'CHANGE_REQ')
order by ct.order_seq
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -5,97 +5,6 @@
<bm:query-sql><![CDATA[
select *
from (select t1.contract_id,
t1.contract_number,
t1.contract_status,
t1.bp_id_tenant,
(select hm.bp_name
from hls_bp_master hm
where hm.bp_id = t1.bp_id_tenant) bp_id_tenant_n,
cr.ec_sign_type,
decode(cr.ec_sign_type,
'INITIATE',
'待签约',
'SIGNING',
'待签约') AS ec_sign_type_n,
(select hm.id_card_no
from hls_bp_master hm
where hm.bp_id = t1.bp_id_tenant) id_card_no_tenant,
t1.bp_id_agent_level1,
(select hm.bp_name
from hls_bp_master hm
where hm.bp_id = t1.bp_id_agent_level1) bp_id_agent_level1_n,
(select hm.id_card_no_leg
from hls_bp_master hm
where hm.bp_id = t1.bp_id_agent_level1) id_card_no_agent,
decode((SELECT cs.esign_type
from con_contract_ele_signer cs
where cs.contract_id = t1.contract_id
and cs.id_no = ${@id_no}
and cs.id_type = ${@id_type}
and rownum = 1),
'CE',
'合同签约',
'ET',
'提前结清') contract_status_n,
(select ci.brand_id
from con_contract_lease_item ci
where ci.contract_id = t1.contract_id
and ci.equipment_type = 'MAIN') brand_id,
NVL((SELECT a.description
FROM hls_car_brands_vl a
WHERE a.brand_id =
(select ci.brand_id
from con_contract_lease_item ci
where ci.contract_id = t1.contract_id
and ci.equipment_type = 'MAIN')),
'日立') brand_id_n,
(select ci.modelcd
from con_contract_lease_item ci
where ci.contract_id = t1.contract_id
and ci.equipment_type = 'MAIN') modelcd, --机型
(SELECT i.machine_number
FROM con_contract_lease_item i
WHERE i.contract_id = t1.contract_id
AND i.equipment_type = 'MAIN') machine_number, --机号
t1.lease_times, --期数
(NVL(t1.down_payment, 0) + NVL(t1.residual_value, 0) +
NVL(t1.total_rental, 0)) total_sign,
(SELECT cs.sign_url
from con_contract_ele_signer cs
where cs.contract_id = t1.contract_id
and ((${@account_type} = 'AG' and
cs.id_no =
(select hm.social_code
from hls_bp_master hm
where t1.bp_id_tenant = hm.bp_id)) or
(${@account_type} != 'AG' and
cs.id_no = ${@id_no}))
and rownum = 1) sign_url,
(SELECT nvl(cs.ec_sign_status, 'N')
from con_contract_ele_signer cs
where cs.contract_id = t1.contract_id
and cs.id_no = ${@id_no}
and cs.id_type = ${@id_type}
and rownum = 1) userSignStatus
from con_contract t1, con_contract_change_req cr
where t1.contract_id = cr.contract_id
and cr.ec_sign_type in ('INITIATE', 'SIGNING')
and cr.sign_type = 'ELE_SIGN'
and ((${@account_type} = 'PE' and exists (select 1 from con_contract_bp ccb ,hls_bp_master hb
where ccb.bp_id = hb.bp_id
and ccb.contract_id = t1.contract_id
and ccb.bp_category in ('TENANT','GUARANTOR') and (ccb.id_card_no = ${@id_no} or ccb.id_no_sp = ${@id_no})))
or (${@account_type} = 'AG' and exists (select 1 from hls_bp_master_signer hs where hs.hls_bp_signer_id = t1.signer and hs.id_card = ${@id_no}))
or (${@account_type} = 'AG' and exists (select 1 from con_contract_bp cb where cb.contract_id = t1.contract_id and cb.bp_category = 'GUARANTOR' and cb.bp_class = 'ORG' and cb.id_card_no_leg = ${@id_no}))
or (${@account_type} = 'LP' and exists
(select 1
from con_contract_bp cb, hls_bp_master hb
where cb.bp_id = hb.bp_id
and cb.contract_id = t1.contract_id
and hb.social_code = ${@id_no}))
)
UNION ALL
select t1.contract_id,
t1.contract_number,
t1.contract_status,
t1.bp_id_tenant,
......@@ -151,17 +60,24 @@ select *
t1.lease_times, --期数
(NVL(t1.down_payment, 0) + NVL(t1.residual_value, 0) +
NVL(t1.total_rental, 0)) total_sign,
(SELECT cs.sign_url
from con_contract_ele_signer cs
where cs.contract_id = t1.contract_id
and ((${@account_type} = 'AG' and
cs.id_no =
(select hm.social_code
from hls_bp_master hm
where t1.bp_id_tenant = hm.bp_id)) or
(${@account_type} != 'AG' and
cs.id_no = ${@id_no}))
and rownum = 1) sign_url,
(SELECT cs.sign_url
from con_contract_ele_signer cs
where cs.contract_id = t1.contract_id
and ((${@account_type} = 'AG' and
(cs.id_no =
(select hm.social_code
from hls_bp_master hm, con_contract_bp cb
where hm.bp_id = cb.bp_id
and cb.contract_id = t1.contract_id
and cb.id_card_no_leg = ${@id_no}) or
cs.id_no =
(select hm.social_code
from hls_bp_master hm, hls_bp_master_signer hs
where hm.bp_id = hs.bp_id
and hm.bp_id = t1.bp_id_tenant
and hs.id_card = ${@id_no}))) or
(${@account_type} != 'AG' and cs.id_no = ${@id_no}))
and rownum = 1) sign_url,
(SELECT nvl(cs.ec_sign_status, 'N')
from con_contract_ele_signer cs
where cs.contract_id = t1.contract_id
......@@ -172,20 +88,32 @@ select *
where t1.data_class = 'NORMAL'
and t1.ec_sign_type in ('INITIATE', 'SIGNING')
and t1.sign_type = 'ELE_SIGN'
and ((${@account_type} = 'PE' and exists (select 1 from con_contract_bp ccb ,hls_bp_master hb
where ccb.bp_id = hb.bp_id
and ccb.contract_id = t1.contract_id
and ccb.bp_category in ('TENANT','GUARANTOR') and (ccb.id_card_no = ${@id_no} or ccb.id_no_sp = ${@id_no})))
or (${@account_type} = 'AG' and exists (select 1 from hls_bp_master_signer hs where hs.hls_bp_signer_id = t1.signer and hs.id_card = ${@id_no}))
or (${@account_type} = 'AG' and exists (select 1 from con_contract_bp cb where cb.contract_id = t1.contract_id and cb.bp_category = 'GUARANTOR' and cb.bp_class = 'ORG' and cb.id_card_no_leg = ${@id_no}))
or (${@account_type} = 'LP' and exists
(select 1
from con_contract_bp cb, hls_bp_master hb
where cb.bp_id = hb.bp_id
and cb.contract_id = t1.contract_id
and hb.social_code = ${@id_no}))
)
) v
and ((${@account_type} = 'PE' and exists
(select 1
from con_contract_bp ccb, hls_bp_master hb
where ccb.bp_id = hb.bp_id
and ccb.contract_id = t1.contract_id
and ccb.bp_category in ('TENANT', 'GUARANTOR')
and (ccb.id_card_no = ${@id_no} or
ccb.id_no_sp = ${@id_no}))) or
(${@account_type} = 'AG' and exists
(select 1
from hls_bp_master_signer hs
where hs.hls_bp_signer_id = t1.signer
and hs.id_card = ${@id_no})) or
(${@account_type} = 'AG' and exists
(select 1
from con_contract_bp cb
where cb.contract_id = t1.contract_id
and cb.bp_category = 'GUARANTOR'
and cb.bp_class = 'ORG'
and cb.id_card_no_leg = ${@id_no})) or
(${@account_type} = 'LP' and exists
(select 1
from con_contract_bp cb, hls_bp_master hb
where cb.bp_id = hb.bp_id
and cb.contract_id = t1.contract_id
and hb.social_code = ${@id_no})))) v
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
......
......@@ -24,7 +24,7 @@
<bm:query-sql><![CDATA[
select distinct t.* from (select
cs.contract_id,
(select c.contract_number from con_contract c where c.contract_id = cs.contract_id and c.data_class = 'NORMAL') contract_number,
(select c.contract_number from con_contract c where c.contract_id = cs.contract_id) contract_number,
cs.bp_id,
cs.bp_name,
cs.id_type,
......
......@@ -13,18 +13,11 @@
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select * from (select c.contract_id, c.ele_flow_id
from con_contract c
where c.sign_type = 'ELE_SIGN'
and nvl(c.ele_file_dl_flag,'N') = 'N'
and c.data_class = 'NORMAL'
and c.flow_status = 2
union all
select cr.contract_id, cr.ele_flow_id
from con_contract_change_req cr
where cr.sign_type = 'ELE_SIGN'
and nvl(cr.ele_file_dl_flag, 'N') = 'N'
and cr.flow_status = 2) t1
select * from (
select c.contract_id, c.ele_flow_id
from con_contract_ele_flow c
where nvl(c.ele_file_dl_flag,'N') = 'N'
and c.flow_status = 2) t1
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
......@@ -43,13 +36,9 @@
<bm:operation name="execute">
<bm:update-sql><![CDATA[
BEGIN
update con_contract c
set c.ele_file_dl_flag = 'Y'
where c.ele_flow_id =${@flow_id}
and c.contract_id =${@contract_id};
update con_contract_change_req cr
set cr.ele_file_dl_flag = 'Y'
update con_contract_ele_flow cr
set cr.ele_file_dl_flag = 'Y',
cr.last_update_date = sysdate
where cr.ele_flow_id =${@flow_id}
and cr.contract_id =${@contract_id};
COMMIT;
......
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:fields>
<bm:field name="ce_num"/>
</bm:fields>
<bm:operations>
<bm:operation name="query">
<bm:query-sql>
select count(cf.ele_flow_id) ce_num
from con_contract_ele_flow cf
where cf.contract_id = ${@contract_id}
and cf.ele_flow_type = 'CE'
and cf.ele_flow_id is not null
</bm:query-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
BEGIN
UPDATE CON_CONTRACT c
SET c.ele_flow_id = ${@flow_id},
c.ec_sign_type = 'INITIATE',
c.sign_contract_status = 'SIGNING',
c.last_updated_by = nvl(${/session/@user_id},1),
c.last_update_date = sysdate
WHERE c.contract_id = ${@contract_id};
END;
BEGIN
insert into con_contract_ele_flow
(con_ele_flow_id,
contract_id,
ele_flow_type,
ele_flow_id,
creation_date,
created_by,
last_updated_by,
last_update_date)
values
(CON_CONTRACT_ELE_FLOW_S.NEXTVAL,
${@contract_id},
${@esign_type},
${@flow_id},
sysdate,
nvl(${/session/@user_id},1),
nvl(${/session/@user_id},1),
sysdate);
END;
]]></bm:update-sql>
</bm:operation>
<bm:operation name="execute">
<bm:update-sql>
BEGIN
UPDATE CON_CONTRACT c
SET c.ec_sign_type = 'INITIATE',
c.sign_contract_status = 'SIGNING',
c.last_updated_by = nvl(${/session/@user_id},1),
c.last_update_date = sysdate
WHERE c.contract_id = ${@contract_id};
end;
</bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -27,6 +27,7 @@
and cf.con_ele_signer_id = cs.con_ele_signer_id
and t.con_contract_bp_id = cb.record_id
and cb.bp_id = cs.bp_id
and t.clause_usage != 'AGENT_CONTRACT'
and cf.templet_code != 'SETTLE_ADVANCE_OEC'
and cs.templet_signer_id = hs.templet_signer_id
and hs.signer_category in ('GUARANTOR_NP','GUARANTOR_SP','GUARANTOR_ORG_SIGN','GUARANTOR_ORG_SEAL')
......@@ -37,6 +38,7 @@
and t.templet_id = cf.templet_id
and cf.con_ele_signer_id = ${@con_ele_signer_id}
and cf.con_ele_signer_id = cs.con_ele_signer_id
and t.clause_usage != 'AGENT_CONTRACT'
and cf.templet_code != 'SETTLE_ADVANCE_OEC'
and cs.templet_signer_id = hs.templet_signer_id
and hs.signer_category not in ('GUARANTOR_NP','GUARANTOR_SP','GUARANTOR_ORG_SIGN','GUARANTOR_ORG_SEAL'))
......
......@@ -11,12 +11,12 @@
cs.last_update_date = sysdate
WHERE cs.contract_id = ${@contract_id}
AND cs.id_no = ${@id_no}
AND cs.esign_type = 'CE';
AND cs.esign_type = ${@esign_type};
update con_contract cc
set cc.ec_sign_type = 'SIGNING',
cc.last_update_date = sysdate
where cc.ele_flow_id = ${@flow_id}
where cc.contract_id = ${@contract_id}
and cc.ec_sign_type != 'SIGNED';
END;
]]></bm:update-sql>
......@@ -27,11 +27,14 @@
update con_contract cc
set cc.ec_sign_type = 'SIGNED',
cc.sign_contract_status = 'SIGN',
cc.flow_status = ${@flow_status},
cc.end_time = to_date(${@end_time},'yyyy-mm-dd HH24:MI:SS'),
cc.last_update_date = sysdate
where cc.ele_flow_id = ${@flow_id}
and cc.contract_id = ${@contract_id};
where cc.contract_id = ${@contract_id};
update con_contract_ele_flow cf
set cf.flow_status = ${@flow_status},
cf.end_time = to_date(${@end_time},'yyyy-mm-dd HH24:MI:SS'),
cf.last_update_date = sysdate
where cf.ele_flow_id = ${@flow_id};
update con_contract_ele_signer cs
set cs.ec_sign_status = 'Y',
......
......@@ -22,10 +22,10 @@
and cc.templet_id = ct.templet_id
and fm.table_pk_value in
(select t.content_id
from con_contract_content t,con_ele_signer_file cf
from con_contract_content t
where t.contract_id = ${@contract_id}
and t.templet_id = cf.templet_id
and cf.templet_code != 'SETTLE_ADVANCE_OEC')
and t.clause_usage != 'AGENT_CONTRACT'
and t.clause_usage != 'CHANGE_REQ')
order by ct.order_seq
]]></bm:query-sql>
</bm:operation>
......
......@@ -30,8 +30,7 @@
select * from (select cs.con_ele_signer_id,
(select cc.contract_number
from con_contract cc
where cc.contract_id = cs.contract_id
and cc.data_class = 'NORMAL') contract_number,
where cc.contract_id = cs.contract_id) contract_number,
cs.contract_id,
cs.bp_id,
cs.bp_name,
......
......@@ -22,10 +22,9 @@
and cc.templet_id = ct.templet_id
and fm.table_pk_value in
(select t.content_id
from con_contract_content t,con_ele_signer_file cf
from con_contract_content t
where t.contract_id = ${@contract_id}
and t.templet_id = cf.templet_id
and cf.templet_code = 'SETTLE_ADVANCE_OEC')
and t.clause_usage = 'CHANGE_REQ')
order by ct.order_seq
]]></bm:query-sql>
</bm:operation>
......
......@@ -48,14 +48,27 @@ select fa.file_name,fa.file_path,fa.attachment_id
from con_ele_signer_file cf, con_contract_ele_signer cs
where cf.con_ele_signer_id = cs.con_ele_signer_id
and cs.contract_id = ${@contract_id}
and (((select cr.id_type from con_contract_ele_signer cr where cr.id_no = ${@id_no} and rownum = 1) = 'IdCard'
and ((((select cb.bp_category
from con_contract_bp cb, hls_bp_master hm
where cb.bp_id = hm.bp_id
and hm.social_code = ${@id_no}
and cb.contract_id = cs.contract_id) != 'AGENT' or
(select cb.bp_category
from con_contract_bp cb, hls_bp_master hm
where cb.bp_id = hm.bp_id
and hm.social_code = ${@id_no}
and cb.contract_id = cs.contract_id) is null)
and exists (select 1 from hls_doc_file_templet_signer hs,con_clause_templet ct,hls_doc_file_templet ht
where hs.templet_id = ht.templet_id
and ht.templet_code = ct.templet_code
and ct.templet_id = cf.templet_id
and hs.enable_flag = 'Y'
and hs.signer_category not in ('AGENCY_STORE_SEAL','AGENCY_STORE_SIGN','HONGLING_SEAL','HONGLING_SIGN')))
or (select cr.id_type from con_contract_ele_signer cr where cr.id_no = ${@id_no} and rownum = 1) = 'license'))
or (select cb.bp_category
from con_contract_bp cb, hls_bp_master hm
where cb.bp_id = hm.bp_id
and hm.social_code = ${@id_no}
and cb.contract_id = cs.contract_id) = 'AGENT'))
and pi.cdd_list_id =
(select cc.cdd_list_id
from con_contract cc
......
......@@ -9,43 +9,50 @@
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select fa.file_name, fa.file_path, fa.file_size, ct.order_seq
from fnd_atm_attachment fa,
fnd_atm_attachment_multi fm,
con_contract_content cc,
con_clause_templet ct
where fa.attachment_id = fm.attachment_id
and fm.table_name = 'CON_CONTRACT_CONTENT'
and cc.contract_id = ${@contract_id}
and cc.content_id = fm.table_pk_value
and cc.templet_id = ct.templet_id
and fm.table_pk_value = cc.content_id
and ct.templet_code in
(select cf.templet_code
from con_ele_signer_file cf, con_contract_ele_signer cs
where cf.con_ele_signer_id = cs.con_ele_signer_id
and cs.contract_id = ${@contract_id}
and (((select cr.id_type
from con_contract_ele_signer cr
where cr.id_no = ${@id_no}
and rownum = 1) = 'IdCard' and exists
(select 1
from hls_doc_file_templet_signer hs,
con_clause_templet ct,
hls_doc_file_templet ht
where hs.templet_id = ht.templet_id
and ht.templet_code = ct.templet_code
and ct.templet_id = cf.templet_id
and hs.enable_flag = 'Y'
and hs.signer_category not in
('AGENCY_STORE_SEAL',
'AGENCY_STORE_SIGN',
'HONGLING_SEAL',
'HONGLING_SIGN'))) or
(select cr.id_type
from con_contract_ele_signer cr
where cr.id_no = ${@id_no}
and rownum = 1) = 'license'))
select fa.file_name, fa.file_path, fa.file_size, ct.order_seq
from fnd_atm_attachment fa,
fnd_atm_attachment_multi fm,
con_contract_content cc,
con_clause_templet ct
where fa.attachment_id = fm.attachment_id
and fm.table_name = 'CON_CONTRACT_CONTENT'
and cc.contract_id = ${@contract_id}
and cc.content_id = fm.table_pk_value
and cc.templet_id = ct.templet_id
and fm.table_pk_value = cc.content_id
and ct.templet_code in
(select cf.templet_code
from con_ele_signer_file cf, con_contract_ele_signer cs
where cf.con_ele_signer_id = cs.con_ele_signer_id
and cs.contract_id = cc.contract_id
and ((((select cb.bp_category
from con_contract_bp cb, hls_bp_master hm
where cb.bp_id = hm.bp_id
and hm.social_code = ${@id_no}
and cb.contract_id = cc.contract_id) != 'AGENT' or
(select cb.bp_category
from con_contract_bp cb, hls_bp_master hm
where cb.bp_id = hm.bp_id
and hm.social_code = ${@id_no}
and cb.contract_id = cc.contract_id) is null) and
exists (select 1
from hls_doc_file_templet_signer hs,
con_clause_templet ct,
hls_doc_file_templet ht
where hs.templet_id = ht.templet_id
and ht.templet_code = ct.templet_code
and ct.templet_id = cf.templet_id
and hs.enable_flag = 'Y'
and hs.signer_category not in
('AGENCY_STORE_SEAL',
'AGENCY_STORE_SIGN',
'HONGLING_SEAL',
'HONGLING_SIGN'))) or
(select cb.bp_category
from con_contract_bp cb, hls_bp_master hm
where cb.bp_id = hm.bp_id
and hm.social_code = ${@id_no}
and cb.contract_id = cc.contract_id) = 'AGENT'))
order by ct.order_seq
]]></bm:query-sql>
</bm:operation>
......
<?xml version="1.0" encoding="UTF-8"?><!-- $Author: zlf $Date: 2014-11-10 下午5:42:24 $Revision: 1.0 $Purpose: --><a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true" dynamiccreateenabled="true" trace="true"> <a:init-procedure> <a:model-query fetchAll="true" model="cont.CON500.con_contract_get_guid_file_name" rootPath="file_name_path"/> <s:server-script import="contract_print_path.js"><![CDATA[ $ctx.parameter.file_path = con_print_path['con_print_path']; $ctx.parameter.tomcat_source = con_print_path['tomcat_source']; ]]> </s:server-script> <s:server-script import="con_print_path.js"><![CDATA[ set_parameter_file_path(); ]]> </s:server-script> </a:init-procedure> <a:view> <a:link id="wfl_readonly_pageLink_projectQueryScreen_update_project" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain_readonly.lview"/> <a:link id="${/parameter/@layout_code}_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/> <a:link id="${/parameter/@layout_code}_con_contract_content_confirm_link_id" url="${/request/@context_path}/modules/cont/CON501N/con_contract_content_confirm.lview"/> <a:link id="contract_lease_item_query_link" url="${/request/@context_path}/modules/cont/CON505/con_lease_item_query.lview"/> <a:link id="contract_history_window_link" url="${/request/@context_path}/modules/cont/CON501N/con_document_history_query.lview"/> <a:link id="con505_hls_bp_master_query_link" url="${/request/@context_path}/modules/cont/CON505/hls_bp_master_query.lview"/> <a:link id="${/parameter/@layout_code}_prj500_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/> <a:link id="${/parameter/@layout_code}_prj500_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/> <!--打印使用--> <a:link id="${/parameter/@layout_code}_con505_contract_content_id" model="cont.CON505.con505_contract_content" modelaction="update"/> <a:link id="${/parameter/@layout_code}_creat_con_contract_content_link_id" model="cont.CON505.con505_contract_content" modelaction="execute"/> <a:link id="${/parameter/@layout_code}_file_copy_from_template_link_id" url="${/request/@context_path}/modules/cont/CON505/file_copy_from_template.lsc"/> <a:link id="${/parameter/@layout_code}_con_batch_dl_link_id" url="${/request/@context_path}/modules/cont/CON505/con_atm_batch_dl.lsc"/> <a:link id="${/parameter/@layout_code}_con_cashflow_wirte_off_detail_link" url="${/request/@context_path}/modules/cont/CON302N/con_cashflow_wirte_off_detail.lview"/> <a:link id="con_approval_link_id" model="cont.CON505.contract_approval" modelaction="update"/> <a:link id="con_sign_cancel_link_id" model="cont.CON505.contract_sign_cancel" modelaction="update"/> <a:link id="${/parameter/@layout_code}_con_ele_content_create_link_id" url="${/request/@context_path}/modules/wx/WX100/con_ele_content_create.lsc"/> <a:link id="${/parameter/@layout_code}_con_ele_sign_cancel_link_id" url="${/request/@context_path}/modules/cont/CON505/con_ele_sign_cancel.lsc"/> <a:link id="${/parameter/@layout_code}_ele_operator_verify_link_id" url="${/request/@context_path}/modules/wx/WX100/wx_ele_verify_operator.lsc"/> <link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/> <script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/> <script type="text/javascript"><![CDATA[ Ext.ux.Lightbox.register('a[ref=img]', true); function lock_current_window() { Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}'); } function unlock_current_window() { Leaf.Masker.unmask(Ext.getBody()); } window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var contract_id = $(ds_id).getCurrentRecord().get('contract_id'); new Leaf.Window({ id: 'contract_history_window', url: $('contract_history_window_link').getUrl(), params: { contract_id: contract_id }, fullScreen: true }); }; // window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) { // if (name == 'car_detail') { // return '<a href="javascript:open_contract_window(\'' + record.id + '\',\'' + record.ds.id + '\')">' + config_record.get('prompt') + '</a>'; // } // return value; // }; window['${/parameter/@layout_code}_received_amount_detail'] = function (ds_id, id, name, query_only) { var url = $('${/parameter/@layout_code}_con_cashflow_wirte_off_detail_link').getUrl(); var record = $(ds_id).findById(id); if (record) { var win = new Leaf.Window({ id: 'con_cashflow_wirte_off_detail_window', url: url, params: { cashflow_id: record.get('cashflow_id'), winid: 'con_cashflow_wirte_off_detail_window' }, draggable: true, fullScreen: true }); } }; window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) { var link_function = ''; window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record; if (name == 'project_number') { return '<a href="javascript:wfl_prj501_grid_update(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>'; } else if (name == 'gps_attch') { link_function = '${/parameter/@layout_code}_ast_con_cdd4_attachtment_upload'; if (record.get('atm_num3') > 0) { return '<a style="color:red" href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } else { return '<a style="font-weight:bolder;font-size:1.2em" href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } } else if (name == 'description') { if (record.get('important_flag') == 'Y') { return '<font color="RED">' + value + '</font>'; } return value; } else if (name == 'bp_link' && record.get('bp_id') && record.get('record_id')) { link_function = '${/parameter/@layout_code}_open_bp_detail_window'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>'; } else if (name == 'car_detail' && record.get('contract_lease_item_id')) { link_function = '${/parameter/@layout_code}_open_lease_item_detail_window'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>'; } else if (name == 'attachment') { link_function = '${/parameter/@layout_code}_prj500_cdd_attachtment_upload'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } else if (name == 'attach_file_name' || name == 'attach_file_name_print' || name == 'attachment_new') { var content_type = record.get('content_type'); var content_id = record.get('content_id'); //电子合同 // if(content_type == '01'){ // var link = '${/request/@context_path}/modules/xxx/pdf_download.lsc?type=SIN&content_id=' + content_id; // var url = ''; // url = url + '<a href=' + link + '>' + '下载' + '</a>' + ','; // return url; // }else { if (value != null) { var link = '${/request/@context_path}/atm_download.lsc?attachment_id='; var str = value.split(';;'); var url = ''; for (var i = 0; i < str.length; i++) { var temp = str[i].split('--'); if (!Leaf.isEmpty(temp[0])) { var file_name = temp[0].toUpperCase(); var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase(); if (file_name.indexOf('.PDF') >= 0) { url = url + '<a href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>' + ','; } else if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') { url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ','; } else { url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ','; } } } return url; } //} } else if (name == 'received_amount') { link_function = '${/parameter/@layout_code}_received_amount_detail'; if (value) { return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + Leaf.formatMoney(value) + '</a>'; } return ''; } else if (name == 'attach_file_name_new') { link_function = '${/parameter/@layout_code}_prj500_cdd_attachtment_new_upload'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } }; function wfl_prj501_grid_update(record_id, ds_id) { var record = $(ds_id).findById(record_id); var param = {}; param['bp_class'] = record.get('bp_class'); param['project_id'] = record.get('project_id'); param['function_code'] = 'PRJ502D'; param['function_usage'] = 'QUERY'; param['url_title'] = '租赁申请查询'; hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, 'wfl_readonly_pageLink_projectQueryScreen_update_project', record.ds.id, '${/parameter/@layout_code}'); } window['${/parameter/@layout_code}_ast_con_cdd4_attachtment_upload'] = function (ds_id, id, name, query_only) { var record = $(ds_id).findById(id); // if (record.get('con_contract_id')) { var url; if (query_only == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('contract_id'); } else { url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('contract_id'); } var win = new Leaf.Window({ url: url, title: 'gps附件上传', id: '${/parameter/@layout_code}${/parameter/@tree_code}_ast_con_cdd4_attachtment_upload_id', width: 850, height: 400 }); // win.on('close', function(){ // $(ds_id).query(); // }); // } else { // Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); // } }; window['${/parameter/@layout_code}_open_lease_item_detail_window'] = function (id, name) { var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name]; var param = record.data; var contract_lease_item_id = record.get('contract_lease_item_id'); new Leaf.Window({ id: 'contract_lease_item_maintain_window', url: $('contract_lease_item_query_link').getUrl(), params: { contract_lease_item_id: contract_lease_item_id, winid: 'contract_lease_item_maintain_window' }, draggable: true, fullScreen: true }); }; window['${/parameter/@layout_code}_open_bp_detail_window'] = function (id, name) { var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name]; var param = {};//record.data; param['bp_id'] = record.get('bp_id'); param['cdd_list_id'] = record.get('cdd_list_id'); param['company_id'] = '${/session/company_id}'; param['document_id'] = record.get('bp_id'); param['document_category'] = 'BP'; param['bp_class'] = record.get('bp_class'); param['bp_category'] = record.get('bp_category'); if (record.get('bp_category') == 'AGENT') { param['function_code'] = 'HLS303_Q'; param['function_usage'] = 'QUERY'; } else { param['function_code'] = 'CON505H'; param['function_usage'] = 'QUERY'; } param['bp_type'] = record.get('bp_type'); param['download'] = 'Y'; param['url_title'] = '${l:HLS212.BP_MASTER_QUERY}'; hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, 'con505_hls_bp_master_query_link', record.ds.id, '${/parameter/@layout_code}'); }; // function open_contract_window(record_id, ds_id) { // var record = $(ds_id).findById(record_id); // var param = record.data; // var contract_lease_item_id = record.get('contract_lease_item_id'); // new Leaf.Window({ // id: 'contract_lease_item_maintain_window', // url: $('contract_lease_item_maintain_link').getUrl(), // params: { // contract_lease_item_id: contract_lease_item_id // }, // fullScreen: true // }); // // param['function_code'] = 'CON501D'; // // param['function_usage'] = 'MODIFY'; // // param['maintain_type'] = 'UPDATE'; // // param['url_title'] = '${l:CON301.CONTRACT_DETAIL}'; // // hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_modify_link',ds_id); // } window['${/parameter/@layout_code}_prj500_cdd_attachtment_upload'] = function (ds_id, id, name, query_only) { var record = $(ds_id).findById(id); if (record.get('check_id')) { var url; //add by lijingjing 2019-11-15 if (record.get('attachment_tab_group') == 'CREDIT_CHECK' && '${/parameter/@query_only}' == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else if (record.get('attachment_tab_group') == 'SIGN' && '${/parameter/@con_query_only}' == 'N') { url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else if (record.get('attachment_tab_group') == 'SIGN' && '${/parameter/@con_query_only}' == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else if (query_only == 'Y' || '${/parameter/@download}' == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else { url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } var win = new Leaf.Window({ url: url, title: '${l:HLS.SUPPORTING_DOCUMENT}', id: '${/parameter/@layout_code}${/parameter/@tree_code}_prj500_cdd_uploadFile_screen_id', width: 850, height: 400 }); win.on('close', function () { record.ds.query(); }); } else { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); } }; window['${/parameter/@layout_code}_prj500_cdd_attachtment_new_upload'] = function (ds_id, id, name, query_only) { var record = $(ds_id).findById(id); if (record.get('check_id')) { var url; //add by lijingjing 2019-11-15 if (query_only == 'Y' || '${/parameter/@download}' == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('check_id'); } else { url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('check_id'); } var win = new Leaf.Window({ url: url, title: '${l:HLS.SUPPORTING_DOCUMENT}', id: '${/parameter/@layout_code}${/parameter/@tree_code}_prj500_cdd_uploadFile_screen_id', width: 850, height: 400 }); win.on('close', function () { record.ds.query(); }); } else { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); } }; window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function () { // var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var record = $(ds_id).getCurrentRecord(); var content_id; //alert($('${/parameter/@layout_code}_con505_contract_content_id').getUrl); Leaf.request({ url: $('${/parameter/@layout_code}_con505_contract_content_id').getUrl(), para: { content_id: content_id, contract_id: record.get('contract_id'), contract_bp_id: record.get('content_bp_pk'), clause_usage: 'GH_WITHHOLD_AGREE' }, success: function (rsc) { // //alert(rsc.result.content_id); Leaf.request({ url: $('${/parameter/@layout_code}_creat_con_contract_content_link_id').getUrl(), para: { content_id: rsc.result.content_id, file_path: '${/parameter/@file_path}' }, success: function () { Leaf.request({ url: $('${/parameter/@layout_code}_file_copy_from_template_link_id').getUrl(), para: { contract_id: record.get('contract_id'), content_id: rsc.result.content_id, file_path: '${/parameter/@file_path}', batch_flag: 'Y' }, success: function () { var url = $('${/parameter/@layout_code}_con_batch_dl_link_id').getUrl() + '?contract_id=' + record.get('contract_id') + '&content_id=' + rsc.result.content_id; window.open(url, '_self'); unlock_current_window(); } }); unlock_current_window(); }, error: function () { unlock_current_window(); }, failure: function () { unlock_current_window(); }, scope: this }); }, error: function () { unlock_current_window(); }, failure: function () { unlock_current_window(); }, scope: this }); }; window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var record = $(ds_id).getCurrentRecord(); var direct_debit_bank_id = record.get('direct_debit_bank_id'); var dd_bank_account_name = record.get('dd_bank_account_name'); var dd_bank_account_num = record.get('dd_bank_account_num'); if (!Ext.isEmpty(record.get('contract_number'))) { new Leaf.Window({ id: '${/parameter/@layout_code}_con_contract_content_confirm_win_id', params: { action: 'VIEW', contract_id: record.get('contract_id'), company_id: record.get('company_id'), document_category: record.get('document_category'), business_type: record.get('business_type'), winid: '${/parameter/@layout_code}_con_contract_content_confirm_win_id' }, url: $('${/parameter/@layout_code}_con_contract_content_confirm_link_id').getUrl(), title: '合同查看', width: 1300, height: 550 }); } else { Leaf.showErrorMessage('错误', '请先点击保存生成合同编号!'); } }; var change_flag = 'N'; //工作流中合同文本生成按钮 //基本信息tab页 新增必输字段的校验 add by liukang 20160328 window['${/parameter/@layout_code}_print_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var con_lease_item_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_lease_item'); var record = $(ds_id).getCurrentRecord(); var con_lease_record = $(con_lease_item_id).getCurrentRecord(); var direct_debit_bank_id = record.get('direct_debit_bank_id'); var dd_bank_account_name = record.get('dd_bank_account_name'); var dd_bank_account_num = record.get('dd_bank_account_num'); var color_of_apprearance = con_lease_record.get('color_of_apprearance'); var item_frame_number = con_lease_record.get('item_frame_number'); var item_engine_number = con_lease_record.get('item_engine_number'); var license_number = con_lease_record.get('license_number'); /* if (Ext.isEmpty(direct_debit_bank_id)) { Leaf.showMessage('${l:HLS.PROMPT}', '请先填写数据并保存!'); } else */ if (!Ext.isEmpty(record.get('contract_number'))) { var win = new Leaf.Window({ id: '${/parameter/@layout_code}_con_contract_content_confirm_win_id', params: { contract_id: record.get('contract_id'), company_id: record.get('company_id'), document_category: record.get('document_category'), business_type: record.get('business_type'), winid: '${/parameter/@layout_code}_con_contract_content_confirm_win_id', change_flag: change_flag, contract_name: record.get('contract_name'), contract_number: record.get('contract_number') }, url: $('${/parameter/@layout_code}_con_contract_content_confirm_link_id').getUrl(), title: '合同文本生成', width: 1300, height: 550 }); //在关闭页面之后,刷新一下ds win.on('close', function () { if (ds_id) { $(ds_id).query(); } }); } else { Leaf.showErrorMessage('错误', '请先点击保存生成合同编号!'); } }; //add by zhuxianfei 20180207 function view_pdf(attachment_id) { Leaf.request({ url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query', para: { attachment_id: attachment_id }, success: function (res) { var path = res.result.record.file_path; path = path.substr(path.indexOf('hls_attachment')); var tomcat_source = '${/parameter/@tomcat_source}'; var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path + '?type=pdf'; var oWin = window.open(source_path); }, scope: this }); } window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function (ds, qpara, bp_seq) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_bs_score'); if (ds.id == ds_id) { qpara.contract_id = '${/parameter/@contract_id}'; //$(ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}'); } }; window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) { debugger; var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); if (ds_id == ds.id && ds_id) { //业务类型回租时,默认只读“首付款抵扣”选项 if (record.get('business_type') == 'LEASEBACK' && '${/parameter/@function_usage}' == 'MODIFY') { //document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT_prompt').style.display = 'block'; // document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT').style.display = 'block'; record.getField('entrusted_amount').setRequired(true); } else if (record.get('business_type') == 'LEASE') { document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT_prompt').style.display = 'none'; document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT').style.display = 'none'; } if(record.get('bp_class') == 'NP' || record.get('sign_type_n') == '纸质签约'){ record.getField('signer_n').setReadOnly(true); record.getField('signer_n').setRequired(false); record.set('signer_n',''); }else if ('${/parameter/@function_usage}' == 'MODIFY' && record.get('sign_type_n') == '电子签约' && record.get('bp_class') == 'ORG'){ record.getField('signer_n').setReadOnly(false); record.getField('signer_n').setRequired(true); } } }; //更新时调用 window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); if (ds_id == ds.id && ds_id) { var record = $(ds_id).getCurrentRecord(); var bp_tenant_class = record.get('bp_class'); if (name == 'sign_type_n') { if(value == '纸质签约'){ record.getField('signer_n').setReadOnly(true); record.getField('signer_n').setRequired(false); record.set('signer_n',''); }else if (value == '电子签约' && bp_tenant_class == 'ORG'){ record.getField('signer_n').setReadOnly(false); record.getField('signer_n').setRequired(true); record.set('ec_sign_type','NEW'); record.set('sign_contract_status','NEW'); }else if(value == '电子签约' && bp_tenant_class == 'NP'){ record.getField('signer_n').setReadOnly(true); record.set('ec_sign_type','NEW'); record.set('sign_contract_status','NEW'); } } } }; /*保存前调用校验*/ window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) { debugger; var check_flag = true; var contract_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var con_record = $(contract_ds_id).getAt(0); if (contract_ds_id == ds.id&&$(contract_ds_id).validate()) { if (con_record.get('business_type') == 'LEASEBACK') { //“保存”按钮增加校验:若所填写小于0或大于设备款价格,点击按钮校验提示:“委托付款金额有误,请重新填写!” if (con_record.get('entrusted_amount') < 0 || con_record.get('entrusted_amount') > minus(con_record.get('lease_item_amount'),con_record.get('down_payment'))) { Leaf.showMessage('${HLS.PROMPT}', '委托付款金额有误,请重新填写!'); return false; } } } else { check_flag = false; } return check_flag; }; //取消签约按钮 add by 24976 window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var record = $(ds_id).getCurrentRecord(); var contract_id = record.get('contract_id'); var sign_contract_status = record.get('sign_contract_status'); var sign_type = record.get('sign_type') || 'PAPER_SIGN'; if (sign_contract_status != 'SIGNING') { Leaf.showMessage('${l:PROMPT}', '只有签约中的合同可以取消签约'); return; } if (sign_contract_status == 'SIGNING' && sign_type == 'PAPER_SIGN'){ Leaf.showConfirm('${HLS.PROMPT}', '确认要取消签约吗?', function () { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request({ url: $('con_sign_cancel_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); }else if(sign_type == 'ELE_SIGN' && sign_contract_status == 'SIGNING'){ Leaf.showConfirm('${HLS.PROMPT}', '确认取消电子签约吗?', function () { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request({ url: $('${/parameter/@layout_code}_con_ele_sign_cancel_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); } }; window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var record = $(ds_id).getCurrentRecord(); var contract_id = record.get('contract_id'); //add by 24976 var sign_type = record.get('sign_type'); var contract_inception_date = record.get('contract_inception_date'); var con_lease_item_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_lease_item'); var con_lease_record = $(con_lease_item_id).getCurrentRecord(); var machine_number = con_lease_record.get('machine_number'); if (record.dirty == true) { Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}'); return; } // if(record.get('contract_status')!='NEW'){ // $L.showErrorMessage("错误",'只能新建状态的合同才能发起签约!'); // return; // } if ($(ds_id).validate()) { if (sign_type == 'ELE_SIGN'){ Leaf.showConfirm('${HLS.PROMPT}', '确认要发起电子签约吗?', function () { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); //校验起租日 var date = new Date(); date.setTime(date.getTime()); if (contract_inception_date < date) { Leaf.showMessage('${l:PROMPT}', '起租日小于当前时间,不允许发起电子签约!'); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); return; } if (Ext.isEmpty(machine_number)) { Leaf.showMessage('${l:HLS.PROMPT}', '请先填写机号并保存!'); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); return; } Leaf.request({ url:$('${/parameter/@layout_code}_ele_operator_verify_link_id').getUrl(), para:{ contract_id:contract_id, esign_type:'CE' }, scope:this, success: function (res) { if(res.result.check_flag == 'Y'){ Leaf.showConfirm('${HLS.PROMPT}', '该企业下已存在其他经办人,如果发起签约,原账户将失效,请确认是否继续!', function () { Leaf.request({ url: $('${/parameter/@layout_code}_con_ele_content_create_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }else{ Leaf.request({ url: $('${/parameter/@layout_code}_con_ele_content_create_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); } }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); } else if (sign_type == 'PAPER_SIGN'){ Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request({ url: $('con_approval_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); } } }; if ('${/parameter/@source_type}' == 'WFL') { zjwfl5110_ApproveChecker_add('zjwfl5110_submit', function (type) { var con_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); if (type == 'agree') { if ($(con_ds_id).validate()) { if ($(con_ds_id).isModified()) { Leaf.showMessage('${HLS.PROMPT}', '请先保存'); return false; } //提交先保存 return true; } else { return false; } } else return true; }); } Leaf.onReady(function () { var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_INVOICE_INFO', 'con_contract_bp'); if (ds_id) { $(ds_id).setQueryUrl('${/request/@context_path}/autocrud/prj.PRJ501N.con_contract_bp/query'); $(ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}'); $(ds_id).query(); } //add by 24976 if("${/parameter/@sign_contract_status}" == 'SIGNING'){ document.getElementById("${/parameter/@layout_code}_user_button4").style.display = ""; }else if("${/parameter/@sign_contract_status}" == 'SIGN'){ document.getElementById("${/parameter/@layout_code}_user_button4").style.display = "none"; } }) ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> </a:view></a:screen>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?><!-- $Author: zlf $Date: 2014-11-10 下午5:42:24 $Revision: 1.0 $Purpose: --><a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true" dynamiccreateenabled="true" trace="true"> <a:init-procedure> <a:model-query fetchAll="true" model="cont.CON500.con_contract_get_guid_file_name" rootPath="file_name_path"/> <s:server-script import="contract_print_path.js"><![CDATA[ $ctx.parameter.file_path = con_print_path['con_print_path']; $ctx.parameter.tomcat_source = con_print_path['tomcat_source']; ]]> </s:server-script> <s:server-script import="con_print_path.js"><![CDATA[ set_parameter_file_path(); ]]> </s:server-script> </a:init-procedure> <a:view> <a:link id="wfl_readonly_pageLink_projectQueryScreen_update_project" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain_readonly.lview"/> <a:link id="${/parameter/@layout_code}_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/> <a:link id="${/parameter/@layout_code}_con_contract_content_confirm_link_id" url="${/request/@context_path}/modules/cont/CON501N/con_contract_content_confirm.lview"/> <a:link id="contract_lease_item_query_link" url="${/request/@context_path}/modules/cont/CON505/con_lease_item_query.lview"/> <a:link id="contract_history_window_link" url="${/request/@context_path}/modules/cont/CON501N/con_document_history_query.lview"/> <a:link id="con505_hls_bp_master_query_link" url="${/request/@context_path}/modules/cont/CON505/hls_bp_master_query.lview"/> <a:link id="${/parameter/@layout_code}_prj500_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/> <a:link id="${/parameter/@layout_code}_prj500_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/> <!--打印使用--> <a:link id="${/parameter/@layout_code}_con505_contract_content_id" model="cont.CON505.con505_contract_content" modelaction="update"/> <a:link id="${/parameter/@layout_code}_creat_con_contract_content_link_id" model="cont.CON505.con505_contract_content" modelaction="execute"/> <a:link id="${/parameter/@layout_code}_file_copy_from_template_link_id" url="${/request/@context_path}/modules/cont/CON505/file_copy_from_template.lsc"/> <a:link id="${/parameter/@layout_code}_con_batch_dl_link_id" url="${/request/@context_path}/modules/cont/CON505/con_atm_batch_dl.lsc"/> <a:link id="${/parameter/@layout_code}_con_cashflow_wirte_off_detail_link" url="${/request/@context_path}/modules/cont/CON302N/con_cashflow_wirte_off_detail.lview"/> <a:link id="con_approval_link_id" model="cont.CON505.contract_approval" modelaction="update"/> <a:link id="con_sign_cancel_link_id" model="cont.CON505.contract_sign_cancel" modelaction="update"/> <a:link id="${/parameter/@layout_code}_con_ele_content_create_link_id" url="${/request/@context_path}/modules/wx/WX100/con_ele_content_create.lsc"/> <a:link id="${/parameter/@layout_code}_con_ele_agent_link_id" url="${/request/@context_path}/modules/wx/WX100/con_ele_agent_content_create.lsc"/> <a:link id="${/parameter/@layout_code}_con_ele_sign_cancel_link_id" url="${/request/@context_path}/modules/cont/CON505/con_ele_sign_cancel.lsc"/> <a:link id="${/parameter/@layout_code}_ele_operator_verify_link_id" url="${/request/@context_path}/modules/wx/WX100/wx_ele_verify_operator.lsc"/> <link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/> <script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/> <script type="text/javascript"><![CDATA[ Ext.ux.Lightbox.register('a[ref=img]', true); function lock_current_window() { Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}'); } function unlock_current_window() { Leaf.Masker.unmask(Ext.getBody()); } window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var contract_id = $(ds_id).getCurrentRecord().get('contract_id'); new Leaf.Window({ id: 'contract_history_window', url: $('contract_history_window_link').getUrl(), params: { contract_id: contract_id }, fullScreen: true }); }; // window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) { // if (name == 'car_detail') { // return '<a href="javascript:open_contract_window(\'' + record.id + '\',\'' + record.ds.id + '\')">' + config_record.get('prompt') + '</a>'; // } // return value; // }; window['${/parameter/@layout_code}_received_amount_detail'] = function (ds_id, id, name, query_only) { var url = $('${/parameter/@layout_code}_con_cashflow_wirte_off_detail_link').getUrl(); var record = $(ds_id).findById(id); if (record) { var win = new Leaf.Window({ id: 'con_cashflow_wirte_off_detail_window', url: url, params: { cashflow_id: record.get('cashflow_id'), winid: 'con_cashflow_wirte_off_detail_window' }, draggable: true, fullScreen: true }); } }; window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) { var link_function = ''; window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record; if (name == 'project_number') { return '<a href="javascript:wfl_prj501_grid_update(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>'; } else if (name == 'gps_attch') { link_function = '${/parameter/@layout_code}_ast_con_cdd4_attachtment_upload'; if (record.get('atm_num3') > 0) { return '<a style="color:red" href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } else { return '<a style="font-weight:bolder;font-size:1.2em" href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } } else if (name == 'description') { if (record.get('important_flag') == 'Y') { return '<font color="RED">' + value + '</font>'; } return value; } else if (name == 'bp_link' && record.get('bp_id') && record.get('record_id')) { link_function = '${/parameter/@layout_code}_open_bp_detail_window'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>'; } else if (name == 'car_detail' && record.get('contract_lease_item_id')) { link_function = '${/parameter/@layout_code}_open_lease_item_detail_window'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>'; } else if (name == 'attachment') { link_function = '${/parameter/@layout_code}_prj500_cdd_attachtment_upload'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } else if (name == 'attach_file_name' || name == 'attach_file_name_print' || name == 'attachment_new') { var content_type = record.get('content_type'); var content_id = record.get('content_id'); //电子合同 // if(content_type == '01'){ // var link = '${/request/@context_path}/modules/xxx/pdf_download.lsc?type=SIN&content_id=' + content_id; // var url = ''; // url = url + '<a href=' + link + '>' + '下载' + '</a>' + ','; // return url; // }else { if (value != null) { var link = '${/request/@context_path}/atm_download.lsc?attachment_id='; var str = value.split(';;'); var url = ''; for (var i = 0; i < str.length; i++) { var temp = str[i].split('--'); if (!Leaf.isEmpty(temp[0])) { var file_name = temp[0].toUpperCase(); var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase(); if (file_name.indexOf('.PDF') >= 0) { url = url + '<a href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>' + ','; } else if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') { url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ','; } else { url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ','; } } } return url; } //} } else if (name == 'received_amount') { link_function = '${/parameter/@layout_code}_received_amount_detail'; if (value) { return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + Leaf.formatMoney(value) + '</a>'; } return ''; } else if (name == 'attach_file_name_new') { link_function = '${/parameter/@layout_code}_prj500_cdd_attachtment_new_upload'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } }; function wfl_prj501_grid_update(record_id, ds_id) { var record = $(ds_id).findById(record_id); var param = {}; param['bp_class'] = record.get('bp_class'); param['project_id'] = record.get('project_id'); param['function_code'] = 'PRJ502D'; param['function_usage'] = 'QUERY'; param['url_title'] = '租赁申请查询'; hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, 'wfl_readonly_pageLink_projectQueryScreen_update_project', record.ds.id, '${/parameter/@layout_code}'); } window['${/parameter/@layout_code}_ast_con_cdd4_attachtment_upload'] = function (ds_id, id, name, query_only) { var record = $(ds_id).findById(id); // if (record.get('con_contract_id')) { var url; if (query_only == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('contract_id'); } else { url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('contract_id'); } var win = new Leaf.Window({ url: url, title: 'gps附件上传', id: '${/parameter/@layout_code}${/parameter/@tree_code}_ast_con_cdd4_attachtment_upload_id', width: 850, height: 400 }); // win.on('close', function(){ // $(ds_id).query(); // }); // } else { // Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); // } }; window['${/parameter/@layout_code}_open_lease_item_detail_window'] = function (id, name) { var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name]; var param = record.data; var contract_lease_item_id = record.get('contract_lease_item_id'); new Leaf.Window({ id: 'contract_lease_item_maintain_window', url: $('contract_lease_item_query_link').getUrl(), params: { contract_lease_item_id: contract_lease_item_id, winid: 'contract_lease_item_maintain_window' }, draggable: true, fullScreen: true }); }; window['${/parameter/@layout_code}_open_bp_detail_window'] = function (id, name) { var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name]; var param = {};//record.data; param['bp_id'] = record.get('bp_id'); param['cdd_list_id'] = record.get('cdd_list_id'); param['company_id'] = '${/session/company_id}'; param['document_id'] = record.get('bp_id'); param['document_category'] = 'BP'; param['bp_class'] = record.get('bp_class'); param['bp_category'] = record.get('bp_category'); if (record.get('bp_category') == 'AGENT') { param['function_code'] = 'HLS303_Q'; param['function_usage'] = 'QUERY'; } else { param['function_code'] = 'CON505H'; param['function_usage'] = 'QUERY'; } param['bp_type'] = record.get('bp_type'); param['download'] = 'Y'; param['url_title'] = '${l:HLS212.BP_MASTER_QUERY}'; hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, 'con505_hls_bp_master_query_link', record.ds.id, '${/parameter/@layout_code}'); }; // function open_contract_window(record_id, ds_id) { // var record = $(ds_id).findById(record_id); // var param = record.data; // var contract_lease_item_id = record.get('contract_lease_item_id'); // new Leaf.Window({ // id: 'contract_lease_item_maintain_window', // url: $('contract_lease_item_maintain_link').getUrl(), // params: { // contract_lease_item_id: contract_lease_item_id // }, // fullScreen: true // }); // // param['function_code'] = 'CON501D'; // // param['function_usage'] = 'MODIFY'; // // param['maintain_type'] = 'UPDATE'; // // param['url_title'] = '${l:CON301.CONTRACT_DETAIL}'; // // hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_modify_link',ds_id); // } window['${/parameter/@layout_code}_prj500_cdd_attachtment_upload'] = function (ds_id, id, name, query_only) { var record = $(ds_id).findById(id); if (record.get('check_id')) { var url; //add by lijingjing 2019-11-15 if (record.get('attachment_tab_group') == 'CREDIT_CHECK' && '${/parameter/@query_only}' == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else if (record.get('attachment_tab_group') == 'SIGN' && '${/parameter/@con_query_only}' == 'N') { url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else if (record.get('attachment_tab_group') == 'SIGN' && '${/parameter/@con_query_only}' == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else if (query_only == 'Y' || '${/parameter/@download}' == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else { url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } var win = new Leaf.Window({ url: url, title: '${l:HLS.SUPPORTING_DOCUMENT}', id: '${/parameter/@layout_code}${/parameter/@tree_code}_prj500_cdd_uploadFile_screen_id', width: 850, height: 400 }); win.on('close', function () { record.ds.query(); }); } else { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); } }; window['${/parameter/@layout_code}_prj500_cdd_attachtment_new_upload'] = function (ds_id, id, name, query_only) { var record = $(ds_id).findById(id); if (record.get('check_id')) { var url; //add by lijingjing 2019-11-15 if (query_only == 'Y' || '${/parameter/@download}' == 'Y') { url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('check_id'); } else { url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('check_id'); } var win = new Leaf.Window({ url: url, title: '${l:HLS.SUPPORTING_DOCUMENT}', id: '${/parameter/@layout_code}${/parameter/@tree_code}_prj500_cdd_uploadFile_screen_id', width: 850, height: 400 }); win.on('close', function () { record.ds.query(); }); } else { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); } }; window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function () { // var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var record = $(ds_id).getCurrentRecord(); var content_id; //alert($('${/parameter/@layout_code}_con505_contract_content_id').getUrl); Leaf.request({ url: $('${/parameter/@layout_code}_con505_contract_content_id').getUrl(), para: { content_id: content_id, contract_id: record.get('contract_id'), contract_bp_id: record.get('content_bp_pk'), clause_usage: 'GH_WITHHOLD_AGREE' }, success: function (rsc) { // //alert(rsc.result.content_id); Leaf.request({ url: $('${/parameter/@layout_code}_creat_con_contract_content_link_id').getUrl(), para: { content_id: rsc.result.content_id, file_path: '${/parameter/@file_path}' }, success: function () { Leaf.request({ url: $('${/parameter/@layout_code}_file_copy_from_template_link_id').getUrl(), para: { contract_id: record.get('contract_id'), content_id: rsc.result.content_id, file_path: '${/parameter/@file_path}', batch_flag: 'Y' }, success: function () { var url = $('${/parameter/@layout_code}_con_batch_dl_link_id').getUrl() + '?contract_id=' + record.get('contract_id') + '&content_id=' + rsc.result.content_id; window.open(url, '_self'); unlock_current_window(); } }); unlock_current_window(); }, error: function () { unlock_current_window(); }, failure: function () { unlock_current_window(); }, scope: this }); }, error: function () { unlock_current_window(); }, failure: function () { unlock_current_window(); }, scope: this }); }; window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var record = $(ds_id).getCurrentRecord(); var direct_debit_bank_id = record.get('direct_debit_bank_id'); var dd_bank_account_name = record.get('dd_bank_account_name'); var dd_bank_account_num = record.get('dd_bank_account_num'); if (!Ext.isEmpty(record.get('contract_number'))) { new Leaf.Window({ id: '${/parameter/@layout_code}_con_contract_content_confirm_win_id', params: { action: 'VIEW', contract_id: record.get('contract_id'), company_id: record.get('company_id'), document_category: record.get('document_category'), business_type: record.get('business_type'), winid: '${/parameter/@layout_code}_con_contract_content_confirm_win_id' }, url: $('${/parameter/@layout_code}_con_contract_content_confirm_link_id').getUrl(), title: '合同查看', width: 1300, height: 550 }); } else { Leaf.showErrorMessage('错误', '请先点击保存生成合同编号!'); } }; var change_flag = 'N'; //工作流中合同文本生成按钮 //基本信息tab页 新增必输字段的校验 add by liukang 20160328 window['${/parameter/@layout_code}_print_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var con_lease_item_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_lease_item'); var record = $(ds_id).getCurrentRecord(); var con_lease_record = $(con_lease_item_id).getCurrentRecord(); var direct_debit_bank_id = record.get('direct_debit_bank_id'); var dd_bank_account_name = record.get('dd_bank_account_name'); var dd_bank_account_num = record.get('dd_bank_account_num'); var color_of_apprearance = con_lease_record.get('color_of_apprearance'); var item_frame_number = con_lease_record.get('item_frame_number'); var item_engine_number = con_lease_record.get('item_engine_number'); var license_number = con_lease_record.get('license_number'); /* if (Ext.isEmpty(direct_debit_bank_id)) { Leaf.showMessage('${l:HLS.PROMPT}', '请先填写数据并保存!'); } else */ if (!Ext.isEmpty(record.get('contract_number'))) { var win = new Leaf.Window({ id: '${/parameter/@layout_code}_con_contract_content_confirm_win_id', params: { contract_id: record.get('contract_id'), company_id: record.get('company_id'), document_category: record.get('document_category'), business_type: record.get('business_type'), winid: '${/parameter/@layout_code}_con_contract_content_confirm_win_id', change_flag: change_flag, contract_name: record.get('contract_name'), contract_number: record.get('contract_number') }, url: $('${/parameter/@layout_code}_con_contract_content_confirm_link_id').getUrl(), title: '合同文本生成', width: 1300, height: 550 }); //在关闭页面之后,刷新一下ds win.on('close', function () { if (ds_id) { $(ds_id).query(); } }); } else { Leaf.showErrorMessage('错误', '请先点击保存生成合同编号!'); } }; //add by zhuxianfei 20180207 function view_pdf(attachment_id) { Leaf.request({ url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query', para: { attachment_id: attachment_id }, success: function (res) { var path = res.result.record.file_path; path = path.substr(path.indexOf('hls_attachment')); var tomcat_source = '${/parameter/@tomcat_source}'; var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path + '?type=pdf'; var oWin = window.open(source_path); }, scope: this }); } window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function (ds, qpara, bp_seq) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_bs_score'); if (ds.id == ds_id) { qpara.contract_id = '${/parameter/@contract_id}'; //$(ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}'); } }; window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) { debugger; var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); if (ds_id == ds.id && ds_id) { //业务类型回租时,默认只读“首付款抵扣”选项 if (record.get('business_type') == 'LEASEBACK' && '${/parameter/@function_usage}' == 'MODIFY') { //document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT_prompt').style.display = 'block'; // document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT').style.display = 'block'; record.getField('entrusted_amount').setRequired(true); } else if (record.get('business_type') == 'LEASE') { document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT_prompt').style.display = 'none'; document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT').style.display = 'none'; } if(record.get('bp_class') == 'NP' || record.get('sign_type_n') == '纸质签约'){ record.getField('signer_n').setReadOnly(true); record.getField('signer_n').setRequired(false); record.set('signer_n',''); }else if ('${/parameter/@function_usage}' == 'MODIFY' && record.get('sign_type_n') == '电子签约' && record.get('bp_class') == 'ORG'){ record.getField('signer_n').setReadOnly(false); record.getField('signer_n').setRequired(true); } } }; //更新时调用 window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); if (ds_id == ds.id && ds_id) { var record = $(ds_id).getCurrentRecord(); var bp_tenant_class = record.get('bp_class'); if (name == 'sign_type_n') { if(value == '纸质签约'){ record.getField('signer_n').setReadOnly(true); record.getField('signer_n').setRequired(false); record.set('signer_n',''); }else if (value == '电子签约' && bp_tenant_class == 'ORG'){ record.getField('signer_n').setReadOnly(false); record.getField('signer_n').setRequired(true); record.set('ec_sign_type','NEW'); record.set('sign_contract_status','NEW'); }else if(value == '电子签约' && bp_tenant_class == 'NP'){ record.getField('signer_n').setReadOnly(true); record.set('ec_sign_type','NEW'); record.set('sign_contract_status','NEW'); } } } }; /*保存前调用校验*/ window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) { debugger; var check_flag = true; var contract_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var con_record = $(contract_ds_id).getAt(0); if (contract_ds_id == ds.id&&$(contract_ds_id).validate()) { if (con_record.get('business_type') == 'LEASEBACK') { //“保存”按钮增加校验:若所填写小于0或大于设备款价格,点击按钮校验提示:“委托付款金额有误,请重新填写!” if (con_record.get('entrusted_amount') < 0 || con_record.get('entrusted_amount') > minus(con_record.get('lease_item_amount'),con_record.get('down_payment'))) { Leaf.showMessage('${HLS.PROMPT}', '委托付款金额有误,请重新填写!'); return false; } } } else { check_flag = false; } return check_flag; }; //取消签约按钮 add by 24976 window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var record = $(ds_id).getCurrentRecord(); var contract_id = record.get('contract_id'); var sign_contract_status = record.get('sign_contract_status'); var sign_type = record.get('sign_type') || 'PAPER_SIGN'; if (sign_contract_status != 'SIGNING') { Leaf.showMessage('${l:PROMPT}', '只有签约中的合同可以取消签约'); return; } if (sign_contract_status == 'SIGNING' && sign_type == 'PAPER_SIGN'){ Leaf.showConfirm('${HLS.PROMPT}', '确认要取消签约吗?', function () { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request({ url: $('con_sign_cancel_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); }else if(sign_type == 'ELE_SIGN' && sign_contract_status == 'SIGNING'){ Leaf.showConfirm('${HLS.PROMPT}', '确认取消电子签约吗?', function () { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request({ url: $('${/parameter/@layout_code}_con_ele_sign_cancel_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); } }; window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var record = $(ds_id).getCurrentRecord(); var contract_id = record.get('contract_id'); //add by 24976 var sign_type = record.get('sign_type'); var contract_inception_date = record.get('contract_inception_date'); var con_lease_item_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_lease_item'); var con_lease_record = $(con_lease_item_id).getCurrentRecord(); var machine_number = con_lease_record.get('machine_number'); if (record.dirty == true) { Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}'); return; } // if(record.get('contract_status')!='NEW'){ // $L.showErrorMessage("错误",'只能新建状态的合同才能发起签约!'); // return; // } if ($(ds_id).validate()) { if (sign_type == 'ELE_SIGN'){ Leaf.showConfirm('${HLS.PROMPT}', '确认要发起电子签约吗?', function () { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); //校验起租日 var date = new Date(); date.setTime(date.getTime()); if (contract_inception_date < date) { Leaf.showMessage('${l:PROMPT}', '起租日小于当前时间,不允许发起电子签约!'); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); return; } if (Ext.isEmpty(machine_number)) { Leaf.showMessage('${l:HLS.PROMPT}', '请先填写机号并保存!'); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); return; } Leaf.request({ url:$('${/parameter/@layout_code}_ele_operator_verify_link_id').getUrl(), para:{ contract_id:contract_id, esign_type:'CE' }, scope:this, success: function (res) { if(res.result.check_flag == 'Y'){ Leaf.showConfirm('${HLS.PROMPT}', '该企业下已存在其他经办人,如果发起签约,原账户将失效,请确认是否继续!', function () { Leaf.request({ url: $('${/parameter/@layout_code}_con_ele_content_create_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { Leaf.request({ url: $('${/parameter/@layout_code}_con_ele_agent_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }else{ Leaf.request({ url: $('${/parameter/@layout_code}_con_ele_content_create_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { Leaf.request({ url: $('${/parameter/@layout_code}_con_ele_agent_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); } }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); } else if (sign_type == 'PAPER_SIGN'){ Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request({ url: $('con_approval_link_id').getUrl(), para: { contract_id: contract_id }, scope: this, success: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }); } } }; if ('${/parameter/@source_type}' == 'WFL') { zjwfl5110_ApproveChecker_add('zjwfl5110_submit', function (type) { var con_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); if (type == 'agree') { if ($(con_ds_id).validate()) { if ($(con_ds_id).isModified()) { Leaf.showMessage('${HLS.PROMPT}', '请先保存'); return false; } //提交先保存 return true; } else { return false; } } else return true; }); } Leaf.onReady(function () { var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_INVOICE_INFO', 'con_contract_bp'); if (ds_id) { $(ds_id).setQueryUrl('${/request/@context_path}/autocrud/prj.PRJ501N.con_contract_bp/query'); $(ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}'); $(ds_id).query(); } //add by 24976 if("${/parameter/@sign_contract_status}" == 'SIGNING'){ document.getElementById("${/parameter/@layout_code}_user_button4").style.display = ""; }else if("${/parameter/@sign_contract_status}" == 'SIGN'){ document.getElementById("${/parameter/@layout_code}_user_button4").style.display = "none"; } }) ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> </a:view></a:screen>
\ No newline at end of file
......
......@@ -5,7 +5,7 @@
importPackage(java.io);
importPackage(Packages.com.hand.elecon.httpost);
var up_file_token_url = 'http://hlsapp.hand-china.com/hl_dr_dev/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=admin'; //文件上传获取token的地址
var up_file_token_url = info_query('UP_FILE_TOKEN_URL').code_value;
//系统参数获取
function info_query(parameter_code) {
var info = new Object();
......@@ -23,9 +23,15 @@
var sign_cancel_map = sign_cancel_bm.queryAsMap({
contract_id:$ctx.parameter.contract_id
});
var flow_Id = sign_cancel_map.getChildren()[0].ele_flow_id;
var sign_cancel_data = sign_cancel_map.getChildren();
var revoke_flows = [];
for (var i = 0; i < sign_cancel_data.length;i++){
revoke_flows.push({
"flowId":sign_cancel_data[i].ele_flow_id
});
}
var revokeParam = {
flowId:flow_Id
revokeFlows:revoke_flows
}
//调用中台取消流程
var info = info_query('HL_SIGN_FLOW_CANCEL');
......@@ -47,14 +53,31 @@
tokenResult:token_sign_result
});
var result_ob = JSON.parse(result); //根据返回参数形式再定
var revoke_flag_update_bm = $bm('cont.CON505.contract_revoke_flag_update');
if (result_ob.code != 0) {
//rollback
$bm('wx.WX100.rollback').update();
raise_app_error('取消签约失败,请联系技术人员检查!');
}else if(result_ob.code == 0){
sign_cancel_bm.execute({
contract_id:$ctx.parameter.contract_id
})
var revokeFlows = result_ob.revokeFlows;
var all_revoke_flag = 'Y';
for (var i = 0; i < revokeFlows.length; i++) {
if(revokeFlows[i].result == 0){
revoke_flag_update_bm.update({
contract_id:$ctx.parameter.contract_id,
flow_id:revokeFlows[i].flowId
});
}else{
all_revoke_flag = 'N';
}
}
if(all_revoke_flag == 'Y'){
sign_cancel_bm.execute({
contract_id:$ctx.parameter.contract_id
});
}else{
raise_app_error('取消签约未完成,请再次发起取消签约!');
}
}
]]></s:server-script>
</a:init-procedure>
......
......@@ -303,17 +303,18 @@
var req_record = $(req_ds_id).getAt(0);
var req_status = req_record.get('req_status');
var contract_id = req_record.get('contract_id');
if (req_status != 'NEW') {
var change_req_id = req_record.get('change_req_id');
/* if (req_status != 'NEW') {
Leaf.showMessage('${l:PROMPT}', '只有新建状态的才能发起电子签约');
return;
}
}*/
Leaf.showConfirm('${l:HLS.PROMPT}', '是否确认发起电子签约?', function () {
$('${/parameter/@layout_code}_user_button3').disable();
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
Leaf.request({
url:$('${/parameter/@layout_code}_ele_operator_verify_link_id').getUrl(),
para:{
contract_id:contract_id,
contract_id:change_req_id,
esign_type:'ET'
},
scope:this,
......@@ -323,7 +324,7 @@
Leaf.request({
url: $('${/parameter/@layout_code}_con_ele_terminate_create_link_id').getUrl(),
para: {
contract_id: contract_id
contract_id: change_req_id
},
success: function(res) {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
......@@ -343,7 +344,7 @@
Leaf.request({
url: $('${/parameter/@layout_code}_con_ele_terminate_create_link_id').getUrl(),
para: {
contract_id: contract_id
contract_id: change_req_id
},
success: function(res) {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
......
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<a:model-query fetchAll="true" model="cont.CON500.con_contract_get_guid_file_name"
rootPath="guid_file_name_path"/>
<!--<a:model-query fetchAll="true" model="cont.CON500.con_doc_file_templet_get_atm" rootPath="file_templet_get_atm_path"/>-->
<s:server-script import="contract_print_path.js"><![CDATA[
importPackage(java.io);
importPackage(Packages.hls.plugin.docx4j);
importPackage(Packages.leaf.plugin.word2pdf);
importPackage(Packages.org.apache.commons.io);
importPackage(Packages.com.hand.elecon.httpost);
var up_file_token_url = info_query('UP_FILE_TOKEN_URL').code_value;
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
var fos = new java.io.FileOutputStream(fNew);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 4);
var len = -1;
while ((len = fis.read(b)) != -1) {
fos.write(b, 0, len);
}
fis.close();
fos.close();
}
//删除文件
function deleteFile(filePath) {
var file = new File(filePath);
if (file.exists()) {
file.delete();
}
}
//生成pdf
function wordToPdf(word_file_path,pdf_file_path) {
// word转pdf
var pdf_file_path_new = pdf_file_path + '.pdf';
var wordToPdf = new WordToPdf($instance('uncertain.ocm.IObjectRegistry'), "jacob-1.19-x64.dll");
wordToPdf.word2pdf(word_file_path, pdf_file_path_new);
//删除word文件
// deleteFile(word_file_path);
return pdf_file_path_new;
}
//生成pdf openoffice
function doc2pdf(word_file_path,pdf_file_path) {
// word转pdf
var pdf_file_path_new = pdf_file_path + '.pdf';
var wordToPdf = new doc2pdf2();
wordToPdf.doc2pdf2("C:/Program Files (x86)/OpenOffice 4",word_file_path, pdf_file_path_new);
//删除word文件
deleteFile(word_file_path);
return pdf_file_path_new;
}
//按日期创建目录
function getDatePath() {
set_parameter_file_path();
var info = info_query('HL_ELE_FILE_PATH');
var file_path = info.code_value;
//var file_path = $ctx.parameter.pdf_path; //file_path = c:/hls_test_files/content_files/
//var file_path = 'd:/hl_test_files/content_files/'; //file_path = c:/hls_test_files/content_files/
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
m = m < 10 ? "0" + m : m
var datePath = file_path + y + "/" + m + "/";
return datePath; //datePath = d:/hls_test_files/fileupload/2018/04/
}
//系统参数获取
function info_query(parameter_code) {
var info = new Object();
var data = null;
var parameter_map = $bm('wx.WX100.sys_parameter_value').queryAsMap({
parameter_code:parameter_code
});
var data = parameter_map.getChildren();
info.code_value = data[0].code_value;
return info;
}
//依据合同文本签署人定义存储签署人信息
var ele_contract_signer_bm = $bm('wx.WX100.con_ele_contract_signer_save');
/* ele_contract_signer_bm.update({
contract_id: $ctx.parameter.contract_id
});*/
//第一步生成合同文本
/* $bm('cont.CON505.con_ele_contract_create_content').update({
contract_id: $ctx.parameter.contract_id,
content_type: 'NORMAL'
});*/
var datePath = getDatePath();
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
$ctx.parameter.batch_flag = 'Y';
var from_file_data_map = $bm('cont.CON500.con_doc_file_templet_get_atm').queryAsMap({
contract_id: $ctx.parameter.contract_id,
batch_flag: $ctx.parameter.batch_flag
});
/*var from_file_data = from_file_data_map.getChildren();*/
//所有文件
var conFileList = [];
//签署人
var signer = [];
//文件列表
var con_ele_unsigned_file_bm = $bm('wx.WX100.con_agent_unsigned_file_query');
var con_ele_unsigned_file_map = con_ele_unsigned_file_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id
});
var con_ele_unsigned_file_data = con_ele_unsigned_file_map.getChildren();
for (var n = 0; n < con_ele_unsigned_file_data.length; n++){
conFileList.push({
"fileUrl": con_ele_unsigned_file_data[n].file_path,
"fileName": con_ele_unsigned_file_data[n].file_name,
"fileSize": con_ele_unsigned_file_data[n].file_size
});
}
//合同签署人信息
var ele_signer_bm = $bm('wx.WX100.con_ele_contract_signer_query');
var ele_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
esign_type:'CE'
});
var ele_signer_data = ele_signer_map.getChildren();
var userInfoList = [];
for (var k = 0 ; k < ele_signer_data.length;k++){
var signer_record_data = ele_signer_data[k];
if(signer_record_data.signer_category == 'AGENCY_STORE_SEAL'){
var ele_org_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
signer_category:'AGENCY_STORE_SIGN'
});
var ele_org_signer_data = ele_org_signer_map.getChildren();
var agentName = ele_org_signer_data[0].bp_name;
var agentIdNo = ele_org_signer_data[0].id_no;
var mobile = ele_org_signer_data[0].mobile;
userInfoList.push({
"idNo":signer_record_data.id_no,
"name":signer_record_data.bp_name,
"agentIdNo":agentIdNo,
"agentName":agentName,
"mobile":mobile,
"legalName":agentName,
"legalIdNo":agentIdNo,
"agentType":"1"
});
}
}
var ele_contract_signer_map = ele_contract_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id
});
var ele_contract_signer_data = ele_contract_signer_map.getChildren();
var contract_number = ele_contract_signer_data[0].contract_number;
for (var k = 0 ; k < ele_contract_signer_data.length;k++){
var signerFileList = [];
var signer_record_data = ele_contract_signer_data[k];
var con_ele_signer_id = signer_record_data.con_ele_signer_id;
var ele_signer_file_bm = $bm('wx.WX100.con_agent_signer_file_query');
var ele_signer_file_map = ele_signer_file_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
con_ele_signer_id:con_ele_signer_id
});
var ele_signer_file_data = ele_signer_file_map.getChildren();
if (ele_signer_file_data.length == 0){continue};
for (var h = 0; h < ele_signer_file_data.length; h++){
signerFileList.push({
"fileName":ele_signer_file_data[h].file_name,
"fileUrl":ele_signer_file_data[h].file_path,
"fileSize":ele_signer_file_data[h].file_size
});
}
signer.push({
"idNo":signer_record_data.id_no,
"idType":signer_record_data.id_type,
"accountType":signer_record_data.signer_category,
"signOrder":signer_record_data.sign_order,
"key":signer_record_data.key_word,
"autoExecute":signer_record_data.auto_sign,
"signType":signer_record_data.sign_type,
"signerFileList":signerFileList
})
}
//调用中台签署流程
var info = info_query('HL_SIGN_FLOW_CREATE');
var httpUrl = info.code_value;
var signParam = {
contractNo:$ctx.parameter.contract_id,
contractNumber:contract_number,
esignType:"AE",
userInfo:userInfoList,
conFileList:conFileList,
signer:signer
}
var logs_bm = $bm('wx.WX100.con_ele_savelogs');
try {
var token_sign_result = EleFileUpHttpPost.post(up_file_token_url, null, null);
} catch (e) {
raise_app_error('上传文件获取token失败,请联系技术人员检查!');
}
var token_sign_result_ob = JSON.parse(token_sign_result);
var access_sign_token = token_sign_result_ob.access_token;
var result = EleFileUpHttpPost.post(httpUrl, JSON.stringify(signParam), access_sign_token);
//var result = new HttpRequest().sendPost(httpUrl, JSON.stringify(signParam));
logs_bm.insert({
contract_id:$ctx.parameter.contract_id,
httpurl:httpUrl,
jsonPut:JSON.stringify(signParam),
jsonResult:result,
tokenResult:token_sign_result
});
var result_ob = JSON.parse(result); //根据返回参数形式再定
if (result_ob.code != 0) {
//rollback
$bm('wx.WX100.rollback').update();
//raise_app_error('发起签约失败,请联系技术人员检查!');
raise_app_error(result_ob.message.toString());
}else if(result_ob.code == 0){
var flow_id = result_ob.flowId;
var flow_update_bm = $bm('wx.WX100.con_ele_flow_update');
flow_update_bm.update({
contract_id: $ctx.parameter.contract_id,
flow_id: flow_id,
esign_type: 'AE'
})
flow_update_bm.execute({
contract_id: $ctx.parameter.contract_id
})
}
]]></s:server-script>
</a:init-procedure>
</a:service>
\ No newline at end of file
......@@ -11,8 +11,6 @@
importPackage(Packages.org.apache.commons.io);
importPackage(Packages.com.hand.elecon.httpost);
var up_file_token_url = 'http://hlsapp.hand-china.com/hl_dr_dev/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=admin'; //文件上传获取token的地址
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
var fos = new java.io.FileOutputStream(fNew);
......@@ -82,259 +80,277 @@
info.code_value = data[0].code_value;
return info;
}
var up_file_token_url = info_query('UP_FILE_TOKEN_URL').code_value;
//依据合同文本签署人定义存储签署人信息
var ele_contract_signer_bm = $bm('wx.WX100.con_ele_contract_signer_save');
/* ele_contract_signer_bm.update({
var flow_count_bm = $bm('wx.WX100.con_ele_flow_update');
var flow_count_map = flow_count_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id
});*/
//第一步生成合同文本
$bm('cont.CON505.con_ele_contract_create_content').update({
contract_id: $ctx.parameter.contract_id,
content_type: 'NORMAL'
});
var datePath = getDatePath();
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
$ctx.parameter.batch_flag = 'Y';
var from_file_data_map = $bm('cont.CON500.con_doc_file_templet_get_atm').queryAsMap({
contract_id: $ctx.parameter.contract_id,
batch_flag: $ctx.parameter.batch_flag
});
var from_file_data = from_file_data_map.getChildren();
//所有文件
var conFileList = [];
//签署人
var signer = [];
for (var i = 0; i < from_file_data.length; i++) {
var to_file_path = $ctx.parameter.file_path;
var record_data = from_file_data[i];
var flow_count_data = flow_count_map.getChildren();
if(flow_count_data[0].ce_num == 0) {
//依据合同文本签署人定义存储签署人信息
var ele_contract_signer_bm = $bm('wx.WX100.con_ele_contract_signer_save');
//第一步生成合同文本
$bm('cont.CON505.con_ele_contract_create_content').update({
contract_id: $ctx.parameter.contract_id,
content_type: 'NORMAL'
});
var datePath = getDatePath();
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
$ctx.parameter.batch_flag = 'Y';
var from_file_data_map = $bm('cont.CON500.con_doc_file_templet_get_atm').queryAsMap({
contract_id: $ctx.parameter.contract_id,
batch_flag: $ctx.parameter.batch_flag
});
var from_file_data = from_file_data_map.getChildren();
//所有文件
var conFileList = [];
//签署人
var signer = [];
for (var i = 0; i < from_file_data.length; i++) {
var to_file_path = $ctx.parameter.file_path;
var record_data = from_file_data[i];
if (record_data.file_exists_flag != 'Y') {
var to_file_name = record_data.to_file_name + '.' + record_data.file_type_code || 'doc';
var from_file_path = record_data.file_path;
var guid_file_name_path = $bm('cont.CON500.con_contract_get_guid_file_name').queryAsMap();
var guid_file_name_tables = guid_file_name_path.getChildren();
to_file_path = to_file_path + guid_file_name_tables[0].guid_file_name + 'con' + record_data.content_id + '.' + record_data.file_type_code || 'doc';
if (record_data.file_exists_flag != 'Y') {
var to_file_name = record_data.to_file_name + '.' + record_data.file_type_code || 'doc';
var from_file_path = record_data.file_path;
var guid_file_name_path = $bm('cont.CON500.con_contract_get_guid_file_name').queryAsMap();
var guid_file_name_tables = guid_file_name_path.getChildren();
to_file_path = to_file_path + guid_file_name_tables[0].guid_file_name + 'con' + record_data.content_id + '.' + record_data.file_type_code || 'doc';
copyFile(from_file_path, to_file_path);
copyFile(from_file_path, to_file_path);
try {
var brwt = new BookmarksReplaceWithText($instance('leaf.database.service.IDatabaseServiceFactory'), $instance('uncertain.ocm.IObjectRegistry'), $ctx.getData());
brwt.replaceBookmarkFromContent(to_file_path.toString(), record_data.content_id);
} catch (e) {
raise_app_error(e);
}
// word转pdf
var pdf_file_path = datePath + guid_file_name_tables[0].guid_file_name + 'con_' + record_data.content_id;
var outputfilepath = wordToPdf(to_file_path, pdf_file_path);
var outputfilename = record_data.to_file_name + '.pdf';
var pdf_file = new File(outputfilepath);
var file_size = 0;
if (pdf_file.exists()) {
file_size = pdf_file.length();
try {
var brwt = new BookmarksReplaceWithText($instance('leaf.database.service.IDatabaseServiceFactory'), $instance('uncertain.ocm.IObjectRegistry'), $ctx.getData());
brwt.replaceBookmarkFromContent(to_file_path.toString(), record_data.content_id);
} catch (e) {
raise_app_error(e);
}
// word转pdf
var pdf_file_path = datePath + guid_file_name_tables[0].guid_file_name + 'con_' + record_data.content_id;
var outputfilepath = wordToPdf(to_file_path, pdf_file_path);
var outputfilename = record_data.to_file_name + '.pdf';
var pdf_file = new File(outputfilepath);
var file_size = 0;
if (pdf_file.exists()) {
file_size = pdf_file.length();
}
//保存文本名及路径
$bm('cont.CON500.con_file_content_copy_update').execute({
table_name: 'CON_CONTRACT_CONTENT',
content_id: record_data.content_id,
file_name: outputfilename.toString(),
file_path: outputfilepath.toString(),
file_size: file_size,
file_type_code: 'pdf',
mime_type: 'application/pdf',
user_id: $ctx.parameter.user_id
});
}
//保存文本名及路径
$bm('cont.CON500.con_file_content_copy_update').execute({
table_name: 'CON_CONTRACT_CONTENT',
content_id: record_data.content_id,
file_name: outputfilename.toString(),
file_path: outputfilepath.toString(),
file_size: file_size,
file_type_code: 'pdf',
mime_type: 'application/pdf',
user_id: $ctx.parameter.user_id
});
}
}
//文件列表
var con_ele_unsigned_file_bm = $bm('wx.WX100.con_ele_unsigned_file_query');
var con_ele_unsigned_file_map = con_ele_unsigned_file_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id
});
var con_ele_unsigned_file_data = con_ele_unsigned_file_map.getChildren();
for (var n = 0; n < con_ele_unsigned_file_data.length; n++){
conFileList.push({
"fileUrl": con_ele_unsigned_file_data[n].file_path,
"fileName": con_ele_unsigned_file_data[n].file_name,
"fileSize": con_ele_unsigned_file_data[n].file_size
//文件列表
var con_ele_unsigned_file_bm = $bm('wx.WX100.con_ele_unsigned_file_query');
var con_ele_unsigned_file_map = con_ele_unsigned_file_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id
});
}
//合同签署人信息
var ele_signer_bm = $bm('wx.WX100.con_ele_contract_signer_query');
var ele_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
esign_type:'CE'
});
var ele_signer_data = ele_signer_map.getChildren();
var userInfoList = [];
for (var k = 0 ; k < ele_signer_data.length;k++){
var signer_record_data = ele_signer_data[k];
if(signer_record_data.signer_category == 'TENANT_NP' || signer_record_data.signer_category == 'TENANT_SP' || signer_record_data.signer_category =='GUARANTOR_NP' || signer_record_data.signer_category =='GUARANTOR_SP'){
userInfoList.push({
"idNo":signer_record_data.id_no,
"name":signer_record_data.bp_name,
"mobile":signer_record_data.mobile
});
}else if (signer_record_data.signer_category == 'TENANT_ORG_SEAL'){
var ele_org_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
signer_category:'TENANT_ORG_SIGN'
var con_ele_unsigned_file_data = con_ele_unsigned_file_map.getChildren();
for (var n = 0; n < con_ele_unsigned_file_data.length; n++) {
conFileList.push({
"fileUrl": con_ele_unsigned_file_data[n].file_path,
"fileName": con_ele_unsigned_file_data[n].file_name,
"fileSize": con_ele_unsigned_file_data[n].file_size
});
var ele_org_signer_data = ele_org_signer_map.getChildren();
//经办人
var agentName = ele_org_signer_data[0].bp_name;
var agentIdNo = ele_org_signer_data[0].id_no;
var mobile = ele_org_signer_data[0].mobile;
//法人
var legalName = ele_org_signer_data[0].legal_person;
var legalIdNo = ele_org_signer_data[0].id_card_no_leg;
if (agentIdNo == legalIdNo){
}
//合同签署人信息
var ele_signer_bm = $bm('wx.WX100.con_ele_contract_signer_query');
var ele_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
esign_type: 'CE'
});
var ele_signer_data = ele_signer_map.getChildren();
var userInfoList = [];
for (var k = 0; k < ele_signer_data.length; k++) {
var signer_record_data = ele_signer_data[k];
if (signer_record_data.signer_category == 'TENANT_NP' || signer_record_data.signer_category == 'TENANT_SP' || signer_record_data.signer_category == 'GUARANTOR_NP' || signer_record_data.signer_category == 'GUARANTOR_SP') {
userInfoList.push({
"idNo": signer_record_data.id_no,
"name": signer_record_data.bp_name,
"mobile": signer_record_data.mobile
});
} else if (signer_record_data.signer_category == 'TENANT_ORG_SEAL') {
var ele_org_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
signer_category: 'TENANT_ORG_SIGN'
});
var ele_org_signer_data = ele_org_signer_map.getChildren();
//经办人
var agentName = ele_org_signer_data[0].bp_name;
var agentIdNo = ele_org_signer_data[0].id_no;
var mobile = ele_org_signer_data[0].mobile;
//法人
var legalName = ele_org_signer_data[0].legal_person;
var legalIdNo = ele_org_signer_data[0].id_card_no_leg;
if (agentIdNo == legalIdNo) {
userInfoList.push({
"idNo": signer_record_data.id_no,
"name": signer_record_data.bp_name,
"agentIdNo": agentIdNo,
"agentName": agentName,
"mobile": mobile,
"legalName": legalName,
"legalIdNo": legalIdNo,
"agentType": "1"
});
} else {
userInfoList.push({
"idNo": signer_record_data.id_no,
"name": signer_record_data.bp_name,
"agentIdNo": agentIdNo,
"agentName": agentName,
"mobile": mobile,
"legalName": legalName,
"legalIdNo": legalIdNo,
"agentType": "2"
});
}
} else if (signer_record_data.signer_category == 'GUARANTOR_ORG_SEAL') {
var ele_org_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
signer_category: 'GUARANTOR_ORG_SIGN'
});
var ele_org_signer_data = ele_org_signer_map.getChildren();
var agentName = ele_org_signer_data[0].bp_name;
var agentIdNo = ele_org_signer_data[0].id_no;
var mobile = ele_org_signer_data[0].mobile;
userInfoList.push({
"idNo":signer_record_data.id_no,
"name":signer_record_data.bp_name,
"agentIdNo":agentIdNo,
"agentName":agentName,
"mobile":mobile,
"legalName":legalName,
"legalIdNo":legalIdNo,
"agentType":"1"
"idNo": signer_record_data.id_no,
"name": signer_record_data.bp_name,
"agentIdNo": agentIdNo,
"agentName": agentName,
"mobile": mobile,
"legalName": agentName,
"legalIdNo": agentIdNo,
"agentType": "1"
});
}else{
} else if (signer_record_data.signer_category == 'AGENCY_STORE_SEAL') {
var ele_org_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
signer_category: 'AGENCY_STORE_SIGN'
});
var ele_org_signer_data = ele_org_signer_map.getChildren();
var agentName = ele_org_signer_data[0].bp_name;
var agentIdNo = ele_org_signer_data[0].id_no;
var mobile = ele_org_signer_data[0].mobile;
userInfoList.push({
"idNo":signer_record_data.id_no,
"name":signer_record_data.bp_name,
"agentIdNo":agentIdNo,
"agentName":agentName,
"mobile":mobile,
"legalName":legalName,
"legalIdNo":legalIdNo,
"agentType":"2"
"idNo": signer_record_data.id_no,
"name": signer_record_data.bp_name,
"agentIdNo": agentIdNo,
"agentName": agentName,
"mobile": mobile,
"legalName": agentName,
"legalIdNo": agentIdNo,
"agentType": "1"
});
}
}else if(signer_record_data.signer_category == 'GUARANTOR_ORG_SEAL'){
var ele_org_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
signer_category:'GUARANTOR_ORG_SIGN'
});
var ele_org_signer_data = ele_org_signer_map.getChildren();
var agentName = ele_org_signer_data[0].bp_name;
var agentIdNo = ele_org_signer_data[0].id_no;
var mobile = ele_org_signer_data[0].mobile;
userInfoList.push({
"idNo":signer_record_data.id_no,
"name":signer_record_data.bp_name,
"agentIdNo":agentIdNo,
"agentName":agentName,
"mobile":mobile,
"legalName":agentName,
"legalIdNo":agentIdNo,
"agentType":"1"
});
}else if(signer_record_data.signer_category == 'AGENCY_STORE_SEAL'){
var ele_org_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
signer_category:'AGENCY_STORE_SIGN'
});
var ele_org_signer_data = ele_org_signer_map.getChildren();
var agentName = ele_org_signer_data[0].bp_name;
var agentIdNo = ele_org_signer_data[0].id_no;
var mobile = ele_org_signer_data[0].mobile;
userInfoList.push({
"idNo":signer_record_data.id_no,
"name":signer_record_data.bp_name,
"agentIdNo":agentIdNo,
"agentName":agentName,
"mobile":mobile,
"legalName":agentName,
"legalIdNo":agentIdNo,
"agentType":"1"
});
}
}
var ele_contract_signer_map = ele_contract_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id
});
var ele_contract_signer_data = ele_contract_signer_map.getChildren();
var contract_number = ele_contract_signer_data[0].contract_number;
for (var k = 0 ; k < ele_contract_signer_data.length;k++){
var signerFileList = [];
var signer_record_data = ele_contract_signer_data[k];
var con_ele_signer_id = signer_record_data.con_ele_signer_id;
var ele_signer_file_bm = $bm('wx.WX100.con_ele_signer_file_query');
var ele_signer_file_map = ele_signer_file_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
con_ele_signer_id:con_ele_signer_id
var ele_contract_signer_map = ele_contract_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id
});
var ele_signer_file_data = ele_signer_file_map.getChildren();
if (ele_signer_file_data.length == 0){continue};
for (var h = 0; h < ele_signer_file_data.length; h++){
signerFileList.push({
"fileName":ele_signer_file_data[h].file_name,
"fileUrl":ele_signer_file_data[h].file_path,
"fileSize":ele_signer_file_data[h].file_size
var ele_contract_signer_data = ele_contract_signer_map.getChildren();
var contract_number = ele_contract_signer_data[0].contract_number;
for (var k = 0; k < ele_contract_signer_data.length; k++) {
var signerFileList = [];
var signer_record_data = ele_contract_signer_data[k];
var con_ele_signer_id = signer_record_data.con_ele_signer_id;
var ele_signer_file_bm = $bm('wx.WX100.con_ele_signer_file_query');
var ele_signer_file_map = ele_signer_file_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
con_ele_signer_id: con_ele_signer_id
});
var ele_signer_file_data = ele_signer_file_map.getChildren();
if (ele_signer_file_data.length == 0) {continue};
for (var h = 0; h < ele_signer_file_data.length; h++) {
signerFileList.push({
"fileName": ele_signer_file_data[h].file_name,
"fileUrl": ele_signer_file_data[h].file_path,
"fileSize": ele_signer_file_data[h].file_size
});
}
signer.push({
"idNo": signer_record_data.id_no,
"idType": signer_record_data.id_type,
"accountType": signer_record_data.signer_category,
"signOrder": signer_record_data.sign_order,
"key": signer_record_data.key_word,
"autoExecute": signer_record_data.auto_sign,
"signType": signer_record_data.sign_type,
"signerFileList": signerFileList
})
}
signer.push({
"idNo":signer_record_data.id_no,
"idType":signer_record_data.id_type,
"accountType":signer_record_data.signer_category,
"signOrder":signer_record_data.sign_order,
"key":signer_record_data.key_word,
"autoExecute":signer_record_data.auto_sign,
"signType":signer_record_data.sign_type,
"signerFileList":signerFileList
})
}
//调用中台签署流程
var info = info_query('HL_SIGN_FLOW_CREATE');
var httpUrl = info.code_value;
var signParam = {
contractNo:$ctx.parameter.contract_id,
contractNumber:contract_number,
esignType:"CE",
userInfo:userInfoList,
conFileList:conFileList,
signer:signer
}
var logs_bm = $bm('wx.WX100.con_ele_savelogs');
try {
var token_sign_result = EleFileUpHttpPost.post(up_file_token_url, null, null);
} catch (e) {
raise_app_error('上传文件获取token失败,请联系技术人员检查!');
}
var token_sign_result_ob = JSON.parse(token_sign_result);
var access_sign_token = token_sign_result_ob.access_token;
var result = EleFileUpHttpPost.post(httpUrl, JSON.stringify(signParam), access_sign_token);
//var result = new HttpRequest().sendPost(httpUrl, JSON.stringify(signParam));
logs_bm.insert({
contract_id:$ctx.parameter.contract_id,
httpurl:httpUrl,
jsonPut:JSON.stringify(signParam),
jsonResult:result,
tokenResult:token_sign_result
});
var result_ob = JSON.parse(result); //根据返回参数形式再定
if (result_ob.code != 0) {
//rollback
$bm('wx.WX100.rollback').update();
//raise_app_error('发起签约失败,请联系技术人员检查!');
raise_app_error(result_ob.message.toString());
}else if(result_ob.code == 0){
var flow_id = result_ob.flowId;
var flow_update_bm = $bm('wx.WX100.con_ele_flow_update');
flow_update_bm.update({
//调用中台签署流程
var info = info_query('HL_SIGN_FLOW_CREATE');
var httpUrl = info.code_value;
var signParam = {
contractNo: $ctx.parameter.contract_id,
contractNumber: contract_number,
esignType: "CE",
userInfo: userInfoList,
conFileList: conFileList,
signer: signer
}
var logs_bm = $bm('wx.WX100.con_ele_savelogs');
try {
var token_sign_result = EleFileUpHttpPost.post(up_file_token_url, null, null);
} catch (e) {
raise_app_error('上传文件获取token失败,请联系技术人员检查!');
}
var token_sign_result_ob = JSON.parse(token_sign_result);
var access_sign_token = token_sign_result_ob.access_token;
var result = EleFileUpHttpPost.post(httpUrl, JSON.stringify(signParam), access_sign_token);
//var result = new HttpRequest().sendPost(httpUrl, JSON.stringify(signParam));
logs_bm.insert({
contract_id: $ctx.parameter.contract_id,
flow_id: flow_id
})
var sign_url_list = result_ob.signUrlList;
var ele_con_info_bm = $bm('wx.WX100.con_ele_con_info_update');
for (var i = 0; i < sign_url_list.length; i++) {
ele_con_info_bm.update({
httpurl: httpUrl,
jsonPut: JSON.stringify(signParam),
jsonResult: result,
tokenResult: token_sign_result
});
var result_ob = JSON.parse(result); //根据返回参数形式再定
if (result_ob.code != 0) {
//rollback
$bm('wx.WX100.rollback').update();
//raise_app_error('发起签约失败,请联系技术人员检查!');
raise_app_error(result_ob.message.toString());
} else if (result_ob.code == 0) {
/* var hls_system_url = info_query('HLS_SYSTEM_URL').code_value;
var url = hls_system_url + 'modules/wx/WX100/con_ele_agent_content_create.lsc';
Leaf.request({
url: url,
para: {
contract_id:$ctx.parameter.contract_id
},
success: function(res) {},
failure: function(res) {
raise_app_error( res.error.message );
}
});*/
var flow_id = result_ob.flowId;
var flow_update_bm = $bm('wx.WX100.con_ele_flow_update');
flow_update_bm.update({
contract_id: $ctx.parameter.contract_id,
id_no: sign_url_list[i].idNo,
sign_url: sign_url_list[i].signUrl,
flow_id: flow_id,
esign_type: 'CE'
})
var sign_url_list = result_ob.signUrlList;
var ele_con_info_bm = $bm('wx.WX100.con_ele_con_info_update');
for (var i = 0; i < sign_url_list.length; i++) {
ele_con_info_bm.update({
contract_id: $ctx.parameter.contract_id,
id_no: sign_url_list[i].idNo,
sign_url: sign_url_list[i].signUrl,
esign_type: 'CE'
})
}
}
}
]]></s:server-script>
......
......@@ -5,7 +5,7 @@
importPackage(java.io);
importPackage(Packages.com.hand.elecon.httpost);
var up_file_token_url = 'http://hlsapp.hand-china.com/hl_dr_dev/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=admin'; //文件上传获取token的地址
var up_file_token_url = info_query('UP_FILE_TOKEN_URL').code_value;
//系统参数获取
function info_query(parameter_code) {
......
......@@ -10,7 +10,7 @@
/* var data = $ctx.parameter.requestData;
var data_ob=JSON.parse(data);*/
var contract_no= $ctx.parameter.contractNo;
var data = "action:" + $ctx.parameter.action + ",flowId:" + $ctx.parameter.flowId;
var data = "action:" + $ctx.parameter.action + ",flowId:" + $ctx.parameter.flowId + ",signResult:" + $ctx.parameter.signResult + ",flowStatus:" + $ctx.parameter.flowStatus;
var logs_bm = $bm('wx.WX100.con_ele_savelogs');
logs_bm.insert({
contract_id:contract_no,
......@@ -19,15 +19,9 @@
jsonResult:data.toString(),
tokenResult:null
});
var signer_status_update_bm;
if ($ctx.parameter.esignType == 'CE'){
signer_status_update_bm= $bm('wx.WX100.con_ele_signer_status_update');
}else if ($ctx.parameter.esignType == 'ET') {
signer_status_update_bm = $bm('wx.WX100.con_et_signer_status_update');
}
//个人签署完成
if ($ctx.parameter.action == 'SIGN_FLOW_UPDATE' && $ctx.parameter.signResult == '2'){
var signer_status_update_bm = $bm('wx.WX100.con_ele_signer_status_update');
//个人签署完成 (代理店流程不处理个人签署完成)
if ($ctx.parameter.action == 'SIGN_FLOW_UPDATE' && $ctx.parameter.signResult == '2' && $ctx.parameter.esignType != 'AE'){
var idNos = $ctx.parameter.idNos;
var idNos_json = JSON.parse(idNos);
var idNos_list = idNos_json.idNoList;
......@@ -37,7 +31,8 @@
flow_id:$ctx.parameter.flowId,
id_no:idNos_list[i].idNo,
sign_time:$ctx.parameter.signTime,
sign_result:$ctx.parameter.signResult
sign_result:$ctx.parameter.signResult,
esign_type:$ctx.parameter.esignType
});
}
$ctx.parameter.return_status = '0';
......
......@@ -11,7 +11,7 @@
importPackage(Packages.org.apache.commons.io);
importPackage(Packages.com.hand.elecon.httpost);
var up_file_token_url = 'http://hlsapp.hand-china.com/hl_dr_dev/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=admin'; //文件上传获取token的地址
var up_file_token_url = info_query('UP_FILE_TOKEN_URL').code_value;
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
......@@ -284,10 +284,11 @@
raise_app_error(result_ob.message.toString());
}else if(result_ob.code == 0){
var flow_id = result_ob.flowId;
var flow_update_bm = $bm('wx.WX100.con_et_flow_update');
var flow_update_bm = $bm('wx.WX100.con_ele_flow_update');
flow_update_bm.update({
contract_id:$ctx.parameter.contract_id,
flow_id:flow_id
contract_id: $ctx.parameter.contract_id,
flow_id: flow_id,
esign_type: 'ET'
})
var sign_url_list = result_ob.signUrlList;
var ele_con_info_bm = $bm('wx.WX100.con_ele_con_info_update');
......
......@@ -14,7 +14,7 @@
importPackage(Packages.org.apache.commons.io);
importPackage(Packages.com.hand.elecon.httpost);
var up_file_token_url = 'http://hlsapp.hand-china.com/hl_dr_dev/oauth/token?client_id=client2&client_secret=secret&grant_type=password&username=admin&password=admin'; //文件上传获取token的地址
var up_file_token_url = info_query('UP_FILE_TOKEN_URL').code_value;
//系统参数获取
function info_query(parameter_code) {
var info = new Object();
......
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