Browse Source

1

tiaosheng
Lihong@123456 5 years ago
parent
commit
4adc089d09
  1. 5
      mt/src/main/java/com/ccsens/mt/service/ExcelService.java
  2. 1
      mt/src/main/resources/application.yml
  3. 8
      mt/src/main/resources/mapper_dao/CompeteScoreDao.xml
  4. 25
      util/src/main/java/com/ccsens/util/PoiUtil.java

5
mt/src/main/java/com/ccsens/mt/service/ExcelService.java

@ -842,6 +842,7 @@ public class ExcelService implements IExcelService {
//创建整个excel表格对象 //创建整个excel表格对象
Workbook workbook = new XSSFWorkbook(); Workbook workbook = new XSSFWorkbook();
int i = 1; int i = 1;
int a = 2;
for (TableVo.CompeteAllCount1 competeAllCount : arrayList) { for (TableVo.CompeteAllCount1 competeAllCount : arrayList) {
//行对象 //行对象
List<PoiUtil.PoiUtilCell> cells = new ArrayList<>(); List<PoiUtil.PoiUtilCell> cells = new ArrayList<>();
@ -857,14 +858,14 @@ public class ExcelService implements IExcelService {
PoiUtil.PoiUtilCell poiUtilCel = new PoiUtil.PoiUtilCell(competeAllCount.getNums().get(j)); PoiUtil.PoiUtilCell poiUtilCel = new PoiUtil.PoiUtilCell(competeAllCount.getNums().get(j));
cells.add(poiUtilCel); cells.add(poiUtilCel);
} }
} }
PoiUtil.PoiUtilCell poiUtilCell = new PoiUtil.PoiUtilCell(); PoiUtil.PoiUtilCell poiUtilCell = new PoiUtil.PoiUtilCell();
poiUtilCell.setValue(""); poiUtilCell.setValue("");
poiUtilCell.setFunction("C1:Q1"); poiUtilCell.setFunction("sum(C"+a+":Q"+a+")");
cells.add(poiUtilCell); cells.add(poiUtilCell);
list.add(cells); list.add(cells);
i++; i++;
a++;
} }
//生成excel表格对象,并将数据放入 //生成excel表格对象,并将数据放入
Workbook wbs = PoiUtil.exportWB("比赛报名汇总表", list, workbook); Workbook wbs = PoiUtil.exportWB("比赛报名汇总表", list, workbook);

1
mt/src/main/resources/application.yml

@ -3,3 +3,4 @@ spring:
active: dev active: dev
include: common, util-dev include: common, util-dev

8
mt/src/main/resources/mapper_dao/CompeteScoreDao.xml

@ -743,8 +743,8 @@
IF IF
( (
( (
( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player ) ) ( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player WHERE rec_status = 0) )
OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member ) ) OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member WHERE rec_status = 0) )
), ),
1, 1,
0 0
@ -839,8 +839,8 @@
IF IF
( (
( (
( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player ) ) ( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player WHERE rec_status = 0) )
OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member ) ) OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member WHERE rec_status = 0) )
), ),
1, 1,
0 0

25
util/src/main/java/com/ccsens/util/PoiUtil.java

@ -178,9 +178,14 @@ public class PoiUtil {
CellStyle style = wb.createCellStyle(); CellStyle style = wb.createCellStyle();
//设置内容 //设置内容
if (!WebConstant.CELL_NULL.equals(cell.value)){ if (!WebConstant.CELL_NULL.equals(cell.value)){
if(cell.num == 1){ // if(cell.num == 1){
newCell.setCellValue(Integer.parseInt(cell.value)); // newCell.setCellValue(Integer.parseInt(cell.value));
}else { // }else {
// newCell.setCellValue(cell.value);
// }
if (cell.value.length() <= 14 && cell.value.matches("\\d+")) {
newCell.setCellValue(Long.parseLong(cell.value));
} else {
newCell.setCellValue(cell.value); newCell.setCellValue(cell.value);
} }
} }
@ -623,17 +628,19 @@ public class PoiUtil {
PoiUtilCell poiUtilCell = new PoiUtilCell(); PoiUtilCell poiUtilCell = new PoiUtilCell();
poiUtilCell.setValue("111222333"); poiUtilCell.setValue("111222333");
poiUtilCell.setColspan(3); poiUtilCell.setColspan(1);
PoiUtilCell poiUtilCella = new PoiUtilCell();
PoiUtilCell poiUtilCellb = new PoiUtilCell();
PoiUtilCell poiUtilCell1 = new PoiUtilCell(); PoiUtilCell poiUtilCell1 = new PoiUtilCell();
poiUtilCell1.setValue("aaadddfffersdfsdfasftargadfgergsdfhasfgasfgaertagaergafdhsfgjfyk");
poiUtilCell1.setValue("123");
PoiUtilCell poiUtilCell2 = new PoiUtilCell();
poiUtilCell2.setValue("");
poiUtilCell2.setFunction("SUM(A1:B1)");
List<PoiUtilCell> cells = new ArrayList<>(); List<PoiUtilCell> cells = new ArrayList<>();
cells.add(poiUtilCell); cells.add(poiUtilCell);
cells.add(poiUtilCella);
cells.add(poiUtilCellb);
cells.add(poiUtilCell1); cells.add(poiUtilCell1);
cells.add(poiUtilCell2);
List<List<PoiUtilCell>> list = new ArrayList<>(); List<List<PoiUtilCell>> list = new ArrayList<>();
list.add(cells); list.add(cells);

Loading…
Cancel
Save