use of com.bc.pmpheep.back.po.DecTextbook in project pmph by BCSquad.
the class WordHelper method fillDecTextbookData.
private XWPFTable fillDecTextbookData(XWPFTable table, List<DecTextbook> decTextbooks) {
if (CollectionUtil.isEmpty(decTextbooks)) {
return table;
}
if (decTextbooks.size() > 1) {
int height = table.getRow(1).getHeight();
for (int i = 1; i < decTextbooks.size(); i++) {
table.createRow().setHeight(height);
}
}
List<XWPFTableRow> rows = table.getRows();
List<XWPFTableCell> cells;
int rowCount = 1;
for (DecTextbook decTextbook : decTextbooks) {
cells = rows.get(rowCount).getTableCells();
String value = decTextbook.getMaterialName();
if (StringUtil.notEmpty(value)) {
cells.get(0).setText(value);
}
/* 0=无/1=国家/2=省部/3=协编/4=校本/5=其他教材 */
Integer rank = decTextbook.getRank();
if (null != rank) {
switch(rank) {
case 0:
value = "无";
case 1:
value = "国家";
break;
case 2:
value = "省部";
break;
case 3:
value = "协编";
break;
case 4:
value = "校本";
break;
case 5:
value = "其他教材";
break;
default:
value = "其他";
break;
}
cells.get(1).setText(value);
}
// 0=无/1=主编/2=副主编/3=编委
Integer position = decTextbook.getPosition();
if (null != position) {
switch(position) {
case 1:
value = "主编";
break;
case 2:
value = "副主编";
break;
case 3:
value = "编委";
break;
case 4:
value = "数字编委";
break;
default:
value = "无";
break;
}
cells.get(2).setText(value);
}
Date publishDate = decTextbook.getPublishDate();
if (null != publishDate) {
value = sdf.format(publishDate);
cells.get(3).setText(value);
}
value = decTextbook.getPublisher();
if (StringUtil.notEmpty(value)) {
cells.get(4).setText(value);
}
value = decTextbook.getIsbn();
if (StringUtil.notEmpty(value)) {
cells.get(5).setText(value);
}
value = decTextbook.getNote();
if (StringUtil.notEmpty(value)) {
cells.get(6).setText(value);
}
for (XWPFTableCell cell : cells) {
cell.setVerticalAlignment(XWPFVertAlign.CENTER);
}
rowCount++;
}
return table;
}
use of com.bc.pmpheep.back.po.DecTextbook in project pmph by BCSquad.
the class DecTextbookServiceTest method testGetDecTextbook.
@Test
@Rollback(Const.ISROLLBACK)
public void testGetDecTextbook() {
long id = add().getId();
DecTextbook decTextbook = decTextbookService.getDecTextbookById(id);
Assert.assertNotNull("获取作家教材编写情况信息失败", decTextbook);
}
use of com.bc.pmpheep.back.po.DecTextbook in project pmph by BCSquad.
the class DecTextbookServiceTest method add.
private DecTextbook add() {
DecTextbook decTextbook = new DecTextbook();
decTextbook.setDeclarationId(3L);
decTextbook.setMaterialName("神经脑科学");
decTextbook.setRank(1);
decTextbook.setPosition(1);
decTextbook.setPublisher("科学出版社");
decTextbook.setPublishDate(new Date());
decTextbook.setIsbn("123");
decTextbook.setNote("重点科目");
decTextbook.setSort(7);
decTextbookService.addDecTextbook(decTextbook);
DecTextbook decTextbook2 = new DecTextbook(2L, "人体解剖学", 1, true, 2, "人民卫生出版社", new Date(), "321", "一级学科", null);
decTextbookService.addDecTextbook(decTextbook2);
DecTextbook decTextbook3 = new DecTextbook(3L, "内科学", 3, true, 3, "机械出版社", null, "798", null, 6);
decTextbookService.addDecTextbook(decTextbook3);
return decTextbook3;
}
Aggregations