结算管理批量结算
This commit is contained in:
parent
bb3428c32f
commit
ac01898219
|
|
@ -250,9 +250,9 @@ public class PoiOutPage {
|
|||
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<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) {
|
||||
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,
|
||||
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) {
|
||||
// 创建工作簿和工作表
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
HSSFSheet sheet = workbook.createSheet();
|
||||
|
|
@ -383,13 +383,208 @@ public class PoiOutPage {
|
|||
}
|
||||
rowNum = createTotalRow(sheet, rowNum, listLose, totalCostLose, headerStyle);
|
||||
|
||||
/**
|
||||
* 减免费用明细
|
||||
*/
|
||||
// 填充标题行
|
||||
rowNum = createTitleRowStyleCost(sheet, rowNum, "减免费用明细", titleStyle, listReduction.size());
|
||||
// 填充表头
|
||||
rowNum = createHeaderRow(sheet, rowNum, listReduction, headerStyle);
|
||||
// 填充数据行
|
||||
if (resultsReduction != null && !resultsReduction.isEmpty()) {
|
||||
rowNum = createDataRows(sheet, rowNum, resultsReduction, contentStyle, listReduction.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) (listReduction.size() - 1)));
|
||||
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listReduction.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, listReduction, totalCostReduction, headerStyle);
|
||||
|
||||
|
||||
//合计
|
||||
BigDecimal totalCostAll = totalCostLease.add(totalCostLose).add(totalCostRepair).add(totalCostScrap);
|
||||
BigDecimal totalCostAll = totalCostLease.add(totalCostLose).add(totalCostRepair).add(totalCostScrap).add(totalCostReduction);
|
||||
rowNum = createTotalRowAll(sheet, rowNum, listScrap, totalCostAll, headerStyle);
|
||||
|
||||
return workbook;
|
||||
}
|
||||
|
||||
public static void excelForcheckEach(HSSFWorkbook workbook,HSSFSheet sheet,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 projectName, String unit,
|
||||
BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap,BigDecimal totalCostReduction) {
|
||||
|
||||
sheet.setDefaultColumnWidth(15); // 设置列宽
|
||||
|
||||
// 创建样式
|
||||
HSSFCellStyle titleStyle = createTitleStyle(workbook);
|
||||
HSSFCellStyle headerStyle = createHeaderStyle(workbook);
|
||||
HSSFCellStyle contentStyle = createCellStyleCost(workbook);
|
||||
|
||||
// // 设置工作簿名称
|
||||
// workbook.setSheetName(0, sheet.getSheetName());
|
||||
|
||||
// 填充标题行
|
||||
int rowNum = 0;
|
||||
rowNum = createTitleRowStyle(sheet, rowNum, "结算费用明细", 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);
|
||||
|
||||
/**
|
||||
* 减免费用明细
|
||||
*/
|
||||
// 填充标题行
|
||||
rowNum = createTitleRowStyleCost(sheet, rowNum, "减免费用明细", titleStyle, listReduction.size());
|
||||
// 填充表头
|
||||
rowNum = createHeaderRow(sheet, rowNum, listReduction, headerStyle);
|
||||
// 填充数据行
|
||||
if (resultsReduction != null && !resultsReduction.isEmpty()) {
|
||||
rowNum = createDataRows(sheet, rowNum, resultsReduction, contentStyle, listReduction.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) (listReduction.size() - 1)));
|
||||
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listReduction.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, listReduction, totalCostReduction, headerStyle);
|
||||
|
||||
|
||||
//合计
|
||||
BigDecimal totalCostAll = totalCostLease.add(totalCostLose).add(totalCostRepair).add(totalCostScrap).add(totalCostReduction);
|
||||
rowNum = createTotalRowAll(sheet, rowNum, listScrap, totalCostAll, headerStyle);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 结算记录查询--导出全部明细
|
||||
|
|
@ -922,7 +1117,7 @@ public class PoiOutPage {
|
|||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle createTitleStyle(HSSFWorkbook workbook) {
|
||||
public static HSSFCellStyle createTitleStyle(HSSFWorkbook workbook) {
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
|
@ -938,7 +1133,7 @@ public class PoiOutPage {
|
|||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle createHeaderStyle(HSSFWorkbook workbook) {
|
||||
public static HSSFCellStyle createHeaderStyle(HSSFWorkbook workbook) {
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
|
@ -996,7 +1191,7 @@ public class PoiOutPage {
|
|||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle createCellStyleCost(HSSFWorkbook workbook) {
|
||||
public static HSSFCellStyle createCellStyleCost(HSSFWorkbook workbook) {
|
||||
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.RegionUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
|
|
@ -269,18 +272,20 @@ public class SltAgreementInfoController extends BaseController {
|
|||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出结算单--all
|
||||
* @throws Exception
|
||||
*/
|
||||
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)
|
||||
private void expOutExcelAll(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)
|
||||
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>>();
|
||||
|
||||
List<Map<String, Object>> resultsReduction = new ArrayList<Map<String, Object>>();
|
||||
if (lease!= null) {
|
||||
int sizeLease = lease.size();
|
||||
for (int i = 0; i < sizeLease; i++) {
|
||||
|
|
@ -313,12 +318,22 @@ public class SltAgreementInfoController extends BaseController {
|
|||
resultsScrap.add(maps);
|
||||
}
|
||||
}
|
||||
if (reduction!= null) {
|
||||
int sizeReduction = reduction.size();
|
||||
for (int i = 0; i < sizeReduction; i++) {
|
||||
SltLeaseInfo bean = reduction.get(i);
|
||||
Map<String, Object> maps = outReceiveDetailsBeanToMap(bean,5,1);
|
||||
resultsReduction.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);
|
||||
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);
|
||||
OutputStream out = null;
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
response.addHeader("Content-Disposition",
|
||||
|
|
@ -883,25 +898,37 @@ public class SltAgreementInfoController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出结算信息列表--all
|
||||
* 各明细导出--all
|
||||
*/
|
||||
@ApiOperation(value = "导出结算信息列表")
|
||||
@ApiOperation(value = "各明细导出")
|
||||
@PreventRepeatSubmit
|
||||
// @RequiresPermissions("settlement:info:export")
|
||||
@SysLog(title = "结算信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出租赁明细")
|
||||
@PostMapping("/exportAll")
|
||||
public void exportAll(HttpServletResponse response, SltAgreementInfo sltAgreementInfo) {
|
||||
@SysLog(title = "结算信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->各明细导出")
|
||||
@PostMapping("/exportEach")
|
||||
public void exportEach(HttpServletResponse response, @RequestParam("params") String params) {
|
||||
try {
|
||||
String fileName = "结算明细";
|
||||
String projectName = sltAgreementInfo.getProjectName();
|
||||
String unitName = sltAgreementInfo.getUnitName();
|
||||
|
||||
String fileName = "结算费用明细";
|
||||
List<SltAgreementInfo> sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class);
|
||||
// List<String> projectNames = new ArrayList<>();
|
||||
// List<String> unitNames = new ArrayList<>();
|
||||
// 创建工作簿
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
int sheetIndex = 1;
|
||||
for (SltAgreementInfo info : sltAgreementInfo) {
|
||||
// 创建工作表
|
||||
HSSFSheet sheet = workbook.createSheet("sheet" + sheetIndex);
|
||||
// 处理单个info的导出逻辑
|
||||
List<String> projectNames = new ArrayList<>();
|
||||
List<String> unitNames = new ArrayList<>();
|
||||
projectNames.add(info.getProjectName());
|
||||
unitNames.add(info.getUnitName());
|
||||
//租赁费用明细
|
||||
BigDecimal totalCostLease = BigDecimal.valueOf(0.00);
|
||||
List<SltAgreementInfo> leaseList = new ArrayList<>();
|
||||
List<SltAgreementInfo> oneOfListLease = sltAgreementInfoMapper.getLeaseList(sltAgreementInfo);
|
||||
leaseList.addAll(oneOfListLease);
|
||||
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(info);
|
||||
leaseList.addAll(oneOfList);
|
||||
for (SltAgreementInfo bean : leaseList) {
|
||||
if (null == bean.getLeasePrice()) {
|
||||
bean.setLeasePrice(BigDecimal.valueOf(0.00));
|
||||
|
|
@ -926,8 +953,7 @@ public class SltAgreementInfoController extends BaseController {
|
|||
//丢失费用明细
|
||||
BigDecimal totalCostLose = BigDecimal.valueOf(0.00);
|
||||
List<SltAgreementInfo> loseList = new ArrayList<>();
|
||||
|
||||
List<SltAgreementInfo> oneOfListLose = sltAgreementInfoMapper.getLoseList(sltAgreementInfo);
|
||||
List<SltAgreementInfo> oneOfListLose = sltAgreementInfoMapper.getLoseList(info);
|
||||
loseList.addAll(oneOfListLose);
|
||||
for (SltAgreementInfo bean : loseList) {
|
||||
if (null == bean.getBuyPrice()) {
|
||||
|
|
@ -948,12 +974,13 @@ public class SltAgreementInfoController extends BaseController {
|
|||
}
|
||||
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);
|
||||
List<TmTask> taskList = taskMapper.getTaskIdList(info);
|
||||
if (null != taskList && !taskList.isEmpty()) {
|
||||
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList);
|
||||
repairList.addAll(repairDetailsList);
|
||||
}
|
||||
for (SltAgreementInfo bean : repairList) {
|
||||
|
|
@ -963,10 +990,11 @@ public class SltAgreementInfoController extends BaseController {
|
|||
}
|
||||
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);
|
||||
List<TmTask> taskListScrap = taskMapper.getTaskIdList(info);
|
||||
if (null != taskListScrap && !taskListScrap.isEmpty()) {
|
||||
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskListScrap);
|
||||
scrapList.addAll(scrapDetailsList);
|
||||
|
|
@ -978,21 +1006,109 @@ public class SltAgreementInfoController extends BaseController {
|
|||
}
|
||||
List<SltLeaseInfo> scrap = Convert.toList(SltLeaseInfo.class, scrapList);
|
||||
|
||||
expOutExcelAll(response,lease,lose,repair,scrap,fileName,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap);
|
||||
|
||||
//减免费用明细
|
||||
BigDecimal totalCostReduction = BigDecimal.valueOf(0.00);
|
||||
List<SltAgreementReduce> reductionList = new ArrayList<>();
|
||||
|
||||
if (info.getAgreementId() != null){
|
||||
SltAgreementReduce bean =new SltAgreementReduce();
|
||||
bean.setAgreementId(info.getAgreementId());
|
||||
List<SltAgreementReduce> oneOfListReduction = sltAgreementRecudceMapper.getReductionList(bean);
|
||||
reductionList.addAll(oneOfListReduction);
|
||||
}
|
||||
for (SltAgreementReduce reduction : reductionList) {
|
||||
if(reduction.getLeaseMoney()!=null){
|
||||
totalCostReduction = totalCostReduction.add(reduction.getLeaseMoney());
|
||||
}
|
||||
}
|
||||
List<SltLeaseInfo> reduction = Convert.toList(SltLeaseInfo.class, reductionList);
|
||||
String projectName = handleData(projectNames);
|
||||
String unitName = handleData(unitNames);
|
||||
|
||||
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>>();
|
||||
List<Map<String, Object>> resultsReduction = 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);
|
||||
}
|
||||
}
|
||||
if (reduction!= null) {
|
||||
int sizeReduction = reduction.size();
|
||||
for (int i = 0; i < sizeReduction; i++) {
|
||||
SltLeaseInfo bean = reduction.get(i);
|
||||
Map<String, Object> maps = outReceiveDetailsBeanToMap(bean,5,1);
|
||||
resultsReduction.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);
|
||||
List<String> headersReduction = receiveDetailsHeader(5,1);
|
||||
// 创建工作簿和工作表
|
||||
PoiOutPage.excelForcheckEach(workbook, sheet, resultsLease,resultsLose,resultsRepair,resultsScrap,resultsReduction, headersLease,headersLose,headersRepair,headersScrap,headersReduction,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
|
||||
|
||||
|
||||
// expOutExcelAll(response,lease,lose,repair,scrap,reduction,fileName,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
|
||||
sheetIndex++;
|
||||
}
|
||||
OutputStream out = null;
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
response.addHeader("Content-Disposition",
|
||||
"attachment;filename=" + URLEncoder.encode("各结算明细", "UTF-8") + ".xls");
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
out = response.getOutputStream();
|
||||
workbook.write(out);
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 结算记录查询--导出全部明细
|
||||
* 导出结算信息列表--all
|
||||
*/
|
||||
@ApiOperation(value = "导出全部结算费用明细")
|
||||
@ApiOperation(value = "导出结算信息列表")
|
||||
@PreventRepeatSubmit
|
||||
@SysLog(title = "结算记录查询", businessType = OperaType.EXPORT, logType = 1,module = "结算记录查询->导出全部结算费用明细")
|
||||
@PostMapping("/exportAlls")
|
||||
public void exportAlls(HttpServletResponse response, @RequestParam("params") String params) {
|
||||
// @RequiresPermissions("settlement:info:export")
|
||||
@SysLog(title = "结算信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出租赁明细")
|
||||
@PostMapping("/exportAll")
|
||||
public void exportAll(HttpServletResponse response, @RequestParam("params") String params) {
|
||||
try {
|
||||
String fileName = "结算费用明细";
|
||||
List<SltAgreementInfo> sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class);
|
||||
|
|
@ -1126,6 +1242,122 @@ public class SltAgreementInfoController extends BaseController {
|
|||
List<SltLeaseInfo> reduction = Convert.toList(SltLeaseInfo.class, reductionList);
|
||||
String projectName = handleData(projectNames);
|
||||
String unitName = handleData(unitNames);
|
||||
expOutExcelAll(response,lease,lose,repair,scrap,reduction,fileName,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
|
||||
} 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 {
|
||||
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);
|
||||
|
||||
//减免费用明细
|
||||
BigDecimal totalCostReduction = BigDecimal.valueOf(0.00);
|
||||
List<SltAgreementReduce> reductionList = new ArrayList<>();
|
||||
if (sltAgreementInfo.getAgreementId()!=null){
|
||||
SltAgreementReduce bean =new SltAgreementReduce();
|
||||
bean.setAgreementId(sltAgreementInfo.getAgreementId());
|
||||
reductionList = sltAgreementRecudceMapper.getReductionList(bean);
|
||||
for (SltAgreementReduce reduction : reductionList){
|
||||
if(reduction.getLeaseMoney()!=null){
|
||||
totalCostReduction = totalCostReduction.add(reduction.getLeaseMoney());
|
||||
}
|
||||
}
|
||||
}
|
||||
List<SltLeaseInfo> reduction = Convert.toList(SltLeaseInfo.class, reductionList);
|
||||
|
||||
expOutExcelAlls(response,lease,lose,repair,scrap,reduction,fileName,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue