建议先去看文档
异常代码
double actCostSum=0.0;
double stuCoreSumCost = (double)map.get("typeStuCoreSumCost");
double medicineSumCost = (double)map.get("typeMedicineSumCost");
double supSumCost = (double)map.get("typeSupSumCost");
double otherSumCost = (double)map.get("typeOtherSumCost");
double otherCoreActBedSum = (double)map.get("typeArticleSumCost");
BigDecimal decimal = NumberUtil.add(stuCoreSumCost, medicineSumCost, supSumCost, otherSumCost, otherCoreActBedSum);
actCostSum= decimal.doubleValue();
map.put("actCostSum",actCostSum);
// 附加总成本(赠药费用和人力成本)
double preManCostSum=0.0;
double mediSumCost =(double) map.get("typeFreeMediSumCost");
double manSumCost = (double)map.get("typeManSumCost");
preManCostSum = NumberUtil.add(mediSumCost, manSumCost);
map.put("preManCostSum",preManCostSum);
// 项目总费用(实际成本/+附加总成本)
double proCostSum=0.0;
proCostSum= NumberUtil.add(actCostSum,preManCostSum);
map.put("proCostSum",proCostSum);
// 逐年分解
List<CtmsProYearResolve> ctmsProYearResolves = proYearResolveMapper.selectList(new LambdaQueryWrapperX<CtmsProYearResolve>()
.eq(CtmsProYearResolve::getProjectId, projectId));
List<YearResolveExportVO> yearResolveExportVOS=new ArrayList<>();
if(CollUtil.isNotEmpty(ctmsProYearResolves)){
for(CtmsProYearResolve resolve:ctmsProYearResolves){
YearResolveExportVO exportVO=new YearResolveExportVO();
double ratio = Double.parseDouble(resolve.getRatio()) / 100;
double sub = NumberUtil.mul(ratio, actCostSum);
double pre = NumberUtil.mul(ratio, preManCostSum);
double sum = NumberUtil.add(sub, pre);
exportVO.setRatio(resolve.getRatio()+"%");
exportVO.setExecuteYear(resolve.getExecuteYear());
exportVO.setActOutCostSum(String.valueOf(sub));
exportVO.setAdditionCostSum(String.valueOf(pre));
exportVO.setProYearCost(String.valueOf(sum));
yearResolveExportVOS.add(exportVO);
}
}
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
// 防止中文乱码
String fileName = URLEncoder.encode("项目费用信息", "UTF-8")
.replaceAll("\\+","%20");
response.setHeader("Content-disposition", "attachment;filename*=UTF-8''" + fileName + ExcelTypeEnum.XLSX.getValue());
//响应的输出流
outputStream = response.getOutputStream();
ClassPathResource classPathResource = new ClassPathResource("excel/projectCostConfig.xlsx");
InputStream templateFileName = classPathResource.getInputStream();
//String fileName = "D://" + "proCostConfig" + System.currentTimeMillis() + "demo.xlsx";
excelWriter = EasyExcel.write(outputStream).withTemplate(templateFileName).build();
WriteSheet writeSheet = EasyExcel.writerSheet().build();
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
excelWriter.fill(new FillWrapper("year", yearResolveExportVOS),fillConfig, writeSheet);
excelWriter.fill(map, writeSheet);
异常提示
大家尽量把问题一次性描述清楚,然后贴上全部异常,这样方便把问题一次性解决掉。
至少大家要符合一个原则就是,能让其他人复现出这个问题,如果无法复现,肯定无法解决。
问题描述
数据list有数据 下面的样式数据全都消失,,变成空白表格了,list为空,下面的map数据填充 正常填充 图一是模版 图二是list有数据的时候,图三是list为空的的时候
2条答案
按热度按时间fquxozlt1#
kyxcudwk2#
请问解决了吗 遇到同样的问题