浏览代码

fix 学时

he2802 2 年之前
父节点
当前提交
cb555978c0

+ 1 - 30
run-prod.sh

@@ -1,34 +1,5 @@
 #!/usr/bin/env bash
-# 定义应用组名
-group_name='zhongzheng'
-# 定义应用名称
-app_name='zhongzheng-saas-api'
-# 定义应用版本
-app_version='1.0-SNAPSHOT'
-# 定义应用环境
-profile_active='prod'
-echo '----copy jar----'
-docker stop ${app_name}
-echo '----stop container----'
-docker rm ${app_name}
-echo '----rm container----'
-docker rmi ${group_name}/${app_name}:${app_version}
-echo '----rm image----'
-# 打包编译docker镜像
-docker build -f /mydata/maven/build/Dockerfile -t ${group_name}/${app_name}:${app_version} .
-echo '----build image----'
-docker run -p 5055:5055 --name ${app_name} \
---restart=always \
--e 'spring.profiles.active'=${profile_active} \
--e TZ="Asia/Shanghai" \
--m 10240m \
---cpus=3 \
--v /etc/localtime:/etc/localtime \
--v /usr/share/fonts:/usr/share/fonts \
--v /data/logs/prod_api:/logs \
--v /mydata/app/${app_name}/logs:/var/logs \
--d ${group_name}/${app_name}:${app_version}
-echo '----start container----'
+
 
 echo "开始等待20秒..."
 # 1-10秒内随机

+ 88 - 11
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -68,8 +68,6 @@ import org.springframework.util.CollectionUtils;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.zip.ZipOutputStream;
@@ -606,7 +604,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                 return respone;
             }
         } catch (IOException e) {
-            throw new CustomException("学时推送请求错误"+e.getMessage());
+            throw new CustomException("请求错误");
         }
     }
 
@@ -740,7 +738,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                 return respone;
             }
         } catch (IOException e) {
-            throw new CustomException("请求错误"+e.getMessage());
+            throw new CustomException("请求错误");
         }
     }
 
@@ -1639,6 +1637,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         List<ClassPeriodVo> classPeriodVos = baseMapper.listPeriodAudit(bo);
         classPeriodVos.addAll(baseMapper.listPeriodAuditSection(bo));
         Collections.sort(classPeriodVos);
+        Long startTotalTime = 0L;
+        Long endTotalTime = 0L;
         for (ClassPeriodVo classPeriodVo : classPeriodVos) {
             //为模块搜索下面的章 和节 并搜索学时记录
             if (classPeriodVo.getType() == 1) {
@@ -1647,6 +1647,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                 classPeriodChapterVos.addAll(baseMapper.listperiodModuleExam( bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId(), classPeriodVo.getId()));
                 for (ClassPeriodChapterVo classPeriodChapterVo : classPeriodChapterVos) {
                     if (classPeriodChapterVo.getType() == 2) {
+                        Long ChapterEndTime = 0L;
+                        Long ChapterStartTime = 0L;
                         List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodChapterVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId());
                         Collections.sort(classPeriodSectionVos);
                         classPeriodSectionVos.addAll(baseMapper.listperiodExam(classPeriodChapterVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId(), classPeriodVo.getId()));
@@ -1667,18 +1669,31 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                     UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
                                     LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                                     lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
-                                    classPeriodSectionVo.setUserStudyRecordPhotoList(entity2PhotoVo(userStudyRecordPhotoService.list(lqw)));
+                                    List<UserStudyRecordPhotoVo> photoList = entity2PhotoVo(userStudyRecordPhotoService.list(lqw));
+                                    classPeriodSectionVo.setUserStudyRecordPhotoList(photoList);
                                     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.setStudyStartTime(photoList.get(0).getCreateTime());
+                                    if(startTotalTime==0L||startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                                        startTotalTime = classPeriodSectionVo.getStudyStartTime();
+                                    }
+                                    if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
+                                        endTotalTime = classPeriodSectionVo.getStudyEndTime();
+                                    }
                                     classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
                                     classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
                                     classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
                                     classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
                                     classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
                                     classPeriodSectionVo.setDurationTime(userPeriodStatusVo.getDurationTime());
+                                    if(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&ChapterEndTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue()){
+                                        ChapterEndTime = classPeriodSectionVo.getStudyEndTime();
+                                    }
+                                    if(ChapterStartTime==0L||ChapterStartTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                                        ChapterStartTime = classPeriodSectionVo.getStudyStartTime();
+                                    }
                                 }
                                 if(userPeriodStatusVos.size()>1){
                             //        int preIndex = userPeriodStatusVos.size() - 2;
@@ -1712,12 +1727,24 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                     classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
                                     classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
                                     classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                                    if(startTotalTime==0L||startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                                        startTotalTime = classPeriodSectionVo.getStudyStartTime();
+                                    }
+                                    if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
+                                        endTotalTime = classPeriodSectionVo.getStudyEndTime();
+                                    }
                                     classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
                                     classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
                                     classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
                                     classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
                                     classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
                                     classPeriodSectionVo.setPerformance(Convert.toBigDecimal(userPeriodStatusVo.getPerformance()));
+                                    if(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&ChapterEndTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue()){
+                                        ChapterEndTime = classPeriodSectionVo.getStudyEndTime();
+                                    }
+                                    if(ChapterStartTime==0L||ChapterStartTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                                        ChapterStartTime = classPeriodSectionVo.getStudyStartTime();
+                                    }
                                 }
                                 classPeriodSectionVo.setModuleId(classPeriodVo.getId());
                                 classPeriodSectionVo.setChapterId(classPeriodChapterVo.getId());
@@ -1725,7 +1752,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                                 classPeriodSectionVo.setGradeId(bo.getGradeId());
                             }
                         }
-
+                        classPeriodChapterVo.setStudyEndTime(ChapterEndTime);
+                        classPeriodChapterVo.setStudyStartTime(ChapterStartTime);
                         classPeriodChapterVo.setClassPeriodSectionList(classPeriodSectionVos);
                     }
                     else if (classPeriodChapterVo.getType() == 5) {
@@ -1755,6 +1783,12 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                             classPeriodChapterVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
                             classPeriodChapterVo.setPeriodStatusId(userPeriodStatusVo.getId());
                             classPeriodChapterVo.setPerformance(Convert.toBigDecimal(userPeriodStatusVo.getPerformance()));
+                            if(startTotalTime==0L||startTotalTime.longValue()>classPeriodChapterVo.getStudyStartTime().longValue()){
+                                startTotalTime = classPeriodChapterVo.getStudyStartTime();
+                            }
+                            if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodChapterVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodChapterVo.getStudyEndTime().longValue())){
+                                endTotalTime = classPeriodChapterVo.getStudyEndTime();
+                            }
                         }
 
                     }
@@ -1763,6 +1797,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
             }
             //为章搜索节记录和学时记录
             if (classPeriodVo.getType() == 2) {
+                Long ChapterEndTime = 0L;
+                Long ChapterStartTime = 0L;
                 List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId());
                 Collections.sort(classPeriodSectionVos);
                 for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
@@ -1780,18 +1816,31 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
                         LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                         lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
-                        classPeriodSectionVo.setUserStudyRecordPhotoList(entity2PhotoVo(userStudyRecordPhotoService.list(lqw)));
+                        List<UserStudyRecordPhotoVo> photoList = entity2PhotoVo(userStudyRecordPhotoService.list(lqw));
+                        classPeriodSectionVo.setUserStudyRecordPhotoList(photoList);
                         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.setStudyStartTime(photoList.get(0).getCreateTime());
+                        if(startTotalTime==0L||startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                            startTotalTime = classPeriodSectionVo.getStudyStartTime();
+                        }
+                        if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
+                            endTotalTime = classPeriodSectionVo.getStudyEndTime();
+                        }
                         classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
                         classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
                         classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
                         classPeriodSectionVo.setAuditTime(userPeriodStatusVo.getAuditTime());
                         classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
                         classPeriodSectionVo.setDurationTime(userPeriodStatusVo.getDurationTime());
+                        if(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&ChapterEndTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue()){
+                            ChapterEndTime = classPeriodSectionVo.getStudyEndTime();
+                        }
+                        if(ChapterStartTime==0L||ChapterStartTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                            ChapterStartTime = classPeriodSectionVo.getStudyStartTime();
+                        }
                     }
                     if(userPeriodStatusVos.size()>1){
                 //        int preIndex = userPeriodStatusVos.size() - 2;
@@ -1826,6 +1875,12 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         classPeriodSectionVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
                         classPeriodSectionVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
                         classPeriodSectionVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                        if(startTotalTime==0L||startTotalTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                            startTotalTime = classPeriodSectionVo.getStudyStartTime();
+                        }
+                        if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue())){
+                            endTotalTime = classPeriodSectionVo.getStudyEndTime();
+                        }
                         classPeriodSectionVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
                         classPeriodSectionVo.setPeriodId(userPeriodStatusVo.getPeriodId());
                         classPeriodSectionVo.setPeriodStatusId(userPeriodStatusVo.getId());
