he2802 1 жил өмнө
parent
commit
5baa88601e

+ 2 - 2
zhongzheng-admin-data/src/main/java/com/zhongzheng/controller/common/UserStudyLogController.java

@@ -168,12 +168,12 @@ public class UserStudyLogController extends BaseController {
         /*if (!ToolsUtils.checkSignFromOldSys(bo.getStamp(), bo.getSign())) {
             throw new CustomException("签名错误");
         }*/
-    //    iClassGradeUserService.exportListVideoUserPeriod(451L,"D:\\test\\网课");  //网课
+        iClassGradeUserService.exportListVideoUserPeriod(451L,"D:\\test\\网课");  //网课
     //    iClassGradeUserService.exportListBKUserPeriod(451L,"D:\\test\\网课");  //报考
     //    iClassGradeUserService.exportCertificateList(451L,"D:\\test\\网课");  //证书
     //    iClassGradeUserService.exportLiveStudyList(451L,"D:\\test\\网课"); //直播
     //    iClassGradeUserService.exportHandoutsStudyList(454L,"D:\\test\\网课"); //资料
-        iClassGradeUserService.exportExamStudyList(454L,"D:\\test\\网课"); //题库
+    //    iClassGradeUserService.exportExamStudyList(454L,"D:\\test\\网课"); //题库
         return AjaxResult.success();
     }
 }

+ 2 - 2
zhongzheng-admin-data/src/main/resources/application-dev.yml

@@ -4,9 +4,9 @@ spring:
         type: com.alibaba.druid.pool.DruidDataSource
         driverClassName: com.mysql.cj.jdbc.Driver
         druid:
-            url: jdbc:mysql://39.108.7.155:3306/zz_edu_data_dev?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
+            url: jdbc:mysql://192.168.1.222:3306/zz_edu_saas?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
             username: root
-            password: gdxy2023#@#zzkj
+            password: zhongzheng2021
             # 初始连接数
             initialSize: 5
             # 最小连接池数量

+ 1 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/poi/ExcelUtil.java

@@ -23,6 +23,7 @@ import org.apache.poi.ss.util.CellRangeAddressList;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
 import org.apache.poi.xssf.usermodel.XSSFDataValidation;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

+ 106 - 70
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -75,6 +75,10 @@ import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
 import com.zhongzheng.modules.user.mapper.UserStudyRecordPhotoMapper;
 import com.zhongzheng.modules.user.service.*;
 import com.zhongzheng.modules.user.vo.*;
