he2802 3 years ago
parent
commit
a0ee75122f

+ 11 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/DateUtils.java

@@ -7,6 +7,7 @@ import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.Date;
 
+import cn.hutool.core.lang.Validator;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
@@ -89,6 +90,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         }
     }
 
+    public static String timestampToDate(Long times){
+        if(Validator.isEmpty(times)){
+            return "";
+        }
+        long t = times.longValue();
+        t = t * 1000;
+        Date date = new Date(t);
+        return dateTime(date);
+    }
+
     /**
      * 日期路径 即年/月/日 如2018/08/08
      */

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseChapterSectionMapper.java

@@ -27,13 +27,13 @@ public interface CourseChapterSectionMapper extends BaseMapper<CourseChapterSect
     List<CourseUserChapterSectionVo> examList(CourseMenuQueryBo bo);
 
     Integer rebuildCheck(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
-                         @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId);
+                         @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId);
 
     Integer learningCheck(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
                           @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId);
 
     Integer auditCheck(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
-                       @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId);
+                       @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId);
 
     Integer learningExamCheck(@Param("typeId") Long typeId,@Param("gradeId") Long gradeId,
                           @Param("userId") Long userId,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("examId") Long examId,@Param("courseId") Long courseId);

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMenuMapper.java

@@ -29,5 +29,5 @@ public interface CourseMenuMapper extends BaseMapper<CourseMenu> {
 
     Integer learningCheck(@Param("sectionId") Long id,@Param("gradeId") Long gradeId,@Param("userId")Long userId,@Param("courseId")Long courseId);
 
-    Integer auditCheck(@Param("sectionId") Long id,@Param("gradeId") Long gradeId,@Param("userId")Long userId);
+    Integer auditCheck(@Param("sectionId") Long id,@Param("gradeId") Long gradeId,@Param("userId")Long userId,@Param("courseId")Long courseId);
 }

+ 4 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterSectionServiceImpl.java

@@ -142,11 +142,11 @@ public class CourseChapterSectionServiceImpl extends ServiceImpl<CourseChapterSe
         if (bo.getUserId() != null) {
             for (CourseUserChapterSectionVo courseMenuVo : courseUserChapterSectionVos) {
                 if (courseMenuVo.getType().equals(1)) {
-                    Integer rebuild = baseMapper.rebuildCheck(courseMenuVo.getTypeId(), courseMenuVo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), 0L);
+                    Integer rebuild = baseMapper.rebuildCheck(courseMenuVo.getTypeId(), courseMenuVo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), 0L,bo.getCourseId());
                     if (rebuild > 0) {
                         courseMenuVo.setRebuild(1);
                     }
-                    Integer audit = baseMapper.auditCheck(courseMenuVo.getTypeId(), courseMenuVo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), 0L);
+                    Integer audit = baseMapper.auditCheck(courseMenuVo.getTypeId(), courseMenuVo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), 0L,bo.getCourseId());
                     if (audit > 0) {
                         courseMenuVo.setAudit(1L);
                     }
@@ -155,11 +155,11 @@ public class CourseChapterSectionServiceImpl extends ServiceImpl<CourseChapterSe
                         courseMenuVo.setLearning(1L);
                     }
                 } else {
-                    Integer rebuild = baseMapper.rebuildCheck(0L, courseMenuVo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), courseMenuVo.getTypeId());
+                    Integer rebuild = baseMapper.rebuildCheck(0L, courseMenuVo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), courseMenuVo.getTypeId(),bo.getCourseId());
                     if (rebuild > 0) {
                         courseMenuVo.setRebuild(1);
                     }
-                    Integer audit = baseMapper.auditCheck(0L, courseMenuVo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), courseMenuVo.getTypeId());
+                    Integer audit = baseMapper.auditCheck(0L, courseMenuVo.getGradeId(), bo.getUserId(), bo.getModuleId(), bo.getChapterId(), courseMenuVo.getTypeId(),bo.getCourseId());
                     if (rebuild > 0) {
                         courseMenuVo.setAudit(1L);
                     }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseMenuServiceImpl.java

