问题修改
This commit is contained in:
parent
746b572d8e
commit
982b0eb61c
|
|
@ -7,6 +7,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.apache.poi.ss.util.RegionUtil;
|
import org.apache.poi.ss.util.RegionUtil;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -249,7 +250,151 @@ public class PoiOutPage {
|
||||||
return workbook;
|
return workbook;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HSSFWorkbook excelForcheckAll(List<Map<String, Object>> resultLease,List<Map<String, Object>> resultLose,List<Map<String, Object>> resultRepair,List<Map<String, Object>> resultScrap,List<Map<String, Object>> resultsReduction,
|
public static HSSFWorkbook excelForcheckAll(List<Map<String, Object>> resultLease,List<Map<String, Object>> resultLose,List<Map<String, Object>> resultRepair,List<Map<String, Object>> resultScrap,
|
||||||
|
List<String> listLease,List<String> listLose,List<String> listRepair,List<String> listScrap, String filename, String projectName, String unit,
|
||||||
|
BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap) {
|
||||||
|
// 创建工作簿和工作表
|
||||||
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||||
|
HSSFSheet sheet = workbook.createSheet();
|
||||||
|
sheet.setDefaultColumnWidth(15); // 设置列宽
|
||||||
|
|
||||||
|
// 创建样式
|
||||||
|
HSSFCellStyle titleStyle = createTitleStyle(workbook);
|
||||||
|
HSSFCellStyle headerStyle = createHeaderStyle(workbook);
|
||||||
|
HSSFCellStyle contentStyle = createCellStyleCost(workbook);
|
||||||
|
|
||||||
|
// 设置工作簿名称
|
||||||
|
workbook.setSheetName(0, filename);
|
||||||
|
|
||||||
|
// 填充标题行
|
||||||
|
int rowNum = 0;
|
||||||
|
rowNum = createTitleRowStyle(sheet, rowNum, filename, titleStyle, listLease.size());
|
||||||
|
rowNum = createProjectAndUnitRow(sheet, rowNum, projectName, unit, titleStyle, listLease.size());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租赁费用明细
|
||||||
|
*/
|
||||||
|
rowNum = createTitleRowStyleCost(sheet, rowNum, "租赁费用明细", titleStyle, listLease.size());
|
||||||
|
// 填充表头
|
||||||
|
rowNum = createHeaderRow(sheet, rowNum, listLease, headerStyle);
|
||||||
|
|
||||||
|
// 填充数据行
|
||||||
|
if (resultLease != null && !resultLease.isEmpty()) {
|
||||||
|
rowNum = createDataRows(sheet, rowNum, resultLease, contentStyle, listLease.size());
|
||||||
|
} else {
|
||||||
|
// 如果没有数据,则仅显示表头
|
||||||
|
// rowNum++;
|
||||||
|
// rowNum = createDataRows(sheet, rowNum, resultLease, contentStyle, listLease.size());
|
||||||
|
HSSFRow row = sheet.createRow(rowNum++);
|
||||||
|
HSSFCell cell = row.createCell(0);
|
||||||
|
cell.setCellStyle(headerStyle);
|
||||||
|
cell.setCellValue("暂无数据");
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listLease.size() - 1)));
|
||||||
|
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listLease.size() - 1));
|
||||||
|
// 设置边框样式
|
||||||
|
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
}
|
||||||
|
rowNum = createTotalRow(sheet, rowNum, listLease, totalCostLease, headerStyle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维修费用明细
|
||||||
|
*/
|
||||||
|
// 填充标题行
|
||||||
|
rowNum = createTitleRowStyleCost(sheet, rowNum, "维修费用明细", titleStyle, listRepair.size());
|
||||||
|
// 填充表头
|
||||||
|
rowNum = createHeaderRow(sheet, rowNum, listRepair, headerStyle);
|
||||||
|
// 填充数据行
|
||||||
|
if (resultRepair!= null &&!resultRepair.isEmpty()) {
|
||||||
|
rowNum = createDataRows(sheet, rowNum, resultRepair, contentStyle, listRepair.size());
|
||||||
|
} else {
|
||||||
|
// 如果没有数据,则仅显示表头
|
||||||
|
// rowNum++;
|
||||||
|
// rowNum = createDataRows(sheet, rowNum, resultRepair, contentStyle, listRepair.size());
|
||||||
|
HSSFRow row = sheet.createRow(rowNum++);
|
||||||
|
HSSFCell cell = row.createCell(0);
|
||||||
|
cell.setCellStyle(headerStyle);
|
||||||
|
cell.setCellValue("暂无数据");
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listRepair.size() - 1)));
|
||||||
|
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listRepair.size() - 1));
|
||||||
|
// 设置边框样式
|
||||||
|
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
}
|
||||||
|
rowNum = createTotalRow(sheet, rowNum, listRepair, totalCostRepair, headerStyle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废费用明细
|
||||||
|
*/
|
||||||
|
// 填充标题行
|
||||||
|
rowNum = createTitleRowStyleCost(sheet, rowNum, "报废费用明细", titleStyle, listScrap.size());
|
||||||
|
// 填充表头
|
||||||
|
rowNum = createHeaderRow(sheet, rowNum, listScrap, headerStyle);
|
||||||
|
// 填充数据行
|
||||||
|
if (resultScrap!= null &&!resultScrap.isEmpty()) {
|
||||||
|
rowNum = createDataRows(sheet, rowNum, resultScrap, contentStyle, listScrap.size());
|
||||||
|
} else {
|
||||||
|
// 如果没有数据,则仅显示表头
|
||||||
|
// rowNum++;
|
||||||
|
// rowNum = createDataRows(sheet, rowNum, resultScrap, contentStyle, listScrap.size());
|
||||||
|
HSSFRow row = sheet.createRow(rowNum++);
|
||||||
|
HSSFCell cell = row.createCell(0);
|
||||||
|
cell.setCellStyle(headerStyle);
|
||||||
|
cell.setCellValue("暂无数据");
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listScrap.size() - 1)));
|
||||||
|
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listScrap.size() - 1));
|
||||||
|
// 设置边框样式
|
||||||
|
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
}
|
||||||
|
rowNum = createTotalRow(sheet, rowNum, listScrap, totalCostScrap, headerStyle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 丢失费用明细
|
||||||
|
*/
|
||||||
|
// 填充标题行
|
||||||
|
rowNum = createTitleRowStyleCost(sheet, rowNum, "丢失费用明细", titleStyle, listLose.size());
|
||||||
|
// 填充表头
|
||||||
|
rowNum = createHeaderRow(sheet, rowNum, listLose, headerStyle);
|
||||||
|
// 填充数据行
|
||||||
|
if (resultLose!= null &&!resultLose.isEmpty()) {
|
||||||
|
rowNum = createDataRows(sheet, rowNum, resultLose, contentStyle, listLose.size());
|
||||||
|
} else {
|
||||||
|
// 如果没有数据,则仅显示表头
|
||||||
|
// rowNum++;
|
||||||
|
// rowNum = createDataRows(sheet, rowNum, resultLose, contentStyle, listLose.size());
|
||||||
|
HSSFRow row = sheet.createRow(rowNum++);
|
||||||
|
HSSFCell cell = row.createCell(0);
|
||||||
|
cell.setCellStyle(headerStyle);
|
||||||
|
cell.setCellValue("暂无数据");
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listLose.size() - 1)));
|
||||||
|
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listLose.size() - 1));
|
||||||
|
// 设置边框样式
|
||||||
|
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
|
||||||
|
}
|
||||||
|
rowNum = createTotalRow(sheet, rowNum, listLose, totalCostLose, headerStyle);
|
||||||
|
|
||||||
|
//合计
|
||||||
|
BigDecimal totalCostAll = totalCostLease.add(totalCostLose).add(totalCostRepair).add(totalCostScrap);
|
||||||
|
rowNum = createTotalRowAll(sheet, rowNum, listScrap, totalCostAll, headerStyle);
|
||||||
|
|
||||||
|
return workbook;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算记录查询--导出全部明细
|
||||||
|
*/
|
||||||
|
public static HSSFWorkbook excelForcheckAlls(List<Map<String, Object>> resultLease,List<Map<String, Object>> resultLose,List<Map<String, Object>> resultRepair,List<Map<String, Object>> resultScrap,List<Map<String, Object>> resultsReduction,
|
||||||
List<String> listLease,List<String> listLose,List<String> listRepair,List<String> listScrap,List<String> listReduction, String filename, String projectName, String unit,
|
List<String> listLease,List<String> listLose,List<String> listRepair,List<String> listScrap,List<String> listReduction, String filename, String projectName, String unit,
|
||||||
BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap,BigDecimal totalCostReduction) {
|
BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap,BigDecimal totalCostReduction) {
|
||||||
// 创建工作簿和工作表
|
// 创建工作簿和工作表
|
||||||
|
|
@ -272,12 +417,12 @@ public class PoiOutPage {
|
||||||
BigDecimal totalCost1 = totalCostLease.subtract(totalCostReduction);
|
BigDecimal totalCost1 = totalCostLease.subtract(totalCostReduction);
|
||||||
//合计
|
//合计
|
||||||
BigDecimal totalCostAll = totalCostLease.add(totalCostLose).add(totalCostRepair).add(totalCostScrap).subtract(totalCostReduction);
|
BigDecimal totalCostAll = totalCostLease.add(totalCostLose).add(totalCostRepair).add(totalCostScrap).subtract(totalCostReduction);
|
||||||
String all= NumberToChinese.number2CN(totalCostAll);
|
String all= NumberToChinese.number2CN(totalCostAll.setScale(2, RoundingMode.HALF_UP));
|
||||||
rowNum = createProjectAndUnitRows(sheet, rowNum, "一、施工机具有偿使用费:", totalCost1+"", titleStyle, listLease.size());
|
rowNum = createProjectAndUnitRows(sheet, rowNum, "一、施工机具有偿使用费:", totalCost1.setScale(2, RoundingMode.HALF_UP)+"", titleStyle, listLease.size());
|
||||||
rowNum = createProjectAndUnitRows(sheet, rowNum, "二、施工机具维修费:", totalCostRepair+"", titleStyle, listLease.size());
|
rowNum = createProjectAndUnitRows(sheet, rowNum, "二、施工机具维修费:", totalCostRepair.setScale(2, RoundingMode.HALF_UP)+"", titleStyle, listLease.size());
|
||||||
rowNum = createProjectAndUnitRows(sheet, rowNum, "三、施工机具丢失费:", totalCostLose+"", titleStyle, listLease.size());
|
rowNum = createProjectAndUnitRows(sheet, rowNum, "三、施工机具丢失费:", totalCostLose.setScale(2, RoundingMode.HALF_UP)+"", titleStyle, listLease.size());
|
||||||
rowNum = createProjectAndUnitRows(sheet, rowNum, "四、施工机具损坏赔偿费:", totalCostScrap+"", titleStyle, listLease.size());
|
rowNum = createProjectAndUnitRows(sheet, rowNum, "四、施工机具损坏赔偿费:", totalCostScrap.setScale(2, RoundingMode.HALF_UP)+"", titleStyle, listLease.size());
|
||||||
rowNum = createProjectAndUnitRowss(sheet,rowNum,"费用合计金额(大写)",all,totalCostAll+"", titleStyle, listLease.size());
|
rowNum = createProjectAndUnitRowss(sheet,rowNum,"费用合计金额(大写)",all,totalCostAll.setScale(2, RoundingMode.HALF_UP)+"", titleStyle, listLease.size());
|
||||||
rowNum = createProjectAndUnitRows(sheet, rowNum, "说明", "本协议一式三份,甲方一份,乙方一份,经双方签字后生效。", titleStyle, listLease.size());
|
rowNum = createProjectAndUnitRows(sheet, rowNum, "说明", "本协议一式三份,甲方一份,乙方一份,经双方签字后生效。", titleStyle, listLease.size());
|
||||||
rowNum = createProjectAndUnitRows(sheet, rowNum, "备注", "此费用仅为在机具设备分公司发生费用,未计从项目部领用机具费用。", titleStyle, listLease.size());
|
rowNum = createProjectAndUnitRows(sheet, rowNum, "备注", "此费用仅为在机具设备分公司发生费用,未计从项目部领用机具费用。", titleStyle, listLease.size());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,69 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
* 导出结算单--all
|
* 导出结算单--all
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void expOutExcelAll(HttpServletResponse response, List<SltLeaseInfo> lease,List<SltLeaseInfo> lose,List<SltLeaseInfo> repair,List<SltLeaseInfo> scrap,List<SltLeaseInfo> reduction,
|
private void expOutExcelAll(HttpServletResponse response, List<SltLeaseInfo> lease,List<SltLeaseInfo> lose,List<SltLeaseInfo> repair,List<SltLeaseInfo> scrap,
|
||||||
|
String filename,String projectName,String unitName,BigDecimal totalCostLease,BigDecimal totalCostLose,BigDecimal totalCostRepair,BigDecimal totalCostScrap)
|
||||||
|
throws Exception {
|
||||||
|
List<Map<String, Object>> resultsLease = new ArrayList<Map<String, Object>>();
|
||||||
|
List<Map<String, Object>> resultsLose = new ArrayList<Map<String, Object>>();
|
||||||
|
List<Map<String, Object>> resultsRepair = new ArrayList<Map<String, Object>>();
|
||||||
|
List<Map<String, Object>> resultsScrap = new ArrayList<Map<String, Object>>();
|
||||||
|
|
||||||
|
if (lease!= null) {
|
||||||
|
int sizeLease = lease.size();
|
||||||
|
for (int i = 0; i < sizeLease; i++) {
|
||||||
|
SltLeaseInfo bean = lease.get(i);
|
||||||
|
Map<String, Object> maps = outReceiveDetailsBeanToMap(bean,1,1);
|
||||||
|
resultsLease.add(maps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lose!= null) {
|
||||||
|
int sizeLose = lose.size();
|
||||||
|
for (int i = 0; i < sizeLose; i++) {
|
||||||
|
SltLeaseInfo bean = lose.get(i);
|
||||||
|
Map<String, Object> maps = outReceiveDetailsBeanToMap(bean,2,1);
|
||||||
|
resultsLose.add(maps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (repair!= null) {
|
||||||
|
int sizeRepair = repair.size();
|
||||||
|
for (int i = 0; i < sizeRepair; i++) {
|
||||||
|
SltLeaseInfo bean = repair.get(i);
|
||||||
|
Map<String, Object> maps = outReceiveDetailsBeanToMap(bean,3,1);
|
||||||
|
resultsRepair.add(maps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scrap!= null) {
|
||||||
|
int sizeScrap = scrap.size();
|
||||||
|
for (int i = 0; i < sizeScrap; i++) {
|
||||||
|
SltLeaseInfo bean = scrap.get(i);
|
||||||
|
Map<String, Object> maps = outReceiveDetailsBeanToMap(bean,4,1);
|
||||||
|
resultsScrap.add(maps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> headersLease = receiveDetailsHeader(1,1);
|
||||||
|
List<String> headersLose = receiveDetailsHeader(2,1);
|
||||||
|
List<String> headersRepair = receiveDetailsHeader(3,1);
|
||||||
|
List<String> headersScrap = receiveDetailsHeader(4,1);
|
||||||
|
HSSFWorkbook workbook = PoiOutPage.excelForcheckAll(resultsLease,resultsLose,resultsRepair,resultsScrap, headersLease,headersLose,headersRepair,headersScrap, filename,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap);
|
||||||
|
OutputStream out = null;
|
||||||
|
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||||
|
response.addHeader("Content-Disposition",
|
||||||
|
"attachment;filename=" + URLEncoder.encode(filename, "UTF-8") + ".xls");
|
||||||
|
response.setHeader("Pragma", "No-cache");
|
||||||
|
out = response.getOutputStream();
|
||||||
|
workbook.write(out);
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算记录查询--导出全部明细
|
||||||
|
*/
|
||||||
|
private void expOutExcelAlls(HttpServletResponse response, List<SltLeaseInfo> lease,List<SltLeaseInfo> lose,List<SltLeaseInfo> repair,List<SltLeaseInfo> scrap,List<SltLeaseInfo> reduction,
|
||||||
String filename,String projectName,String unitName,BigDecimal totalCostLease,BigDecimal totalCostLose,BigDecimal totalCostRepair,BigDecimal totalCostScrap,BigDecimal totalCostReduction)
|
String filename,String projectName,String unitName,BigDecimal totalCostLease,BigDecimal totalCostLose,BigDecimal totalCostRepair,BigDecimal totalCostScrap,BigDecimal totalCostReduction)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
List<Map<String, Object>> resultsLease = new ArrayList<Map<String, Object>>();
|
List<Map<String, Object>> resultsLease = new ArrayList<Map<String, Object>>();
|
||||||
|
|
@ -263,7 +325,7 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
List<String> headersRepair = receiveDetailsHeader(3,1);
|
List<String> headersRepair = receiveDetailsHeader(3,1);
|
||||||
List<String> headersScrap = receiveDetailsHeader(4,1);
|
List<String> headersScrap = receiveDetailsHeader(4,1);
|
||||||
List<String> headersReduction = receiveDetailsHeader(5,1);
|
List<String> headersReduction = receiveDetailsHeader(5,1);
|
||||||
HSSFWorkbook workbook = PoiOutPage.excelForcheckAll(resultsLease,resultsLose,resultsRepair,resultsScrap,resultsReduction, headersLease,headersLose,headersRepair,headersScrap,headersReduction, filename,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
|
HSSFWorkbook workbook = PoiOutPage.excelForcheckAlls(resultsLease,resultsLose,resultsRepair,resultsScrap,resultsReduction, headersLease,headersLose,headersRepair,headersScrap,headersReduction, filename,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
|
||||||
OutputStream out = null;
|
OutputStream out = null;
|
||||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||||
response.addHeader("Content-Disposition",
|
response.addHeader("Content-Disposition",
|
||||||
|
|
@ -713,6 +775,107 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
@SysLog(title = "结算信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出租赁明细")
|
@SysLog(title = "结算信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出租赁明细")
|
||||||
@PostMapping("/exportAll")
|
@PostMapping("/exportAll")
|
||||||
public void exportAll(HttpServletResponse response, SltAgreementInfo sltAgreementInfo) {
|
public void exportAll(HttpServletResponse response, SltAgreementInfo sltAgreementInfo) {
|
||||||
|
try {
|
||||||
|
String fileName = "结算明细";
|
||||||
|
String projectName = sltAgreementInfo.getProjectName();
|
||||||
|
String unitName = sltAgreementInfo.getUnitName();
|
||||||
|
|
||||||
|
//租赁费用明细
|
||||||
|
BigDecimal totalCostLease = BigDecimal.valueOf(0.00);
|
||||||
|
List<SltAgreementInfo> leaseList = new ArrayList<>();
|
||||||
|
List<SltAgreementInfo> oneOfListLease = sltAgreementInfoMapper.getLeaseList(sltAgreementInfo);
|
||||||
|
leaseList.addAll(oneOfListLease);
|
||||||
|
for (SltAgreementInfo bean : leaseList) {
|
||||||
|
if (null == bean.getLeasePrice()) {
|
||||||
|
bean.setLeasePrice(BigDecimal.valueOf(0.00));
|
||||||
|
}
|
||||||
|
if (null == bean.getNum()) {
|
||||||
|
bean.setNum(BigDecimal.valueOf(0L));
|
||||||
|
}
|
||||||
|
if (null == bean.getLeaseDays()) {
|
||||||
|
bean.setLeaseDay(0L);
|
||||||
|
}
|
||||||
|
BigDecimal leasePrice = bean.getLeasePrice();
|
||||||
|
BigDecimal num = bean.getNum();
|
||||||
|
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
|
||||||
|
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays);
|
||||||
|
if(costs!=null){
|
||||||
|
totalCostLease = totalCostLease.add(costs);
|
||||||
|
}
|
||||||
|
bean.setCosts(costs);
|
||||||
|
}
|
||||||
|
List<SltLeaseInfo> lease = Convert.toList(SltLeaseInfo.class, leaseList);
|
||||||
|
|
||||||
|
//丢失费用明细
|
||||||
|
BigDecimal totalCostLose = BigDecimal.valueOf(0.00);
|
||||||
|
List<SltAgreementInfo> loseList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<SltAgreementInfo> oneOfListLose = sltAgreementInfoMapper.getLoseList(sltAgreementInfo);
|
||||||
|
loseList.addAll(oneOfListLose);
|
||||||
|
for (SltAgreementInfo bean : loseList) {
|
||||||
|
if (null == bean.getBuyPrice()) {
|
||||||
|
bean.setBuyPrice(BigDecimal.valueOf(0.00));
|
||||||
|
}
|
||||||
|
if (null == bean.getNum()) {
|
||||||
|
bean.setNum(BigDecimal.valueOf(0L));
|
||||||
|
}
|
||||||
|
BigDecimal buyPrice = bean.getBuyPrice();
|
||||||
|
BigDecimal num = bean.getNum();
|
||||||
|
// 原价 x 数量
|
||||||
|
BigDecimal costs = buyPrice.multiply(num);
|
||||||
|
if(costs!=null){
|
||||||
|
totalCostLose = totalCostLose.add(costs);
|
||||||
|
}
|
||||||
|
//计算租赁费用
|
||||||
|
bean.setCosts(costs);
|
||||||
|
}
|
||||||
|
List<SltLeaseInfo> lose = Convert.toList(SltLeaseInfo.class, loseList);
|
||||||
|
|
||||||
|
//维修费用明细
|
||||||
|
BigDecimal totalCostRepair = BigDecimal.valueOf(0.00);
|
||||||
|
List<SltAgreementInfo> repairList = new ArrayList<>();
|
||||||
|
List<TmTask> taskListRepair = taskMapper.getTaskIdList(sltAgreementInfo);
|
||||||
|
if (null != taskListRepair && !taskListRepair.isEmpty()) {
|
||||||
|
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskListRepair);
|
||||||
|
repairList.addAll(repairDetailsList);
|
||||||
|
}
|
||||||
|
for (SltAgreementInfo bean : repairList) {
|
||||||
|
if (bean.getCosts()!=null && (bean.getPartType().equals("收费"))) {
|
||||||
|
totalCostRepair = totalCostRepair.add(bean.getCosts());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<SltLeaseInfo> repair = Convert.toList(SltLeaseInfo.class, repairList);
|
||||||
|
|
||||||
|
//报废费用明细
|
||||||
|
BigDecimal totalCostScrap = BigDecimal.valueOf(0.00);
|
||||||
|
List<SltAgreementInfo> scrapList = new ArrayList<>();
|
||||||
|
List<TmTask> taskListScrap = taskMapper.getTaskIdList(sltAgreementInfo);
|
||||||
|
if (null != taskListScrap && !taskListScrap.isEmpty()) {
|
||||||
|
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskListScrap);
|
||||||
|
scrapList.addAll(scrapDetailsList);
|
||||||
|
}
|
||||||
|
for (SltAgreementInfo bean : scrapList) {
|
||||||
|
if (bean.getCosts()!=null && (bean.getPartType().equals("收费"))) {
|
||||||
|
totalCostScrap = totalCostScrap.add(bean.getCosts());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<SltLeaseInfo> scrap = Convert.toList(SltLeaseInfo.class, scrapList);
|
||||||
|
|
||||||
|
expOutExcelAll(response,lease,lose,repair,scrap,fileName,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算记录查询--导出全部明细
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "导出全部结算费用明细")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@SysLog(title = "结算记录查询", businessType = OperaType.EXPORT, logType = 1,module = "结算记录查询->导出全部结算费用明细")
|
||||||
|
@PostMapping("/exportAlls")
|
||||||
|
public void exportAlls(HttpServletResponse response, SltAgreementInfo sltAgreementInfo) {
|
||||||
try {
|
try {
|
||||||
String fileName = "结算费用明细";
|
String fileName = "结算费用明细";
|
||||||
String projectName = sltAgreementInfo.getProjectName();
|
String projectName = sltAgreementInfo.getProjectName();
|
||||||
|
|
@ -814,7 +977,7 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
List<SltLeaseInfo> reduction = Convert.toList(SltLeaseInfo.class, reductionList);
|
List<SltLeaseInfo> reduction = Convert.toList(SltLeaseInfo.class, reductionList);
|
||||||
|
|
||||||
expOutExcelAll(response,lease,lose,repair,scrap,reduction,fileName,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
|
expOutExcelAlls(response,lease,lose,repair,scrap,reduction,fileName,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.toString(), e);
|
log.error(e.toString(), e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue