Commit 11183e05 authored by gzj34291's avatar gzj34291

对账单和催收函转PDF盖章

parent d032d792
...@@ -10,6 +10,8 @@ import java.util.Calendar; ...@@ -10,6 +10,8 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
import static com.hand.kinggrid.MainRequest.createHttpRequest;
public class ContractSignaturesNew public class ContractSignaturesNew
{ {
public static String hl_contract_signatures(String file_path, String sign_path, Object[] param,String server_url,String app_id,String app_security,String datePath) public static String hl_contract_signatures(String file_path, String sign_path, Object[] param,String server_url,String app_id,String app_security,String datePath)
...@@ -17,7 +19,7 @@ public class ContractSignaturesNew ...@@ -17,7 +19,7 @@ public class ContractSignaturesNew
{ {
String contractid = UUID.randomUUID().toString().replaceAll("-", ""); String contractid = UUID.randomUUID().toString().replaceAll("-", "");
HttpRequest request = MainRequest.createHttpRequest("/api/cnt/sign",server_url,app_id,app_security); HttpRequest request = createHttpRequest("/api/cnt/sign",server_url,app_id,app_security);
InputStream is = null; InputStream is = null;
String status; String status;
String signer_info; String signer_info;
......
...@@ -11,18 +11,20 @@ ...@@ -11,18 +11,20 @@
<bm:query-sql><![CDATA[ <bm:query-sql><![CDATA[
select t.file_name, select t.file_name,
to_char(t.print_date,'yyyy-mm-dd hh24:mi:ss') print_date, to_char(t.print_date,'yyyy-mm-dd hh24:mi:ss') print_date,
t.print_id t.print_id,
(SELECT su.description FROM sys_user su WHERE su.user_id = t.created_by) user_name
from cux_contract_print t from cux_contract_print t
where (((SELECT e.role_code where (((SELECT e.role_code
FROM sys_role_vl e FROM sys_role_vl e
WHERE e.role_id = ${/session/@role_id}) in ('0018', '0019') and WHERE e.role_id = ${/session/@role_id}) in ('0018', '0019')
t.file_type = 'EXCEL') and t.created_by = ${/session/@user_id})
or (SELECT e.role_code or (SELECT e.role_code
FROM sys_role_vl e FROM sys_role_vl e
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}
order by t.print_date and t.lease_type = '01'
order by t.print_date desc
]]></bm:query-sql> ]]></bm:query-sql>
</bm:operation> </bm:operation>
</bm:operations> </bm:operations>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gzj
$Date: 2022年03月20日 17:13:08
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:fields>
<bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String"/>
<bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String"/>
</bm:fields>
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT fa.file_name,fa.file_path
FROM fnd_atm_attachment fa, fnd_atm_attachment_multi fm
WHERE fa.attachment_id = fm.attachment_id
and fm.table_name = 'CUX_CONTRACT_PRINT'
and fm.table_pk_value = ${@record_id}
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
p_file_size =>${@p_file_size}, p_file_size =>${@p_file_size},
p_user_id =>${@p_user_id}, p_user_id =>${@p_user_id},
p_contract_id =>${@p_contract_id}, p_contract_id =>${@p_contract_id},
p_file_type =>${@p_file_type} p_file_type =>${@p_file_type},
p_lease_type =>${@p_lease_type}
); );
END; END;
]]></bm:update-sql> ]]></bm:update-sql>
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
</bm:operations> </bm:operations>
<bm:fields> <bm:fields>
<bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/> <bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
<!-- <bm:field name="file_name2" databaseType="VARCHAR2" datatype="java.lang.String"/>-->
<bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/> <bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
<bm:field name="attachment_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ATTACHMENT_ID"/> <bm:field name="attachment_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ATTACHMENT_ID"/>
<!-- <bm:field name="templet_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLET_CODE"/>--> <!-- <bm:field name="templet_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLET_CODE"/>-->
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<bm:operations> <bm:operations>
<bm:operation name="update"> <bm:operation name="update">
<bm:update-sql><![CDATA[ <bm:update-sql><![CDATA[
begin begin
HL_CONTRACT_PKG.save_pdf_atm(p_content_id =>${@content_id}); HL_CONTRACT_PKG.save_pdf_atm(p_content_id =>${@content_id});
end; end;
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gzj
$Date: 2022年12月8日 17:13:08
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select t.file_name,
to_char(t.print_date,'yyyy-mm-dd hh24:mi:ss') print_date,
t.print_id,
(SELECT su.description FROM sys_user su WHERE su.user_id = t.created_by) user_name
from cux_contract_print t
where (((SELECT e.role_code
FROM sys_role_vl e
WHERE e.role_id = ${/session/@role_id}) in ('0018', '0019')
and t.created_by = ${/session/@user_id})
or (SELECT e.role_code
FROM sys_role_vl e
WHERE e.role_id = ${/session/@role_id}) not in
('0018', '0019'))
and t.contract_id = ${@contract_id}
and t.lease_type = '02'
order by t.print_date desc
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<bm:operations> <bm:operations>
<bm:operation name="query"> <bm:operation name="query">
<bm:query-sql><![CDATA[ <bm:query-sql><![CDATA[
select s.signature_code, select s.signature_code,
s.code, s.code,
s.seal_code, s.seal_code,
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<bm:operations> <bm:operations>
<bm:operation name="query"> <bm:operation name="query">
<bm:query-sql><![CDATA[ <bm:query-sql><![CDATA[
select sys_parameter_pkg.value(p_parameter_code => 'JG_SERVER_URL') server_url, select sys_parameter_pkg.value(p_parameter_code => 'JG_SERVER_URL') server_url,
sys_parameter_pkg.value(p_parameter_code => 'JG_APP_ID') app_id, sys_parameter_pkg.value(p_parameter_code => 'JG_APP_ID') app_id,
sys_parameter_pkg.value(p_parameter_code => 'JG_APP_SECURITY') app_security sys_parameter_pkg.value(p_parameter_code => 'JG_APP_SECURITY') app_security
......
function set_parameter_file_path(name) { function set_parameter_file_path(name) {
$ctx.parameter.file_path = '/u01/hls_file/excel/'; $ctx.parameter.file_path = '/u01/hls_file/excel/';
} };
function set_pdf_parameter_file_path(name) {
$ctx.parameter.file_path = 'D:/u01/hls_file/excel/';
};
...@@ -23,3 +23,6 @@ function set_parameter_file_path(name) { ...@@ -23,3 +23,6 @@ function set_parameter_file_path(name) {
$ctx.parameter.file_path = 'D:/u01/hls_file/excel/'; $ctx.parameter.file_path = 'D:/u01/hls_file/excel/';
$ctx.parameter.pdf_path = 'D:/u01/hls_file/content_pdf/'; $ctx.parameter.pdf_path = 'D:/u01/hls_file/content_pdf/';
}; };
function set_pdf_parameter_file_path(name) {
$ctx.parameter.file_path = 'D:/u01/hls_file/excel/';
};
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
p_file_size :file_size, p_file_size :file_size,
p_user_id :$ctx.session.user_id, p_user_id :$ctx.session.user_id,
p_contract_id :$ctx.parameter.contract_id, p_contract_id :$ctx.parameter.contract_id,
p_file_type :'EXCEL' p_file_type :'EXCEL',
p_lease_type :'01'
}); });
} }
}catch(e){ }catch(e){
......
...@@ -5,10 +5,17 @@ ...@@ -5,10 +5,17 @@
<s:server-script ><![CDATA[ <s:server-script ><![CDATA[
importPackage(Packages.java.util); importPackage(Packages.java.util);
importPackage(Packages.java.lang); importPackage(Packages.java.lang);
importPackage(Packages.com.hand.kinggrid);
importPackage(Packages.com.hand.hl); importPackage(Packages.com.hand.hl);
importPackage(Packages.leaf.plugin.word2pdf); importPackage(Packages.leaf.plugin.word2pdf);
importPackage(Packages.java.io); importPackage(Packages.java.io);
importPackage(java.io); importPackage(java.io);
//获取日期目录
var datePath = getDate();
var tranfer_dir= new File(String(datePath));
if(!tranfer_dir.exists()){//如果文件夹不存在,创建文件夹
tranfer_dir.mkdirs();//创建文件夹
}
try{ try{
var sys_url_bm=$bm('cont.CON4000.get_sys_url'); var sys_url_bm=$bm('cont.CON4000.get_sys_url');
var parameter_code='HLS_SYSTEM_URL'; var parameter_code='HLS_SYSTEM_URL';
...@@ -28,8 +35,14 @@ ...@@ -28,8 +35,14 @@
h = h < 10 ? "0" + h : h; h = h < 10 ? "0" + h : h;
mi = now.getMinutes(); mi = now.getMinutes();
mi = mi < 10 ? "0" + mi : mi; mi = mi < 10 ? "0" + mi : mi;
var sys_file_path_bm=$bm('cont.CON4000.get_sys_url');
var parameter_code='TEMPORARY_FILES';
var SysurlQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var f_fileDir = $ctx.parameter.file_path; var sys_file_path = SysurlQuery.getChildren()[0].parameter_value;
var f_fileDir = sys_file_path;
var filePath = (f_fileDir + y + "\/" + m + "\/").toString(); var filePath = (f_fileDir + y + "\/" + m + "\/").toString();
//var filePath = (f_fileDir + y + "//" + m + "//").toString(); //var filePath = (f_fileDir + y + "//" + m + "//").toString();
var tranfer_dir= new File(String(filePath)); var tranfer_dir= new File(String(filePath));
...@@ -51,14 +64,18 @@ ...@@ -51,14 +64,18 @@
file_size=get_file_length(outputfilepath); file_size=get_file_length(outputfilepath);
pdf_path =(pdf_file_path).toString() pdf_path =(pdf_file_path).toString()
println('p_file_name = '+ $ctx.parameter.file_name + y + m + d + h + mi + ".pdf"); println('p_file_name = '+ $ctx.parameter.file_name + y + m + d + h + mi + ".pdf");
println('contract_id = ' + $ctx.parameter.contract_id);
word_to_pdf_sign($ctx.parameter.contract_id,pdf_file_path,$ctx.parameter.file_name);
if(result_flag=true){ if(result_flag=true){
var business_daily_email=$bm('cont.CON301N.insert_into_attachment_bmp').update({ var business_daily_email=$bm('cont.CON301N.insert_into_attachment_bmp').update({
p_file_path :(pdf_file_path).toString(), p_file_path :(datePath + $ctx.parameter.file_name + y + m + d + h + mi + ".pdf").toString(),
p_file_name :($ctx.parameter.file_name + y + m + d + h + mi + ".pdf").toString(), p_file_name :($ctx.parameter.file_name + y + m + d + h + mi + ".pdf").toString(),
p_file_size :file_size, p_file_size :file_size,
p_user_id :$ctx.session.user_id, p_user_id :$ctx.session.user_id,
p_contract_id :$ctx.parameter.contract_id, p_contract_id :$ctx.parameter.contract_id,
p_file_type :'PDF' p_file_type :'PDF',
p_lease_type :'01'
}); });
} }
...@@ -87,6 +104,70 @@ ...@@ -87,6 +104,70 @@
//deleteFile(word_file_path); //deleteFile(word_file_path);
return pdf_file_path_new; return pdf_file_path_new;
} }
function getDate() {
var file_path = $ctx.parameter.file_path;
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
m = m < 10 ? "0" + m : m
var path = file_path + y + "/" + m + "/";
return path;
}
function word_to_pdf_sign(content_id,pdf_file_path,file_name) {
importPackage(Packages.com.hl.signatures);
importPackage(Packages.java.io);
importPackage(Packages.java.util);
var org_flag = '';
var qf_flag = '';
var param = new ArrayList();
var paramdetail;
var attachment_update = $bm('cont.CON620.con_contract_save_pdf_atm');
var file_name = file_name;
var file_path = pdf_file_path;
if (file_name.substring(file_name.length - 4) == '.doc') {
file_name = file_name.substring(0, file_name.length - 4);
} else if (file_name.substring(file_name.length - 5) == '.docx') {
file_name = file_name.substring(0, file_name.length - 5);
}
var outputfilepath = pdf_file_path;// 由于wordToPdf转换后pdf文件已经带有.pdf
var wordToPdf = new WordToPdf($instance('uncertain.ocm.IObjectRegistry'), "jacob-1.19-x64.dll");
//wordToPdf.word2pdf(file_path, outputfilepath);
var con_signature_info = $bm('cont.CON620.get_con_signature_info').queryAsMap();
var con_signature_data = con_signature_info.getChildren();
var con_signature_record;
for (var i = 0;i < con_signature_data.length;i++) {
con_signature_record = con_signature_data[i];
println(con_signature_record.signature_code);
if (con_signature_record.signature_code == 'gz_flag'){
paramdetail = '[{ "code":"' + con_signature_record.code +
'", "seal_code":"' + con_signature_record.seal_code +
'", "seal_width":' + con_signature_record.seal_width +
', "fontname":"' + con_signature_record.fontname +
'", "fontsize":"' + con_signature_record.fontsize +
'", "fontcolor":"' + con_signature_record.fontcolor +
'", "pageno":"' + con_signature_record.pageno +
'", "text":"' + con_signature_record.word_code + '"}]';
}
param.add(paramdetail);
}
var con_signature_info = $bm('cont.CON620.get_kinggrid_info').queryAsMap();
var con_kinggrid_data = con_signature_info.getChildren()[0];
var server_url = con_kinggrid_data.server_url;
var app_id = con_kinggrid_data.app_id;
var app_security = con_kinggrid_data.app_security;
var status = new com.hand.kinggrid.ContractSignaturesNew.hl_contract_signatures(outputfilepath, 1,param.toArray(),server_url,app_id,app_security,datePath);
<!-- attachment_update.update({-->
<!-- content_id: content_id,-->
<!-- table_name: 'HLS_DOC_FILE_CONTENT'-->
<!-- });-->
}
]]></s:server-script> ]]></s:server-script>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
trace="true"> trace="true">
<a:init-procedure> <a:init-procedure>
<s:server-script import="con_print_path.js"><![CDATA[ <s:server-script import="con_print_path.js"><![CDATA[
set_parameter_file_path(); set_pdf_parameter_file_path();
]]></s:server-script> ]]></s:server-script>
<a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/> <a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
</a:init-procedure> </a:init-procedure>
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
url="${/request/@context_path}/modules/cont/CON505/con_contract_content_asset_detail.lview"/> url="${/request/@context_path}/modules/cont/CON505/con_contract_content_asset_detail.lview"/>
<a:link id="con_doc_batch_create_link_id" <a:link id="con_doc_batch_create_link_id"
url="${/request/@context_path}/modules/cont/CON500/con_doc_batch_create.lsc"/> url="${/request/@context_path}/modules/cont/CON500/con_doc_batch_create.lsc"/>
<a:link id="con301n_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/> <!-- <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" <a:link id="con301n_print_excel_link"
url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_atm.lsc"/> url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_atm.lsc"/>
<a:link id="con301n_print_pdf_link" <a:link id="con301n_print_pdf_link"
...@@ -36,12 +37,6 @@ ...@@ -36,12 +37,6 @@
function con_print_excel_create() { function con_print_excel_create() {
Leaf.Masker.mask(Ext.getBody(), '请稍等......'); Leaf.Masker.mask(Ext.getBody(), '请稍等......');
// var file_name = '对账单(' +'${/parameter/@tenant_name}'+'+'+'${/parameter/@contract_number}'+').doc';
// var file_dir = '$ctx.parameter.file_path';
// var contract_id = '${/parameter/@contract_id}';
// var url;
// url ='${/request/@context_path}/con/contract/conExportExcel?contractId=' + contract_id;
// window.open(href = url);
var contract_id = '${/parameter/@contract_id}'; var contract_id = '${/parameter/@contract_id}';
var contract_number = '${/parameter/@contract_number}'; var contract_number = '${/parameter/@contract_number}';
var tenant_name = '${/parameter/@tenant_name}'; var tenant_name = '${/parameter/@tenant_name}';
...@@ -115,15 +110,19 @@ ...@@ -115,15 +110,19 @@
function detail_download_window(record_id) { function detail_download_window(record_id) {
var url = $('con301n_downloadFile_id').getUrl() + '?table_name=CUX_CONTRACT_PRINT&header_id=' + record_id; var url = $('con301n_downloadFile_id').getUrl() + '?table_name=CUX_CONTRACT_PRINT&header_id=' + record_id;
var win = new Leaf.Window({ // var win = new Leaf.Window({
url: url, // url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}', // title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'con301n_records_uploadFile_id', // id: 'con301n_records_uploadFile_id',
width: 850, // width: 850,
height: 400 // height: 400
}); // });
win.on('close', function() { // win.on('close', function() {
}); // });
var url = $('con301n_downloadFile_id').getUrl() + '?record_id=' + record_id + '&table_name=CUX_CONTRACT_PRINT';
window.open(url, '_self');
} }
]]></script> ]]></script>
...@@ -163,6 +162,7 @@ ...@@ -163,6 +162,7 @@
</a:toolBar> </a:toolBar>
<a:columns> <a:columns>
<a:column name="file_name" prompt="文本名称" width="260"/> <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="print_date" prompt="生成日期" width="180"/>
<a:column name="download" align="center" prompt="下载" renderer="attachment_download" width="50"/> <a:column name="download" align="center" prompt="下载" renderer="attachment_download" width="50"/>
</a:columns> </a:columns>
...@@ -170,11 +170,11 @@ ...@@ -170,11 +170,11 @@
</a:screenBody> </a:screenBody>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
Leaf.onReady(function() { Leaf.onReady(function() {
if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") { if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") {
document.getElementById("con_print_signatures_id").style.display = ""; document.getElementById("con_print_signatures_id").style.display = "";
} else { } else {
document.getElementById("con_print_signatures_id").style.display = "none"; document.getElementById("con_print_signatures_id").style.display = "none";
} }
}); });
]]></script> ]]></script>
</a:view> </a:view>
......
...@@ -306,12 +306,6 @@ ...@@ -306,12 +306,6 @@
//对账单打印加盖公章 //对账单打印加盖公章
window['${/parameter/@layout_code}_user_button5_layout_dynamic_click'] = function () { window['${/parameter/@layout_code}_user_button5_layout_dynamic_click'] = function () {
debugger;
// var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
// var record = $(ds_id).getSelected()[0];
// var url;
// url ='${/request/@context_path}/con/contract/conExportExcel?contractId=' + record.get('contract_id');
// window.open(href = url);
var ds = $('CONTRACT_QUERY_ENTRANCE_G_CONTRACT_RESULT_con_contract_ds'); var ds = $('CONTRACT_QUERY_ENTRANCE_G_CONTRACT_RESULT_con_contract_ds');
var records = ds.getSelected(); var records = ds.getSelected();
if (records.length != 1) { if (records.length != 1) {
......
<?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-update model="hls.HLS811.hls_doc_file_templet_get_atm"/>
<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);
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();
}
$ctx["__request_type__"] = 'file'; //to indicate this request is not a JSON_REQUEST
var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
resp.setHeader("Pragma", "No-cache");
resp.setHeader("Cache-Control", "no-cache, must-revalidate");
resp.setDateHeader("Expires", 0);
resp.setContentType("application/x-msdownload");
try {
var sys_url_bm=$bm('cont.CON301N.get_file_address');
var FileQuery = sys_url_bm.queryAsMap({
record_id: $ctx.parameter.record_id
});
var arr = FileQuery.getChildren();
var file_name = arr[0].file_name;
var file_path = arr[0].file_path;
println('file_name = '+ file_name);
println('file_path = '+ file_path);
resp.setHeader("Content-disposition", "attachment; filename=" + encodeURI(file_name, 'UTF-8'));
var os = resp.getOutputStream();
//transfer(file_path, os);
write_os_to_file(file_path, os);
os.flush();
} catch (e) {
println(e);
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</a:service>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: ZLF
$Date: 2014-11-20 下午8:50:38
$Revision: 1.0
$Purpose:
-->
<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.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 = '${/parameter/@bp_name}';
var contract_number = '${/parameter/@contract_number}';
var contract_name = '${/parameter/@contract_name}';
var file_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
},
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() {
Leaf.Masker.mask(Ext.getBody(), '请稍等......');
var contract_id = '${/parameter/@contract_id}';
var templet_code = '${/parameter/@templet_code}';
var bp_name = '${/parameter/@bp_name}';
var contract_number = '${/parameter/@contract_number}';
var contract_name = '${/parameter/@contract_name}';
var file_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
},
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: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}">
<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="700">
<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: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>
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
<a:link id="con_collection_message_create_link_id" model="cont.CON620.con_collection_message_create" modelaction="update"/> <a:link id="con_collection_message_create_link_id" model="cont.CON620.con_collection_message_create" modelaction="update"/>
<a:link id="con_lease_org_print_signatures_link" <a:link id="con_lease_org_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"/>
<a:link id="cashflow_print_signatures_link_id"
url="${/request/@context_path}/modules/cont/CON620/con_cashflow_print_signatures.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);
...@@ -69,13 +71,13 @@ ...@@ -69,13 +71,13 @@
}); });
} }
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () { // window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
var contract_id = '${/parameter/@document_id}'; // var contract_id = '${/parameter/@document_id}';
var templet_code = 'CON_LEASE_ORG'; // var templet_code = 'CON_LEASE_ORG';
var url=$('con_lease_org_print_link').getUrl() + '?contract_id=' + contract_id + '&templet_code=' + templet_code; // var url=$('con_lease_org_print_link').getUrl() + '?contract_id=' + contract_id + '&templet_code=' + templet_code;
window.open(url, '_self'); // window.open(url, '_self');
create_message(contract_id,templet_code); // create_message(contract_id,templet_code);
}; // };
window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function () { window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function () {
var contract_id = '${/parameter/@document_id}'; var contract_id = '${/parameter/@document_id}';
var templet_code = 'CON_LEASE_CONFIRM'; var templet_code = 'CON_LEASE_CONFIRM';
...@@ -209,23 +211,42 @@ ...@@ -209,23 +211,42 @@
if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") { if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") {
document.getElementById("CON_DUE_DETAIL_user_button4").style.display = ""; document.getElementById("CON_DUE_DETAIL_user_button4").style.display = "";
document.getElementById("CON_DUE_DETAIL_user_button3").style.display = ""; document.getElementById("CON_DUE_DETAIL_user_button3").style.display = "";
document.getElementById("CON_DUE_DETAIL_user_button5").style.display = "";
} else { } else {
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_button3").style.display = "none"; document.getElementById("CON_DUE_DETAIL_user_button3").style.display = "none";
document.getElementById("CON_DUE_DETAIL_user_button5").style.display = "none";
} }
} }
}); });
//新增催款函pdf打印(盖章) //新增催款函pdf打印(盖章)
window['${/parameter/@layout_code}_user_button5_layout_dynamic_click'] = function () { window['${/parameter/@layout_code}_user_button5_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 contract_id = '${/parameter/@document_id}';
var templet_code = 'CON_LEASE_ORG'; var templet_code = 'CON_LEASE_ORG';
var url=$('con_lease_org_print_signatures_link').getUrl() + '?contract_id=' + contract_id + '&templet_code=' + templet_code; var win = new Leaf.Window({
window.open(url, '_self'); id: 'cashflow_print_signatures',
create_message(contract_id,templet_code); url: $('cashflow_print_signatures_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_signatures_winid'
},
title: '催款函打印',
height: 500,
width: 800
});
}; };
]]></script> ]]></script>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
importPackage(java.io); importPackage(java.io);
importPackage(Packages.hls.plugin.docx4j) importPackage(Packages.hls.plugin.docx4j)
importPackage(Packages.org.apache.commons.io); importPackage(Packages.org.apache.commons.io);
importPackage(Packages.com.hand.hl);
function RandomString(length) { function RandomString(length) {
var str = ''; var str = '';
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
//按日期创建目录 //按日期创建目录
function getDatePath() { function getDatePath() {
set_parameter_file_path(); set_pdf_parameter_file_path();
var file_path = $ctx.parameter.file_path; //file_path = c:/hls_test_files/content_files/ var file_path = $ctx.parameter.file_path; //file_path = c:/hls_test_files/content_files/
var now = new Date() var now = new Date()
y = now.getFullYear() y = now.getFullYear()
...@@ -47,6 +47,16 @@ ...@@ -47,6 +47,16 @@
return datePath; //datePath = d:/hls_test_files/fileupload/2018/04/ 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) { function write_os_to_file(file, os) {
var fis = new FileInputStream(file); var fis = new FileInputStream(file);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64); var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
...@@ -110,15 +120,25 @@ ...@@ -110,15 +120,25 @@
} catch (e) { } catch (e) {
raise_app_error(e); raise_app_error(e);
} }
$bm('cont.CON500.con_file_content_copy_update').update({ <!-- $bm('cont.CON500.con_file_content_copy_update').update({-->
table_name: 'CON_CONTRACT_CONTENT', <!-- table_name: 'CON_CONTRACT_CONTENT',-->
content_id: record_data.content_id, <!-- content_id: record_data.content_id,-->
file_name: to_file_name.toString(), <!-- file_name: to_file_name.toString(),-->
file_path: to_file_path.toString() <!-- file_path: to_file_path.toString()-->
}); <!-- });-->
var test=new File(to_file_path); var test=new File(to_file_path);
var test1=new File('D:'+to_file_path); var test1=new File('D:'+to_file_path);
download_file(to_file_path.toString(),to_file_name.toString()); <!-- download_file(to_file_path.toString(),to_file_name.toString());-->
var file_size=get_file_length(to_file_path);
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 :'02'
});
} }
} }
......
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