|
@@ -4,13 +4,24 @@ import cn.hmsoft.application.SpringHelper;
|
|
|
import cn.hmsoft.art.constants.StdMaterialType;
|
|
|
import cn.hmsoft.art.data.dao.sc.ScScoreYmDao;
|
|
|
import cn.hmsoft.art.data.model.sc.ScScoreYm;
|
|
|
+import cn.hmsoft.art.data.model.std.StdLog;
|
|
|
import cn.hmsoft.art.enrol.helper.EnrolMaterialHelper;
|
|
|
import cn.hmsoft.art.helper.ArtParamHelper;
|
|
|
+import cn.hmsoft.frame.exception.BusinessException;
|
|
|
+import cn.hmsoft.helper.LocalDateHelper;
|
|
|
+import cn.hmsoft.helper.StringHelper;
|
|
|
import cn.hmsoft.helper.pdf.ItextPdfHelper;
|
|
|
+import cn.hmsoft.helper.pdf.PdfHeaderFooterEvent;
|
|
|
import cn.hmsoft.log.LogHelper;
|
|
|
import com.itextpdf.io.font.PdfEncodings;
|
|
|
+import com.itextpdf.kernel.events.PdfDocumentEvent;
|
|
|
import com.itextpdf.kernel.font.PdfFont;
|
|
|
import com.itextpdf.kernel.font.PdfFontFactory;
|
|
|
+import com.itextpdf.kernel.geom.PageSize;
|
|
|
+import com.itextpdf.kernel.pdf.EncryptionConstants;
|
|
|
+import com.itextpdf.kernel.pdf.PdfDocument;
|
|
|
+import com.itextpdf.kernel.pdf.PdfWriter;
|
|
|
+import com.itextpdf.kernel.pdf.WriterProperties;
|
|
|
import com.itextpdf.layout.Document;
|
|
|
import com.itextpdf.layout.element.Cell;
|
|
|
import com.itextpdf.layout.element.Paragraph;
|
|
@@ -21,6 +32,7 @@ import com.itextpdf.layout.property.TextAlignment;
|
|
|
import com.itextpdf.layout.property.VerticalAlignment;
|
|
|
|
|
|
import java.io.File;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @Description 中央美术学院-违规处理决定书生成帮助类
|
|
@@ -137,9 +149,18 @@ public abstract class DecisionHelper {
|
|
|
file.delete();
|
|
|
|
|
|
Document doc = null;
|
|
|
+
|
|
|
+ //成绩查询日志List
|
|
|
+ List<StdLog> logList = scoreYmDao.listBySql(StdLog.class,"select * from std_log where log_type='ScoreQuery' and std_id=? order by log_time",
|
|
|
+ score.getStd_id());
|
|
|
+ StdLog searchLog = null;
|
|
|
+ if(logList != null && !logList.isEmpty()) {
|
|
|
+ searchLog = logList.get(0);
|
|
|
+ }
|
|
|
try {
|
|
|
// 设置密码
|
|
|
- doc = ItextPdfHelper.createPdf(file, "hmosft_" + ArtParamHelper.SchoolCode);
|
|
|
+ //doc = ItextPdfHelper.createPdf(file, "hmosft_" + ArtParamHelper.SchoolCode);
|
|
|
+ doc = createPdf(file, PageSize.A4, "hmosft_" + ArtParamHelper.SchoolCode);
|
|
|
|
|
|
doc.setBorder(null);
|
|
|
doc.setMargins(30, 50, 30, 50);
|
|
@@ -175,14 +196,14 @@ public abstract class DecisionHelper {
|
|
|
stdTable.addCell(new Cell(1, 1).add("生 源 地:").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.RIGHT).setTextAlignment(TextAlignment.RIGHT)
|
|
|
.setMarginTop(5).setMarginBottom(5));
|
|
|
- stdTable.addCell(new Cell(1, 1).add(score.getStd_name()).setFontSize(fontSize)
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(score.getProvince_name()).setFontSize(fontSize)
|
|
|
.setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
|
|
|
// 考生号
|
|
|
stdTable.addCell(new Cell(1, 1).add("考 生 号:").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.RIGHT).setTextAlignment(TextAlignment.RIGHT)
|
|
|
.setMarginTop(5).setMarginBottom(5));
|
|
|
- stdTable.addCell(new Cell(1, 1).add(score.getCert_id()).setFontSize(fontSize)
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(score.getExam_id()).setFontSize(fontSize)
|
|
|
.setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
|
|
|
// 报考专业
|
|
@@ -196,7 +217,7 @@ public abstract class DecisionHelper {
|
|
|
stdTable.addCell(new Cell(1, 1).add("考试科目:").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.RIGHT).setTextAlignment(TextAlignment.RIGHT)
|
|
|
.setMarginTop(5).setMarginBottom(5));
|
|
|
- stdTable.addCell(new Cell(1, 1).add(" ").setFontSize(fontSize)
|
|
|
+ stdTable.addCell(new Cell(1, 1).add(score.getSubject_name_1()).setFontSize(fontSize)
|
|
|
.setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
|
|
|
// 准考证号
|
|
@@ -219,27 +240,30 @@ public abstract class DecisionHelper {
|
|
|
doc.add(p1.setMarginTop(15f));
|
|
|
|
|
|
Table scoreTable = new Table(new float[] { 2, 6}).setWidthPercent(100).setBorder(null);
|
|
|
-
|
|
|
+ float lineHeight = 35f;
|
|
|
//成绩查询结果
|
|
|
scoreTable.addCell(new Cell(1, 1).add("成绩查询结果").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setMarginTop(5).setMarginBottom(5));
|
|
|
- scoreTable.addCell(new Cell(1, 1).add(" ").setFontSize(fontSize)
|
|
|
- .setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
+ .setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
+ scoreTable.addCell(new Cell(1, 1).add(searchLog != null ? score.getAspect_qualified() : "").setFontSize(fontSize)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setMarginLeft(10).setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
|
|
|
//成绩查询时间
|
|
|
scoreTable.addCell(new Cell(1, 1).add("成绩查询时间").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setMarginTop(5).setMarginBottom(5));
|
|
|
- scoreTable.addCell(new Cell(1, 1).add(" ").setFontSize(fontSize)
|
|
|
- .setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
+ .setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
+ scoreTable.addCell(new Cell(1, 1).add(searchLog != null ? LocalDateHelper.format(searchLog.getLog_time()) : "").setFontSize(fontSize)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setMarginLeft(10).setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
|
|
|
//查询IP地址
|
|
|
scoreTable.addCell(new Cell(1, 1).add("查询IP地址").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setMarginTop(5).setMarginBottom(5));
|
|
|
- scoreTable.addCell(new Cell(1, 1).add(" ").setFontSize(fontSize)
|
|
|
- .setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
+ .setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
+ scoreTable.addCell(new Cell(1, 1).add(searchLog != null ? searchLog.getLog_value() : "").setFontSize(fontSize)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setMarginLeft(10).setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
|
|
|
doc.add(scoreTable);
|
|
|
|
|
@@ -252,23 +276,26 @@ public abstract class DecisionHelper {
|
|
|
//陈述申辩内容
|
|
|
scoreTable.addCell(new Cell(1, 1).add("陈述申辩内容").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setMarginTop(5).setMarginBottom(5));
|
|
|
- scoreTable.addCell(new Cell(1, 1).add(" ").setFontSize(fontSize)
|
|
|
- .setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
+ .setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
+ scoreTable.addCell(new Cell(1, 1).add(score.getApply_msg() != null ? score.getApply_msg() : "").setFontSize(fontSize)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setMarginLeft(10).setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
|
|
|
//陈述申辩时间
|
|
|
scoreTable.addCell(new Cell(1, 1).add("陈述申辩时间").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setMarginTop(5).setMarginBottom(5));
|
|
|
- scoreTable.addCell(new Cell(1, 1).add(" ").setFontSize(fontSize)
|
|
|
- .setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
+ .setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
+ scoreTable.addCell(new Cell(1, 1).add(score.getCheck_flag() != null ? score.getCheck_flag() : "").setFontSize(fontSize)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setMarginLeft(10).setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
|
|
|
//陈辩IP地址
|
|
|
scoreTable.addCell(new Cell(1, 1).add("陈辩IP地址").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setMarginTop(5).setMarginBottom(5));
|
|
|
- scoreTable.addCell(new Cell(1, 1).add(" ").setFontSize(fontSize)
|
|
|
- .setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
+ .setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
+ scoreTable.addCell(new Cell(1, 1).add(score.getEms_no() != null ? score.getEms_no() : "").setFontSize(fontSize)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setMarginLeft(10).setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
|
|
|
doc.add(scoreTable);
|
|
|
|
|
@@ -280,16 +307,18 @@ public abstract class DecisionHelper {
|
|
|
//复核结论答复
|
|
|
scoreTable.addCell(new Cell(1, 1).add("复核结论答复").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setMarginTop(5).setMarginBottom(5));
|
|
|
- scoreTable.addCell(new Cell(1, 1).add(" ").setFontSize(fontSize)
|
|
|
- .setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
+ .setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
+ scoreTable.addCell(new Cell(1, 1).add(score.getCheck_note() != null ? score.getCheck_note() : "").setFontSize(fontSize)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setMarginLeft(10).setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
|
|
|
//复核答复时间
|
|
|
scoreTable.addCell(new Cell(1, 1).add("复核答复时间").setFontSize(fontSize)
|
|
|
.setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER)
|
|
|
- .setMarginTop(5).setMarginBottom(5));
|
|
|
- scoreTable.addCell(new Cell(1, 1).add(" ").setFontSize(fontSize)
|
|
|
- .setMarginLeft(10).setMarginTop(5).setMarginBottom(5));
|
|
|
+ .setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
+ scoreTable.addCell(new Cell(1, 1).add(score.getRecovery_time() != null ? score.getRecovery_time() : "").setFontSize(fontSize)
|
|
|
+ .setVerticalAlignment(VerticalAlignment.MIDDLE).setHorizontalAlignment(HorizontalAlignment.CENTER)
|
|
|
+ .setMarginLeft(10).setMarginTop(5).setMarginBottom(5).setHeight(lineHeight));
|
|
|
|
|
|
doc.add(scoreTable);
|
|
|
|
|
@@ -298,6 +327,9 @@ public abstract class DecisionHelper {
|
|
|
|
|
|
ItextPdfHelper.closePdf(doc);
|
|
|
|
|
|
+ //更新文件路径
|
|
|
+ String sql = "update sc_score_ym set review_log_file=? where cert_id=? and aspect_name=? and batch=? ";
|
|
|
+ scoreYmDao.updateBySql(sql, file_name, score.getCert_id(), score.getAspect_name(), score.getBatch());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
LogHelper.error(e.getMessage());
|
|
@@ -310,4 +342,31 @@ public abstract class DecisionHelper {
|
|
|
}
|
|
|
return file;
|
|
|
}
|
|
|
+
|
|
|
+ public static Document createPdf(File file, PageSize pageSize, String passwd) {
|
|
|
+ PdfDocument pdfDoc;
|
|
|
+ Document doc;
|
|
|
+ try {
|
|
|
+
|
|
|
+ if (StringHelper.isNotEmpty(passwd))
|
|
|
+ pdfDoc = new PdfDocument(
|
|
|
+ new PdfWriter(
|
|
|
+ file.getPath(),
|
|
|
+ new WriterProperties().setStandardEncryption(
|
|
|
+ null,
|
|
|
+ passwd.getBytes(),
|
|
|
+ EncryptionConstants.ALLOW_PRINTING,
|
|
|
+ EncryptionConstants.ENCRYPTION_AES_128
|
|
|
+ | EncryptionConstants.DO_NOT_ENCRYPT_METADATA)));
|
|
|
+ else
|
|
|
+ pdfDoc = new PdfDocument(new PdfWriter(file.getPath()));
|
|
|
+ // 添加页码
|
|
|
+ PdfHeaderFooterEvent event = new PdfHeaderFooterEvent();
|
|
|
+ pdfDoc.addEventHandler(PdfDocumentEvent.END_PAGE, event);
|
|
|
+ doc = new Document(pdfDoc, pageSize);
|
|
|
+ return doc;
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BusinessException("无法创建临时文件,请联系系统管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|