|
@@ -255,7 +255,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
|
|
|
ftlList.add(commonService.getFile(basicAttachment.getPath(), false));
|
|
|
if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "SIGN")) {//签到表
|
|
|
- createPdfUtil.createSignBook(basicAttachment, basicSchool.getName(), examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
+ createPdfUtil.createSignBook(basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
} else if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "PACKAGE")) {//卷袋贴
|
|
|
createPdfUtil.createPaperPackage(basicAttachment, basicSchool.getName(), examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
}
|
|
@@ -431,29 +431,29 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
// TODO: 2021/4/20 可以优化
|
|
|
if (ExaminationDBFieldsEnum.STUDENT_CODE.getDesc().equals(name)) {
|
|
|
studentCode = cellValue;
|
|
|
- ConvertUtil.verifyLength(studentCode,10, ExaminationDBFieldsEnum.STUDENT_CODE.getDesc());
|
|
|
+ ConvertUtil.verifyLength(studentCode, 10, ExaminationDBFieldsEnum.STUDENT_CODE.getDesc());
|
|
|
} else if (ExaminationDBFieldsEnum.STUDENT_NAME.getDesc().equals(name)) {
|
|
|
studentName = cellValue;
|
|
|
- ConvertUtil.verifyLength(studentName,15,ExaminationDBFieldsEnum.STUDENT_NAME.getDesc());
|
|
|
+ ConvertUtil.verifyLength(studentName, 15, ExaminationDBFieldsEnum.STUDENT_NAME.getDesc());
|
|
|
} else if (ExaminationDBFieldsEnum.COURSE_CODE.getDesc().equals(name)) {
|
|
|
courseCode = cellValue;
|
|
|
- ConvertUtil.verifyLength(courseCode,10,ExaminationDBFieldsEnum.COURSE_CODE.getDesc());
|
|
|
+ ConvertUtil.verifyLength(courseCode, 10, ExaminationDBFieldsEnum.COURSE_CODE.getDesc());
|
|
|
} else if (ExaminationDBFieldsEnum.COURSE_NAME.getDesc().equals(name)) {
|
|
|
courseName = cellValue;
|
|
|
- ConvertUtil.verifyLength(courseName,20,ExaminationDBFieldsEnum.COURSE_NAME.getDesc());
|
|
|
+ ConvertUtil.verifyLength(courseName, 20, ExaminationDBFieldsEnum.COURSE_NAME.getDesc());
|
|
|
} else if (ExaminationDBFieldsEnum.EXAM_PLACE.getDesc().equals(name)) {
|
|
|
examPlace = cellValue;
|
|
|
- ConvertUtil.verifyLength(examPlace,10,ExaminationDBFieldsEnum.EXAM_PLACE.getDesc());
|
|
|
+ ConvertUtil.verifyLength(examPlace, 10, ExaminationDBFieldsEnum.EXAM_PLACE.getDesc());
|
|
|
} else if (ExaminationDBFieldsEnum.EXAM_ROOM.getDesc().equals(name)) {
|
|
|
examRoom = cellValue;
|
|
|
- ConvertUtil.verifyLength(examRoom,10,ExaminationDBFieldsEnum.EXAM_ROOM.getDesc());
|
|
|
+ ConvertUtil.verifyLength(examRoom, 10, ExaminationDBFieldsEnum.EXAM_ROOM.getDesc());
|
|
|
} else if (ExaminationDBFieldsEnum.EXAM_DATE.getDesc().equals(name)) {
|
|
|
examDate = cellValue;
|
|
|
} else if (ExaminationDBFieldsEnum.EXAM_TIME.getDesc().equals(name)) {
|
|
|
examTime = cellValue;
|
|
|
} else if (ExaminationDBFieldsEnum.PAPER_NUMBER.getDesc().equals(name)) {
|
|
|
paperNumber = cellValue;
|
|
|
- ConvertUtil.verifyLength(paperNumber,15,ExaminationDBFieldsEnum.PAPER_NUMBER.getDesc());
|
|
|
+ ConvertUtil.verifyLength(paperNumber, 15, ExaminationDBFieldsEnum.PAPER_NUMBER.getDesc());
|
|
|
} else {
|
|
|
if ("primary".equals(level)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("有数据库不需要的必选字段 : " + name);
|
|
@@ -500,14 +500,14 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
for (String courseCode : courseCodeList) {
|
|
|
List<String> tmp = dataList.stream().filter(e -> courseCode.equals(String.valueOf(e.get("courseCode"))))
|
|
|
.map(e -> String.valueOf(e.get("paperNumber"))).distinct().collect(Collectors.toList());
|
|
|
- if (tmp.size() != 1){
|
|
|
+ if (tmp.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("课程代码为 " + courseCode + ",对应多个试卷编号 : " + tmp);
|
|
|
}
|
|
|
}
|
|
|
for (String paperNumber : paperNumberList) {
|
|
|
List<String> tmp = dataList.stream().filter(e -> paperNumber.equals(String.valueOf(e.get("paperNumber"))))
|
|
|
.map(e -> String.valueOf(e.get("courseCode"))).distinct().collect(Collectors.toList());
|
|
|
- if (tmp.size() != 1){
|
|
|
+ if (tmp.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("试卷编号为 " + paperNumber + ",对应多个课程代码 : " + tmp);
|
|
|
}
|
|
|
}
|
|
@@ -650,13 +650,13 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
Long[] ids = (Long[]) map.get("ids");
|
|
|
for (Long id : ids) {
|
|
|
ExamTask examTask = examTaskService.getById(id);
|
|
|
- if (Objects.isNull(examTask)){
|
|
|
+ if (Objects.isNull(examTask)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到命题任务");
|
|
|
}
|
|
|
String examTaskSign = examTask.getSchoolId() + "-" + examTask.getCourseName() + "-" + examTask.getPaperNumber();
|
|
|
String firstPath = zipLocalRootPath + File.separator + examTaskSign;
|
|
|
- List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.list(new QueryWrapper<ExamTaskDetail>().lambda().eq(ExamTaskDetail::getExamTaskId,id));
|
|
|
- if (examTaskDetailList.size() != 1){
|
|
|
+ List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.list(new QueryWrapper<ExamTaskDetail>().lambda().eq(ExamTaskDetail::getExamTaskId, id));
|
|
|
+ if (examTaskDetailList.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("获取命题任务详情失败 命题任务id : " + id);
|
|
|
}
|
|
|
ExamTaskDetail examTaskDetail = examTaskDetailList.get(0);
|
|
@@ -667,19 +667,19 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
System.out.println("paperInfo = " + JSON.toJSONString(paperInfo));
|
|
|
Set<Long> attPaperIds = new HashSet<>();
|
|
|
for (Map paperMap : paperInfo) {
|
|
|
- if (Objects.isNull(paperMap.get("attachmentId"))){
|
|
|
+ if (Objects.isNull(paperMap.get("attachmentId"))) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到附件id");
|
|
|
}
|
|
|
Long attachmentId = Long.valueOf(String.valueOf(paperMap.get("attachmentId")));
|
|
|
attPaperIds.add(attachmentId);
|
|
|
}
|
|
|
List<BasicAttachment> paperAttachmentList = basicAttachmentService.listByIds(attPaperIds);
|
|
|
- if (Objects.nonNull(paperAttachmentList)){
|
|
|
+ if (Objects.nonNull(paperAttachmentList)) {
|
|
|
for (BasicAttachment paperAttachment : paperAttachmentList) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(paperAttachment.getPath());
|
|
|
String paperPath = firstPath + File.separator + "试卷" + File.separator + paperAttachment.getName() + paperAttachment.getType();
|
|
|
ossUtil.ossDownload((String) jsonObject.get("path"), paperPath);
|
|
|
- count ++;
|
|
|
+ count++;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -688,53 +688,53 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
System.out.println("confirmInfo = " + JSON.toJSONString(confirmInfo));
|
|
|
Set<Long> attConfirmIds = new HashSet<>();
|
|
|
for (Map confirmMap : confirmInfo) {
|
|
|
- if (Objects.isNull(confirmMap.get("attachmentId"))){
|
|
|
+ if (Objects.isNull(confirmMap.get("attachmentId"))) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到附件id");
|
|
|
}
|
|
|
Long attachmentId = Long.valueOf(String.valueOf(confirmMap.get("attachmentId")));
|
|
|
attConfirmIds.add(attachmentId);
|
|
|
}
|
|
|
List<BasicAttachment> confirmAttachmentList = basicAttachmentService.listByIds(attConfirmIds);
|
|
|
- if (Objects.nonNull(confirmAttachmentList)){
|
|
|
+ if (Objects.nonNull(confirmAttachmentList)) {
|
|
|
for (BasicAttachment confirmAttachment : confirmAttachmentList) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(confirmAttachment.getPath());
|
|
|
String confirmPath = firstPath + File.separator + "审核样本" + File.separator + confirmAttachment.getName() + confirmAttachment.getType();
|
|
|
ossUtil.ossDownload((String) jsonObject.get("path"), confirmPath);
|
|
|
- count ++;
|
|
|
+ count++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 处理题卡
|
|
|
Long cardId = examTaskDetail.getCardId();
|
|
|
ExamCard examCard = examCardService.getById(cardId);
|
|
|
- if (Objects.isNull(examCard)){
|
|
|
+ if (Objects.isNull(examCard)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("找不到答题卡 cardId = " + cardId);
|
|
|
}
|
|
|
MakeMethodEnum makeMethodEnum = examCard.getMakeMethod();
|
|
|
- if (MakeMethodEnum.SELECT.equals(makeMethodEnum)){
|
|
|
+ if (MakeMethodEnum.SELECT.equals(makeMethodEnum)) {
|
|
|
Long templateId = examCard.getTemplateId();
|
|
|
- if (templateId == null || templateId == 0){
|
|
|
+ if (templateId == null || templateId == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("找不到题卡对应的模板 templateId = " + templateId);
|
|
|
}
|
|
|
BasicTemplate basicTemplate = basicTemplateService.getById(templateId);
|
|
|
- if (Objects.isNull(basicTemplate)){
|
|
|
+ if (Objects.isNull(basicTemplate)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("找不到模板信息 templateId = " + templateId);
|
|
|
}
|
|
|
Long attachmentId = basicTemplate.getAttachmentId();
|
|
|
- if (attachmentId == null || attachmentId == 0){
|
|
|
+ if (attachmentId == null || attachmentId == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("找不到模板对应的附件 templateId = " + templateId);
|
|
|
}
|
|
|
BasicAttachment cardAttachment = basicAttachmentService.getById(attachmentId);
|
|
|
- if (Objects.isNull(cardAttachment)){
|
|
|
+ if (Objects.isNull(cardAttachment)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("找不到附件 attachmentId = " + attachmentId);
|
|
|
}
|
|
|
JSONObject jsonObject = JSONObject.parseObject(cardAttachment.getPath());
|
|
|
String cardPath = firstPath + File.separator + "题卡" + File.separator + cardAttachment.getName() + cardAttachment.getType();
|
|
|
ossUtil.ossDownload((String) jsonObject.get("path"), cardPath);
|
|
|
- count ++;
|
|
|
- }else {
|
|
|
- List<ExamCardDetail> examCardDetailList = examCardDetailService.list(new QueryWrapper<ExamCardDetail>().lambda().eq(ExamCardDetail::getCardId,cardId));
|
|
|
- if (examCardDetailList.size() != 1){
|
|
|
+ count++;
|
|
|
+ } else {
|
|
|
+ List<ExamCardDetail> examCardDetailList = examCardDetailService.list(new QueryWrapper<ExamCardDetail>().lambda().eq(ExamCardDetail::getCardId, cardId));
|
|
|
+ if (examCardDetailList.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("题卡明细信息异常 card_id = " + cardId);
|
|
|
}
|
|
|
ExamCardDetail examCardDetail = examCardDetailService.getByCardId(cardId);
|
|
@@ -746,7 +746,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
localFile.getParentFile().mkdirs();
|
|
|
}
|
|
|
FileCopyUtils.copy(bytes, localFile);
|
|
|
- count ++;
|
|
|
+ count++;
|
|
|
}
|
|
|
}
|
|
|
ZipUtil.zip(zipLocalRootPath, zipFile.getPath(), true);
|
|
@@ -758,7 +758,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
tbTask.setResultFilePath(jsonObject.toJSONString());
|
|
|
ConvertUtil.delFolder(zipLocalRootPath);
|
|
|
zipFile.delete();
|
|
|
- map.put("count",count);
|
|
|
+ map.put("count", count);
|
|
|
return map;
|
|
|
}
|
|
|
}
|