|
@@ -880,14 +880,11 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
|
|
|
return result;
|
|
|
}
|
|
|
String load="D:\\单证模板\\预装箱单新.xlsx";
|
|
|
- File file=new File(load);
|
|
|
- TemplateExportParams templateExcelConstants=new TemplateExportParams(file.getAbsolutePath(),true,"预装箱单汇总");
|
|
|
- Map<Integer, Map<String, Object>> maps = new HashMap<>();
|
|
|
- templateExcelConstants.setColForEach(true);
|
|
|
- Workbook workbook = ExcelExportUtil.exportExcel(maps,templateExcelConstants);
|
|
|
+ TemplateExportParams params = new TemplateExportParams(load);
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(params, new HashMap<>());
|
|
|
+ refreshSheet(workbook,pageLists);
|
|
|
ServletOutputStream outputStream = response.getOutputStream();
|
|
|
workbook.write(outputStream);
|
|
|
- refreshSheet(workbook,pageLists);
|
|
|
result.setCode(200);
|
|
|
result.setResult(pageLists.get(0));
|
|
|
result.setMessage("导出成功!");
|
|
@@ -904,12 +901,36 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
|
|
|
}
|
|
|
|
|
|
protected static void refreshSheet(Workbook workbook,List<SyPreAssembledPackingListVo> mains ) {
|
|
|
+
|
|
|
+ CellStyle cellStyle = workbook.createCellStyle();
|
|
|
+
|
|
|
+ cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ cellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
|
|
|
+ cellStyle.setFillBackgroundColor(HSSFColor.HSSFColorPredefined.YELLOW.getIndex());
|
|
|
+ cellStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ cellStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ cellStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ cellStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+ cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
+
|
|
|
+ CellStyle cellStyle2 = workbook.createCellStyle();
|
|
|
+ cellStyle2.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ cellStyle2.setWrapText(true);
|
|
|
+ cellStyle2.setBorderBottom(BorderStyle.THIN);
|
|
|
+ cellStyle2.setBorderTop(BorderStyle.THIN);
|
|
|
+ cellStyle2.setBorderLeft(BorderStyle.THIN);
|
|
|
+ cellStyle2.setBorderRight(BorderStyle.THIN);
|
|
|
+ cellStyle2.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ cellStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
+
|
|
|
Iterator sheets=workbook.sheetIterator();
|
|
|
+ workbook.setSheetName(0,"测试数据");
|
|
|
if (sheets.hasNext()){
|
|
|
Sheet sheet=(Sheet) sheets.next();
|
|
|
- System.out.println("sheets.size\t"+sheet);
|
|
|
+
|
|
|
Map<String,Object> maps=new HashMap<>();
|
|
|
- SyPreAssembledPackingListVo sysCount=new SyPreAssembledPackingListVo();
|
|
|
+ SyPreAssembledPackingListVo sysCount=new SyPreAssembledPackingListVo();
|
|
|
sysCount.setTotal(new BigDecimal("0"));
|
|
|
sysCount.setTotalBoxes(new BigDecimal("0"));
|
|
|
sysCount.setTotalGrossWeight(new BigDecimal("0"));
|
|
@@ -936,17 +957,70 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
|
|
|
int num=0;
|
|
|
for (String key : maps.keySet()) {
|
|
|
List<SyPreAssembledPackingListVo> sys = (List<SyPreAssembledPackingListVo>) maps.get(key);
|
|
|
+ SyPreAssembledPackingListVo sysGroupCount=new SyPreAssembledPackingListVo();
|
|
|
+ sysGroupCount.setTotal(new BigDecimal("0"));
|
|
|
+ sysGroupCount.setTotalBoxes(new BigDecimal("0"));
|
|
|
+ sysGroupCount.setTotalGrossWeight(new BigDecimal("0"));
|
|
|
+ sysGroupCount.setTotalNetWeight(new BigDecimal("0"));
|
|
|
+ sysGroupCount.setTotalVolume(new BigDecimal("0"));
|
|
|
for (SyPreAssembledPackingListVo sy : sys){
|
|
|
- Row row = sheet.createRow( num);
|
|
|
+ Row row = sheet.createRow(num+1);
|
|
|
+ sysGroupCount.setTotal(sysGroupCount.getTotal().add(sy.getTotal()));
|
|
|
+ sysGroupCount.setTotalBoxes(sysGroupCount.getTotalBoxes().add(sy.getTotalBoxes()));
|
|
|
+ sysGroupCount.setTotalGrossWeight(sysGroupCount.getTotalGrossWeight().add(sy.getTotalGrossWeight()));
|
|
|
+ sysGroupCount.setTotalNetWeight(sysGroupCount.getTotalNetWeight().add(sy.getTotalNetWeight()));
|
|
|
+ sysGroupCount.setTotalVolume(sysGroupCount.getTotalVolume().add(sy.getTotalVolume()));
|
|
|
String [] strs=sy.str().split(",");
|
|
|
for (int i=0; i<strs.length;i++){
|
|
|
- Cell cell = row.createCell(i+1);
|
|
|
- cell.setCellValue("1134134");
|
|
|
- System.out.println("strs"+i+""+strs[i]);
|
|
|
+ Cell cell = row.createCell(i);
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ cell.setCellValue(strs[i]);
|
|
|
+
|
|
|
}
|
|
|
num++;
|
|
|
}
|
|
|
+ Row row = sheet.createRow(num+1);
|
|
|
+ Cell cell = row.createCell(9);
|
|
|
+
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+ cell.setCellValue("分组合计");
|
|
|
+ Cell cell1 = row.createCell(10);
|
|
|
+ cell1.setCellStyle(cellStyle);
|
|
|
+ cell1.setCellValue(sysGroupCount.getTotal().toString());
|
|
|
+ Cell cell2 = row.createCell(11);
|
|
|
+ cell2.setCellStyle(cellStyle);
|
|
|
+ cell2.setCellValue(sysGroupCount.getTotalBoxes().toString());
|
|
|
+ Cell cell3 = row.createCell(12);
|
|
|
+ cell3.setCellStyle(cellStyle);
|
|
|
+ cell3.setCellValue(sysGroupCount.getTotalNetWeight().toString());
|
|
|
+ Cell cell4 = row.createCell(13);
|
|
|
+ cell4.setCellStyle(cellStyle);
|
|
|
+ cell4.setCellValue(sysGroupCount.getTotalGrossWeight().toString());
|
|
|
+ Cell cell5 = row.createCell(14);
|
|
|
+ cell5.setCellStyle(cellStyle);
|
|
|
+ cell5.setCellValue(sysGroupCount.getTotalVolume().toString());
|
|
|
+ num++;
|
|
|
}
|
|
|
+ Row row = sheet.createRow(num+1);
|
|
|
+ Cell cell = row.createCell(9);
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+ cell.setCellValue("所有数据合计");
|
|
|
+ Cell cell1 = row.createCell(10);
|
|
|
+ cell1.setCellStyle(cellStyle);
|
|
|
+ cell1.setCellValue(sysCount.getTotal().toString());
|
|
|
+ Cell cell2 = row.createCell(11);
|
|
|
+ cell2.setCellStyle(cellStyle);
|
|
|
+ cell2.setCellValue(sysCount.getTotalBoxes().toString());
|
|
|
+ Cell cell3 = row.createCell(12);
|
|
|
+ cell3.setCellStyle(cellStyle);
|
|
|
+ cell3.setCellValue(sysCount.getTotalNetWeight().toString());
|
|
|
+ Cell cell4 = row.createCell(13);
|
|
|
+ cell4.setCellStyle(cellStyle);
|
|
|
+ cell4.setCellValue(sysCount.getTotalGrossWeight().toString());
|
|
|
+ Cell cell5 = row.createCell(14);
|
|
|
+ cell5.setCellStyle(cellStyle);
|
|
|
+ cell5.setCellValue(sysCount.getTotalVolume().toString());
|
|
|
+ num++;
|
|
|
}
|
|
|
}
|
|
|
|