Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
leaf-hlcm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hlcm
leaf-hlcm
Commits
e00ca296
Commit
e00ca296
authored
Nov 14, 2024
by
18083
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量下载催收函补充缺少文件
(cherry picked from commit
051ce0c1
)
parent
61c1173d
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
291 additions
and
10 deletions
+291
-10
con_contract_rent_dun_query.lview
...app/modules/cont/CON620/con_contract_rent_dun_query.lview
+111
-10
create_content_for_collection_n.lsc
...p/modules/cont/CON620/create_content_for_collection_n.lsc
+180
-0
No files found.
src/main/webapp/modules/cont/CON620/con_contract_rent_dun_query.lview
View file @
e00ca296
This diff is collapsed.
Click to expand it.
src/main/webapp/modules/cont/CON620/create_content_for_collection_n.lsc
0 → 100644
View file @
e00ca296
<?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.CON620.con_doc_file_templet_get_atm_batch').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 :(record_data.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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment