|
|
@ -391,7 +391,9 @@ public class ExcelService implements IExcelService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public String competeAllCount(CompeteDto.CompeteTime params) throws IOException { |
|
|
|
return null; |
|
|
|
List<TableVo.CompeteAllCount> competeAllCountList = competeAllCountList(params); |
|
|
|
String path = getExcelFilePathForCompeteAllCount(competeAllCountList); |
|
|
|
return path; |
|
|
|
} |
|
|
|
|
|
|
|
// private List<TableVo.CompeteAllCount> competeAllCountList(CompeteDto.CompeteTime params){
|
|
|
@ -432,6 +434,95 @@ public class ExcelService implements IExcelService { |
|
|
|
return competePlayerDao.getTeamJoinNumByType(params.getCompeteTimeId()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getExcelFilePathForCompeteAllCount(List<TableVo.CompeteAllCount> arrayList) throws IOException { |
|
|
|
//创建excle表格对象
|
|
|
|
List<List<PoiUtil.PoiUtilCell>> list = new ArrayList<>(); |
|
|
|
//创建行对象
|
|
|
|
List<PoiUtil.PoiUtilCell> title = new ArrayList<>(); |
|
|
|
//给首行单元格赋值
|
|
|
|
title.add(new PoiUtil.PoiUtilCell("序号")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("参赛项目")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("小学男子组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("小学女子组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("小学混合组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("中学男子组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("中学女子组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("中学混合组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("高职院校男子组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("高职院校女子组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("高职院校混合组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("本科院校男子组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("本科院校女子组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("本科院校混合组")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("俱乐部男子组(14岁及以下)")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("俱乐部女子组(14岁及以下)")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("俱乐部混合组(14岁及以下)")); |
|
|
|
title.add(new PoiUtil.PoiUtilCell("合计")); |
|
|
|
list.add(title); |
|
|
|
//创建整个excel表格对象
|
|
|
|
Workbook workbook = new XSSFWorkbook(); |
|
|
|
int i = 1; |
|
|
|
for (TableVo.CompeteAllCount competeAllCount : arrayList) { |
|
|
|
//行对象
|
|
|
|
List<PoiUtil.PoiUtilCell> cells = new ArrayList<>(); |
|
|
|
cells.add(new PoiUtil.PoiUtilCell(i + "", 1, 1, 300, 18)); |
|
|
|
//单元格对象
|
|
|
|
PoiUtil.PoiUtilCell poiUtilCel15 = new PoiUtil.PoiUtilCell(competeAllCount.getProjectName()); |
|
|
|
cells.add(poiUtilCel15); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(0))); |
|
|
|
cells.add(poiUtilCel); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCell = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(1))); |
|
|
|
cells.add(poiUtilCell); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel2 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(2))); |
|
|
|
cells.add(poiUtilCel2); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel3 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(3))); |
|
|
|
cells.add(poiUtilCel3); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel4 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(4))); |
|
|
|
cells.add(poiUtilCel4); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel5 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(5))); |
|
|
|
cells.add(poiUtilCel5); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel6 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(6))); |
|
|
|
cells.add(poiUtilCel6); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel7 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(7))); |
|
|
|
cells.add(poiUtilCel7); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel8 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(8))); |
|
|
|
cells.add(poiUtilCel8); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel9 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(9))); |
|
|
|
cells.add(poiUtilCel9); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel10 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(10))); |
|
|
|
cells.add(poiUtilCel10); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel11 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(11))); |
|
|
|
cells.add(poiUtilCel11); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel12 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(12))); |
|
|
|
cells.add(poiUtilCel12); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel13 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(13))); |
|
|
|
cells.add(poiUtilCel13); |
|
|
|
PoiUtil.PoiUtilCell poiUtilCel14 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(14))); |
|
|
|
cells.add(poiUtilCel14); |
|
|
|
list.add(cells); |
|
|
|
i++; |
|
|
|
} |
|
|
|
//生成excel表格对象,并将数据放入
|
|
|
|
Workbook wbs = PoiUtil.exportWB("XXX比赛报名汇总表", list, workbook); |
|
|
|
//8:关联金山在线文档
|
|
|
|
String name = "参赛人数统计表" + ".xlsx"; |
|
|
|
String filepath = "mt/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".xlsx"; |
|
|
|
String path = PropUtil.path + filepath; |
|
|
|
// String path = filepath;
|
|
|
|
File tmpFile = new File(path); |
|
|
|
if (!tmpFile.getParentFile().exists()) { |
|
|
|
tmpFile.getParentFile().mkdirs(); |
|
|
|
} |
|
|
|
//PropUtil.path获取配置文件中的path属性,拼接生成写入信息的文件名,
|
|
|
|
File file = new File(path); |
|
|
|
OutputStream stream = new FileOutputStream(file); |
|
|
|
wbs.write(stream); |
|
|
|
stream.close(); |
|
|
|
return path; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|