Ver Fonte

学时审核

change há 3 anos atrás
pai
commit
3dc6874d52
23 ficheiros alterados com 1679 adições e 211 exclusões
  1. 14 4
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java
  2. 51 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodAddBo.java
  3. 69 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodEditBo.java
  4. 63 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodQueryBo.java
  5. 42 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodStatusAddBo.java
  6. 49 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodStatusEditBo.java
  7. 54 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodStatusQueryBo.java
  8. 51 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/UserPeriod.java
  9. 45 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/UserPeriodStatus.java
  10. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeUserMapper.java
  11. 14 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/UserPeriodMapper.java
  12. 14 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/UserPeriodStatusMapper.java
  13. 52 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IUserPeriodService.java
  14. 52 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IUserPeriodStatusService.java
  15. 6 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java
  16. 137 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java
  17. 103 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodStatusServiceImpl.java
  18. 2 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodVo.java
  19. 47 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodStatusVo.java
  20. 59 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodVo.java
  21. 706 204
      zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml
  22. 22 0
      zhongzheng-system/src/main/resources/mapper/modules/grade/UserPeriodMapper.xml
  23. 19 0
      zhongzheng-system/src/main/resources/mapper/modules/grade/UserPeriodStatusMapper.xml

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

@@ -5,9 +5,7 @@ import java.util.Arrays;
 
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.grade.bo.*;
-import com.zhongzheng.modules.grade.service.IClassGradeInterfaceService;
-import com.zhongzheng.modules.grade.service.IClassGradeSysService;
-import com.zhongzheng.modules.grade.service.IClassGradeUserService;
+import com.zhongzheng.modules.grade.service.*;
 import com.zhongzheng.modules.grade.vo.*;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -24,7 +22,6 @@ import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.enums.BusinessType;
-import com.zhongzheng.modules.grade.service.IClassGradeService;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import io.swagger.annotations.Api;
@@ -50,6 +47,8 @@ public class ClassGradeController extends BaseController {
 
     private final IClassGradeUserService iClassGradeUserService;
 
+    private final IUserPeriodService iUserPeriodService;
+
     /**
      * 查询班级列表
      */
@@ -206,6 +205,17 @@ public class ClassGradeController extends BaseController {
         return toAjax(iClassGradeService.updateByEditBo(bo) ? 1 : 0);
     }
 
+    /**
+     * 修改【请填写功能名称】
+     */
+    @ApiOperation("")
+    @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
+    @PutMapping()
+    public AjaxResult<Void> edit(@RequestBody UserPeriodEditBo bo) {
+        return toAjax(iUserPeriodService.updateByEditBo(bo) ? 1 : 0);
+    }
+
     /*    *//**
      * 删除班级
      *//*

+ 51 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodAddBo.java

@@ -0,0 +1,51 @@
+package com.zhongzheng.modules.grade.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * 【请填写功能名称】添加对象 user_period
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@ApiModel("【请填写功能名称】添加对象")
+public class UserPeriodAddBo {
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long userId;
+    /** 课程ID */
+    @ApiModelProperty("课程ID")
+    private Long courseId;
+    /** 节ID */
+    @ApiModelProperty("节ID")
+    private Long sectionId;
+    /** 商品Id */
+    @ApiModelProperty("商品Id")
+    private Long goodsId;
+    /** 1 节类型  2试卷类型 */
+    @ApiModelProperty("1 节类型  2试卷类型")
+    private Integer type;
+    /** 试卷ID */
+    @ApiModelProperty("试卷ID")
+    private Long examId;
+    /** 创建时间 */
+    @ApiModelProperty("创建时间")
+    private Long createTime;
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long updateTime;
+    /** 模块ID */
+    @ApiModelProperty("模块ID")
+    private Long moduleId;
+    /** 章ID */
+    @ApiModelProperty("章ID")
+    private Long chapterId;
+}

+ 69 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodEditBo.java

@@ -0,0 +1,69 @@
+package com.zhongzheng.modules.grade.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+
+
+/**
+ * 【请填写功能名称】编辑对象 user_period
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@ApiModel("【请填写功能名称】编辑对象")
+public class UserPeriodEditBo {
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long[] id;
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long userId;
+
+    /** 课程ID */
+    @ApiModelProperty("课程ID")
+    private Long courseId;
+
+    /** 节ID */
+    @ApiModelProperty("节ID")
+    private Long sectionId;
+
+    /** 商品Id */
+    @ApiModelProperty("商品Id")
+    private Long goodsId;
+
+    /** 1 节类型  2试卷类型 */
+    @ApiModelProperty("1 节类型  2试卷类型")
+    private Integer type;
+
+    /** 试卷ID */
+    @ApiModelProperty("试卷ID")
+    private Long examId;
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long updateTime;
+
+
+    /** 模块ID */
+    @ApiModelProperty("模块ID")
+    private Long moduleId;
+
+    /** 1通过 0作弊 */
+    @ApiModelProperty("1通过 0作弊")
+    private Integer status;
+
+    /** 章ID */
+    @ApiModelProperty("章ID")
+    private Long chapterId;
+
+    /** 章ID */
+    @ApiModelProperty("1单独审核  2待审核项目全部审核")
+    private Long completeAudit;
+
+}

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

@@ -0,0 +1,63 @@
+package com.zhongzheng.modules.grade.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import com.zhongzheng.common.core.domain.BaseEntity;
+
+/**
+ * 【请填写功能名称】分页查询对象 user_period
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel("【请填写功能名称】分页查询对象")
+public class UserPeriodQueryBo extends BaseEntity {
+
+	/** 分页大小 */
+	@ApiModelProperty("分页大小")
+	private Integer pageSize;
+	/** 当前页数 */
+	@ApiModelProperty("当前页数")
+	private Integer pageNum;
+	/** 排序列 */
+	@ApiModelProperty("排序列")
+	private String orderByColumn;
+	/** 排序的方向desc或者asc */
+	@ApiModelProperty(value = "排序的方向", example = "asc,desc")
+	private String isAsc;
+
+
+	/** $column.columnComment */
+	@ApiModelProperty("$column.columnComment")
+	private Long userId;
+	/** 课程ID */
+	@ApiModelProperty("课程ID")
+	private Long courseId;
+	/** 节ID */
+	@ApiModelProperty("节ID")
+	private Long sectionId;
+	/** 商品Id */
+	@ApiModelProperty("商品Id")
+	private Long goodsId;
+	/** 1 节类型  2试卷类型 */
+	@ApiModelProperty("1 节类型  2试卷类型")
+	private Integer type;
+	/** 试卷ID */
+	@ApiModelProperty("试卷ID")
+	private Long examId;
+	/** 模块ID */
+	@ApiModelProperty("模块ID")
+	private Long moduleId;
+	/** 章ID */
+	@ApiModelProperty("章ID")
+	private Long chapterId;
+}

+ 42 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodStatusAddBo.java

