Search in sources :

Example 11 with DecTextbook

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;
}
Also used : BigInteger(java.math.BigInteger) XWPFTableCell(org.apache.poi.xwpf.usermodel.XWPFTableCell) DecTextbook(com.bc.pmpheep.back.po.DecTextbook) Date(java.util.Date) XWPFTableRow(org.apache.poi.xwpf.usermodel.XWPFTableRow)

Example 12 with DecTextbook

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);
}
Also used : DecTextbook(com.bc.pmpheep.back.po.DecTextbook) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 13 with 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;
}
Also used : DecTextbook(com.bc.pmpheep.back.po.DecTextbook) Date(java.util.Date)

Aggregations

DecTextbook (com.bc.pmpheep.back.po.DecTextbook)13 DecTextbookPmph (com.bc.pmpheep.back.po.DecTextbookPmph)6 Date (java.util.Date)6 DecAcade (com.bc.pmpheep.back.po.DecAcade)5 DecCourseConstruction (com.bc.pmpheep.back.po.DecCourseConstruction)5 DecEduExp (com.bc.pmpheep.back.po.DecEduExp)5 DecLastPosition (com.bc.pmpheep.back.po.DecLastPosition)5 DecNationalPlan (com.bc.pmpheep.back.po.DecNationalPlan)5 DecResearch (com.bc.pmpheep.back.po.DecResearch)5 DecTeachExp (com.bc.pmpheep.back.po.DecTeachExp)5 DecWorkExp (com.bc.pmpheep.back.po.DecWorkExp)5 ArrayList (java.util.ArrayList)5 DecAcadeReward (com.bc.pmpheep.back.po.DecAcadeReward)4 DecAchievement (com.bc.pmpheep.back.po.DecAchievement)4 DecClinicalReward (com.bc.pmpheep.back.po.DecClinicalReward)4 DecIntention (com.bc.pmpheep.back.po.DecIntention)4 DecMonograph (com.bc.pmpheep.back.po.DecMonograph)4 DecMoocDigital (com.bc.pmpheep.back.po.DecMoocDigital)4 DecPublishReward (com.bc.pmpheep.back.po.DecPublishReward)4 DecSci (com.bc.pmpheep.back.po.DecSci)4