use of com.bc.pmpheep.back.po.DecAcadeReward in project pmph by BCSquad.
the class WordHelper method fillDecAcadeRewardData.
private XWPFTable fillDecAcadeRewardData(XWPFTable table, List<DecAcadeReward> decAcadeRewards) {
if (CollectionUtil.isEmpty(decAcadeRewards)) {
return table;
}
if (decAcadeRewards.size() > 1) {
int height = table.getRow(1).getHeight();
for (int i = 1; i < decAcadeRewards.size(); i++) {
table.createRow().setHeight(height);
}
}
List<XWPFTableRow> rows = table.getRows();
List<XWPFTableCell> cells;
int rowCount = 1;
for (DecAcadeReward decAcadeReward : decAcadeRewards) {
cells = rows.get(rowCount).getTableCells();
String value = decAcadeReward.getRewardName();
if (StringUtil.notEmpty(value)) {
cells.get(0).setText(value);
}
Date rewardDate = decAcadeReward.getRewardDate();
if (null != rewardDate) {
value = sdf.format(rewardDate);
cells.get(1).setText(value);
}
Integer type = decAcadeReward.getAwardUnit();
if (null != type) {
switch(type) {
case 0:
value = "无";
break;
case 1:
value = "国际";
break;
case 2:
value = "国家";
break;
case 3:
value = "省部";
break;
case 4:
value = "市";
break;
default:
value = "其他";
break;
}
cells.get(2).setText(value);
}
value = decAcadeReward.getNote();
if (StringUtil.notEmpty(value)) {
cells.get(3).setText(value);
}
for (XWPFTableCell cell : cells) {
cell.setVerticalAlignment(XWPFVertAlign.CENTER);
}
rowCount++;
}
return table;
}
Aggregations