|
@@ -27,7 +27,7 @@ public class MaterialGenerateServiceImpl implements MaterialGenerateService {
|
|
|
private static final int LINE_NUMBER = 30;
|
|
|
private static final int STUDENT_NUMBER_ROW = 2;
|
|
|
private static final int FONT_SIZE = 12;
|
|
|
- private static final int LINE_HEIGHT = 23;
|
|
|
+ private static final int LINE_HEIGHT = 22;
|
|
|
|
|
|
@Override
|
|
|
public File generateSignInForm(MaterialTitleInfo title, List<StudentApplyVO> studentList) {
|
|
@@ -67,90 +67,96 @@ public class MaterialGenerateServiceImpl implements MaterialGenerateService {
|
|
|
|
|
|
private void createSignInTable(List<StudentApplyVO> tempList, Document doc) {
|
|
|
Table tableTitle = tableTitle();
|
|
|
- int number = LINE_NUMBER;
|
|
|
- if (tempList.size() < LINE_NUMBER) {
|
|
|
- number = tempList.size();
|
|
|
- }
|
|
|
+ int number = Math.min(tempList.size(), LINE_NUMBER);
|
|
|
for (int i = 0; i < number; i++) {
|
|
|
StudentApplyVO result = null;
|
|
|
if (tempList.size() >= i + 1) {
|
|
|
result = tempList.get(i);
|
|
|
- tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getName() : " ")
|
|
|
- .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
- .setFontSize(FONT_SIZE));
|
|
|
- tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getStudentCode() : " ")
|
|
|
- .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
- .setFontSize(FONT_SIZE));
|
|
|
- tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getSeatNumber() : " ")
|
|
|
- .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
- .setFontSize(FONT_SIZE));
|
|
|
- tableTitle.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE));
|
|
|
+ tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getName() : " ").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getStudentCode() : " ").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getSeatNumber() : " ").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(FONT_SIZE).setHeight(LINE_HEIGHT));
|
|
|
} else {
|
|
|
- tableTitle.addCell(new Cell().add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
- tableTitle.addCell(new Cell().add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
- tableTitle.addCell(new Cell().add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
- tableTitle.addCell(new Cell().add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
}
|
|
|
if (tempList.size() >= i + number + 1) {
|
|
|
result = tempList.get(i + 30);
|
|
|
- tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getName() : " ")
|
|
|
- .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
- .setFontSize(FONT_SIZE));
|
|
|
- tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getStudentCode() : " ")
|
|
|
- .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
- .setFontSize(FONT_SIZE));
|
|
|
- tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getSeatNumber() : " ")
|
|
|
- .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
- .setFontSize(FONT_SIZE));
|
|
|
- tableTitle.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE));
|
|
|
+ tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getName() : " ").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getStudentCode() : " ").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(new Cell(1, 1).add(result != null ? result.getSeatNumber() : " ").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(FONT_SIZE).setHeight(LINE_HEIGHT));
|
|
|
} else {
|
|
|
- tableTitle.addCell(new Cell().add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
- tableTitle.addCell(new Cell().add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
- tableTitle.addCell(new Cell().add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
- tableTitle.addCell(new Cell().add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
+ tableTitle.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(10).setHeight(LINE_HEIGHT));
|
|
|
}
|
|
|
}
|
|
|
doc.add(tableTitle);
|
|
|
}
|
|
|
|
|
|
private Table subHead(MaterialTitleInfo title, int studentSize, int titleFontSize) {
|
|
|
- Table table = new Table(new float[] { 1f, 1f }).setWidthPercent(100);
|
|
|
+ Table table = new Table(new float[] { 1.2f, 1f }).setWidthPercent(100);
|
|
|
table.addCell(new Cell(1, 1).add("考点名称:" + title.getSiteName()).setTextAlignment(TextAlignment.LEFT)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null).setFontSize(titleFontSize)
|
|
|
- .setMarginLeft(20f));
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null).setFontSize(titleFontSize).setMarginLeft(20f));
|
|
|
table.addCell(new Cell(1, 1).add("考试时间:" + title.getTimePeriod()).setTextAlignment(TextAlignment.LEFT)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null).setFontSize(titleFontSize)
|
|
|
- .setMarginLeft(40f));
|
|
|
- table.addCell(new Cell(1, 1).add("考场名称:" + title.getAddress()).setTextAlignment(TextAlignment.LEFT)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null).setFontSize(titleFontSize)
|
|
|
- .setMarginLeft(20f));
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null).setFontSize(titleFontSize).setMarginLeft(40f));
|
|
|
+ String address = title.getAddress();
|
|
|
+ int fontSize = titleFontSize;
|
|
|
+ if(address != null && address.length()>17) {
|
|
|
+ fontSize = 10;
|
|
|
+ }
|
|
|
+ table.addCell(new Cell(1, 1).add("考场名称:" + address).setTextAlignment(TextAlignment.LEFT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null).setFontSize(fontSize).setMarginLeft(20f));
|
|
|
table.addCell(new Cell(1, 1).add("考生数量:" + studentSize).setTextAlignment(TextAlignment.LEFT)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null).setFontSize(titleFontSize)
|
|
|
- .setMarginLeft(40f));
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null).setFontSize(titleFontSize).setMarginLeft(40f));
|
|
|
return table;
|
|
|
}
|
|
|
|
|
|
private Table tableTitle() {
|
|
|
Table signTable = new Table(new float[] { 1f, 1.3f, 0.5f, 1f, 1f, 1.3f, 0.5f, 1f }).setWidthPercent(100);
|
|
|
for (int i = 0; i < STUDENT_NUMBER_ROW; i++) {
|
|
|
- signTable.addCell(new Cell(1, 1).add("姓名").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setBold());
|
|
|
- signTable.addCell(new Cell(1, 1).add("学号").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setBold());
|
|
|
- signTable.addCell(new Cell(1, 1).add("座号").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setBold());
|
|
|
- signTable.addCell(new Cell(1, 1).add("签字").setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(FONT_SIZE).setBold());
|
|
|
+ signTable.addCell(
|
|
|
+ new Cell(1, 1).add("姓名").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(FONT_SIZE).setBold());
|
|
|
+ signTable.addCell(
|
|
|
+ new Cell(1, 1).add("学号").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(FONT_SIZE).setBold());
|
|
|
+ signTable.addCell(
|
|
|
+ new Cell(1, 1).add("座号").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(FONT_SIZE).setBold());
|
|
|
+ signTable.addCell(
|
|
|
+ new Cell(1, 1).add("签字").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(FONT_SIZE).setBold());
|
|
|
}
|
|
|
return signTable;
|
|
|
}
|