+import org.apache.poi.ss.usermodel.ClientAnchor;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.util.Units;
+import org.apache.poi.xssf.usermodel.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -83,9 +87,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
+import java.io.*;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -3882,7 +3884,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
 
         //next
         for (ClassPeriodStudentVo classPeriodStudentVo : classPeriodStudentVos) {
-            String goodsDirPath = dirPath+"/"+classPeriodStudentVo.getGoodsName()+"/学时记录";
+            String goodsDirPath = dirPath + "/" + classPeriodStudentVo.getGoodsName() + "/学时记录";
             List<DangAnPeriodExportAllVo> studyList = new ArrayList<>();
             ClassGradeUserQueryBo bo = new ClassGradeUserQueryBo();
             bo.setUserId(classPeriodStudentVo.getUserId());
@@ -3900,7 +3902,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                 //为模块搜索下面的章 和节 并搜索学时记录
                 if (classPeriodVo.getType() == 1) {
                     CourseModuleVo moduleVo = iCourseModuleService.queryById(classPeriodVo.getId());
-                    List<ClassPeriodChapterVo> classPeriodChapterVos = baseMapper.listperiodChapter(classPeriodVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId(), bo.getGradeId(),bo.getOrderGoodsId());
+                    List<ClassPeriodChapterVo> classPeriodChapterVos = baseMapper.listperiodChapter(classPeriodVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId(), bo.getGradeId(), bo.getOrderGoodsId());
                     Collections.sort(classPeriodChapterVos);
                     classPeriodChapterVos.addAll(baseMapper.listperiodModuleExam(bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId(), classPeriodVo.getId()));
                     for (ClassPeriodChapterVo classPeriodChapterVo : classPeriodChapterVos) {
@@ -3925,7 +3927,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                     List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
                                     if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
                                         int index = 0;
-                                        for(UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos){
+                                        for (UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos) {
                                             index++;
                                             LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                                             lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
@@ -3937,9 +3939,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                             classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
                                             classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
                                             if (Validator.isNotEmpty(photoList) && photoList.size() > 0) {
-                                                if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
+                                                if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员")) {
                                                     classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
-                                                }else{
+                                                } else {
                                                     classPeriodSectionVo.setStudyStartTime(photoList.get(0).getCreateTime());
                                                 }
                                             }
@@ -3954,23 +3956,26 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                             exportAllVo.setModuleName(moduleVo.getModuleName());
                                             exportAllVo.setChapterName(classPeriodChapterVo.getTypeName());
                                             exportAllVo.setSectionName(classPeriodSectionVo.getTypeName());
-                                            exportAllVo.setNumIndex("第"+index+"次");
-                                            exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyStartTime(),"yyyy-MM-dd HH:mm:ss"));
-                                            exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyEndTime(),"yyyy-MM-dd HH:mm:ss"));
-                                            exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getAuditTime(),"yyyy-MM-dd HH:mm:ss"));
+                                            exportAllVo.setNumIndex("第" + index + "次");
+                                            exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyStartTime(), "yyyy-MM-dd HH:mm:ss"));
+                                            exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyEndTime(), "yyyy-MM-dd HH:mm:ss"));
+                                            exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getAuditTime(), "yyyy-MM-dd HH:mm:ss"));
                                             exportAllVo.setAuditPeopleTxt(classPeriodSectionVo.getAuditUserName());
                                             exportAllVo.setSectionType("节");
                                             BigDecimal secTime = new BigDecimal(userPeriodStatusVo.getDurationTime());
-                                            exportAllVo.setClassHour(secTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).toString());
+                                            exportAllVo.setClassHour(secTime.divide(new BigDecimal(45 * 60), BigDecimal.ROUND_HALF_UP).toString());
+                                            if (photoList.size() > 0) {
+                                                exportAllVo.setStudyImg(readImageAsBytes(photoList.get(0).getPhoto()));
+                                            }
                                             studyList.add(exportAllVo);
 
-                                            String imgDirPath = goodsDirPath+"/模块_"+exportAllVo.getModuleName()+"/章_"+exportAllVo.getChapterName()+"/节_"+exportAllVo.getSectionName();
+                                            String imgDirPath = goodsDirPath + "/模块_" + exportAllVo.getModuleName() + "/章_" + exportAllVo.getChapterName() + "/节_" + exportAllVo.getSectionName();
                                             File dir = new File(imgDirPath);
-                                            if(!dir.exists()){
+                                            if (!dir.exists()) {
                                                 dir.mkdirs();
                                             }
-                                            for(UserStudyRecordPhotoVo photoVo:photoList){
-                                                ossService.fileDownloadLocal(photoVo.getPhoto(),imgDirPath+"/"+photoVo.getCreateTime()+".jpg");
+                                            for (UserStudyRecordPhotoVo photoVo : photoList) {
+                                                ossService.fileDownloadLocal(photoVo.getPhoto(), imgDirPath + "/" + photoVo.getCreateTime() + ".jpg");
                                             }
                                         }
                                     }
@@ -3988,7 +3993,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                     List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
                                     if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
                                         int index = 0;
