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表格对象
Workbook workbook = new XSSFWorkbook();
int i = 1;
int a = 2;
for (TableVo.CompeteAllCount1 competeAllCount : 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));
cells.add(poiUtilCel);
}
}
PoiUtil.PoiUtilCell poiUtilCell = new PoiUtil.PoiUtilCell();
poiUtilCell.setValue("");
poiUtilCell.setFunction("C1:Q1");
poiUtilCell.setFunction("sum(C"+a+":Q"+a+")");
cells.add(poiUtilCell);
list.add(cells);
i++;
a++;
}
//生成excel表格对象,并将数据放入
Workbook wbs = PoiUtil.exportWB("比赛报名汇总表", list, workbook);

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

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

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

@ -743,8 +743,8 @@
IF
(
(
( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player ) )
OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member ) )
( 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 WHERE rec_status = 0) )
),
1,
0
@ -839,8 +839,8 @@
IF
(
(
( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player ) )
OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member ) )
( 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 WHERE rec_status = 0) )
),
1,
0

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

@ -178,9 +178,14 @@ public class PoiUtil {
CellStyle style = wb.createCellStyle();
//设置内容
if (!WebConstant.CELL_NULL.equals(cell.value)){
if(cell.num == 1){
newCell.setCellValue(Integer.parseInt(cell.value));
}else {
// if(cell.num == 1){
// newCell.setCellValue(Integer.parseInt(cell.value));
// }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);
}
}
@ -623,17 +628,19 @@ public class PoiUtil {
PoiUtilCell poiUtilCell = new PoiUtilCell();
poiUtilCell.setValue("111222333");
poiUtilCell.setColspan(3);
PoiUtilCell poiUtilCella = new PoiUtilCell();
PoiUtilCell poiUtilCellb = new PoiUtilCell();
poiUtilCell.setColspan(1);
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<>();
cells.add(poiUtilCell);
cells.add(poiUtilCella);
cells.add(poiUtilCellb);
cells.add(poiUtilCell1);
cells.add(poiUtilCell2);
List<List<PoiUtilCell>> list = new ArrayList<>();
list.add(cells);

Loading…
Cancel
Save