Commit e14c815e authored by 38823's avatar 38823

催收函 担保人开发和代码遗漏补充

parent 07aa2331
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select ccb.bp_name, ccb.bp_code
from con_contract_bp ccb
where ccb.bp_category = 'GUARANTOR'
and ccb.contract_id =${@contract_id}
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field name="bp_code" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="210" forDisplay="true" forQuery="true" physicalName="BP_CODE" prompt="商业伙伴编码"/>
<bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="210" forDisplay="true" forQuery="true" physicalName="BP_NAME" prompt="商业伙伴名称"/>
</bm:fields>
<bm:query-fields>
<bm:query-field field="bp_code" queryOperator="like"/>
<bm:query-field field="bp_name" queryOperator="like"/>
</bm:query-fields>
</bm:model>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
WHERE e.role_id = ${/session/@role_id}) not in WHERE e.role_id = ${/session/@role_id}) not in
('0018', '0019')) ('0018', '0019'))
and t.contract_id = ${@contract_id} and t.contract_id = ${@contract_id}
and t.lease_type = '02' and t.lease_type = ${@lease_type}
order by t.print_date desc order by t.print_date desc
]]></bm:query-sql> ]]></bm:query-sql>
</bm:operation> </bm:operation>
......
...@@ -19,5 +19,18 @@ ...@@ -19,5 +19,18 @@
]]></bm:update-sql> ]]></bm:update-sql>
</bm:operation> </bm:operation>
<bm:operation name="execute">
<bm:update-sql><![CDATA[
begin
con_contract_content_pkg.content_create_for_gua(
p_contract_id =>${@contract_id},
p_user_id =>${/session/@user_id},
p_templet_code=>${@templet_code},
p_bp_code=>${@bp_code}
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations> </bm:operations>
</bm:model> </bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true"
trace="true">
<a:init-procedure>
<s:server-script import="con_print_path.js"><![CDATA[
set_parameter_file_path();
]]></s:server-script>
<a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
</a:init-procedure>
<a:view>
<!-- <a:link id="con301n_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>-->
<a:link id="con301n_downloadFile_id" url="${/request/@context_path}/modules/cont/CON301N/con_downfile.lsc"/>
<a:link id="con301n_print_excel_link"
url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_atm.lsc"/>
<a:link id="con301n_print_pdf_link"
url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_pdf.lsc"/>
<a:link id="con_cashflow_print_link"
url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection_n.lsc"/>
<a:link id="con_cashflow_print_signatures_link"
url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection_signatures.lsc"/>
<script type="text/javascript"><![CDATA[
function lock_current_window() {
Leaf.Masker.mask($('${/parameter/@winid}').wrap, '${l:HLS.EXECUTING}');
}
function unlock_current_window() {
Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
}
function con_print_word_create() {
debugger;
Leaf.Masker.mask(Ext.getBody(), '请稍等......');
var contract_id = '${/parameter/@contract_id}';
var templet_code = '${/parameter/@templet_code}';
var bp_name = $('con_contract_update_print_detail_header_ds').getCurrentRecord().get('bp_name');
var bp_code = $('con_contract_update_print_detail_header_ds').getCurrentRecord().get('bp_code');
if(bp_name == undefined || bp_name==''){
$L.showMessage("提示",'请选择担保人名称!');
Leaf.Masker.unmask(Ext.getBody());
return;
}
var contract_number = '${/parameter/@contract_number}';
var contract_name = '${/parameter/@contract_name}';
var file_name = '催收函-'+ '${/parameter/@bp_name}'+'(担保人-'+bp_name+')';
Leaf.request({
url: $('con_cashflow_print_link').getUrl(),
para: {
contract_id : contract_id,
contract_number : contract_number,
contract_name : contract_name,
templet_code : templet_code,
file_name : file_name,
bp_code : bp_code
},
success: function(res) {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
}
});
}
function con_print_signatures_create() {
debugger;
Leaf.Masker.mask(Ext.getBody(), '请稍等......');
var contract_id = '${/parameter/@contract_id}';
var templet_code = '${/parameter/@templet_code}';
var bp_name = $('con_contract_update_print_detail_header_ds').getCurrentRecord().get('bp_name');
var bp_code = $('con_contract_update_print_detail_header_ds').getCurrentRecord().get('bp_code');
if(bp_name == undefined || bp_name==''){
$L.showMessage("提示",'请选择担保人名称!');
Leaf.Masker.unmask(Ext.getBody());
return;
}
var contract_number = '${/parameter/@contract_number}';
var contract_name = '${/parameter/@contract_name}';
var file_name = '催收函'+ '${/parameter/@bp_name}'+'(担保人-'+bp_name+')';
Leaf.request({
url: $('con_cashflow_print_signatures_link').getUrl(),
para: {
contract_id : contract_id,
contract_number : contract_number,
contract_name : contract_name,
templet_code : templet_code,
file_name : file_name,
bp_code : bp_code
},
success: function(res) {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
}
});
}
function update_attachment_renderer(value, record, name) {
var content_id = record.get('content_id');
return '<a href="javascript:open_uploadfile_win(' + content_id + ')">附件</a>';
}
function attachment_download(val,rec,name) {
return '<a href=javascript:detail_download_window('+rec.get('print_id')+')>下载</a>';}
function detail_download_window(record_id) {
// var url = $('con301n_downloadFile_id').getUrl() + '?table_name=CUX_CONTRACT_PRINT&header_id=' + record_id;
// var win = new Leaf.Window({
// url: url,
// title: '${l:HLS.SUPPORTING_DOCUMENT}',
// id: 'con301n_records_uploadFile_id',
// width: 850,
// height: 400
// });
// win.on('close', function() {
// });
var url = $('con301n_downloadFile_id').getUrl() + '?record_id=' + record_id + '&table_name=CUX_CONTRACT_PRINT';
window.open(url, '_self');
}
]]></script>
<a:dataSets>
<a:dataSet id="con_contract_update_print_detail_header_ds" autoCreate="true">
<a:fields>
<a:field name="contract_number" defaultValue="${/parameter/@contract_number}" readOnly="true"/>
<a:field name="contract_name" defaultValue="${/parameter/@contract_name}" readOnly="true"/>
<a:field name="bp_name" lovGridHeight="350" lovHeight="500" lovLabelWidth="100" lovService="cont.CON620.con_cashflow_print_gua?contract_id=${/parameter/@contract_id}" lovWidth="550" required="true" title="明细">
<a:mapping>
<a:map from="bp_name" to="bp_name"/>
<a:map from="bp_code" to="bp_code"/>
</a:mapping>
</a:field>
</a:fields>
</a:dataSet>
<a:dataSet id="con_contract_print_detail_line_ds" autoQuery="true" fetchAll="true" pageSize="100"
queryUrl="${/request/@context_path}/autocrud/cont.CON620.con_statement_of_account_print/query?contract_id=${/parameter/@contract_id}&amp;lease_type=03">
<a:fields>
<a:field name="contract_id"/>
<a:field name="content_number" readOnly="true"/>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<div id="screenTopToolbardiv">
<a:screenTopToolbar style="width:700px">
<a:gridButton id="con_print_id" click="con_print_word_create" text="生成催收函Word"/>
<a:gridButton id="con_print_signatures_id" click="con_print_signatures_create" text="生成催收函PDF"/>
</a:screenTopToolbar>
<a:form column="2" width="750" labelWidth="200" >
<a:textField name="contract_number" bindTarget="con_contract_update_print_detail_header_ds"
prompt="HLS.CONTRACT_NUMBER"/>
<a:textField name="contract_name" bindTarget="con_contract_update_print_detail_header_ds"
prompt="HLS.CONTRACT_NAME" width="330"/>
<a:lov name="bp_name" bindTarget="con_contract_update_print_detail_header_ds" prompt="担保人名称"/>
</a:form>
</div>
<a:grid id="con_contract_update_print_detail_grid_id" bindTarget="con_contract_print_detail_line_ds"
height="350" navBar="true" width="700">
<a:toolBar>
<a:button prompt="PROMPT.EXPORT_EXCEL" type="excel"/>
</a:toolBar>
<a:columns>
<a:column name="file_name" prompt="文本名称" width="260"/>
<a:column name="user_name" prompt="打印人" width="160"/>
<a:column name="print_date" prompt="生成日期" width="180"/>
<a:column name="download" align="center" prompt="下载" renderer="attachment_download" width="50"/>
</a:columns>
</a:grid>
</a:screenBody>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function() {
if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") {
document.getElementById("con_print_signatures_id").style.display = "";
} else {
document.getElementById("con_print_signatures_id").style.display = "none";
}
});
]]></script>
</a:view>
</a:screen>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<a:link id="con301n_print_pdf_link" <a:link id="con301n_print_pdf_link"
url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_pdf.lsc"/> url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_pdf.lsc"/>
<a:link id="con_cashflow_print_link" <a:link id="con_cashflow_print_link"
url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection.lsc"/> url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection_n.lsc"/>
<a:link id="con_cashflow_print_signatures_link" <a:link id="con_cashflow_print_signatures_link"
url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection_signatures.lsc"/> url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection_signatures.lsc"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
</a:dataSet> </a:dataSet>
<a:dataSet id="con_contract_print_detail_line_ds" autoQuery="true" fetchAll="true" pageSize="100" <a:dataSet id="con_contract_print_detail_line_ds" autoQuery="true" fetchAll="true" pageSize="100"
queryUrl="${/request/@context_path}/autocrud/cont.CON620.con_statement_of_account_print/query?contract_id=${/parameter/@contract_id}"> queryUrl="${/request/@context_path}/autocrud/cont.CON620.con_statement_of_account_print/query?contract_id=${/parameter/@contract_id}&amp;lease_type=02">
<a:fields> <a:fields>
<a:field name="contract_id"/> <a:field name="contract_id"/>
<a:field name="content_number" readOnly="true"/> <a:field name="content_number" readOnly="true"/>
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection_signatures.lsc"/> url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection_signatures.lsc"/>
<a:link id="cashflow_print_signatures_link_id" <a:link id="cashflow_print_signatures_link_id"
url="${/request/@context_path}/modules/cont/CON620/con_cashflow_print_signatures.lview"/> url="${/request/@context_path}/modules/cont/CON620/con_cashflow_print_signatures.lview"/>
<a:link id="cashflow_print_gua_link_id"
url="${/request/@context_path}/modules/cont/CON620/con_cashflow_print_gua.lview"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
Ext.ux.Lightbox.register('a[ref=img]', true); Ext.ux.Lightbox.register('a[ref=img]', true);
...@@ -234,6 +236,7 @@ ...@@ -234,6 +236,7 @@
document.getElementById("CON_DUE_DETAIL_user_button3").style.display = "none"; document.getElementById("CON_DUE_DETAIL_user_button3").style.display = "none";
document.getElementById("CON_DUE_DETAIL_user_button4").style.display = "none"; document.getElementById("CON_DUE_DETAIL_user_button4").style.display = "none";
document.getElementById("CON_DUE_DETAIL_user_button5").style.display = "none"; document.getElementById("CON_DUE_DETAIL_user_button5").style.display = "none";
document.getElementById("CON_DUE_DETAIL_user_button6").style.display = "none";
if(document.getElementById("${/parameter/@layout_code}_F_BASIC_CON_CONTRACT_PATTERN")){ if(document.getElementById("${/parameter/@layout_code}_F_BASIC_CON_CONTRACT_PATTERN")){
document.getElementById("${/parameter/@layout_code}_F_BASIC_CON_CONTRACT_PATTERN_prompt").style.display = "none"; document.getElementById("${/parameter/@layout_code}_F_BASIC_CON_CONTRACT_PATTERN_prompt").style.display = "none";
document.getElementById("${/parameter/@layout_code}_F_BASIC_CON_CONTRACT_PATTERN").style.display = "none"; document.getElementById("${/parameter/@layout_code}_F_BASIC_CON_CONTRACT_PATTERN").style.display = "none";
...@@ -283,6 +286,34 @@ ...@@ -283,6 +286,34 @@
}; };
//新增催款函担保人pdf打印(盖章)
window['${/parameter/@layout_code}_user_button6_layout_dynamic_click'] = function () {
debugger;
var ds = $('CON_DUE_DETAIL_F_BASIC_con_contract_ds');
var records = ds.getCurrentRecord();
var bp_name = records.get('bp_name');
var contract_number = records.get('contract_number');
var contract_name = records.get('contract_name');
var contract_id = '${/parameter/@document_id}';
var templet_code = 'CON_LEASE_GUA';
var win = new Leaf.Window({
id: 'cashflow_print_gua',
url: $('cashflow_print_gua_link_id').getUrl(),
params: {
contract_id: contract_id,
templet_code: templet_code,
bp_name : bp_name,
contract_number : contract_number,
contract_name : contract_name,
winid : 'contract_print_gua_winid'
},
title: '催款函打印',
height: 550,
width: 800
});
};
]]></script> ]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view> </a:view>
......
<?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>
<s:server-script import="con_print_path.js"><![CDATA[
importPackage(java.io);
importPackage(Packages.hls.plugin.docx4j)
importPackage(Packages.org.apache.commons.io);
importPackage(Packages.com.hand.hl);
function RandomString(length) {
var str = '';
for (;str.length < length;str += Math.random().toString(36).substr(2));
return str.substr(0, length);
}
//删除文件
function deleteFile(filePath) {
var file = new File(filePath);
if (file.exists()) {
file.delete();
}
}
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 getDatePath() {
set_pdf_parameter_file_path();
var file_path = $ctx.parameter.file_path; //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 get_file_length(path){
var file=new File(String(path));
if(file.exists() && file.isFile()){
length=file.length();
return length;
}else{
return 0 ;
}
}
function write_os_to_file(file, os) {
var fis = new FileInputStream(file);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
fis.close();
}
function download_file(file_path, file_name) {
$ctx["__request_type__"] = 'file';
var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
resp.setHeader("Pragma", "No-cache");
resp.setHeader("Cache-Control", "no-cache, must-revalidate");
resp.setHeader("Content-disposition", "attachment; filename=" + encodeURI(file_name, 'utf-8'));
resp.setDateHeader("Expires", 0);
resp.setContentType("application/x-msdownload");
try {
var os = resp.getOutputStream();
write_os_to_file(file_path, os);
//write_os_to_file(file_path+file_name, os);
os.flush();
} catch (e) {
$logger("server-script").severe(e.message);
}
}
function collection_create_content() {
try {
//第一步生成合同文本
if($ctx.parameter.templet_code == 'CON_LEASE_GUA'){
$bm('cont.CON620.create_content_for_collection').execute({
contract_id: $ctx.parameter.contract_id,
templet_code: $ctx.parameter.templet_code,
bp_code: $ctx.parameter.bp_code
});
}else {
$bm('cont.CON620.create_content_for_collection').update({
contract_id: $ctx.parameter.contract_id,
templet_code: $ctx.parameter.templet_code
});
}
//获取日期目录
set_parameter_file_path();
var datePath = getDatePath();
$ctx.parameter.batch_flag='Y';
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
var from_file_data_map = $bm('cont.CON500.con_doc_file_templet_get_atm_new').queryAsMap({
contract_id: $ctx.parameter.contract_id,
batch_flag:$ctx.parameter.batch_flag,
templet_code: $ctx.parameter.templet_code
});
var from_file_data = from_file_data_map.getChildren();
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 = datePath + guid_file_name_tables[0].guid_file_name + 'con' + record_data.content_id;
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);
}
<!-- $bm('cont.CON500.con_file_content_copy_update').update({-->
<!-- table_name: 'CON_CONTRACT_CONTENT',-->
<!-- content_id: record_data.content_id,-->
<!-- file_name: to_file_name.toString(),-->
<!-- file_path: to_file_path.toString()-->
<!-- });-->
var test=new File(to_file_path);
var test1=new File('D:'+to_file_path);
<!-- download_file(to_file_path.toString(),to_file_name.toString());-->
var file_size=get_file_length(to_file_path);
if($ctx.parameter.templet_code == 'CON_LEASE_GUA'){
var lease_type='03';
}else {
lease_type='02'
}
var business_daily_email=$bm('cont.CON301N.insert_into_attachment_bmp').update({
p_file_path :(to_file_path).toString(),
p_file_name :($ctx.parameter.file_name+'.docx').toString(),
p_file_size :file_size,
p_user_id :$ctx.session.user_id,
p_contract_id :$ctx.parameter.contract_id,
p_file_type :'WORD',
p_lease_type :lease_type
});
}
}
$ctx.parameter.return_status = 'S';
$ctx.parameter.return_message = '执行成功';
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = 'E';
$ctx.parameter.return_message = $ctx.get('/error/@message') || String(e);
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') {
collection_create_content();
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</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