-                                        for(UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos){
+                                        for (UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos) {
                                             index++;
                                             LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                                             lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
@@ -4010,22 +4015,25 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                             exportAllVo.setModuleName(moduleVo.getModuleName());
                                             exportAllVo.setChapterName(classPeriodChapterVo.getTypeName());
                                             exportAllVo.setSectionName(classPeriodSectionVo.getTypeName());
-                                            exportAllVo.setNumIndex("第"+index+"次");
-                                            exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyStartTime(),"yyyy-MM-dd HH:mm:ss"));
-                                            exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyEndTime(),"yyyy-MM-dd HH:mm:ss"));
-                                            exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getAuditTime(),"yyyy-MM-dd HH:mm:ss"));
+                                            exportAllVo.setNumIndex("第" + index + "次");
+                                            exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyStartTime(), "yyyy-MM-dd HH:mm:ss"));
+                                            exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyEndTime(), "yyyy-MM-dd HH:mm:ss"));
+                                            exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getAuditTime(), "yyyy-MM-dd HH:mm:ss"));
                                             exportAllVo.setAuditPeopleTxt(classPeriodSectionVo.getAuditUserName());
                                             exportAllVo.setSectionType("试卷");
                                             exportAllVo.setScore(classPeriodSectionVo.getPerformance());
+                                            if (photoList.size() > 0) {
+                                                exportAllVo.setStudyImg(readImageAsBytes(photoList.get(0).getPhoto()));
+                                            }
                                             studyList.add(exportAllVo);
 
-                                            String imgDirPath = goodsDirPath+"/模块_"+exportAllVo.getModuleName()+"/章_"+exportAllVo.getChapterName()+"/卷_"+exportAllVo.getSectionName();
+                                            String imgDirPath = goodsDirPath + "/模块_" + exportAllVo.getModuleName() + "/章_" + exportAllVo.getChapterName() + "/卷_" + exportAllVo.getSectionName();
                                             File dir = new File(imgDirPath);
-                                            if(!dir.exists()){
+                                            if (!dir.exists()) {
                                                 dir.mkdirs();
                                             }
-                                            for(UserStudyRecordPhotoVo photoVo:photoList){
-                                                ossService.fileDownloadLocal(photoVo.getPhoto(),imgDirPath+"/"+photoVo.getCreateTime()+".jpg");
+                                            for (UserStudyRecordPhotoVo photoVo : photoList) {
+                                                ossService.fileDownloadLocal(photoVo.getPhoto(), imgDirPath + "/" + photoVo.getCreateTime() + ".jpg");
                                             }
                                         }
 
@@ -4053,7 +4061,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                             List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
                             if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
                                 int index = 0;
-                                for(UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos) {
+                                for (UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos) {
                                     index++;
                                     LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                                     lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
@@ -4074,22 +4082,25 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                     DangAnPeriodExportAllVo exportAllVo = BeanUtil.toBean(classPeriodStudentVo, DangAnPeriodExportAllVo.class);
                                     exportAllVo.setModuleName(moduleVo.getModuleName());
                                     exportAllVo.setSectionName(classPeriodChapterVo.getTypeName());
-                                    exportAllVo.setNumIndex("第"+index+"次");
-                                    exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodChapterVo.getStudyStartTime(),"yyyy-MM-dd HH:mm:ss"));
-                                    exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodChapterVo.getStudyEndTime(),"yyyy-MM-dd HH:mm:ss"));
-                                    exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodChapterVo.getAuditTime(),"yyyy-MM-dd HH:mm:ss"));
+                                    exportAllVo.setNumIndex("第" + index + "次");
+                                    exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodChapterVo.getStudyStartTime(), "yyyy-MM-dd HH:mm:ss"));
+                                    exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodChapterVo.getStudyEndTime(), "yyyy-MM-dd HH:mm:ss"));
+                                    exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodChapterVo.getAuditTime(), "yyyy-MM-dd HH:mm:ss"));
                                     exportAllVo.setAuditPeopleTxt(classPeriodChapterVo.getAuditUserName());
                                     exportAllVo.setSectionType("试卷");
                                     exportAllVo.setScore(classPeriodChapterVo.getPerformance());
+                                    if (photoList.size() > 0) {
+                                        exportAllVo.setStudyImg(readImageAsBytes(photoList.get(0).getPhoto()));
+                                    }
                                     studyList.add(exportAllVo);
 
