|
@@ -325,8 +325,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
public Map<String, Object> executeExaminationLogic(Map<String, Object> map) throws Exception {
|
|
|
List<ExaminationExportDto> examinationExportDtoList = examDetailService.findExaminationExportDtoDatasource(map);
|
|
|
|
|
|
- System.out.println("examinationResultList = " + JSON.toJSONString(examinationExportDtoList));
|
|
|
-
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
ExcelUtil.excelMake(ExaminationExportDto.class, examinationExportDtoList, outputStream);
|
|
|
InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
|
|
@@ -381,7 +379,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
String importFilePath = tbTask.getImportFilePath();
|
|
|
Map importFilePathMap = JSONObject.parseObject(importFilePath);
|
|
|
String path = String.valueOf(importFilePathMap.get("path"));
|
|
|
- System.out.println("path = " + path);
|
|
|
Workbook workbook;
|
|
|
if (path.endsWith(SystemConstant.XLSX)) {
|
|
|
workbook = new XSSFWorkbook(inputStream);
|
|
@@ -399,7 +396,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
if (totalRows > 1 && sheet.getRow(0) != null) {
|
|
|
totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
|
|
|
}
|
|
|
- System.out.println("行 : " + totalRows + "\n列 : " + totalCells);
|
|
|
Row head = sheet.getRow(0);
|
|
|
List<String> headList = new ArrayList<>();
|
|
|
// 将必填字段匹配excel解析的表头索引
|
|
@@ -416,14 +412,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
// 搜索所有有效字段 excel中的表头是否包含
|
|
|
for (FieldsDto fieldsDto : fieldsDtoList) {
|
|
|
if (!headList.contains(fieldsDto.getName())) {
|
|
|
- System.out.println("exception " + fieldsDto.getName());
|
|
|
throw ExceptionResultEnum.ERROR.exception("学校考务必填字段 :'" + fieldsDto.getName() + "' 不存在");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- System.out.println("headList : " + headList);
|
|
|
- System.out.println("fieldsDtoList : " + JSONObject.toJSONString(fieldsDtoList));
|
|
|
-
|
|
|
List<Map<String, Object>> dataList = new ArrayList<>();
|
|
|
|
|
|
for (int r = 1; r < totalRows; r++) {
|
|
@@ -446,6 +437,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
String level = fieldsDto.getLevel();
|
|
|
|
|
|
Cell cell = row.getCell(index);
|
|
|
+ if (cell == null) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("excel中第[" + (r + 1) + "]行,第[" + (index + 1) + "]列,字段[" + name + "]必填");
|
|
|
+ }
|
|
|
String cellValue = String.valueOf(ExcelUtil.convert(cell));
|
|
|
if (cellValue == null || cellValue.length() < 1 || cellValue.equals("null")) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("excel中第[" + (r + 1) + "]行,第[" + (index + 1) + "]列,字段[" + name + "]必填");
|
|
@@ -673,7 +667,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
String firstPath = zipLocalRootPath + File.separator + examTaskSign;
|
|
|
List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.list(new QueryWrapper<ExamTaskDetail>().lambda().eq(ExamTaskDetail::getExamTaskId, id));
|
|
|
if (examTaskDetailList.size() != 1) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("获取命题任务详情失败 命题任务id : " + id);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("获取命题任务详情失败");
|
|
|
}
|
|
|
ExamTaskDetail examTaskDetail = examTaskDetailList.get(0);
|
|
|
|
|
@@ -724,25 +718,25 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
Long cardId = examTaskDetail.getCardId();
|
|
|
ExamCard examCard = examCardService.getById(cardId);
|
|
|
if (Objects.isNull(examCard)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("找不到答题卡 cardId = " + cardId);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("找不到答题卡");
|
|
|
}
|
|
|
MakeMethodEnum makeMethodEnum = examCard.getMakeMethod();
|
|
|
if (MakeMethodEnum.SELECT.equals(makeMethodEnum)) {
|
|
|
Long templateId = examCard.getTemplateId();
|
|
|
if (templateId == null || templateId == 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("找不到题卡对应的模板 templateId = " + templateId);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("找不到题卡对应的模板");
|
|
|
}
|
|
|
BasicTemplate basicTemplate = basicTemplateService.getById(templateId);
|
|
|
if (Objects.isNull(basicTemplate)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("找不到模板信息 templateId = " + templateId);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("找不到模板信息");
|
|
|
}
|
|
|
Long attachmentId = basicTemplate.getAttachmentId();
|
|
|
if (attachmentId == null || attachmentId == 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("找不到模板对应的附件 templateId = " + templateId);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("找不到模板对应的附件");
|
|
|
}
|
|
|
BasicAttachment cardAttachment = basicAttachmentService.getById(attachmentId);
|
|
|
if (Objects.isNull(cardAttachment)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("找不到附件 attachmentId = " + attachmentId);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("找不到附件");
|
|
|
}
|
|
|
JSONObject jsonObject = JSONObject.parseObject(cardAttachment.getPath());
|
|
|
String cardPath = firstPath + File.separator + "题卡" + File.separator + cardAttachment.getName() + cardAttachment.getType();
|
|
@@ -751,7 +745,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
} 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);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("题卡明细信息异常");
|
|
|
}
|
|
|
ExamCardDetail examCardDetail = examCardDetailService.getByCardId(cardId);
|
|
|
String htmlContent = examCardDetail.getHtmlContent();
|