@@ -0,0 +1,42 @@
+package com.zhongzheng.modules.grade.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * 【请填写功能名称】添加对象 user_period_status
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@ApiModel("【请填写功能名称】添加对象")
+public class UserPeriodStatusAddBo {
+
+    /** 1通过 0作弊 */
+    @ApiModelProperty("1通过 0作弊")
+    private Integer status;
+    /** 学习开始时间 */
+    @ApiModelProperty("学习开始时间")
+    private Long recordStartTime;
+    /** 学习结束时间 */
+    @ApiModelProperty("学习结束时间")
+    private Long recordEndTime;
+    /** 学时关联 */
+    @ApiModelProperty("学时关联")
+    private Long periodId;
+    /** 当前节状态 1 当前状态 0过往状态 */
+    @ApiModelProperty("当前节状态 1 当前状态 0过往状态")
+    private Integer periodStatus;
+    /** 创建时间 */
+    @ApiModelProperty("创建时间")
+    private Long createTime;
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long updateTime;
+}

+ 49 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodStatusEditBo.java

@@ -0,0 +1,49 @@
+package com.zhongzheng.modules.grade.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+
+
+/**
+ * 【请填写功能名称】编辑对象 user_period_status
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@ApiModel("【请填写功能名称】编辑对象")
+public class UserPeriodStatusEditBo {
+
+    /** 1通过 0作弊 */
+    @ApiModelProperty("1通过 0作弊")
+    private Integer status;
+
+    /** 学习开始时间 */
+    @ApiModelProperty("学习开始时间")
+    private Long recordStartTime;
+
+    /** 学习结束时间 */
+    @ApiModelProperty("学习结束时间")
+    private Long recordEndTime;
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long id;
+
+    /** 学时关联 */
+    @ApiModelProperty("学时关联")
+    private Long periodId;
+
+    /** 当前节状态 1 当前状态 0过往状态 */
+    @ApiModelProperty("当前节状态 1 当前状态 0过往状态")
+    private Integer periodStatus;
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long updateTime;
+
+
+}

+ 54 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodStatusQueryBo.java

@@ -0,0 +1,54 @@
+package com.zhongzheng.modules.grade.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import com.zhongzheng.common.core.domain.BaseEntity;
+
+/**
+ * 【请填写功能名称】分页查询对象 user_period_status
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel("【请填写功能名称】分页查询对象")
+public class UserPeriodStatusQueryBo extends BaseEntity {
+
+	/** 分页大小 */
+	@ApiModelProperty("分页大小")
+	private Integer pageSize;
+	/** 当前页数 */
+	@ApiModelProperty("当前页数")
+	private Integer pageNum;
+	/** 排序列 */
+	@ApiModelProperty("排序列")
+	private String orderByColumn;
+	/** 排序的方向desc或者asc */
+	@ApiModelProperty(value = "排序的方向", example = "asc,desc")
+	private String isAsc;
+
+
+	/** 1通过 0作弊 */
+	@ApiModelProperty("1通过 0作弊")
+	private Integer status;
+	/** 学习开始时间 */
+	@ApiModelProperty("学习开始时间")
+	private Long recordStartTime;
+	/** 学习结束时间 */
+	@ApiModelProperty("学习结束时间")
+	private Long recordEndTime;
+	/** 学时关联 */
+	@ApiModelProperty("学时关联")
+	private Long periodId;
+	/** 当前节状态 1 当前状态 0过往状态 */
+	@ApiModelProperty("当前节状态 1 当前状态 0过往状态")
+	private Integer periodStatus;
+}

+ 51 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/UserPeriod.java

@@ -0,0 +1,51 @@
+package com.zhongzheng.modules.grade.domain;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import java.io.Serializable;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.zhongzheng.common.annotation.Excel;
+
+/**
+ * 【请填写功能名称】对象 user_period
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("user_period")
+public class UserPeriod implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    /** $column.columnComment */
+    @TableId(value = "id")
+    private Long id;
+    /** $column.columnComment */
+    private Long userId;
+    /** 课程ID */
+    private Long courseId;
+    /** 节ID */
+    private Long sectionId;
+    /** 商品Id */
+    private Long goodsId;
+    /** 1 节类型  2试卷类型 */
+    private Integer type;
+    /** 试卷ID */
+    private Long examId;
+    /** 创建时间 */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createTime;
+    /** $column.columnComment */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateTime;
+    /** 模块ID */
+    private Long moduleId;
+    /** 章ID */
+    private Long chapterId;
+}

+ 45 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/domain/UserPeriodStatus.java

@@ -0,0 +1,45 @@
+package com.zhongzheng.modules.grade.domain;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import java.io.Serializable;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.zhongzheng.common.annotation.Excel;
+
+/**
+ * 【请填写功能名称】对象 user_period_status
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("user_period_status")
+public class UserPeriodStatus implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    /** 1通过 0作弊 */
+    private Integer status;
+    /** 学习开始时间 */
+    private Long recordStartTime;
+    /** 学习结束时间 */
+    private Long recordEndTime;
+    /** $column.columnComment */
+    @TableId(value = "id")
+    private Long id;
+    /** 学时关联 */
+    private Long periodId;
+    /** 当前节状态 1 当前状态 0过往状态 */
+    private Integer periodStatus;
+    /** 创建时间 */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createTime;
+    /** $column.columnComment */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateTime;
+}

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeUserMapper.java

@@ -30,4 +30,12 @@ public interface ClassGradeUserMapper extends BaseMapper<ClassGradeUser> {
     List<ClassPeriodChapterVo> listperiodChapter(@Param("moduleId") Long id,@Param("goodsId") Long goodsId,@Param("courseId") Long courseId,@Param("userId") Long userId);
 
     List<ClassPeriodSectionVo> listPeriodSection(@Param("chapterId") Long id,@Param("goodsId") Long goodsId,@Param("courseId") Long courseId,@Param("userId") Long userId);
+
+    List<ClassPeriodVo> listPeriodAuditSection(ClassGradeUserQueryBo bo);
+
+    List<ClassPeriodVo> listPeriodAuditExam(ClassGradeUserQueryBo bo);
+
+    List<ClassPeriodChapterVo> listperiodExam(@Param("moduleId") Long id,@Param("goodsId") Long goodsId,@Param("courseId") Long courseId,@Param("userId") Long userId);
+
+    List<ClassPeriodSectionVo> listPeriodSectionExam(@Param("chapterId") Long id,@Param("goodsId") Long goodsId,@Param("courseId") Long courseId,@Param("userId") Long userId);
 }

+ 14 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/UserPeriodMapper.java

@@ -0,0 +1,14 @@
+package com.zhongzheng.modules.grade.mapper;
+
+import com.zhongzheng.modules.grade.domain.UserPeriod;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+public interface UserPeriodMapper extends BaseMapper<UserPeriod> {
+
+}

+ 14 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/UserPeriodStatusMapper.java

@@ -0,0 +1,14 @@
+package com.zhongzheng.modules.grade.mapper;
+
+import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+public interface UserPeriodStatusMapper extends BaseMapper<UserPeriodStatus> {
+
+}

+ 52 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IUserPeriodService.java