-                                    String imgDirPath = goodsDirPath+"/模块_"+exportAllVo.getModuleName()+"/卷_"+exportAllVo.getSectionName();
+                                    String imgDirPath = goodsDirPath + "/模块_" + exportAllVo.getModuleName() + "/卷_" + exportAllVo.getSectionName();
                                     File dir = new File(imgDirPath);
-                                    if(!dir.exists()){
+                                    if (!dir.exists()) {
                                         dir.mkdirs();
                                     }
-                                    for(UserStudyRecordPhotoVo photoVo:photoList){
-                                        ossService.fileDownloadLocal(photoVo.getPhoto(),imgDirPath+"/"+photoVo.getCreateTime()+".jpg");
+                                    for (UserStudyRecordPhotoVo photoVo : photoList) {
+                                        ossService.fileDownloadLocal(photoVo.getPhoto(), imgDirPath + "/" + photoVo.getCreateTime() + ".jpg");
                                     }
                                 }
                             }
@@ -4117,7 +4128,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
                         if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
                             int index = 0;
-                            for(UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos){
+                            for (UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos) {
                                 index++;
                                 LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                                 lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
@@ -4129,9 +4140,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                 classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
                                 classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
                                 if (Validator.isNotEmpty(photoList) && photoList.size() > 0) {
-                                    if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
+                                    if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员")) {
                                         classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
-                                    }else{
+                                    } else {
                                         classPeriodSectionVo.setStudyStartTime(photoList.get(0).getCreateTime());
                                     }
                                 }
@@ -4145,23 +4156,26 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                 DangAnPeriodExportAllVo exportAllVo = BeanUtil.toBean(classPeriodStudentVo, DangAnPeriodExportAllVo.class);
                                 exportAllVo.setChapterName(classPeriodVo.getTypeName());
                                 exportAllVo.setSectionName(classPeriodSectionVo.getTypeName());
-                                exportAllVo.setNumIndex("第"+index+"次");
-                                exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyStartTime(),"yyyy-MM-dd HH:mm:ss"));
-                                exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyEndTime(),"yyyy-MM-dd HH:mm:ss"));
-                                exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getAuditTime(),"yyyy-MM-dd HH:mm:ss"));
+                                exportAllVo.setNumIndex("第" + index + "次");
+                                exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyStartTime(), "yyyy-MM-dd HH:mm:ss"));
+                                exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyEndTime(), "yyyy-MM-dd HH:mm:ss"));
+                                exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getAuditTime(), "yyyy-MM-dd HH:mm:ss"));
                                 exportAllVo.setAuditPeopleTxt(classPeriodSectionVo.getAuditUserName());
                                 exportAllVo.setSectionType("节");
                                 BigDecimal secTime = new BigDecimal(userPeriodStatusVo.getDurationTime());
-                                exportAllVo.setClassHour(secTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).toString());
+                                exportAllVo.setClassHour(secTime.divide(new BigDecimal(45 * 60), BigDecimal.ROUND_HALF_UP).toString());
+                                if (photoList.size() > 0) {
+                                    exportAllVo.setStudyImg(readImageAsBytes(photoList.get(0).getPhoto()));
+                                }
                                 studyList.add(exportAllVo);
 
-                                String imgDirPath = goodsDirPath+"/章_"+exportAllVo.getChapterName()+"/节_"+exportAllVo.getSectionName();
+                                String imgDirPath = goodsDirPath + "/章_" + exportAllVo.getChapterName() + "/节_" + exportAllVo.getSectionName();
                                 File dir = new File(imgDirPath);
