Commit 0502bf33 authored by liyuan.chen's avatar liyuan.chen

对账单,付款申请上传附件,收支一览表,租金催收修改

parent cf17f6c3
package com.hand.hls.hlcm.cont.controllers;
/**
* @Author: Liyuan.Chen
* @Date: 2020/8/19
* @Purpose:
*/
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import com.hand.hap.system.controllers.BaseController;
import org.apache.poi.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
@Validated
public class BaseFrontController extends BaseController {
/**
* slf4j 日志 logger
*/
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* 下载文件,纯SpringMVC的API来完成
*
* @param is
* 文件输入流
* @param name
* 文件名称,带后缀名
*
* @throws Exception
*/
public ResponseEntity<byte[]> buildResponseEntity(InputStream is, String name) throws Exception {
logger.info(">>>>>>>>>>>>>>>>>>>>开始下载文件>>>>>>>>>>");
if (this.logger.isDebugEnabled())
this.logger.debug("download: " + name);
HttpHeaders header = new HttpHeaders();
String fileSuffix = name.substring(name.lastIndexOf('.') + 1);
fileSuffix = fileSuffix.toLowerCase();
Map<String, String> arguments = new HashMap<String, String>();
arguments.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
arguments.put("xls", "application/vnd.ms-excel");
String contentType = arguments.get(fileSuffix);
header.add("Content-Type", (StringUtils.hasText(contentType) ? contentType : "application/x-download"));
if(is!=null && is.available()!=0){
header.add("Content-Length", String.valueOf(is.available()));
header.add("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(name, "UTF-8"));
byte[] bs = IOUtils.toByteArray(is);
logger.info(">>>>>>>>>>>>>>>>>>>>结束下载文件-有记录>>>>>>>>>>");
logger.info(">>>>>>>>>>结束导出excel>>>>>>>>>>");
return new ResponseEntity<>(bs, header, HttpStatus.OK);
}else{
String string="数据为空";
header.add("Content-Length", "0");
header.add("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(name, "UTF-8"));
logger.info(">>>>>>>>>>>>>>>>>>>>结束下载文件-无记录>>>>>>>>>>");
logger.info(">>>>>>>>>>结束导出excel>>>>>>>>>>");
return new ResponseEntity<>(string.getBytes(), header, HttpStatus.OK);
}
}
}
package com.hand.hls.hlcm.cont.controllers;
/**
* @Author: Liyuan.Chen
* @Date: 2020/8/19
* @Purpose:
*/
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hand.hap.system.controllers.BaseController;
import com.hand.hap.system.dto.ResponseData;
import com.hand.hls.hlcm.cont.service.ConExportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
@Controller
public class ConExportController extends BaseController {
@Autowired
private ConExportService conExportService;
// 导出excel
@RequestMapping(value = "/con/contract/conExportExcel")
public void exportExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam("contractId") int contractId) {
System.out.println(contractId);
try {
conExportService.exportExcel(request, response, contractId);
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.hand.hls.hlcm.cont.mapper;
import com.hand.hap.mybatis.common.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.*;
/**
* @Author: Liyuan.Chen
* @Date: 2020/8/19
* @Purpose:
*/
public interface ConExportMapper {
public LinkedList<LinkedHashMap<String, Object>> selectCashflowList(@Param("contractId") int contractId);
public HashMap<String, Object> selectContractDetailList(@Param("contractId") int contractId);
/* public List<HashMap<String, Object>> selectTemplateDetailInfo(HashMap<String, Object> hm);
public int updateTemplateDetail(HashMap<String, Object> hm);*/
}
package com.hand.hls.hlcm.cont.service;
/**
* @Author: Liyuan.Chen
* @Date: 2020/8/19
* @Purpose:
*/
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hand.hap.core.ProxySelf;
import org.springframework.http.ResponseEntity;
import java.util.Map;
public interface ConExportService extends ProxySelf<ConExportService> {
void exportExcel(HttpServletRequest request, HttpServletResponse response, int contractId) throws Exception;
}
package com.hand.hls.hlcm.cont.util;
/**
* @Author: Liyuan.Chen
* @Date: 2020/8/19
* @Purpose:
*/
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import java.math.BigDecimal;
import java.math.BigInteger;
/**
* excle样式工具类
* @author linry
*
*/
public class ExcelFormatUtil {
/**
* 设置报表头样式
* @param workbook
* @return
*/
public static CellStyle headSytle(SXSSFWorkbook workbook){
// 设置style1的样式,此样式运用在第二行
CellStyle style1 = workbook.createCellStyle();// cell样式
// 设置单元格背景色,设置单元格背景色以下两句必须同时设置
/*style1.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);// 设置填充样式
style1.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);// 设置填充色*/
// 设置单元格上、下、左、右的边框线
/*style1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style1.setBorderRight(HSSFCellStyle.BORDER_THIN);
style1.setBorderTop(HSSFCellStyle.BORDER_THIN);*/
Font font1 = workbook.createFont();// 创建一个字体对象
font1.setBold(true);
//font1.setBoldweight((short) 16);// 设置字体的宽度
font1.setFontHeightInPoints((short) 16);// 设置字体的高度
font1.setFontName("等线");
//font1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);// 粗体显示
style1.setFont(font1);// 设置style1的字体
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.CENTER);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1;
}
/**
* 设置报表体样式
* @param wb
* @return
*/
public static CellStyle contentStyle(SXSSFWorkbook wb){
// 设置style1的样式,此样式运用在第二行
CellStyle style1 = wb.createCellStyle();// cell样式
// 设置单元格上、下、左、右的边框线
/*style1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style1.setBorderRight(HSSFCellStyle.BORDER_THIN);
style1.setBorderTop(HSSFCellStyle.BORDER_THIN);*/
//style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.LEFT);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1;
}
public static CellStyle contentStyleLine(SXSSFWorkbook wb){
// 设置style1的样式,此样式运用在第二行
CellStyle style1 = wb.createCellStyle();// cell样式
// 设置单元格上、下、左、右的边框线
style1.setBorderBottom(BorderStyle.THIN);
/* style1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style1.setBorderRight(HSSFCellStyle.BORDER_THIN);
style1.setBorderTop(HSSFCellStyle.BORDER_THIN);*/
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.LEFT);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1;
}
public static CellStyle contentTableStyle(SXSSFWorkbook wb){
// 设置style1的样式,此样式运用在第二行
CellStyle style1 = wb.createCellStyle();// cell样式
// 设置单元格上、下、左、右的边框线
style1.setBorderBottom(BorderStyle.THIN);
style1.setBorderLeft(BorderStyle.THIN);
style1.setBorderRight(BorderStyle.THIN);
style1.setBorderTop(BorderStyle.THIN);
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.CENTER);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1;
}
/**
* 设置报表标题样式
* @param workbook
* @return
*/
public static HSSFCellStyle titleSytle(HSSFWorkbook workbook,short color,short fontSize){
// 设置style1的样式,此样式运用在第二行
HSSFCellStyle style1 = workbook.createCellStyle();// cell样式
// 设置单元格背景色,设置单元格背景色以下两句必须同时设置
//style1.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);// 设置填充样式
//short fcolor = color;
// 设置单元格上、下、左、右的边框线
style1.setBorderBottom(BorderStyle.THIN);
style1.setBorderLeft(BorderStyle.THIN);
style1.setBorderRight(BorderStyle.THIN);
style1.setBorderTop(BorderStyle.THIN);
HSSFFont font1 = workbook.createFont();// 创建一个字体对象
font1.setBold(true);
font1.setFontHeightInPoints(fontSize);// 设置字体的高度
style1.setFont(font1);// 设置style1的字体
style1.setWrapText(true);// 设置自动换行
style1.setAlignment(HorizontalAlignment.CENTER);// 设置单元格字体显示居中(左右方向)
style1.setVerticalAlignment(VerticalAlignment.CENTER);// 设置单元格字体显示居中(上下方向)
return style1;
}
/**
*设置表头
* @param sheet
*/
public static void initTitleEX(SXSSFSheet sheet, CellStyle header,String title[],int titleLength[]) {
SXSSFRow row0 = sheet.createRow(0);
row0.setHeight((short) 800);
for(int j = 0;j<title.length; j++) {
SXSSFCell cell = row0.createCell(j);
//设置每一列的字段名
cell.setCellValue(title[j]);
cell.setCellStyle(header);
sheet.setColumnWidth(j, titleLength[j]);
}
}
/**
*设置表头
* @param sheet
*/
public static void initTitle(SXSSFSheet sheet, CellStyle header, String title, int firstRow, int firstrCol) {
SXSSFRow row = sheet.createRow(firstRow);
SXSSFCell cell = row.createCell(firstrCol);
//设置每一列的字段名
cell.setCellValue(title);
cell.setCellStyle(header);
CellRangeAddress region = new CellRangeAddress(firstRow, firstRow+1, firstrCol, 9);
sheet.addMergedRegion(region);
}
public static void initContent(SXSSFSheet sheet, CellStyle contentType, String content, int firstRow, int firstrCol) {
SXSSFRow row = sheet.createRow(firstRow);
SXSSFCell cell = row.createCell(firstrCol);
//设置每一列的字段名
cell.setCellValue(content);
cell.setCellStyle(contentType);
CellRangeAddress region = new CellRangeAddress(firstRow, firstRow, firstrCol, 9);
sheet.addMergedRegion(region);
}
public static void initColumn(SXSSFSheet sheet, CellStyle contentTable,String title[],int titleLength[], int firstRow) {
SXSSFRow row = sheet.createRow(firstRow);
for(int j = 1;j<=title.length; j++) {
SXSSFCell cell = row.createCell(j);
//设置每一列的字段名
cell.setCellValue(title[j-1]);
cell.setCellStyle(contentTable);
sheet.setColumnWidth(j, titleLength[j-1]);
}
}
public static BigDecimal getBigDecimal(Object value) {
BigDecimal ret = null;
if (value != null) {
if (value instanceof BigDecimal) {
ret = (BigDecimal) value;
} else if (value instanceof String) {
ret = new BigDecimal((String) value);
} else if (value instanceof BigInteger) {
ret = new BigDecimal((BigInteger) value);
} else if (value instanceof Number) {
ret = new BigDecimal(((Number) value).doubleValue());
} else {
throw new ClassCastException("Not possible to coerce [" + value + "] from class " + value.getClass() + " into a BigDecimal.");
}
}
return ret;
}
}
......@@ -65,12 +65,12 @@
WHERE hd.enabled_flag = 'Y'
AND hd.division = cc.division) division_n,
cc.division,
/*contract_item_query_pkg.calc_ac_overdue_times(p_contract_id => cc.contract_id,
contract_item_query_pkg.calc_ac_overdue_times(p_contract_id => cc.contract_id,
p_calc_date => SYSDATE,
p_user_id => -1) account_due_times,
contract_item_query_pkg.calc_ac_overdue_days(p_contract_id => cc.contract_id,
p_calc_date => SYSDATE,
p_user_id => -1) account_due_days,*/
p_user_id => -1) account_due_days,
(SELECT SUM(ccc.due_amount)
......@@ -89,12 +89,12 @@
and gwo.contract_id = ccw.contract_id
AND trunc(ccw.due_date) <= trunc(SYSDATE)), 0) account_due_amount,
/*contract_item_query_pkg.calc_business_overdue_times(p_contract_id => cc.contract_id,
contract_item_query_pkg.calc_business_overdue_times(p_contract_id => cc.contract_id,
p_calc_date => SYSDATE,
p_user_id => -1) business_due_times,
contract_item_query_pkg.calc_bussiness_overdue_days(p_contract_id => cc.contract_id,
p_calc_date => SYSDATE,
p_user_id => -1) business_due_days,*/
p_user_id => -1) business_due_days,
(SELECT SUM(ccc.due_amount)
FROM con_contract_cashflow ccc
......@@ -181,7 +181,7 @@
AND ccc.cf_status = 'RELEASE'
AND ccc.cf_item IN (1, 8, 250)
) total_due_amount,
cc.contract_status,
cc.contract_status/*,
(Select Count(1)
From con_contract_cashflow ccc
Where ccc.contract_id = cc.contract_id
......@@ -228,7 +228,7 @@
And gwo.contract_id = ccc.contract_id
And gwo.times = ccc.times
And gwo.cf_item = ccc.cf_item),
0)) As account_due_days -- 会计逾期天数
0)) As account_due_days -- 会计逾期天数*/
FROM con_contract cc
WHERE
......
......@@ -27,36 +27,36 @@
'金',
7,
'土') named_day,
(SELECT SUM(due_amount - nvl(received_amount, 0))
FROM con_contract_cashflow
WHERE cf_item = 8
AND due_date = t.calendar_date
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 8
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = contract_id)) purchase_amount, --留购金
(SELECT SUM(due_amount - nvl(received_amount, 0))
FROM con_contract_cashflow
WHERE cf_item = 2
AND due_date = t.calendar_date
AND ct.contract_id = ccc.contract_id)) purchase_amount, --留购金
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 2
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = contract_id)) down_payment, --首付款
(SELECT SUM(due_amount)
AND ct.contract_id = ccc.contract_id)) down_payment, --首付款
(SELECT SUM(ccc.due_amount)
FROM con_contract_cashflow ccc
WHERE cf_item = 1
AND due_date = t.calendar_date
WHERE ccc.cf_item = 1
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
('INCEPT', 'PENDING','ETING', 'REPURING')
AND ct.contract_id = contract_id)) lease_amount, --租金
AND ct.contract_id = ccc.contract_id)) lease_amount, --租金
(CASE
WHEN to_char(SYSDATE, 'dd') <= 20 AND
to_char(t.calendar_date, 'yyyymmdd') =
......
......@@ -27,36 +27,36 @@
'金',
7,
'土') named_day,
(SELECT SUM(due_amount - nvl(received_amount, 0))
FROM con_contract_cashflow
WHERE cf_item = 8
AND due_date = t.calendar_date
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 8
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
('INCEPT', 'PENDING', 'ETING', 'REPURING')
AND ct.contract_id = contract_id)) purchase_amount, --留购金
(SELECT SUM(due_amount - nvl(received_amount, 0))
FROM con_contract_cashflow
WHERE cf_item = 2
AND due_date = t.calendar_date
AND ct.contract_id = ccc.contract_id)) purchase_amount, --留购金
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.cf_item = 2
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
('INCEPT', 'PENDING', 'ETING', 'REPURING')
AND ct.contract_id = contract_id)) down_payment, --首付款
(SELECT SUM(due_amount)
AND ct.contract_id = ccc.contract_id)) down_payment, --首付款
(SELECT SUM(ccc.due_amount)
FROM con_contract_cashflow ccc
WHERE cf_item = 1
AND due_date = t.calendar_date
WHERE ccc.cf_item = 1
AND ccc.due_date = t.calendar_date
AND EXISTS
(SELECT 1
FROM con_contract ct
WHERE ct.contract_status IN
('INCEPT', 'PENDING', 'ETING', 'REPURING')
AND ct.contract_id = contract_id)) lease_amount, --租金
AND ct.contract_id = ccc.contract_id)) lease_amount, --租金
(CASE
WHEN to_char(SYSDATE, 'dd') <= 20 AND
to_char(t.calendar_date, 'yyyymmdd') =
......
......@@ -217,6 +217,18 @@
fullScreen: true
});
};
window['${/parameter/@layout_code}_user_button4_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);
//window.location.href='${/request/@context_path}/con/contract/conExportExcel?contractId='+record.get('contract_id');
};
]]></script>
<a:screen-include
screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=CONTRACT&amp;function_code=CON501"/>
......
......@@ -7,9 +7,16 @@
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true"
dynamiccreateenabled="true" trace="true">
<a:init-procedure>
<s:server-script import="contract_print_path.js"><![CDATA[
$ctx.parameter.file_path = con_print_path['con_print_path'];
$ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
]]>
</s:server-script>
<a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
</a:init-procedure>
<a:view>
<a:link id="${/parameter/@layout_code}_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<script type="text/javascript"><![CDATA[
......
......@@ -16,7 +16,7 @@
<a:link id="penalty_change_id"
url="${/request/@context_path}/modules/cont/CON747/con_contract_penatly_change_req_detail.lview"/>
<a:link id="con_contract_dun_detail_link_id"
url="${/request/@context_path}/modules/cont/CON620/con_contract_rent_detail.lview"/>
url="${/request/@context_pacon_contract_dun_for_queryth}/modules/cont/CON620/con_contract_rent_detail.lview"/>
<a:link id="con_contract_account_detail_link_id"
url="${/request/@context_path}/modules/cont/CON620/con_contract_account_detail.lview"/>
<a:link id="con_contract_query_link_id"
......
......@@ -13,7 +13,7 @@
<script type="text/javascript"><![CDATA[
Leaf.onReady(function(){
//付款打印按钮只有会计担当和会计部长可见
if("${/model/role_info/record/@role_code}"!="0013"&&"${/model/role_info/record/@role_code}"!="0014") {
if("${/model/role_info/record/@role_code}"!="0013"&&"${/model/role_info/record/@role_code}"!="0014"&&"${/model/role_info/record/@role_code}"!="0010") {
//$('${/parameter/@layout_code}_user_button5').style.display='none';
Ext.fly('${/parameter/@layout_code}_user_button5').dom.style.display="none";
}else{
......
......@@ -191,7 +191,9 @@ var csh_return_atm_id = '${/model/csh_return_list_id/record/@return_list_id}';
<a:textField name="opposite_band_na" bindTarget="csh_transaction_deposit_return_maintain_ds"
prompt="CSH510.CSH_TRANSACTION.YOUR_BANK_NAME"/>
<a:textField name="bp_bank_account_num" bindTarget="csh_transaction_deposit_return_maintain_ds"
prompt="CSH510.CSH_TRANSACTION.YOUR_ACCOUNT_USERNAME"/>
prompt="CSH510.CSH_TRANSACTION.YOUR_ACCOUNT_USERNAME" width="170"/>
<!--<a:numberField name="bp_bank_account_num" allowdecimals="false" bindTarget="csh_transaction_deposit_return_maintain_ds"
prompt="CSH510.CSH_TRANSACTION.YOUR_ACCOUNT_USERNAME" width="170"/>-->
<a:hBox>
<a>附件上传:</a><a href="javascript:upload_attachment_win()" style="color:red"> 附件上传</a>
</a:hBox>
......
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