@@ -0,0 +1,52 @@
+package com.zhongzheng.modules.grade.service;
+
+import com.zhongzheng.modules.grade.domain.UserPeriod;
+import com.zhongzheng.modules.grade.vo.UserPeriodVo;
+import com.zhongzheng.modules.grade.bo.UserPeriodQueryBo;
+import com.zhongzheng.modules.grade.bo.UserPeriodAddBo;
+import com.zhongzheng.modules.grade.bo.UserPeriodEditBo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Service接口
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+public interface IUserPeriodService extends IService<UserPeriod> {
+	/**
+	 * 查询单个
+	 * @return
+	 */
+	UserPeriodVo queryById(Long id);
+
+	/**
+	 * 查询列表
+	 */
+	List<UserPeriodVo> queryList(UserPeriodQueryBo bo);
+
+	/**
+	 * 根据新增业务对象插入【请填写功能名称】
+	 * @param bo 【请填写功能名称】新增业务对象
+	 * @return
+	 */
+	Boolean insertByAddBo(UserPeriodAddBo bo);
+
+	/**
+	 * 根据编辑业务对象修改【请填写功能名称】
+	 * @param bo 【请填写功能名称】编辑业务对象
+	 * @return
+	 */
+	Boolean updateByEditBo(UserPeriodEditBo bo);
+
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 52 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IUserPeriodStatusService.java

@@ -0,0 +1,52 @@
+package com.zhongzheng.modules.grade.service;
+
+import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
+import com.zhongzheng.modules.grade.bo.UserPeriodStatusQueryBo;
+import com.zhongzheng.modules.grade.bo.UserPeriodStatusAddBo;
+import com.zhongzheng.modules.grade.bo.UserPeriodStatusEditBo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Service接口
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+public interface IUserPeriodStatusService extends IService<UserPeriodStatus> {
+	/**
+	 * 查询单个
+	 * @return
+	 */
+	UserPeriodStatusVo queryById(Long id);
+
+	/**
+	 * 查询列表
+	 */
+	List<UserPeriodStatusVo> queryList(UserPeriodStatusQueryBo bo);
+
+	/**
+	 * 根据新增业务对象插入【请填写功能名称】
+	 * @param bo 【请填写功能名称】新增业务对象
+	 * @return
+	 */
+	Boolean insertByAddBo(UserPeriodStatusAddBo bo);
+
+	/**
+	 * 根据编辑业务对象修改【请填写功能名称】
+	 * @param bo 【请填写功能名称】编辑业务对象
+	 * @return
+	 */
+	Boolean updateByEditBo(UserPeriodStatusEditBo bo);
+
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 6 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -161,16 +161,21 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Override
     public List<ClassPeriodVo> listPeriodAudit(ClassGradeUserQueryBo bo) {
         List<ClassPeriodVo> classPeriodVos = baseMapper.listPeriodAudit(bo);
+        classPeriodVos.addAll(baseMapper.listPeriodAuditSection(bo));
+        classPeriodVos.addAll(baseMapper.listPeriodAuditExam(bo));
         for (ClassPeriodVo classPeriodVo : classPeriodVos) {
             if (classPeriodVo.getType() == 1){
                 List<ClassPeriodChapterVo> classPeriodChapterVos = baseMapper.listperiodChapter(classPeriodVo.getId(), bo.getGoodsId(),classPeriodVo.getCourseId(), bo.getUserId());
+                classPeriodChapterVos.addAll(baseMapper.listperiodExam(classPeriodVo.getId(), bo.getGoodsId(),classPeriodVo.getCourseId(), bo.getUserId()));
                 for (ClassPeriodChapterVo classPeriodChapterVo : classPeriodChapterVos) {
                     classPeriodChapterVo.setClassPeriodSectionList(baseMapper.listPeriodSection(classPeriodChapterVo.getId(),bo.getGoodsId(),classPeriodVo.getCourseId(),bo.getUserId()));
                 }
                 classPeriodVo.setClassPeriods(classPeriodChapterVos);
             }
             if (classPeriodVo.getType() == 2){
-                classPeriodVo.setClassPeriodSectionList(baseMapper.listPeriodSection(classPeriodVo.getId(),bo.getGoodsId(),classPeriodVo.getCourseId(),bo.getUserId()));
+                List<ClassPeriodSectionVo> classPeriodSectionVos = baseMapper.listPeriodSection(classPeriodVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId());
+                classPeriodSectionVos.addAll(baseMapper.listPeriodSectionExam(classPeriodVo.getId(), bo.getGoodsId(), classPeriodVo.getCourseId(), bo.getUserId()));
+                classPeriodVo.setClassPeriodSectionList(classPeriodSectionVos);
             }
         }
         return classPeriodVos;

+ 137 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java

@@ -0,0 +1,137 @@
+package com.zhongzheng.modules.grade.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.pagehelper.Page;
+import com.zhongzheng.modules.grade.bo.UserPeriodAddBo;
+import com.zhongzheng.modules.grade.bo.UserPeriodQueryBo;
+import com.zhongzheng.modules.grade.bo.UserPeriodEditBo;
+import com.zhongzheng.modules.grade.domain.UserPeriod;
+import com.zhongzheng.modules.grade.mapper.UserPeriodMapper;
+import com.zhongzheng.modules.grade.vo.UserPeriodVo;
+import com.zhongzheng.modules.grade.service.IUserPeriodService;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Service
+public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPeriod> implements IUserPeriodService {
+
+    @Autowired
+    private IUserPeriodStatusService userPeriodStatusService;
+
+
+    @Override
+    public UserPeriodVo queryById(Long id){
+        UserPeriod db = this.baseMapper.selectById(id);
+        return BeanUtil.toBean(db, UserPeriodVo.class);
+    }
+
+    @Override
+    public List<UserPeriodVo> queryList(UserPeriodQueryBo bo) {
+        LambdaQueryWrapper<UserPeriod> lqw = Wrappers.lambdaQuery();
+        lqw.eq(bo.getUserId() != null, UserPeriod::getUserId, bo.getUserId());
+        lqw.eq(bo.getCourseId() != null, UserPeriod::getCourseId, bo.getCourseId());
+        lqw.eq(bo.getSectionId() != null, UserPeriod::getSectionId, bo.getSectionId());
+        lqw.eq(bo.getGoodsId() != null, UserPeriod::getGoodsId, bo.getGoodsId());
+        lqw.eq(bo.getType() != null, UserPeriod::getType, bo.getType());
+        lqw.eq(bo.getExamId() != null, UserPeriod::getExamId, bo.getExamId());
+        lqw.eq(bo.getModuleId() != null, UserPeriod::getModuleId, bo.getModuleId());
+        lqw.eq(bo.getChapterId() != null, UserPeriod::getChapterId, bo.getChapterId());
+        return entity2Vo(this.list(lqw));
+    }
+
+    /**
+    * 实体类转化成视图对象
+    *
+    * @param collection 实体类集合
+    * @return
+    */
+    private List<UserPeriodVo> entity2Vo(Collection<UserPeriod> collection) {
+        List<UserPeriodVo> voList = collection.stream()
+                .map(any -> BeanUtil.toBean(any, UserPeriodVo.class))
+                .collect(Collectors.toList());
+        if (collection instanceof Page) {
+            Page<UserPeriod> page = (Page<UserPeriod>)collection;
+            Page<UserPeriodVo> pageVo = new Page<>();
+            BeanUtil.copyProperties(page,pageVo);
+            pageVo.addAll(voList);
+            voList = pageVo;
+        }
+        return voList;
+    }
+
+    @Override
+    public Boolean insertByAddBo(UserPeriodAddBo bo) {
+        UserPeriod add = BeanUtil.toBean(bo, UserPeriod.class);
+        validEntityBeforeSave(add);
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
+        return this.save(add);
+    }
+
+    @Override
+    public Boolean updateByEditBo(UserPeriodEditBo bo) {
+        if (bo.getCompleteAudit() == 1){
+            for (Long aLong : bo.getId()) {
+                UserPeriodStatus userPeriodStatus = new UserPeriodStatus();
+                userPeriodStatus.setPeriodStatus(1);
+                userPeriodStatus.setStatus(bo.getStatus());
+                LambdaQueryWrapper<UserPeriodStatus> lqw = Wrappers.lambdaQuery();
+                lqw.eq( UserPeriodStatus::getPeriodId, aLong);
+                lqw.eq( UserPeriodStatus::getPeriodStatus, 1);
+                userPeriodStatusService.update(userPeriodStatus,lqw);
+            }
+        }
+        if (bo.getCompleteAudit() == 2){
+            LambdaQueryWrapper<UserPeriod> lqw = Wrappers.lambdaQuery();
+            lqw.eq(bo.getUserId() != null, UserPeriod::getUserId, bo.getUserId());
+            lqw.eq(bo.getGoodsId() != null, UserPeriod::getGoodsId, bo.getGoodsId());
+            List<UserPeriod> list = this.list(lqw);
+            for (UserPeriod userPeriod : list) {
+                UserPeriodStatus userPeriodStatus = new UserPeriodStatus();
+                userPeriodStatus.setPeriodStatus(1);
+                userPeriodStatus.setStatus(bo.getStatus());
+                LambdaQueryWrapper<UserPeriodStatus> userPeriods = Wrappers.lambdaQuery();
+                userPeriods.eq( UserPeriodStatus::getPeriodId, userPeriod.getId());
+                userPeriods.eq( UserPeriodStatus::getPeriodStatus, 1);
+                userPeriods.eq( UserPeriodStatus::getStatus, 2);
+                userPeriodStatusService.update(userPeriodStatus,userPeriods);
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(UserPeriod entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return this.removeByIds(ids);
+    }
+}

+ 103 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodStatusServiceImpl.java

@@ -0,0 +1,103 @@
+package com.zhongzheng.modules.grade.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.zhongzheng.common.utils.DateUtils;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.pagehelper.Page;
+import com.zhongzheng.modules.grade.bo.UserPeriodStatusAddBo;
+import com.zhongzheng.modules.grade.bo.UserPeriodStatusQueryBo;
+import com.zhongzheng.modules.grade.bo.UserPeriodStatusEditBo;
+import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.zhongzheng.modules.grade.mapper.UserPeriodStatusMapper;
+import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
+import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Service
+public class UserPeriodStatusServiceImpl extends ServiceImpl<UserPeriodStatusMapper, UserPeriodStatus> implements IUserPeriodStatusService {
+
+    @Override
+    public UserPeriodStatusVo queryById(Long id){
+        UserPeriodStatus db = this.baseMapper.selectById(id);
+        return BeanUtil.toBean(db, UserPeriodStatusVo.class);
+    }
+
+    @Override
+    public List<UserPeriodStatusVo> queryList(UserPeriodStatusQueryBo bo) {
+        LambdaQueryWrapper<UserPeriodStatus> lqw = Wrappers.lambdaQuery();
+        lqw.eq(bo.getStatus() != null, UserPeriodStatus::getStatus, bo.getStatus());
+        lqw.eq(bo.getRecordStartTime() != null, UserPeriodStatus::getRecordStartTime, bo.getRecordStartTime());
+        lqw.eq(bo.getRecordEndTime() != null, UserPeriodStatus::getRecordEndTime, bo.getRecordEndTime());
+        lqw.eq(bo.getPeriodId() != null, UserPeriodStatus::getPeriodId, bo.getPeriodId());
+        lqw.eq(bo.getPeriodStatus() != null, UserPeriodStatus::getPeriodStatus, bo.getPeriodStatus());
+        return entity2Vo(this.list(lqw));
+    }
+
+    /**
+    * 实体类转化成视图对象
+    *
+    * @param collection 实体类集合
+    * @return
+    */
+    private List<UserPeriodStatusVo> entity2Vo(Collection<UserPeriodStatus> collection) {
+        List<UserPeriodStatusVo> voList = collection.stream()
+                .map(any -> BeanUtil.toBean(any, UserPeriodStatusVo.class))
+                .collect(Collectors.toList());
+        if (collection instanceof Page) {
+            Page<UserPeriodStatus> page = (Page<UserPeriodStatus>)collection;
+            Page<UserPeriodStatusVo> pageVo = new Page<>();
+            BeanUtil.copyProperties(page,pageVo);
+            pageVo.addAll(voList);
+            voList = pageVo;
+        }
+        return voList;
+    }
+
+    @Override
+    public Boolean insertByAddBo(UserPeriodStatusAddBo bo) {
+        UserPeriodStatus add = BeanUtil.toBean(bo, UserPeriodStatus.class);
+        validEntityBeforeSave(add);
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
+        return this.save(add);
+    }
+
+    @Override
+    public Boolean updateByEditBo(UserPeriodStatusEditBo bo) {
+        UserPeriodStatus update = BeanUtil.toBean(bo, UserPeriodStatus.class);
+        validEntityBeforeSave(update);
+        update.setUpdateTime(DateUtils.getNowTime());
+        return this.updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(UserPeriodStatus entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return this.removeByIds(ids);
+    }
+}

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodVo.java

@@ -33,9 +33,9 @@ public class ClassPeriodVo {
 	@ApiModelProperty("id")
 	private Long id;
 
-	/** 学员编码 */
+	/** 標題 */
 	@Excel(name = "標題")
-	@ApiModelProperty("学员编码")
+	@ApiModelProperty("標題")
 	private String typeName;
 
 	/** 学员编码 */

+ 47 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodStatusVo.java

@@ -0,0 +1,47 @@
+package com.zhongzheng.modules.grade.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * 【请填写功能名称】视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@ApiModel("【请填写功能名称】视图对象")
+public class UserPeriodStatusVo {
+	private static final long serialVersionUID = 1L;
+
+	/** $pkColumn.columnComment */
+	@ApiModelProperty("$pkColumn.columnComment")
+	private Long id;
+
+	/** 1通过 0作弊 */
+	@Excel(name = "1通过 0作弊")
+	@ApiModelProperty("1通过 0作弊")
+	private Integer status;
+	/** 学习开始时间 */
+	@Excel(name = "学习开始时间")
+	@ApiModelProperty("学习开始时间")
+	private Long recordStartTime;
+	/** 学习结束时间 */
+	@Excel(name = "学习结束时间")
+	@ApiModelProperty("学习结束时间")
+	private Long recordEndTime;
+	/** 学时关联 */
+	@Excel(name = "学时关联")
+	@ApiModelProperty("学时关联")
+	private Long periodId;
+	/** 当前节状态 1 当前状态 0过往状态 */
+	@Excel(name = "当前节状态 1 当前状态 0过往状态")
+	@ApiModelProperty("当前节状态 1 当前状态 0过往状态")
+	private Integer periodStatus;
+}

+ 59 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/UserPeriodVo.java

@@ -0,0 +1,59 @@
+package com.zhongzheng.modules.grade.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * 【请填写功能名称】视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-11-22
+ */
+@Data
+@ApiModel("【请填写功能名称】视图对象")
+public class UserPeriodVo {
+	private static final long serialVersionUID = 1L;
+
+	/** $pkColumn.columnComment */
+	@ApiModelProperty("$pkColumn.columnComment")
+	private Long id;
+
+	/** $column.columnComment */
+	@Excel(name = "${comment}" , readConverterExp = "$column.readConverterExp()")
+	@ApiModelProperty("$column.columnComment")
+	private Long userId;
+	/** 课程ID */
+	@Excel(name = "课程ID")
+	@ApiModelProperty("课程ID")
+	private Long courseId;
+	/** 节ID */
+	@Excel(name = "节ID")
+	@ApiModelProperty("节ID")
+	private Long sectionId;
+	/** 商品Id */
+	@Excel(name = "商品Id")
+	@ApiModelProperty("商品Id")
+	private Long goodsId;
+	/** 1 节类型  2试卷类型 */
+	@Excel(name = "1 节类型  2试卷类型")
+	@ApiModelProperty("1 节类型  2试卷类型")
+	private Integer type;
+	/** 试卷ID */
+	@Excel(name = "试卷ID")
+	@ApiModelProperty("试卷ID")
+	private Long examId;
+	/** 模块ID */
+	@Excel(name = "模块ID")
+	@ApiModelProperty("模块ID")
+	private Long moduleId;
+	/** 章ID */
+	@Excel(name = "章ID")
+	@ApiModelProperty("章ID")
+	private Long chapterId;
+}

+ 706 - 204
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -182,7 +182,8 @@
     </select>
 
 
-    <select id="listUserPeriod"  parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="ClassPeriodStudentVo">
+    <select id="listUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultMap="ClassPeriodStudentVo">
         SELECT
         u.student_code,
         u.user_id,
@@ -192,14 +193,19 @@
         u.id_card,
         cgu.grade_id,
         u.telphone,
-        (SELECT g.class_hours FROM goods g LEFT JOIN class_grade_goods cgg on cgg.goods_id = g.goods_id where cg.grade_id = cgg.grade_id) as class_hours,
+        (SELECT g.class_hours FROM goods g LEFT JOIN class_grade_goods cgg on cgg.goods_id = g.goods_id where
+        cg.grade_id = cgg.grade_id) as class_hours,
         cgu.period_status,
-        (SELECT g.study_start_time FROM goods g LEFT JOIN class_grade_goods cgg on cgg.goods_id = g.goods_id where cg.grade_id = cgg.grade_id) as study_start_time,
-        (SELECT g.study_end_time FROM goods g LEFT JOIN class_grade_goods cgg on cgg.goods_id = g.goods_id where cg.grade_id = cgg.grade_id) as study_end_time,
+        (SELECT g.study_start_time FROM goods g LEFT JOIN class_grade_goods cgg on cgg.goods_id = g.goods_id where
+        cg.grade_id = cgg.grade_id) as study_start_time,
+        (SELECT g.study_end_time FROM goods g LEFT JOIN class_grade_goods cgg on cgg.goods_id = g.goods_id where
+        cg.grade_id = cgg.grade_id) as study_end_time,
         cg.class_start_time,
         cg.class_end_time,
-        (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type = 1 ) as exam_num,
-        (SELECT COUNT(DISTINCT ubr.record_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id = ubr.goods_id where ubr.`status`=1) as record_num
+        (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
+        class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type = 1 ) as exam_num,
+        (SELECT COUNT(DISTINCT ubr.record_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
+        = ubr.goods_id where ubr.`status`=1) as record_num
         FROM
         class_grade_user cgu
         LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
@@ -212,176 +218,452 @@
         order by cgu.update_time
     </select>
 
-    <select id="listPeriod"  parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="ClassPeriodUserVo">
+    <select id="listPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultMap="ClassPeriodUserVo">
         SELECT
-            u.student_code,
-            u.realname,
-            u.id_card,
-            u.user_id,
-            u.telphone,
+        u.student_code,
+        u.realname,
+        u.id_card,
+        u.user_id,
+        u.telphone,
         (SELECT cgg.goods_id FROM class_grade_goods cgg where cg.grade_id=cgg.grade_id) as goods_id,
-            u.one_inch_photos,
-            u.id_card_img1,
-            u.id_card_img2,
-            (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type = 1 ) as exam_num,
-            (SELECT COUNT(DISTINCT ubr.record_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id = ubr.goods_id where ubr.`status`=1) as record_num,
-            (SELECT COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status` =1) as pass,
-            (SELECT COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id) - (SELECT COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status` =1) as cheat
-        FROM
-            class_grade_user cgu
-                LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
-                LEFT JOIN `user` u ON u.user_id = cgu.user_id
+        u.one_inch_photos,
+        u.id_card_img1,
+        u.id_card_img2,
+        (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
+        class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type = 1 ) as exam_num,
+        (SELECT COUNT(DISTINCT ubr.record_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
+        = ubr.goods_id where ubr.`status`=1) as record_num,
+        (SELECT COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
+        ups.`status` =1) as pass,
+        (SELECT COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id) - (SELECT
+        COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
+        =1) as cheat
+        FROM
+        class_grade_user cgu
+        LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
+        LEFT JOIN `user` u ON u.user_id = cgu.user_id
         where 1=1
-          and u.user_id = 2
+        and u.user_id = 2
         <if test="userId != null and userId !='' ">
-            and u.user_id =  #{userId}
+            and u.user_id = #{userId}
         </if>
         <if test="gradeId != null and gradeId !='' ">
             and cgu.grade_id = #{gradeId}
         </if>
     </select>
 
-    <select id="listPeriodAudit"  parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="ClassPeriodVo">
+    <select id="listPeriodAudit" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultMap="ClassPeriodVo">
         SELECT
         cm.menu_id as id,
         cm.course_id,
-                (SELECT u.realname FROM `user` u where 1=1      <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
+        (SELECT u.realname FROM `user` u where 1=1      <if test="userId != null and userId !='' ">
+        and u.user_id = #{userId}
     </if>) as realname,
 
-                (SELECT u.user_id FROM `user` u where 1=1     <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
+        (SELECT u.user_id FROM `user` u where 1=1     <if test="userId != null and userId !='' ">
+        and u.user_id = #{userId}
     </if>) as user_id,
-                (SELECT cm.module_name FROM course_module cm where cm.menu_id = cm.module_id) as type_name,
-                (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs LEFT JOIN course_module_chapter cmc on cmc.chapter_id=ccs.chapter_id where cmc.module_id=cm.menu_id) as class_hours,
-                1 as type,
-                NULL as study_start_time,
-                NULL as study_end_time
-        FROM
-            course_menu cm
-                LEFT JOIN goods_course gc on gc.course_id = cm.course_id
+        (SELECT cm.module_name FROM course_module cm where cm.menu_id = cm.module_id) as type_name,
+        (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs LEFT JOIN course_module_chapter cmc on
+        cmc.chapter_id=ccs.chapter_id where cmc.module_id=cm.menu_id) as class_hours,
+        1 as type,
+        NULL as study_start_time,
+        NULL as study_end_time
+        FROM
+        course_menu cm
+        LEFT JOIN goods_course gc on gc.course_id = cm.course_id
         where 1=1
-          <if test="goodsId != null and goodsId !='' ">
-        and gc.goods_id=#{goodsId}
+        <if test="goodsId != null and goodsId !='' ">
+            and gc.goods_id=#{goodsId}
         </if>
         AND cm.type=1
         UNION
         SELECT
         cm.menu_id as id,
         cm.course_id,
-                (SELECT u.realname FROM `user` u where 1=1  <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
+        (SELECT u.realname FROM `user` u where 1=1  <if test="userId != null and userId !='' ">
+        and u.user_id = #{userId}
     </if>) as realname,
-                (SELECT u.user_id FROM `user` u where 1=1  <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
+        (SELECT u.user_id FROM `user` u where 1=1  <if test="userId != null and userId !='' ">
+        and u.user_id = #{userId}
     </if>) as user_id,
-                (SELECT cc.`name` FROM course_chapter cc where cm.menu_id = cc.chapter_id) as type_name,
-                (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs  where ccs.chapter_id=cm.menu_id) as class_hours,
-                2 as type,
-                (SELECT usr.create_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id = ccs.section_id where ccs.chapter_id = cm.menu_id and usr.goods_id = gc.goods_id ORDER BY usr.create_time ASC limit 1) as study_start_time,
-	(SELECT usr.update_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id = ccs.section_id where ccs.chapter_id = cm.menu_id and usr.goods_id = gc.goods_id ORDER BY usr.create_time DESC limit 1) as study_end_time
-        FROM
-            course_menu cm
-            LEFT JOIN goods_course gc on gc.course_id = cm.course_id
+        (SELECT cc.`name` FROM course_chapter cc where cm.menu_id = cc.chapter_id) as type_name,
+        (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs where ccs.chapter_id=cm.menu_id) as class_hours,
+        2 as type,
+        (SELECT usr.create_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
+        ccs.section_id where ccs.chapter_id = cm.menu_id and usr.goods_id = gc.goods_id ORDER BY usr.create_time ASC
+        limit 1) as study_start_time,
+        (SELECT usr.update_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
+        ccs.section_id where ccs.chapter_id = cm.menu_id and usr.goods_id = gc.goods_id ORDER BY usr.create_time DESC
+        limit 1) as study_end_time
+        FROM
+        course_menu cm
+        LEFT JOIN goods_course gc on gc.course_id = cm.course_id
         where 1=1   <if test="goodsId != null and goodsId !='' ">
         and gc.goods_id=#{goodsId}
     </if>  AND cm.type=2
-        UNION
+    </select>
+
+    <select id="listPeriodAuditSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultMap="ClassPeriodVo">
         SELECT
         cm.menu_id as id,
         cm.course_id,
-                (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
-    </if>) as realname,
-                (SELECT u.user_id FROM `user` u where 1=1  <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
-    </if>) as user_id,
-                (SELECT cs.`name` FROM course_section cs where cm.menu_id = cs.section_id) as type_name,
-                null as class_hours,
-                3 as type,
-                NULL as study_start_time,
-                NULL as study_end_time
-        FROM
-            course_menu cm
-                LEFT JOIN goods_course gc on gc.course_id = cm.course_id
-        where 1=1   <if test="goodsId != null and goodsId !='' ">
-        and gc.goods_id=#{goodsId}
-    </if>  AND cm.type=3
-        UNION
+        (SELECT u.realname FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as realname,
+        (SELECT u.user_id FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as user_id,
+        (SELECT cs.`name` FROM course_section cs where cm.menu_id = cs.section_id) as type_name,
+        null as class_hours,
+        3 as type,
+        (
         SELECT
-        cme.section_id as id,
+        ups.record_start_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+
+        AND up.section_id = cm.menu_id
+
+        ) AS study_start_time,
+        (
+        SELECT
+        ups.record_end_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+
+            AND up.course_id = gc.course_id
+
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        AND up.section_id = cm.menu_id
+        ) AS study_end_time,
+        (
+        SELECT
+        ups.`status`
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        AND up.section_id = cm.menu_id
+        ) AS STATUS,
+        (
+        SELECT
+        ups.create_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        AND up.section_id = cm.menu_id
+        ) AS audit_time,
+        (
+        SELECT
+        COUNT( ups.id )
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        AND up.section_id = cm.menu_id
+        ) AS audit_num
+        FROM
+        course_menu cm
+        LEFT JOIN goods_course gc on gc.course_id = cm.course_id
+        where 1=1
+        <if test="goodsId != null and goodsId !='' ">
+            and gc.goods_id = #{goodsId}
+        </if>
+        AND cm.type=3
+    </select>
+
+    <select id="listPeriodAuditSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultMap="ClassPeriodVo">
+        SELECT
+        cm.menu_id as id,
+        cm.course_id,
+        (SELECT u.realname FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as realname,
+        (SELECT u.user_id FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as user_id,
+        (SELECT cs.`name` FROM course_section cs where cm.menu_id = cs.section_id) as type_name,
+        null as class_hours,
+        3 as type,
+        (
+        SELECT
+        ups.record_start_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+
+        AND up.section_id = cm.menu_id
+
+        ) AS study_start_time,
+        (
+        SELECT
+        ups.record_end_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+
+        AND up.course_id = gc.course_id
+
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        AND up.section_id = cm.menu_id
+        ) AS study_end_time,
+        (
+        SELECT
+        ups.`status`
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        AND up.section_id = cm.menu_id
+        ) AS STATUS,
+        (
+        SELECT
+        ups.create_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        AND up.section_id = cm.menu_id
+        ) AS audit_time,
+        (
+        SELECT
+        COUNT( ups.id )
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        AND up.section_id = cm.menu_id
+        ) AS audit_num
+        FROM
+        course_menu cm
+        LEFT JOIN goods_course gc on gc.course_id = cm.course_id
+        where 1=1
+        <if test="goodsId != null and goodsId !='' ">
+            and gc.goods_id = #{goodsId}
+        </if>
+        AND cm.type=3
+    </select>
+
+    <select id="listPeriodAuditExam"  parameterType="map" resultMap="ClassPeriodChapterVo">
+        SELECT
+        cme.exam_id as id,
         cme.course_id,
-                (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
-    </if>) as realname,
-                (SELECT u.user_id FROM `user` u where 1=1<if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
-    </if>) as user_id,
-                (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
-                null as class_hours,
-                4 as type,
-                NULL as study_start_time,
-                NULL as study_end_time
-        FROM
-            course_menu_exam cme
-                LEFT JOIN goods_course gc on gc.course_id = cme.course_id
-                LEFT JOIN course_menu cm on cme.section_id = cm.menu_id
-        where 1=1   <if test="goodsId != null and goodsId !='' ">
-        and gc.goods_id=#{goodsId}
-    </if>  AND cm.type=3 and cme.chapter_id=0 and cme.module_id=0 and cme.type=1 and cm.type=3
+        (SELECT u.realname FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as realname,
+        (SELECT u.user_id FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as user_id,
+        (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
+        null as class_hours,
+        4 as type,
+        (
+        SELECT
+        ups.record_start_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.section_id =up.section_id
+        AND up.exam_id = cme.exam_id
 
+        ) AS study_start_time,
+        (
+        SELECT
+        ups.record_end_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+
+        AND up.course_id = gc.course_id
+
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        AND up.exam_id = cme.exam_id
+        ) AS study_end_time,
+        (
+        SELECT
+        ups.`status`
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.section_id =up.section_id
+        AND up.exam_id = cme.exam_id
+        ) AS STATUS,
+        (
+        SELECT
+        ups.create_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.section_id =up.section_id
+        AND up.exam_id = cme.exam_id
+        ) AS audit_time,
+        (
+        SELECT
+        COUNT( ups.id )
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = gc.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.section_id =up.section_id
+        AND up.exam_id = cme.exam_id
+        ) AS audit_num
+        FROM
+        course_menu_exam cme
+        LEFT JOIN goods_course gc on gc.course_id = cme.course_id
+        LEFT JOIN course_menu cm on cme.section_id = cm.menu_id
+        where 1=1
+        and gc.goods_id=11
+        AND cm.type=3 and cme.chapter_id=0 and cme.module_id=0 and cme.type=1 and cm.type=3
     </select>
 
-    <select id="listperiodChapter"  parameterType="map" resultMap="ClassPeriodChapterVo">
+    <select id="listperiodChapter" parameterType="map" resultMap="ClassPeriodChapterVo">
         SELECT
-            cc.chapter_id as id,
-            cm.course_id,
-            ( SELECT u.realname FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
+        cc.chapter_id as id,
+        cm.course_id,
+        ( SELECT u.realname FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
+        and u.user_id = #{userId}
     </if> ) AS realname,
-            ( SELECT u.user_id FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
-    </if>)  AS user_id,
-            cc.`name` as type_name,
-            ( SELECT COUNT( ccs.section_id ) FROM course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id ) AS class_hours,
-            2 AS type,
-            (
-                SELECT
-                    usr.create_time
-                FROM
-                    user_study_record usr
-                        LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id
-                WHERE
-                    ccs.chapter_id = cc.chapter_id
+        ( SELECT u.user_id FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
+        and u.user_id = #{userId}
+    </if>) AS user_id,
+        cc.`name` as type_name,
+        ( SELECT COUNT( ccs.section_id ) FROM course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id ) AS
+        class_hours,
+        2 AS type,
+        (
+        SELECT
+        usr.create_time
+        FROM
+        user_study_record usr
+        LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id
+        WHERE
+        ccs.chapter_id = cc.chapter_id
         <if test="goodsId != null and goodsId !='' ">
             AND usr.goods_id=#{goodsId}
         </if>
-                ORDER BY
-                    usr.create_time ASC
-                LIMIT 1
-            ) AS study_start_time,
-	(
-	SELECT
-		usr.update_time
-	FROM
-		user_study_record usr
-		LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id
-	WHERE
-		ccs.chapter_id = cc.chapter_id
+        ORDER BY
+        usr.create_time ASC
+        LIMIT 1
+        ) AS study_start_time,
+        (
+        SELECT
+        usr.update_time
+        FROM
+        user_study_record usr
+        LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id
+        WHERE
+        ccs.chapter_id = cc.chapter_id
         <if test="goodsId != null and goodsId !='' ">
             AND usr.goods_id=#{goodsId}
         </if>
-	ORDER BY
-		usr.create_time DESC
-		LIMIT 1
-	) AS study_end_time,
-	(
-	SELECT
-		ubr.performance
-	FROM
-		user_bank_record ubr
-		LEFT JOIN course_menu_exam cme ON cme.exam_id = ubr.exam_id
-	WHERE 1=1
+        ORDER BY
+        usr.create_time DESC
+        LIMIT 1
+        ) AS study_end_time,
+        (
+        SELECT
+        ubr.performance
+        FROM
+        user_bank_record ubr
+        LEFT JOIN course_menu_exam cme ON cme.exam_id = ubr.exam_id
+        WHERE 1=1
         <if test="goodsId != null and goodsId !='' ">
             AND ubr.goods_id=#{goodsId}
         </if>
@@ -389,128 +671,348 @@
             AND cme.module_id=#{moduleId}
         </if>
         <if test="courseId != null and courseId !='' ">
-            AND  cme.course_id =#{courseId}
+            AND cme.course_id =#{courseId}
         </if>
         AND cme.chapter_id = cmc.chapter_id
         ) AS performance
         FROM
-            course_menu cm
-            LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
-            LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
+        course_menu cm
+        LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
+        LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
         WHERE
-            1 = 1
+        1 = 1
         <if test="moduleId != null and moduleId !='' ">
             AND cmc.module_id=#{moduleId}
         </if>
         <if test="courseId != null and courseId !='' ">
-            AND  cm.course_id =#{courseId}
+            AND cm.course_id =#{courseId}
         </if>
     </select>
 
+    <select id="listperiodExam" parameterType="map" resultMap="ClassPeriodChapterVo">
+        SELECT
+        cme.exam_id as id,
+        cme.course_id,
+        (SELECT u.realname FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as realname,
+        (SELECT u.user_id FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as user_id,
+        (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
+        null as class_hours,
+        4 as type,
+        (
+        SELECT
+        ups.record_start_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = cme.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id = up.module_id
+        AND up.exam_id = cme.exam_id
 
+        ) AS study_start_time,
+        (
+        SELECT
+        ups.record_end_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
 
-    <select id="listPeriodSection"  parameterType="map" resultMap="ClassPeriodSectionVo">
+        AND up.course_id = cme.course_id
+
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id = up.module_id
+        AND up.exam_id = cme.exam_id
+        ) AS study_end_time,
+        (
+        SELECT
+        ups.`status`
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = cme.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id = up.module_id
+        AND up.exam_id = cme.exam_id
+        ) AS STATUS,
+        (
         SELECT
-            cs.section_id AS id,
-            #{courseId} AS course_id,
-            ( SELECT u.realname FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
+        ups.create_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = cme.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id = up.module_id
+        AND up.exam_id = cme.exam_id
+        ) AS audit_time,
+        (
+        SELECT
+        COUNT( ups.id )
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = cme.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id = up.module_id
+        AND up.exam_id = cme.exam_id
+        ) AS audit_num
+        FROM
+        course_menu_exam cme
+        LEFT JOIN exam e ON cme.exam_id = e.exam_id
+        WHERE 1=1
+        <if test="courseId != null and courseId !='' ">
+            AND  cme.course_id=#{courseId}
+        </if>
+        <if test="moduleId != null and moduleId !='' ">
+            AND cme.module_id =#{moduleId}
+        </if>
+    </select>
+
+
+    <select id="listPeriodSection" parameterType="map" resultMap="ClassPeriodSectionVo">
+        SELECT
+        cs.section_id AS id,
+        #{courseId} AS course_id,
+        ( SELECT u.realname FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
+        and u.user_id = #{userId}
     </if>  ) AS realname,
-            ( SELECT u.user_id FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
-        and u.user_id =  #{userId}
+        ( SELECT u.user_id FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
+        and u.user_id = #{userId}
     </if>  ) AS user_id,
-            cs.NAME AS type_name,
-            NULL AS class_hours,
-            3 AS type,
-            (
-                SELECT
-                    ups.record_start_time
-                FROM
-                    user_period_status ups
-                        LEFT JOIN user_period up ON up.id = ups.period_id
-                WHERE
-                    period_status = 1
+        cs.NAME AS type_name,
+        NULL AS class_hours,
+        3 AS type,
+        (
+        SELECT
+        ups.record_start_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
         <if test="courseId != null and courseId !='' ">
-                  AND up.course_id = #{courseId}
+            AND up.course_id = #{courseId}
         </if>
         <if test="goodsId != null and goodsId !='' ">
-                  AND up.goods_id = #{goodsId}
+            AND up.goods_id = #{goodsId}
         </if>
 
-                  AND up.section_id = cs.section_id
+        AND up.section_id = cs.section_id
 
-            ) AS study_start_time,
-            (
-                SELECT
-                    ups.record_end_time
-                FROM
-                    user_period_status ups
-                        LEFT JOIN user_period up ON up.id = ups.period_id
-                WHERE
-                    period_status = 1
+        ) AS study_start_time,
+        (
+        SELECT
+        ups.record_end_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
         <if test="courseId != null and courseId !='' ">
             AND up.course_id = #{courseId}
         </if>
         <if test="goodsId != null and goodsId !='' ">
             AND up.goods_id = #{goodsId}
         </if>
-                  AND up.section_id = cs.section_id
-            ) AS study_end_time,
-            (
-                SELECT
-                    ups.`status`
-                FROM
-                    user_period_status ups
-                        LEFT JOIN user_period up ON up.id = ups.period_id
-                WHERE
-                    period_status = 1
+        AND up.section_id = cs.section_id
+        ) AS study_end_time,
+        (
+        SELECT
+        ups.`status`
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
         <if test="courseId != null and courseId !='' ">
             AND up.course_id = #{courseId}
         </if>
         <if test="goodsId != null and goodsId !='' ">
             AND up.goods_id = #{goodsId}
         </if>
-                  AND up.section_id = cs.section_id
-            ) AS STATUS,
-            (
-                SELECT
-                    ups.create_time
-                FROM
-                    user_period_status ups
-                        LEFT JOIN user_period up ON up.id = ups.period_id
-                WHERE
-                    period_status = 1
+        AND up.section_id = cs.section_id
+        ) AS STATUS,
+        (
+        SELECT
+        ups.create_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
         <if test="courseId != null and courseId !='' ">
             AND up.course_id = #{courseId}
         </if>
         <if test="goodsId != null and goodsId !='' ">
             AND up.goods_id = #{goodsId}
         </if>
-                  AND up.section_id = cs.section_id
-            ) AS audit_time,
-            (
-                SELECT
-                    COUNT( ups.id )
-                FROM
-                    user_period_status ups
-                        LEFT JOIN user_period up ON up.id = ups.period_id
-                WHERE
-                    period_status = 1
+        AND up.section_id = cs.section_id
+        ) AS audit_time,
+        (
+        SELECT
+        COUNT( ups.id )
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
         <if test="courseId != null and courseId !='' ">
             AND up.course_id = #{courseId}
         </if>
         <if test="goodsId != null and goodsId !='' ">
             AND up.goods_id = #{goodsId}
         </if>
-                  AND up.section_id = cs.section_id
-            ) AS audit_num
+        AND up.section_id = cs.section_id
+        ) AS audit_num
+        FROM
+        course_chapter_section ccs
+        LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
+        WHERE
+        1 = 1
+        <if test="chapterId != null and chapterId !='' ">
+            AND ccs.chapter_id = #{chapterId}
+        </if>
+    </select>
+
+
+    <select id="listPeriodSectionExam" parameterType="map" resultMap="ClassPeriodSectionVo">
+        SELECT
+        cme.exam_id as id,
+        cme.course_id,
+        (SELECT u.realname FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as realname,
+        (SELECT u.user_id FROM `user` u where 1=1
+        <if test="userId != null and userId !='' ">
+            and u.user_id = #{userId}
+        </if>
+        ) as user_id,
+        (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
+        null as class_hours,
+        4 as type,
+        (
+        SELECT
+        ups.record_start_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = cme.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id =0
+        and cme.chapter_id = up.chapter_id
+        AND up.exam_id = cme.exam_id
+
+        ) AS study_start_time,
+        (
+        SELECT
+        ups.record_end_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+
+        AND up.course_id = cme.course_id
+
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id =0
+        and cme.chapter_id = up.chapter_id
+        AND up.exam_id = cme.exam_id
+        ) AS study_end_time,
+        (
+        SELECT
+        ups.`status`
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = cme.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id =0
+        and cme.chapter_id = up.chapter_id
+        AND up.exam_id = cme.exam_id
+        ) AS STATUS,
+        (
+        SELECT
+        ups.create_time
         FROM
-            course_chapter_section ccs
-                LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
         WHERE
-            1 = 1
+        period_status = 1
+        AND up.course_id = cme.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id =0
+        and cme.chapter_id = up.chapter_id
+        AND up.exam_id = cme.exam_id
+        ) AS audit_time,
+        (
+        SELECT
+        COUNT( ups.id )
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        period_status = 1
+        AND up.course_id = cme.course_id
+        <if test="goodsId != null and goodsId !='' ">
+            AND up.goods_id = #{goodsId}
+        </if>
+        and cme.module_id =0
+        and cme.chapter_id = up.chapter_id
+        AND up.exam_id = cme.exam_id
+        ) AS audit_num
+        FROM
+        course_menu_exam cme
+        LEFT JOIN exam e ON cme.exam_id = e.exam_id
+        WHERE 1=1
+        and cme.module_id =0
+        <if test="courseId != null and courseId !='' ">
+            AND  cme.course_id=#{courseId}
+        </if>
         <if test="chapterId != null and chapterId !='' ">
-          AND ccs.chapter_id = #{chapterId}
+            AND cme.chapter_id = #{chapterId}
         </if>
     </select>
 

+ 22 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/UserPeriodMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zhongzheng.modules.grade.mapper.UserPeriodMapper">
+
+    <resultMap type="com.zhongzheng.modules.grade.domain.UserPeriod" id="UserPeriodResult">
+        <result property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="courseId" column="course_id"/>
+        <result property="sectionId" column="section_id"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="type" column="type"/>
+        <result property="examId" column="exam_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="moduleId" column="module_id"/>
+        <result property="chapterId" column="chapter_id"/>
+    </resultMap>
+
+
+</mapper>

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

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zhongzheng.modules.grade.mapper.UserPeriodStatusMapper">
+
+    <resultMap type="com.zhongzheng.modules.grade.domain.UserPeriodStatus" id="UserPeriodStatusResult">
+        <result property="status" column="status"/>
+        <result property="recordStartTime" column="record_start_time"/>
+        <result property="recordEndTime" column="record_end_time"/>
+        <result property="id" column="id"/>
+        <result property="periodId" column="period_id"/>
+        <result property="periodStatus" column="period_status"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+
+</mapper>