he2802 hai 1 ano
pai
achega
6da89cf5b0

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

@@ -28,6 +28,8 @@ import com.zhongzheng.modules.grade.bo.*;
 import com.zhongzheng.modules.grade.domain.ClassGrade;
 import com.zhongzheng.modules.grade.service.*;
 import com.zhongzheng.modules.grade.vo.*;
+import com.zhongzheng.modules.order.bo.OrderQueryBo;
+import com.zhongzheng.modules.order.vo.OrderListExportVo;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import io.swagger.models.auth.In;
 import lombok.RequiredArgsConstructor;
@@ -255,6 +257,14 @@ public class ClassGradeController extends BaseController {
         return getDataTable(list);
     }
 
+    @ApiOperation("导出学员学时学习记录列表")
+    @GetMapping("/exportListUserPeriodRecord")
+    public AjaxResult<ClassPeriodStudentExportProcessVo> exportListUserPeriodRecord(ClassGradeUserQueryBo bo) {
+        List<ClassPeriodStudentExportProcessVo> list = iClassGradeUserService.exportListUserPeriodRecord(bo);
+        ExcelUtil<ClassPeriodStudentExportProcessVo> util = new ExcelUtil<>(ClassPeriodStudentExportProcessVo.class);
+        return util.exportExcel(list,"学员学时学习记录列表");
+    }
+
     /**
      * 班级管理列表
      */

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

@@ -34,6 +34,8 @@ public interface ClassGradeUserMapper extends BaseMapper<ClassGradeUser> {
 
     List<ClassPeriodStudentVo> listUserPeriod(ClassGradeUserQueryBo bo);
 
+    List<ClassPeriodStudentVo> exportUserPeriod(ClassGradeUserQueryBo bo);
+
     List<ClassPeriodStudentVo> listUserWeekPeriod(ClassGradeUserQueryBo bo);
 
     Long listUserWeekStudyTime(ClassGradeUserQueryBo bo);

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

@@ -95,6 +95,8 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 
 	List<ClassPeriodStudentVo> listUserPeriodRecord(ClassGradeUserQueryBo bo);
 
+	List<ClassPeriodStudentExportProcessVo> exportListUserPeriodRecord(ClassGradeUserQueryBo bo);
+
 	List<ClassPeriodStudentVo> listUserPeriodWeekRecord(ClassGradeUserQueryBo bo);
 
 	List<ClassPeriodStudentVo> listUserVideoRecord(ClassGradeUserQueryBo bo);

+ 40 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -181,6 +181,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private IUserExamRecordService iUserExamRecordService;
 
+    @Autowired
+    private IMajorService iMajorService;
+
     @Value("${aliyun.oss.endpoint}")
     private String ALIYUN_OSS_ENDPOINT;
 
@@ -217,8 +220,6 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private ISysOldOrgService sysOldOrgService;
 
-    @Autowired
-    private IMajorService iMajorService;
 
     @Autowired
     private IGoodsAttachedService iGoodsAttachedService;
@@ -2168,6 +2169,43 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return classPeriodStudentVos;
     }
 
