Commit 55047458 authored by congzhao's avatar congzhao

电子合同开发 11.19

parent ffc37692
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author:zc
$Date: 2020年11月19日 09点37分
$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
hl_con_contract_content_pkg.contract_et_content_create(
p_contract_id =>${@contract_id},
p_content_id =>${@content_id},
p_user_id =>${/session/@user_id},
p_templet_usage =>${@templet_usage},
p_content_type =>${@content_type},
p_ccr_document_type => ${@ccr_document_type}
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -7,6 +7,7 @@
wx_ele_contract_pkg.update_ele_con_info(p_contract_id => ${@contract_id},
p_id_no => ${@id_no},
p_sign_url => ${@sign_url},
p_esign_type => ${@esign_type},
p_user_id => nvl(${/session/@user_id},1)
);
END;
......
......@@ -14,6 +14,7 @@
<bm:field name="id_no"/>
<bm:field name="mobile"/>
<bm:field name="signer_category"/>
<bm:field name="esign_type"/>
</bm:fields>
<bm:operations>
<bm:operation name="query">
......@@ -25,7 +26,8 @@
cs.id_type,
cs.id_no,
cs.mobile,
hs.signer_category
hs.signer_category,
cs.esign_type
from con_contract_ele_signer cs, hls_doc_file_templet_signer hs
where cs.templet_signer_id = hs.templet_signer_id) t
#WHERE_CLAUSE#
......@@ -35,5 +37,6 @@
<bm:query-fields>
<bm:query-field name="contract_id" queryExpression="t.contract_id= ${@contract_id}"/>
<bm:query-field name="signer_category" queryExpression="t.signer_category= ${@signer_category}"/>
<bm:query-field name="esign_type" queryExpression="t.esign_type= ${@esign_type}"/>
</bm:query-fields>
</bm:model>
......@@ -42,7 +42,8 @@
hs.sign_type,
hs.signer_category
from con_contract_ele_signer cs, hls_doc_file_templet_signer hs
where cs.templet_signer_id = hs.templet_signer_id) t
where cs.templet_signer_id = hs.templet_signer_id
and cs.esign_type = 'CE') t
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
......
......@@ -23,7 +23,8 @@
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.con_ele_signer_id = ${@con_ele_signer_id}
and cf.templet_code != 'SETTLE_ADVANCE_OEC')
]]></bm:query-sql>
</bm:operation>
</bm:operations>
......
......@@ -6,20 +6,17 @@
BEGIN
UPDATE con_contract_ele_signer cs
SET cs.ec_sign_status = 'Y',
cs.sign_time = to_date(${sign_time},'yyyy-mm-dd HH:mm:ss'),
cs.sign_result = ${sign_result},
cs.sign_time = to_date(${@sign_time},'yyyy-mm-dd HH24:MI:SS'),
cs.sign_result = ${@sign_result},
cs.last_update_date = sysdate
WHERE cs.contract_id =
(select c.contract_id
from con_contract c
where c.ele_flow_id = ${flow_id}
and c.data_class = 'NORMAL')
AND cs.id_no = ${id_no};
WHERE cs.contract_id = ${@contract_id}
AND cs.id_no = ${@id_no}
AND cs.esign_type = 'ET';
update con_contract cc
set cc.ec_sign_type = 'SIGNING',
cc.last_update_date = sysdate
where cc.ele_flow_id = ${flow_id};
where cc.ele_flow_id = ${@flow_id};
END;
]]></bm:update-sql>
</bm:operation>
......@@ -29,32 +26,11 @@
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 HH:mm:ss'),
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};
insert into con_ele_signed_file_list
(signed_file_list_id,
flow_id,
file_id,
file_name,
file_download_url,
creation_date,
created_by,
last_updated_by,
last_update_date)
values
(CON_ELE_SIGNED_FILE_LIST_S.NEXTVAL,
${@flow_id},
${@file_id},
${@file_name},
${@file_download_url},
sysdate,
nvl(${/session/@user_id},1),
nvl(${/session/@user_id},1),
sysdate
);
where cc.ele_flow_id = ${@flow_id}
and cc.contract_id = ${@contract_id};
END;
]]></bm:update-sql>
</bm:operation>
......
......@@ -22,7 +22,8 @@
(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 t.templet_id = cf.templet_id
and cf.templet_code != 'SETTLE_ADVANCE_OEC')
]]></bm:query-sql>
</bm:operation>
</bm:operations>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: zc
$Date: 2020年11月9日 10点35分
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:fields>
<bm:field name="con_ele_signer_id"/>
<bm:field name="contract_id"/>
<bm:field name="bp_id"/>
<bm:field name="bp_name"/>
<bm:field name="id_type"/>
<bm:field name="id_no"/>
<bm:field name="templet_signer_id"/>
<bm:field name="ec_sign_status"/>
<bm:field name="templet_id"/>
<bm:field name="indentity_type"/>
<bm:field name="key_word"/>
<bm:field name="auto_sign"/>
<bm:field name="sign_order"/>
<bm:field name="sign_type"/>
<bm:field name="signer_category"/>
</bm:fields>
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select * from (select cs.con_ele_signer_id,
cs.contract_id,
cs.bp_id,
cs.bp_name,
cs.id_type,
cs.id_no,
cs.templet_signer_id,
cs.ec_sign_status,
hs.templet_id,
hs.indentity_type,
hs.key_word,
nvl(hs.auto_sign,'N') auto_sign,
hs.sign_order,
hs.sign_type,
hs.signer_category
from con_contract_ele_signer cs, hls_doc_file_templet_signer hs
where cs.templet_signer_id = hs.templet_signer_id
and cs.esign_type = 'ET') t
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
wx_ele_contract_pkg.et_contract_signer_save(
p_contract_id =>${@contract_id},
p_user_id =>nvl(${/session/@user_id},1)
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="contract_id" queryExpression="t.contract_id= ${@contract_id}"/>
<bm:query-field name="signer_category" queryExpression="t.signer_category= ${@signer_category}"/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
BEGIN
UPDATE con_contract_change_req c
SET c.ele_flow_id = ${@flow_id},
c.ec_sign_type = 'INITIATE',
c.sign_type = 'ELE_SIGN',
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>
<?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
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')
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
BEGIN
UPDATE con_contract_ele_signer cs
SET cs.ec_sign_status = 'Y',
cs.sign_time = to_date(${@sign_time},'yyyy-mm-dd HH24:MI:SS'),
cs.sign_result = ${@sign_result},
cs.last_update_date = sysdate
WHERE cs.contract_id = ${@contract_id}
AND cs.id_no = ${@id_no}
AND cs.esign_type = 'ET';
update con_contract_change_req cc
set cc.ec_sign_type = 'SIGNING',
cc.last_update_date = sysdate
where cc.ele_flow_id = ${@flow_id};
END;
]]></bm:update-sql>
</bm:operation>
<bm:operation name="insert">
<bm:update-sql><![CDATA[
BEGIN
update con_contract_change_req cc
set cc.ec_sign_type = 'SIGNED',
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};
END;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?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
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
where t.contract_id = ${@contract_id}
and t.templet_id = cf.templet_id
and cf.templet_code = 'SETTLE_ADVANCE_OEC')
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -16,6 +16,8 @@
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}_con_ele_terminate_create_link_id"
url="${/request/@context_path}/modules/wx/WX100/con_ele_terminate_create.lsc"/>
<script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>
<link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript"><![CDATA[
......@@ -293,6 +295,39 @@
});
});
};
//提前结清发起电子签署 add by 24976
window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function() {
var req_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASE_01', 'con_contract_change_req');
var req_record = $(req_ds_id).getAt(0);
var req_status = req_record.get('req_status');
var contact_id = req_record.get('contact_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}_con_ele_terminate_create_link_id').getUrl(),
para: {
contract_id: contact_id
},
success: function(res) {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$('${/parameter/@winid}').close();
},
failure: function() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
});
}
window['${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, qpara, bp_seq) {
};
......
......@@ -160,7 +160,8 @@
//合同签署人信息
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
contract_id: $ctx.parameter.contract_id,
esign_type:'CE'
});
var ele_signer_data = ele_signer_map.getChildren();
var userInfoList = [];
......@@ -270,6 +271,7 @@
var httpUrl = info.code_value;
var signParam = {
contractNo:$ctx.parameter.contract_id,
esignType:"CE",
userInfo:userInfoList,
conFileList:conFileList,
signer:signer
......@@ -310,7 +312,8 @@
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
sign_url:sign_url_list[i].signUrl,
esign_type:'CE'
})
}
}
......
......@@ -6,10 +6,30 @@
importPackage(Packages.java.util);
function con_sign_status_update() {
try {
var signer_status_update_bm = $bm('wx.WX100.con_ele_signer_status_update');
//获取传输过来的数据
/* var data = $ctx.parameter.requestData;
var data_ob=JSON.parse(data);*/
var contract_no= $ctx.parameter.contractNo;
var data = "action:" + $ctx.parameter.action + ",contractNO:" + $ctx.parameter.idNo + ",flowId:" + $ctx.parameter.flowId;
var logs_bm = $bm('wx.WX100.con_ele_savelogs');
logs_bm.insert({
contract_id:contract_no,
httpurl:'回调接口',
jsonPut:null,
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'){
signer_status_update_bm.update({
contract_id:contract_no,
flow_id:$ctx.parameter.flowId,
id_no:$ctx.parameter.idNo,
sign_time:$ctx.parameter.signTime,
......@@ -21,14 +41,12 @@
//合同签署完成
else if($ctx.parameter.action == 'SIGN_FLOW_FINISH'){
var docsList = $ctx.parameter.docsList;
for (var i = 0; i < conFileList.length ; i++){
for (var i = 0; i < docsList.length ; i++){
signer_status_update_bm.insert({
contract_id:contract_no,
flow_id:$ctx.parameter.flowId,
flow_status:$ctx.parameter.flowStatus,
end_time:$ctx.parameter.endTime,
file_id:docsList[i].fileId,
file_name:docsList[i].fileName,
file_download_url:docsList[i].fileUrl
end_time:$ctx.parameter.endTime
});
}
$ctx.parameter.return_status = '0';
......
<?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 = '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);
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 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_et_contract_signer_save');
ele_contract_signer_bm.update({
contract_id: $ctx.parameter.contract_id
});
//第一步生成提前结清文本
$bm('cont.CON732.con_et_content_create').update({
contract_id: $ctx.parameter.contract_id,
ccr_document_type: 'ET',
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';
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();
}
//保存文本名及路径
$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_et_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:'ET'
});
var ele_signer_data = ele_signer_map.getChildren();
var userInfoList = [];
println(ele_signer_data.length);
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'){
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;
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":"2"
});
}
}
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();
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_et_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,
esignType:"ET",
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);
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('发起签约失败,请联系技术人员检查!');
}else if(result_ob.code == 0){
var flow_id = result_ob.flowId;
var flow_update_bm = $bm('wx.WX100.con_et_flow_update');
flow_update_bm.update({
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({
contract_id:$ctx.parameter.contract_id,
id_no:sign_url_list[i].idNo,
sign_url:sign_url_list[i].signUrl,
esign_type:'ET'
})
}
}
]]></s:server-script>
</a:init-procedure>
</a:service>
\ No newline at end of file
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