he2802 2 years ago
parent
commit
4631ca4760
14 changed files with 498 additions and 5 deletions
  1. 4 4
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java
  2. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java
  3. 20 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java
  4. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodQueryBo.java
  5. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java
  6. 330 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java
  7. 0 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportAllVo.java
  8. 92 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportWeekAllVo.java
  9. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordPhotoMapper.java
  10. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserStudyRecordPhotoService.java
  11. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordPhotoServiceImpl.java
  12. 3 0
      zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml
  13. 7 0
      zhongzheng-system/src/main/resources/mapper/modules/grade/UserPeriodStatusMapper.xml
  14. 20 0
      zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordPhotoMapper.xml

+ 4 - 4
zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java

@@ -353,16 +353,16 @@ public class ClassGradeController extends BaseController {
             }
         }
         bo.setUserPhoto(1);
-        Map<String,Object> map = iClassGradeUserService.exportPo(bo);
-        List<ClassPeriodStudentExportAllVo> list = (List<ClassPeriodStudentExportAllVo>)map.get("list");
-        ExcelUtil<ClassPeriodStudentExportAllVo> util = new ExcelUtil<ClassPeriodStudentExportAllVo>(ClassPeriodStudentExportAllVo.class);
+        Map<String,Object> map = iClassGradeUserService.exportWeekPo(bo);
+        List<ClassPeriodStudentExportWeekAllVo> list = (List<ClassPeriodStudentExportWeekAllVo>)map.get("list");
+        ExcelUtil<ClassPeriodStudentExportWeekAllVo> util = new ExcelUtil<ClassPeriodStudentExportWeekAllVo>(ClassPeriodStudentExportWeekAllVo.class);
         ExportParams deptExportParams = new ExportParams();
         // 设置sheet得名称
         deptExportParams.setSheetName("表1");
         String timeStr= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
         Map<String, Object> deptExportMap = new HashMap<>();
         deptExportMap.put("title", deptExportParams);
-        deptExportMap.put("entity", ClassPeriodStudentExportAllVo.class);
+        deptExportMap.put("entity", ClassPeriodStudentExportWeekAllVo.class);
         // sheet中要填充得数据
         deptExportMap.put("data", list);
         List<Map<String, Object>> sheetsList = new ArrayList<>();

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java

@@ -6,6 +6,7 @@ import com.zhongzheng.modules.alioss.bo.OssRequest;
 import com.zhongzheng.modules.alioss.vo.FileBean;
 import com.zhongzheng.modules.alioss.vo.ResultBean;
 import com.zhongzheng.modules.grade.vo.ClassPeriodStudentExportVo;
+import com.zhongzheng.modules.grade.vo.WeekDataVo;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
@@ -30,6 +31,8 @@ public interface OssService {
 
     void zipPeopleDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream);
 
+    void zipPeopleWeekDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream, WeekDataVo weekDataVo);
+
     void zipCommonDownload(List<String> fileList, ZipOutputStream zipOut, String dir);
 
     void zipWisdomDownload(List<FileBean> list, ZipOutputStream outStream);

+ 20 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java

@@ -18,6 +18,7 @@ import com.zhongzheng.modules.alioss.service.OssService;
 import com.zhongzheng.modules.alioss.vo.FileBean;
 import com.zhongzheng.modules.alioss.vo.ResultBean;
 import com.zhongzheng.modules.grade.vo.ClassPeriodStudentExportVo;
+import com.zhongzheng.modules.grade.vo.WeekDataVo;
 import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
 import org.apache.commons.io.IOUtils;
 import org.apache.xmlbeans.impl.values.XmlValueNotNillableException;
@@ -419,6 +420,25 @@ public class OssServiceImpl implements OssService {
         zipFile(listInfo, outStream,vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"资料照片");  //
     }
 