+    @Override
+    public List<ClassPeriodStudentExportProcessVo> exportListUserPeriodRecord(ClassGradeUserQueryBo bo) {
+        //查询班级学员信息
+        List<ClassPeriodStudentVo> classPeriodStudentVos = baseMapper.exportUserPeriod(bo);
+        List<ClassPeriodStudentExportProcessVo> exlist = new ArrayList<>();
+        //查找学员学习记录
+        for (ClassPeriodStudentVo classPeriodStudentVo : classPeriodStudentVos) {
+            Long secLong = 0L;
+            Long studyLong = 0L;
+            SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
+            subjectStudyRecordQueryBo.setGoodsId(classPeriodStudentVo.getGoodsId());
+            subjectStudyRecordQueryBo.setUserId(classPeriodStudentVo.getUserId());
+            subjectStudyRecordQueryBo.setGradeId(classPeriodStudentVo.getGradeId());
+            List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
+            for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
+                secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
+                studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
+
+            }
+            //总节数
+            classPeriodStudentVo.setSecAllNum(secLong);
+            //学习节数
+            classPeriodStudentVo.setStuAllNum(studyLong);
+
+            ClassPeriodStudentExportProcessVo vo = BeanUtil.toBean(classPeriodStudentVo,ClassPeriodStudentExportProcessVo.class);
+            String process = (studyLong+classPeriodStudentVo.getRecordNum())+"/"+(secLong+classPeriodStudentVo.getExamNum());
+            vo.setProcess(process);
+
+            Major major = iMajorService.getById(classPeriodStudentVo.getMajorId());
+            if (ObjectUtils.isNotNull(major)){
+                vo.setCategoryName(major.getCategoryName());
+            }
+            exlist.add(vo);
+        }
+        return exlist;
+    }
+
     @Override
     public List<ClassPeriodStudentVo> listUserPeriodWeekRecord(ClassGradeUserQueryBo bo) {
         //查询班级学员信息

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

@@ -0,0 +1,92 @@
+package com.zhongzheng.modules.grade.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+
+/**
+ * 学员记录视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-11-10
+ */
+@Data
+@ApiModel("学员学时视图对象")
+public class ClassPeriodStudentExportProcessVo {
+	private static final long serialVersionUID = 1L;
+
+
+	/** 学员编码 */
+	@Excel(name = "学员姓名")
+	@ApiModelProperty("学员姓名")
+	private String realName;
+
+
+	/** 学员编码 */
+	@Excel(name = "学员身份证")
+	@ApiModelProperty("学员身份证")
+	private String idCard;
+
+	/** 学员编码 */
+	@Excel(name = "学员电话")
+	@ApiModelProperty("学员电话")
+	private String telPhone;
+
+
+	@Excel(name = "单号")
+	@ApiModelProperty("单号")
+	private String orderSn;
+
+
+	@Excel(name = "学习进度")
+	@ApiModelProperty("学习进度")
+	private String process;
+
+	/** 学习进度 */
+	@ApiModelProperty("已学节数")
+	private Long stuAllNum;
+
+
+	/** 学习进度 */
+	@ApiModelProperty("总节数")
+	private Long secAllNum;
+
+
+	/** 节数 */
+	@ApiModelProperty("试卷数")
+	private Long examNum;
+
+
+	/** 已做试卷 */
+	@ApiModelProperty("已做试卷")
+	private Long recordNum;
+
+
+	@ApiModelProperty("商品名称")
+	private String goodsName;
+
+	/** 业务名称 */
+	@ApiModelProperty("业务名称")
+	private String businessName;
+
+	/** 项目名称 */
+	@ApiModelProperty("项目名称")
+	private String projectName;
+
+
+	/** 项目名称 */
+	@ApiModelProperty("教育名")
+	private String educationName;
+
+	@Excel(name = "专业名")
+	@ApiModelProperty("专业名")
+	private String categoryName;
+
+
+
+}

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

@@ -264,4 +264,9 @@ public class ClassPeriodStudentVo {
 	@ApiModelProperty("商品年份")
 	private String goodsYear;
 
+	@ApiModelProperty("订单号")
+	private String orderSn;
+
+	private Long majorId;
+
 }

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

@@ -147,6 +147,8 @@
         <result property="goodsYear" column="goods_year"/>
         <result property="createTime" column="create_time"/>
         <result property="profileStatus" column="profile_status"/>
+        <result property="orderSn" column="order_sn"/>
+        <result property="majorId" column="major_id"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodUserVo" id="ClassPeriodUserVo">
@@ -449,6 +451,8 @@
         cgu.period_status_num,
         cgu.period_time,
         cgu.order_goods_id,
+        og.order_sn,
+        g.major_id,
         /*    IFNULL(ge.exam_num,0) as exam_num, */
         <if test="userPhoto != null and userPhoto == 1">
             up.key_value,
@@ -572,6 +576,159 @@
         </if>
     </select>
 
+    <select id="exportUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultMap="ClassPeriodStudentVo">
+        SELECT
+        u.user_account,
+        u.user_id,
+        cgu.`status`,
+        u.realname,
+        og.goods_id,
+        u.id_card,
+        cgu.grade_id,
+        u.telphone,
+        u.one_inch_photos,
+        u.company_name,
+        up.`status` as profile_status,
+        g.class_hours as class_hours,
+        g.study_start_time as study_start_time,
+        g.study_end_time as study_end_time,
+        g.goods_name,
+        g.code as goods_code,
+        g.stand_price,
+        cgu.period_status,
+        cg.class_start_time,
+        cg.class_end_time,
+        cg.class_name,
+        cgu.period_plush,
+        cgu.period_status_num,
+        cgu.period_time,
+        cgu.order_goods_id,
+        og.order_sn,
+        g.major_id,
+        IFNULL(ge.exam_num,0) as exam_num,
+        <if test="userPhoto != null and userPhoto == 1">
+            up.key_value,
+        </if>
+        cgu.period_wait_time as end_time,
+        (SELECT og.seven_year FROM order_goods og  where og.order_goods_id = cgu.order_goods_id ) as seven_year,
+        (SELECT og.service_start_time FROM order_goods og  where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
+        (SELECT og.service_end_time FROM order_goods og  where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
+        (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr  where ubr.`status`=1 and ubr.`type` in (1,3) and ubr.report_status=1 and ubr.order_goods_id = cgu.order_goods_id and ubr.grade_id = cgu.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num
+        <if test="userPhoto == null">
+            /* ,(select COUNT(up.id) from user_period up LEFT JOIN user_period_status ups on up.id=ups.period_id where up.goods_id = og.goods_id and up.grade_id = cgu.grade_id and up.order_goods_id = cgu.order_goods_id and up.user_id = u.user_id
+            and ups.period_status=0 and ups.`status`=0 and (SELECT COUNT(upss.id) from user_period_status upss where upss.id = ups.id and upss.period_status = 1 and upss.`status` = 2) > 0 ) as rebuild_num */
+        </if>
+        FROM
+        class_grade_user cgu
+        LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
+        LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
+        LEFT JOIN `user` u ON u.user_id = cgu.user_id
+        LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = og.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
+        LEFT JOIN goods g on og.goods_id = g.goods_id
+        LEFT JOIN course_business cb ON g.business_id = cb.id
+       LEFT JOIN (SELECT
+        COUNT( m.id ) AS exam_num,
+        c.goods_id
+        FROM
+        course_menu_exam m
+        LEFT JOIN goods_course c ON m.course_id = c.course_id
+        where
+        m.type in (1,3)
+        GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
+        where 1=1
+        and cgu.`status` =1
+        and cb.`period_check_sign` = 1
+        <if test="periodPlush != null and periodPlush != ''">
+            AND cgu.period_plush = #{periodPlush}
+        </if>
+        <if test="officialStatus != null and officialStatus != ''">
+            AND cgu.official_status = #{officialStatus}
+        </if>
+        <if test="changeGrade != null and changeGrade != ''">
+            AND cgu.change_grade = #{changeGrade}
+        </if>
+        <if test="profileStatus != null and profileStatus != ''">
+            AND up.status = #{profileStatus}
+        </if>
+        <if test="gradeId != null and gradeId !='' ">
+            and cgu.grade_id = #{gradeId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        <if test="projectId != null and projectId != ''">
+            AND g.project_id = #{projectId}
+        </if>
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND g.education_type_id = #{educationTypeId}
+        </if>
+        <if test="schoolId != null and schoolId != ''">
+            AND g.school_id = #{schoolId}
+        </if>
+        <if test="majorId != null and majorId != ''">
+            AND g.major_id = #{majorId}
+        </if>
+        <if test="periodStatus != null ">
+            and cgu.period_status = #{periodStatus}
+        </if>
+        <if test="classStartTime != null and classStartTime != '' ">
+            AND cg.class_start_time >= #{classStartTime}
+        </if>
+        <if test="classEndTime != null and classEndTime != '' ">
+            AND #{classEndTime} >=  cg.class_end_time
+        </if>
+        <if test="studyStatus != null and studyStatus == 1 ">
+            and cgu.period_status = -1
+        </if>
+        <if test="studyStatus != null and studyStatus == 2 ">
+            and cgu.period_status != -1
+        </if>
+        <if test="className != null and className !='' ">
+            and  cg.class_name like concat('%', #{className}, '%')
+        </if>
+        <if test="searchKey != null and searchKey != '' ">
+            and (u.realname like concat('%', #{searchKey}, '%')
+            or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
+            or g.goods_name like concat('%', #{searchKey}, '%')
+            or cg.class_name like concat('%', #{searchKey}, '%')
+            or u.company_name like concat('%', #{searchKey}, '%'))
+        </if>
+        <if test="inputOrderSn != null and inputOrderSn != '' ">
+            and (select count(*) from `order` o where o.order_sn =og.order_sn and o.input_order_sn =  #{inputOrderSn})>0
+        </if>
+        <if test="companyName != null and companyName != '' ">
+            and u.company_name like concat('%', #{companyName}, '%')
+        </if>
+        <if test="idCard != null and idCard !='' ">
+            AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
+        </if>
+        <if test="telphone != null and telphone !='' ">
+            AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
+        </if>
+        <if test="searchStartTime != null and searchStartTime !='' ">
+            AND cgu.create_time >=#{searchStartTime}
+        </if>
+        <if test="searchEndTime != null and searchEndTime !='' ">
+            AND #{searchEndTime} >= cgu.create_time
+        </if>
+        <if test="periodStartTime != null and periodStartTime !='' ">
+            AND cgu.period_time >=#{periodStartTime}
+        </if>
+        <if test="periodEndTime != null and periodEndTime !='' ">
+            AND #{periodEndTime} >= cgu.period_time
+        </if>
+        <if test="periodStatus != 2 and periodStatus != 3">
+            order by cgu.update_time desc
+        </if>
+        <if test="periodStatus == 2 ">
+            order by cgu.period_wait_time,cgu.create_time
+        </if>
+        <if test="periodStatus == 3 ">
+            order by cgu.period_ing_time,cgu.create_time
+        </if>
+    </select>
+
     <select id="listUserWeekStudyTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
             resultType="Long">
         SELECT