Commit 2f71211b authored by stone's avatar stone

【fix】合同文本打印修改

parent 71675f61
...@@ -37,6 +37,33 @@ ...@@ -37,6 +37,33 @@
//删除word文件 //删除word文件
// deleteFile(word_file_path); // 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;
}
//生成pdf
function AsposeWordToPDF(word_file_path,pdf_file_path) {
// word转pdf
var pdf_file_path_new = pdf_file_path + '.pdf';
var wordToPdf = new AsposeUtil();
wordToPdf.trans(word_file_path, pdf_file_path_new,"word");
//删除word文件
deleteFile(word_file_path);
return pdf_file_path_new; return pdf_file_path_new;
} }
...@@ -74,7 +101,7 @@ ...@@ -74,7 +101,7 @@
var from_file_path = record_data.file_path; 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_path = $bm('cont.CON500.con_contract_get_guid_file_name').queryAsMap();
var guid_file_name_tables = guid_file_name_path.getChildren(); 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; 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); copyFile(from_file_path, to_file_path);
...@@ -85,12 +112,13 @@ ...@@ -85,12 +112,13 @@
} catch (e) { } catch (e) {
raise_app_error(e); raise_app_error(e);
} }
if (record_data.templet_code == 'FINANCE_LEASE_CONTRACT'||record_data.templet_code == 'BUSINESS_CONTRACT'||record_data.templet_code == 'BUSINESS_CONTRACT_XJ'||record_data.templet_code=='LEASE_EXCHANGE'||record_data.templet_code=='LEASE_EXCHANGE_GN'||record_data.templet_code=='FINANCE_LEASE_CONTRACT_EX') {
// word转pdf // word转pdf
var pdf_file_path=datePath+guid_file_name_tables[0].guid_file_name + 'con' + record_data.content_id; 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 outputfilepath = wordToPdf(to_file_path,pdf_file_path);
var outputfilename= record_data.to_file_name +'.pdf'; var outputfilename= record_data.to_file_name +'.pdf';
var pdf_file = new File(outputfilepath); var pdf_file = new File(outputfilepath);
println(outputfilepath);
var file_size = 0; var file_size = 0;
if (pdf_file.exists()) { if (pdf_file.exists()) {
file_size = pdf_file.length(); file_size = pdf_file.length();
...@@ -106,6 +134,19 @@ ...@@ -106,6 +134,19 @@
mime_type: 'application/pdf', mime_type: 'application/pdf',
user_id: $ctx.parameter.user_id user_id: $ctx.parameter.user_id
}); });
}
else{
$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()
});
}
} }
} }
]]></s:server-script> ]]></s:server-script>
......
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