+    @Override
+    public void zipPeopleWeekDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream, WeekDataVo weekDataVo) {
+        //学时照片
+        List<String> list = iUserStudyRecordPhotoService.selectGradePhotoWeek(vo.getUserId(),vo.getGradeId(),weekDataVo.getSearchWeekStartTime(),weekDataVo.getSearchWeekEndTime());
+        zipFile(list, outStream,weekDataVo.getWeekCxt()+"/"+vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"学习照片");  //
+        //个人资料
+        List<String> listInfo = new ArrayList<>();
+        if(Validator.isNotEmpty(vo.getOneInchPhotosOss())){
+            listInfo.add(vo.getOneInchPhotosOss());
+        }
+        if(Validator.isNotEmpty(vo.getIdCardImg1Oss())){
+            listInfo.add(vo.getIdCardImg1Oss());
+        }
+        if(Validator.isNotEmpty(vo.getIdCardImg2Oss())){
+            listInfo.add(vo.getIdCardImg2Oss());
+        }
+        zipFile(listInfo, outStream,weekDataVo.getWeekCxt()+"/"+vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"资料照片");  //
+    }
+
     @Override
     public void zipCommonDownload(List<String> fileList, ZipOutputStream zipOut,String dir) {
         zipFile(fileList, zipOut,dir);

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodQueryBo.java

@@ -83,4 +83,9 @@ public class UserPeriodQueryBo extends BaseEntity {
 	private List<Long> chapterIds;
 	@ApiModelProperty("节IDs")
 	private List<Long> sectionIds;
+	@ApiModelProperty("周查询开始时间")
+	private Long searchWeekStartTime;
+
+	@ApiModelProperty("周查询结束时间")
+	private Long searchWeekEndTime;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java

@@ -62,6 +62,8 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 
 	Map<String,Object> exportPo(ClassGradeUserQueryBo bo);
 
+	Map<String,Object> exportWeekPo(ClassGradeUserQueryBo bo);
+
 
 	/**
 	 * 根据编辑业务对象修改学员记录
@@ -90,6 +92,8 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 
 	List<UserPeriodExportVo> listUserStudyRecord(ClassGradeUserQueryBo bo);
 
+	List<UserPeriodExportVo> listUserStudyRecordWeek(ClassGradeUserQueryBo bo);
+
 	List<UserPeriodExportV2Vo> listUserStudyRecordV2(ClassGradeUserQueryBo bo);
 
 	List<UserPeriodExportV2Vo> listUserStudyRecordV2Week(ClassGradeUserQueryBo bo);

+ 330 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -864,6 +864,105 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return fillList(exportList);
     }
 
+    @Override
+    public Map<String, Object> exportWeekPo(ClassGradeUserQueryBo bo) {
+        Map<String, Object> totalRs = new HashMap<>();
+        List<ClassPeriodStudentExportWeekAllVo> totalList = new ArrayList<>();
+        Map<String, List<ClassPeriodStudentExportVo>> weekRs = new HashMap<>();
+        for(WeekDataVo weekDataVo : bo.getWeekList() ){
+            bo.setSearchWeekStartTime(weekDataVo.getSearchWeekStartTime());
+            bo.setSearchWeekEndTime(weekDataVo.getSearchWeekEndTime());
+            //查询班级学员信息
+            List<ClassPeriodStudentVo> classPeriodStudentVos = baseMapper.listUserPeriodExport(bo);
+            List<ClassPeriodStudentExportVo> exportList = new ArrayList<>();
+            //查找学员学习记录
+            for (ClassPeriodStudentVo classPeriodStudentVo : classPeriodStudentVos) {
+                Long secLong = 0L;
+                Long studyLong = 0L;
+
+                SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
+                subjectStudyRecordQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
+                subjectStudyRecordQueryBo.setUserId(classPeriodStudentVo.getUserId());
+                subjectStudyRecordQueryBo.setGradeId(bo.getGradeId());
+                User user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, classPeriodStudentVo.getUserId()));
+                if(Validator.isNotEmpty(user.getOneInchPhotos())){
+                    classPeriodStudentVo.setOneInchPhotos(ALIYUN_OSS_ENDPOINT + "/" + user.getOneInchPhotos());
+                    classPeriodStudentVo.setOneInchPhotosOss(user.getOneInchPhotos());
+                }
+                if(Validator.isNotEmpty(user.getIdCardImg1())){
+                    classPeriodStudentVo.setIdCardImg1(ALIYUN_OSS_ENDPOINT + "/" + user.getIdCardImg1());
+                    classPeriodStudentVo.setIdCardImg1Oss(user.getIdCardImg1());
+                }
+                if(Validator.isNotEmpty(user.getIdCardImg2())){
+                    classPeriodStudentVo.setIdCardImg2(ALIYUN_OSS_ENDPOINT + "/" + user.getIdCardImg2());
+                    classPeriodStudentVo.setIdCardImg2Oss(user.getIdCardImg2());
+                }
+                ClassPeriodStudentExportVo addItem = BeanUtil.toBean(classPeriodStudentVo, ClassPeriodStudentExportVo.class);
+
+                addItem.setStudyTimeStr(DateUtils.timestampToDate(classPeriodStudentVo.getServiceStartTime()) + "-" + DateUtils.timestampToDate(classPeriodStudentVo.getServiceEndTime()));
+                addItem.setClassTimeStr(DateUtils.timestampToDate(classPeriodStudentVo.getClassStartTime()) + "-" + DateUtils.timestampToDate(classPeriodStudentVo.getClassEndTime()));
+
+                ClassGradeUserQueryBo classGradeUserQueryBo1 = new ClassGradeUserQueryBo();
+                classGradeUserQueryBo1.setUserId(classPeriodStudentVo.getUserId());
+                classGradeUserQueryBo1.setGradeId(classPeriodStudentVo.getGradeId());
+                classGradeUserQueryBo1.setGoodsId(classPeriodStudentVo.getGoodsId());
+                classGradeUserQueryBo1.setSearchWeekStartTime(weekDataVo.getSearchWeekStartTime());
+                classGradeUserQueryBo1.setSearchWeekEndTime(weekDataVo.getSearchWeekEndTime());
+                addItem.setPeriodVoList(listUserStudyRecordWeek(classGradeUserQueryBo1));
+                exportList.add(addItem);
+            }
+            weekRs.put(weekDataVo.getWeekCxt(),exportList);
+            Map<String, Object> rs =  fillListWeek(exportList);
+            List<ClassPeriodStudentExportWeekAllVo> list = (List<ClassPeriodStudentExportWeekAllVo>)rs.get("list");
+            ClassPeriodStudentExportWeekAllVo titleVo = new ClassPeriodStudentExportWeekAllVo();
+            titleVo.setWeekTime(weekDataVo.getWeekCxt());
+            totalList.add(titleVo);
+            totalList.addAll(list);
+
+        }
+        String filename = FileUtils.encodingZipFilename("用户压缩数据");
+        String zipFile = FileUtils.getZipAbsoluteFile(filename);
+        try {
+            ZipOutputStream outStream = new ZipOutputStream(new FileOutputStream(zipFile));
+            //生成ZIP
+            for(WeekDataVo weekDataVo : bo.getWeekList() ){
+                List<ClassPeriodStudentExportVo> exportList = weekRs.get(weekDataVo.getWeekCxt());
+                for (ClassPeriodStudentExportVo vo : exportList) {
+                    ossService.zipPeopleWeekDownload(vo, outStream,weekDataVo);
+                }
+            }
+            outStream.close();
+        } catch (IOException e) {
+            System.out.println(e.getMessage() + "压缩");
+        }
+        totalRs.put("list",totalList);
+        totalRs.put("zip", AjaxResult.success(filename));
+        return totalRs;
+    }
+
+    //填充满列表的用户信息
+    private Map<String, Object> fillListWeek(List<ClassPeriodStudentExportVo> list) {
+        List<ClassPeriodStudentExportWeekAllVo> newList = new ArrayList<>();
+        Map<String, Object> rs = new HashMap<>();
+            for (ClassPeriodStudentExportVo vo : list) {
+                for (UserPeriodExportVo cVo : vo.getPeriodVoList()) {
+                    ClassPeriodStudentExportWeekAllVo item = BeanUtil.toBean(vo, ClassPeriodStudentExportWeekAllVo.class);
+                    item.setId(cVo.getId());
+                    item.setModuleName(cVo.getModuleName());
+                    item.setChapterName(cVo.getChapterName());
+                    item.setSectionName(cVo.getSectionName());
+                    item.setDurationTime(Validator.isEmpty(cVo.getDurationTime())?new BigDecimal(0):((new BigDecimal(cVo.getDurationTime()).divide(new BigDecimal(3600),2,BigDecimal.ROUND_DOWN))));
+                    item.setStudyTimeTxt(cVo.getStudyTimeTxt());
+                    item.setStudyTimeLongTxt(cVo.getStudyTimeLongTxt());
+                    item.setStudyStatusTxt(cVo.getStudyStatusTxt());
+                    item.setScore(cVo.getScore());
+                    newList.add(item);
+                }
+            }
+        rs.put("list", newList);
+        return rs;
+    }
+
     //填充满列表的用户信息
     private Map<String, Object> fillList(List<ClassPeriodStudentExportVo> list) {
         List<ClassPeriodStudentExportAllVo> newList = new ArrayList<>();
@@ -1539,6 +1638,237 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return studyList;
     }
 
+    @Override
+    public List<UserPeriodExportVo> listUserStudyRecordWeek(ClassGradeUserQueryBo bo) {
+        //学习记录
+        ClassGradeUserQueryBo cGQB = new ClassGradeUserQueryBo();
+        cGQB.setGoodsId(bo.getGoodsId());
+        cGQB.setUserId(bo.getUserId());
+        cGQB.setGradeId(bo.getGradeId());
+        List<ClassPeriodVo> list = listPeriodAudit(cGQB);
+        String moduleName = "";
+        String chapterName = "";
+        String sectionName = "";
+        List<UserPeriodExportVo> studyList = new ArrayList<>();
+        long i = 0;
+        Long gradeId = bo.getGradeId();
+        Long userId = bo.getUserId();
+        Long goodsId = bo.getGoodsId();
+        for (ClassPeriodVo classPeriodVo : list) {
+            //为模块搜索下面的章 和节 并搜索学时记录
+            if (classPeriodVo.getType() == 1) {
+                moduleName = classPeriodVo.getTypeName();
+                List<ClassPeriodChapterVo> classPeriodChapterVos = baseMapper.listperiodChapter(classPeriodVo.getId(), goodsId, classPeriodVo.getCourseId(), userId, gradeId);
+                for (ClassPeriodChapterVo classPeriodChapterVo : classPeriodChapterVos) {
+                    if (classPeriodChapterVo.getType() == 2) {
+                        chapterName = classPeriodChapterVo.getTypeName();
+                        List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodChapterVo.getId(), goodsId, classPeriodVo.getCourseId(), userId);
+                        classPeriodSectionVos.addAll(baseMapper.listperiodExam(classPeriodChapterVo.getId(), goodsId, classPeriodVo.getCourseId(), userId, classPeriodVo.getId()));
+                        for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
+                            i++;
+                            if (classPeriodSectionVo.getType() == 3) {
+                                sectionName = classPeriodSectionVo.getTypeName();
+                                UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                                userPeriodQueryBo.setSectionId(classPeriodSectionVo.getId());
+                                userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                                userPeriodQueryBo.setGoodsId(goodsId);
+                                userPeriodQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                                userPeriodQueryBo.setChapterId(classPeriodChapterVo.getId());
+                                userPeriodQueryBo.setModuleId(classPeriodVo.getId());
+                                userPeriodQueryBo.setGradeId(gradeId);
+                                userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                                userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                                List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                                    int numIndex = userPeriodStatusVos.size() - 1;
+                                    UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                                    classPeriodSectionVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                                    classPeriodSectionVo.setStatus(userPeriodStatusVo.getStatus());
+                                    classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                                    classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                                    classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                                    classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                                    classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                                    classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                                    classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                                    classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                                    classPeriodSectionVo.setDurationTime(userPeriodStatusVo.getDurationTime());
+                                }
+                                classPeriodSectionVo.setModuleId(classPeriodVo.getId());
+                                classPeriodSectionVo.setChapterId(classPeriodChapterVo.getId());
+                                classPeriodSectionVo.setGoodsId(goodsId);
+                                classPeriodSectionVo.setGradeId(gradeId);
+                                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                                    studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, (new BigDecimal(0)), false));
+                                }
+                            } else {
+                                //章卷
+                                sectionName = classPeriodSectionVo.getTypeName();
+                                UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                                userPeriodQueryBo.setExamId(classPeriodSectionVo.getId());
+                                userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                                userPeriodQueryBo.setGoodsId(goodsId);
+                                userPeriodQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                                userPeriodQueryBo.setChapterId(classPeriodChapterVo.getId());
+                                userPeriodQueryBo.setModuleId(classPeriodVo.getId());
+                                userPeriodQueryBo.setGradeId(gradeId);
+                                userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                                userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                                List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                                    int numIndex = userPeriodStatusVos.size() - 1;
+                                    UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                                    classPeriodSectionVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                                    classPeriodSectionVo.setStatus(userPeriodStatusVo.getStatus());
+                                    classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                                    classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                                    classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                                    classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                                    classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                                    classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                                    classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                                    classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                                    classPeriodChapterVo.setPerformance(Convert.toBigDecimal(userPeriodStatusVo.getPerformance()));
+                                }
+                                classPeriodSectionVo.setModuleId(classPeriodVo.getId());
+                                classPeriodSectionVo.setChapterId(classPeriodChapterVo.getId());
+                                classPeriodSectionVo.setGoodsId(goodsId);
+                                classPeriodSectionVo.setGradeId(gradeId);
+                                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                                    studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, classPeriodChapterVo.getPerformance(), true));
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            //为章搜索节记录和学时记录
+            if (classPeriodVo.getType() == 2) {
+                moduleName = "";
+                chapterName = classPeriodVo.getTypeName();
+                List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodVo.getId(), goodsId, classPeriodVo.getCourseId(), userId);
+                for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
+                    i++;
+                    sectionName = classPeriodSectionVo.getTypeName();
+                    UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                    userPeriodQueryBo.setSectionId(classPeriodSectionVo.getId());
+                    userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                    userPeriodQueryBo.setGoodsId(goodsId);
+                    userPeriodQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                    userPeriodQueryBo.setChapterId(classPeriodVo.getId());
+                    userPeriodQueryBo.setModuleId(0L);
+                    userPeriodQueryBo.setGradeId(gradeId);
+                    userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                    userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                    List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                    if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                        int numIndex = userPeriodStatusVos.size() - 1;
+                        UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                        classPeriodSectionVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                        classPeriodSectionVo.setStatus(userPeriodStatusVo.getStatus());
+                        classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                        classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                        classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                        classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                        classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                        classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                        classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                        classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                        classPeriodSectionVo.setDurationTime(userPeriodStatusVo.getDurationTime());
+                    }
+                    classPeriodSectionVo.setModuleId(0L);
+                    classPeriodSectionVo.setChapterId(classPeriodVo.getId());
+                    classPeriodSectionVo.setGoodsId(goodsId);
+                    classPeriodSectionVo.setGradeId(gradeId);
+                    if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                        studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, (new BigDecimal(0)), false));
+                    }
+                }
+                List<ClassPeriodSectionVo> classPeriodSectionVos1 = baseMapper.listPeriodSectionExam(classPeriodVo.getId(), goodsId, classPeriodVo.getCourseId(), userId);
+                for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos1) {
+                    //章卷
+                    i++;
+                    sectionName = classPeriodSectionVo.getTypeName();
+                    UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                    userPeriodQueryBo.setExamId(classPeriodSectionVo.getId());
+                    userPeriodQueryBo.setCourseId(classPeriodSectionVo.getCourseId());
+                    userPeriodQueryBo.setGoodsId(bo.getGoodsId());
+                    userPeriodQueryBo.setUserId(classPeriodSectionVo.getUserId());
+                    userPeriodQueryBo.setChapterId(classPeriodVo.getId());
+                    userPeriodQueryBo.setModuleId(0L);
+                    userPeriodQueryBo.setGradeId(bo.getGradeId());
+                    userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                    userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                    List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                    if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                        int numIndex = userPeriodStatusVos.size() - 1;
+                        UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                        classPeriodSectionVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                        classPeriodSectionVo.setStatus(userPeriodStatusVo.getStatus());
+                        classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                        classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                        classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                        classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                        classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                        classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                        classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                        classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                        classPeriodVo.setPerformance(Convert.toBigDecimal(userPeriodStatusVo.getPerformance()));
+                    }
+                    classPeriodSectionVo.setModuleId(0L);
+                    classPeriodSectionVo.setChapterId(classPeriodVo.getId());
+                    classPeriodSectionVo.setGoodsId(goodsId);
+                    classPeriodSectionVo.setGradeId(gradeId);
+                    if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                        studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, classPeriodVo.getPerformance(), true));
+                    }
+                }
+                classPeriodSectionVos.addAll(classPeriodSectionVos1);
+                classPeriodVo.setClassPeriodSectionList(classPeriodSectionVos);
+            }
+            //为节搜索学时记录
+            if (classPeriodVo.getType() == 3) {
+                i++;
+                sectionName = classPeriodVo.getTypeName();
+                UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
+                userPeriodQueryBo.setSectionId(classPeriodVo.getId());
+                userPeriodQueryBo.setCourseId(classPeriodVo.getCourseId());
+                userPeriodQueryBo.setGoodsId(bo.getGoodsId());
+                userPeriodQueryBo.setUserId(classPeriodVo.getUserId());
+                userPeriodQueryBo.setChapterId(0L);
+                userPeriodQueryBo.setModuleId(0L);
+                userPeriodQueryBo.setGradeId(bo.getGradeId());
+                userPeriodQueryBo.setSearchWeekStartTime(bo.getSearchWeekStartTime());
+                userPeriodQueryBo.setSearchWeekEndTime(bo.getSearchWeekEndTime());
+                List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
+                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                    int numIndex = userPeriodStatusVos.size() - 1;
+                    UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
+                    classPeriodVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
+                    classPeriodVo.setStatus(userPeriodStatusVo.getStatus());
+                    classPeriodVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
+                    classPeriodVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
+                    classPeriodVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                    classPeriodVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
+                    classPeriodVo.setPeriodId(userPeriodStatusVo.getPeriodId());
+                    classPeriodVo.setPeriodStatusId(userPeriodStatusVo.getId());
+                    classPeriodVo.setAuditTime(userPeriodStatusVo.getAuditTime());
+                    classPeriodVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
+                    classPeriodVo.setDurationTime(userPeriodStatusVo.getDurationTime());
+                }
+                classPeriodVo.setModuleId(0L);
+                classPeriodVo.setChapterId(0L);
+                classPeriodVo.setGoodsId(bo.getGoodsId());
+                classPeriodVo.setGradeId(bo.getGradeId());
+                ClassPeriodSectionVo classPeriodSectionVo = BeanUtil.toBean(classPeriodVo, ClassPeriodSectionVo.class);
+                if (!CollectionUtils.isEmpty(userPeriodStatusVos)) {
+                    studyList.add(mergeData(i, moduleName, chapterName, sectionName, classPeriodSectionVo, (new BigDecimal(0)), false));
+                }
+            }
+        }
+        return studyList;
+    }
+
     /**
      * 学习记录第二版
      * @param bo

+ 0 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportAllVo.java

@@ -20,7 +20,6 @@ import java.util.List;
 @ExcelTarget("classPeriodStudentExportVo")
 public class ClassPeriodStudentExportAllVo {
 	private static final long serialVersionUID = 1L;
-
 	/** 学员编码 */
 	@Excel(name = "学员编码")
 	@ApiModelProperty("学员编码")

+ 92 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportWeekAllVo.java

@@ -0,0 +1,92 @@
+package com.zhongzheng.modules.grade.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+
+/**
+ * 学员记录视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-11-10
+ */
+@Data
+@ExcelTarget("classPeriodStudentExportVo")
+public class ClassPeriodStudentExportWeekAllVo {
+	private static final long serialVersionUID = 1L;
+	/** 学员编码 */
+	@Excel(name = "周时间")
+	@ApiModelProperty("周时间")
+	private String weekTime;
+	/** 学员编码 */
+	@Excel(name = "学员编码")
+	@ApiModelProperty("学员编码")
+	private String studentCode;
+	/** 学员编码 */
+	@Excel(name = "学员姓名")
+	@ApiModelProperty("学员姓名")
+	private String realName;
+	/** 学员编码 */
+	@Excel(name = "学员身份证")
+	@ApiModelProperty("学员身份证")
+	private String idCard;
+	/** 学员编码 */
+	@Excel(name = "学员电话")
+	@ApiModelProperty("学员电话")
+	private String telPhone;
+	/** 一寸照片 */
+	@Excel(name = "一寸照片")
+	@ApiModelProperty("一寸照片")
+	private String oneInchPhotos;
+	/** 身份证人像照 */
+	@Excel(name = "身份证人像照")
+	@ApiModelProperty("身份证人像照")
+	private String idCardImg1;
+	/** 商品ID */
+	@Excel(name = "商品名称")
+	@ApiModelProperty("商品名称")
+	private String goodsName;
+	/** 学时 */
+	@Excel(name = "学时")
+	@ApiModelProperty("学时")
+	private BigDecimal classHours;
+	@Excel(name = "服务有效期")
+	private String studyTimeStr;
+	@Excel(name = "所在班级")
+	private String className;
+	@Excel(name = "班级有效期")
+	private String classTimeStr;
+
+	@Excel(name = "序号")
+	@ApiModelProperty("序号")
+	private Long id;
+
+	@Excel(name = "模块标题")
+	@ApiModelProperty("模块标题")
+	private String moduleName;
+	@Excel(name = "章标题")
+	@ApiModelProperty("章标题")
+	private String chapterName;
+	@Excel(name = "节标题")
+	@ApiModelProperty("节标题")
+	private String sectionName;
+	@Excel(name = "节时长(小时)")
+	@ApiModelProperty("节时长(小时)")
+	private BigDecimal durationTime;
+	@Excel(name = "学习/做题时间")
+	@ApiModelProperty("学习/做题时间")
+	private String studyTimeTxt;
+	@Excel(name = "学习/做题时长")
+	@ApiModelProperty("学习/做题时长")
+	private String studyTimeLongTxt;
+	@Excel(name = "学习/做题状态")
+	@ApiModelProperty("学习/做题状态")
+	private String studyStatusTxt;
+	@Excel(name = "测试成绩")
+	@ApiModelProperty("测试成绩")
+	private BigDecimal score;
+}

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordPhotoMapper.java

@@ -16,4 +16,6 @@ public interface UserStudyRecordPhotoMapper extends BaseMapper<UserStudyRecordPh
     List<String> selectGradePhoto(@Param("userId") Long userId,@Param("gradeId") Long gradeId);
 
     String selectGradeRecentOnePhoto(@Param("userId") Long userId,@Param("gradeId") Long gradeId);
+
+    List<String> selectGradePhotoWeek(@Param("userId") Long userId,@Param("gradeId") Long gradeId,@Param("searchWeekStartTime") Long searchWeekStartTime,@Param("searchWeekEndTime") Long searchWeekEndTime);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserStudyRecordPhotoService.java

@@ -54,4 +54,7 @@ public interface IUserStudyRecordPhotoService extends IService<UserStudyRecordPh
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
 	List<String> selectGradePhoto(Long userId,Long gradeId);
+
+	List<String> selectGradePhotoWeek(Long userId,Long gradeId,Long searchWeekStartTime,Long searchWeekEndTime);
+
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordPhotoServiceImpl.java

@@ -130,4 +130,9 @@ public class UserStudyRecordPhotoServiceImpl extends ServiceImpl<UserStudyRecord
     public List<String> selectGradePhoto(Long userId, Long gradeId) {
         return this.baseMapper.selectGradePhoto(userId,gradeId);
     }
+
+    @Override
+    public List<String> selectGradePhotoWeek(Long userId, Long gradeId,Long searchWeekStartTime,Long searchWeekEndTime) {
+        return this.baseMapper.selectGradePhotoWeek(userId,gradeId,searchWeekStartTime,searchWeekEndTime);
+    }
 }

+ 3 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -694,6 +694,9 @@
         LEFT JOIN course_business cb ON g.business_id = cb.id
         LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = g.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
         where 1=1
+        <if test="searchWeekStartTime != null and searchWeekEndTime != '' ">
+            AND (SELECT count(*) from user_study_record usr where usr.user_id = cgu.user_id AND usr.grade_id = cgu.grade_id AND usr.current_status = 1 AND #{searchWeekEndTime} >=  usr.update_time AND usr.update_time >=#{searchWeekStartTime}) >0
+        </if>
         and cgu.`status` =1
         <if test="periodPlush != null and periodPlush != ''">
             AND cgu.period_plush = #{periodPlush}

+ 7 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/UserPeriodStatusMapper.xml

@@ -81,6 +81,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="type != null ">
             and up.`type` = #{type}
         </if>
+        <if test="searchWeekStartTime != null and searchWeekStartTime != '' ">
+            and ups.period_status = 1
+            AND ups.update_time >= #{searchWeekStartTime}
+        </if>
+        <if test="searchWeekEndTime != null and searchWeekEndTime != '' ">
+            AND #{searchWeekEndTime} >=  ups.update_time
+        </if>
         ORDER BY
             ups.create_time asc
     </select>

+ 20 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordPhotoMapper.xml

@@ -28,6 +28,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             up.user_id = #{userId}
           AND up.grade_id = #{gradeId}
           AND rp.photo IS NOT NULL
+          AND ups.period_status = 1
+    </select>
+
+    <select id="selectGradePhotoWeek" parameterType="map" resultType="string">
+        SELECT
+            rp.photo,
+            ups.id,
+            ups.period_id
+        FROM
+            user_period up
+                LEFT JOIN user_period_status ups ON up.id = ups.period_id
+                LEFT JOIN user_study_record_photo rp ON ups.id = rp.period_id
+        WHERE
+            up.user_id = #{userId}
+          AND up.grade_id = #{gradeId}
+          AND rp.photo IS NOT NULL
+          AND ups.period_status = 1
+            AND rp.update_time >= #{searchWeekStartTime}
+            AND #{searchWeekEndTime} >=  rp.update_time
+
     </select>
 
     <select id="selectGradeRecentOnePhoto" parameterType="map" resultType="string">