-                                if(!dir.exists()){
+                                if (!dir.exists()) {
                                     dir.mkdirs();
                                 }
-                                for(UserStudyRecordPhotoVo photoVo:photoList){
-                                    ossService.fileDownloadLocal(photoVo.getPhoto(),imgDirPath+"/"+photoVo.getCreateTime()+".jpg");
+                                for (UserStudyRecordPhotoVo photoVo : photoList) {
+                                    ossService.fileDownloadLocal(photoVo.getPhoto(), imgDirPath + "/" + photoVo.getCreateTime() + ".jpg");
                                 }
                             }
 
@@ -4181,7 +4195,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
                         if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
                             int index = 0;
-                            for(UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos){
+                            for (UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos) {
                                 index++;
                                 LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                                 lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
@@ -4203,22 +4217,25 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                 DangAnPeriodExportAllVo exportAllVo = BeanUtil.toBean(classPeriodStudentVo, DangAnPeriodExportAllVo.class);
                                 exportAllVo.setChapterName(classPeriodVo.getTypeName());
                                 exportAllVo.setSectionName(classPeriodSectionVo.getTypeName());
-                                exportAllVo.setNumIndex("第"+index+"次");
-                                exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyStartTime(),"yyyy-MM-dd HH:mm:ss"));
-                                exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyEndTime(),"yyyy-MM-dd HH:mm:ss"));
-                                exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getAuditTime(),"yyyy-MM-dd HH:mm:ss"));
+                                exportAllVo.setNumIndex("第" + index + "次");
+                                exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyStartTime(), "yyyy-MM-dd HH:mm:ss"));
+                                exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getStudyEndTime(), "yyyy-MM-dd HH:mm:ss"));
+                                exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodSectionVo.getAuditTime(), "yyyy-MM-dd HH:mm:ss"));
                                 exportAllVo.setAuditPeopleTxt(classPeriodSectionVo.getAuditUserName());
                                 exportAllVo.setSectionType("试卷");
                                 exportAllVo.setScore(classPeriodSectionVo.getPerformance());
+                                if (photoList.size() > 0) {
+                                    exportAllVo.setStudyImg(readImageAsBytes(photoList.get(0).getPhoto()));
+                                }
                                 studyList.add(exportAllVo);
 
-                                String imgDirPath = goodsDirPath+"/章_"+exportAllVo.getChapterName()+"/卷_"+exportAllVo.getSectionName();
+                                String imgDirPath = goodsDirPath + "/章_" + exportAllVo.getChapterName() + "/卷_" + exportAllVo.getSectionName();
                                 File dir = new File(imgDirPath);
-                                if(!dir.exists()){
+                                if (!dir.exists()) {
                                     dir.mkdirs();
                                 }
-                                for(UserStudyRecordPhotoVo photoVo:photoList){
-                                    ossService.fileDownloadLocal(photoVo.getPhoto(),imgDirPath+"/"+photoVo.getCreateTime()+".jpg");
+                                for (UserStudyRecordPhotoVo photoVo : photoList) {
+                                    ossService.fileDownloadLocal(photoVo.getPhoto(), imgDirPath + "/" + photoVo.getCreateTime() + ".jpg");
                                 }
                             }
 
@@ -4249,7 +4266,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                     List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
                     if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
                         int index = 0;
-                        for(UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos){
+                        for (UserPeriodStatusVo userPeriodStatusVo : userPeriodStatusVos) {
                             index++;
                             LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                             lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
@@ -4261,9 +4278,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                             classPeriodVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
                             classPeriodVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
                             if (photoList.size() > 0) {
-                                if(fullName.contains("继续教育")&&fullName.contains("施工现场专业人员")){
+                                if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员")) {
                                     classPeriodVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
-                                }else{
+                                } else {
                                     classPeriodVo.setStudyStartTime(photoList.get(0).getCreateTime());
                                 }
 
@@ -4277,36 +4294,55 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
 
                             DangAnPeriodExportAllVo exportAllVo = BeanUtil.toBean(classPeriodStudentVo, DangAnPeriodExportAllVo.class);
                             exportAllVo.setSectionName(classPeriodVo.getTypeName());
-                            exportAllVo.setNumIndex("第"+index+"次");
-                            exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodVo.getStudyStartTime(),"yyyy-MM-dd HH:mm:ss"));
-                            exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodVo.getStudyEndTime(),"yyyy-MM-dd HH:mm:ss"));
-                            exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodVo.getAuditTime(),"yyyy-MM-dd HH:mm:ss"));
+                            exportAllVo.setNumIndex("第" + index + "次");
+                            exportAllVo.setStartTimeTxt(DateUtils.timestampToDateFormat(classPeriodVo.getStudyStartTime(), "yyyy-MM-dd HH:mm:ss"));
+                            exportAllVo.setEndTimeTxt(DateUtils.timestampToDateFormat(classPeriodVo.getStudyEndTime(), "yyyy-MM-dd HH:mm:ss"));
+                            exportAllVo.setAuditTimeTxt(DateUtils.timestampToDateFormat(classPeriodVo.getAuditTime(), "yyyy-MM-dd HH:mm:ss"));
                             exportAllVo.setAuditPeopleTxt(classPeriodVo.getAuditUserName());
                             exportAllVo.setSectionType("节");
                             BigDecimal secTime = new BigDecimal(userPeriodStatusVo.getDurationTime());