@@ -179,7 +179,7 @@ public class CourseMenuServiceImpl extends ServiceImpl<CourseMenuMapper, CourseM
                     if (rebuild > 0) {
                         courseMenuVo.setRebuild(1);
                     }
-                    Integer audit = baseMapper.auditCheck(courseMenuVo.getMenuId(), courseMenuVo.getGradeId(), bo.getUserId());
+                    Integer audit = baseMapper.auditCheck(courseMenuVo.getMenuId(), courseMenuVo.getGradeId(), bo.getUserId(),bo.getCourseId());
                     if (audit > 0) {
                         courseMenuVo.setAudit(1L);
                     }

+ 9 - 7
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java

@@ -278,7 +278,6 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public boolean editRebuild(ClassGradeUserQueryBo bo) {
         if(Validator.isEmpty(bo.getGradeId())||Validator.isEmpty(bo.getUserId())){
             throw new CustomException("参数错误");
@@ -304,8 +303,9 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
             objectLambdaUpdateWrapper.eq(CoursePhotoLog::getGoodsId, vo.getGoodsId());
             objectLambdaUpdateWrapper.eq(CoursePhotoLog::getSectionId,vo.getSectionId());
             objectLambdaUpdateWrapper.eq(CoursePhotoLog::getGradeId,vo.getGradeId());
-            objectLambdaUpdateWrapper.eq(vo.getModuleId()>0,CoursePhotoLog::getModuleId,vo.getModuleId());
-            objectLambdaUpdateWrapper.eq(vo.getChapterId()>0,CoursePhotoLog::getChapterId,vo.getChapterId());
+            objectLambdaUpdateWrapper.eq(CoursePhotoLog::getModuleId,vo.getModuleId());
+            objectLambdaUpdateWrapper.eq(CoursePhotoLog::getChapterId,vo.getChapterId());
+            objectLambdaUpdateWrapper.eq(CoursePhotoLog::getCourseId,vo.getCourseId());
 
             objectLambdaUpdateWrapper.set(CoursePhotoLog::getCurrentStatus,0); //拍照记录改为历史状态
             iCoursePhotoLogService.update(null, objectLambdaUpdateWrapper);
@@ -315,8 +315,9 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
             objectLambdaUpdateWrapper1.eq(UserStudyRecord::getGoodsId, vo.getGoodsId());
             objectLambdaUpdateWrapper1.eq(UserStudyRecord::getSectionId,vo.getSectionId());
             objectLambdaUpdateWrapper1.eq(UserStudyRecord::getGradeId,vo.getGradeId());
-            objectLambdaUpdateWrapper1.eq(vo.getModuleId()>0,UserStudyRecord::getModuleId,vo.getModuleId());
-            objectLambdaUpdateWrapper1.eq(vo.getChapterId()>0,UserStudyRecord::getChapterId,vo.getChapterId());
+            objectLambdaUpdateWrapper1.eq(UserStudyRecord::getModuleId,vo.getModuleId());
+            objectLambdaUpdateWrapper1.eq(UserStudyRecord::getChapterId,vo.getChapterId());
+            objectLambdaUpdateWrapper1.eq(UserStudyRecord::getCourseId,vo.getCourseId());
 
             objectLambdaUpdateWrapper1.set(UserStudyRecord::getCurrentStatus,0); //学习记录改为历史状态
             iUserStudyRecordService.update(null, objectLambdaUpdateWrapper1);
@@ -326,8 +327,9 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
             objectLambdaUpdateWrapper2.eq(UserBankRecord::getGoodsId, vo.getGoodsId());
             objectLambdaUpdateWrapper2.eq(UserBankRecord::getExamId,vo.getExamId());
             objectLambdaUpdateWrapper2.eq(UserBankRecord::getGradeId,vo.getGradeId());
-            objectLambdaUpdateWrapper2.eq(vo.getModuleId()>0,UserBankRecord::getModuleId,vo.getModuleId());
-            objectLambdaUpdateWrapper2.eq(vo.getChapterId()>0,UserBankRecord::getChapterId,vo.getChapterId());
+            objectLambdaUpdateWrapper2.eq(UserBankRecord::getModuleId,vo.getModuleId());
+            objectLambdaUpdateWrapper2.eq(UserBankRecord::getChapterId,vo.getChapterId());
+            objectLambdaUpdateWrapper2.eq(UserBankRecord::getCourseId,vo.getCourseId());
 
             objectLambdaUpdateWrapper2.set(UserBankRecord::getCurrentStatus,0); //做卷记录改为历史状态
             iUserBankRecordService.update(null, objectLambdaUpdateWrapper2);

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

@@ -262,6 +262,12 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
      */
     @Override
     public Boolean updateUserPeriodStatus(ClassGradeUserQueryBo bo) {
+        if(Validator.isEmpty(bo.getUserId())){
+            throw new CustomException("参数错误");
+        }
+        if(Validator.isEmpty(bo.getGradeId())){
+            throw new CustomException("参数错误");
+        }
         ClassPeriodStudentVo classPeriodStudentVo = baseMapper.getUserPeriodStatus(bo);
         Long secLong = 0L;
         Long studyLong = 0L;
@@ -409,6 +415,17 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
 
             ClassPeriodStudentExportVo addItem = BeanUtil.toBean(classPeriodStudentVo, ClassPeriodStudentExportVo.class);
 
+            addItem.setStudyTimeStr(DateUtils.timestampToDate(classPeriodStudentVo.getStudyStartTime())+"-"+DateUtils.timestampToDate(classPeriodStudentVo.getStudyEndTime()));
+            addItem.setClassTimeStr(DateUtils.timestampToDate(classPeriodStudentVo.getClassStartTime())+"-"+DateUtils.timestampToDate(classPeriodStudentVo.getClassEndTime()));
+            //学习记录
+            ClassGradeUserQueryBo cGQB = new ClassGradeUserQueryBo();
+            cGQB.setGoodsId(classPeriodStudentVo.getGoodsId());
+            cGQB.setUserId(classPeriodStudentVo.getUserId());
+            cGQB.setGradeId(classPeriodStudentVo.getGradeId());
+            List<ClassPeriodVo> list = listPeriodAudit(cGQB);
+            for(ClassPeriodVo vo : list){
+
+            }
             List<UserPeriodVo> periodVoList = new ArrayList<>();
             UserPeriodVo v1 = new UserPeriodVo();
             v1.setSectionId(113L);

+ 6 - 7
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java

@@ -8,6 +8,7 @@ import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
+import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
@@ -264,13 +265,11 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
             userPeriodStatusService.update(userPeriodStatus, userPeriods);
         }
         //更新班级学员信息
-        LambdaQueryWrapper<ClassGradeUser> classGradeUser = Wrappers.lambdaQuery();
-        classGradeUser.eq(ClassGradeUser::getUserId, bo.getUserId());
-        classGradeUser.eq(ClassGradeUser::getGradeId, bo.getGradeId());
-        ClassGradeUser classGradeUser1 = new ClassGradeUser();
-        classGradeUser1.setPeriodStatus(bo.getStatus());
-        classGradeUser1.setUpdateTime(DateUtils.getNowTime());
-        iClassGradeUserService.update(classGradeUser1, classGradeUser);
+        ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
+        classGradeUserQueryBo.setUserId(bo.getUserId());
+        classGradeUserQueryBo.setGradeId(bo.getGradeId());
+        iClassGradeUserService.updateUserPeriodStatus(classGradeUserQueryBo);
+
         //发送消息
         sendPeriodSMS(bo);
         sendPeriodSevenSMS(bo);

+ 18 - 34
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentExportVo.java

@@ -22,60 +22,44 @@ import java.util.List;
 public class ClassPeriodStudentExportVo {
 	private static final long serialVersionUID = 1L;
 
-
-	/** 学员ID */
-	@Excel(name = "学员ID")
-	@ApiModelProperty("学员ID")
-	private Long userId;
-
-	/** 商品ID */
-	@Excel(name = "商品ID")
-	@ApiModelProperty("商品ID")
-	private Long goodsId;
-	/** 班级id */
-	@Excel(name = "班级id")
-	@ApiModelProperty("班级id")
-	private Long gradeId;
-	/** 1 进入 0移除 */
-	@Excel(name = "1 进入 0移除")
-	@ApiModelProperty("1 进入 0移除")
-	private Integer status;
-
 	/** 学员编码 */
 	@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 = "當前班級學員審核狀態 -1不可审核 0待審  1未通过 2通过")
-	@ApiModelProperty("當前班級學員審核狀態 -1不可审核 0待審  1未通过 2通过")
-	private Integer allStatus;
-	/** 身份证人像照 */
-	@Excel(name = "身份证人像照")
-	@ApiModelProperty("身份证人像照")
-	private String idCardImg1;
 	/** 一寸照片 */
 	@Excel(name = "一寸照片")
 	@ApiModelProperty("一寸照片")
 	private String oneInchPhotos;
-
+	/** 身份证人像照 */
+	@Excel(name = "身份证人像照")
+	@ApiModelProperty("身份证人像照")
+	private String idCardImg1;
+	/** 商品ID */
+	@Excel(name = "商品名称")
+	@ApiModelProperty("商品名称")
+	private String goodsName;
+	/** 学时 */
+	@Excel(name = "学时")
+	@ApiModelProperty("学时")
+	private Long classHours;
+	@Excel(name = "学习有效期")
+	private String studyTimeStr;
+	@Excel(name = "所在班级")
+	private String className;
+	@Excel(name = "班级有效期")
+	private String classTimeStr;
 
 	@ExcelCollection(name = "学习记录")
 	private List<UserPeriodVo> periodVoList;

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

@@ -173,4 +173,8 @@ public class ClassPeriodStudentVo {
 
 	@ApiModelProperty("key值")
 	private String keyValue;
+
+	private Long classStartTime;
+
+	private Long classEndTime;
 }

+ 51 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodExportVo.java

@@ -0,0 +1,51 @@
+package com.zhongzheng.modules.grade.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * 【请填写功能名称】视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@ApiModel("【请填写功能名称】视图对象")
+@ExcelTarget("userPeriodVo")
+public class UserPeriodExportVo {
+	private static final long serialVersionUID = 1L;
+
+	@Excel(name = "序号")
+	private Long id;
+
+	@Excel(name = "模块标题")
+	private String moduleName;
+	@Excel(name = "章ID")
+	@ApiModelProperty("章标题")
+	private String chapterName;
+	@Excel(name = "节标题")
+	private String sectionName;
+	@Excel(name = "节时长(秒)")
+	private Long durationTime;
+	@Excel(name = "学习/做题时间")
+	private String studyTimeStr;
+	@Excel(name = "学习/做题时间")
+	private String studyTimeLong;
+
+	/** 1 节类型  2试卷类型 */
+	@Excel(name = "1 节类型  2试卷类型")
+	@ApiModelProperty("1 节类型  2试卷类型")
+	private Integer type;
+	/** 试卷ID */
+	@Excel(name = "试卷ID")
+	@ApiModelProperty("试卷ID")
+	private Long examId;
+
+	/** 班级ID */
+	@ApiModelProperty("班级ID")
+	private Long gradeId;
+}

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterSectionMapper.xml

@@ -178,6 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND up.module_id= #{moduleId}
           and up.chapter_id=#{chapterId}
           and up.section_id=#{typeId}
+          and up.course_id=#{courseId}
           and up.exam_id=#{examId}
           AND ups.period_status =1
           and (ups.`status` = 0 or ups.`status` = 3)
@@ -230,6 +231,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND up.module_id= #{moduleId}
           and up.chapter_id=#{chapterId}
           and up.section_id=#{typeId}
+          AND up.course_id=#{courseId}
           and up.exam_id=#{examId}
           AND ups.period_status =1
           and ups.`status` = 1

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuMapper.xml

@@ -174,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND up.user_id = #{userId}
           AND up.module_id= 0
           and up.chapter_id=0
+          and up.course_id=#{courseId}
           and up.section_id=#{sectionId}
           AND ups.period_status =1
           and ups.`status` = 1

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

@@ -78,6 +78,8 @@
         <result property="standPrice" column="stand_price"/>
         <result property="goodsCode" column="goods_code"/>
         <result property="keyValue" column="key_value"/>
+        <result property="classStartTime" column="class_start_time"/>
+        <result property="classEndTime" column="class_end_time"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodUserVo" id="ClassPeriodUserVo">