Commit 6b8a6823 authored by stone's avatar stone

【fix】合同结束功能修改

parent 0d7adcac
package com.hand.hls.hlcm.util;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* Created with IntelliJ IDEA.
* Description:
* User: huangtianyang
* Date: 2018-08-23
* Time: 上午9:24
*/
public class HlsFileUtil {
private static Logger logger = LoggerFactory.getLogger(HlsFileUtil.class);
/**
* 批量打包
*
* @param files 需要打包的文件
* @param fileName 压缩文件名
*/
public static void zipFile(List<File> files, String fileName) throws IOException {
File zipFile = new File(fileName);
FileOutputStream outputStream = new FileOutputStream(zipFile);
ZipOutputStream out = new ZipOutputStream(outputStream);
// byte[] buffer = new byte[1024];
for (File file : files) {
FileInputStream in = null;
if (file.exists() && !file.isDirectory()) {
in = new FileInputStream(file);
out.putNextEntry(new ZipEntry(file.getName()));
IOUtils.copy(in, out);
// IOUtils.read(in, buffer);
// IOUtils.write(buffer, out);
}
IOUtils.closeQuietly(in);
}
IOUtils.closeQuietly(out);
IOUtils.closeQuietly(outputStream);
}
/*
* copy from weck
* */
public static void downloadFile(String filePath, String fileName, HttpServletResponse response) {
File file = new File(filePath);
if (!file.exists()) {
logger.error("target file does not exists.");
response.setStatus(HttpStatus.SC_NO_CONTENT);
} else {
response.setContentType("application/octet-stream");
// response.setContentType("application/force-download");// 设置强制下载不打开
// response.setContentType("multipart/form-data");
response.addHeader("Content-Disposition",
"attachment;fileName=" + fileName);// 设置文件名
response.setContentLength((int) (FileUtils.sizeOf(file)));
FileInputStream is = null;
OutputStream os = null;
doFileStream(response, file, is, os);
}
}
public static void downloadFile(String filePath, String fileName, HttpServletResponse response, String fileType) {
File file = new File(filePath);
if (!file.exists()) {
logger.error("target file does not exists.");
response.setStatus(HttpStatus.SC_NO_CONTENT);
} else {
response.setContentType(chooseMimeType(fileType));
// response.setContentType("application/force-download");// 设置强制下载不打开
// response.setContentType("multipart/form-data");
response.addHeader("Content-Disposition",
chooseHeader(fileName, fileType));// 设置文件名
response.setContentLength((int) (FileUtils.sizeOf(file)));
FileInputStream is = null;
OutputStream os = null;
doFileStream(response, file, is, os);
}
}
private static void doFileStream(HttpServletResponse response, File file, FileInputStream is, OutputStream os) {
try {
is = new FileInputStream(file);
os = response.getOutputStream();
IOUtils.copy(is, os);
} catch (Exception e) {
logger.error("io transformation failed when download file.", e);
} finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(os);
}
}
private static String chooseMimeType(String suffix) {
String mimeType;
switch (suffix) {
case "pdf":
mimeType = "application/pdf";
break;
default:
mimeType = "application/octet-stream";
}
return mimeType;
}
private static String chooseHeader(String fileName, String type) {
String header;
switch (type) {
case "pdf":
header = "inline;fileName=" + fileName;
break;
default:
header = "attachment;fileName=" + fileName;
}
return header;
}
}
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="CON_CONTRACT.OWNER_USER_ID"/> <bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="CON_CONTRACT.OWNER_USER_ID"/>
<bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date" physicalName="INCEPTION_OF_LEASE" prompt="CON_CONTRACT.INCEPTION_OF_LEASE"/> <bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date" physicalName="INCEPTION_OF_LEASE" prompt="CON_CONTRACT.INCEPTION_OF_LEASE"/>
<bm:field name="lease_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="LEASE_END_DATE" prompt="CON_CONTRACT.LEASE_END_DATE"/> <bm:field name="lease_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="LEASE_END_DATE" prompt="CON_CONTRACT.LEASE_END_DATE"/>
<bm:field name="et_date" databaseType="DATE" datatype="java.util.Date" physicalName="ET_DATE" prompt="CON_CONTRACT.ET_DATE"/>
<bm:field name="lease_item_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_ITEM_AMOUNT" prompt="CON_CONTRACT.LEASE_ITEM_AMOUNT"/> <bm:field name="lease_item_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_ITEM_AMOUNT" prompt="CON_CONTRACT.LEASE_ITEM_AMOUNT"/>
<bm:field name="contract_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS" prompt="CON_CONTRACT.CONTRACT_STATUS"/> <bm:field name="contract_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_STATUS" prompt="CON_CONTRACT.CONTRACT_STATUS"/>
<!--<bm:field name="signing_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SIGNING_USER_ID" prompt="CON_CONTRACT.SIGNING_USER_ID"/>--> <!--<bm:field name="signing_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SIGNING_USER_ID" prompt="CON_CONTRACT.SIGNING_USER_ID"/>-->
...@@ -47,6 +48,18 @@ ...@@ -47,6 +48,18 @@
Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js"); Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js");
]]></s:bm-script> ]]></s:bm-script>
</bm:features> </bm:features>
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
con_contract_pkg.change_et_date(p_contract_id =>${@contract_id} ,
p_et_date =>${@et_date} ,
p_user_id => ${session/@user_id});
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
<bm:primary-key> <bm:primary-key>
<bm:pk-field name="contract_id"/> <bm:pk-field name="contract_id"/>
</bm:primary-key> </bm:primary-key>
...@@ -60,7 +73,7 @@ ...@@ -60,7 +73,7 @@
</bm:query-fields> </bm:query-fields>
<bm:data-filters> <bm:data-filters>
<bm:field name="is_terminate" expression="((select sum(ccc.due_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id and cf_item = 1 AND ccc.cf_status&lt;&gt;&apos;BLOCK&apos;) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id and cf_item = 1 AND ccc.cf_status&lt;&gt;&apos;BLOCK&apos;)) = 0"/> <bm:field name="is_terminate" expression="((select sum(ccc.due_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id and cf_item = 1 AND ccc.cf_status&lt;&gt;&apos;BLOCK&apos;) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where contract_id = t1.contract_id and cf_item = 1 AND ccc.cf_status&lt;&gt;&apos;BLOCK&apos;)) = 0"/>
<bm:data-filter enforceOperations="query" expression="t1.contract_status not in (&apos;CLOSED&apos;) "/> <bm:data-filter enforceOperations="query" expression="t1.contract_status in (&apos;INCEPT&apos;,&apos;ETING&apos;,&apos;REPURING&apos;,&apos;TERMINATING&apos;) "/>
<!-- <bm:data-filter enforceOperations="query" expression="t1.lease_end_date &lt;= sysdate"/> --> <!-- <bm:data-filter enforceOperations="query" expression="t1.lease_end_date &lt;= sysdate"/> -->
<bm:data-filter enforceOperations="query" expression="t1.data_class = &apos;NORMAL&apos;"/> <bm:data-filter enforceOperations="query" expression="t1.data_class = &apos;NORMAL&apos;"/>
<!-- <bm:data-filter enforceOperations="query" expression="t1.contract_id = ${@contract_id}"/>--> <!-- <bm:data-filter enforceOperations="query" expression="t1.contract_id = ${@contract_id}"/>-->
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<bm:field name="bp_id_tenant" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_TENANT" prompt="CON_CONTRACT.BP_ID_TENANT"/> <bm:field name="bp_id_tenant" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_TENANT" prompt="CON_CONTRACT.BP_ID_TENANT"/>
<bm:field name="bp_name" expression="(select bp_name from hls_bp_master where bp_id=t1.bp_id_tenant and enabled_flag=&apos;Y&apos;)" forInsert="false" forUpdate="false"/> <bm:field name="bp_name" expression="(select bp_name from hls_bp_master where bp_id=t1.bp_id_tenant and enabled_flag=&apos;Y&apos;)" forInsert="false" forUpdate="false"/>
<bm:field name="bp_id_agent_level1" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_AGENT_LEVEL1" prompt="CON_CONTRACT.BP_ID_AGENT_LEVEL1"/> <bm:field name="bp_id_agent_level1" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_AGENT_LEVEL1" prompt="CON_CONTRACT.BP_ID_AGENT_LEVEL1"/>
<bm:field name="et_date" databaseType="DATE" datatype="java.util.Date" physicalName="ET_DATE" prompt="CON_CONTRACT.ET_DATE"/>
<bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="CON_CONTRACT.OWNER_USER_ID"/> <bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="CON_CONTRACT.OWNER_USER_ID"/>
<bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date" physicalName="INCEPTION_OF_LEASE" prompt="CON_CONTRACT.INCEPTION_OF_LEASE"/> <bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date" physicalName="INCEPTION_OF_LEASE" prompt="CON_CONTRACT.INCEPTION_OF_LEASE"/>
<bm:field name="lease_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="LEASE_END_DATE" prompt="CON_CONTRACT.LEASE_END_DATE"/> <bm:field name="lease_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="LEASE_END_DATE" prompt="CON_CONTRACT.LEASE_END_DATE"/>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
select v.code_value, v.code_value_name select v.code_value, v.code_value_name
from sys_code_values_v v from sys_code_values_v v
where v.code = 'CON500_CONTRACT_STATUS' where v.code = 'CON500_CONTRACT_STATUS'
and v.code_value in ('ETING', 'INCEPT', 'TERMINATING','REPUR') and v.code_value in ('ETING', 'INCEPT', 'TERMINATING','REPURING')
and v.code_enabled_flag = 'Y' and v.code_enabled_flag = 'Y'
]]></bm:query-sql> ]]></bm:query-sql>
</bm:operation> </bm:operation>
......
...@@ -19,6 +19,14 @@ var override_queryfields = [ ...@@ -19,6 +19,14 @@ var override_queryfields = [
name : 'lease_start_date_to', name : 'lease_start_date_to',
queryexpression : "t1.lease_start_date <=${@lease_start_date_to}" queryexpression : "t1.lease_start_date <=${@lease_start_date_to}"
}, },
{
name : 'lease_end_date_from',
queryexpression : "t1.lease_end_date >= ${@lease_end_date_from}"
},
{
name : 'lease_end_date_to',
queryexpression : "t1.lease_end_date <=${@lease_end_date_to}"
},
{ {
name : 'contract_creation_date_from', name : 'contract_creation_date_from',
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
]]> ]]>
</a:init-procedure> </a:init-procedure>
<a:view> <a:view>
<a:link id="change_et_date_link" model="cont.CON560.con_contract_finish_for_query" modelaction="batch_update"/>
<a:link id="${/parameter/@layout_code}con_contract_query_link" <a:link id="${/parameter/@layout_code}con_contract_query_link"
url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/> url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/>
<a:link id="con_contract_terminate_link_id" model="cont.CON560.con_contract_terminate" <a:link id="con_contract_terminate_link_id" model="cont.CON560.con_contract_terminate"
...@@ -20,6 +21,54 @@ ...@@ -20,6 +21,54 @@
<a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/> modelaction="update"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
function save_et_date_btn(){
var datas=$('con560_contract_result_ds').getJsonData();
if(datas.length==0){
$L.showInfoMessage("提示",'未修改任何数据!');
return;
}else{
var arry=[];
for(var i=0;i<datas.length;i++){
var obj={};
obj.contract_id=datas[i].contract_id;
obj.et_date=Leaf.formatDate(datas[i].et_date);
obj._status=datas[i]._status;
arry.push(obj);
}
console.log(arry);
//保存数据
var detail_mask=Ext.getBody();
Leaf.Masker.mask(detail_mask);
Leaf.request({
url: $('change_et_date_link').getUrl(),
para: arry,
success: function() {
Leaf.SideBar.show({
msg: '操作成功',
duration: 2000
});
Leaf.Masker.unmask(detail_mask);
$('con560_contract_result_ds').query();
},
failure: function() {
Leaf.Masker.unmask(detail_mask);
},
error: function() {
Leaf.Masker.unmask(detail_mask);
},
scope: this
});
}
}
function date_editor_func(record,name){
if(record.get('contract_status')=='INCEPT'||record.get('contract_status')=='ETING'||record.get('contract_status')=='REPURING'){
return 'date_editor';
}else{
return '';
}
}
function con560_con_contract_detail() { function con560_con_contract_detail() {
var records = $('con560_contract_result_ds').getSelected(); var records = $('con560_contract_result_ds').getSelected();
if (!records.length) { if (!records.length) {
...@@ -204,6 +253,11 @@ ...@@ -204,6 +253,11 @@
</a:form> </a:form>
<a:grid id="con560_con_contract_grid_ds" bindTarget="con560_contract_result_ds" height="250" <a:grid id="con560_con_contract_grid_ds" bindTarget="con560_contract_result_ds" height="250"
marginWidth="30" navBar="true"> marginWidth="30" navBar="true">
<a:toolBar>
<a:button id="hn_atm_complement_atm_grid_save" click='save_et_date_btn' text="保存"/>
</a:toolBar>
<a:columns> <a:columns>
<a:column name="contract_number" lock="true" prompt="HLS.CONTRACT_NUMBER" <a:column name="contract_number" lock="true" prompt="HLS.CONTRACT_NUMBER"
renderer="con560_render_contractMaintainDs_grid" width="150"/> renderer="con560_render_contractMaintainDs_grid" width="150"/>
...@@ -222,7 +276,11 @@ ...@@ -222,7 +276,11 @@
renderer="Leaf.formatMoney" width="120"/> renderer="Leaf.formatMoney" width="120"/>
<!--<a:column name="owner_user_id_n" prompt="出单人" width="60"/>--> <!--<a:column name="owner_user_id_n" prompt="出单人" width="60"/>-->
<a:column name="contract_status_n" prompt="合同状态" width="80"/> <a:column name="contract_status_n" prompt="合同状态" width="80"/>
<a:column name="et_date" prompt="合同结束日" width="80" editorFunction="date_editor_func" renderer="Leaf.formatDate"/>
</a:columns> </a:columns>
<a:editors>
<a:datePicker id="date_editor"/>
</a:editors>
</a:grid> </a:grid>
<a:tabPanel marginHeight="420" marginWidth="30"> <a:tabPanel marginHeight="420" marginWidth="30">
<a:tabs> <a:tabs>
......
...@@ -216,6 +216,8 @@ ...@@ -216,6 +216,8 @@
renderer="Leaf.formatMoney" width="120"/> renderer="Leaf.formatMoney" width="120"/>
<!--<a:column name="owner_user_id_n" prompt="出单人" width="60"/>--> <!--<a:column name="owner_user_id_n" prompt="出单人" width="60"/>-->
<a:column name="contract_status_n" prompt="合同状态" width="80"/> <a:column name="contract_status_n" prompt="合同状态" width="80"/>
<a:column name="et_date" prompt="合同结束日" width="80"/>
</a:columns> </a:columns>
</a:grid> </a:grid>
<a:tabPanel marginHeight="420" marginWidth="30"> <a:tabPanel marginHeight="420" marginWidth="30">
......
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