-                            exportAllVo.setClassHour(secTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).toString());
+                            exportAllVo.setClassHour(secTime.divide(new BigDecimal(45 * 60), BigDecimal.ROUND_HALF_UP).toString());
+                            if (photoList.size() > 0) {
+                                exportAllVo.setStudyImg(readImageAsBytes(photoList.get(0).getPhoto()));
+                            }
                             studyList.add(exportAllVo);
 
-                            String imgDirPath = goodsDirPath+"/节_"+exportAllVo.getSectionName();
+                            String imgDirPath = goodsDirPath + "/节_" + exportAllVo.getSectionName();
                             File dir = new File(imgDirPath);
-                            if(!dir.exists()){
+                            if (!dir.exists()) {
                                 dir.mkdirs();
                             }
-                            for(UserStudyRecordPhotoVo photoVo:photoList){
-                                ossService.fileDownloadLocal(photoVo.getPhoto(),imgDirPath+"/"+photoVo.getCreateTime()+".jpg");
+                            for (UserStudyRecordPhotoVo photoVo : photoList) {
+                                ossService.fileDownloadLocal(photoVo.getPhoto(), imgDirPath + "/" + photoVo.getCreateTime() + ".jpg");
                             }
                         }
                     }
                 }
 
             }
-            String goodsPeriodPath = goodsDirPath+"/学时记录"+System.currentTimeMillis()+".xlsx";
+            String goodsPeriodPath = goodsDirPath + "/学时记录" + System.currentTimeMillis() + ".xlsx";
             ExcelUtil<DangAnPeriodExportAllVo> util3 = new ExcelUtil<DangAnPeriodExportAllVo>(DangAnPeriodExportAllVo.class);
-            util3.exportEasyExcelUtil(studyList,DangAnPeriodExportAllVo.class,goodsPeriodPath);
+            util3.exportEasyExcelUtil(studyList, DangAnPeriodExportAllVo.class, goodsPeriodPath);
         }
         return true;
     }
 
+    public  byte[] readImageAsBytes(String ossPath){
+      try{
+          InputStream is =  ossService.getStreamByObject(ossPath);
+          ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+          byte[] buffer = new byte[1024];
+          int length;
+          while ((length = is.read(buffer)) != -1) {
+              byteArrayOutputStream.write(buffer, 0, length);
+          }
+          byteArrayOutputStream.close();
+          return byteArrayOutputStream.toByteArray();
+      }catch (Exception e){
+          return null;
+      }
+    }
+
 
     public Boolean sevenPushAuthCallBack(SevenPushAuthAddBo bo) {
         if(Validator.isEmpty(bo.getGradeUserId())||Validator.isEmpty(bo.getPushStatus())){

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/DangAnPeriodExportAllVo.java

@@ -84,4 +84,7 @@ public class DangAnPeriodExportAllVo {
 	@Excel(name = "审核人")
 	@ApiModelProperty("审核人")
 	private String auditPeopleTxt;
+
+	@Excel(name = "学习照片", type = 2, width = 20.0, height = 30.0, imageType = 2)
+	private byte[] studyImg;
 }