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}))
)
UNION ALL
select t1.contract_id,
t1.contract_number,
...
...
@@ -153,11 +156,15 @@ select *
from con_contract t1
where t1.data_class = 'NORMAL'
and t1.ec_sign_type in ('INITIATE', 'SIGNING')
and t1.contract_id in
(select distinct cs.contract_id
from con_contract_ele_signer cs
where cs.id_no = ${@id_no}
and cs.id_type = ${@id_type})) v
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}))
FROM fnd_atm_attachment_multi m1, fnd_atm_attachment faa
WHERE m1.table_name = 'CON_CONTRACT'
AND m1.attachment_id = faa.attachment_id
AND m1.table_pk_value in
(select pc.check_id
from PRJ_CDD_ITEM_CHECK pc
where pc.cdd_item_id in
(select pi.cdd_item_id
from prj_cdd_item pi
where pi.cdd_item in ('CONTRACT','LEASE_ITEM_REQ','TN_GU_INFO','GUARANTEE_LETTER_OEC','CHECK_INFO','SPOUSE_COMMITMENT','PUR_CONTRACT','CASHFLOW_INFO','ITEM_TRAN_NOTICE','PAYMENT_REQ','MORT_CONTRACT','ET_TREATY')
select fa.file_name,fa.file_path,fa.attachment_id
from prj_cdd_item pi,PRJ_CDD_ITEM_CHECK pc,fnd_atm_attachment_multi fm,fnd_atm_attachment fa
where pc.cdd_item_id = pi.cdd_item_id
and fm.table_pk_value = pc.check_id
and fm.attachment_id = fa.attachment_id
and fm.table_name = 'CON_CONTRACT'
and pi.cdd_item in
(select decode(cf.templet_code,
'LEASE_CONTRACT_MASTER_OEC','CONTRACT',
'LEASE_REQUEST_OEC','LEASE_ITEM_REQ',
'LEASE_INFO_OEC','TN_GU_INFO',
'LEASE_SURE_PER_OEC','GUARANTEE_LETTER_OEC',
'LEASE_SURE_SEL_OEC','S_GUARANTEE_LETTER_OEC',
'LEASE_CHECK_OEC','CHECK_INFO',
'LEASE_SURE_PAR_OEC','SPOUSE_COMMITMENT',
'LEASE_SALE_RL_OEC','PUR_CONTRACT',
'LEASE_SALE_YL_OEC','PUR_CONTRACT',
'LEASE_SURE_BUS_OEC','GUARANTEE_LETTER_OEC',
'R_LEASE_CONTRACT_MASTER_OEC','CONTRACT',
'R_LEASE_REQUEST_OEC','LEASE_ITEM_REQ',
'R_LEASE_INFO_OEC','TN_GU_INFO',
'R_LEASE_SURE_PER_OEC','GUARANTEE_LETTER_OEC',
'R_LEASE_SURE_SEL_OEC','S_GUARANTEE_LETTER_OEC',
'R_LEASE_SURE_BUS_OEC','GUARANTEE_LETTER_OEC',
'R_LEASE_CHECK_OEC','CHECK_INFO',
'R_LEASE_SURE_PAR_OEC','SPOUSE_COMMITMENT',
'R_LEASE_SALE_OEC','PUR_CONTRACT',
'S_LEASE_CONTRACT_MASTER_B_OEC','CONTRACT',
'S_LEASE_PAY_OEC','CASHFLOW_INFO',
'S_LEASE_CHECK_OEC','CHECK_INFO',
'S_LEASE_SURE_PER_OEC','GUARANTEE_LETTER_OEC',
'S_LEASE_SURE_PAR_OEC','SPOUSE_COMMITMENT',
'S_LEASE_SURE_F_OEC','S_GUARANTEE_LETTER_OEC',
'S_LEASE_SURE_BUS_OEC','GUARANTEE_LETTER_OEC',
'S_LEASE_ORDER_OEC','ITEM_TRAN_NOTICE',
'S_LEASE_PAY_REQ_OEC','PAYMENT_REQ',
'S_LEASE_MOR_OEC','MORT_CONTRACT')
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'))
expression:"(exists (select 1 from aut_trx_user_authorize a1, aut_owner_user_authorize a2 where a1.trx_category = 'CONTRACT' and a1.trx_id = t1.contract_id and trunc(sysdate) between a1.start_date and nvl(a1.end_date, trunc(sysdate)) and a1.user_id = a2.owner_user_id and a1.trx_category = a2.trx_category and a2.authorized_user_id = ${/session/@user_id} and trunc(sysdate) between a2.start_date and nvl(a2.end_date, trunc(sysdate))))"
},
{
name:'sign_type',
expression:" (nvl(t1.sign_type,'PAPER_SIGN') = 'PAPER_SIGN' or (t1.sign_type = 'ELE_SIGN' and t1.ec_sign_type = 'SIGNED'))"
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 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;
}
//依据合同文本签署人定义存储签署人信息
if ($ctx.parameter.esign_type == 'CE'){
var ele_contract_signer_bm = $bm('wx.WX100.con_ele_contract_signer_save');
ele_contract_signer_bm.update({
contract_id: $ctx.parameter.contract_id
});
}else if($ctx.parameter.esign_type == 'ET'){
//依据提前结清合同文本签署人定义存储签署人信息
var ele_contract_signer_bm = $bm('wx.WX100.con_et_contract_signer_save');
ele_contract_signer_bm.update({
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:$ctx.parameter.esign_type
});
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_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();