Search in sources :

Example 1 with DecEduExp

use of com.bc.pmpheep.back.po.DecEduExp in project pmph by BCSquad.

the class ExcelHelper method fillDecEduExpData.

private ColumnProperties fillDecEduExpData(List<DecEduExp> decEduExps, Row row, ColumnProperties properties) {
    int colCount = properties.getColCount();
    int[] maxLength = properties.getMaxLength();
    if (CollectionUtil.isEmpty(decEduExps)) {
        for (int i = 0; i < 4; i++) {
            row.createCell(colCount++);
        }
    } else {
        String value;
        List<StringBuilder> builders = new ArrayList<>(3);
        for (int i = 0; i < 4; i++) {
            builders.add(new StringBuilder());
        }
        boolean isFirst = true;
        for (DecEduExp decEduExp : decEduExps) {
            if (isFirst == false) {
                for (StringBuilder builder : builders) {
                    builder.append("\r\n");
                }
            } else {
                isFirst = false;
            }
            int index = 0;
            String dateBegin = decEduExp.getDateBegin();
            String dateEnd = decEduExp.getDateEnd();
            if (StringUtil.isEmpty(dateBegin)) {
                dateBegin = " ";
            }
            if (StringUtil.isEmpty(dateEnd)) {
                dateEnd = "至今";
            }
            value = dateBegin.concat(" ~ ").concat(dateEnd);
            builders.get(index++).append(value);
            if (value.length() / 2 + 1 > maxLength[colCount]) {
                maxLength[colCount] = value.length() / 2 + 1;
            }
            colCount++;
            value = decEduExp.getSchoolName();
            if (StringUtil.isEmpty(value)) {
                value = "";
            }
            builders.get(index++).append(value);
            if (value.length() > maxLength[colCount]) {
                maxLength[colCount] = value.length();
            }
            colCount++;
            value = decEduExp.getMajor();
            if (StringUtil.isEmpty(value)) {
                value = "";
            }
            builders.get(index++).append(value);
            if (value.length() > maxLength[colCount]) {
                maxLength[colCount] = value.length();
            }
            colCount++;
            value = decEduExp.getDegree();
            if (StringUtil.isEmpty(value)) {
                value = "";
            }
            builders.get(index++).append(value);
            if (value.length() > maxLength[colCount]) {
                maxLength[colCount] = value.length();
            }
            // 列数复位
            colCount = properties.getColCount();
        }
        for (int i = 0; i < 4; i++) {
            Cell cell = row.createCell(colCount++);
            value = builders.get(i).toString();
            cell.setCellValue(value);
        }
    }
    properties.setColCount(colCount);
    properties.setMaxLength(maxLength);
    return properties;
}
Also used : ArrayList(java.util.ArrayList) DecEduExp(com.bc.pmpheep.back.po.DecEduExp) Cell(org.apache.poi.ss.usermodel.Cell)

Example 2 with DecEduExp

use of com.bc.pmpheep.back.po.DecEduExp in project pmph by BCSquad.

the class WordHelper method fillDecEduExpData.

private XWPFTable fillDecEduExpData(XWPFTable table, List<DecEduExp> decEduExps) {
    if (CollectionUtil.isEmpty(decEduExps)) {
        return table;
    }
    if (decEduExps.size() > 1) {
        int height = table.getRow(1).getHeight();
        for (int i = 1; i < decEduExps.size(); i++) {
            table.createRow().setHeight(height);
        }
    }
    List<XWPFTableRow> rows = table.getRows();
    List<XWPFTableCell> cells;
    int rowCount = 1;
    for (DecEduExp decEduExp : decEduExps) {
        cells = rows.get(rowCount).getTableCells();
        String dateBegin = decEduExp.getDateBegin();
        if (StringUtil.isEmpty(dateBegin)) {
            dateBegin = "未知";
        }
        String dateEnd = decEduExp.getDateEnd();
        if (StringUtil.isEmpty(dateEnd)) {
            dateEnd = "至今";
        }
        String value = dateBegin.concat("~").concat(dateEnd);
        cells.get(0).setText(value);
        value = decEduExp.getSchoolName();
        if (StringUtil.notEmpty(value)) {
            cells.get(1).setText(value);
        }
        value = decEduExp.getMajor();
        if (StringUtil.notEmpty(value)) {
            cells.get(2).setText(value);
        }
        value = decEduExp.getDegree();
        if (StringUtil.notEmpty(value)) {
            cells.get(3).setText(value);
        }
        value = decEduExp.getNote();
        if (StringUtil.notEmpty(value)) {
            cells.get(4).setText(value);
        }
        for (XWPFTableCell cell : cells) {
            cell.setVerticalAlignment(XWPFVertAlign.CENTER);
        }
        rowCount++;
    }
    return table;
}
Also used : XWPFTableCell(org.apache.poi.xwpf.usermodel.XWPFTableCell) DecEduExp(com.bc.pmpheep.back.po.DecEduExp) XWPFTableRow(org.apache.poi.xwpf.usermodel.XWPFTableRow)

Example 3 with DecEduExp

use of com.bc.pmpheep.back.po.DecEduExp in project pmph by BCSquad.

the class DecEduExpServiceTest method add.

private DecEduExp add() {
    DecEduExp decEduExp = new DecEduExp();
    decEduExp.setDeclarationId(3L);
    decEduExp.setSchoolName("第三军医大学");
    decEduExp.setMajor("心理诊断学");
    decEduExp.setDegree("硕士研究生");
    decEduExp.setNote("精神分析流派");
    decEduExp.setDateBegin("1997-09");
    decEduExp.setDateEnd("2000-06");
    decEduExp.setSort(10);
    decEduExpService.addDecEduExp(decEduExp);
    DecEduExp decEduExp2 = new DecEduExp(5L, "首都医科大学", "神经学", "博士", "博士研究生", "2002-09", "2004-06", 15);
    decEduExpService.addDecEduExp(decEduExp2);
    DecEduExp decEduExp3 = new DecEduExp(3L, "北京师范大学", "发展心理学", "博士", "精神分析学派", "2001-09", "2003-06", 20);
    decEduExpService.addDecEduExp(decEduExp3);
    return decEduExp3;
}
Also used : DecEduExp(com.bc.pmpheep.back.po.DecEduExp)

Example 4 with DecEduExp

use of com.bc.pmpheep.back.po.DecEduExp in project pmph by BCSquad.

the class DecEduExpServiceTest method testUpdateDecEduExp.

@Test
@Rollback(Const.ISROLLBACK)
public void testUpdateDecEduExp() {
    DecEduExp decEduExp = add();
    decEduExp.setMajor("幸福心理学");
    decEduExp.setNote("专业选修");
    Integer count = decEduExpService.updateDecEduExp(decEduExp);
    Assert.assertTrue("更新数据失败", count > 0);
}
Also used : DecEduExp(com.bc.pmpheep.back.po.DecEduExp) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Example 5 with DecEduExp

use of com.bc.pmpheep.back.po.DecEduExp in project pmph by BCSquad.

the class DecEduExpServiceTest method testGetDecEduExp.

@Test
@Rollback(Const.ISROLLBACK)
public void testGetDecEduExp() {
    long id = add().getId();
    DecEduExp decEduExp = decEduExpService.getDecEduExpById(id);
    Assert.assertNotNull("获取学习经历相关信息失败", decEduExp);
}
Also used : DecEduExp(com.bc.pmpheep.back.po.DecEduExp) Test(org.junit.Test) BaseTest(com.bc.pmpheep.test.BaseTest) Rollback(org.springframework.test.annotation.Rollback)

Aggregations

DecEduExp (com.bc.pmpheep.back.po.DecEduExp)13 ArrayList (java.util.ArrayList)6 DecAcade (com.bc.pmpheep.back.po.DecAcade)5 DecCourseConstruction (com.bc.pmpheep.back.po.DecCourseConstruction)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 DecTextbook (com.bc.pmpheep.back.po.DecTextbook)5 DecWorkExp (com.bc.pmpheep.back.po.DecWorkExp)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 DecTextbookPmph (com.bc.pmpheep.back.po.DecTextbookPmph)4 DecExtensionVO (com.bc.pmpheep.back.vo.DecExtensionVO)4