添加一期一档下载功能并优化一人一档处理

dev
zhangyue 2026-02-11 09:10:00 +08:00
parent 3780e465ff
commit 53849a7693
46 changed files with 860 additions and 76 deletions

View File

@ -1,9 +1,33 @@
#FROM jjb-registry-registry.cn-hangzhou.cr.aliyuncs.com/pub/jdk:1.8.0_202
#
#ENV TZ=Asia/Shanghai
#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#
#COPY ./start/target/start.jar /opt/app.jar
#
#
#ENTRYPOINT ["java", "-jar", "/opt/app.jar"]
FROM jjb-registry-registry.cn-hangzhou.cr.aliyuncs.com/pub/jdk:1.8.0_202
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# === 修复 CentOS 8 EOL 问题:切换到 vault 归档源 ===
RUN sed -i 's|mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-*.repo && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
# 安装字体工具
RUN yum install -y fontconfig mkfontdir && \
yum clean all
# 安装宋体
RUN mkdir -p /usr/share/fonts/chinese
COPY fonts/simsun.ttc /usr/share/fonts/chinese/
RUN chmod 644 /usr/share/fonts/chinese/simsun.ttc && \
fc-cache -fv
COPY ./start/target/start.jar /opt/app.jar
ENTRYPOINT ["java", "-jar", "/opt/app.jar"]

BIN
fonts/simsun.ttc Normal file

Binary file not shown.

View File

@ -0,0 +1,39 @@
学员考核成绩统计表
班级名称:{{className}}
公司名称
{{corpName}}
培训时间
班级名称
{{startTime}} 至 {{endTime}}
{{className}}
应参加培训人数
实际参加培训人数
{{studentCount}}
{{signCount}}
合格学员名单
{{pass_work_list}}序号
姓名
身份证
手机号
性别
结业考试成绩
[index]
[name]
[userIdCard]
[phone]
[sex]
[stateName]
未合格学员名单
{{fail_work_list}}序号
姓名
身份证
手机号
性别
结业考试成绩
[index]
[name]
[userIdCard]
[phone]
[sex]
[stateName]

View File

