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
607090fa
Commit
607090fa
authored
Nov 14, 2024
by
18083
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量下载催收函
parent
194f0788
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
924 additions
and
27 deletions
+924
-27
insert_into_attachment_bmp.lwm
...B-INF/classes/cont/CON301N/insert_into_attachment_bmp.lwm
+2
-1
con_contract_rent_temp.lwm
...pp/WEB-INF/classes/cont/CON620/con_contract_rent_temp.lwm
+18
-0
con_doc_file_templet_get_atm_batch.lwm
...lasses/cont/CON620/con_doc_file_templet_get_atm_batch.lwm
+86
-0
contract_rent_batch_dl.lwm
...pp/WEB-INF/classes/cont/CON620/contract_rent_batch_dl.lwm
+38
-0
create_contract_rent_batch.lwm
...EB-INF/classes/cont/CON620/create_contract_rent_batch.lwm
+24
-0
con_contract_rent_download.lview
...bapp/modules/cont/CON620/con_contract_rent_download.lview
+123
-0
con_contract_rent_dun_query.lview
...app/modules/cont/CON620/con_contract_rent_dun_query.lview
+70
-10
contract_rent_atm_batch_dl.lsc
...webapp/modules/cont/CON620/contract_rent_atm_batch_dl.lsc
+70
-0
create_content_for_collection_download.lsc
...es/cont/CON620/create_content_for_collection_download.lsc
+207
-0
create_content_for_collection_download_signatures.lsc
...620/create_content_for_collection_download_signatures.lsc
+256
-0
create_content_for_collection_n.lsc
...p/modules/cont/CON620/create_content_for_collection_n.lsc
+9
-9
create_content_for_collection_signatures.lsc
.../cont/CON620/create_content_for_collection_signatures.lsc
+21
-7
No files found.
src/main/webapp/WEB-INF/classes/cont/CON301N/insert_into_attachment_bmp.lwm
View file @
607090fa
...
...
@@ -11,7 +11,8 @@
p_user_id =>${@p_user_id},
p_contract_id =>${@p_contract_id},
p_file_type =>${@p_file_type},
p_lease_type =>${@p_lease_type}
p_lease_type =>${@p_lease_type},
p_session_id =>${/session/@session_id}
);
END;
]]>
</bm:update-sql>
...
...
src/main/webapp/WEB-INF/classes/cont/CON620/con_contract_rent_temp.lwm
0 → 100644
View file @
607090fa
<?xml version="1.0" encoding="UTF-8"?>
<bm:model
xmlns:bm=
"http://www.leaf-framework.org/schema/bm"
>
<bm:operations>
<bm:operation
name=
"execute"
>
<bm:update-sql>
<![CDATA[
begin
con_contract_content_pkg.delect_contract_rent_temp(
p_session_id =>
${/session/@session_id}
);
end;
]]>
</bm:update-sql>
<bm:parameters>
<bm:parameter
inputPath=
"/session/@session_id"
/>
</bm:parameters>
</bm:operation>
</bm:operations>
</bm:model>
src/main/webapp/WEB-INF/classes/cont/CON620/con_doc_file_templet_get_atm_batch.lwm
0 → 100644
View file @
607090fa
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gaoyang
$Date: 2015-6-10 下午03:17:55
$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
faa.file_path,
faa.file_type_code,
(select 'Y' from dual where exists (SELECT
1
FROM
fnd_atm_attachment_multi m1
WHERE
m1.table_name = 'CON_CONTRACT_CONTENT' AND
m1.table_pk_value = cc.content_id)
) file_exists_flag,
cc.content_number
||'-'
||cc.bp_name
||'-'
||
(SELECT
t.project_number
FROM
con_contract ct,
prj_project t
WHERE
t.project_id = ct.project_id AND
ct.contract_id = cc.contract_id
) to_file_name,
lt.pwd,
cc.content_id,
decode(cc.bp_category,
'TENANT',
'催收函-' || (select ct.contract_number
from con_contract ct
where ct.contract_id = cc.contract_id) || '-' ||
(select bp.bp_name
from con_contract_bp bp
where bp.contract_id = cc.contract_id
and bp.bp_category = 'TENANT'),
'催收函-' || (select ct.contract_number
from con_contract ct
where ct.contract_id = cc.contract_id) || '-' ||
(select bp.bp_name
from con_contract_bp bp
where bp.contract_id = cc.contract_id
and bp.bp_category = 'TENANT') || '(担保人-' ||
cc.bp_name || ')') file_name
FROM
fnd_atm_attachment faa,
fnd_atm_attachment_multi m,
hls_doc_file_templet lt,
con_clause_templet t,
con_contract_content_v cc
WHERE
faa.attachment_id = m.attachment_id AND
m.table_name = 'HLS_DOC_FILE_TEMPLET' AND
m.table_pk_value = lt.templet_id AND
lt.templet_id = t.doc_template_id AND
t.templet_code=${@templet_code} and
t.doc_plugin_flag = 'Y' AND
t.templet_id = cc.templet_id AND
(
cc.contract_id =${@contract_id} AND
${/parameter/@batch_flag}='Y'
)
]]>
</bm:query-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field
name=
"file_name"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"FILE_NAME"
/>
<bm:field
name=
"file_path"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"FILE_PATH"
/>
<bm:field
name=
"file_type_code"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"FILE_TYPE_CODE"
/>
<bm:field
name=
"file_exists_flag"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"FILE_EXISTS_FLAG"
/>
<bm:field
name=
"to_file_name"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"TO_FILE_NAME"
/>
<bm:field
name=
"pwd"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"PWD"
/>
<bm:field
name=
"content_id"
databaseType=
"NUMBER"
datatype=
"java.lang.Long"
physicalName=
"CONTENT_ID"
/>
</bm:fields>
</bm:model>
src/main/webapp/WEB-INF/classes/cont/CON620/contract_rent_batch_dl.lwm
0 → 100644
View file @
607090fa
<?xml version="1.0" encoding="UTF-8"?>
<bm:model
xmlns:bm=
"http://www.leaf-framework.org/schema/bm"
>
<bm:operations>
<bm:operation
name=
"query"
>
<bm:query-sql>
<![CDATA[
SELECT m.table_name,
m.table_pk_value,
m.record_id,
fa.attachment_id,
fa.file_name,
fa.file_path
FROM fnd_atm_attachment fa,
fnd_atm_attachment_multi m,
CUX_CONTRACT_PRINT t,
con_contract_rent_temp tp
WHERE m.attachment_id = fa.attachment_id
AND fa.source_type_code = 'fnd_atm_attachment_multi'
AND fa.source_pk_value = m.record_id
AND m.table_name = 'CUX_CONTRACT_PRINT'
AND m.table_pk_value = t.print_id
and t.print_id = tp.print_id
and tp.session_id = ${/session/@session_id}
]]>
</bm:query-sql>
<bm:parameters>
<bm:parameter
name=
"table_pk_value"
/>
<bm:parameter
name=
"table_name"
/>
</bm:parameters>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field
name=
"table_name"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"TABLE_NAME"
required=
"true"
/>
<bm:field
name=
"table_pk_value"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"TABLE_PK_VALUE"
required=
"true"
/>
<bm:field
name=
"record_id"
databaseType=
"NUMBER"
datatype=
"java.lang.Long"
physicalName=
"RECORD_ID"
required=
"true"
/>
<bm:field
name=
"attachment_id"
databaseType=
"NUMBER"
datatype=
"java.lang.Long"
physicalName=
"ATTACHMENT_ID"
required=
"true"
/>
<bm:field
name=
"file_name"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"FILE_NAME"
/>
<bm:field
name=
"file_path"
databaseType=
"VARCHAR2"
datatype=
"java.lang.String"
physicalName=
"FILE_PATH"
/>
</bm:fields>
</bm:model>
src/main/webapp/WEB-INF/classes/cont/CON620/create_contract_rent_batch.lwm
0 → 100644
View file @
607090fa
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2024-10-30 上午09:52:30
$Revision: 1.0
$Purpose:
-->
<bm:model
xmlns:bm=
"http://www.leaf-framework.org/schema/bm"
needAccessControl=
"false"
>
<bm:operations>
<bm:operation
name=
"update"
>
<bm:update-sql>
<![CDATA[
begin
con_contract_content_pkg.contract_rent_batch(
p_contract_id =>
${@contract_id},
p_user_id =>${/session/@user_id},
p_content_type =>${@content_type},
p_templet_code=>${@templet_code},
p_session_id =>${/session/@session_id}
);
end;
]]>
</bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
src/main/webapp/modules/cont/CON620/con_contract_rent_download.lview
0 → 100644
View file @
607090fa
<?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=
"con_rent_temp_link"
url=
"${/request/@context_path}/modules/cont/CON620/con_contract_rent_temp.lsc"
/>
<a:link
id=
"con_rent_download_link"
url=
"${/request/@context_path}/modules/cont/CON620/create_content_for_collection_download.lsc"
/>
<a:link
id=
"con_rent_atm_bacth_link"
url=
"${/request/@context_path}/modules/cont/CON620/contract_rent_atm_batch_dl.lsc"
/>
<a:link
id=
"con_rent_down_signatures_link"
url=
"${/request/@context_path}/modules/cont/CON620/create_content_for_collection_download_signatures.lsc"
/>
<script
type=
"text/javascript"
>
<![CDATA[
//生成催收函word
function con_print_word_create() {
Leaf.Masker.mask(Ext.getBody(), '请稍等......');
var download_type = $('contract_rent_download_ds').getCurrentRecord().get('download_type');
if(Ext.isEmpty(download_type)){
$L.showMessage("提示",'请选择下载类型!');
Leaf.Masker.unmask(Ext.getBody());
return;
}
var result_templet_code ='';
if(download_type=='TEN'){
result_templet_code ='{"CON_LEASE_ORG":"CON_LEASE_ORG"}';
}else if(download_type=='GUA'){
result_templet_code ='{"CON_LEASE_GUA":"CON_LEASE_GUA"}';
}else if(download_type=='ALL'){
result_templet_code = '{"CON_LEASE_ORG":"CON_LEASE_ORG","CON_LEASE_GUA":"CON_LEASE_GUA"}';
}
var result_map ='${/parameter/@result_map}';
Leaf.request({
url: $('con_rent_download_link').getUrl(),
para: {
result_map : result_map,
result_templet_code : result_templet_code
},
success: function(res) {
Leaf.Masker.unmask(Ext.getBody());
var url_l = $('con_rent_atm_bacth_link').getUrl();
window.open(href = url_l, target = "_self");
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
}
});
}
//生成催收函pdf
function con_print_signatures_create() {
Leaf.Masker.mask(Ext.getBody(), '请稍等......');
var download_type = $('contract_rent_download_ds').getCurrentRecord().get('download_type');
if(Ext.isEmpty(download_type)){
$L.showMessage("提示",'请选择下载类型!');
Leaf.Masker.unmask(Ext.getBody());
return;
}
var result_templet_code ='';
if(download_type=='TEN'){
result_templet_code ='{"CON_LEASE_ORG":"CON_LEASE_ORG"}';
}else if(download_type=='GUA'){
result_templet_code ='{"CON_LEASE_GUA":"CON_LEASE_GUA"}';
}else if(download_type=='ALL'){
result_templet_code = '{"CON_LEASE_ORG":"CON_LEASE_ORG","CON_LEASE_GUA":"CON_LEASE_GUA"}';
}
var result_map ='${/parameter/@result_map}';
Leaf.request({
url: $('con_rent_down_signatures_link').getUrl(),
para: {
result_map : result_map,
result_templet_code : result_templet_code
},
success: function(res) {
Leaf.Masker.unmask(Ext.getBody());
var url_l = $('con_rent_atm_bacth_link').getUrl();
window.open(href = url_l, target = "_self");
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
}
});
}
]]>
</script>
<a:dataSets>
<a:dataSet
id=
"DOWNLOAD_TYPE_DS"
lookupCode=
"DOWNLOAD_TYPE"
/>
<a:dataSet
id=
"contract_rent_download_ds"
autoCreate=
"true"
>
<a:fields>
<a:field
name=
"download_type"
/>
<a:field
name=
"download_type_desc"
options=
"DOWNLOAD_TYPE_DS"
returnField=
"download_type"
displayField=
"code_value_name"
valueField=
"code_value"
required=
"true"
/>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<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
>
<a:comboBox
name=
"download_type_desc"
prompt=
"下载类型"
bindTarget=
"contract_rent_download_ds"
/>
</a:form>
</a:screenBody>
</a:view>
</a:screen>
src/main/webapp/modules/cont/CON620/con_contract_rent_dun_query.lview
View file @
607090fa
...
...
@@ -21,13 +21,16 @@
url=
"${/request/@context_path}/modules/cont/CON620/con_contract_account_detail.lview"
/>
<a:link
id=
"con_contract_query_link_id"
url=
"${/request/@context_path}/modules/cont/CON3200/con_re_incept_modify.lview"
/>
<a:link
id=
"con_contract_op_query_link_id"
<a:link
id=
"con_contract_op_query_link_id"
url=
"${/request/@context_path}/modules/cont/CON3200/con_re_incept_op_modify.lview"
/>
<a:link
id=
"con601_send_dun_msg"
model=
"cont.CON620.con620_send_dun_msg"
modelaction=
"execute"
/>
<a:link
id=
"contract_rent_download_link_id"
url=
"${/request/@context_path}/modules/cont/CON620/con_contract_rent_download.lview"
/>
<script
type=
"text/javascript"
>
<![CDATA[
function CON601_con_contract_query() {
$('CON620_contract_result_ds').query();
$('CON620_contract_repur_result_ds').query();
}
function CON601_con_contract_reset() {
...
...
@@ -245,7 +248,7 @@
hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_query_link_id');
}
//经租合同明细
//经租合同明细
function contract_op_detail_link(record_id, ds_id) {
var current_record = $(ds_id).findById(record_id);
var record = current_record;
...
...
@@ -330,8 +333,8 @@
Leaf.onReady(function () {
if ("${/model/role_info/record/@role_code}" == "0018" || "${/model/role_info/record/@role_code}" == "0019") {
document.getElementById('msg_money_id').style.display = "none";
document.getElementById('msg_no_money_id').style.display = "none";
document.getElementById('msg_money_id').style.display = "none";
document.getElementById('msg_no_money_id').style.display = "none";
$('CON601_con_contract_grid_ds').hideColumn('account_due_times');
$('CON601_con_contract_grid_ds').hideColumn('account_due_days');
$('CON601_con_contract_grid_ds').hideColumn('account_due_amount');
...
...
@@ -379,6 +382,7 @@
function CON601_dun_msg_money() {
var records = $('CON620_contract_result_ds').getSelected();
var records_repur = $('CON620_contract_repur_result_ds').getSelected();
if (records_repur.length > 0) {
$L.showInfoMessage('提示', '解约回购合同不在催收短信发送范围!');
return;
...
...
@@ -393,7 +397,7 @@
var no_send_message = '';
//判断单据的状态
for (var i = 0; i
< records.length
;
i++)
{
if(records[i].get('division')
==
'95'){
if(records[i].get('division')
==
'95'){
$L.showInfoMessage('提示','经营性租赁业务不支持发送催收短信!');
return;
}
...
...
@@ -476,7 +480,7 @@
var no_send_message = '';
for (var i = 0; i
< records.length
;
i++)
{
if(records[i].get('division')
==
'95'){
if(records[i].get('division')
==
'95'){
$L.showInfoMessage('提示','经营性租赁业务不支持发送催收短信!');
return;
}
...
...
@@ -551,6 +555,60 @@
}
}
function
MapTOJson(m)
{
var
str =
'{'
;
var
i =
1;
m.forEach(function
(item,
key,
mapObj)
{
if
(
mapObj.size =
=
i)
{
str
+=
'"'
+
key
+
'":"'
+
item
+
'"';
}
else
{
str
+=
'"'
+
key
+
'":"'
+
item
+
'",';
}
i++;
});
str
+=
'}';
return
str;
}
//批量下载催收函
function
CON601_con_contract_download(){
var
records =
$('CON620_contract_result_ds').getSelected();
var
records_repur =
$('CON620_contract_repur_result_ds').getSelected();
if
(records_repur.length
>
0) {
$L.showInfoMessage('提示', '解约回购合同不在批量下载范围!');
return;
}
if (records.length == 0) {
$L.showInfoMessage('提示', '请选择需下载催收函对应的合同!');
return;
}
if (records.length > 10) {
$L.showInfoMessage('提示', '批量下载催收函最多可勾选10个合同,请重新选择!');
return;
}
var r_map = new Map();
for (var i = 0; i
< records.length
;
i++)
{
if(!r_map.has(records[i].get('contract_id'))){
var
arr =
new
Array();
arr.add(records[i].get('contract_id'));
r_map.set(records[i].get('contract_id'),arr);
}
}
var
result_map =
MapTOJson(r_map);
var
win =
new
Leaf.Window({
id:
'contract_rent_download',
url:
$('contract_rent_download_link_id').getUrl(),
params:
{
result_map
:
result_map,
winid
:
'contract_rent_download_winid'
},
title:
'催款函批量打印',
height:
150,
width:
360
});
}
]]
></script>
...
...
@@ -561,7 +619,7 @@
<a:datas>
<a:record
code_value=
"LEASE"
code_value_name=
"直租"
/>
<a:record
code_value=
"LEASEBACK"
code_value_name=
"售后回租"
/>
<a:record
code_value=
"LEASEOPERAT"
code_value_name=
"经营性租赁"
/>
<a:record
code_value=
"LEASEOPERAT"
code_value_name=
"经营性租赁"
/>
</a:datas>
</a:dataSet>
<a:dataSet
id=
"repurchase_types_ds"
lookupCode=
"REPURCHASE_TYPES"
/>
...
...
@@ -622,6 +680,7 @@
queryUrl=
"${/request/@context_path}/autocrud/cont.CON620.con_contract_dun_for_repur_query/query"
selectable=
"true"
selectionModel=
"multiple"
>
</a:dataSet>
<!--<a:dataSet id="bgt_contract_payment_detail_line_ds" fetchAll="true" model="cont.CON620.bgt_contract_payment_detail_line"/>-->
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
...
...
@@ -630,7 +689,8 @@
<a:gridButton
click=
"CON601_con_contract_query"
text=
"HLS.QUERY"
/>
<a:gridButton
id=
"msg_money_id"
click=
"CON601_dun_msg_money"
text=
"催收短信发送(含金额)"
/>
<a:gridButton
id=
"msg_no_money_id"
click=
"CON601_dun_msg_no_money"
text=
"催收短信发送(无金额)"
/>
<!--<a:gridButton id="CON601_con_contract_print_btn" click="CON601_con_contract_print" text="打印催收函"/>-->
<a:gridButton
id=
"CON601_con_contract_download_btn"
click=
"CON601_con_contract_download"
text=
"下载催收函"
/>
<!--<a:gridButton id="CON601_con_contract_print_btn" click="CON601_con_contract_print" text="打印催收函"/>-->
</a:screenTopToolbar>
<a:queryForm
title=
"CON301.CONTRACT_QUERY"
style=
"background-color: white;"
id=
"condition_queryForm"
...
...
@@ -770,7 +830,7 @@
<a:column
name=
"lease_times"
align=
"center"
prompt=
"期数"
width=
"100"
/>
<a:column
name=
"total_due_amount"
align=
"right"
prompt=
"租金合计"
width=
"100"
renderer=
"Leaf.formatMoney"
/>
<a:column
name=
"lease_item_amount"
align=
"right"
prompt=
"设备价格"
width=
"100"
<a:column
name=
"lease_item_amount"
align=
"right"
prompt=
"设备价格"
width=
"100"
renderer=
"Leaf.formatMoney"
/>
<a:column
name=
"contract_amount"
align=
"right"
prompt=
"合同金额"
width=
"100"
renderer=
"Leaf.formatMoney"
/>
...
...
@@ -794,7 +854,7 @@
<a:column
name=
"bp_id_tenant_desc"
lock=
"true"
prompt=
"承租人名称"
showTitle=
"true"
width=
"100"
align=
"center"
/>
<a:column
name=
"repurchase_types_n"
align=
"center"
prompt=
"回购类型"
width=
"100"
/>
<a:column
name=
"repurchase_types_n"
align=
"center"
prompt=
"回购类型"
width=
"100"
/>
<a:column
name=
"min_overdue_date"
align=
"center"
prompt=
"预定支付日"
width=
"100"
renderer=
"render_formatDate"
/>
<a:column
name=
"min_overdue_times"
align=
"center"
prompt=
"预定支付期数"
width=
"100"
/>
...
...
src/main/webapp/modules/cont/CON620/contract_rent_atm_batch_dl.lsc
0 → 100644
View file @
607090fa
<?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>
<![CDATA[
importPackage(java.util.zip);
importPackage(java.io);
function getdate() {
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
d = now.getDate()
m = m < 10 ? "0" + m : m
d = d < 10 ? "0" + d : d
return y + "" + m + "" + d
}
function writeFile(zos, fn, fp) {
var ze = new ZipEntry(fn);
//zos.setEncoding("UTF-8");//如果是org.apache.tools.zip需要追加字符集
zos.putNextEntry(ze);
var fis = new FileInputStream(fp);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
zos.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");
var date = new Date();
var date_str = getdate();
var doc_code = '催收函';
var filename = doc_code + '-' + date_str + ".zip"
resp.setHeader("Content-disposition", "attachment; filename=" + encodeURI(filename, 'utf-8'));
resp.setDateHeader("Expires", 0);
resp.setContentType("application/x-msdownload");
var zos = new ZipOutputStream(resp.getOutputStream());
try {
var attachment_batch_dl = $bm('cont.CON620.contract_rent_batch_dl');
var result = attachment_batch_dl.queryAsMap();
var arr = result.getChildren();
var file_exist_list = {};
for (var i = 0;i < arr.length;i++) {
var f = arr[i];
if (f.file_path && !file_exist_list[f.file_name]) {
writeFile(zos, f.file_name, f.file_path);
file_exist_list[f.file_name] = 1;
} else {
file_exist_list[f.file_name] = file_exist_list[f.file_name] * 1 + 1;
var last_index = f.file_name.lastIndexOf(".");
var temp_exists_file_name = f.file_name.substr(0, last_index);
var temp_exists_file_type = f.file_name.substr(last_index, f.file_name.length);
temp_exists_file_name = temp_exists_file_name + '-' + file_exist_list[f.file_name] + temp_exists_file_type;
writeFile(zos, temp_exists_file_name, f.file_path);
}
}
} catch (e) {
var logger = $logger("server-script");
logger.severe(e.message)
}
zos.close();
]]>
</s:server-script>
</a:init-procedure>
</a:service>
src/main/webapp/modules/cont/CON620/create_content_for_collection_download.lsc
0 → 100644
View file @
607090fa
<?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);
importPackage(java.util.zip);
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 getdate() {
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
d = now.getDate()
m = m < 10 ? "0" + m : m
d = d < 10 ? "0" + d : d
return y + "" + m + "" + d
}
//按日期创建目录
function getDatePath() {
set_pdf_parameter_file_path();
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 datePath = file_path + y + "/" + m + "/";
return datePath;
}
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 writeFile(zos, fn, fp) {
var ze = new ZipEntry(fn);
//zos.setEncoding("UTF-8");//如果是org.apache.tools.zip需要追加字符集
zos.putNextEntry(ze);
var fis = new FileInputStream(fp);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
zos.write(b, 0, len);
}
fis.close();
}
try {
var resultStr = $ctx.parameter.result_map;
var result_templet_code = $ctx.parameter.result_templet_code;
var jm = JSON.parse(resultStr);
var te = JSON.parse(result_templet_code);
//清除批次表数据
$bm('cont.CON620.con_contract_rent_temp').execute();
for(var key in jm){
var hds = jm[key];
//转为数组
var hdsArr = hds.split(',');
//循环合同
for(var m =0; m< hdsArr.length; m++){
var contract_id = hdsArr[m];
//循环模板
for(var key in te){
var template = te[key];
//转为数组
var templateArr = template.split(',');
for(var j =0; j< templateArr.length; j++){
var templet_code = templateArr[j];
//第一步生成合同文本
if(templet_code=='CON_LEASE_ORG'){
content_type ='FIN';
}else{
content_type ='GUA';
}
$bm('cont.CON620.create_contract_rent_batch').update({
contract_id: contract_id,
content_type: content_type,
templet_code: templet_code
});
//获取日期目录
set_parameter_file_path();
var datePath = getDatePath();
$ctx.parameter.batch_flag='Y';
$ctx.parameter.contract_id=contract_id;
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
var from_file_data_map = $bm('cont.CON620.con_doc_file_templet_get_atm_batch').queryAsMap({
contract_id: contract_id,
batch_flag:$ctx.parameter.batch_flag,
templet_code: 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);
}
var test=new File(to_file_path);
var test1=new File('D:'+to_file_path);
var file_size=get_file_length(to_file_path);
if(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 :contract_id,
p_file_type :'WORD',
p_lease_type :lease_type
});
}
}
}
}
}
}
} catch (e) {
raise_app_error(e);
}
]]>
</s:server-script>
</a:init-procedure>
</a:service>
src/main/webapp/modules/cont/CON620/create_content_for_collection_download_signatures.lsc
0 → 100644
View file @
607090fa
This diff is collapsed.
Click to expand it.
src/main/webapp/modules/cont/CON620/create_content_for_collection_n.lsc
View file @
607090fa
...
...
@@ -105,7 +105,7 @@ function collection_create_content() {
var datePath = getDatePath();
$ctx.parameter.batch_flag='Y';
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
var from_file_data_map = $bm('cont.CON
500.con_doc_file_templet_get_atm_new
').queryAsMap({
var from_file_data_map = $bm('cont.CON
620.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
...
...
@@ -143,14 +143,14 @@ function collection_create_content() {
}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
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
});
}
}
...
...
src/main/webapp/modules/cont/CON620/create_content_for_collection_signatures.lsc
View file @
607090fa
...
...
@@ -27,16 +27,24 @@
}
//第一步生成合同文本
$bm('cont.CON620.create_content_for_collection').update({
contract_id: $ctx.parameter.contract_id,
templet_code: $ctx.parameter.templet_code
});
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
});
}
//获取日期目录
var datePath = getDate();
$ctx.parameter.batch_flag='Y';
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
var from_file_data_map = $bm('cont.CON
500.con_doc_file_templet_get_atm_new
').queryAsMap({
var from_file_data_map = $bm('cont.CON
620.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
...
...
@@ -86,14 +94,20 @@
var file_size=get_file_length(datePath+ guid_file_name_tables[0].guid_file_name + 'con' + record_data.content_id + '.pdf' );
var download_file = datePath + guid_file_name_tables[0].guid_file_name + 'con' + record_data.content_id + ".pdf";
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 :(download_file).toString(),
p_file_name :(
$ctx.parameter
.file_name+'.pdf').toString(),
p_file_name :(
record_data
.file_name+'.pdf').toString(),
p_file_size :file_size,
p_user_id :$ctx.session.user_id,
p_contract_id :$ctx.parameter.contract_id,
p_file_type :'PDF',
p_lease_type :
'02'
p_lease_type :
lease_type
});
println('download_file' + download_file);
<!-- download_file(datePath + guid_file_name_tables[0].guid_file_name + 'con' + record_data.content_id + '.pdf' ,'催收函.pdf');-->
...
...
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