Commit 434d5031 authored by congzhao's avatar congzhao

[建机]电子合同开发 11.23

parent 14247df4
......@@ -83,6 +83,6 @@
<bm:field name="sign_url"/>
</bm:fields>
<bm:query-fields>
<bm:query-field name="contract_number" queryExpression="v.contract_number = ${@contract_number}"/>
<bm:query-field name="contract_number" queryExpression="v.contract_number like &apos;%&apos;||${@contract_number}||&apos;%&apos;"/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: zc
$Date: 2020年11月20日
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:fields>
<bm:field name="contract_id"/>
<bm:field name="ele_flow_id"/>
</bm:fields>
<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
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
BEGIN
wx_ele_contract_pkg.init_con_atm(p_contract_id => ${@contract_id},
p_file_path => ${@file_url},
p_file_name => ${@file_name},
p_file_length => ${@file_size},
p_user_id => nvl(${/session/@user_id},1));
COMMIT;
END;
]]></bm:update-sql>
</bm:operation>
<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'
where cr.ele_flow_id =${@flow_id}
and cr.contract_id =${@contract_id};
COMMIT;
END;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field field="contract_id" queryOperator="="/>
<bm:query-field field="ele_flow_id" queryOperator="="/>
</bm:query-fields>
</bm:model>
......@@ -11,7 +11,7 @@
cs.last_update_date = sysdate
WHERE cs.contract_id = ${@contract_id}
AND cs.id_no = ${@id_no}
AND cs.esign_type = 'ET';
AND cs.esign_type = 'CE';
update con_contract cc
set cc.ec_sign_type = 'SIGNING',
......@@ -31,6 +31,11 @@
cc.last_update_date = sysdate
where cc.ele_flow_id = ${@flow_id}
and cc.contract_id = ${@contract_id};
wx_ele_contract_pkg.downloadEleFile(p_contract_id => ${@contract_id},
p_ele_flow_id => ${@flow_id},
p_user_id => 1,
p_company_id => 1);
COMMIT;
END;
]]></bm:update-sql>
</bm:operation>
......
......@@ -30,6 +30,11 @@
cc.last_update_date = sysdate
where cc.ele_flow_id = ${@flow_id}
and cc.contract_id = ${@contract_id};
wx_ele_contract_pkg.downloadEleFile(p_contract_id => ${@contract_id},
p_ele_flow_id => ${@flow_id},
p_user_id => 1,
p_company_id => 1);
COMMIT;
END;
]]></bm:update-sql>
</bm:operation>
......
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="insert">
<bm:update-sql><![CDATA[
BEGIN
wx_ele_contract_pkg.send_email(p_user_id => nvl(${/session/@user_id},1),
p_mail_to => ${@mail_to},
p_contract_id => ${@contract_id});
END;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -4,13 +4,16 @@
<bm:operation name="insert">
<bm:update-sql><![CDATA[
BEGIN
HL_SMS_SEND_PKG.wx_verify_code_sms(p_phone_number => ${@phone_number},p_user_id => nvl(${/session/@user_id},1), p_sms_id =>${@sms_id},p_verify_code => ${@verify_code});
COMMIT;
HL_SMS_SEND_PKG.send_mobile_validation_key(p_phone_number => ${@phone_number},
p_user_id => nvl(${/session/@user_id},1),
p_sms_id => ${@sms_id},
o_md5_check_id => ${@md5_check_id});
COMMIT;
END;
]]></bm:update-sql>
<bm:parameters>
<bm:parameter name="sms_id" dataType="java.lang.Long" input="false" output="true" outputPath="/parameter/@sms_id"/>
<bm:parameter name="verify_code" dataType="java.lang.Long" input="false" output="true" outputPath="/parameter/@verify_code"/>
<bm:parameter name="md5_check_id" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@md5_check_id"/>
</bm:parameters>
</bm:operation>
</bm:operations>
......
<?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
HL_SMS_SEND_PKG.verify_mobile_validation_key(p_user_id => nvl(${/session/@user_id},1),
p_md5_check_id => ${@check_id},
p_validation_key => ${@validation_key},
o_check_flag => ${@check_flag},
o_check_result => ${@check_result});
COMMIT;
END;
]]></bm:update-sql>
<bm:parameters>
<bm:parameter name="check_flag" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@check_flag"/>
<bm:parameter name="check_result" dataType="java.lang.String" input="false" output="true" outputPath="/parameter/@check_result"/>
</bm:parameters>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -17,7 +17,7 @@
contract_list_map = contract_list_bm.queryAsMap({
id_no:$ctx.parameter.idNo,
id_type:$ctx.parameter.IdType,
contract_number:$ctx.parameter.contract_number
contract_number:inputData
});
}
contract_list_details = contract_list_map.getChildren();
......
......@@ -60,8 +60,10 @@
//按日期创建目录
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 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
......@@ -303,17 +305,17 @@
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
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++){
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'
contract_id: $ctx.parameter.contract_id,
id_no: sign_url_list[i].idNo,
sign_url: sign_url_list[i].signUrl,
esign_type: 'CE'
})
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" trace="true">
<a:init-procedure>
<s:server-script><![CDATA[
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的地址
//系统参数获取
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;
}
function ele_file_download() {
try {
//文件列表
var con_ele_file_dl_bm = $bm('wx.WX100.con_ele_file_download');
var con_ele_file_dl_map;
if($ctx.parameter.p_contract_id && $ctx.parameter.p_ele_flow_id){
con_ele_file_dl_map = con_ele_file_dl_bm.queryAsMap({
contract_id: $ctx.parameter.p_contract_id,
ele_flow_id: $ctx.parameter.p_ele_flow_id
});
}else{
con_ele_file_dl_map = con_ele_file_dl_bm.queryAsMap();
}
var con_ele_file_dl_data = con_ele_file_dl_map.getChildren();
for (var i = 0; i < con_ele_file_dl_data.length; i++) {
var flow_id = con_ele_file_dl_data[i].ele_flow_id;
//调用中台下载文件接口
var info = info_query('HL_SIGN_FILE_DOWNLOAD');
var httpUrl = info.code_value;
var Param = {
flowId: flow_id
}
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(Param), access_sign_token);
logs_bm.insert({
contract_id: con_ele_file_dl_data[i].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) {
var docs_list = result_ob.docsList;
for (var j = 0; j < docs_list.length; j++) {
con_ele_file_dl_bm.update({
contract_id: con_ele_file_dl_data[i].contract_id,
file_name: docs_list[j].fileName,
file_url: docs_list[j].fileUrl,
file_size:docs_list[j].fileSize
})
}
con_ele_file_dl_bm.execute({
contract_id: con_ele_file_dl_data[i].contract_id,
flow_id:flow_id
})
}
}
$ctx.parameter.return_status = '0';
$ctx.parameter.return_message = '执行成功';
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = 'E';
$ctx.parameter.return_message = $ctx.get('/error/@message') || String(e);
$bm('wx.WX100.rollback').update();
//raise_app_error(e);
}
var result = {
result: $ctx.parameter.return_status,
message: $ctx.parameter.return_message
};
$ctx.parameter.json = JSON.stringify(result);
}
if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
ele_file_download();
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</a:service>
\ No newline at end of file
......@@ -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 + ",contractNO:" + $ctx.parameter.idNo + ",flowId:" + $ctx.parameter.flowId;
var data = "action:" + $ctx.parameter.action + ",flowId:" + $ctx.parameter.flowId;
var logs_bm = $bm('wx.WX100.con_ele_savelogs');
logs_bm.insert({
contract_id:contract_no,
......@@ -28,27 +28,29 @@
}
//个人签署完成
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,
sign_result:$ctx.parameter.signResult
});
var idNos = $ctx.parameter.idNos;
var idNos_json = JSON.parse(idNos);
var idNos_list = idNos_json.idNoList;
for(var i = 0 ; i < idNos_list.length; i++){
signer_status_update_bm.update({
contract_id:contract_no,
flow_id:$ctx.parameter.flowId,
id_no:idNos_list[i].idNo,
sign_time:$ctx.parameter.signTime,
sign_result:$ctx.parameter.signResult
});
}
$ctx.parameter.return_status = '0';
$ctx.parameter.return_message = '修改成功';
}
//合同签署完成
else if($ctx.parameter.action == 'SIGN_FLOW_FINISH'){
var docsList = $ctx.parameter.docsList;
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
});
}
signer_status_update_bm.insert({
contract_id:contract_no,
flow_id:$ctx.parameter.flowId,
flow_status:$ctx.parameter.flowStatus,
end_time:$ctx.parameter.endTime
});
$ctx.parameter.return_status = '0';
$ctx.parameter.return_message = '修改成功';
}
......@@ -57,6 +59,7 @@
$ctx.success = "true";
$ctx.parameter.return_status = '1';
$ctx.parameter.return_message = $ctx.get('/error/@message') || String(e);
//$bm('wx.WX100.rollback').update();
}
var result = {
code: $ctx.parameter.return_status,
......
......@@ -60,8 +60,10 @@
//按日期创建目录
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 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
......
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<s:server-script import="app/app_login_check.js"><![CDATA[
function send_email() {
try {
if($ctx.parameter.email && $ctx.parameter.contractNo) {
var ele_file_email_bm = $bm('wx.WX100.wx_ele_file_email');
ele_file_email_bm.insert({
mail_to: $ctx.parameter.email,
contract_id:$ctx.parameter.contractNo
});
$ctx.parameter.return_status = '0';
$ctx.parameter.return_message = '执行成功';
}
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = '1';
$ctx.parameter.return_message = String(e);
}
var result = {
code: $ctx.parameter.return_status,
message: $ctx.parameter.return_message,
};
$ctx.parameter.json = JSON.stringify(result);
}
send_email();
]]></s:server-script>
</a:init-procedure>
<a:service-output output="/parameter/@json"/>
</a:service>
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<s:server-script><![CDATA[
importPackage(Packages.deron_sms_interface);
function send_sms() {
try {
if($ctx.parameter.mobile){
//step1 配置信息
var sms_server_bm = $bm('sys.SYS403.sys_sms_server');
var sms_server_result = sms_server_bm.queryAsMap({});
var sms_server_records = sms_server_result.getChildren();
var server_url = sms_server_records[0].server_url;
var CorpID = sms_server_records[0].serviceid;
var Pwd = sms_server_records[0].password;
// step2 生成短信
var verify_code_sms_bm = $bm('wx.WX100.wx_verify_code_sms');
verify_code_sms_bm.insert({
phone_number: $ctx.parameter.mobile
});
var sms_list_bm = $bm('sys.SYS401.sys_sms_list');
if ($ctx.parameter.sms_id) {
var sms_list_result = sms_list_bm.queryAsMap({
sms_id: $ctx.parameter.sms_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 sms = new SendSms();
var result = sms.doSend(server_url, CorpID, Pwd, content, Phones);
var req_response = result.toString();
// req_response = parseInt(req_response);
/* var json_result = {
"sendflag": result
};
$ctx.parameter.json = JSON.stringify(json_result);*/
} catch (e) {
println("抛出异常:" + e);
}
// 发送短信后,逻辑处理
$bm('nt.sys_sms_list').update({
sms_id: sms_id,
req_response: req_response
});
}
$ctx.parameter.return_status = '0';
$ctx.parameter.return_message = '执行成功';
<s:server-script import="app/app_login_check.js"><![CDATA[
importPackage(Packages.com.hand.hls.hlcm.emay);
function send_sms() {
try {
if($ctx.parameter.mobile) {
// step2 生成短信
var verify_code_sms_bm = $bm('wx.WX100.wx_verify_code_sms');
verify_code_sms_bm.insert({
phone_number: $ctx.parameter.mobile
});
var sms_list_bm = $bm('sys.SYS401.sys_sms_list');
var md5_check_id = $ctx.parameter.md5_check_id;
if ($ctx.parameter.sms_id) {
var sms_list_result = sms_list_bm.queryAsMap({
sms_id: $ctx.parameter.sms_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);
}
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = '1';
$ctx.parameter.return_message = String(e);
}
var result = {
code: $ctx.parameter.return_status,
message: $ctx.parameter.return_message,
data:{}
};
var data = result.data;
data["mobile"] = $ctx.parameter.mobile;
data["verifyCode"] = $ctx.parameter.verify_code.toString();
$ctx.parameter.json = JSON.stringify(result);
// 发送短信后,逻辑处理
$bm('nt.sys_sms_list').update({
sms_id: sms_id,
req_response: req_response
});
}
}
send_sms();
]]></s:server-script>
</a:init-procedure>
<a:service-output output="/parameter/@json"/>
</a:service>
$ctx.parameter.return_status = '0';
$ctx.parameter.return_message = '执行成功';
}
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = '1';
$ctx.parameter.return_message = String(e);
}
var result = {
code: $ctx.parameter.return_status,
message: $ctx.parameter.return_message,
checkId:md5_check_id
};
$ctx.parameter.json = JSON.stringify(result);
}
send_sms();
]]></s:server-script>
</a:init-procedure>
<a:service-output output="/parameter/@json"/>
</a:service>
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<s:server-script import="app/app_login_check.js"><![CDATA[
function verify_validation_code() {
try {
if($ctx.parameter.checkId && $ctx.parameter.validationKey){
var verify_code_sms_bm = $bm('wx.WX100.wx_verify_validation_code');
verify_code_sms_bm.update({
check_id:$ctx.parameter.checkId,
validation_key:$ctx.parameter.validationKey
});
$ctx.parameter.return_status = '0';
$ctx.parameter.return_message = '执行成功';
}
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = '1';
$ctx.parameter.return_message = String(e);
}
var result = {
code: $ctx.parameter.return_status,
message: $ctx.parameter.return_message,
checkFlag:$ctx.parameter.check_flag,
checkResult:$ctx.parameter.check_result
};
$ctx.parameter.json = JSON.stringify(result);
}
verify_validation_code();
]]></s:server-script>
</a:init-procedure>
<a:service-output output="/parameter/@json"/>
</a:service>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment