|
@@ -22,12 +22,10 @@ import com.qmth.teachcloud.common.config.DictionaryConfig;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicAttachment;
|
|
|
import com.qmth.teachcloud.common.entity.BasicClazz;
|
|
|
+import com.qmth.teachcloud.common.entity.BasicSemester;
|
|
|
import com.qmth.teachcloud.common.entity.TBTask;
|
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
|
-import com.qmth.teachcloud.common.service.BasicAttachmentService;
|
|
|
-import com.qmth.teachcloud.common.service.BasicCampusService;
|
|
|
-import com.qmth.teachcloud.common.service.BasicClazzService;
|
|
|
-import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
+import com.qmth.teachcloud.common.service.*;
|
|
|
import com.qmth.teachcloud.common.util.ConvertUtil;
|
|
|
import com.qmth.teachcloud.common.util.FileStoreUtil;
|
|
|
import com.qmth.teachcloud.common.util.RedisUtil;
|
|
@@ -107,6 +105,9 @@ public class CreatePdfUtil {
|
|
|
@Resource
|
|
|
BasicTemplateService basicTemplateService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ BasicSemesterService basicSemesterService;
|
|
|
+
|
|
|
@Resource
|
|
|
DictionaryConfig dictionaryConfig;
|
|
|
|
|
@@ -312,20 +313,40 @@ public class CreatePdfUtil {
|
|
|
* @param variablePdfList
|
|
|
* @param printCount
|
|
|
* @param examDetailCourseList
|
|
|
- * @throws IOException
|
|
|
*/
|
|
|
- public void createPaperPackage(Long templateId, String schoolName, ExamDetail examDetail, List<ExamStudentCourseDto> examStudentList, List<PdfDto> variablePdfList, Integer printCount, List<ExamDetailCourse> examDetailCourseList) throws IOException {
|
|
|
+ public void createPaperPackage(Long templateId, String schoolName, ExamDetail examDetail, List<ExamStudentCourseDto> examStudentList, List<PdfDto> variablePdfList, Integer printCount, List<ExamDetailCourse> examDetailCourseList, Long examId) {
|
|
|
BasicTemplate basicTemplate = basicTemplateService.getById(templateId);
|
|
|
if (Objects.isNull(basicTemplate)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("印品数据有误");
|
|
|
}
|
|
|
|
|
|
- List<JSONObject> objectList = JSON.parseArray(basicTemplate.getDisplayRange(), JSONObject.class);
|
|
|
+ JSONObject object = JSON.parseObject(basicTemplate.getDisplayRange());
|
|
|
|
|
|
PdfPackageDto pdfPackageDto = new PdfPackageDto();
|
|
|
- pdfPackageDto.setTitle(schoolName + "卷袋贴");
|
|
|
+ pdfPackageDto.setTitle(schoolName);
|
|
|
pdfPackageDto.setPackageNumber(examDetail.getPackageCode());
|
|
|
|
|
|
+ // 标题信息
|
|
|
+ List<JSONObject> objectTitleList = JSON.parseArray(object.getString("title"), JSONObject.class);
|
|
|
+ List<Map<String, String>> titlePlate = new ArrayList<>();
|
|
|
+ for (JSONObject jsonObject : objectTitleList) {
|
|
|
+ Map<String, String> titleMap = new HashMap<>();
|
|
|
+ if (jsonObject.getBoolean("enable")) {
|
|
|
+ String code = jsonObject.getString("code");
|
|
|
+ String name = jsonObject.getString("name");
|
|
|
+ titleMap.put("code", code);
|
|
|
+ titleMap.put("name", name);
|
|
|
+ if ("semesterName".equals(code)) {
|
|
|
+ BasicSemester basicSemester = basicSemesterService.selectByExamId(examId);
|
|
|
+ titleMap.put("value", basicSemester == null ? null : basicSemester.getName() + " 课程考试");
|
|
|
+ }
|
|
|
+ titlePlate.add(titleMap);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pdfPackageDto.setTitlePlate(titlePlate);
|
|
|
+
|
|
|
+ List<JSONObject> objectList = JSON.parseArray(object.getString("basic"), JSONObject.class);
|
|
|
// 基础信息
|
|
|
List<Map<String, String>> basicPlate = new ArrayList<>();
|
|
|
for (JSONObject jsonObject : objectList) {
|
|
@@ -382,6 +403,8 @@ public class CreatePdfUtil {
|
|
|
basicMap.put("value", String.valueOf(examStudentList.size()));
|
|
|
} else if ("actualExamCount".equals(code)) {
|
|
|
basicMap.put("value", "");
|
|
|
+ } else if ("paperCount".equals(code)) {
|
|
|
+ basicMap.put("value", examStudentList.size() + " + " + printCount);
|
|
|
}
|
|
|
basicPlate.add(basicMap);
|
|
|
|
|
@@ -595,9 +618,7 @@ public class CreatePdfUtil {
|
|
|
* @param printCount
|
|
|
* @param examDetailCourseList
|
|
|
*/
|
|
|
- public void createSignBook(Long templateId, String schoolName, ExamDetail
|
|
|
- examDetail, List<ExamStudentCourseDto> examStudentList, List<PdfDto> variablePdfList, Integer
|
|
|
- printCount, List<ExamDetailCourse> examDetailCourseList) {
|
|
|
+ public void createSignBook(Long templateId, String schoolName, ExamDetail examDetail, List<ExamStudentCourseDto> examStudentList, List<PdfDto> variablePdfList, Integer printCount, List<ExamDetailCourse> examDetailCourseList) {
|
|
|
BasicTemplate basicTemplate = basicTemplateService.getById(templateId);
|
|
|
if (Objects.isNull(basicTemplate)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("印品数据有误");
|
|
@@ -652,10 +673,10 @@ public class CreatePdfUtil {
|
|
|
basicMap.put("code", code);
|
|
|
basicMap.put("name", name);
|
|
|
StringJoiner stringJoiner = new StringJoiner("");
|
|
|
- if(StringUtils.isNotBlank(examDetail.getExamPlace())){
|
|
|
+ if (StringUtils.isNotBlank(examDetail.getExamPlace())) {
|
|
|
stringJoiner.add(examDetail.getExamPlace());
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(examDetail.getExamRoom())){
|
|
|
+ if (StringUtils.isNotBlank(examDetail.getExamRoom())) {
|
|
|
stringJoiner.add(examDetail.getExamRoom());
|
|
|
}
|
|
|
basicMap.put("value", stringJoiner.toString());
|
|
@@ -691,6 +712,9 @@ public class CreatePdfUtil {
|
|
|
List<Map<String, String>> studentPlate = new ArrayList<>();
|
|
|
for (ExamStudentCourseDto examStudentCourseDto : examStudentList) {
|
|
|
Map<String, String> studentMap = new LinkedHashMap<>();
|
|
|
+ if (studentHeadPlateMap.containsKey("siteNumber")) {
|
|
|
+ studentMap.put("siteNumber", examStudentCourseDto.getSiteNumber());
|
|
|
+ }
|
|
|
if (studentHeadPlateMap.containsKey("studentName")) {
|
|
|
studentMap.put("studentName", examStudentCourseDto.getStudentName());
|
|
|
}
|
|
@@ -793,9 +817,10 @@ public class CreatePdfUtil {
|
|
|
|
|
|
/**
|
|
|
* 获取试卷pdf
|
|
|
- * @param stuPaperType 考生卷型
|
|
|
- * @param paperPdfDto 抽取的试卷文件信息
|
|
|
- * @param pdfList 考生试卷集合
|
|
|
+ *
|
|
|
+ * @param stuPaperType 考生卷型
|
|
|
+ * @param paperPdfDto 抽取的试卷文件信息
|
|
|
+ * @param pdfList 考生试卷集合
|
|
|
* @param waterMarkNames 水印内容
|
|
|
*/
|
|
|
public PdfDto getExamStudentPaperPdf(String stuPaperType, List<PaperPdfDto> paperPdfDto, List<PdfDto> pdfList, String[] waterMarkNames) throws IOException {
|
|
@@ -806,7 +831,7 @@ public class CreatePdfUtil {
|
|
|
int pages = dto.getPages();
|
|
|
pagesList.add(pages);
|
|
|
PdfDto pdfDto = PdfUtil.addPdfPage(dto.getFile());
|
|
|
- File file = paperPdfDto.size() > 1 ? PdfUtil.addWaterMark(dto.getFile(), waterMarkNames, 0.5f, 12, 0): dto.getFile();
|
|
|
+ File file = paperPdfDto.size() > 1 ? PdfUtil.addWaterMark(dto.getFile(), waterMarkNames, 0.5f, 12, 0) : dto.getFile();
|
|
|
pdfList.add(new PdfDto(file.getPath(), dto.getPageSize(), pdfDto.getPageCount()));
|
|
|
}
|
|
|
}
|
|
@@ -1347,7 +1372,7 @@ public class CreatePdfUtil {
|
|
|
} else if (cardTemp.contains("<div class=\"page-box page-box-A3 page-box-0 page-box-less\">")) {
|
|
|
String packageCodeDiv = "<div class=\"page-box page-box-A3 page-box-0 page-box-less\"><div class=\"package-number\" style=\"position: absolute;width: 200px;height: 40px;top: 10px;right: 25%;margin-left: -100px;text-align: center;z-index: 99;\"><img src=\"data:image/png;base64," + packageCodeImg + "\" style=\"display: block; height: 28px; width: 100%\" /><p style=\"line-height: 1; font-size: 12px; margin: 0;\">" + packageCode + "</p></div>";
|
|
|
cardTemp = cardTemp.replaceAll("<div class=\"page-box page-box-A3 page-box-0 page-box-less\">", packageCodeDiv);
|
|
|
- } else if (cardTemp.contains("<div class=\"page-box page-box-A4 page-box-0\">")) {
|
|
|
+ } else if (cardTemp.contains("<div class=\"page-box page-box-A4 page-box-0\">")) {
|
|
|
String packageCodeDiv = "<div class=\"page-box page-box-A4 page-box-0\"><div class=\"package-number\" style=\"position: absolute;width: 200px;height: 40px;top: 10px;right: 25%;margin-left: -100px;text-align: center;z-index: 99;\"><img src=\"data:image/png;base64," + packageCodeImg + "\" style=\"display: block; height: 28px; width: 100%\" /><p style=\"line-height: 1; font-size: 12px; margin: 0;\">" + packageCode + "</p></div>";
|
|
|
cardTemp = cardTemp.replaceAll("<div class=\"page-box page-box-A4 page-box-0\">", packageCodeDiv);
|
|
|
} else if (cardTemp.contains("<div class=\"page-box page-box-A4 page-box-0 page-box-less\">")) {
|