@ -0,0 +1,6 @@
{{examName}}
(满分:{{examScore}}分)
{{question_list}}
[questionTypeName] [index].[questionDry] (题目分值:[score] 正确答案:[choiceAnswer] 学员答案:[answer]
[optionsText]

View File

@ -5,6 +5,7 @@
分数:{{examScore}}
考试时间:{{examTimeBegin}}
签字:
{{@signPicture}}
[questionTypeName] [index].[questionDry] (题目分值:[score] 正确答案:[choiceAnswer] 学员答案:[answer]
A[optionA] B[optionB]
[optionsText]

View File

@ -0,0 +1,16 @@
人员安全培训档案
姓 名:{{name}}
身份证号:{{userIdCard}}
建档日期:{{endTime}}
单位名称(公章):

View File

@ -0,0 +1,5 @@
安全培训教材或课2程讲义
{{curriculumName}}教材讲义{{chapter_list}}
[index].[name]
课件描述:[coursewareIntroduce]

View File

@ -0,0 +1,5 @@
安全培训教材或课程讲义
{{curriculumName}}教材讲义{{chapter_list}}
[index].[name]
[chapter]

View File

@ -0,0 +1,18 @@
培训影像资料
班级名称:{{className}}
{{sign_list}}序号
学员姓名
身份证号
手机
头像
签到照片
考试照片
[index]
[studentName]
[userIdCard]
[phone]
[@facePicture]
[@signPicture]
[@examPicture]
备注:仅限用于线上学习证明材料,其他使用无效

View File

@ -0,0 +1,29 @@
生产经营单位安全培训教材会审表
教材名称
{{curriculumName}}
出版书号
{{bookNum}}
编写单位
{{corpName}}
编写时间
{{writeDate}}
教材类型
{{materialType}}
会审地点
{{address}}
主持人
{{compere}}
会审时间
{{auditDate}}
安全培训教材会审情况
{{record_list}}审查人员
工作部门
职务/职称
审查意见
[reviewUser]
[department]
[duties]
[checkOpinion]
会审意见
{{reviewOpinions}}

View File

@ -0,0 +1,19 @@
安全培训教育记录及签字表
日期
{{startTime}}至{{endTime}}
培训地点
{{trainingLocation}}
人数
{{studentCount}}
培训教师
{{teacherName}}
培训内容
{{trainSubject}}
受培训人
{{sign_list}}序号
姓名
签字
[index]
[studentName]
[@picture]

View File

@ -1,6 +1,7 @@
package com.zcloud.edu.web.archives;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext;
@ -72,9 +73,15 @@ public class ArchivesController {
}
@ApiOperation("下载一人一档")
@PostMapping("/downloadPersonArchives")
public SingleResponse<ClassArchivesDTO> downloadPersonArchives(@RequestBody ArchivesQry qry) {
public Response downloadPersonArchives(@RequestBody ArchivesQry qry) {
archivesService.downloadPersonArchives(qry);
return null;
return Response.buildSuccess();
}
@ApiOperation("下载一期一档")
@PostMapping("/downloadClassArchives")
public Response downloadClassArchives(@RequestBody ArchivesQry qry) {
archivesService.downloadClassArchives(qry);
return Response.buildSuccess();
}

View File

@ -22,5 +22,9 @@
<artifactId>web-infrastructure</artifactId>
</dependency>
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -2,36 +2,43 @@ package com.zcloud.edu.command.query.archives;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.unit.DataUnit;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.deepoove.poi.data.PictureRenderData;
import com.deepoove.poi.data.PictureType;
import com.deepoove.poi.data.Pictures;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.edu.command.convertor.archives.ArchivesPdfFileCoConvertor;
import com.zcloud.edu.command.convertor.study.StudentCoConvertor;
import com.zcloud.edu.command.convertor.study.StudentExamRecordCoConvertor;
import com.zcloud.edu.command.convertor.study.StudentExamRecordItemCoConvertor;
import com.zcloud.edu.command.convertor.archives.ArchivesReviewCoConvertor;
import com.zcloud.edu.command.convertor.archives.ArchivesReviewRecordCoConvertor;
import com.zcloud.edu.command.convertor.study.*;
import com.zcloud.edu.domain.model.archives.ArchivesPdfFileE;
import com.zcloud.edu.domain.model.archives.ClassArchivesE;
import com.zcloud.edu.domain.model.archives.PersonArchivesE;
import com.zcloud.edu.domain.model.study.*;
import com.zcloud.edu.dto.archives.ArchivesPdfFilePageQry;
import com.zcloud.edu.dto.archives.ArchivesQry;
import com.zcloud.edu.dto.clientobject.archives.ArchivesPdfFileCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamRecordCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamRecordItemCO;
import com.zcloud.edu.dto.clientobject.archives.ArchivesReviewCO;
import com.zcloud.edu.dto.clientobject.archives.ArchivesReviewRecordCO;
import com.zcloud.edu.dto.clientobject.resource.QuestionCO;
import com.zcloud.edu.dto.clientobject.study.*;
import com.zcloud.edu.dto.data.archives.ClassArchivesDTO;
import com.zcloud.edu.dto.data.archives.PersonArchivesDTO;
import com.zcloud.edu.persistence.dataobject.QuestionDO;
import com.zcloud.edu.persistence.dataobject.archives.ArchivesPdfFileDO;
import com.zcloud.edu.persistence.dataobject.archives.ArchivesReviewDO;
import com.zcloud.edu.persistence.dataobject.archives.ArchivesReviewRecordDO;
import com.zcloud.edu.persistence.dataobject.study.*;
import com.zcloud.edu.persistence.repository.archives.ArchivesPdfFileRepository;
import com.zcloud.edu.persistence.repository.archives.ArchivesReviewRecordRepository;
import com.zcloud.edu.persistence.repository.archives.ArchivesReviewRepository;
import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
import com.zcloud.edu.persistence.repository.study.*;
import com.zcloud.gbscommon.utils.DateUtil;
import com.zcloud.gbscommon.utils.PageQueryHelper;
import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.gbscommon.utils.WordToPdfUtil;
import com.zcloud.gbscommon.utils.*;
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import net.coobird.thumbnailator.Thumbnails;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.dubbo.config.annotation.DubboReference;
@ -41,9 +48,15 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.lang.reflect.InvocationTargetException;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -66,12 +79,23 @@ public class ArchivesQueryExe {
private final StudentExamRecordRepository studentExamRecordRepository;
private final StudentExamRecordItemRepository studentExamRecordItemRepository;
private final StudentExamRecordItemCoConvertor studentExamRecordItemCoConvertor;
private final ArchivesReviewRepository archivesReviewRepository;
private final ArchivesReviewRecordRepository archivesReviewRecordRepository;
private final ArchivesReviewCoConvertor archivesReviewCoConvertor;
private final ArchivesReviewRecordCoConvertor archivesReviewRecordCoConvertor;
private final ClassCurriculumChapterCoConvertor classCurriculumChapterCoConvertor;
private final ClassCurriculumCoConvertor classCurriculumCoConvertor;
private final ClassExamPaperRepository classExamPaperRepository;
private final QuestionRepository questionRepository;
private final StudentSignCoConvertor studentSignCoConvertor;
private static String prefixUrl;
// = "https://jpfz.qhdsafety.com/gbsFileTest/";
// public static Integer corePoolSize;
@Value("${file.url}")
public void setPrefixUrl(String prefixUrlProperties) {
System.out.println("prefixUrlProperties-----"+prefixUrlProperties);
prefixUrl = prefixUrlProperties;
}
@ -156,7 +180,7 @@ public class ArchivesQueryExe {
}
// 新增档案下载记录
ArchivesPdfFileE archivesPdfFileE = new ArchivesPdfFileE();
archivesPdfFileE.init("student", personArchivesDTO.getStudentId(), 1);
archivesPdfFileE.init("student", personArchivesDTO.getStudentId(), 1, AuthContext.getTenantId(), personArchivesDTO.getName()+"-"+personArchivesDTO.getClassName());
ArchivesPdfFileDO archivesPdfFileDO = new ArchivesPdfFileDO();
BeanUtils.copyProperties(archivesPdfFileE, archivesPdfFileDO);
archivesPdfFileRepository.save(archivesPdfFileDO);
@ -166,29 +190,50 @@ public class ArchivesQueryExe {
@Async("archivesAsyncExecutor")
public void execteGeneratePdf(ArchivesQry qry, PersonArchivesDTO params){
List<byte[]> byteArrayList = new ArrayList<>();
if (qry.getTypeList().contains(1)){
byteArrayList.add(execteHomepage(params));
System.out.println("1-------------------------------------------------------------");
}
if (qry.getTypeList().contains(2)){
byteArrayList.add(execteAttendanceRecord(params));
System.out.println("2------------------------------------------------------------");
}
if (qry.getTypeList().contains(3)){
byteArrayList.add(execteStudentRecord(params));
System.out.println("3-------------------------------------------------------------");
}
if (qry.getTypeList().contains(4)){
byteArrayList.add(execteStudyRecord(params));
System.out.println("4-------------------------------------------------------------");
}
if (qry.getTypeList().contains(5)){
byteArrayList.add(execteExamRecord(params));
System.out.println("5-------------------------------------------------------------");
}
try {
byte[] pdf = WordToPdfUtil.mergeWordToPdf(byteArrayList);
String filepath = zcloudImgFilesFacade.saveFile(pdf, params.getName()+"-"+params.getClassName()+"-"+ DateUtil.getSdfTimes()+".pdf","personArchives", params.getClassCorpinfoId());
System.out.println(filepath+"filepath-------------------------------------------------------------");
ArchivesPdfFileE archivesPdfFileE = new ArchivesPdfFileE();
archivesPdfFileE.initEdit(params.getArchivesPdfFileId(), filepath, 1, null);
ArchivesPdfFileDO archivesPdfFileDO = new ArchivesPdfFileDO();
BeanUtils.copyProperties(archivesPdfFileE, archivesPdfFileDO);
// archivesPdfFileRepository.updateById(archivesPdfFileDO);
System.out.println(archivesPdfFileDO.toString());
archivesPdfFileRepository.updateById(archivesPdfFileDO);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public byte[] execteHomepage(PersonArchivesDTO params){
try {
Map<String, Object> workItem = PropertyUtils.describe( params);
String templatePath = "templates/template/homepage.docx";
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
return outputStream.toByteArray();
} catch (Exception e) {
throw new RuntimeException(e);
}
@ -208,7 +253,9 @@ public class ArchivesQueryExe {
public byte[] execteStudentRecord(PersonArchivesDTO params){
try {
Map<String, Object> workItem = PropertyUtils.describe( params);
PictureRenderData picture = Pictures.ofUrl(prefixUrl + params.getUserAvatarUrl(), PictureType.JPEG).size(100, 100).create();//网络图片地址
String url = "https://jpfz.qhdsafety.com/gbsFileTest/";
System.out.println("prefixUrl-----"+prefixUrl);
PictureRenderData picture = Pictures.ofUrl(url + params.getUserAvatarUrl(), PictureType.JPEG).size(100, 100).create();//网络图片地址
workItem.put("img", picture);
String templatePath = "templates/template/studentInfo.docx";
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
@ -227,10 +274,37 @@ public class ArchivesQueryExe {
PictureRenderData signFacePicture = Pictures.ofUrl(prefixUrl + params.getSignFaceUrl(), PictureType.JPEG).size(100, 100).create();//网络图片地址
workItem.put("signFacePicture", signFacePicture);
}
if(!ObjectUtils.isEmpty(params.getExamSignFlag())){
PictureRenderData examSignFacePicture = Pictures.ofUrl(prefixUrl + params.getExamSignFaceUrl(), PictureType.JPEG).size(100, 100).create();//网络图片地址
workItem.put("examSignFacePicture", examSignFacePicture);
// if(!ObjectUtils.isEmpty(params.getExamSignFlag())){
// PictureRenderData examSignFacePicture = Pictures.ofUrl(prefixUrl + params.getExamSignFaceUrl(), PictureType.JPEG).size(100, 100).create();//网络图片地址
// workItem.put("examSignFacePicture", examSignFacePicture);
// }
if (!ObjectUtils.isEmpty(params.getExamSignFlag())) {
String imageUrl = prefixUrl + params.getExamSignFaceUrl();
try (InputStream is = new URL(imageUrl).openStream()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Thumbnailator 自动处理 EXIF 方向,并缩放到 100x100保持比例
Thumbnails.of(is)
.keepAspectRatio(true) // 可选:保持比例,避免拉伸
.outputFormat("JPEG")
.toOutputStream(baos);
byte[] imageBytes = baos.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(imageBytes);
PictureRenderData picture = Pictures.ofStream(bis)
.size(100, 100)
.create();
workItem.put("examSignFacePicture", picture);
} catch (Exception e) {
e.printStackTrace();
// 可选:插入默认占位图
// workItem.put("examSignFacePicture", defaultPicture);
}
}
String templatePath = "templates/template/studyRecord.docx";
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
return outputStream.toByteArray();
@ -248,30 +322,38 @@ public class ArchivesQueryExe {
Map<String, Object> itemMap = PropertyUtils.describe( item);
int index = atomicIndex.getAndIncrement();
itemMap.put("index", index);
String optionsText = null;
if(item.getQuestionType() == 1){
itemMap.put("questionTypeName", "单选题");
optionsText = "A" + item.getOptionA() + "\n" +
"B" + item.getOptionB() + "\n" +
"C" + item.getOptionC() + "\n" +
"D" + item.getOptionD();
} else if(item.getQuestionType() == 2){
itemMap.put("questionTypeName", "多选题");
optionsText = "A" + item.getOptionA() + "\n" +
"B" + item.getOptionB() + "\n" +
"C" + item.getOptionC() + "\n" +
"D" + item.getOptionD();
}else if(item.getQuestionType() == 3){
itemMap.put("questionTypeName", "判断题");
optionsText = "A" + item.getOptionA() + " B" + item.getOptionB();
}
itemMap.put("optionsText", optionsText);
workList.add(itemMap);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
workItem.put("examRecord_list", workList);
// if(!ObjectUtils.isEmpty(params.getStudentExamRecord().getSignUrl())){
// PictureRenderData signPicture = Pictures.ofUrl(prefixUrl + params.getStudentExamRecord().getSignUrl(), PictureType.JPEG).size(100, 100).create();//网络图片地址
// workItem.put("signPicture", signPicture);
// }
// if(!ObjectUtils.isEmpty(params.getExamSignFlag())){
// PictureRenderData examSignFacePicture = Pictures.ofUrl(prefixUrl + params.getExamSignFaceUrl(), PictureType.JPEG).size(100, 100).create();//网络图片地址
// workItem.put("examSignFacePicture", examSignFacePicture);
// }
workItem.put("name", params.getName());
workItem.put("className", params.getClassName());
if(!ObjectUtils.isEmpty(params.getStudentExamRecord().getSignUrl())){
PictureRenderData signPicture = Pictures.ofUrl(prefixUrl + params.getStudentExamRecord().getSignUrl(), PictureType.JPEG).size(50, 15).create();//网络图片地址
workItem.put("signPicture", signPicture);
}
String templatePath = "templates/template/exam.docx";
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
System.out.println("5555555555555");
return outputStream.toByteArray();
} catch (Exception e) {
throw new RuntimeException(e);
@ -280,5 +362,487 @@ public class ArchivesQueryExe {
public ClassArchivesDTO downloadClassArchives(ArchivesQry qry){
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("classId", qry.getClassId());
List<ArchivesReviewCO> reviewCOList = new ArrayList<>();
List<ClassCurriculumCO> curriculumList = new ArrayList<>();
List<StudentSignCO> signList = new ArrayList<>();
List<ClassCurriculumE> classCurList = new ArrayList<>();
ClassExamPaperCO classExamPaperCO = new ClassExamPaperCO();
List<StudentCO> passStudentList = new ArrayList<StudentCO>();
List<StudentCO> failStudentList = new ArrayList<StudentCO>();
Long stuCount = 0L;
ClassDO classDO = classRepository.getByClassId(qry.getClassId());
ClassE classE = new ClassE();
BeanUtils.copyProperties(classDO, classE);
// 教材会审表
if (qry.getTypeList().contains(1)){
// 查询所有教材会审表
List<ArchivesReviewDO> reviewList = archivesReviewRepository.listAll(params);
String reviewIds = reviewList.stream()
.map(ArchivesReviewDO::getArchivesReviewId)
.filter(archivesReviewId -> archivesReviewId != null && !archivesReviewId.trim().isEmpty()) // 非 null 且非空(可选 trim
.collect(Collectors.joining(","));
reviewCOList = archivesReviewCoConvertor.converDOsToCOs(reviewList);
// 查询子表
params.put("inArchivesReviewId", reviewIds);
List<ArchivesReviewRecordDO> reviewRecordList = archivesReviewRecordRepository.listAll(params);
if(reviewRecordList != null && reviewRecordList.size() > 0){
List<ArchivesReviewRecordCO> reviewRecordCOList = archivesReviewRecordCoConvertor.converDOsToCOs(reviewRecordList);
// 子表放到主表下
Map<String, List<ArchivesReviewRecordCO>> reviewRecordCOMap = reviewRecordCOList.stream().collect(Collectors.groupingBy(ArchivesReviewRecordCO::getArchivesReviewId));
reviewCOList.forEach(reviewCO -> {
reviewCO.setArchivesReviewRecordList(reviewRecordCOMap.get(reviewCO.getArchivesReviewId()));
});
}
}
// 安全培训教材或课程讲义
if (qry.getTypeList().contains(2)){
params.put("eqClassId", qry.getClassId());
List<ClassCurriculumDO> curList = classCurriculumRepository.listAll(params);
List<String> classCurriculumIds = curList.stream().map(ClassCurriculumDO::getClassCurriculumId).collect(Collectors.toList());
List<ClassCurriculumChapterDO> chapterList = classCurriculumChapterRepository.listByClassCurriculumIds(classCurriculumIds);
List<ClassCurriculumChapterCO> chapterCoList = classCurriculumChapterCoConvertor.converDOsToCOs(chapterList);
List<ClassCurriculumChapterCO> resultList = Tools.buildEntityTree(chapterCoList, "classCurriculumChapterId", "parentId", "childCurriculumChapterCOList", "0");
Map<String, List<ClassCurriculumChapterCO>> chapterMap = resultList.stream().collect(Collectors.groupingBy(ClassCurriculumChapterCO::getClassCurriculumId));
curriculumList = classCurriculumCoConvertor.converDOsToCOs(curList);
curriculumList.stream().forEach(bean -> {
bean.setCurriculumChapterCOList(chapterMap.get(bean.getClassCurriculumId()));
});
}
if (qry.getTypeList().contains(3) || qry.getTypeList().contains(4) || qry.getTypeList().contains(6)){
// 查询学员数量
List<StudentDO> stuList = studentRepository.listAll(params);
stuCount = Long.valueOf(stuList.size());
List<StudentCO> stuCOList = BeanUtil.copyToList(stuList, StudentCO.class);
// 获取通过和未通过学员
stuCOList.forEach(stu -> {
if (stu.getState() == 0){
failStudentList.add(stu);
}
if (stu.getState() == 1){
passStudentList.add(stu);
}
});
// 学员签到
List<StudentSignDO> studentSignList = studentSignRepository.listAllByStudent(params);
signList = studentSignCoConvertor.converDOsToCOs(studentSignList);
if(qry.getTypeList().contains(3)){
// 课程信息
List<ClassCurriculumDO> curEList = classCurriculumRepository.listAll(params);
classCurList = BeanUtil.copyToList(curEList, ClassCurriculumE.class);
}
}
// if (qry.getTypeList().contains(4)){
//
// ClassDO classDO = classRepository.getByClassId(qry.getClassId());
// ClassE classE = new ClassE();
// BeanUtils.copyProperties(classDO, classE);
// List<StudentSignDO> studentSignList = studentSignRepository.listAllByStudent(params);
// classArchivesDTO.setSignList(BeanUtil.copyToList(studentSignList, StudentSignCO.class));
// }
if(qry.getTypeList().contains(5)){
ClassExamPaperDO classExamPaperDO = classExamPaperRepository.findByClassId(qry.getClassId());
List<QuestionDO> questionDOList = questionRepository.getInfoByExamPaperId(classExamPaperDO.getExamPaperId());
List<QuestionCO> questionCOList = BeanUtil.copyToList(questionDOList, QuestionCO.class);
BeanUtils.copyProperties(classExamPaperDO, classExamPaperCO);
classExamPaperCO.setQuestionList(questionCOList);
}
ClassArchivesDTO classArchivesDTO = new ClassArchivesDTO();
ClassArchivesE classArchivesE = new ClassArchivesE();
classArchivesE.initArchives(classE, stuCount, classCurList, signList.size());
BeanUtils.copyProperties(classArchivesE, classArchivesDTO);
classArchivesDTO.setPassStudentList(passStudentList);
classArchivesDTO.setFailStudentList(failStudentList);
classArchivesDTO.setClassPaper(classExamPaperCO);
SSOUser ssoUser = AuthContext.getCurrentUser();
classArchivesDTO.setCorpinfoId(ssoUser.getTenantId());
classArchivesDTO.setArchivesReviewList(reviewCOList);
// 新增档案下载记录
ArchivesPdfFileE archivesPdfFileE = new ArchivesPdfFileE();
archivesPdfFileE.init("class", classArchivesDTO.getClassId(), 2, AuthContext.getTenantId(), classArchivesDTO.getClassName());
ArchivesPdfFileDO archivesPdfFileDO = new ArchivesPdfFileDO();
BeanUtils.copyProperties(archivesPdfFileE, archivesPdfFileDO);
archivesPdfFileRepository.save(archivesPdfFileDO);
classArchivesDTO.setArchivesPdfFileId(archivesPdfFileDO.getId());
return classArchivesDTO;
}
@Async("archivesAsyncExecutor")
public void execteClassGeneratePdf(ArchivesQry qry, ClassArchivesDTO params) {
String tempDir = System.getProperty("java.io.tmpdir");
List<File> stringList = new ArrayList<>();
try {
if (qry.getTypeList().contains(1)){
String zipString = execteReview(params);
stringList.add(new File(zipString));
}
if (qry.getTypeList().contains(2)){
String zipString = execteClassCurriculum(params);
stringList.add(new File(zipString));
}
if (qry.getTypeList().contains(3)){
byte[] word = execteSign(params);
List<byte[]> byteArrayList = new ArrayList<>();
byteArrayList.add(word);
byte[] pdf = WordToPdfUtil.mergeWordToPdf(byteArrayList);
Files.write(Paths.get(tempDir+"aaa/"+params.getClassName()+"-签字表-"+DateUtil.getSdfTimes()+".pdf"), pdf);
stringList.add(new File(tempDir+"aaa/"+params.getClassName()+"-签字表-"+DateUtil.getSdfTimes()+".pdf"));
}
if (qry.getTypeList().contains(4)){
byte[] word = exectePicture(params);
List<byte[]> byteArrayList = new ArrayList<>();
byteArrayList.add(word);
byte[] pdf = WordToPdfUtil.mergeWordToPdf(byteArrayList);
Files.write(Paths.get(tempDir+"aaa/"+params.getClassName()+"-影像资料-"+DateUtil.getSdfTimes()+".pdf"), pdf);
stringList.add(new File(tempDir+"aaa/"+params.getClassName()+"-影像资料-"+DateUtil.getSdfTimes()+".pdf"));
}
if (qry.getTypeList().contains(5)){
byte[] word = execteClassPaper(params);
List<byte[]> byteArrayList = new ArrayList<>();
byteArrayList.add(word);
byte[] pdf = WordToPdfUtil.mergeWordToPdf(byteArrayList);
Files.write(Paths.get(tempDir+"aaa/"+params.getClassName()+"-试卷-"+DateUtil.getSdfTimes()+".pdf"), pdf);
stringList.add(new File(tempDir+"aaa/"+params.getClassName()+"-试卷-"+DateUtil.getSdfTimes()+".pdf"));
}
if (qry.getTypeList().contains(6)){
byte[] word = execteClassExamResult(params);
List<byte[]> byteArrayList = new ArrayList<>();
byteArrayList.add(word);
byte[] pdf = WordToPdfUtil.mergeWordToPdf(byteArrayList);
Files.write(Paths.get(tempDir+"aaa/"+params.getClassName()+"-学员考核成绩统计表-"+DateUtil.getSdfTimes()+".pdf"), pdf);
stringList.add(new File(tempDir+"aaa/"+params.getClassName()+"-学员考核成绩统计表-"+DateUtil.getSdfTimes()+".pdf"));
}
FileZip.zipList(tempDir+"aaa/"+params.getClassName()+"-"+ DateUtil.getSdfTimes()+"zipzip.zip",stringList );
File file = new File(tempDir+"aaa/"+params.getClassName()+"-"+ DateUtil.getSdfTimes()+"zipzip.zip");
byte[] bytes = Files.readAllBytes(file.toPath());
String filepath = zcloudImgFilesFacade.saveFile(bytes, params.getClassName()+"-"+ DateUtil.getSdfTimes()+"zipzip.zip","classArchives", params.getCorpinfoId());
ArchivesPdfFileE archivesPdfFileE = new ArchivesPdfFileE();
archivesPdfFileE.initEdit(params.getArchivesPdfFileId(), filepath, 1, null);
ArchivesPdfFileDO archivesPdfFileDO = new ArchivesPdfFileDO();
BeanUtils.copyProperties(archivesPdfFileE, archivesPdfFileDO);
archivesPdfFileRepository.updateById(archivesPdfFileDO);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
} finally {
// FileUtil.delFile();
}
}
/**
*
* @param params
* @return
*/
public String execteReview(ClassArchivesDTO params){
try {
if (params.getArchivesReviewList() != null && params.getArchivesReviewList().size() > 0){
String tempDir = System.getProperty("java.io.tmpdir");
Map<String, byte[]> byteArrayMap = new HashMap<>();
for (ArchivesReviewCO item : params.getArchivesReviewList()){
byte[] word = execteReviewInfo(item);
List<byte[]> byteArrayList = new ArrayList<>();
byteArrayList.add(word);
byte[] pdf = WordToPdfUtil.mergeWordToPdf(byteArrayList);
// String filepath = zcloudImgFilesFacade.saveFile(pdf, item.getCurriculumName()+"-教材会审表-"+ DateUtil.getSdfTimes()+".pdf","classArchives", params.getCorpinfoId());
byteArrayMap.put(item.getCurriculumName()+"-教材会审表-"+ DateUtil.getSdfTimes()+".pdf", pdf);
}
FileZip.writeByteArraysToZip(tempDir+"aaa/"+params.getClassName()+"-教材会审表-"+DateUtil.getSdfTimes()+".zip", byteArrayMap);
return tempDir+"aaa/"+params.getClassName()+"-教材会审表-"+DateUtil.getSdfTimes()+".zip";
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
public byte[] execteReviewInfo(ArchivesReviewCO params) throws Exception {
Map<String, Object> workItem = PropertyUtils.describe(params);
ArrayList<Object> workList = CollUtil.newArrayList();
String templatePath = "templates/template/review.docx";
if (params.getArchivesReviewRecordList() != null && params.getArchivesReviewRecordList().size() > 0){
for (ArchivesReviewRecordCO item : params.getArchivesReviewRecordList()){
Map<String, Object> itemMap = PropertyUtils.describe(item);
workList.add(itemMap);
}
}
workItem.put("record_list", workList);
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
return outputStream.toByteArray();
}
/**
*
* @param params
* @return
*/
public String execteClassCurriculum(ClassArchivesDTO params){
try {
if (params.getClassCurriculumList() != null && params.getClassCurriculumList().size() > 0){
String tempDir = System.getProperty("java.io.tmpdir");
Map<String, byte[]> byteArrayMap = new HashMap<>();
for (ClassCurriculumCO item : params.getClassCurriculumList()){
byte[] word = execteClassCurriculumInfo(item);
List<byte[]> byteArrayList = new ArrayList<>();
byteArrayList.add(word);
byte[] pdf = WordToPdfUtil.mergeWordToPdf(byteArrayList);
// String filepath = zcloudImgFilesFacade.saveFile(pdf, item.getCurriculumName()+"-教材会审表-"+ DateUtil.getSdfTimes()+".pdf","classArchives", params.getCorpinfoId());
byteArrayMap.put(item.getCurriculumName()+"-安全培训教材或课程讲义-"+ DateUtil.getSdfTimes()+".pdf", pdf);
}
FileZip.writeByteArraysToZip(tempDir+"aaa/"+params.getClassName()+"-安全培训教材或课程讲义-"+DateUtil.getSdfTimes()+".zip", byteArrayMap);
return tempDir+"aaa/"+params.getClassName()+"-安全培训教材或课程讲义-"+DateUtil.getSdfTimes()+".zip";
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
public byte[] execteClassCurriculumInfo(ClassCurriculumCO params) throws Exception {
String templatePath = "templates/template/jc.docx";
if (params.getCatalogueLevel() == 2){
templatePath = "templates/template/jc2.docx";
}
Map<String, Object> workItem = PropertyUtils.describe(params);
ArrayList<Object> workList = CollUtil.newArrayList();
if (params.getCurriculumChapterCOList() != null && params.getCurriculumChapterCOList().size() > 0){
AtomicInteger atomicIndex = new AtomicInteger(1);
for (ClassCurriculumChapterCO item : params.getCurriculumChapterCOList()){
Map<String, Object> itemMap = PropertyUtils.describe(item);
workList.add(itemMap);
int index = atomicIndex.getAndIncrement();
itemMap.put("index", index);
if (params.getCatalogueLevel() == 2){
String chapter = "";
AtomicInteger childAtomicIndex = new AtomicInteger(1);
for (ClassCurriculumChapterCO child : item.getChildCurriculumChapterCOList()){
chapter += "\t"+childAtomicIndex.getAndIncrement()+"."+child.getName()+"\n" +
"\t"+"\t"+"课件描述:"+ child.getCoursewareIntroduce()+"\n";
}
itemMap.put("chapter", chapter);
}
}
}
workItem.put("chapter_list", workList);
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
return outputStream.toByteArray();
}
/**
*
* @param params
* @return
*/
public byte[] execteSign(ClassArchivesDTO params){
try {
Map<String, Object> workItem = PropertyUtils.describe( params);
String url = "https://jpfz.qhdsafety.com/gbsFileTest/";
// String url = "http://192.168.20.240:9787/mnt/";
ArrayList<Object> workList = CollUtil.newArrayList();
if (params.getSignList() != null && params.getSignList().size() > 0){
AtomicInteger atomicIndex = new AtomicInteger(1);
for (StudentSignCO item : params.getSignList()){
Map<String, Object> itemMap = PropertyUtils.describe(item);
PictureRenderData picture = Pictures.ofUrl(url + item.getSignUrl(), PictureType.JPEG).size(100, 100).create();//网络图片地址
itemMap.put("picture", picture);
int index = atomicIndex.getAndIncrement();
itemMap.put("index", index);
workList.add(itemMap);
}
}
workItem.put("sign_list", workList);
String templatePath = "templates/template/sign.docx";
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
return outputStream.toByteArray();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
/**
*
* @param params
* @return
*/
public byte[] exectePicture(ClassArchivesDTO params){
try {
Map<String, Object> workItem = PropertyUtils.describe( params);
// String url = "https://jpfz.qhdsafety.com/gbsFileTest/";
String url = "http://192.168.20.240:9787/mnt/";
ArrayList<Object> workList = CollUtil.newArrayList();
if (params.getSignList() != null && params.getSignList().size() > 0){
AtomicInteger atomicIndex = new AtomicInteger(1);
for (StudentSignCO item : params.getSignList()){
byte[] userIdCardBytes = Base64.getDecoder().decode(item.getUserIdCard());
String userIdCardString = new String(userIdCardBytes);
item.setUserIdCard(userIdCardString);
Map<String, Object> itemMap = PropertyUtils.describe(item);
if(!ObjectUtils.isEmpty(item.getSignFaceUrl())){
PictureRenderData signPicture = Pictures.ofUrl(url + item.getSignFaceUrl(), PictureType.JPEG).size(50, 50).create();//网络图片地址
itemMap.put("signPicture", signPicture);
}
if(!ObjectUtils.isEmpty(item.getExamFaceUrl())){
PictureRenderData examPicture = Pictures.ofUrl(url + item.getExamFaceUrl(), PictureType.JPEG).size(50, 50).create();//网络图片地址
itemMap.put("examPicture", examPicture);
}
if(!ObjectUtils.isEmpty(item.getExamFaceUrl())){
PictureRenderData facePicture = Pictures.ofUrl(url + item.getUserAvatarUrl(), PictureType.JPEG).size(50, 50).create();//网络图片地址
itemMap.put("facePicture", facePicture);
}
int index = atomicIndex.getAndIncrement();
itemMap.put("index", index);
workList.add(itemMap);
}
}
workItem.put("sign_list", workList);
String templatePath = "templates/template/picture_data.docx";
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
return outputStream.toByteArray();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
/**
*
* @param params
* @return
*/
public byte[] execteClassPaper(ClassArchivesDTO params){
try {
Map<String, Object> workItem = PropertyUtils.describe( params.getClassPaper());
ArrayList<Object> workList = CollUtil.newArrayList();
AtomicInteger atomicIndex = new AtomicInteger(1);
params.getClassPaper().getQuestionList().forEach(item -> {
try {
Map<String, Object> itemMap = PropertyUtils.describe( item);
int index = atomicIndex.getAndIncrement();
itemMap.put("index", index);
String optionsText = null;
if(item.getQuestionType() == 1){
itemMap.put("questionTypeName", "单选题");
optionsText = "A" + item.getOptionA() + "\n" +
"B" + item.getOptionB() + "\n" +
"C" + item.getOptionC() + "\n" +
"D" + item.getOptionD();
} else if(item.getQuestionType() == 2){
itemMap.put("questionTypeName", "多选题");
optionsText = "A" + item.getOptionA() + "\n" +
"B" + item.getOptionB() + "\n" +
"C" + item.getOptionC() + "\n" +
"D" + item.getOptionD();
}else if(item.getQuestionType() == 3){
itemMap.put("questionTypeName", "判断题");
optionsText = "A" + item.getOptionA() + " B" + item.getOptionB();
}
itemMap.put("optionsText", optionsText);
workList.add(itemMap);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
workItem.put("question_list", workList);
workItem.put("className", params.getClassName());
String templatePath = "templates/template/class_paper.docx";
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
return outputStream.toByteArray();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
/**
*
* @param params
* @return
*/
public byte[] execteClassExamResult(ClassArchivesDTO params){
try {
Map<String, Object> workItem = PropertyUtils.describe( params);
ArrayList<Object> passWorkList = initWorkList(params.getPassStudentList());
ArrayList<Object> failWorkList = initWorkList(params.getFailStudentList());
workItem.put("pass_work_list", passWorkList);
workItem.put("fail_work_list", failWorkList);
String templatePath = "templates/template/class_exam_result.docx";
ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
return outputStream.toByteArray();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
private ArrayList<Object> initWorkList(List<StudentCO> studentCOList){
ArrayList<Object> workList = CollUtil.newArrayList();
AtomicInteger atomicIndex = new AtomicInteger(1);
studentCOList.forEach(item -> {
try {
Map<String, Object> itemMap = PropertyUtils.describe(item);
itemMap.put("stateName", !ObjectUtils.isEmpty(item.getState()) && item.getState() == 1 ? "通过" : "未通过");
if (!ObjectUtils.isEmpty(item.getUserIdCard())){
byte[] userIdCardBytes = Base64.getDecoder().decode(item.getUserIdCard());
String userIdCardString = new String(userIdCardBytes);
itemMap.put("userIdCard", userIdCardString);
itemMap.put("sex", getGender(userIdCardString));
}
int index = atomicIndex.getAndIncrement();
itemMap.put("index", index);
workList.add(itemMap);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
return workList;
}
public static String getGender(String userIdCardString) {
if (userIdCardString == null || userIdCardString.length() != 18) {
throw new IllegalArgumentException("身份证号码必须为18位");
}
// 获取第17位字符索引16
char genderChar = userIdCardString.charAt(16);
// 转为数字
int genderNum = Character.getNumericValue(genderChar);
if (genderNum % 2 == 0) {
return "女";
} else {
return "男";
}
}
}

View File

@ -7,6 +7,7 @@ import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.edu.command.convertor.archives.ArchivesReviewCoConvertor;
import com.zcloud.edu.command.convertor.archives.ArchivesReviewRecordCoConvertor;
import com.zcloud.edu.domain.model.archives.ArchivesReviewE;
import com.zcloud.edu.dto.archives.ArchivesQry;
import com.zcloud.edu.dto.archives.ArchivesReviewPageQry;
import com.zcloud.edu.dto.clientobject.archives.ArchivesReviewCO;
import com.zcloud.edu.dto.clientobject.archives.ArchivesReviewRecordCO;

View File

@ -109,7 +109,6 @@ public class StudentQueryExe {
PersonArchivesE personArchivesE = new PersonArchivesE();
personArchivesE.init(studentE, classE, classCurList);
PersonArchivesDTO personArchivesDTO = new PersonArchivesDTO();
BeanUtils.copyProperties(personArchivesE, personArchivesDTO);

View File

@ -15,10 +15,7 @@ import com.zcloud.edu.persistence.dataobject.study.ClassDO;
import com.zcloud.edu.persistence.dataobject.study.ClassExamPaperDO;
import com.zcloud.edu.persistence.dataobject.study.StudentExamRecordDO;
import com.zcloud.edu.persistence.dataobject.study.StudentExamRecordItemDO;
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
import com.zcloud.edu.persistence.repository.study.ClassRepository;
import com.zcloud.edu.persistence.repository.study.StudentExamRecordItemRepository;
import com.zcloud.edu.persistence.repository.study.StudentExamRecordRepository;
import com.zcloud.edu.persistence.repository.study.*;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
@ -26,7 +23,9 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -43,6 +42,7 @@ public class StudentExamRecordAddExe {
private final StudentExamRecordItemRepository studentExamRecordItemRepository;
private final StudentExamRecordRepository studentExamRecordRepository;
private final ClassRepository classRepository;
private final StudentRepository studentRepository;
@Transactional(rollbackFor = Exception.class)
public SingleResponse<StudentExamRecordCO> execute(StudentExamRecordAddCmd cmd) {
ClassDO classDO = classRepository.getByClassId(cmd.getClassId());
@ -63,6 +63,12 @@ public class StudentExamRecordAddExe {
try {
res = studentExamRecordGateway.add(studentExamRecordE);
studentExamRecordItemRepository.saveBatch(BeanUtil.copyToList(queList, StudentExamRecordItemDO.class));
if (studentExamRecordE.getResult() == 1){
Map<String, Object> params = new HashMap<>();
params.put("state",1);
params.put("studentId", studentExamRecordE.getStudentId());
studentRepository.updateStudent(params);
}
} catch (Exception e) {
throw new RuntimeException(e);
}

View File

@ -15,6 +15,7 @@ import com.zcloud.edu.dto.archives.ArchivesReviewAddCmd;
import com.zcloud.edu.dto.archives.ArchivesReviewPageQry;
import com.zcloud.edu.dto.archives.ArchivesReviewUpdateCmd;
import com.zcloud.edu.dto.clientobject.archives.ArchivesReviewCO;
import com.zcloud.edu.dto.data.archives.ClassArchivesDTO;
import com.zcloud.edu.dto.data.archives.PersonArchivesDTO;
import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.gbscommon.utils.WordToPdfUtil;
@ -47,41 +48,18 @@ public class ArchivesServiceImpl implements ArchivesServiceI {
@Override
public void downloadPersonArchives(ArchivesQry qry) {
// HashMap<String, Object> workItem = new HashMap<>();
// workItem.put("qry", "555");
// String templatePath = "templates/template/category_score_list.docx";
try {
// ByteArrayOutputStream outputStream = Tools.renderTemplate(templatePath, workItem);
// workItem.put("qry", "16516851");
// ByteArrayOutputStream outputStream1 = Tools.renderTemplate(templatePath, workItem);
//
// List<byte[]> byteArrayList = new ArrayList<>();
// byteArrayList.add(outputStream.toByteArray());
// byteArrayList.add(outputStream1.toByteArray());
// byte[] pdf = WordToPdfUtil.mergeWordToPdf(byteArrayList);
// byte[] pdfBytes = WordToPdfUtil.convertWordBytesToPdfBytes(outputStream.toByteArray());
// String s = zcloudImgFilesFacade.saveFile(pdf, "clockSign11.pdf","clockSign");
//
// System.out.println(s);
} catch (Exception e) {
throw new RuntimeException(e);
}
PersonArchivesDTO personArchivesDTO = archivesQueryExe.downloadPersonArchives(qry);
// 首页
// archivesQueryExe.execteHomePage(personArchivesDTO);
// 查询学时证明
archivesQueryExe.execteGeneratePdf(qry,personArchivesDTO);
// 查询学习档案
// archivesQueryExe.execteStudyArchives(personArchivesDTO);
// 查询学习记录
// archivesQueryExe.execteStudyRecord(personArchivesDTO);
// 查询考试记录
// archivesQueryExe.execteStudentExamRecord(personArchivesDTO);
System.out.println("下载成功");
}
@Override
public void downloadClassArchives(ArchivesQry qry) {
ClassArchivesDTO classArchivesDTO = archivesQueryExe.downloadClassArchives(qry);
archivesQueryExe.execteClassGeneratePdf(qry,classArchivesDTO);
System.out.println("下载成功");
}
}

View File

@ -16,5 +16,6 @@ import com.zcloud.edu.dto.clientobject.archives.ArchivesReviewCO;
*/
public interface ArchivesServiceI {
void downloadPersonArchives(ArchivesQry qry);
void downloadClassArchives(ArchivesQry qry);
}

View File

@ -3,6 +3,8 @@ package com.zcloud.edu.dto.archives;
import com.alibaba.cola.dto.PageQuery;
import lombok.Data;
import java.time.LocalDateTime;
/**
* web-client
@ -24,5 +26,9 @@ public class ArchivesPdfFilePageQry extends PageQuery {
* - `ne`: SQL!=
*/
private String likeArchivesPdfFileId;
private String likeName;
private Integer eqType;
private String geCreateTime;
private String leCreateTime;
}

View File

@ -28,6 +28,7 @@ public class ArchivesQry {
private List<Integer> typeList;
private String studentId;
private Long stuId;
private String classId;
}

View File

@ -22,12 +22,19 @@ public class ArchivesPdfFileCO extends ClientObject {
//业务id
@ApiModelProperty(value = "业务id")
private String archivesPdfFileId;
//下载档案描述
@ApiModelProperty(value = "下载档案描述")
private String name;
//关联表名称
@ApiModelProperty(value = "关联表名称")
private String tableName;
//关联表id
@ApiModelProperty(value = "关联表id")
private String tableId;
// 企业id
@ApiModelProperty(value = "企业id")
private Long corpinfoId;
//文件路径
@ApiModelProperty(value = "文件路径")
private String filePath;

View File

@ -37,10 +37,26 @@ public class StudentSignCO extends ClientObject {
@ApiModelProperty(value = "签到人脸路径")
private String faceUrl;
//签到人脸路径
@ApiModelProperty(value = "打卡签到人脸路径")
@TableField(exist = false)
private String signFaceUrl;
//签到人脸路径
@ApiModelProperty(value = "考试签到人脸路径")
@TableField(exist = false)
private String examFaceUrl;
@ApiModelProperty(value = "身份证号")
@TableField(exist = false)
private String userIdCard;
@ApiModelProperty(value = "手机号")
@TableField(exist = false)
private String phone;
//打卡签字路径
@ApiModelProperty(value = "打卡签字路径")
private String signUrl;
@ApiModelProperty(value = "人脸图片")
@TableField(exist = false)
private String userAvatarUrl;
//学员姓名
@ApiModelProperty(value = "学员姓名")
private String studentName;

View File

@ -1,5 +1,8 @@
package com.zcloud.edu.dto.data.archives;
import com.zcloud.edu.dto.clientobject.archives.ArchivesReviewCO;
import com.zcloud.edu.dto.clientobject.study.ClassCurriculumCO;
import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO;
import com.zcloud.edu.dto.clientobject.study.StudentCO;
import com.zcloud.edu.dto.clientobject.study.StudentSignCO;
import io.swagger.annotations.ApiModelProperty;
@ -94,4 +97,16 @@ public class ClassArchivesDTO {
private List<StudentCO> passStudentList;
@ApiModelProperty(value = "不合格学员列表")
private List<StudentCO> failStudentList;
@ApiModelProperty(value = "教材会审表")
private List<ArchivesReviewCO> archivesReviewList;
@ApiModelProperty(value = "安全培训教材或课程讲义")
private List<ClassCurriculumCO> classCurriculumList;
@ApiModelProperty(value = "教材pdf文件id")
private Long archivesPdfFileId;
@ApiModelProperty(value = "班级试卷")
private ClassExamPaperCO classPaper;
}

View File

@ -45,7 +45,7 @@ public class ClassCurriculumAddCmd extends Command {
//目录级别 1-一级目录 2-二级目录
@ApiModelProperty(value = "目录级别 1-一级目录 2-二级目录")
@NotNull(message = "课程总时长不能为空")
@NotNull(message = "目录级别不能为空")
private Integer catalogueLevel;

View File

@ -19,6 +19,8 @@ public class ArchivesPdfFileE extends BaseE {
private Long id;
//业务id
private String archivesPdfFileId;
//下载档案描述
private String name;
//关联表名称
private String tableName;
//关联表id
@ -35,6 +37,8 @@ public class ArchivesPdfFileE extends BaseE {
private String methodName;
//参数
private String param;
// 企业id
private Long corpinfoId;
//环境
private String env;
//删除标识true false
@ -60,11 +64,13 @@ public class ArchivesPdfFileE extends BaseE {
//修改人id
private Long updateId;
public void init(String tableName, String tableId, Integer type){
public void init(String tableName, String tableId, Integer type, Long corpinfoId, String name){
this.setArchivesPdfFileId(Tools.get32UUID());
this.setTableName(tableName);
this.setTableId(tableId);
this.setType(type);
this.setCorpinfoId(corpinfoId);
this.setName(name);
this.setStatus(0);
}
public void initEdit(Long id, String filePath, Integer status, String errormsg){

View File

@ -92,7 +92,7 @@ public class ClassArchivesE extends BaseE {
public void initClassSign(ClassE classE, Long studentCount, List<ClassCurriculumE> classCurList) {
BeanUtils.copyProperties(classE, this);
String trainSubject = classCurList.stream().map(ClassCurriculumE::getCurriculumName).collect(Collectors.joining(","));
setClassName(classE.getName());
setTrainSubject(trainSubject);
setStudentCount(studentCount);
setClzId(classE.getId());
@ -106,5 +106,18 @@ public class ClassArchivesE extends BaseE {
setSignCount(Long.valueOf(signCount));
setClzId(classE.getId());
}
public void initArchives(ClassE classE, Long studentCount,
List<ClassCurriculumE> classCurList,
Integer signCount) {
BeanUtils.copyProperties(classE, this);
if (classCurList != null && classCurList.size() > 0){
String trainSubject = classCurList.stream().map(ClassCurriculumE::getCurriculumName).collect(Collectors.joining(","));
setTrainSubject(trainSubject);
}
setClassName(classE.getName());
setStudentCount(studentCount);
setClzId(classE.getId());
}
}

View File

@ -152,6 +152,7 @@ public class PersonArchivesE extends BaseE {
public void init(StudentE studentE, ClassE classE, List<ClassCurriculumE> classCurList) {
BeanUtils.copyProperties(studentE, this);
setCorpName(classE.getCorpName());
setStuId(studentE.getId());
setClassName(classE.getName());
setStartTime(classE.getStartTime());
@ -175,6 +176,7 @@ public class PersonArchivesE extends BaseE {
public void initAttendanceRecord(StudentE studentE, ClassE classE, List<ClassCurriculumChapterE> chapterEList, List<ClassCurriculumE> classCurList) {
BeanUtils.copyProperties(studentE, this);
setStuId(studentE.getId());
setCorpName(classE.getCorpName());
setClassName(classE.getName());
setStartTime(classE.getStartTime());
setEndTime(classE.getEndTime());
@ -198,6 +200,8 @@ public class PersonArchivesE extends BaseE {
}
public void initStudyRecord(StudentE studentE, ClassE classE, List<StudentSignE> studentSignEList, List<ClassCurriculumE> classCurList) {
BeanUtils.copyProperties(studentE, this);
setCorpName(classE.getCorpName());
setStuId(studentE.getId());
setClassName(classE.getName());
setStartTime(classE.getStartTime());

View File

@ -89,11 +89,13 @@ public class ClassCurriculumE extends BaseE {
public void initBatchAdd(List<ClassCurriculumE> curList, List<ClassCurriculumChapterE> chapterList, String classId){
Map<String, String> map = new HashMap<String, String>();
for (ClassCurriculumE cur : curList){
cur.setId( null);
cur.setClassCurriculumId(Tools.get32UUID());
cur.setClassId(classId);
map.put(cur.getCurriculumId(), cur.getClassCurriculumId());
}
chapterList.stream().forEach(chapter -> {
chapter.setId(null);
chapter.setClassCurriculumId(map.get(chapter.getCurriculumId()));
chapter.setClassId(classId);
chapter.setClassCurriculumChapterId(Tools.get32UUID());

View File

@ -91,8 +91,12 @@ public class StudentExamRecordE extends BaseE {
.sorted()
.mapToObj(c -> String.valueOf((char) c))
.collect(Collectors.joining());
System.out.println(choiceAnswer.equals(que.getAnswer()));
if (choiceAnswer.equals(que.getAnswer())){
System.out.println(examScore+"---begin");
System.out.println(que.getScore()+"---que.getScore()");
examScore = examScore.add(que.getScore());
System.out.println(examScore+"---end");
examQuestionRight++;
}
}

View File

@ -76,13 +76,17 @@ public class StudentSignE extends BaseE {
// public static Integer corePoolSize;
@Value("${file.url}")
public void setPrefixUrl(String prefixUrlProperties) {
System.out.println("prefixUrlProperties-----"+prefixUrlProperties);
prefixUrl = prefixUrlProperties;
}
@DubboReference
private ZcloudImgFilesFacade zcloudImgFilesFacade;
public void compareFace(String templateFaceUrl, String faceUrl) throws Exception {
String templateFace = Base64Util.urlToBase64(prefixUrl + templateFaceUrl);
System.out.println("prefixUrl-----"+prefixUrl);
String templateFace = Base64Util.urlToBase64("https://jpfz.qhdsafety.com/gbsFileTest/" + templateFaceUrl);
String confidence = FaceUtil.compareFace(templateFace, faceUrl);
if (Double.valueOf(confidence) < 75) {

View File

@ -24,9 +24,16 @@ public class ArchivesPdfFileDO extends BaseDO {
//关联表名称
@ApiModelProperty(value = "关联表名称")
private String tableName;
//下载档案描述
@ApiModelProperty(value = "下载档案描述")
private String name;
//关联表id
@ApiModelProperty(value = "关联表id")
private String tableId;
// 企业id
@ApiModelProperty(value = "企业id")
private Long corpinfoId;
//文件路径
@ApiModelProperty(value = "文件路径")
private String filePath;

View File

@ -45,11 +45,29 @@ public class StudentSignDO extends BaseDO {
//签到人脸路径
@ApiModelProperty(value = "签到人脸路径")
private String faceUrl;
//签到人脸路径
@ApiModelProperty(value = "打卡签到人脸路径")
@TableField(exist = false)
private String signFaceUrl;
//签到人脸路径
@ApiModelProperty(value = "考试签到人脸路径")
@TableField(exist = false)
private String examFaceUrl;
@ApiModelProperty(value = "身份证号")
@TableField(exist = false)
private String userIdCard;
@ApiModelProperty(value = "手机号")
@TableField(exist = false)
private String phone;
//打卡签字路径
@ApiModelProperty(value = "打卡签字路径")
@TableField(exist = false)
private String signUrl;
@ApiModelProperty(value = "人脸图片")
@TableField(exist = false)
private String userAvatarUrl;
//签到类型 1-打卡签到 2-考试签到
@ApiModelProperty(value = "签到类型 1-打卡签到 2-考试签到")
private Integer type;

View File

@ -8,6 +8,9 @@ import com.zcloud.edu.persistence.dataobject.study.ClassDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* web-infrastructure
*
@ -19,5 +22,7 @@ public interface ArchivesReviewMapper extends BaseMapper<ArchivesReviewDO> {
IPage<ArchivesReviewDO> listPage(IPage<ArchivesReviewDO> page, @Param("ew") QueryWrapper<ArchivesReviewDO> queryWrapper, String menuPerms);
ArchivesReviewDO getInfoById(@Param("id") Long id);
List<ArchivesReviewDO> listAll(@Param("params") Map<String, Object> params);
}

View File

@ -17,5 +17,6 @@ import java.util.Map;
@Mapper
public interface StudentSignMapper extends BaseMapper<StudentSignDO> {
List<StudentSignDO> listAll(@Param("params") Map<String, Object> params);
List<StudentSignDO> listAllByStudent(@Param("params") Map<String, Object> params);
}

View File

@ -17,5 +17,6 @@ public interface ArchivesReviewRecordRepository extends BaseRepository<ArchivesR
PageResponse<ArchivesReviewRecordDO> listPage(Map<String, Object> params);
List<ArchivesReviewRecordDO> listByReviewId(String reviewId);
List<ArchivesReviewRecordDO> listAll(Map<String, Object> params);
}

View File

@ -4,6 +4,7 @@ import com.alibaba.cola.dto.PageResponse;
import com.jjb.saas.framework.repository.repo.BaseRepository;
import com.zcloud.edu.persistence.dataobject.archives.ArchivesReviewDO;
import java.util.List;
import java.util.Map;
/**
@ -16,5 +17,7 @@ public interface ArchivesReviewRepository extends BaseRepository<ArchivesReviewD
PageResponse<ArchivesReviewDO> listPage(Map<String, Object> params);
ArchivesReviewDO getInfoById(Long id);
List<ArchivesReviewDO> listAll(Map<String, Object> params);
}

View File

@ -3,6 +3,8 @@ package com.zcloud.edu.persistence.repository.impl.archives;
import com.alibaba.cola.dto.PageResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.jjb.saas.framework.repository.common.PageHelper;
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
import com.zcloud.edu.persistence.dataobject.archives.ArchivesPdfFileDO;
@ -31,6 +33,8 @@ public class ArchivesPdfFileRepositoryImpl extends BaseRepositoryImpl<ArchivesPd
IPage<ArchivesPdfFileDO> iPage = new Query<ArchivesPdfFileDO>().getPage(params);
QueryWrapper<ArchivesPdfFileDO> queryWrapper = new QueryWrapper<>();
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
SSOUser ssoUser = AuthContext.getCurrentUser();
queryWrapper.eq("corpinfo_id", ssoUser.getTenantId());
queryWrapper.orderByDesc("create_time");
IPage<ArchivesPdfFileDO> result = archivesPdfFileMapper.selectPage(iPage, queryWrapper);
return PageHelper.pageToResponse(result, result.getRecords());

View File

@ -45,5 +45,14 @@ public class ArchivesReviewRecordRepositoryImpl extends BaseRepositoryImpl<Archi
queryWrapper.orderByDesc("create_time");
return archivesReviewRecordMapper.selectList(queryWrapper);
}
@Override
public List<ArchivesReviewRecordDO> listAll(Map<String, Object> params) {
QueryWrapper<ArchivesReviewRecordDO> queryWrapper = new QueryWrapper<>();
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
queryWrapper.orderByDesc("create_time");
queryWrapper.eq("delete_enum", "FALSE");
return archivesReviewRecordMapper.selectList(queryWrapper);
}
}

View File

@ -13,6 +13,7 @@ import com.zcloud.gbscommon.utils.Query;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
@ -41,5 +42,10 @@ public class ArchivesReviewRepositoryImpl extends BaseRepositoryImpl<ArchivesRev
public ArchivesReviewDO getInfoById(Long id) {
return archivesReviewMapper.getInfoById(id);
}
@Override
public List<ArchivesReviewDO> listAll(Map<String, Object> params) {
return archivesReviewMapper.listAll(params);
}
}

View File

@ -54,6 +54,10 @@ public class StudentSignRepositoryImpl extends BaseRepositoryImpl<StudentSignMap
public List<StudentSignDO> listAll(Map<String, Object> params) {
return studentSignMapper.listAll(params);
}
@Override
public List<StudentSignDO> listAllByStudent(Map<String, Object> params) {
return studentSignMapper.listAllByStudent(params);
}
@Override
public List<StudentSignDO> listAllByStudentId(Map<String, Object> params) {

View File

@ -21,6 +21,8 @@ public interface StudentSignRepository extends BaseRepository<StudentSignDO> {
List<StudentSignDO> listAll(Map<String, Object> params);
List<StudentSignDO> listAllByStudent(Map<String, Object> params);
List<StudentSignDO> listAllByStudentId(Map<String, Object> params);
Integer countByClassId(String classId);

View File

@ -25,5 +25,23 @@
WHERE
ar.id = #{id}
</select>
<select id="listAll" resultType="com.zcloud.edu.persistence.dataobject.archives.ArchivesReviewDO">
SELECT
cc.curriculum_name,
cc.class_curriculum_id,
cc.class_id,
ar.*
FROM
class_curriculum cc
LEFT JOIN archives_review ar ON cc.class_curriculum_id = ar.class_curriculum_id and ar.delete_enum = 'FALSE'
<where>
cc.delete_enum = 'FALSE'
<if test="params.classId != null and params.classId != ''">
and cc.class_id = #{params.classId}
</if>
</where>
</select>
</mapper>

View File

@ -21,10 +21,15 @@
er.exam_question_wrong,
er.exam_score,
er.result,
ss.sign_url
ss.sign_url,
ep.exam_name,
ep.exam_score paper_exam_score,
ep.pass_score,
ep.exam_time
FROM
student_exam_record er
left join student_sign ss on ss.student_sign_id = er.student_sign_id
left join class_exam_paper ep on er.class_exam_paper_id = ep.class_exam_paper_id
<where>
er.delete_enum = 'FALSE'
and er.student_id = #{studentId}

View File

@ -116,6 +116,9 @@
<if test="params.examSignFlag != null and params.examSignFlag != ''">
,exam_sign_flag = #{params.examSignFlag}
</if>
<if test="params.state != null and params.state != ''">
,state = #{params.state}
</if>
</set>
where
student_id = #{params.studentId}

View File

@ -31,6 +31,42 @@
</where>
</select>
<select id="listAllByStudent" resultType="com.zcloud.edu.persistence.dataobject.study.StudentSignDO">
SELECT
s.name student_name,
cl.name class_name,
cl.training_location,
MAX(CASE WHEN ss.type = 1 THEN ss.face_url END) AS sign_face_url,
MAX(CASE WHEN ss.type = 2 THEN ss.face_url END) AS exam_face_url,
u.user_avatar_url,
s.user_id_card,
s.phone,
ss.*
FROM
student_sign ss
LEFT JOIN student s ON ss.student_id = s.student_id
LEFT JOIN class cl ON cl.class_id = s.class_id
left join user u on u.phone = s.phone
<where>
<if test="params.classId != null and params.classId != ''">
AND ss.class_id = #{params.classId}
</if>
<if test="params.studentId != null and params.studentId != ''">
AND ss.student_id = #{params.studentId}
</if>
<if test="params.type != null and params.type != ''">
AND ss.type = #{params.type}
</if>
AND ss.delete_enum = 'FALSE'
and ss.sign_url is not null
and ss.sign_url != ''
group by
ss.student_id
order by
ss.create_time desc
</where>
</select>
<!--<select id="listAllByStudentId" resultType="com.zcloud.edu.persistence.dataobject.study.StudentSignDO">-->