|
@@ -0,0 +1,1779 @@
|
|
|
+package cn.hmsoft.art.service.ly.material.written;
|
|
|
+
|
|
|
+import cn.hmsoft.application.SpringHelper;
|
|
|
+import cn.hmsoft.art.data.model.cf.CfAspect;
|
|
|
+import cn.hmsoft.art.data.model.ly.*;
|
|
|
+import cn.hmsoft.art.data.model.std.StdEnrol;
|
|
|
+import cn.hmsoft.art.helper.ArtFileHelper;
|
|
|
+import cn.hmsoft.art.helper.ArtParamHelper;
|
|
|
+import cn.hmsoft.frame.constants.FrameStatus;
|
|
|
+import cn.hmsoft.frame.constants.FrameThreadStatus;
|
|
|
+import cn.hmsoft.frame.data.model.FrameThread;
|
|
|
+import cn.hmsoft.frame.exception.BusinessException;
|
|
|
+import cn.hmsoft.frame.thread.FrameThreadHelper;
|
|
|
+import cn.hmsoft.helper.LocalDateHelper;
|
|
|
+import cn.hmsoft.helper.StringHelper;
|
|
|
+import cn.hmsoft.helper.pdf.ItextDocumentModel;
|
|
|
+import cn.hmsoft.helper.pdf.ItextPdfHelper;
|
|
|
+import cn.hmsoft.log.LogHelper;
|
|
|
+import com.itextpdf.io.font.PdfEncodings;
|
|
|
+import com.itextpdf.io.image.ImageDataFactory;
|
|
|
+import com.itextpdf.kernel.font.PdfFont;
|
|
|
+import com.itextpdf.kernel.font.PdfFontFactory;
|
|
|
+import com.itextpdf.layout.Document;
|
|
|
+import com.itextpdf.layout.border.Border;
|
|
|
+import com.itextpdf.layout.element.*;
|
|
|
+import com.itextpdf.layout.property.HorizontalAlignment;
|
|
|
+import com.itextpdf.layout.property.TextAlignment;
|
|
|
+import com.itextpdf.layout.property.VerticalAlignment;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.*;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description 央美附中考务材料
|
|
|
+ */
|
|
|
+public class WrittenMaterial10047FZ extends WrittenMaterialDefault {
|
|
|
+
|
|
|
+ /*****************
|
|
|
+ * 门贴
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public File makeWriteDoor(LyGroup group) {
|
|
|
+ Document doc = null;
|
|
|
+ try {
|
|
|
+ File tempFile = ArtFileHelper.createTempFile();
|
|
|
+ this.pageModel.rotate();
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setMargins(30, 30, 30, 30);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+
|
|
|
+ List<LyRoomWritten> roomArray = this.daoRoom.listRoom(group.getLy_group_id());
|
|
|
+
|
|
|
+ for (int roomIndex = 0; roomIndex < roomArray.size(); roomIndex++) {
|
|
|
+ LyRoomWritten room = roomArray.get(roomIndex);
|
|
|
+ if (room.getReal_std_total() < 1) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Paragraph p1;
|
|
|
+ Table mainTable = new Table(new float[] { 1, 3 }).setWidthPercent(100).setBorder(Border.NO_BORDER);
|
|
|
+ // 学校logo
|
|
|
+ Image imageLogo = null;
|
|
|
+ try {
|
|
|
+ String path = SpringHelper.WebServletContext.getRealPath("/") + "fonts" + File.separator + "school"
|
|
|
+ + File.separator + "10047.png";
|
|
|
+ imageLogo = new Image(ImageDataFactory.create(path)).scaleAbsolute(120, 80);
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ //标题部分
|
|
|
+ mainTable.addCell(new Cell(1, 1).add(imageLogo).setMarginTop(2).setMarginBottom(0).setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(20)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE)).setBorder(Border.NO_BORDER);
|
|
|
+
|
|
|
+ mainTable.addCell(new Cell(1, 1).add(ArtParamHelper.SchoolName)
|
|
|
+ .setMarginLeft(-18).setMarginTop(-15).setMarginBottom(0).setFontSize(30f).setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE)).setBorder(Border.NO_BORDER);
|
|
|
+ doc.add(mainTable);
|
|
|
+
|
|
|
+ //考场地址和考场编号部分
|
|
|
+ int fontsize = 60;
|
|
|
+ String roomName = room.getRoom_name();
|
|
|
+ if (roomName.length() > 12 && roomName.length() < 16) {
|
|
|
+ fontsize = 50;
|
|
|
+ } else if (roomName.length() > 16) {
|
|
|
+ fontsize = 43;
|
|
|
+ }
|
|
|
+ p1 = new Paragraph(roomName).setFontSize(fontsize).setBold().setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+ // 考场地址
|
|
|
+ p1 = new Paragraph(room.getRoom_addr()).setFontSize(40).setBold().setMarginTop(-10).setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ Map<String, Object> mainStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 1);
|
|
|
+ Map<String, Object> hkStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 2);
|
|
|
+ Map<String, Object> otherStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 3);
|
|
|
+
|
|
|
+ int ticketFontSize = 40;
|
|
|
+ int num = 0;
|
|
|
+ if (StringHelper.isNotEmpty(mainStd))
|
|
|
+ num++;
|
|
|
+ if (StringHelper.isNotEmpty(hkStd))
|
|
|
+ num++;
|
|
|
+ if (StringHelper.isNotEmpty(otherStd))
|
|
|
+ num++;
|
|
|
+ if (num == 2) {
|
|
|
+ ticketFontSize = 35;
|
|
|
+ } else if (num == 3) {
|
|
|
+ ticketFontSize = 32;
|
|
|
+ }
|
|
|
+ // 准考证范围
|
|
|
+ if (StringHelper.isNotEmpty(mainStd)) {
|
|
|
+ if (!mainStd.get("start_num").equals(mainStd.get("end_num"))) {
|
|
|
+ p1 = new Paragraph(mainStd.get("start_num").toString() + "---" + mainStd.get("end_num")).setMarginTop(-10).setFontSize(ticketFontSize)
|
|
|
+ .setBold().setTextAlignment(TextAlignment.CENTER);
|
|
|
+ } else {
|
|
|
+ p1 = new Paragraph(mainStd.get("start_num").toString()).setMarginTop(-10).setFontSize(ticketFontSize).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER);
|
|
|
+ }
|
|
|
+ doc.add(p1);
|
|
|
+ }
|
|
|
+ if (StringHelper.isNotEmpty(hkStd)) {
|
|
|
+ if (!hkStd.get("start_num").equals(hkStd.get("end_num"))) {
|
|
|
+ p1 = new Paragraph(hkStd.get("start_num").toString() + "---" + hkStd.get("end_num")).setMarginTop(-20).setFontSize(ticketFontSize)
|
|
|
+ .setBold().setTextAlignment(TextAlignment.CENTER);
|
|
|
+ } else {
|
|
|
+ p1 = new Paragraph(hkStd.get("start_num").toString()).setMarginTop(-20).setFontSize(ticketFontSize).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER);
|
|
|
+ }
|
|
|
+ doc.add(p1);
|
|
|
+ }
|
|
|
+ if (StringHelper.isNotEmpty(otherStd)) {
|
|
|
+ if (!otherStd.get("start_num").equals(otherStd.get("end_num"))) {
|
|
|
+ p1 = new Paragraph(otherStd.get("start_num").toString() + "---" + otherStd.get("end_num")).setMarginTop(-20).setFontSize(ticketFontSize)
|
|
|
+ .setBold().setTextAlignment(TextAlignment.CENTER);
|
|
|
+ } else {
|
|
|
+ p1 = new Paragraph(otherStd.get("start_num").toString()).setMarginTop(-20).setFontSize(ticketFontSize).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER);
|
|
|
+ }
|
|
|
+ doc.add(p1);
|
|
|
+ }
|
|
|
+
|
|
|
+ //考试科目
|
|
|
+ String group_name = StringHelper.isEmpty(group.getShow_aspect_name()) ? group.getGroup_name() : group.getShow_aspect_name();
|
|
|
+ p1 = new Paragraph(group_name).setFontSize(ticketFontSize).setBold().setTextAlignment(TextAlignment.CENTER).setMarginTop(-10);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ //考试时间
|
|
|
+ LySubject subject = this.daoGroup.find(LySubject.class, "ly_group_id", group.getLy_group_id());
|
|
|
+ p1 = new Paragraph(getExamTime(subject.getExam_start_time(), subject.getExam_end_time())).setFontSize(ticketFontSize).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ if (roomIndex < roomArray.size() - 1) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*****************
|
|
|
+ * 桌贴
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public File makeWriteSeat(FrameThread thread, File tempFile, LyGroup group, boolean image_flag) {
|
|
|
+ Document doc;
|
|
|
+ try {
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setMargins(0, 20, 10, 15);
|
|
|
+ doc.setBorder(null);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+ List<LyRoomWritten> roomArray = this.daoRoom.listRoom(group.getLy_group_id());
|
|
|
+ Map<LyRoomWritten, List<Map<String, Object>>> roomStdMap = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ FrameThreadHelper.updateThread(thread, 1, "一共有【" + roomArray.size() + "】个笔试考场", FrameThreadStatus.Running);
|
|
|
+ for (LyRoomWritten room : roomArray) {
|
|
|
+ roomStdMap.put(room, this.daoRoom.listRoomStd(group.getLy_group_id(), room));
|
|
|
+ }
|
|
|
+ int pageStdCount = 12;
|
|
|
+ int fontSize = 9;
|
|
|
+ int left = 1;
|
|
|
+ int marginTop = 0;
|
|
|
+ int rowHeight = 10;
|
|
|
+ int imageLeft = -25;
|
|
|
+ int rowNum = 5;
|
|
|
+ int roomNameSize = 9;
|
|
|
+
|
|
|
+ // 每行考生数
|
|
|
+ int roomIndex = 0;
|
|
|
+
|
|
|
+ for (List<Map<String, Object>> array : roomStdMap.values()) {
|
|
|
+ Table mainTable = new Table(new float[] { 1, 1 }).setWidthPercent(100).setBorder(null);
|
|
|
+ // 宽度 及无边框设置
|
|
|
+ boolean hasStd = false;
|
|
|
+ LyRoomWritten rw = new LyRoomWritten();
|
|
|
+ rw.setRoom_name(array.get(0).get("room_name").toString());
|
|
|
+ rw.setRoom_addr(array.get(0).get("room_addr").toString());
|
|
|
+ // 桌贴表头
|
|
|
+ createSeatTitle(doc, group, rw);
|
|
|
+
|
|
|
+ for (int stdIndex = 0; stdIndex < array.size(); stdIndex++) {
|
|
|
+ Map<String, Object> std = array.get(stdIndex);
|
|
|
+ //考生头像
|
|
|
+ Image imgStdUpload = ArtFileHelper.generateStdImage(std.containsKey("std_image") ? std.get("std_image").toString() : "cert.jpg");
|
|
|
+
|
|
|
+ if (StringHelper.isEmpty(std.get("ly_room_seq"))) {
|
|
|
+ rowNum = 4;
|
|
|
+ rowHeight = 27;
|
|
|
+ }
|
|
|
+ if (String.valueOf(std.get("room_name")).length() > 10) {
|
|
|
+ imageLeft = -15;
|
|
|
+ }
|
|
|
+ // 考场编号字体大小
|
|
|
+ if (String.valueOf(std.get("room_name")).length() > 20) {
|
|
|
+ roomNameSize = 5;
|
|
|
+ }
|
|
|
+ Table stdTable = new Table(new float[] { 1f, 1.7f, 1.3f }).setWidthPercent(100).setMarginTop(15).setBorder(null);
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("考场编号:")
|
|
|
+ .setBold().setMarginTop(2).setMarginBottom(0).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(20)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(rowHeight).setBorder(null));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("room_name").toString()).setBold()
|
|
|
+ .setMarginTop(2).setMarginBottom(0).setMarginLeft(left).setFontSize(roomNameSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null));
|
|
|
+ // 考生头像
|
|
|
+ stdTable.addCell(new Cell(rowNum, 1).add(imgStdUpload.scaleAbsolute(72, 90)).setFontSize(fontSize)
|
|
|
+ .setMarginLeft(imageLeft).setMarginBottom(0).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setBorder(null));
|
|
|
+
|
|
|
+ // 考场地址
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("考场地址:")
|
|
|
+ .setBold().setMarginTop(marginTop).setMarginBottom(0).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(20)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(rowHeight).setBorder(null));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("room_addr").toString()).setBold()
|
|
|
+ .setMarginBottom(0).setMarginLeft(left).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null));
|
|
|
+
|
|
|
+ // 座位号
|
|
|
+ if (StringHelper.isNotEmpty(std.get("ly_room_seq"))) {
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("座 位 号:")
|
|
|
+ .setBold().setMarginBottom(0).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(20)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(rowHeight).setBorder(null));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(String.valueOf(std.get("ly_room_seq"))).setBold()
|
|
|
+ .setMarginTop(marginTop).setMarginBottom(0).setMarginLeft(left).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 准考证号
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("准考证号:")
|
|
|
+ .setBold().setMarginBottom(0).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(20)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(rowHeight).setBorder(null));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(String.valueOf(std.get("ticket_no"))).setBold()
|
|
|
+ .setMarginBottom(0).setMarginLeft(left).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null));
|
|
|
+
|
|
|
+ //考生姓名
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("考生姓名:")
|
|
|
+ .setBold().setMarginBottom(0).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(20)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(rowHeight).setBorder(null));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(String.valueOf(std.get("std_name"))).setMarginLeft(left).setBold()
|
|
|
+ .setMarginBottom(0).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(null));
|
|
|
+
|
|
|
+ FrameThreadHelper.updateThread(thread, roomIndex * 100 / roomArray.size() - 3, "材料生成中......",
|
|
|
+ FrameThreadStatus.Running);
|
|
|
+
|
|
|
+ mainTable.addCell(new Cell(1, 1).add(stdTable).setBorder(null));
|
|
|
+
|
|
|
+ if (stdIndex > 0) {
|
|
|
+ // 判断分页
|
|
|
+ if ((stdIndex + 1) % pageStdCount == 0) {
|
|
|
+ doc.add(mainTable);
|
|
|
+ // 判断本考场是否还有考生
|
|
|
+ if (stdIndex != array.size() - 1) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ hasStd = true;
|
|
|
+ createSeatTitle(doc, group, rw);
|
|
|
+ } else {
|
|
|
+ // 没考生了
|
|
|
+ hasStd = false;
|
|
|
+ }
|
|
|
+ mainTable = new Table(new float[] { 1, 1 }).setWidthPercent(100).setBorder(null);
|
|
|
+ } else {
|
|
|
+ // 判断是不是最后一个考生
|
|
|
+ if (stdIndex == array.size() - 1) {
|
|
|
+ doc.add(mainTable);
|
|
|
+ hasStd = false;
|
|
|
+ mainTable = new Table(new float[] { 1, 1 }).setWidthPercent(100).setBorder(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (hasStd) {
|
|
|
+ doc.add(mainTable);
|
|
|
+ }
|
|
|
+ if (!hasStd && roomIndex == roomStdMap.keySet().size() - 1) {
|
|
|
+ doc.add(mainTable);
|
|
|
+ }
|
|
|
+ if (roomIndex < roomStdMap.keySet().size() - 1)
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ roomIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ FrameThreadHelper.completeThread(thread, "考务材料已生成!");
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ FrameThreadHelper.completeThread(thread, "材料生成出现内部错误,请检查字体大小设置是否正确", FrameThreadStatus.Error);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*****************
|
|
|
+ * 桌贴(无照片-桌贴备份)
|
|
|
+ */
|
|
|
+ public File makeWriteSeat_BK(FrameThread thread, File tempFile, LyGroup group, boolean image_flag) {
|
|
|
+ Document doc = null;
|
|
|
+ try {
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setMargins(0, 0, 0, 0);
|
|
|
+ doc.setBorder(null);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+ List<LyRoomWritten> roomArray = this.daoRoom.listRoom(group.getLy_group_id());
|
|
|
+ Map<LyRoomWritten, List<Map<String, Object>>> roomStdMap = new LinkedHashMap<LyRoomWritten, List<Map<String, Object>>>();
|
|
|
+
|
|
|
+ FrameThreadHelper.updateThread(thread, 1, "一共有【" + roomArray.size() + "】个笔试考场", FrameThreadStatus.Running);
|
|
|
+ for (LyRoomWritten room : roomArray) {
|
|
|
+ roomStdMap.put(room, this.daoRoom.listRoomStd(group.getLy_group_id(), room));
|
|
|
+ }
|
|
|
+
|
|
|
+ int pageStdCount = 30;
|
|
|
+
|
|
|
+ // 每行考生数
|
|
|
+ int roomIndex = 0;
|
|
|
+ for (List<Map<String, Object>> array : roomStdMap.values()) {
|
|
|
+ Table mainTable = new Table(new float[] { 1, 1, 1 }).setWidthPercent(100).setBorder(Border.NO_BORDER);
|
|
|
+ // 宽度 及无边框设置
|
|
|
+ boolean hasStd = false;
|
|
|
+ for (int stdIndex = 0; stdIndex < array.size(); stdIndex++) {
|
|
|
+ Map<String, Object> std = array.get(stdIndex);
|
|
|
+ Table stdTable = new Table(new float[] { 1.2f, 1 }).setWidthPercent(100).setBorder(Border.NO_BORDER)
|
|
|
+ .setMarginTop(17);
|
|
|
+ stdTable.addCell(new Cell(1, 2).add(
|
|
|
+ "央美招生 -- " + (StringHelper.isEmpty(group.getShow_aspect_name()) ? group.getGroup_name() : group.getShow_aspect_name()))
|
|
|
+ .setBold().setMarginLeft(-8)
|
|
|
+ .setMarginTop(2).setMarginBottom(0).setFontSize(12f).setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(30)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE)).setBorder(Border.NO_BORDER);
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("aspect_ticket_num").toString()).setBold()
|
|
|
+ .setMarginTop(-1).setMarginBottom(0).setMarginLeft(10).setFontSize(16f)
|
|
|
+ .setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.RIGHT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE)).setBorder(Border.NO_BORDER);
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("std_name").toString()).setFontSize(16f).setBold()
|
|
|
+ .setMarginLeft(2).setMarginTop(-1).setMarginBottom(0).setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE))
|
|
|
+ .setBorder(Border.NO_BORDER);
|
|
|
+
|
|
|
+ FrameThreadHelper.updateThread(thread, roomIndex * 100 / roomArray.size() - 3, "材料生成中......",
|
|
|
+ FrameThreadStatus.Running);
|
|
|
+
|
|
|
+ mainTable.addCell(new Cell(1, 1).add(stdTable).setMarginLeft(2).setBorder(Border.NO_BORDER));
|
|
|
+ if (stdIndex > 0) {
|
|
|
+ // 判断分页
|
|
|
+ if ((stdIndex + 1) % pageStdCount == 0) {
|
|
|
+ doc.add(mainTable);
|
|
|
+ // 判断本考场是否还有考生
|
|
|
+ if (stdIndex != array.size() - 1) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ hasStd = true;
|
|
|
+ } else {
|
|
|
+ // 没考生了
|
|
|
+ hasStd = false;
|
|
|
+ }
|
|
|
+ mainTable = new Table(new float[] { 1, 1, 1 }).setWidthPercent(100).setBorder(null);
|
|
|
+ } else {
|
|
|
+ // 判断是不是最后一个考生
|
|
|
+ if (stdIndex == array.size() - 1) {
|
|
|
+ doc.add(mainTable);
|
|
|
+ hasStd = false;
|
|
|
+ mainTable = new Table(new float[] { 1, 1, 1 }).setWidthPercent(100).setBorder(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (hasStd) {
|
|
|
+ doc.add(mainTable);
|
|
|
+ }
|
|
|
+ if (!hasStd && roomIndex == roomStdMap.keySet().size() - 1) {
|
|
|
+ doc.add(mainTable);
|
|
|
+ }
|
|
|
+ if (roomIndex < roomStdMap.keySet().size() - 1)
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ roomIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ FrameThreadHelper.completeThread(thread, "考务材料已生成!");
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ FrameThreadHelper.completeThread(thread, "材料生成出现内部错误,请检查字体大小设置是否正确", FrameThreadStatus.Error);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /********************
|
|
|
+ * 签字单
|
|
|
+ */
|
|
|
+ // @Override
|
|
|
+ public File makeWriteSign2(FrameThread thread, File tempFile, LyGroup group, List<LySubject> subjectArray, Integer subject_id) {
|
|
|
+ Document doc = null;
|
|
|
+ try {
|
|
|
+ tempFile.getParentFile().mkdirs();
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setMargins(30, 20, 20, 20);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+ List<LyRoomWritten> roomArray = this.daoRoom.listRoom(group.getLy_group_id());
|
|
|
+ Map<LyRoomWritten, List<Map<String, Object>>> roomStdMap = new LinkedHashMap<LyRoomWritten, List<Map<String, Object>>>();
|
|
|
+
|
|
|
+ FrameThreadHelper.updateThread(thread, 1, "一共有【" + roomArray.size() + "】个笔试考场", FrameThreadStatus.Running);
|
|
|
+ for (LyRoomWritten room : roomArray) {
|
|
|
+ List<Map<String, Object>> sArray = this.daoRoom.listRoomStd(group.getLy_group_id(), room);
|
|
|
+ if (sArray.size() == 0)
|
|
|
+ continue;
|
|
|
+ roomStdMap.put(room, sArray);
|
|
|
+ }
|
|
|
+
|
|
|
+ int pageStdCount = 15;
|
|
|
+ LyAgent agent = this.daoGroup.find(LyAgent.class, group.getLy_agent_id());
|
|
|
+
|
|
|
+ // 计算每个考生的margin
|
|
|
+ // 每行考生数
|
|
|
+ float[] mainCols = new float[5];
|
|
|
+ for (int i = 0; i < mainCols.length; i++)
|
|
|
+ mainCols[i] = 100 / mainCols.length;
|
|
|
+
|
|
|
+ int roomIndex = 0;
|
|
|
+ for (LyRoomWritten room : roomStdMap.keySet()) {
|
|
|
+ List<Map<String, Object>> array = roomStdMap.get(room);
|
|
|
+ Table mainTable = new Table(mainCols).setMarginTop(10);
|
|
|
+ // 宽度 及无边框设置
|
|
|
+ mainTable.setWidthPercent(100).setBorder(null).setMarginTop(-10);
|
|
|
+ this.createSignNewPage(doc, group, subjectArray, room);
|
|
|
+ boolean hasStd = false;
|
|
|
+ for (int stdIndex = 0; stdIndex < array.size(); stdIndex++) {
|
|
|
+ Map<String, Object> std = array.get(stdIndex);
|
|
|
+ Table stdTable = new Table(new float[] { 2.2f, 3 }).setWidthPercent(100).setBorder(null);
|
|
|
+ // 图片
|
|
|
+ Image imgStdUpload = ArtFileHelper.generateStdImage(
|
|
|
+ std.containsKey("std_image") ? std.get("std_image").toString() : "cert.jpg");
|
|
|
+
|
|
|
+ int row_margin = -2;
|
|
|
+
|
|
|
+ stdTable.addCell(new Cell(1, 2).setBorder(null).add(imgStdUpload.scaleAbsolute(72, 90))
|
|
|
+ .setMarginTop(0).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setMarginLeft(15));
|
|
|
+
|
|
|
+ // 身份证证号
|
|
|
+ stdTable.addCell(new Cell(1, 2).add(std.get("cert_id").toString()).setMarginTop(0).setFontSize(9)
|
|
|
+ .setBorder(null)).setTextAlignment(TextAlignment.CENTER).setBold()
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE);
|
|
|
+ // 准考证号
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(" 准考证:").setBorder(null).setMarginTop(row_margin)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.RIGHT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8).setMarginLeft(6));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("aspect_ticket_num").toString()).setBorder(null)
|
|
|
+ .setMarginTop(row_margin).setHorizontalAlignment(HorizontalAlignment.LEFT).setMarginLeft(-2)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setBold());
|
|
|
+ // 姓名
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(" 姓 名:").setBorder(null).setMarginTop(row_margin)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.RIGHT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8).setMarginLeft(6));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("std_name").toString()).setBorder(null)
|
|
|
+ .setMarginTop(row_margin).setHorizontalAlignment(HorizontalAlignment.LEFT).setMarginLeft(-2)
|
|
|
+ .setBold().setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT));
|
|
|
+
|
|
|
+ // 性别
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(" 性 别:").setBorder(null).setMarginTop(row_margin)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.RIGHT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8).setMarginLeft(6));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("std_sex").toString()).setBorder(null)
|
|
|
+ .setMarginTop(row_margin).setHorizontalAlignment(HorizontalAlignment.LEFT).setMarginLeft(-2)
|
|
|
+ .setBold().setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT));
|
|
|
+ // if (stdIndex % 5 == 0) {
|
|
|
+ // // 第一行
|
|
|
+ // for (LySubject sb : subjectArray) {
|
|
|
+ // int fontsize = 11;
|
|
|
+ // if (sb.getSubject_name().length() > 5)
|
|
|
+ // fontsize = 6;
|
|
|
+ // else if (sb.getSubject_name().length() > 4)
|
|
|
+ // fontsize = 8;
|
|
|
+ // else if (sb.getSubject_name().length() > 3)
|
|
|
+ // fontsize = 9;
|
|
|
+ // stdTable.addCell(new Cell(1,
|
|
|
+ // 1).add(sb.getSubject_name()).setBorder(null).setMarginTop(5)
|
|
|
+ // .setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ // .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(fontsize));
|
|
|
+ // stdTable.addCell(new Cell(1,
|
|
|
+ // 1).add("_________").setBorder(null).setMarginTop(5)
|
|
|
+ // .setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ // .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11));
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // for (LySubject sb : subjectArray) {
|
|
|
+ stdTable.addCell(new Cell(1, 2).add("签字:________________").setBorder(null).setMarginTop(8)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8));
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ mainTable.addCell(new Cell().add(stdTable).setMarginTop(13).setBorder(null));
|
|
|
+
|
|
|
+ FrameThreadHelper.updateThread(thread, roomIndex * 100 / roomArray.size() - 3, "材料生成中......",
|
|
|
+ FrameThreadStatus.Running);
|
|
|
+ if (stdIndex > 0) {
|
|
|
+ // 判断分页
|
|
|
+ if ((stdIndex + 1) % pageStdCount == 0) {
|
|
|
+ doc.add(mainTable.setMarginTop(10));
|
|
|
+ doc.add(new Paragraph("监考员签字:______________________").setFontSize(12).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.RIGHT).setFixedPosition(260, 30, 300));
|
|
|
+ // 判断本考场是否还有考生
|
|
|
+ if (stdIndex != array.size() - 1) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ this.createSignNewPage(doc, group, subjectArray, room);
|
|
|
+ hasStd = true;
|
|
|
+ } else {
|
|
|
+ // 没考生了
|
|
|
+ hasStd = false;
|
|
|
+ }
|
|
|
+ mainTable = new Table(mainCols);
|
|
|
+ // 宽度 及无边框设置
|
|
|
+ mainTable.setWidthPercent(100).setBorder(null);
|
|
|
+ } else {
|
|
|
+ if (stdIndex == array.size() - 1) {
|
|
|
+ doc.add(new Paragraph("监考员签字:______________________").setFontSize(12).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.RIGHT).setFixedPosition(260, 30, 300));
|
|
|
+ doc.add(mainTable);
|
|
|
+ hasStd = false;
|
|
|
+ mainTable = new Table(new float[] { 1, 1, 1 }).setWidthPercent(100).setBorder(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (hasStd) {
|
|
|
+ doc.add(mainTable.setMarginTop(10));
|
|
|
+ // doc.add(new Paragraph("监考教室核对完毕后签名:___________________").setFontSize(12).setBold()
|
|
|
+ // .setTextAlignment(TextAlignment.RIGHT).setFixedPosition(260, 10, 300));
|
|
|
+ }
|
|
|
+ if (!hasStd && roomIndex == roomStdMap.keySet().size() - 1) {
|
|
|
+ doc.add(mainTable.setMarginTop(10));
|
|
|
+ // doc.add(new Paragraph("监考教室核对完毕后签名:___________________").setFontSize(12).setBold()
|
|
|
+ // .setTextAlignment(TextAlignment.RIGHT).setFixedPosition(260, 10, 300));
|
|
|
+ }
|
|
|
+ if (roomIndex < roomStdMap.keySet().size() - 1)
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ roomIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ Thread.sleep(3000);
|
|
|
+ FrameThreadHelper.completeThread(thread, "考务材料已生成!");
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ FrameThreadHelper.completeThread(thread, "材料生成出现内部错误,请检查字体大小设置是否正确", FrameThreadStatus.Error);
|
|
|
+ LogHelper.error(e);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public File makeWriteSign(FrameThread thread, File tempFile, LyGroup group, List<LySubject> subjectArray, Integer subject_id) {
|
|
|
+ Document doc = null;
|
|
|
+ try {
|
|
|
+ tempFile.getParentFile().mkdirs();
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setMargins(30, 20, 20, 20);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+ List<LyRoomWritten> roomArray = this.daoRoom.listRoom(group.getLy_group_id());
|
|
|
+ Map<LyRoomWritten, List<Map<String, Object>>> roomStdMap = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ FrameThreadHelper.updateThread(thread, 1, "一共有【" + roomArray.size() + "】个笔试考场", FrameThreadStatus.Running);
|
|
|
+
|
|
|
+ for (LyRoomWritten room : roomArray) {
|
|
|
+ List<Map<String, Object>> sArray = this.daoRoom.listRoomStd(group.getLy_group_id(), room);
|
|
|
+ if (sArray.isEmpty()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ roomStdMap.put(room, sArray);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 每页考生的数量
|
|
|
+ int pageStdCount = 15;
|
|
|
+ LyAgent agent = this.daoGroup.find(LyAgent.class, group.getLy_agent_id());
|
|
|
+
|
|
|
+ // 计算每个考生的margin
|
|
|
+ // 每行考生数
|
|
|
+ float[] mainCols = new float[5];
|
|
|
+ Arrays.fill(mainCols, (float) 100 / mainCols.length);
|
|
|
+
|
|
|
+ int roomIndex = 0;
|
|
|
+ int fontSize;
|
|
|
+ //List<Map<String, Object>> array = daoRoom.listStdBySeq(68,118);
|
|
|
+ for (LyRoomWritten room : roomStdMap.keySet()) {
|
|
|
+ List<Map<String, Object>> array = roomStdMap.get(room);
|
|
|
+ Table mainTable = new Table(mainCols).setMarginTop(10);
|
|
|
+ // 宽度及无边框设置
|
|
|
+ mainTable.setWidthPercent(100).setBorder(null).setMarginTop(-10);
|
|
|
+ this.createSignNewPage(doc, group, subjectArray, room);
|
|
|
+
|
|
|
+ boolean hasStd = false;
|
|
|
+ for (int stdIndex = 0; stdIndex < array.size(); stdIndex++) {
|
|
|
+ Map<String, Object> std = array.get(stdIndex);
|
|
|
+ //字体大小设置
|
|
|
+ if (std.get("std_name").toString().length() > 6) {
|
|
|
+ fontSize = 6;
|
|
|
+ } else {
|
|
|
+ fontSize = 10;
|
|
|
+ }
|
|
|
+ Table stdTable = new Table(new float[] { 2.2f, 3f }).setWidthPercent(100).setBorder(null);
|
|
|
+ // 考生头像
|
|
|
+ Image imgStdUpload = ArtFileHelper.generateStdImage(std.containsKey("std_image") ? std.get("std_image").toString() : "cert.jpg");
|
|
|
+
|
|
|
+ int row_margin = -2;
|
|
|
+
|
|
|
+ stdTable.addCell(new Cell(1, 2).setBorder(null).add(imgStdUpload.scaleAbsolute(72, 90))
|
|
|
+ .setMarginTop(0).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setMarginLeft(15));
|
|
|
+
|
|
|
+ // 身份证证号
|
|
|
+ stdTable.addCell(new Cell(1, 2).add(std.get("cert_id").toString()).setMarginTop(0).setFontSize(9)
|
|
|
+ .setBorder(null)).setTextAlignment(TextAlignment.CENTER).setBold()
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE);
|
|
|
+ // 准考证号
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(" 准考证:").setBorder(null).setMarginTop(row_margin)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.RIGHT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8).setMarginLeft(6));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("aspect_ticket_num").toString()).setBorder(null)
|
|
|
+ .setMarginTop(row_margin).setHorizontalAlignment(HorizontalAlignment.LEFT).setMarginLeft(-2)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setBold());
|
|
|
+ // 姓名
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(" 姓 名:").setBorder(null).setMarginTop(row_margin)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.RIGHT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8).setMarginLeft(6));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("std_name").toString()).setBorder(null)
|
|
|
+ .setMarginTop(row_margin).setHorizontalAlignment(HorizontalAlignment.LEFT).setMarginLeft(-2)
|
|
|
+ .setBold().setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(fontSize)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT));
|
|
|
+
|
|
|
+ // 性别
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(" 性 别:").setBorder(null).setMarginTop(row_margin)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.RIGHT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8).setMarginLeft(6));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("std_sex").toString()).setBorder(null)
|
|
|
+ .setMarginTop(row_margin).setHorizontalAlignment(HorizontalAlignment.LEFT).setMarginLeft(-2)
|
|
|
+ .setBold().setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT));
|
|
|
+
|
|
|
+ if (group.getGroup_name().contains("美术鉴赏与写作(美术学)")) {
|
|
|
+ stdTable.addCell(new Cell(1, 2).add(group.getShow_aspect_name() + ":").setBorder(null).setMarginTop(2)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8));
|
|
|
+ stdTable.addCell(new Cell(1, 2).add("________________").setBorder(null).setMarginTop(0)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8));
|
|
|
+ } else if (group.getGroup_name().contains("美术鉴赏(美术学中外综合办学)")) {
|
|
|
+ stdTable.addCell(new Cell(1, 2).add("笔试:________________").setBorder(null).setMarginTop(2)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8));
|
|
|
+ stdTable.addCell(new Cell(1, 2).add("面试:________________").setBorder(null).setMarginTop(2)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8));
|
|
|
+ } else {
|
|
|
+ stdTable.addCell(new Cell(1, 2).add("上午:________________").setBorder(null).setMarginTop(2)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8));
|
|
|
+ stdTable.addCell(new Cell(1, 2).add("下午:________________").setBorder(null).setMarginTop(2)
|
|
|
+ .setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(8));
|
|
|
+ }
|
|
|
+ mainTable.addCell(new Cell().add(stdTable).setMarginTop(13).setBorder(null));
|
|
|
+
|
|
|
+ FrameThreadHelper.updateThread(thread, roomIndex * 100 / roomArray.size() - 3, "材料生成中......",
|
|
|
+ FrameThreadStatus.Running);
|
|
|
+ if (stdIndex > 0) {
|
|
|
+ // 判断分页
|
|
|
+ if ((stdIndex + 1) % pageStdCount == 0) {
|
|
|
+ doc.add(mainTable.setMarginTop(0));
|
|
|
+ doc.add(new Paragraph("监考员签字:______________________").setFontSize(12).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.RIGHT).setFixedPosition(260, 20, 300));
|
|
|
+ // 判断本考场是否还有考生
|
|
|
+ if (stdIndex != array.size() - 1) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ this.createSignNewPage(doc, group, subjectArray, room);
|
|
|
+ hasStd = true;
|
|
|
+ } else {
|
|
|
+ // 没考生了
|
|
|
+ hasStd = false;
|
|
|
+ }
|
|
|
+ mainTable = new Table(mainCols);
|
|
|
+ // 宽度 及无边框设置
|
|
|
+ mainTable.setWidthPercent(100).setBorder(null);
|
|
|
+ } else {
|
|
|
+ if (stdIndex == array.size() - 1) {
|
|
|
+ doc.add(new Paragraph("监考员签字:______________________").setFontSize(12).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.RIGHT).setFixedPosition(260, 20, 300));
|
|
|
+ doc.add(mainTable);
|
|
|
+ hasStd = false;
|
|
|
+ mainTable = new Table(new float[] { 1, 1, 1 }).setWidthPercent(100).setBorder(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (hasStd) {
|
|
|
+ doc.add(mainTable.setMarginTop(10));
|
|
|
+ }
|
|
|
+ if (!hasStd && roomIndex == roomStdMap.keySet().size() - 1) {
|
|
|
+ doc.add(mainTable.setMarginTop(10));
|
|
|
+ }
|
|
|
+ if (roomIndex < roomStdMap.keySet().size() - 1)
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ roomIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ Thread.sleep(3000);
|
|
|
+ FrameThreadHelper.completeThread(thread, "考务材料已生成!");
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ FrameThreadHelper.completeThread(thread, "材料生成出现内部错误,请检查字体大小设置是否正确", FrameThreadStatus.Error);
|
|
|
+ LogHelper.error(e);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /********************
|
|
|
+ * 考场记录单
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public File makeWriteRecord(LyGroup group) {
|
|
|
+ Document doc = null;
|
|
|
+ try {
|
|
|
+ File tempFile = ArtFileHelper.createTempFile();
|
|
|
+ ItextDocumentModel pageModel = new ItextDocumentModel();
|
|
|
+
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setMargins(40, 40, 30, 40);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+ List<LySubject> subjectArray = this.daoGroup.listBySql(LySubject.class,
|
|
|
+ "select cf.subject_name,s.exam_start_time,s.exam_end_time from cf_subject cf,ly_subject s where cf.subject_id=s.subject_id and s.ly_group_id=? order by exam_start_time",
|
|
|
+ group.getLy_group_id());
|
|
|
+ List<LyRoomWritten> roomArray = this.daoRoom.listRoom(group.getLy_group_id());
|
|
|
+
|
|
|
+ String agentName = ArtParamHelper.getParamValue("TicketAgentName", "中央美术学院燕郊校区");
|
|
|
+ /*if (group.getGroup_name().equals("素描(造型艺术)") || group.getGroup_name().equals("色彩(造型艺术)")) {
|
|
|
+ agentName = "中央美术学院燕郊校区";
|
|
|
+ } else {
|
|
|
+ agentName = "燕京理工学院";
|
|
|
+ }*/
|
|
|
+ int index = 0;
|
|
|
+ subjectArray = subjectArray.subList(0, 1);
|
|
|
+ for (LySubject subject : subjectArray) {
|
|
|
+ if (index > 0) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ for (int i = 0; i < roomArray.size(); i++) {
|
|
|
+
|
|
|
+ LyRoomWritten room = roomArray.get(i);
|
|
|
+ if (room.getReal_std_total() < 0)
|
|
|
+ continue;
|
|
|
+ if (i > 0) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ }
|
|
|
+ // 中央美术学院2020年本科招生专业考试考场记录
|
|
|
+ Paragraph p1 = new Paragraph("中央美术学院").setFontSize(18).setBold().setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ //附中优秀人才选拔考试
|
|
|
+ p1 = new Paragraph(ArtParamHelper.ArtYear + "年附中优秀人才选拔考试考场记录").setFontSize(18).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setMarginTop(-2);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ int fontsize = 12;
|
|
|
+ int marginLeft = 0;
|
|
|
+ if (room.getRoom_name().length() > 15) {
|
|
|
+ fontsize = 10;
|
|
|
+ marginLeft = -25;
|
|
|
+ }
|
|
|
+
|
|
|
+ Table tableTitle = null;
|
|
|
+ if (agentName.equals("中央美术学院燕郊校区")) {
|
|
|
+ tableTitle = new Table(new float[] { 1.2f, 1.4f, 1.2f }).setWidthPercent(100);
|
|
|
+ } else {
|
|
|
+ tableTitle = new Table(new float[] { 1.1f, 1.5f, 1.2f }).setWidthPercent(100);
|
|
|
+ }
|
|
|
+ tableTitle.addCell(new Cell(1, 1).add("考点:" + agentName).setTextAlignment(TextAlignment.LEFT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold().setBorder(null).setFontSize(12));
|
|
|
+ tableTitle.addCell(new Cell(1, 1).add("考场编号:" + room.getRoom_name()).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold().setBorder(null).setFontSize(fontsize)).setMarginLeft(marginLeft);
|
|
|
+ tableTitle.addCell(new Cell(1, 1).add("考场位置:" + room.getRoom_addr()).setTextAlignment(TextAlignment.RIGHT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold().setBorder(null).setFontSize(12));
|
|
|
+ doc.add(tableTitle);
|
|
|
+
|
|
|
+ Table table = new Table(new float[] { 1, 1, 1, 1, 1, 1 }).setWidthPercent(100);
|
|
|
+
|
|
|
+ if (subject.getSubject_name().length() > 6) {
|
|
|
+ fontsize = 11;
|
|
|
+ }
|
|
|
+ if (subject.getSubject_name().length() > 8) {
|
|
|
+ fontsize = 9;
|
|
|
+ }
|
|
|
+
|
|
|
+ table.addCell(new Cell(1, 1).add("考试科目").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add(subject.getSubject_name()).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(fontsize));
|
|
|
+
|
|
|
+ table.addCell(new Cell(1, 1).add("考试时间").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 4)
|
|
|
+ .add(LocalDateHelper.format(subject.getExam_start_time().toLocalDate()) + " "
|
|
|
+ + LocalDateHelper.formatHourMinute(subject.getExam_start_time()) + " - "
|
|
|
+ + LocalDateHelper.formatHourMinute(subject.getExam_end_time()))
|
|
|
+ .setBold().setTextAlignment(TextAlignment.CENTER).setBold()
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+
|
|
|
+ table.addCell(new Cell(1, 1).add("应考人数").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add(room.getReal_std_total() + "").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+
|
|
|
+ Table table2 = new Table(new float[] { 1, 1, 1 }).setWidthPercent(100).setBorder(null)
|
|
|
+ .setMargin(-2);
|
|
|
+ table2.addCell(new Cell(1, 3).add("实考人数").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table2.addCell(new Cell(1, 1).add("有效").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table2.addCell(new Cell(1, 1).add("违纪").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table2.addCell(new Cell(1, 1).add("作弊").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setMarginTop(20));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setMarginTop(20));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setMarginTop(20));
|
|
|
+
|
|
|
+ table.addCell(new Cell(1, 2).add(table2));
|
|
|
+
|
|
|
+ table.addCell(new Cell(1, 1).add("缺考人数").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+
|
|
|
+ table.addCell(new Cell(1, 1).add("准考证号").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+
|
|
|
+ CfAspect aspect = this.daoGroup.findBySql(CfAspect.class,
|
|
|
+ "select distinct p.* from cf_aspect_subject ts,cf_aspect p where ts.subject_id in "
|
|
|
+ + " ( select subject_id from ly_subject where ly_group_id=?) and ts.aspect_id=p.aspect_id", group.getLy_group_id());
|
|
|
+
|
|
|
+ //准考证号段
|
|
|
+ Map<String, Object> mainStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 1);
|
|
|
+ Map<String, Object> hkStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 2);
|
|
|
+ Map<String, Object> otherStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 3);
|
|
|
+ int num = 0;
|
|
|
+ int height = 25;
|
|
|
+ if (StringHelper.isNotEmpty(mainStd))
|
|
|
+ num++;
|
|
|
+ if (StringHelper.isNotEmpty(hkStd))
|
|
|
+ num++;
|
|
|
+ if (StringHelper.isNotEmpty(otherStd))
|
|
|
+ num++;
|
|
|
+ String value = "";
|
|
|
+ if (num == 1) {
|
|
|
+ value = aspect.getAspect_name() + " " + room.getMin_ticket_no() + " --- " + room.getMax_ticket_no();
|
|
|
+ if (FrameStatus.Active.toString().equals(group.getAspect_num_flag())) {
|
|
|
+ value = aspect.getAspect_name() + " " + room.getMin_aspect_ticket_num() + " --- " + room.getMax_aspect_ticket_num();
|
|
|
+ }
|
|
|
+ } else if (num == 2) {
|
|
|
+ height = 23;
|
|
|
+ if (StringHelper.isNotEmpty(mainStd) && StringHelper.isNotEmpty(hkStd)) {
|
|
|
+ value = aspect.getAspect_name() + " " + mainStd.get("start_num") + (mainStd.get("start_num").equals(mainStd.get("end_num")) ?
|
|
|
+ "\n" :
|
|
|
+ "---" + mainStd.get("end_num") + "\n");
|
|
|
+ value += aspect.getAspect_name() + " " + hkStd.get("start_num") + (hkStd.get("start_num").equals(hkStd.get("end_num")) ?
|
|
|
+ "" :
|
|
|
+ "---" + hkStd.get("end_num"));
|
|
|
+ }
|
|
|
+ if (StringHelper.isNotEmpty(mainStd) && StringHelper.isNotEmpty(otherStd)) {
|
|
|
+ value = aspect.getAspect_name() + " " + mainStd.get("start_num") + (mainStd.get("start_num").equals(mainStd.get("end_num")) ?
|
|
|
+ "\n" :
|
|
|
+ "---" + mainStd.get("end_num") + "\n");
|
|
|
+ value += aspect.getAspect_name() + " " + otherStd.get("start_num") + (otherStd.get("start_num").equals(otherStd.get("end_num")) ?
|
|
|
+ "" :
|
|
|
+ "---" + otherStd.get("end_num"));
|
|
|
+ }
|
|
|
+ if (StringHelper.isNotEmpty(hkStd) && StringHelper.isNotEmpty(otherStd)) {
|
|
|
+ value = aspect.getAspect_name() + " " + hkStd.get("start_num") + (hkStd.get("start_num").equals(hkStd.get("end_num")) ?
|
|
|
+ "\n" :
|
|
|
+ "---" + hkStd.get("end_num") + "\n");
|
|
|
+ value += aspect.getAspect_name() + " " + otherStd.get("start_num") + (otherStd.get("start_num").equals(otherStd.get("end_num")) ?
|
|
|
+ "" :
|
|
|
+ "---" + otherStd.get("end_num"));
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (num == 3) {
|
|
|
+ height = 21;
|
|
|
+ value = aspect.getAspect_name() + " " + mainStd.get("start_num") + (mainStd.get("start_num").equals(mainStd.get("end_num")) ?
|
|
|
+ "\n" :
|
|
|
+ "---" + mainStd.get("end_num") + "\n");
|
|
|
+ value += aspect.getAspect_name() + " " + hkStd.get("start_num") + (hkStd.get("start_num").equals(hkStd.get("end_num")) ?
|
|
|
+ "\n" :
|
|
|
+ "---" + hkStd.get("end_num") + "\n");
|
|
|
+ value += aspect.getAspect_name() + " " + otherStd.get("start_num") + (otherStd.get("start_num").equals(otherStd.get("end_num")) ?
|
|
|
+ "" :
|
|
|
+ "---" + otherStd.get("end_num"));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /* String value = "";
|
|
|
+ // 需要和专业关联,要得急,临时处理
|
|
|
+ if(room.getRoom_seq() == 1) {
|
|
|
+ value = "艺术设计 FZ2406068-FZ2406080";
|
|
|
+ } else if(room.getRoom_seq() == 2) {
|
|
|
+ value = "艺术设计 FZ2406081-FZ2406093";
|
|
|
+ } else if(room.getRoom_seq() == 3) {
|
|
|
+ value = "艺术设计 FZ2406094-FZ2406097\n";
|
|
|
+ value+= "城市艺术设计 FZ2407098-FZ2407106";
|
|
|
+ } else if(room.getRoom_seq() == 4) {
|
|
|
+ value = "城市艺术设计 FZ2407107-FZ2407117\n";
|
|
|
+ value+= "建筑学 FZ2408118";
|
|
|
+ } else if(room.getRoom_seq() == 5) {
|
|
|
+ value = "造型艺术 FZ2401001-FZ2401014";
|
|
|
+ } else if(room.getRoom_seq() == 6) {
|
|
|
+ value = "造型艺术 FZ2401015-FZ2401028";
|
|
|
+ } else if(room.getRoom_seq() == 7) {
|
|
|
+ value = "造型艺术 FZ2401029-FZ2401041";
|
|
|
+ } else if(room.getRoom_seq() == 8) {
|
|
|
+ value = "造型艺术 FZ2401042-FZ2401050\n";
|
|
|
+ value+= "中国画 FZ2402051-FZ2402054";
|
|
|
+ } else if(room.getRoom_seq() == 9) {
|
|
|
+ value = "中国画 FZ2402055-FZ2402057\n";
|
|
|
+ value+= "实验与科技 FZ2403058-FZ2403062\n";
|
|
|
+ value+= "文物保护与修复 FZ2404063-FZ2404066\n";
|
|
|
+ value+= "书法学 FZ2405067";
|
|
|
+ }*/
|
|
|
+
|
|
|
+ table.addCell(new Cell(1, 5).add(value).setTextAlignment(TextAlignment.LEFT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(10).setBold());
|
|
|
+
|
|
|
+ doc.add(table);
|
|
|
+
|
|
|
+ table2 = new Table(new float[] { 1, 1, 1, 1, 1, 1 }).setWidthPercent(100);
|
|
|
+
|
|
|
+ table2.addCell(new Cell(1, 6).add("考生缺考记录").setPaddingLeft(10)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setMarginTop(2).setBorderTop(null)
|
|
|
+ .setBorderBottom(null).setHeight(height));
|
|
|
+ table2.addCell((new Cell(1, 1).add("准考证号")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height)));
|
|
|
+ table2.addCell((new Cell(1, 1).add("姓名")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height)));
|
|
|
+ table2.addCell((new Cell(1, 1).add("准考证号")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height)));
|
|
|
+ table2.addCell((new Cell(1, 1).add("姓名")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height)));
|
|
|
+ table2.addCell((new Cell(1, 1).add("准考证号")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height)));
|
|
|
+ table2.addCell((new Cell(1, 1).add("姓名")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height)));
|
|
|
+
|
|
|
+ for (int temp = 0; temp <= 4; temp++) {
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ }
|
|
|
+
|
|
|
+ table2.addCell(new Cell(1, 6).add("考生违规记录").setPaddingLeft(10)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setMarginTop(2).setBorderTop(null)
|
|
|
+ .setBorderBottom(null));
|
|
|
+ table2.addCell((new Cell(1, 1).add("准考证号")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)));
|
|
|
+ table2.addCell((new Cell(1, 1).add("姓名")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)));
|
|
|
+ table2.addCell((new Cell(1, 3).add("违规行为")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)));
|
|
|
+ table2.addCell((new Cell(1, 1).add("考生签字")
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)));
|
|
|
+ for (int temp = 0; temp <= 4; temp++) {
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ table2.addCell(new Cell(1, 3).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ table2.addCell(new Cell(1, 1).add(" ").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ }
|
|
|
+
|
|
|
+ table2.addCell(new Cell(1, 6).add("考场情况").setPaddingLeft(10)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setMarginTop(2).setBorderTop(null));
|
|
|
+ for (int temp = 0; temp <= 2; temp++) {
|
|
|
+ table2.addCell(new Cell(1, 6).add("\n").setPaddingLeft(10)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setMarginTop(2).setBorderTop(null)
|
|
|
+ .setBorderBottom(null));
|
|
|
+ }
|
|
|
+ table2.addCell(new Cell(1, 6).add("监考员签字:").setPaddingLeft(10)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setMarginTop(2));
|
|
|
+ doc.add(table2);
|
|
|
+
|
|
|
+ doc.add(new Paragraph("注:每考场一份,由学校留存至考试结束后6个月。 ").setFontSize(12).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.LEFT));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /***************
|
|
|
+ * 试卷收发单
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public File makeWriteSendReceive(LyGroup group) {
|
|
|
+ Document doc = null;
|
|
|
+ try {
|
|
|
+ File tempFile = ArtFileHelper.createTempFile();
|
|
|
+ ItextDocumentModel pageModel = new ItextDocumentModel();
|
|
|
+ pageModel.rotate();
|
|
|
+
|
|
|
+ /*
|
|
|
+ String agentName = "燕京理工学院";
|
|
|
+ if (group.getGroup_name().equals("素描(造型艺术)") || group.getGroup_name().equals("色彩(造型艺术)")) {
|
|
|
+ agentName = "中央美术学院燕郊校区";
|
|
|
+ } else {
|
|
|
+ agentName = "燕京理工学院";
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // 考点名称
|
|
|
+ String agentName = ArtParamHelper.getParamValue("TicketAgentName", "中央美术学院燕郊校区");
|
|
|
+
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setMargins(40, 40, 30, 40);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+ /*String sql = "select cf.aspect_name,cf.aspect_code,cf.aspect_id from cf_aspect_subject sb,cf_aspect cf ,ly_subject s where sb.aspect_id=cf.aspect_id and sb.subject_id=s.subject_id and s.ly_group_id=? group by cf.aspect_name,cf.aspect_code,cf.aspect_id";
|
|
|
+ List<CfAspect> aspectArray = this.daoGroup.listBySql(CfAspect.class, sql, group.getLy_group_id());*/
|
|
|
+ List<LySubject> subjectArray = this.daoGroup.listBySql(LySubject.class,
|
|
|
+ "select distinct cf.subject_name,s.exam_start_time from cf_subject cf,ly_subject s where cf.subject_id=s.subject_id and s.ly_group_id=? order by exam_start_time",
|
|
|
+ group.getLy_group_id());
|
|
|
+ List<LyRoomWritten> roomArray = this.daoRoom.listRoom(group.getLy_group_id());
|
|
|
+ int index = 0;
|
|
|
+ int fontSize = 9;
|
|
|
+ int subjectFontSize;
|
|
|
+ int sum = 0;
|
|
|
+ if (group.getGroup_name().length() > 8) {
|
|
|
+ subjectFontSize = 8;
|
|
|
+ } else {
|
|
|
+ subjectFontSize = 9;
|
|
|
+ }
|
|
|
+ for (LySubject subject : subjectArray) {
|
|
|
+ if (index > 0) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ int pageCount = roomArray.size() % 16 == 0 ? roomArray.size() / 16 : (roomArray.size() / 16 + 1);
|
|
|
+ for (int i = 0; i < pageCount; i++) {
|
|
|
+ if (i > 0) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ }
|
|
|
+ //年附中优秀人才选拔考试试卷收发单
|
|
|
+ Paragraph p1 = new Paragraph("中央美术学院" + ArtParamHelper.ArtYear + "年附中优秀人才选拔考试试卷收发单").setFontSize(18)
|
|
|
+ .setBold().setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ Table titleTable = new Table(new float[] { 1f, 1.5f, 1f, 1.5f }).setWidthPercent(100);
|
|
|
+
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add("考点名称:").setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11)
|
|
|
+ .setBold().setBorder(null)).setMarginLeft(0);
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add(agentName).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11)
|
|
|
+ .setBorder(null).setPaddingLeft(-90));
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add("考试日期:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11)
|
|
|
+ .setBold().setBorder(null).setPaddingRight(-120));
|
|
|
+ titleTable.addCell(new Cell(1, 1).add(getExamDate(subject.getExam_start_time()) + getExamDateType(subject.getExam_start_time()))
|
|
|
+ .setTextAlignment(TextAlignment.RIGHT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11).setBorder(null).setPaddingRight(0));
|
|
|
+
|
|
|
+ doc.add(titleTable);
|
|
|
+
|
|
|
+ Table table = new Table(new float[] { 2.4f, 1.7f, 1.5f, 0.9f, 2.5f, 1, 1, 1, 1, 1, 1, 1 }).setWidthPercent(100);
|
|
|
+ table.addCell(new Cell(2, 1).add("考场编号").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(2, 1).add("考试科目").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(2, 1).add("考场位置").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(2, 1).add("应考").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(2, 1).add("准考证起止号").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(2, 1).add("领卷人").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(1, 3).add("实考").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(2, 1).add("缺考").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(2, 1).add("合计").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(2, 1).add("交卷人").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(1, 1).add("有效").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(1, 1).add("违纪").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(1, 1).add("作弊").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+
|
|
|
+ List<LyRoomWritten> vArray = roomArray.subList(i * 16, Math.min((i + 1) * 16, roomArray.size()));
|
|
|
+ float lineHeight = 30f;
|
|
|
+ for (LyRoomWritten room : vArray) {
|
|
|
+ sum += room.getReal_std_total();
|
|
|
+ if (room.getReal_std_total() < 1) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add(room.getRoom_name()).setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(fontSize).setHeight(lineHeight));
|
|
|
+ table.addCell(new Cell(1, 1).add(group.getGroup_name()).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(subjectFontSize));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add(room.getRoom_addr()).setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(fontSize));
|
|
|
+ table.addCell(new Cell(1, 1).add(room.getReal_std_total() + "").setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(fontSize));
|
|
|
+ //不同类型的考生号段
|
|
|
+ Map<String, Object> mainStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 1);
|
|
|
+ Map<String, Object> hkStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 2);
|
|
|
+ Map<String, Object> otherStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 3);
|
|
|
+ int num = 0;
|
|
|
+ if (StringHelper.isNotEmpty(mainStd))
|
|
|
+ num++;
|
|
|
+ if (StringHelper.isNotEmpty(hkStd))
|
|
|
+ num++;
|
|
|
+ if (StringHelper.isNotEmpty(otherStd))
|
|
|
+ num++;
|
|
|
+ String value = "";
|
|
|
+
|
|
|
+ if (num == 1) {
|
|
|
+ value = room.getMin_ticket_no() + " --- " + room.getMax_ticket_no();
|
|
|
+ if (FrameStatus.Active.toString().equals(group.getAspect_num_flag())) {
|
|
|
+ value = room.getMin_aspect_ticket_num() + " --- " + room.getMax_aspect_ticket_num();
|
|
|
+ }
|
|
|
+ } else if (num == 2) {
|
|
|
+ if (StringHelper.isNotEmpty(mainStd) && StringHelper.isNotEmpty(hkStd)) {
|
|
|
+ value = mainStd.get("start_num") + (mainStd.get("start_num").equals(mainStd.get("end_num")) ?
|
|
|
+ "\n" :
|
|
|
+ "---" + mainStd.get("end_num") + "\n");
|
|
|
+ value += hkStd.get("start_num") + (hkStd.get("start_num").equals(hkStd.get("end_num")) ? "" : "---" + hkStd.get("end_num"));
|
|
|
+ }
|
|
|
+ if (StringHelper.isNotEmpty(mainStd) && StringHelper.isNotEmpty(otherStd)) {
|
|
|
+ value = mainStd.get("start_num") + (mainStd.get("start_num").equals(mainStd.get("end_num")) ?
|
|
|
+ "\n" :
|
|
|
+ "---" + mainStd.get("end_num") + "\n");
|
|
|
+ value += otherStd.get("start_num") + (otherStd.get("start_num").equals(otherStd.get("end_num")) ?
|
|
|
+ "" :
|
|
|
+ "---" + otherStd.get("end_num"));
|
|
|
+ }
|
|
|
+ if (StringHelper.isNotEmpty(hkStd) && StringHelper.isNotEmpty(otherStd)) {
|
|
|
+ value = hkStd.get("start_num") + (hkStd.get("start_num").equals(hkStd.get("end_num")) ?
|
|
|
+ "\n" :
|
|
|
+ "---" + hkStd.get("end_num") + "\n");
|
|
|
+ value += otherStd.get("start_num") + (otherStd.get("start_num").equals(otherStd.get("end_num")) ?
|
|
|
+ "" :
|
|
|
+ "---" + otherStd.get("end_num"));
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (num == 3) {
|
|
|
+ value = mainStd.get("start_num") + (mainStd.get("start_num").equals(mainStd.get("end_num")) ?
|
|
|
+ "\n" :
|
|
|
+ "---" + mainStd.get("end_num") + "\n");
|
|
|
+ value +=
|
|
|
+ hkStd.get("start_num") + (hkStd.get("start_num").equals(hkStd.get("end_num")) ? "\n" : "---" + hkStd.get("end_num") + "\n");
|
|
|
+ value += otherStd.get("start_num") + (otherStd.get("start_num").equals(otherStd.get("end_num")) ?
|
|
|
+ "" :
|
|
|
+ "---" + otherStd.get("end_num"));
|
|
|
+ }
|
|
|
+
|
|
|
+ table.addCell(new Cell(1, 1).add(value).setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(fontSize));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(fontSize));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (i == pageCount - 1) {
|
|
|
+ // 结束了
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 3).add("总计").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE).setBold());
|
|
|
+ table.addCell(new Cell(1, 1).add(sum + "").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+ table.addCell(new Cell(1, 1).add("").setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE));
|
|
|
+
|
|
|
+ }
|
|
|
+ doc.add(table);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void createSeatTitle(Document doc, LyGroup group, LyRoomWritten room) {
|
|
|
+ String agentName;
|
|
|
+ if (group.getGroup_name().equals("素描(造型艺术)") || group.getGroup_name().equals("色彩(造型艺术)")) {
|
|
|
+ agentName = "中央美术学院燕郊校区";
|
|
|
+ } else {
|
|
|
+ agentName = "燕京理工学院";
|
|
|
+ }
|
|
|
+ int fontSize = 11;
|
|
|
+ Table table = new Table(new float[] { 1.3f, 1.9f, 1f, 2f, 1f, 1.5f }).setWidthPercent(100);
|
|
|
+ table.addCell(new Cell(1, 1).add("考点名称:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(fontSize)
|
|
|
+ .setBold().setBorder(null).setMarginLeft(20).setMarginTop(10));
|
|
|
+ table.addCell(new Cell(1, 1).add(agentName).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(fontSize)
|
|
|
+ .setBorder(null).setMarginTop(10));
|
|
|
+ table.addCell(new Cell(1, 1).add("考场编号:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(fontSize)
|
|
|
+ .setBold().setBorder(null).setMarginTop(10));
|
|
|
+ table.addCell(new Cell(1, 1).add(room.getRoom_name()).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(fontSize).setBorder(null).setMarginTop(10));
|
|
|
+ table.addCell(new Cell(1, 1).add("考场位置:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(fontSize)
|
|
|
+ .setBold().setBorder(null).setMarginTop(10));
|
|
|
+ table.addCell(new Cell(1, 1).add(room.getRoom_addr()).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(fontSize).setBorder(null).setMarginTop(10));
|
|
|
+ doc.add(table);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void createSignNewPage(Document doc, LyGroup group, List<LySubject> subjectArray, LyRoomWritten room) {
|
|
|
+ Paragraph p1 = new Paragraph("中央美术学院" + ArtParamHelper.ArtYear + "年附中优秀人才选拔考试考生签到单").setFontSize(16).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ // 布展时间和考点名称
|
|
|
+ String showDate = ArtParamHelper.getParamValue("MaterialShowDate", "2025年1月2日 09:00-15:00");
|
|
|
+ String agentName = ArtParamHelper.getParamValue("TicketAgentName", "中央美术学院燕郊校区");
|
|
|
+
|
|
|
+ Table table = new Table(new float[] { 1f, 1.9f, 1f, 1f, 1f, 2f }).setWidthPercent(100);
|
|
|
+ table.addCell(new Cell(1, 1).add("考点名称:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(11).setBold().setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add(agentName).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(11).setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add("布展地点:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(11).setBold().setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add("美术馆").setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(11).setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add("布展日期:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(11).setBold().setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add(showDate).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setFontSize(11).setBorder(null));
|
|
|
+
|
|
|
+ /*
|
|
|
+ //本科
|
|
|
+ Table table = new Table(new float[] { 0.8f, 1.9f, 0.7f, 2f, 0.7f, 1.7f, 1f, 1.9f }).setWidthPercent(100);
|
|
|
+ table.addCell(new Cell(1, 1).add("考点:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(9).setBold()
|
|
|
+ .setBorder(null).setMarginLeft(10));
|
|
|
+ table.addCell(new Cell(1, 1).add(agentName).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(9)
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add("考场:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(9).setBold()
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add(room.getRoom_name()).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(9)
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add("位置:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(9).setBold()
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add(room.getRoom_addr()).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(9)
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add("日期:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(9).setBold()
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add(getExamDate(subjectArray.get(0).getExam_start_time()))
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(9).setBorder(null));*/
|
|
|
+
|
|
|
+ doc.add(table);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getExamTime(LocalDateTime start_time, LocalDateTime end_time) {
|
|
|
+ DateTimeFormatter start = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm");
|
|
|
+ DateTimeFormatter end = DateTimeFormatter.ofPattern("HH:mm");
|
|
|
+ if (start_time != null && end_time != null) {
|
|
|
+ return start_time.format(start) + "-" + end_time.format(end);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void createSignNewPage2(Document doc, LyAgent agent, LyGroup group, List<LySubject> subjectArray,
|
|
|
+ LyRoomWritten room) {
|
|
|
+ // 中央美术学院2020年本科招生专业考试信息核对单
|
|
|
+ Paragraph p1 = new Paragraph("中央美术学院" + ArtParamHelper.ArtYear + "年附中优秀人才选拔考试考生信息核对单").setFontSize(16).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+ Table table = new Table(new float[] { 1f, 2f, 1.5f, 1.5f, 1.5f, 1.5f }).setWidthPercent(100).setMarginLeft(15);
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add("考点名称:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11).setBold()
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add("中央美术学院燕郊校区").setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11)
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add("笔试地点:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11).setBold()
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add(room.getRoom_addr()).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11)
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add("考场号码:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11).setBold()
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add(room.getRoom_name()).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11)
|
|
|
+ .setBorder(null));
|
|
|
+
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add("考试日期:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11).setBold()
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(new Cell(1, 1).add("2024年1月3日").setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11)
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add("考试时间:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11).setBold()
|
|
|
+ .setBorder(null));
|
|
|
+ ;
|
|
|
+ table.addCell(new Cell(1, 1).add(LocalDateHelper.formatHourMinute(subjectArray.get(0).getExam_start_time()) + "-" + LocalDateHelper.formatHourMinute(
|
|
|
+ subjectArray.get(0).getExam_end_time()))
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11).setBorder(null));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add("考试科目:").setTextAlignment(TextAlignment.RIGHT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11).setBold()
|
|
|
+ .setBorder(null));
|
|
|
+ table.addCell(
|
|
|
+ new Cell(1, 1).add(group.getGroup_name()).setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setFontSize(11)
|
|
|
+ .setBorder(null));
|
|
|
+ doc.add(table);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static PdfFont getSchoolFont() {
|
|
|
+ try {
|
|
|
+ return PdfFontFactory.createFont(
|
|
|
+ SpringHelper.WebServletContext.getRealPath("/") + "fonts" + File.separator + "10047.ttf",
|
|
|
+ PdfEncodings.IDENTITY_H, false);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return ItextPdfHelper.getPdfFontSTSong();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getExamDate(LocalDateTime exam_date) {
|
|
|
+ DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
|
|
|
+ if (exam_date != null)
|
|
|
+ return date.format(exam_date);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getExamDateType(LocalDateTime exam_start_time) {
|
|
|
+ if (exam_start_time.getHour() < 12) {
|
|
|
+ return "(上午)";
|
|
|
+ } else {
|
|
|
+ return "(下午)";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getAgentName(LyGroup group) {
|
|
|
+ String agentName = "";
|
|
|
+ if (group.getGroup_name().equals("素描(造型艺术)") || group.getGroup_name().equals("色彩(造型艺术)")) {
|
|
|
+ agentName = "中央美术学院燕郊校区";
|
|
|
+ } else {
|
|
|
+ agentName = "燕京理工学院";
|
|
|
+ }
|
|
|
+ return agentName;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 试卷收发单-需要结合初试的情况,复试的准考证号-对应的初试准考证号
|
|
|
+ * @date 2024-02-02 02:27:40
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public File makeWriteSendReceiveCs(LyGroup group) {
|
|
|
+ Document doc = null;
|
|
|
+ try {
|
|
|
+ File tempFile = ArtFileHelper.createTempFile();
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setBorder(null);
|
|
|
+ doc.setMargins(20, 30, 30, 30);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+ Paragraph p1 = null;
|
|
|
+ int height = 20;
|
|
|
+ int titleSize = 10;
|
|
|
+ int stdSize = 9;
|
|
|
+ String agentName = getAgentName(group);
|
|
|
+
|
|
|
+ List<LyRoomWritten> roomArray = this.daoRoom.listRoom(group.getLy_group_id());
|
|
|
+ Map<LyRoomWritten, List<Map<String, Object>>> roomStdMap = new LinkedHashMap<LyRoomWritten, List<Map<String, Object>>>();
|
|
|
+
|
|
|
+ for (LyRoomWritten room : roomArray) {
|
|
|
+ List<Map<String, Object>> list = this.daoRoom.listRoomStd(group.getLy_group_id(), room);
|
|
|
+ List<Map<String, Object>> result = filterStdList(list);
|
|
|
+ room.setReal_std_total(result.size());
|
|
|
+ roomStdMap.put(room, result);
|
|
|
+ }
|
|
|
+ Iterator<LyRoomWritten> itRoom = roomStdMap.keySet().iterator();
|
|
|
+ int index = 0;
|
|
|
+ while (itRoom.hasNext()) {
|
|
|
+ index++;
|
|
|
+ LyRoomWritten room = itRoom.next();
|
|
|
+ if (room.getReal_std_total() < 1)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ //动态控制每行的高度
|
|
|
+ if (room.getReal_std_total() <= 15)
|
|
|
+ height = 25;
|
|
|
+ else if (room.getReal_std_total() <= 25)
|
|
|
+ height = 22;
|
|
|
+ else
|
|
|
+ height = 20;
|
|
|
+
|
|
|
+ p1 = new Paragraph("中央美术学院" + ArtParamHelper.ArtYear + "年本科招生线上考试试卷回收记录").setFontSize(18).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ //标题
|
|
|
+ Table titleTable = new Table(new float[] { 1, 2, 1, 2, 1, 2 }).setWidthPercent(100).setBorder(null);
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add("考点名称:").setFontSize(titleSize).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ titleTable.addCell(new Cell(1, 1).add(agentName).setFontSize(titleSize).setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.LEFT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add("考场编号:").setFontSize(titleSize).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add(room.getRoom_name()).setFontSize(titleSize).setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.LEFT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add("考场位置:").setFontSize(titleSize).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add(room.getRoom_addr()).setFontSize(titleSize).setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.LEFT)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add("应 收:").setFontSize(titleSize).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ if (group.getGroup_name().equals("篆刻创作(书法学)") || group.getGroup_name().equals("书法创作")) {
|
|
|
+ titleTable.addCell(new Cell(1, 1).add(" " + room.getReal_std_total() * 2 + " 张").setFontSize(titleSize).setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ } else {
|
|
|
+ titleTable.addCell(new Cell(1, 1).add(" " + room.getReal_std_total() + " 张").setFontSize(titleSize).setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ }
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add("实 收:").setFontSize(titleSize).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ titleTable.addCell(new Cell(1, 1).add(" 张").setFontSize(titleSize).setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ titleTable.addCell(
|
|
|
+ new Cell(1, 1).add("未 收:").setFontSize(titleSize).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ titleTable.addCell(new Cell(1, 1).add(" 张").setFontSize(titleSize).setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ doc.add(titleTable);
|
|
|
+
|
|
|
+ Table stdTable = new Table(new float[] { 0.6f, 1.5f, 1.3f, 1.5f, 1.3f, 1.7f, 1.5f }).setWidthPercent(100).setBorder(null);
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("序号").setFontSize(titleSize).setBold().setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("现场考试准考证").setFontSize(titleSize).setBold().setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("姓名").setFontSize(titleSize).setBold().setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("线上考试准考证").setFontSize(titleSize).setBold().setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("交回").setFontSize(titleSize).setBold().setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("未交原因及承诺交回时间").setFontSize(8).setBold().setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("未交考生签字").setFontSize(titleSize).setBold().setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+
|
|
|
+ List<Map<String, Object>> array = roomStdMap.get(room);
|
|
|
+ for (int stdIndex = 0; stdIndex < array.size(); stdIndex++) {
|
|
|
+ Map<String, Object> std = array.get(stdIndex);
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(String.valueOf(stdIndex + 1)).setFontSize(stdSize).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("ticket_no").toString()).setFontSize(stdSize).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("std_name").toString()).setFontSize(stdSize).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(std.get("ticket_no_cs").toString()).setFontSize(stdSize).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHeight(height));
|
|
|
+ stdTable.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setFontSize(stdSize).setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ stdTable.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setFontSize(stdSize).setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ stdTable.addCell(
|
|
|
+ new Cell(1, 1).add(" ").setFontSize(stdSize).setTextAlignment(TextAlignment.CENTER).setVerticalAlignment(VerticalAlignment.MIDDLE)
|
|
|
+ .setHeight(height));
|
|
|
+ }
|
|
|
+
|
|
|
+ doc.add(stdTable);
|
|
|
+ doc.add(new Paragraph("监考员签字:______________________").setFontSize(12).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.RIGHT).setFixedPosition(260, 30, 300));
|
|
|
+ if (index != roomArray.size()) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Map<String, Object>> filterStdList(List<Map<String, Object>> list) {
|
|
|
+ List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
+ StdEnrol enrol = daoGroup.findBySql(StdEnrol.class,
|
|
|
+ "select e.aspect_name,l.ticket_no from std_enrol e, ly_std_ticket_cs l where e.std_id=l.std_id and e.std_id=?", map.get("std_id"));
|
|
|
+ //|| enrol.getAspect_name().equals("建筑学") || enrol.getAspect_name().equals("美术学")
|
|
|
+ if (enrol == null || enrol.getAspect_name().equals("美术学(中外合作办学)"))
|
|
|
+ continue;
|
|
|
+ else {
|
|
|
+ map.put("ticket_no_cs", enrol.getTicket_no());
|
|
|
+ result.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 考生成绩复核-处理单
|
|
|
+ * @date 2024-02-02 02:32:40
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public File makeScoreStdNotice(LyGroup group) {
|
|
|
+ Document doc = null;
|
|
|
+ try {
|
|
|
+ File tempFile = ArtFileHelper.createTempFile();
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setBorder(null);
|
|
|
+ doc.setMargins(30, 30, 30, 30);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+ Paragraph p1 = null;
|
|
|
+ int height = 20;
|
|
|
+
|
|
|
+ List<Map<String, Object>> list = this.daoGroup.listMapBySql(
|
|
|
+ "select y.*,r.exam_id from sc_score_ym y,std_reg r where aspect_qualified='作弊' and apply_msg is not null and y.std_id=r.std_id ");
|
|
|
+
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
+ p1 = new Paragraph("中央美术学院\n" + ArtParamHelper.ArtYear + "年本科招生线上考试复核/申诉记录").setFontSize(25).setBold()
|
|
|
+ .setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ //考生信息
|
|
|
+ Table stdTable = new Table(new float[] { 1.5f, 3 }).setWidthPercent(100).setBorder(null);
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("考生姓名:").setMarginTop(30).setFontSize(15).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setMarginLeft(-70).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(map.get("std_name").toString()).setMarginTop(30).setFontSize(15).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(-80).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("身份证号:").setFontSize(15).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setMarginLeft(-70).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(map.get("cert_id").toString()).setFontSize(15).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(-80).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("考 生 号:").setFontSize(15).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setMarginLeft(-70).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(map.get("exam_id").toString()).setFontSize(15).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(-80).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("考试专业:").setFontSize(15).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setMarginLeft(-70).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(map.get("aspect_name").toString()).setFontSize(15).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(-80).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("准考证号:").setFontSize(15).setBold().setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.CENTER)
|
|
|
+ .setMarginLeft(-70).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(map.get("ticket_no").toString()).setFontSize(15).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(-80).setHeight(height));
|
|
|
+ doc.add(stdTable);
|
|
|
+
|
|
|
+ Table fhTable = new Table(new float[] { 1.5f, 3 }).setWidthPercent(100).setBorder(null).setMarginLeft(10);
|
|
|
+ fhTable.addCell(new Cell(1, 2).add("复核/申诉内容").setFontSize(15).setBold().setTextAlignment(TextAlignment.CENTER).setHeight(height));
|
|
|
+ fhTable.addCell(new Cell(1, 2).add(map.get("apply_msg").toString()).setBorderBottom(null).setFontSize(11)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT));//.setHeight(300)
|
|
|
+ fhTable.addCell(new Cell(1, 2).add(map.get("check_flag").toString()).setFontSize(10).setTextAlignment(TextAlignment.RIGHT).setBorderBottom(null)
|
|
|
+ .setBorderTop(null).setHeight(height));
|
|
|
+
|
|
|
+ fhTable.addCell(new Cell(1, 2).add("复核/申诉回复").setFontSize(15).setBold().setTextAlignment(TextAlignment.CENTER).setHeight(height));
|
|
|
+ fhTable.addCell(new Cell(1, 2).add(map.get("check_note").toString()).setFontSize(11).setBorderBottom(null)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT));//.setHeight(100)
|
|
|
+ fhTable.addCell(new Cell(1, 2).add("2024-01-29 09:00:00").setFontSize(10).setTextAlignment(TextAlignment.RIGHT).setBorderTop(Border.NO_BORDER)
|
|
|
+ .setHeight(height));
|
|
|
+
|
|
|
+ doc.add(fhTable);
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ }
|
|
|
+
|
|
|
+ // doc.add(new Paragraph("中央美学学院招生处").setFontSize(20).setBold().setTextAlignment(TextAlignment.RIGHT).setFixedPosition(260,70, 300));
|
|
|
+ // doc.add(new Paragraph("2024年1月28日").setFontSize(20).setBold().setTextAlignment(TextAlignment.RIGHT).setFixedPosition(260, 35, 300));
|
|
|
+
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /***
|
|
|
+ * @Description: 央美-试卷卷袋
|
|
|
+ * @date 2024-02-18 09:37:21
|
|
|
+ */
|
|
|
+ public File makeWriteBag(LySubject subject, LyGroup group, LyMaterialWrittenParam param, ItextDocumentModel pageModel) {
|
|
|
+ Document doc = null;
|
|
|
+ try {
|
|
|
+ pageModel.rotate();
|
|
|
+ File tempFile = ArtFileHelper.createTempFile();
|
|
|
+ doc = pageModel.prepareDocument(tempFile);
|
|
|
+ doc.setBorder(null);
|
|
|
+ doc.setMargins(50, 80, 30, 80);
|
|
|
+ doc.setFont(getSchoolFont());
|
|
|
+ Paragraph p1 = null;
|
|
|
+ int height = 20;
|
|
|
+ int fontSize = 25;
|
|
|
+ int left = -10;
|
|
|
+ int marginTop = 20;
|
|
|
+ int titleLeft = 30;
|
|
|
+ String agentName = getAgentName(group);
|
|
|
+ List<LyRoomWritten> roomArray = this.daoRoom.listRoom(group.getLy_group_id());
|
|
|
+ Map<LyRoomWritten, List<Map<String, Object>>> roomStdMap = new LinkedHashMap<LyRoomWritten, List<Map<String, Object>>>();
|
|
|
+
|
|
|
+ for (LyRoomWritten room : roomArray) {
|
|
|
+ List<Map<String, Object>> list = this.daoRoom.listRoomStd(group.getLy_group_id(), room);
|
|
|
+ List<Map<String, Object>> result = filterStdList(list);
|
|
|
+ room.setReal_std_total(result.size());
|
|
|
+ roomStdMap.put(room, result);
|
|
|
+ }
|
|
|
+ Iterator<LyRoomWritten> itRoom = roomStdMap.keySet().iterator();
|
|
|
+ int index = 0;
|
|
|
+ while (itRoom.hasNext()) {
|
|
|
+ index++;
|
|
|
+ LyRoomWritten room = itRoom.next();
|
|
|
+ if (room.getReal_std_total() < 1)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ p1 = new Paragraph("中央美术学院").setFontSize(40).setBold().setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+ p1 = new Paragraph(ArtParamHelper.ArtYear + "年本科招生线上考试试卷回收袋").setFontSize(26).setBold().setTextAlignment(TextAlignment.CENTER);
|
|
|
+ doc.add(p1);
|
|
|
+
|
|
|
+ Map<String, Object> mainStd = this.daoRoom.getTicketSerailNum(room.getLy_room_id(), 1);
|
|
|
+
|
|
|
+ Table stdTable = new Table(new float[] { 1.9f, 3f }).setWidthPercent(100).setBorder(null);
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("考点名称:").setMarginTop(30).setFontSize(fontSize).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setMarginLeft(titleLeft).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(agentName).setMarginTop(30).setFontSize(fontSize).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(left).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("考场编号:").setFontSize(fontSize).setMarginTop(marginTop).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setMarginLeft(titleLeft).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(room.getRoom_name()).setFontSize(fontSize).setMarginTop(marginTop).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(left).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("考场位置:").setFontSize(fontSize).setMarginTop(marginTop).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setMarginLeft(titleLeft).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(room.getRoom_addr()).setFontSize(fontSize).setMarginTop(marginTop).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(left).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("准 考 证:").setFontSize(fontSize).setBold().setMarginTop(marginTop).setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setMarginLeft(titleLeft).setHeight(height));
|
|
|
+ if (mainStd.get("start_num").equals(mainStd.get("end_num"))) {
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(mainStd.get("start_num").toString()).setFontSize(fontSize).setMarginTop(marginTop).setBold()
|
|
|
+ .setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.LEFT).setMarginLeft(left).setHeight(height));
|
|
|
+ } else {
|
|
|
+ stdTable.addCell(
|
|
|
+ new Cell(1, 1).add(mainStd.get("start_num") + "-" + mainStd.get("end_num")).setFontSize(fontSize).setMarginTop(marginTop).setBold()
|
|
|
+ .setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.LEFT).setMarginLeft(left).setHeight(height));
|
|
|
+ }
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("应 收:").setFontSize(fontSize).setMarginTop(marginTop).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setMarginLeft(titleLeft).setHeight(height));
|
|
|
+ if (group.getGroup_name().equals("篆刻创作(书法学)") || group.getGroup_name().equals("书法创作")) {
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(room.getReal_std_total() * 2 + " 张").setFontSize(fontSize).setMarginTop(marginTop).setBold()
|
|
|
+ .setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.LEFT).setMarginLeft(left).setHeight(height));
|
|
|
+ } else {
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(room.getReal_std_total() + " 张").setFontSize(fontSize).setMarginTop(marginTop).setBold()
|
|
|
+ .setBorder(Border.NO_BORDER).setTextAlignment(TextAlignment.LEFT).setMarginLeft(left).setHeight(height));
|
|
|
+ }
|
|
|
+
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("实 收:").setFontSize(fontSize).setMarginTop(marginTop).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setMarginLeft(titleLeft).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(" 张").setFontSize(fontSize).setMarginTop(marginTop).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(45).setHeight(height));
|
|
|
+
|
|
|
+ stdTable.addCell(new Cell(1, 1).add("未 收:").setFontSize(fontSize).setMarginTop(marginTop).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.CENTER).setMarginLeft(titleLeft).setHeight(height));
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(" 张").setFontSize(fontSize).setMarginTop(marginTop).setBold().setBorder(Border.NO_BORDER)
|
|
|
+ .setTextAlignment(TextAlignment.LEFT).setMarginLeft(45).setHeight(height));
|
|
|
+ doc.add(stdTable);
|
|
|
+ if (index != roomArray.size()) {
|
|
|
+ doc.add(new AreaBreak());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ return tempFile;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ ItextPdfHelper.closePdf(doc);
|
|
|
+ throw new BusinessException("无法生成pdf文件,请联系系统管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|