|
@@ -16,6 +16,7 @@ import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
import com.qmth.distributed.print.business.bean.params.DownloadPaperFileParam;
|
|
import com.qmth.distributed.print.business.bean.params.DownloadPaperFileParam;
|
|
import com.qmth.distributed.print.business.bean.params.SerialNumberParams;
|
|
import com.qmth.distributed.print.business.bean.params.SerialNumberParams;
|
|
|
|
+import com.qmth.distributed.print.business.bean.result.DictionaryResult;
|
|
import com.qmth.distributed.print.business.bean.result.TSyncExamStudentScoreResult;
|
|
import com.qmth.distributed.print.business.bean.result.TSyncExamStudentScoreResult;
|
|
import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
|
|
import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
@@ -174,6 +175,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
@Resource
|
|
@Resource
|
|
private DownloadService downloadService;
|
|
private DownloadService downloadService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private TeachClazzService teachClazzService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 创建pdf前置条件
|
|
* 创建pdf前置条件
|
|
*
|
|
*
|
|
@@ -1442,7 +1446,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
List<ExcelError> excelErrorTemp = new ArrayList<>();
|
|
List<ExcelError> excelErrorTemp = new ArrayList<>();
|
|
Map<String, SysOrg> collegeOrgMap = new HashMap<>(), teachingRoomMap = new HashMap<>();//学院,部门
|
|
Map<String, SysOrg> collegeOrgMap = new HashMap<>(), teachingRoomMap = new HashMap<>();//学院,部门
|
|
Map<String, BasicCourse> courseMap = new HashMap<>();//课程
|
|
Map<String, BasicCourse> courseMap = new HashMap<>();//课程
|
|
- Map<String, BasicClazz> clazzMap = new HashMap<>();//班级
|
|
|
|
|
|
+ Map<String, DictionaryResult> clazzMap = new HashMap<>();//班级
|
|
String batchNo = SystemConstant.getUuid();
|
|
String batchNo = SystemConstant.getUuid();
|
|
List<TCStatisticsTemp> tcStatisticsImportTempList = new ArrayList<>();
|
|
List<TCStatisticsTemp> tcStatisticsImportTempList = new ArrayList<>();
|
|
Set<Long> collegeIdSet = new HashSet<>(), teachingRoomIdSet = new HashSet<>(), ClazzIdSet = new HashSet<>();
|
|
Set<Long> collegeIdSet = new HashSet<>(), teachingRoomIdSet = new HashSet<>(), ClazzIdSet = new HashSet<>();
|
|
@@ -1456,13 +1460,13 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
SysOrg teachingRoomOrg = this.validSysOrgExists(teachingRoomMap, statisticsImportDto.getTeachingRoomName(), sysUser.getSchoolId(), OrgTypeEnum.TEACHING_ROOM, excelErrorTemp, (y + 1), (i + 1), "开课部门");
|
|
SysOrg teachingRoomOrg = this.validSysOrgExists(teachingRoomMap, statisticsImportDto.getTeachingRoomName(), sysUser.getSchoolId(), OrgTypeEnum.TEACHING_ROOM, excelErrorTemp, (y + 1), (i + 1), "开课部门");
|
|
BasicCourse basicCourse = this.validBasicCourseExists(courseMap, statisticsImportDto.getCourseName(), sysUser.getSchoolId(), statisticsImportDto.getCourseCode(), excelErrorTemp, (y + 1), (i + 1), "课程代码");
|
|
BasicCourse basicCourse = this.validBasicCourseExists(courseMap, statisticsImportDto.getCourseName(), sysUser.getSchoolId(), statisticsImportDto.getCourseCode(), excelErrorTemp, (y + 1), (i + 1), "课程代码");
|
|
String teacherName = statisticsImportDto.getTeacherName();
|
|
String teacherName = statisticsImportDto.getTeacherName();
|
|
- BasicClazz basicClazz = this.validBasicClazzExists(clazzMap, statisticsImportDto.getClazzName(), sysUser.getSchoolId(), excelErrorTemp, (y + 1), (i + 1), "班级名称");
|
|
|
|
|
|
+ DictionaryResult clazz = this.validBasicClazzExists(clazzMap, statisticsImportDto.getClazzName(), sysUser.getSchoolId(), excelErrorTemp, (y + 1), (i + 1), "班级名称");
|
|
|
|
|
|
if (excelErrorTemp.size() == 0) {
|
|
if (excelErrorTemp.size() == 0) {
|
|
collegeIdSet.add(collegeOrg.getId());
|
|
collegeIdSet.add(collegeOrg.getId());
|
|
teachingRoomIdSet.add(teachingRoomOrg.getId());
|
|
teachingRoomIdSet.add(teachingRoomOrg.getId());
|
|
courseSet.add(basicCourse.getCode());
|
|
courseSet.add(basicCourse.getCode());
|
|
- ClazzIdSet.add(basicClazz.getId());
|
|
|
|
|
|
+ ClazzIdSet.add(clazz.getId());
|
|
|
|
|
|
TCStatisticsTemp tcStatistics = new TCStatisticsTemp(collegeOrg.getId(),
|
|
TCStatisticsTemp tcStatistics = new TCStatisticsTemp(collegeOrg.getId(),
|
|
collegeOrg.getName(),
|
|
collegeOrg.getName(),
|
|
@@ -1471,8 +1475,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
basicCourse.getName(),
|
|
basicCourse.getName(),
|
|
basicCourse.getCode(),
|
|
basicCourse.getCode(),
|
|
teacherName,
|
|
teacherName,
|
|
- basicClazz.getId(),
|
|
|
|
- basicClazz.getClazzName(),
|
|
|
|
|
|
+ clazz.getId(),
|
|
|
|
+ clazz.getName(),
|
|
batchNo,
|
|
batchNo,
|
|
sysUser.getId());
|
|
sysUser.getId());
|
|
tcStatisticsImportTempList.add(tcStatistics);
|
|
tcStatisticsImportTempList.add(tcStatistics);
|
|
@@ -1480,7 +1484,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (excelErrorTemp.size() > 0) {
|
|
if (excelErrorTemp.size() > 0) {
|
|
- List<String> errors = excelErrorTemp.stream().map(m -> m.getExcelErrorType()).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> errors = excelErrorTemp.stream().map(ExcelError::getExcelErrorType).collect(Collectors.toList());
|
|
throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(errors));
|
|
throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(errors));
|
|
}
|
|
}
|
|
//加入删除
|
|
//加入删除
|
|
@@ -1488,7 +1492,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
tcStatisticsTempService.saveBatch(tcStatisticsImportTempList);
|
|
tcStatisticsTempService.saveBatch(tcStatisticsImportTempList);
|
|
map.put("dataCount", tcStatisticsImportTempList.size());
|
|
map.put("dataCount", tcStatisticsImportTempList.size());
|
|
tcStatisticsService.importJoinData(sysUser, batchNo);
|
|
tcStatisticsService.importJoinData(sysUser, batchNo);
|
|
- tcStatisticsTempService.removeByIds(tcStatisticsImportTempList.stream().map(s -> s.getId()).collect(Collectors.toSet()));
|
|
|
|
|
|
+ tcStatisticsTempService.removeByIds(tcStatisticsImportTempList.stream().map(BaseEntity::getId).collect(Collectors.toSet()));
|
|
return finalExcelList;
|
|
return finalExcelList;
|
|
});
|
|
});
|
|
return map;
|
|
return map;
|
|
@@ -1693,15 +1697,22 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
if (examTaskPaperFileDtoList.size() == 0){
|
|
if (examTaskPaperFileDtoList.size() == 0){
|
|
throw ExceptionResultEnum.ERROR.exception("没有找到任何试卷信息");
|
|
throw ExceptionResultEnum.ERROR.exception("没有找到任何试卷信息");
|
|
}
|
|
}
|
|
|
|
+ String specialSuccessMessage = "";
|
|
if (Objects.nonNull(paperFileDownloadExposureStatus)){
|
|
if (Objects.nonNull(paperFileDownloadExposureStatus)){
|
|
switch (paperFileDownloadExposureStatus) {
|
|
switch (paperFileDownloadExposureStatus) {
|
|
case EXPOSED_PAPER: // 曝光的
|
|
case EXPOSED_PAPER: // 曝光的
|
|
excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
|
|
excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
|
|
examTaskPaperFileDtoList = examTaskPaperFileDtoList.stream().filter(ExamTaskPaperFileDto::getExposureStatus).collect(Collectors.toList());
|
|
examTaskPaperFileDtoList = examTaskPaperFileDtoList.stream().filter(ExamTaskPaperFileDto::getExposureStatus).collect(Collectors.toList());
|
|
|
|
+ if (examTaskPaperFileDtoList.size() == 0){
|
|
|
|
+ specialSuccessMessage = "所选择的命题任务中没有已曝光的试卷";
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case UNEXPOSED_PAPER: // 未曝光的
|
|
case UNEXPOSED_PAPER: // 未曝光的
|
|
excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
|
|
excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
|
|
examTaskPaperFileDtoList = examTaskPaperFileDtoList.stream().filter(e -> !e.getExposureStatus()).collect(Collectors.toList());
|
|
examTaskPaperFileDtoList = examTaskPaperFileDtoList.stream().filter(e -> !e.getExposureStatus()).collect(Collectors.toList());
|
|
|
|
+ if (examTaskPaperFileDtoList.size() == 0){
|
|
|
|
+ specialSuccessMessage = "所选择的命题任务中没有未曝光的试卷";
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case ALL_PAPER: // 全部试卷
|
|
case ALL_PAPER: // 全部试卷
|
|
excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
|
|
excelName = excelName + "(" + paperFileDownloadExposureStatus.getDesc() + ")";
|
|
@@ -1773,6 +1784,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
boolean cf = pdfFile.createNewFile();
|
|
boolean cf = pdfFile.createNewFile();
|
|
}
|
|
}
|
|
HtmlToPdfUtil.convert(cardLocalHtmlPath, cardLocalPdfPath, PageSizeEnum.A3);
|
|
HtmlToPdfUtil.convert(cardLocalHtmlPath, cardLocalPdfPath, PageSizeEnum.A3);
|
|
|
|
+ specialSuccessMessage = "";
|
|
break;
|
|
break;
|
|
case ONLY_PAPER: // 只下载试卷
|
|
case ONLY_PAPER: // 只下载试卷
|
|
for (ExamTaskPaperFileDto examTaskPaperFileDto : paperCellList) {
|
|
for (ExamTaskPaperFileDto examTaskPaperFileDto : paperCellList) {
|
|
@@ -1836,6 +1848,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
ConvertUtil.delFolder(zipLocalRootPath);
|
|
ConvertUtil.delFolder(zipLocalRootPath);
|
|
zipFile.delete();
|
|
zipFile.delete();
|
|
map.put("count", courseSet.size() + 1);
|
|
map.put("count", courseSet.size() + 1);
|
|
|
|
+ map.put("specialSuccessMessage",specialSuccessMessage);
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1965,40 +1978,52 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 验证课程是否存在
|
|
|
|
|
|
+ * 验证班级是否存在
|
|
*
|
|
*
|
|
- * @param clazzMap
|
|
|
|
- * @param key
|
|
|
|
- * @param schoolId
|
|
|
|
- * @param excelErrorTemp
|
|
|
|
- * @param row
|
|
|
|
- * @param sheet
|
|
|
|
- * @param cloumnName
|
|
|
|
- * @return
|
|
|
|
|
|
+ * @param clazzMap 班级map
|
|
|
|
+ * @param key 班级名称
|
|
|
|
+ * @param schoolId 学校id
|
|
|
|
+ * @param excelErrorTemp 错误信息
|
|
|
|
+ * @param row 行
|
|
|
|
+ * @param sheet 区
|
|
|
|
+ * @param cloumnName 列名
|
|
|
|
+ * @return 班级信息
|
|
*/
|
|
*/
|
|
- private BasicClazz validBasicClazzExists(Map<String, BasicClazz> clazzMap,
|
|
|
|
|
|
+ private DictionaryResult validBasicClazzExists(Map<String, DictionaryResult> clazzMap,
|
|
String key,
|
|
String key,
|
|
Long schoolId,
|
|
Long schoolId,
|
|
List<ExcelError> excelErrorTemp,
|
|
List<ExcelError> excelErrorTemp,
|
|
int row,
|
|
int row,
|
|
int sheet,
|
|
int sheet,
|
|
String cloumnName) {
|
|
String cloumnName) {
|
|
- BasicClazz basicClazz = null;
|
|
|
|
|
|
+ DictionaryResult clazz = null;
|
|
if (!clazzMap.containsKey(key)) {//不存在查询
|
|
if (!clazzMap.containsKey(key)) {//不存在查询
|
|
- QueryWrapper<BasicClazz> basicClazzQueryWrapper = new QueryWrapper<>();
|
|
|
|
- basicClazzQueryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId)
|
|
|
|
- .eq(BasicClazz::getClazzName, key)
|
|
|
|
- .eq(BasicClazz::getEnable, true);
|
|
|
|
- basicClazz = basicClazzService.getOne(basicClazzQueryWrapper);
|
|
|
|
|
|
+ TeachClazz teachClazz = teachClazzService.getOne(new QueryWrapper<TeachClazz>().lambda().eq(TeachClazz::getSchoolId,schoolId).eq(TeachClazz::getTeachClazzName,key));
|
|
|
|
+ if (Objects.nonNull(teachClazz)){
|
|
|
|
+ clazz = new DictionaryResult();
|
|
|
|
+ clazz.setId(teachClazz.getId());
|
|
|
|
+ clazz.setName(teachClazz.getTeachClazzName());
|
|
|
|
+ }else {
|
|
|
|
+ QueryWrapper<BasicClazz> basicClazzQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ basicClazzQueryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId)
|
|
|
|
+ .eq(BasicClazz::getClazzName, key)
|
|
|
|
+ .eq(BasicClazz::getEnable, true);
|
|
|
|
+ BasicClazz basicClazz = basicClazzService.getOne(basicClazzQueryWrapper);
|
|
|
|
+ if (Objects.nonNull(basicClazz)){
|
|
|
|
+ clazz = new DictionaryResult();
|
|
|
|
+ clazz.setId(basicClazz.getId());
|
|
|
|
+ clazz.setName(basicClazz.getClazzName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- basicClazz = clazzMap.get(key);
|
|
|
|
|
|
+ clazz = clazzMap.get(key);
|
|
}
|
|
}
|
|
- if (Objects.isNull(basicClazz)) {
|
|
|
|
|
|
+ if (Objects.isNull(clazz)) {
|
|
excelErrorTemp.add(new ExcelError(row, "excel第" + sheet + "个sheet第" + row + "行[" + cloumnName + "]不存在"));
|
|
excelErrorTemp.add(new ExcelError(row, "excel第" + sheet + "个sheet第" + row + "行[" + cloumnName + "]不存在"));
|
|
} else {
|
|
} else {
|
|
- BasicClazz finalBasicClazz = basicClazz;
|
|
|
|
- clazzMap.computeIfAbsent(key, v -> finalBasicClazz);
|
|
|
|
|
|
+ DictionaryResult finalClazz = clazz;
|
|
|
|
+ clazzMap.computeIfAbsent(key, v -> finalClazz);
|
|
}
|
|
}
|
|
- return basicClazz;
|
|
|
|
|
|
+ return clazz;
|
|
}
|
|
}
|
|
}
|
|
}
|