|
@@ -21,6 +21,7 @@ import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
|
|
|
import com.qmth.teachcloud.common.bean.vo.PrintPathVo;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicAttachment;
|
|
|
+import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
|
import com.qmth.teachcloud.common.entity.BasicPrintConfig;
|
|
|
import com.qmth.teachcloud.common.entity.BasicSemester;
|
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
@@ -336,6 +337,7 @@ public class CreatePdfUtil {
|
|
|
public String replaceBlankHtmlContent(String htmlContent) {
|
|
|
// 替换条码参数
|
|
|
htmlContent = htmlContent.replaceAll("<img src=\"data:image/png;base64,\\$\\{examNumber\\}\">", "");
|
|
|
+ htmlContent = htmlContent.replaceAll("<img src=\"data:image/png;base64,\\$\\{courseCodeBarcodeSrc\\}\">", "");
|
|
|
// 正则匹配所有参数,填入空值
|
|
|
htmlContent = htmlContent.replaceAll("\\$\\{[A-Za-z0-9]+\\}", "");
|
|
|
return htmlContent;
|
|
@@ -548,6 +550,8 @@ public class CreatePdfUtil {
|
|
|
studentHtml = studentHtml.replaceAll("\\$\\{ticketNumberBarcode\\}", "");
|
|
|
studentHtml = studentHtml.replaceAll("\\$\\{examNumber\\}", examStudent != null && examStudent.getStudentCode() != null ? GoogleBarCodeUtil.createBarCode(examStudent.getStudentCode(), false) : "");
|
|
|
studentHtml = studentHtml.replaceAll("\\$\\{examNumberStr\\}", examStudent != null && examStudent.getStudentCode() != null ? examStudent.getStudentCode() : "");
|
|
|
+ studentHtml = studentHtml.replaceAll("\\$\\{courseCodeBarcodeSrc\\}", examStudent != null && examStudent.getCourseCode() != null ? GoogleBarCodeUtil.createBarCode(examStudent.getCourseCode(), false) : "");
|
|
|
+ studentHtml = studentHtml.replaceAll("\\$\\{courseCodeBarcodeName\\}", examStudent != null && examStudent.getCourseCode() != null ? examStudent.getCourseCode() : "");
|
|
|
// 随机生成学生试卷条码并将图片转成base64
|
|
|
studentHtml = studentHtml.replaceAll("\\$\\{paperType\\}", examStudent != null && examStudent.getPaperType() != null ? GoogleBarCodeUtil.createBarCode(SystemConstant.convertPaperType(examStudent.getPaperType()), false) : StringUtils.isNotBlank(paperType) ? GoogleBarCodeUtil.createBarCode(SystemConstant.convertPaperType(paperType), false) : "");
|
|
|
// 替换考生卷型
|
|
@@ -566,6 +570,8 @@ public class CreatePdfUtil {
|
|
|
}
|
|
|
}
|
|
|
} else if (ExamNumberStyleEnum.FILL.equals(basicCardRule.getExamNumberStyle())) {
|
|
|
+ studentHtml = studentHtml.replaceAll("\\$\\{courseCodeBarcodeSrc\\}", examStudent != null && examStudent.getCourseCode() != null ? "data:image/png;base64," + GoogleBarCodeUtil.createBarCode(examStudent.getCourseCode(), false) : "");
|
|
|
+ studentHtml = studentHtml.replaceAll("\\$\\{courseCodeBarcodeName\\}", examStudent != null && examStudent.getCourseCode() != null ? examStudent.getCourseCode() : "");
|
|
|
String fillFields = basicCardRule.getFillFields();
|
|
|
if (StringUtils.isNotBlank(fillFields)) {
|
|
|
if (examStudent != null) {
|
|
@@ -590,6 +596,8 @@ public class CreatePdfUtil {
|
|
|
// 替换条码参数
|
|
|
studentHtml = studentHtml.replaceAll("<img src=\"data:image/png;base64,\\$\\{examNumber\\}\">", "");
|
|
|
studentHtml = studentHtml.replaceAll("\\$\\{examNumberStr\\}", "");
|
|
|
+ studentHtml = studentHtml.replaceAll("<img src=\"data:image/png;base64,\\$\\{courseCodeBarcodeSrc\\}\">", "");
|
|
|
+ studentHtml = studentHtml.replaceAll("\\$\\{courseCodeBarcodeName\\}", "");
|
|
|
}
|
|
|
|
|
|
studentHtml = studentHtml.replaceAll("\\$\\{packageCodeDom\\}", "");
|
|
@@ -611,12 +619,15 @@ public class CreatePdfUtil {
|
|
|
* @param basicCardRule 题卡规则
|
|
|
* @param backupPackageCode 备用题卡条码号
|
|
|
*/
|
|
|
- public String replaceBackupCardHtmlParam(ExamCard examCard, String paperType, BasicCardRule basicCardRule, String backupPackageCode) {
|
|
|
+ public String replaceBackupCardHtmlParam(String courseCode, ExamCard examCard, String paperType, BasicCardRule basicCardRule, String backupPackageCode) {
|
|
|
String htmlContent = examCard.getHtmlContent();
|
|
|
// 替换条码参数
|
|
|
htmlContent = htmlContent.replaceAll("<img src=\"data:image/png;base64,\\$\\{examNumber\\}\">", "");
|
|
|
htmlContent = htmlContent.replaceAll("\\$\\{examNumberStr\\}", "");
|
|
|
|
|
|
+ htmlContent = htmlContent.replaceAll("\\$\\{courseCodeBarcodeSrc\\}", StringUtils.isNotBlank(courseCode) ? "data:image/png;base64," + GoogleBarCodeUtil.createBarCode(courseCode, false) : "");
|
|
|
+ htmlContent = htmlContent.replaceAll("\\$\\{courseCodeBarcodeName\\}", StringUtils.isNotBlank(courseCode) ? courseCode : "");
|
|
|
+
|
|
|
//替换卷型参数
|
|
|
htmlContent = htmlContent.replaceAll("\\$\\{paperTypeName\\}", StringUtils.isBlank(paperType) ? "" : paperType);
|
|
|
//替换卷型条码(base64)
|