Commit a96e5271 authored by 18083's avatar 18083

I-21133运维电子签约静默签文本未回传至系统优化

parent a5ada5d1
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,6 +10,7 @@
importPackage(Packages.leaf.plugin.word2pdf);
importPackage(Packages.org.apache.commons.io);
importPackage(Packages.com.hand.elecon.httpost);
importPackage(Packages.com.hand.hls.hlcm.emay);
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
......@@ -80,6 +81,31 @@
info.code_value = data[0].code_value;
return info;
}
function send_sms(contract_id) {
var sms_list_bm = $bm('sys.SYS401.sys_sms_list');
var sms_list_result = sms_list_bm.queryAsMap({
contract_id: contract_id
});
var sms_list_records = sms_list_result.getChildren();
for (var i = 0; i < sms_list_records.length; i++) {
var Phones = sms_list_records[i].phone_number;
var content = sms_list_records[i].text;
var sms_id = sms_list_records[i].sms_id;
try {
var example = new Example();
var result = example.setSingleSms(content, Phones);
var req_response = result.toString();
} catch (e) {
println("抛出异常:" + e);
}
// 发送短信后,逻辑处理
$bm('nt.sys_sms_list').update({
sms_id: sms_id,
req_response: req_response
});
}
}
var up_file_token_url = info_query('UP_FILE_TOKEN_URL').code_value;
var flow_count_bm = $bm('wx.WX100.con_ele_flow_update');
......@@ -401,6 +427,206 @@
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
});*/
//第一步生成合同文本
/* $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.replace('Z:','/mnt').replace('z:','/mnt'),
"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_agent_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' || signer_record_data.signer_category == 'MAN_FACTURER_SEAL'||signer_record_data.signer_category == 'SUPPLIER_SEAL'||signer_record_data.signer_category == 'LEASE_SUPPLIER_SEAL'){
var signer_category;
var category_desc;
if (signer_record_data.signer_category == 'AGENCY_STORE_SEAL'){
signer_category = 'AGENCY_STORE_SIGN';
category_desc = '代理店';
}else if (signer_record_data.signer_category == 'MAN_FACTURER_SEAL') {
signer_category = 'MAN_FACTURER_SIGN';
category_desc = '厂商代理店';
}else if (signer_record_data.signer_category == 'SUPPLIER_SEAL') {
signer_category = 'SUPPLIER_SIGN';
category_desc = '供应商';
}else if (signer_record_data.signer_category == 'LEASE_SUPPLIER_SEAL') {
signer_category = 'LEASE_SUPPLIER_SIGN';
category_desc = '厂商';
}else if (signer_record_data.signer_category == 'GUARANTOR_NP') {
signer_category = 'GUARANTOR_NP';
category_desc = '担保人';
}
var ele_org_signer_map = ele_signer_bm.queryAsMap({
contract_id: $ctx.parameter.contract_id,
signer_category:signer_category
});
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 = signer_record_data.legal_person;
var legalIdNo = signer_record_data.id_card_no_leg;
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",
"signerCategory":signer_record_data.signer_category,
"categoryDesc":category_desc,
"indentityType":signer_record_data.indentity_type,
"autoSign":signer_record_data.auto_sign
});
}
}
//获取token信息
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 info = info_query('HL_ELE_ACCOUNT_CREATE_PATH');
var httpUrl = info.code_value;
var Param = {
userInfo: userInfoList
}
var result = EleFileUpHttpPost.post(httpUrl, JSON.stringify(Param), 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(Param),
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(result_ob.message.toString());
}
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.replace('Z:','/mnt').replace('Z:','/mnt'),
"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 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
})
//发送签约短消息提醒 24976
flow_update_bm.insert({
contract_id: $ctx.parameter.contract_id
})
send_sms($ctx.parameter.contract_id);
}
}
}
]]></s:server-script>
......
......@@ -28,15 +28,16 @@
}
//依据合同文本签署人定义存储签署人信息
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
});
//第一步生成合同文本
$bm('cont.CON505.con_ele_contract_create_content').update({
contract_id: $ctx.parameter.contract_id,
content_type: 'NORMAL'
});
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');
......
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