@@ -1833,6 +1888,12 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                         classPeriodSectionVo.setAuditUserName(userPeriodStatusVo.getAuditUserName());
                         classPeriodSectionVo.setPerformance(Convert.toBigDecimal(userPeriodStatusVo.getPerformance()));
                         classPeriodVo.setPerformance(Convert.toBigDecimal(userPeriodStatusVo.getPerformance()));
+                        if(Validator.isNotEmpty(classPeriodSectionVo.getStudyEndTime())&&ChapterEndTime.longValue()<classPeriodSectionVo.getStudyEndTime().longValue()){
+                            ChapterEndTime = classPeriodSectionVo.getStudyEndTime();
+                        }
+                        if(ChapterStartTime==0L||ChapterStartTime.longValue()>classPeriodSectionVo.getStudyStartTime().longValue()){
+                            ChapterStartTime = classPeriodSectionVo.getStudyStartTime();
+                        }
                     }
                     classPeriodSectionVo.setModuleId(0L);
                     classPeriodSectionVo.setChapterId(classPeriodVo.getId());
@@ -1841,6 +1902,8 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                 }
                 classPeriodSectionVos.addAll(classPeriodSectionVos1);
                 classPeriodVo.setClassPeriodSectionList(classPeriodSectionVos);
+                classPeriodVo.setStudyEndTime(ChapterEndTime);
+                classPeriodVo.setStudyStartTime(ChapterStartTime);
             }
 
             //为节搜索学时记录
@@ -1859,12 +1922,22 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                     UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
                     LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
                     lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
-                    classPeriodVo.setUserStudyRecordPhotoList(entity2PhotoVo(userStudyRecordPhotoService.list(lqw)));
+
+                    List<UserStudyRecordPhotoVo> photoList = entity2PhotoVo(userStudyRecordPhotoService.list(lqw));
+                    classPeriodVo.setUserStudyRecordPhotoList(photoList);
                     classPeriodVo.setNumIndex(Convert.toLong(userPeriodStatusVos.size()));
                     classPeriodVo.setStatus(userPeriodStatusVo.getStatus());
                     classPeriodVo.setNumList(Convert.toLong(userPeriodStatusVos.size()));
                     classPeriodVo.setStudyEndTime(userPeriodStatusVo.getRecordEndTime());
-                    classPeriodVo.setStudyStartTime(userPeriodStatusVo.getRecordStartTime());
+                    if(photoList.size()>0){
+                        classPeriodVo.setStudyStartTime(photoList.get(0).getCreateTime());
+                    }
+                    if(startTotalTime==0L||startTotalTime.longValue()>classPeriodVo.getStudyStartTime().longValue()){
+                        startTotalTime = classPeriodVo.getStudyStartTime();
+                    }
+                    if(endTotalTime==0L||(Validator.isNotEmpty(classPeriodVo.getStudyEndTime())&&endTotalTime.longValue()<classPeriodVo.getStudyEndTime().longValue())){
+                        endTotalTime = classPeriodVo.getStudyEndTime();
+                    }
                     classPeriodVo.setPeriodStatus(userPeriodStatusVo.getPeriodStatus());
                     classPeriodVo.setPeriodId(userPeriodStatusVo.getPeriodId());
                     classPeriodVo.setPeriodStatusId(userPeriodStatusVo.getId());
@@ -1885,6 +1958,10 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
             }
 
         }
+        if(classPeriodVos.size()>0){
+            classPeriodVos.get(0).setStartTotalTime(startTotalTime);
+            classPeriodVos.get(0).setEndTotalTime(endTotalTime);
+        }
         return classPeriodVos;
     }
 

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodUserVo.java

@@ -138,4 +138,8 @@ public class ClassPeriodUserVo {
 
 	@ApiModelProperty("已完成总视频秒数")
 	private Long finishSectionDuration;
+
+	private Long classStartTime;
+
+	private Long classEndTime;
 }

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

@@ -158,6 +158,8 @@
         <result property="className" column="class_name"/>
         <result property="classHours" column="class_hours"/>
         <result property="orderGoodsId" column="order_goods_id"/>
+        <result property="classStartTime" column="class_start_time"/>
+        <result property="classEndTime" column="class_end_time"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodVo" id="ClassPeriodVo">
@@ -646,6 +648,8 @@
         g.goods_id,
         g.goods_name,
         cg.class_name,
+        cg.class_start_time,
+        cg.class_end_time,
         g.class_hours,
         u.one_inch_photos,
         u.id_card_img1,