|
@@ -47,6 +47,7 @@ import java.io.*;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Field;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -114,6 +115,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
@Resource
|
|
@Resource
|
|
BasicExamRuleService basicExamRuleService;
|
|
BasicExamRuleService basicExamRuleService;
|
|
|
|
|
|
|
|
+ private static volatile ConcurrentHashMap<Integer, String> paperTypeMap = null;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 创建pdf逻辑
|
|
* 创建pdf逻辑
|
|
*
|
|
*
|
|
@@ -165,6 +168,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
}
|
|
}
|
|
attachmentIds = Objects.isNull(attachmentIds) ? attachmentIds = new HashSet<>() : attachmentIds;
|
|
attachmentIds = Objects.isNull(attachmentIds) ? attachmentIds = new HashSet<>() : attachmentIds;
|
|
ftlList = Objects.isNull(ftlList) ? ftlList = new HashSet<>() : ftlList;
|
|
ftlList = Objects.isNull(ftlList) ? ftlList = new HashSet<>() : ftlList;
|
|
|
|
+ paperTypeMap = Objects.isNull(paperTypeMap) ? paperTypeMap = new ConcurrentHashMap<>() : paperTypeMap;
|
|
for (ExamDetail examDetail : examDetailList) {
|
|
for (ExamDetail examDetail : examDetailList) {
|
|
tbTask.setObjName(examDetail.getExamRoom() + "-" + examDetail.getExamPlace());
|
|
tbTask.setObjName(examDetail.getExamRoom() + "-" + examDetail.getExamPlace());
|
|
//查询examDetailCourse
|
|
//查询examDetailCourse
|
|
@@ -234,12 +238,12 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
List<ExamCardDetail> examCardDetailList = examCardDetailService.list(examCardDetailQueryWrapper);
|
|
List<ExamCardDetail> examCardDetailList = examCardDetailService.list(examCardDetailQueryWrapper);
|
|
|
|
|
|
//抽取卷型
|
|
//抽取卷型
|
|
- String paperType = Objects.nonNull(paperTypeParam) ? paperTypeParam : createPdfUtil.getPaperType(examPrintPlan, examTaskDetail);
|
|
|
|
|
|
+ String paperType = Objects.nonNull(paperTypeParam) ? paperTypeParam : createPdfUtil.getPaperType(examPrintPlan, examTaskDetail, examDetail, examDetailCourse);
|
|
examTaskDetail.setRelatePaperType(paperType);
|
|
examTaskDetail.setRelatePaperType(paperType);
|
|
|
|
|
|
//获取试卷pdf
|
|
//获取试卷pdf
|
|
PdfDto pdfDto = createPdfUtil.getPaperPdf(paperType, examTaskDetail, examPrintPlan.getBackupCount(), paperPdfTempList, backupPaperTempPdfList);
|
|
PdfDto pdfDto = createPdfUtil.getPaperPdf(paperType, examTaskDetail, examPrintPlan.getBackupCount(), paperPdfTempList, backupPaperTempPdfList);
|
|
- examDetailCourse.setPaperPagesA3(pdfDto.getPageCount());
|
|
|
|
|
|
+ examDetailCourse.setPaperPagesA3(Objects.nonNull(pdfDto) ? pdfDto.getPageCount() : examDetailCourse.getPaperPagesA3());
|
|
paperPdfList.addAll(paperPdfTempList);
|
|
paperPdfList.addAll(paperPdfTempList);
|
|
backupPaperPdfList.addAll(backupPaperTempPdfList);
|
|
backupPaperPdfList.addAll(backupPaperTempPdfList);
|
|
|
|
|
|
@@ -353,7 +357,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
jsonObject.put(SystemConstant.TYPE, SystemConstant.OSS);
|
|
jsonObject.put(SystemConstant.TYPE, SystemConstant.OSS);
|
|
jsonObject.put(SystemConstant.PATH, dirName);
|
|
jsonObject.put(SystemConstant.PATH, dirName);
|
|
jsonObject.put(SystemConstant.UPLOAD_TYPE, UploadFileEnum.FILE);
|
|
jsonObject.put(SystemConstant.UPLOAD_TYPE, UploadFileEnum.FILE);
|
|
- map.put("path", jsonObject.toString());
|
|
|
|
|
|
+ map.put(SystemConstant.PATH, jsonObject.toString());
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -384,7 +388,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
}
|
|
}
|
|
String importFilePath = tbTask.getImportFilePath();
|
|
String importFilePath = tbTask.getImportFilePath();
|
|
Map importFilePathMap = JSONObject.parseObject(importFilePath);
|
|
Map importFilePathMap = JSONObject.parseObject(importFilePath);
|
|
- String path = String.valueOf(importFilePathMap.get("path"));
|
|
|
|
|
|
+ String path = String.valueOf(importFilePathMap.get(SystemConstant.PATH));
|
|
Workbook workbook;
|
|
Workbook workbook;
|
|
if (path.endsWith(SystemConstant.XLSX)) {
|
|
if (path.endsWith(SystemConstant.XLSX)) {
|
|
workbook = new XSSFWorkbook(inputStream);
|
|
workbook = new XSSFWorkbook(inputStream);
|
|
@@ -452,7 +456,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
|
|
|
for (Field examinationImportDtoField : examinationImportDtoFields) {
|
|
for (Field examinationImportDtoField : examinationImportDtoFields) {
|
|
ExcelDBFieldDesc excelDBFieldDesc = examinationImportDtoField.getAnnotation(ExcelDBFieldDesc.class);
|
|
ExcelDBFieldDesc excelDBFieldDesc = examinationImportDtoField.getAnnotation(ExcelDBFieldDesc.class);
|
|
- if (excelDBFieldDesc == null){
|
|
|
|
|
|
+ if (excelDBFieldDesc == null) {
|
|
// 如果没有注解,说明该数据库必须字段不是从excel中获得的,直接跳过
|
|
// 如果没有注解,说明该数据库必须字段不是从excel中获得的,直接跳过
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -460,12 +464,12 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
// 如果数据库字段中文名和必填字段中文名称对应,则通过反射为数据库必选字段赋值
|
|
// 如果数据库字段中文名和必填字段中文名称对应,则通过反射为数据库必选字段赋值
|
|
String dbName = excelDBFieldDesc.name();
|
|
String dbName = excelDBFieldDesc.name();
|
|
int dbLength = excelDBFieldDesc.length();
|
|
int dbLength = excelDBFieldDesc.length();
|
|
- if (dbName.equals(name)){
|
|
|
|
|
|
+ if (dbName.equals(name)) {
|
|
if (dbLength > 0) {
|
|
if (dbLength > 0) {
|
|
ConvertUtil.verifyLength(cellValue, dbLength, dbName);
|
|
ConvertUtil.verifyLength(cellValue, dbLength, dbName);
|
|
}
|
|
}
|
|
examinationImportDtoField.setAccessible(true);
|
|
examinationImportDtoField.setAccessible(true);
|
|
- examinationImportDtoField.set(examinationImportDto,cellValue);
|
|
|
|
|
|
+ examinationImportDtoField.set(examinationImportDto, cellValue);
|
|
match = true;
|
|
match = true;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -594,8 +598,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
|
|
JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
|
|
StringJoiner stringJoinerPdf = new StringJoiner("")
|
|
StringJoiner stringJoinerPdf = new StringJoiner("")
|
|
.add(SystemConstant.TEMP_FILES_DIR).add(File.separator)
|
|
.add(SystemConstant.TEMP_FILES_DIR).add(File.separator)
|
|
- .add((String) jsonObject.get("path"));
|
|
|
|
- sourceFiles.add(ossUtil.ossDownload((String) jsonObject.get("path"), stringJoinerPdf.toString()));
|
|
|
|
|
|
+ .add((String) jsonObject.get(SystemConstant.PATH));
|
|
|
|
+ sourceFiles.add(ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), stringJoinerPdf.toString()));
|
|
}
|
|
}
|
|
FileUtil.doZip(zipFile, sourceFiles);
|
|
FileUtil.doZip(zipFile, sourceFiles);
|
|
ossUtil.ossUpload(dirName.toString(), zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));
|
|
ossUtil.ossUpload(dirName.toString(), zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));
|
|
@@ -676,7 +680,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
for (BasicAttachment paperAttachment : paperAttachmentList) {
|
|
for (BasicAttachment paperAttachment : paperAttachmentList) {
|
|
JSONObject jsonObject = JSONObject.parseObject(paperAttachment.getPath());
|
|
JSONObject jsonObject = JSONObject.parseObject(paperAttachment.getPath());
|
|
String paperPath = firstPath + File.separator + "试卷" + File.separator + paperAttachment.getName() + paperAttachment.getType();
|
|
String paperPath = firstPath + File.separator + "试卷" + File.separator + paperAttachment.getName() + paperAttachment.getType();
|
|
- ossUtil.ossDownload((String) jsonObject.get("path"), paperPath);
|
|
|
|
|
|
+ ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath);
|
|
count++;
|
|
count++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -697,7 +701,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
for (BasicAttachment confirmAttachment : confirmAttachmentList) {
|
|
for (BasicAttachment confirmAttachment : confirmAttachmentList) {
|
|
JSONObject jsonObject = JSONObject.parseObject(confirmAttachment.getPath());
|
|
JSONObject jsonObject = JSONObject.parseObject(confirmAttachment.getPath());
|
|
String confirmPath = firstPath + File.separator + "审核样本" + File.separator + confirmAttachment.getName() + confirmAttachment.getType();
|
|
String confirmPath = firstPath + File.separator + "审核样本" + File.separator + confirmAttachment.getName() + confirmAttachment.getType();
|
|
- ossUtil.ossDownload((String) jsonObject.get("path"), confirmPath);
|
|
|
|
|
|
+ ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), confirmPath);
|
|
count++;
|
|
count++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -728,7 +732,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
}
|
|
}
|
|
JSONObject jsonObject = JSONObject.parseObject(cardAttachment.getPath());
|
|
JSONObject jsonObject = JSONObject.parseObject(cardAttachment.getPath());
|
|
String cardPath = firstPath + File.separator + "题卡" + File.separator + cardAttachment.getName() + cardAttachment.getType();
|
|
String cardPath = firstPath + File.separator + "题卡" + File.separator + cardAttachment.getName() + cardAttachment.getType();
|
|
- ossUtil.ossDownload((String) jsonObject.get("path"), cardPath);
|
|
|
|
|
|
+ ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), cardPath);
|
|
count++;
|
|
count++;
|
|
} else {
|
|
} else {
|
|
List<ExamCardDetail> examCardDetailList = examCardDetailService.list(new QueryWrapper<ExamCardDetail>().lambda().eq(ExamCardDetail::getCardId, cardId));
|
|
List<ExamCardDetail> examCardDetailList = examCardDetailService.list(new QueryWrapper<ExamCardDetail>().lambda().eq(ExamCardDetail::getCardId, cardId));
|
|
@@ -759,4 +763,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
map.put("count", count);
|
|
map.put("count", count);
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static ConcurrentHashMap<Integer, String> getPaperTypeMap() {
|
|
|
|
+ return paperTypeMap;
|
|
|
|
+ }
|
|
}
|
|
}
|