|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.fasterxml.jackson.databind.introspect.BasicClassIntrospector;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
import com.qmth.distributed.print.business.bean.dto.ExamStudentCourseDto;
|
|
import com.qmth.distributed.print.business.bean.dto.ExamStudentCourseDto;
|
|
import com.qmth.distributed.print.business.bean.dto.ExamStudentDto;
|
|
import com.qmth.distributed.print.business.bean.dto.ExamStudentDto;
|
|
@@ -17,10 +18,7 @@ import com.qmth.distributed.print.business.enums.PrintMethodEnum;
|
|
import com.qmth.distributed.print.business.service.ExamDetailService;
|
|
import com.qmth.distributed.print.business.service.ExamDetailService;
|
|
import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
-import com.qmth.teachcloud.common.entity.BasicAttachment;
|
|
|
|
-import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
|
|
-import com.qmth.teachcloud.common.entity.SysOrg;
|
|
|
|
-import com.qmth.teachcloud.common.entity.TBTask;
|
|
|
|
|
|
+import com.qmth.teachcloud.common.entity.*;
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.util.ConvertUtil;
|
|
import com.qmth.teachcloud.common.util.ConvertUtil;
|
|
@@ -150,11 +148,11 @@ public class CreatePdfUtil {
|
|
List<BasicCourse> basicCourses = basicCourseService.findBySchoolIdAndCourseCode(examDetail.getSchoolId(), courseCodes);
|
|
List<BasicCourse> basicCourses = basicCourseService.findBySchoolIdAndCourseCode(examDetail.getSchoolId(), courseCodes);
|
|
for (BasicCourse basicCours : basicCourses) {
|
|
for (BasicCourse basicCours : basicCourses) {
|
|
List<SysOrg> sysOrgs = sysOrgService.findParentsByOrgId(basicCours.getTeachingRoomId());
|
|
List<SysOrg> sysOrgs = sysOrgService.findParentsByOrgId(basicCours.getTeachingRoomId());
|
|
- Set<String> collegeName = sysOrgs.stream().filter(m-> OrgTypeEnum.COLLEGE.equals(m.getType())).map(m->m.getName()).collect(Collectors.toSet());
|
|
|
|
- if(CollectionUtils.isEmpty(collegeName)) {
|
|
|
|
|
|
+ Set<String> collegeName = sysOrgs.stream().filter(m -> OrgTypeEnum.COLLEGE.equals(m.getType())).map(m -> m.getName()).collect(Collectors.toSet());
|
|
|
|
+ if (CollectionUtils.isEmpty(collegeName)) {
|
|
collegeName = sysOrgs.stream().filter(m -> OrgTypeEnum.FACULTY.equals(m.getType())).map(m -> m.getName()).collect(Collectors.toSet());
|
|
collegeName = sysOrgs.stream().filter(m -> OrgTypeEnum.FACULTY.equals(m.getType())).map(m -> m.getName()).collect(Collectors.toSet());
|
|
}
|
|
}
|
|
- if(!CollectionUtils.isEmpty(collegeName)) {
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(collegeName)) {
|
|
stringSet.addAll(collegeName);
|
|
stringSet.addAll(collegeName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -164,7 +162,7 @@ public class CreatePdfUtil {
|
|
htmlMap.put("courseCode", "");
|
|
htmlMap.put("courseCode", "");
|
|
htmlMap.put("collegeName", "");
|
|
htmlMap.put("collegeName", "");
|
|
}
|
|
}
|
|
- List<Long> classIds = examDetailCourseList.stream().filter(m->StringUtils.isNotBlank(m.getClazzId())).map(m-> Long.valueOf(m.getClazzId())).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ List<Long> classIds = examDetailCourseList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzId())).map(m -> Long.valueOf(m.getClazzId())).distinct().collect(Collectors.toList());
|
|
String campusName = CollectionUtils.isEmpty(classIds) ? "" : basicCampusService.findCampusNamesByClazzIdList(classIds, ",");
|
|
String campusName = CollectionUtils.isEmpty(classIds) ? "" : basicCampusService.findCampusNamesByClazzIdList(classIds, ",");
|
|
htmlMap.put("schoolName", schoolName);
|
|
htmlMap.put("schoolName", schoolName);
|
|
htmlMap.put("campusName", campusName);
|
|
htmlMap.put("campusName", campusName);
|
|
@@ -323,14 +321,14 @@ public class CreatePdfUtil {
|
|
ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
|
|
ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
|
|
examStudentDto.setIndex(j + 1);
|
|
examStudentDto.setIndex(j + 1);
|
|
examStudentDto.setName(examStudentDto.getStudentName());
|
|
examStudentDto.setName(examStudentDto.getStudentName());
|
|
- examStudentDto.setExtendFields(getClassName(examStudentDto.getExtendFields()));
|
|
|
|
|
|
+ examStudentDto.setExtendColumn(getClassName(examStudentDto));
|
|
examStudentList1.add(examStudentDto);
|
|
examStudentList1.add(examStudentDto);
|
|
}
|
|
}
|
|
for (int j = htmlTableCount; j < subStudents.size(); j++) {
|
|
for (int j = htmlTableCount; j < subStudents.size(); j++) {
|
|
ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
|
|
ExamStudentDto examStudentDto = gson.fromJson(gson.toJson(subStudents.get(j)), ExamStudentDto.class);
|
|
examStudentDto.setIndex(j + 1);
|
|
examStudentDto.setIndex(j + 1);
|
|
examStudentDto.setName(examStudentDto.getStudentName());
|
|
examStudentDto.setName(examStudentDto.getStudentName());
|
|
- examStudentDto.setExtendFields(getClassName(examStudentDto.getExtendFields()));
|
|
|
|
|
|
+ examStudentDto.setExtendColumn(getClassName(examStudentDto));
|
|
examStudentList2.add(examStudentDto);
|
|
examStudentList2.add(examStudentDto);
|
|
}
|
|
}
|
|
if (examStudentList1.size() > examStudentList2.size()) {
|
|
if (examStudentList1.size() > examStudentList2.size()) {
|
|
@@ -432,7 +430,6 @@ public class CreatePdfUtil {
|
|
/**
|
|
/**
|
|
* 获取试卷pdf
|
|
* 获取试卷pdf
|
|
*
|
|
*
|
|
- *
|
|
|
|
* @param stuPaperType
|
|
* @param stuPaperType
|
|
* @param paperPdfDto
|
|
* @param paperPdfDto
|
|
* @param pdfList
|
|
* @param pdfList
|
|
@@ -443,7 +440,7 @@ public class CreatePdfUtil {
|
|
Set<Integer> pagesList = new HashSet<>();
|
|
Set<Integer> pagesList = new HashSet<>();
|
|
if (!CollectionUtils.isEmpty(paperPdfDto)) {
|
|
if (!CollectionUtils.isEmpty(paperPdfDto)) {
|
|
for (PaperPdfDto dto : paperPdfDto) {
|
|
for (PaperPdfDto dto : paperPdfDto) {
|
|
- if(stuPaperType.equals(dto.getType())){
|
|
|
|
|
|
+ if (stuPaperType.equals(dto.getType())) {
|
|
int pages = dto.getPages();
|
|
int pages = dto.getPages();
|
|
pagesList.add(pages);
|
|
pagesList.add(pages);
|
|
PdfDto pdfDto = PdfUtil.addPdfPage(dto.getFile());
|
|
PdfDto pdfDto = PdfUtil.addPdfPage(dto.getFile());
|
|
@@ -601,7 +598,7 @@ public class CreatePdfUtil {
|
|
private String randomPaperType(String[] unexposedPaperTypes, String exposedPaperTypes, int drawCount) {
|
|
private String randomPaperType(String[] unexposedPaperTypes, String exposedPaperTypes, int drawCount) {
|
|
List<String> finalTypes = new ArrayList<>();
|
|
List<String> finalTypes = new ArrayList<>();
|
|
List<String> unexposedPaperTypesList = new ArrayList<>(Arrays.asList(unexposedPaperTypes));
|
|
List<String> unexposedPaperTypesList = new ArrayList<>(Arrays.asList(unexposedPaperTypes));
|
|
- List<String> exposedPaperTypesList =StringUtils.isBlank(exposedPaperTypes) ? new ArrayList<>() : new ArrayList<>(Arrays.asList(exposedPaperTypes.split(",")));
|
|
|
|
|
|
+ List<String> exposedPaperTypesList = StringUtils.isBlank(exposedPaperTypes) ? new ArrayList<>() : new ArrayList<>(Arrays.asList(exposedPaperTypes.split(",")));
|
|
if (unexposedPaperTypesList.size() - drawCount >= 0) {
|
|
if (unexposedPaperTypesList.size() - drawCount >= 0) {
|
|
for (int i = 0; i < drawCount; i++) {
|
|
for (int i = 0; i < drawCount; i++) {
|
|
int paperRandom = new Random().nextInt(unexposedPaperTypesList.size());
|
|
int paperRandom = new Random().nextInt(unexposedPaperTypesList.size());
|
|
@@ -704,7 +701,7 @@ public class CreatePdfUtil {
|
|
detailService.saveOrUpdate(examDetail);
|
|
detailService.saveOrUpdate(examDetail);
|
|
if (Objects.nonNull(localA3PdfFile)) {
|
|
if (Objects.nonNull(localA3PdfFile)) {
|
|
// ossUtil.ossUpload(dirNameA3, localA3PdfFile, DigestUtils.md5Hex(new FileInputStream(localA3PdfFile)));
|
|
// ossUtil.ossUpload(dirNameA3, localA3PdfFile, DigestUtils.md5Hex(new FileInputStream(localA3PdfFile)));
|
|
- fileStoreUtil.ossUpload(dirNameA3, localA3PdfFile, DigestUtils.md5Hex(new FileInputStream(localA3PdfFile)),fileStoreUtil.getUploadEnumByPath(dirNameA3).getFssType());
|
|
|
|
|
|
+ fileStoreUtil.ossUpload(dirNameA3, localA3PdfFile, DigestUtils.md5Hex(new FileInputStream(localA3PdfFile)), fileStoreUtil.getUploadEnumByPath(dirNameA3).getFssType());
|
|
localA3PdfFile.delete();
|
|
localA3PdfFile.delete();
|
|
}
|
|
}
|
|
if (Objects.nonNull(localA4PdfFile)) {
|
|
if (Objects.nonNull(localA4PdfFile)) {
|
|
@@ -871,11 +868,19 @@ public class CreatePdfUtil {
|
|
/**
|
|
/**
|
|
* 获取班级名称
|
|
* 获取班级名称
|
|
*
|
|
*
|
|
- * @param extendCloumn
|
|
|
|
|
|
+ * @param examStudentDto
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private String getClassName(String extendCloumn) {
|
|
|
|
- List<Map> mapList = JSONObject.parseArray(extendCloumn, Map.class);
|
|
|
|
|
|
+ private String getClassName(ExamStudentDto examStudentDto) {
|
|
|
|
+ String clazzName = null;
|
|
|
|
+ if (StringUtils.isNotBlank(examStudentDto.getClazzId())) {
|
|
|
|
+ BasicClazz basicClazz = basicClazzService.getById(examStudentDto.getClazzId());
|
|
|
|
+ clazzName = Objects.nonNull(basicClazz) ? basicClazz.getClazzName() : null;
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isNotBlank(clazzName)){
|
|
|
|
+ return clazzName;
|
|
|
|
+ }
|
|
|
|
+ List<Map> mapList = JSONObject.parseArray(examStudentDto.getExtendFields(), Map.class);
|
|
for (Map map : mapList) {
|
|
for (Map map : mapList) {
|
|
if (Objects.equals("className", map.get("code").toString())) {
|
|
if (Objects.equals("className", map.get("code").toString())) {
|
|
return map.get("value").toString();
|
|
return map.get("value").toString();
|