导出总表
parent
e9c81f41e9
commit
40c791e911
|
@ -35,6 +35,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 项目管理功能
|
||||
|
@ -150,6 +151,37 @@ public class ProjectController extends BaseController {
|
|||
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
|
||||
CashFlowBean cashFlowBean = projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails);
|
||||
exportExcelUtils.exportBudgetExcel(budgetBean, cashFlowBean, 0, "项目预算信息", outputStream, project.getOtherName());
|
||||
//收入明细
|
||||
List<ProjectBudgetIncomeDetail> budgetIncomeDetail = projectBudgetService.getBudgetIncomeDetail(project);
|
||||
Integer incomeTotalAmount = projectBudgetService.getBudgetIncomeAmount(project);
|
||||
String[] headers2 = {"序号", "类别", "名称", "单位", "数量", "单价", "税率(%)", "含税总金额(元)", "不含税金额(元)"};
|
||||
String[] columns2 = {"tempId", "type", "name", "unit", "amount", "price", "taxRate", "totalTaxInclude", "totalTaxExclude"};
|
||||
exportExcelUtils.exportIncomeDetailExcel(headers2, columns2, project, budgetBean, budgetIncomeDetail, incomeTotalAmount, "yyyy-MM-dd", 0, "收入明细表", outputStream);
|
||||
//成本明细
|
||||
List<ProjectBudgetCostDetail> budgetCostDetail = projectBudgetService.getBudgetCostDetail(project);
|
||||
Integer costTotalAmount = projectBudgetService.getBudgetCostAmount(project);
|
||||
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
|
||||
Map<Integer, String> procurementMap = procurementTypes.stream().collect(Collectors.toMap(ProcurementType::getId, ProcurementType::getName));
|
||||
String[] headers3 = {"序号", "大类", "类别", "名称", "单位", "数量", "单价", "税率(%)", "含税总金额(元)", "不含税金额(元)"};
|
||||
String[] columns3 = {"tempId", "type", "category", "name", "unit", "amount", "price", "taxRate", "totalTaxInclude", "totalTaxExclude"};
|
||||
exportExcelUtils.exportCostDetailExcel(headers3, columns3, project, budgetBean, budgetCostDetail, costTotalAmount, procurementMap, "yyyy-MM-dd", 0, "采购成本明细表", outputStream);
|
||||
//项目管理成本明细
|
||||
List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail = projectBudgetService.getBudgetCostProjectManageDetail(project);
|
||||
Integer costProjectManageTotalAmount = projectBudgetService.getBudgetCostProjectManageAmount(project);
|
||||
String[] headers4 = {"序号", "财务费用类别", "业务项目", "项目明细", "单位", "数量", "单价", "总金额(元)", "预估计算防范", "预估依据", "备注"};
|
||||
String[] columns4 = {"tempId", "type", "name", "detail", "unit", "amount", "price", "total", "predictMethod", "predictWhy", "remark"};
|
||||
exportExcelUtils.exportCostManageDetailExcel(headers4, columns4, project, budgetBean, budgetCostProjectManageDetail, costProjectManageTotalAmount, "yyyy-MM-dd", 0, "项目管理成本表", outputStream);
|
||||
//资金计划明细
|
||||
// ProjectBudgetPlanDetail projectBudgetPlanDetailTotalTitle = projectBudgetService.getProjectBudgetPlanDetailTotalTitle(project,
|
||||
// budgetIncomeDetail,
|
||||
// budgetCostDetail,
|
||||
// budgetCostProjectManageDetail,
|
||||
// projectBudgetPlanDetails);
|
||||
ProjectBudgetPlanDetail projectBudgetPlanDetailTotal = projectBudgetService.getProjectBudgetPlanDetailTotal(project, projectBudgetPlanDetails);
|
||||
String[] headers5 = {"月份", "设备支出", "工程支出(含服务+施工+其他)", "经营性开支", "保证金支出", "支出合计", "销售收款", "保证金收款", "收款合计", "资金余额", "资金利息", "垫资计划", "还款计划"};
|
||||
String[] row5 = {"month", "deviceCost", "engineerCost", "projectManageCost", "earnestMoneyCost", "totalCost", "saleIncome", "earnestMoneyIncome", "totalIncome", "fundBalance", "capitalInterest", "underwrittenPlan", "repaymentPlan"};
|
||||
exportExcelUtils.exportPlanDetailExcel(headers5, row5, project, budgetBean, projectBudgetPlanDetails, projectBudgetPlanDetailTotal, "yyyy-MM-dd", 0, "资金计划表", outputStream);
|
||||
|
||||
List<String> timeList = projectSettleIncomeRepository.findAllByProjectIdAndGroupByTime(project.getId());
|
||||
for (String time : timeList) {
|
||||
SettleBean settleBean = projectSettleService.getMonthSettle(project, time);
|
||||
|
|
|
@ -552,4 +552,140 @@ public class Project {
|
|||
public void setPlanEndStr(String planEndStr) {
|
||||
this.planEndStr = planEndStr;
|
||||
}
|
||||
|
||||
public String getUnderwrittenModeDesc() {
|
||||
return underwrittenModeDesc;
|
||||
}
|
||||
|
||||
public void setUnderwrittenModeDesc(String underwrittenModeDesc) {
|
||||
this.underwrittenModeDesc = underwrittenModeDesc;
|
||||
}
|
||||
|
||||
public String getCertainty() {
|
||||
return certainty;
|
||||
}
|
||||
|
||||
public void setCertainty(String certainty) {
|
||||
this.certainty = certainty;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfit() {
|
||||
return grossProfit;
|
||||
}
|
||||
|
||||
public void setGrossProfit(BigDecimal grossProfit) {
|
||||
this.grossProfit = grossProfit;
|
||||
}
|
||||
|
||||
public BigDecimal getGrossProfitMargin() {
|
||||
return grossProfitMargin;
|
||||
}
|
||||
|
||||
public void setGrossProfitMargin(BigDecimal grossProfitMargin) {
|
||||
this.grossProfitMargin = grossProfitMargin;
|
||||
}
|
||||
|
||||
public BigDecimal getHuizhiProductAmount() {
|
||||
return huizhiProductAmount;
|
||||
}
|
||||
|
||||
public void setHuizhiProductAmount(BigDecimal huizhiProductAmount) {
|
||||
this.huizhiProductAmount = huizhiProductAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getHuasanProductAmount() {
|
||||
return huasanProductAmount;
|
||||
}
|
||||
|
||||
public void setHuasanProductAmount(BigDecimal huasanProductAmount) {
|
||||
this.huasanProductAmount = huasanProductAmount;
|
||||
}
|
||||
|
||||
public String getPrincipal() {
|
||||
return principal;
|
||||
}
|
||||
|
||||
public void setPrincipal(String principal) {
|
||||
this.principal = principal;
|
||||
}
|
||||
|
||||
public Date getContractTime() {
|
||||
return contractTime;
|
||||
}
|
||||
|
||||
public void setContractTime(Date contractTime) {
|
||||
this.contractTime = contractTime;
|
||||
}
|
||||
|
||||
public Date getBidsTime() {
|
||||
return bidsTime;
|
||||
}
|
||||
|
||||
public void setBidsTime(Date bidsTime) {
|
||||
this.bidsTime = bidsTime;
|
||||
}
|
||||
|
||||
public String getIsSecondStr() {
|
||||
return isSecondStr;
|
||||
}
|
||||
|
||||
public void setIsSecondStr(String isSecondStr) {
|
||||
this.isSecondStr = isSecondStr;
|
||||
}
|
||||
|
||||
public String getSignTypeStr() {
|
||||
return signTypeStr;
|
||||
}
|
||||
|
||||
public void setSignTypeStr(String signTypeStr) {
|
||||
this.signTypeStr = signTypeStr;
|
||||
}
|
||||
|
||||
public String getResolvePlanStr() {
|
||||
return resolvePlanStr;
|
||||
}
|
||||
|
||||
public void setResolvePlanStr(String resolvePlanStr) {
|
||||
this.resolvePlanStr = resolvePlanStr;
|
||||
}
|
||||
|
||||
public String getMainContractResolvePlan() {
|
||||
return mainContractResolvePlan;
|
||||
}
|
||||
|
||||
public void setMainContractResolvePlan(String mainContractResolvePlan) {
|
||||
this.mainContractResolvePlan = mainContractResolvePlan;
|
||||
}
|
||||
|
||||
public String getCalculationCollection() {
|
||||
return CalculationCollection;
|
||||
}
|
||||
|
||||
public void setCalculationCollection(String calculationCollection) {
|
||||
CalculationCollection = calculationCollection;
|
||||
}
|
||||
|
||||
public String getContractRound() {
|
||||
return contractRound;
|
||||
}
|
||||
|
||||
public void setContractRound(String contractRound) {
|
||||
this.contractRound = contractRound;
|
||||
}
|
||||
|
||||
public String getHuazhiRound() {
|
||||
return huazhiRound;
|
||||
}
|
||||
|
||||
public void setHuazhiRound(String huazhiRound) {
|
||||
this.huazhiRound = huazhiRound;
|
||||
}
|
||||
|
||||
public String getZiguangRound() {
|
||||
return ziguangRound;
|
||||
}
|
||||
|
||||
public void setZiguangRound(String ziguangRound) {
|
||||
this.ziguangRound = ziguangRound;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package cn.palmte.work.utils.excel;
|
||||
|
||||
import cn.palmte.work.bean.*;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.utils.DateKit;
|
||||
import cn.palmte.work.utils.ObjectKit;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
|
@ -18,6 +18,7 @@ import java.io.IOException;
|
|||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -820,4 +821,328 @@ public class ExportExcelUtils {
|
|||
workbook.close();
|
||||
out.close();
|
||||
}
|
||||
|
||||
public void exportIncomeDetailExcel(String[] headers, String[] columns, Project project, BudgetBean budgetBean, List<ProjectBudgetIncomeDetail> budgetIncomeDetail, Integer incomeTotalAmount, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
|
||||
// 遍历集合数据,产生数据行
|
||||
int index = rowIndex;
|
||||
XSSFSheet sheet = workbook.createSheet(sheetName);
|
||||
sheet.setDefaultColumnWidth((short)20);
|
||||
Font font3 = workbook.createFont();
|
||||
font3.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex());
|
||||
Row title = sheet.createRow(index++);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
Cell firstCell = title.createCell(i);
|
||||
firstCell.setCellStyle(style);
|
||||
firstCell.setCellType(CellType.STRING);
|
||||
firstCell.setCellValue(headers[i]);
|
||||
}
|
||||
for (int i = 0; i < budgetIncomeDetail.size(); i++) {
|
||||
ProjectBudgetIncomeDetail incomeDetail = budgetIncomeDetail.get(i);
|
||||
Row row = sheet.createRow(index++);
|
||||
for (int j = 0; j < headers.length; j++) {
|
||||
Cell secondCell = row.createCell(j);
|
||||
secondCell.setCellStyle(style2);
|
||||
Object value = ObjectKit.get(incomeDetail, columns[j]);
|
||||
if ("tempId".equals(columns[j])) {
|
||||
value = i + 1;
|
||||
} else if ("type".equals(columns[j])) {
|
||||
if ((Integer) value == 1) {
|
||||
value = "设备类";
|
||||
} else if ((Integer) value == 2) {
|
||||
value = "工程类";
|
||||
} else if ((Integer) value == 3) {
|
||||
value = "服务类";
|
||||
}
|
||||
}
|
||||
if (value == null) {
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
secondCell.setCellValue("");
|
||||
} else {
|
||||
if (value instanceof Integer) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((int) value);
|
||||
} else if (value instanceof Long) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((long) value);
|
||||
} else if (value instanceof Double) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((double) value);
|
||||
} else if (value instanceof BigDecimal) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue(Utils.format(((BigDecimal) value)));
|
||||
} else if (value instanceof Date) {
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
String date_str = DateKit.toStr((Date) value, pattern);
|
||||
secondCell.setCellValue(date_str);
|
||||
} else {
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
secondCell.setCellValue(value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Row total = sheet.createRow(index);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
Cell totalCell = total.createCell(i);
|
||||
totalCell.setCellStyle(style2);
|
||||
if (i == 0) {
|
||||
totalCell.setCellType(CellType.STRING);
|
||||
totalCell.setCellValue("总计");
|
||||
} else if (i == 4) {
|
||||
totalCell.setCellType(CellType.NUMERIC);
|
||||
totalCell.setCellValue(incomeTotalAmount);
|
||||
} else if (i == 7) {
|
||||
totalCell.setCellType(CellType.NUMERIC);
|
||||
totalCell.setCellValue(Utils.format(budgetBean.getIncomeTotalTaxInclude()));
|
||||
} else if (i == 8) {
|
||||
totalCell.setCellType(CellType.NUMERIC);
|
||||
totalCell.setCellValue(Utils.format(budgetBean.getIncomeTotalTaxExclude()));
|
||||
} else {
|
||||
totalCell.setCellType(CellType.STRING);
|
||||
totalCell.setCellValue("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void exportCostDetailExcel(String[] headers, String[] columns, Project project, BudgetBean budgetBean, List<ProjectBudgetCostDetail> budgetCostDetail, Integer costTotalAmount, Map<Integer, String> procurementMap, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
|
||||
// 遍历集合数据,产生数据行
|
||||
int index = rowIndex;
|
||||
XSSFSheet sheet = workbook.createSheet(sheetName);
|
||||
sheet.setDefaultColumnWidth((short)20);
|
||||
Font font3 = workbook.createFont();
|
||||
font3.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex());
|
||||
Row title = sheet.createRow(index++);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
Cell firstCell = title.createCell(i);
|
||||
firstCell.setCellStyle(style);
|
||||
firstCell.setCellType(CellType.STRING);
|
||||
firstCell.setCellValue(headers[i]);
|
||||
}
|
||||
for (int i = 0; i < budgetCostDetail.size(); i++) {
|
||||
ProjectBudgetCostDetail costDetail = budgetCostDetail.get(i);
|
||||
Row row = sheet.createRow(index++);
|
||||
for (int j = 0; j < headers.length; j++) {
|
||||
Cell secondCell = row.createCell(j);
|
||||
secondCell.setCellStyle(style2);
|
||||
Object value = ObjectKit.get(costDetail, columns[j]);
|
||||
if ("tempId".equals(columns[j])) {
|
||||
value = i + 1;
|
||||
} else if ("type".equals(columns[j])) {
|
||||
if ((Integer) value == 1) {
|
||||
value = "设备";
|
||||
} else if ((Integer) value == 2) {
|
||||
value = "施工";
|
||||
} else if ((Integer) value == 3) {
|
||||
value = "服务";
|
||||
} else if ((Integer) value == 4) {
|
||||
value = "其他";
|
||||
}
|
||||
} else if ("category".equals(columns[j])) {
|
||||
value = procurementMap.get(value);
|
||||
}
|
||||
if (value == null) {
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
secondCell.setCellValue("");
|
||||
} else {
|
||||
if (value instanceof Integer) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((int) value);
|
||||
} else if (value instanceof Long) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((long) value);
|
||||
} else if (value instanceof Double) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((double) value);
|
||||
} else if (value instanceof BigDecimal) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue(Utils.format(((BigDecimal) value)));
|
||||
} else if (value instanceof Date) {
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
String date_str = DateKit.toStr((Date) value, pattern);
|
||||
secondCell.setCellValue(date_str);
|
||||
} else {
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
secondCell.setCellValue(value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Row total = sheet.createRow(index);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
Cell totalCell = total.createCell(i);
|
||||
totalCell.setCellStyle(style2);
|
||||
if (i == 0) {
|
||||
totalCell.setCellType(CellType.STRING);
|
||||
totalCell.setCellValue("总计");
|
||||
} else if (i == 5) {
|
||||
totalCell.setCellType(CellType.NUMERIC);
|
||||
totalCell.setCellValue(costTotalAmount);
|
||||
} else if (i == 8) {
|
||||
totalCell.setCellType(CellType.NUMERIC);
|
||||
totalCell.setCellValue(Utils.format(budgetBean.getCostTotalTaxInclude()));
|
||||
} else if (i == 9) {
|
||||
totalCell.setCellType(CellType.NUMERIC);
|
||||
totalCell.setCellValue(Utils.format(budgetBean.getCostTotalTaxExclude()));
|
||||
} else {
|
||||
totalCell.setCellType(CellType.STRING);
|
||||
totalCell.setCellValue("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void exportCostManageDetailExcel(String[] headers, String[] columns, Project project, BudgetBean budgetBean, List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail, Integer costProjectManageTotalAmount, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
|
||||
// 遍历集合数据,产生数据行
|
||||
int index = rowIndex;
|
||||
XSSFSheet sheet = workbook.createSheet(sheetName);
|
||||
sheet.setDefaultColumnWidth((short)20);
|
||||
Font font3 = workbook.createFont();
|
||||
font3.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex());
|
||||
Row title = sheet.createRow(index++);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
Cell firstCell = title.createCell(i);
|
||||
firstCell.setCellStyle(style);
|
||||
firstCell.setCellType(CellType.STRING);
|
||||
firstCell.setCellValue(headers[i]);
|
||||
}
|
||||
for (int i = 0; i < budgetCostProjectManageDetail.size(); i++) {
|
||||
ProjectBudgetCostProjectManageDetail costManageDetail = budgetCostProjectManageDetail.get(i);
|
||||
Row row = sheet.createRow(index++);
|
||||
for (int j = 0; j < headers.length; j++) {
|
||||
Cell secondCell = row.createCell(j);
|
||||
secondCell.setCellStyle(style2);
|
||||
Object value = ObjectKit.get(costManageDetail, columns[j]);
|
||||
if ("tempId".equals(columns[j])) {
|
||||
value = i + 1;
|
||||
} else if ("type".equals(columns[j])) {
|
||||
if ((Integer) value == 1) {
|
||||
value = "人工成本";
|
||||
} else if ((Integer) value == 2) {
|
||||
value = "业务费用";
|
||||
} else if ((Integer) value == 3) {
|
||||
value = "其他费用";
|
||||
}
|
||||
}
|
||||
if (value == null) {
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
secondCell.setCellValue("");
|
||||
} else {
|
||||
if (value instanceof Integer) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((int) value);
|
||||
} else if (value instanceof Long) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((long) value);
|
||||
} else if (value instanceof Double) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((double) value);
|
||||
} else if (value instanceof BigDecimal) {
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue(Utils.format(((BigDecimal) value)));
|
||||
} else if (value instanceof Date) {
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
String date_str = DateKit.toStr((Date) value, pattern);
|
||||
secondCell.setCellValue(date_str);
|
||||
} else {
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
secondCell.setCellValue(value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Row total = sheet.createRow(index);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
Cell totalCell = total.createCell(i);
|
||||
totalCell.setCellStyle(style2);
|
||||
if (i == 0) {
|
||||
totalCell.setCellType(CellType.STRING);
|
||||
totalCell.setCellValue("总计");
|
||||
} else if (i == 5) {
|
||||
totalCell.setCellType(CellType.NUMERIC);
|
||||
totalCell.setCellValue(costProjectManageTotalAmount);
|
||||
} else if (i == 7) {
|
||||
totalCell.setCellType(CellType.NUMERIC);
|
||||
totalCell.setCellValue(Utils.format(budgetBean.getCostProjectManageTaxExclude()));
|
||||
} else {
|
||||
totalCell.setCellType(CellType.STRING);
|
||||
totalCell.setCellValue("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void exportPlanDetailExcel(String[] headers, String[] rows, Project project, BudgetBean budgetBean, List<ProjectBudgetPlanDetail> projectBudgetPlanDetails, ProjectBudgetPlanDetail projectBudgetPlanDetailTotal, String pattern, int rowIndex, String sheetName, ServletOutputStream outputStream) {
|
||||
// 遍历集合数据,产生数据行
|
||||
int index = rowIndex;
|
||||
XSSFSheet sheet = workbook.createSheet(sheetName);
|
||||
sheet.setDefaultColumnWidth((short)20);
|
||||
Font font3 = workbook.createFont();
|
||||
font3.setColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex());
|
||||
for (int i = 0; i < rows.length; i++){
|
||||
Row row = sheet.createRow(index++);
|
||||
Cell firstCell = row.createCell(0);
|
||||
firstCell.setCellStyle(style);
|
||||
firstCell.setCellType(CellType.STRING);
|
||||
firstCell.setCellValue(headers[i]);
|
||||
Cell secondCell = row.createCell(1);
|
||||
secondCell.setCellStyle(style2);
|
||||
Object value = ObjectKit.get(projectBudgetPlanDetailTotal, rows[i]);
|
||||
if (i == 0) {
|
||||
value = "合计";
|
||||
}
|
||||
if(value == null){
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
secondCell.setCellValue("");
|
||||
}else{
|
||||
if(value instanceof Integer){
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((int)value);
|
||||
} else if(value instanceof Long){
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((long)value);
|
||||
} else if(value instanceof Double){
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue((double)value);
|
||||
} else if(value instanceof BigDecimal){
|
||||
secondCell.setCellType(CellType.NUMERIC);
|
||||
secondCell.setCellValue(Utils.format(((BigDecimal)value)));
|
||||
} else if(value instanceof Date){
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
String date_str = DateKit.toStr((Date) value, pattern);
|
||||
secondCell.setCellValue(date_str);
|
||||
} else{
|
||||
secondCell.setCellType(CellType.STRING);
|
||||
secondCell.setCellValue(value.toString());
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < projectBudgetPlanDetails.size(); j++) {
|
||||
Cell nextCell = row.createCell(j + 2);
|
||||
nextCell.setCellStyle(style2);
|
||||
Object value2 = ObjectKit.get(projectBudgetPlanDetails.get(j), rows[i]);
|
||||
if(value == null){
|
||||
nextCell.setCellType(CellType.STRING);
|
||||
nextCell.setCellValue("");
|
||||
}else{
|
||||
if(value instanceof Integer){
|
||||
nextCell.setCellType(CellType.NUMERIC);
|
||||
nextCell.setCellValue((int)value2);
|
||||
} else if(value instanceof Long){
|
||||
nextCell.setCellType(CellType.NUMERIC);
|
||||
nextCell.setCellValue((long)value2);
|
||||
} else if(value instanceof Double){
|
||||
nextCell.setCellType(CellType.NUMERIC);
|
||||
nextCell.setCellValue((double)value2);
|
||||
} else if(value instanceof BigDecimal){
|
||||
nextCell.setCellType(CellType.NUMERIC);
|
||||
nextCell.setCellValue(Utils.format(((BigDecimal)value2)));
|
||||
} else if(value instanceof Date){
|
||||
nextCell.setCellType(CellType.STRING);
|
||||
String date_str = DateKit.toStr((Date) value2, pattern);
|
||||
nextCell.setCellValue(date_str);
|
||||
} else{
|
||||
nextCell.setCellType(CellType.STRING);
|
||||
nextCell.setCellValue(value2.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue