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;
}
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;
}
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;
}
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);
}
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);
}
Aggregations