Merge branch 'dev' of http://47.92.113.182:3000/zcloud_gbs/zcloud_gbs_edu into dev
commit
de90557bad
|
|
@ -8,8 +8,13 @@ import com.zcloud.edu.persistence.dataobject.archives.ArchivesPdfFileDO;
|
||||||
import com.zcloud.edu.persistence.repository.archives.ArchivesPdfFileRepository;
|
import com.zcloud.edu.persistence.repository.archives.ArchivesPdfFileRepository;
|
||||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -33,6 +38,30 @@ public class ArchivesPdfFileQueryExe {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PageResponse<ArchivesPdfFileCO> execute(ArchivesPdfFilePageQry archivesPdfFilePageQry) {
|
public PageResponse<ArchivesPdfFileCO> execute(ArchivesPdfFilePageQry archivesPdfFilePageQry) {
|
||||||
|
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
if(StringUtils.isNotEmpty(archivesPdfFilePageQry.getGeCreateTime())){
|
||||||
|
//增加上00:00:00
|
||||||
|
String dateStr = archivesPdfFilePageQry.getGeCreateTime();
|
||||||
|
try {
|
||||||
|
LocalDate date = LocalDate.parse(dateStr, dateFormatter);
|
||||||
|
LocalDateTime startDateTime = date.atStartOfDay();
|
||||||
|
archivesPdfFilePageQry.setGeCreateTime(startDateTime.toString().replace('T', ' '));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(archivesPdfFilePageQry.getLeCreateTime())){
|
||||||
|
//增加上23:59:59
|
||||||
|
String dateStr = archivesPdfFilePageQry.getLeCreateTime();
|
||||||
|
try {
|
||||||
|
LocalDate date = LocalDate.parse(dateStr, dateFormatter);
|
||||||
|
LocalDateTime endDateTime = date.atTime(LocalTime.MAX);
|
||||||
|
archivesPdfFilePageQry.setLeCreateTime(endDateTime.toString().replace('T', ' '));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> params = PageQueryHelper.toHashMap(archivesPdfFilePageQry);
|
Map<String, Object> params = PageQueryHelper.toHashMap(archivesPdfFilePageQry);
|
||||||
PageResponse<ArchivesPdfFileDO> pageResponse = archivesPdfFileRepository.listPage(params);
|
PageResponse<ArchivesPdfFileDO> pageResponse = archivesPdfFileRepository.listPage(params);
|
||||||
List<ArchivesPdfFileCO> examCenterCOS = archivesPdfFileCoConvertor.converDOsToCOs(pageResponse.getData());
|
List<ArchivesPdfFileCO> examCenterCOS = archivesPdfFileCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||||
|
|
|
||||||
|
|
@ -272,28 +272,30 @@ public class ArchivesQueryExe {
|
||||||
|
|
||||||
|
|
||||||
if (!ObjectUtils.isEmpty(params.getExamSignFlag())) {
|
if (!ObjectUtils.isEmpty(params.getExamSignFlag())) {
|
||||||
String imageUrl = fileUrlConfig.getPrefixUrl() + params.getExamSignFaceUrl();
|
PictureRenderData examSignFacePicture = Pictures.ofUrl(fileUrlConfig.getPrefixUrl() + params.getExamSignFaceUrl(), PictureType.JPEG).size(100, 100).create();//网络图片地址
|
||||||
try (InputStream is = new URL(imageUrl).openStream()) {
|
workItem.put("examSignFacePicture", examSignFacePicture);
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
// String imageUrl = fileUrlConfig.getPrefixUrl() + params.getExamSignFaceUrl();
|
||||||
|
// try (InputStream is = new URL(imageUrl).openStream()) {
|
||||||
// Thumbnailator 自动处理 EXIF 方向,并缩放到 100x100(保持比例)
|
// ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
Thumbnails.of(is)
|
//
|
||||||
.keepAspectRatio(true) // 可选:保持比例,避免拉伸
|
// // Thumbnailator 自动处理 EXIF 方向,并缩放到 100x100(保持比例)
|
||||||
.outputFormat("JPEG")
|
// Thumbnails.of(is)
|
||||||
.toOutputStream(baos);
|
// .keepAspectRatio(true) // 可选:保持比例,避免拉伸
|
||||||
|
// .outputFormat("JPEG")
|
||||||
byte[] imageBytes = baos.toByteArray();
|
// .toOutputStream(baos);
|
||||||
ByteArrayInputStream bis = new ByteArrayInputStream(imageBytes);
|
//
|
||||||
PictureRenderData picture = Pictures.ofStream(bis)
|
// byte[] imageBytes = baos.toByteArray();
|
||||||
.size(100, 100)
|
// ByteArrayInputStream bis = new ByteArrayInputStream(imageBytes);
|
||||||
.create();
|
// PictureRenderData picture = Pictures.ofStream(bis)
|
||||||
|
// .size(100, 100)
|
||||||
workItem.put("examSignFacePicture", picture);
|
// .create();
|
||||||
} catch (Exception e) {
|
//
|
||||||
e.printStackTrace();
|
// workItem.put("examSignFacePicture", picture);
|
||||||
// 可选:插入默认占位图
|
// } catch (Exception e) {
|
||||||
// workItem.put("examSignFacePicture", defaultPicture);
|
// e.printStackTrace();
|
||||||
}
|
// // 可选:插入默认占位图
|
||||||
|
// // workItem.put("examSignFacePicture", defaultPicture);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
String templatePath = "templates/template/studyRecord.docx";
|
String templatePath = "templates/template/studyRecord.docx";
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@ package com.zcloud.edu.command.query.study;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.sun.xml.bind.v2.TODO;
|
||||||
import com.zcloud.edu.command.convertor.study.ClassExamPaperCoConvertor;
|
import com.zcloud.edu.command.convertor.study.ClassExamPaperCoConvertor;
|
||||||
import com.zcloud.edu.dto.clientobject.resource.QuestionCO;
|
import com.zcloud.edu.dto.clientobject.resource.QuestionCO;
|
||||||
import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO;
|
import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO;
|
||||||
|
|
@ -15,6 +17,7 @@ import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
|
||||||
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
|
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
|
||||||
import com.zcloud.edu.persistence.repository.study.ClassRepository;
|
import com.zcloud.edu.persistence.repository.study.ClassRepository;
|
||||||
import com.zcloud.edu.persistence.repository.study.StudentExamRecordRepository;
|
import com.zcloud.edu.persistence.repository.study.StudentExamRecordRepository;
|
||||||
|
import com.zcloud.edu.persistence.repository.study.StudentRepository;
|
||||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
import com.zcloud.gbscommon.utils.Tools;
|
import com.zcloud.gbscommon.utils.Tools;
|
||||||
import com.zcloud.gbscommon.utils.WordToPdfUtil;
|
import com.zcloud.gbscommon.utils.WordToPdfUtil;
|
||||||
|
|
@ -28,9 +31,11 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -47,6 +52,7 @@ public class ClassExamPaperQueryExe {
|
||||||
private final QuestionRepository questionRepository;
|
private final QuestionRepository questionRepository;
|
||||||
private final ClassRepository classRepository;
|
private final ClassRepository classRepository;
|
||||||
private final StudentExamRecordRepository studentExamRecordRepository;
|
private final StudentExamRecordRepository studentExamRecordRepository;
|
||||||
|
private final StudentRepository studentRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
|
|
@ -79,6 +85,9 @@ public class ClassExamPaperQueryExe {
|
||||||
*/
|
*/
|
||||||
public SingleResponse<ClassExamPaperCO> executeGetInfoByClassId(String classId) {
|
public SingleResponse<ClassExamPaperCO> executeGetInfoByClassId(String classId) {
|
||||||
ClassExamPaperDO classExamPaperDO = classExamPaperRepository.findByClassId(classId);
|
ClassExamPaperDO classExamPaperDO = classExamPaperRepository.findByClassId(classId);
|
||||||
|
if(classExamPaperDO == null){
|
||||||
|
return SingleResponse.of(null);
|
||||||
|
}
|
||||||
List<QuestionDO> questionDOList = questionRepository.getInfoByExamPaperId(classExamPaperDO.getExamPaperId());
|
List<QuestionDO> questionDOList = questionRepository.getInfoByExamPaperId(classExamPaperDO.getExamPaperId());
|
||||||
List<QuestionCO> questionCOList = BeanUtil.copyToList(questionDOList, QuestionCO.class);
|
List<QuestionCO> questionCOList = BeanUtil.copyToList(questionDOList, QuestionCO.class);
|
||||||
ClassExamPaperCO classExamPaperCO = new ClassExamPaperCO();
|
ClassExamPaperCO classExamPaperCO = new ClassExamPaperCO();
|
||||||
|
|
@ -86,8 +95,16 @@ public class ClassExamPaperQueryExe {
|
||||||
classExamPaperCO.setQuestionList(questionCOList);
|
classExamPaperCO.setQuestionList(questionCOList);
|
||||||
//考试人数
|
//考试人数
|
||||||
|
|
||||||
Long count = studentExamRecordRepository.getCountByClassExamPaperId(classExamPaperDO.getClassExamPaperId());
|
|
||||||
classExamPaperCO.setClassExamPaperStudentCount( count);
|
List<ClassDO> stuCountList = studentRepository.countStudentByClass(Arrays.asList(classId));
|
||||||
|
//判断当前登录人是否是教师
|
||||||
|
|
||||||
|
if (stuCountList != null && stuCountList.size() > 0){
|
||||||
|
Map<String, ClassDO> stuCountMap = stuCountList.stream().collect(Collectors.toMap(ClassDO::getClassId, classDO -> classDO));
|
||||||
|
classExamPaperCO.setClassExamPaperStudentCount( stuCountMap.get(classId).getSignCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return SingleResponse.of(classExamPaperCO);
|
return SingleResponse.of(classExamPaperCO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,6 @@ public class ClassExamPaperCO extends ClientObject {
|
||||||
private String env;
|
private String env;
|
||||||
|
|
||||||
@ApiModelProperty(value = "班级考试人数")
|
@ApiModelProperty(value = "班级考试人数")
|
||||||
private Long classExamPaperStudentCount;
|
private Integer classExamPaperStudentCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ public class ClassPageQry extends PageQuery {
|
||||||
private String likeName;
|
private String likeName;
|
||||||
private String eqTrainType;
|
private String eqTrainType;
|
||||||
private Integer eqState;
|
private Integer eqState;
|
||||||
|
private Integer neState;
|
||||||
private String geStartTime;
|
private String geStartTime;
|
||||||
private String leStartTime;
|
private String leStartTime;
|
||||||
private String geEndTime;
|
private String geEndTime;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue