he2802 1 жил өмнө
parent
commit
5741406d84

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

@@ -205,6 +205,22 @@ public class ClassGradeController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询所有班级用户列表
+     */
+    @ApiOperation("查询所有班级用户列表")
+    @PreAuthorize("@ss.hasPermi('grade:grade:list')")
+    @GetMapping("/listGradeAll")
+    public TableDataInfo<ClassGradeStudentVo> listGradeAll(ClassGradeUserQueryBo bo) {
+        ClassGrade gradeGrade = iClassGradeService.getById(bo.getGradeId());
+        if (StringUtils.isNotBlank(gradeGrade.getSevenCode())){
+            bo.setSevenCode(gradeGrade.getSevenCode());
+        }
+        startPage();
+        List<ClassGradeStudentVo> list = iClassGradeService.listGradeAll(bo);
+        return getDataTable(list);
+    }
+
     /**
      * 导出班级学员列表
      */

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

@@ -29,6 +29,8 @@ public interface ClassGradeMapper extends BaseMapper<ClassGrade> {
 //    @InterceptorIgnore(tenantLine = "true")
     List<ClassGradeStudentVo> listGrade(ClassGradeUserQueryBo bo);
 
+    List<ClassGradeStudentVo> listGradeAll(ClassGradeUserQueryBo bo);
+
     List<ClassGradeUserListVo> listGradeInform(ClassGradeQueryBo bo);
 
     List<ClassGradeStudentVo> listGradeStudy(ClassGradeQueryBo bo);

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

@@ -56,6 +56,8 @@ public interface IClassGradeService extends IService<ClassGrade> {
 
     List<ClassGradeStudentVo> listGrade(ClassGradeUserQueryBo bo);
 
+	List<ClassGradeStudentVo> listGradeAll(ClassGradeUserQueryBo bo);
+
     boolean editUserGrade(ClassGradeUserAddQueryBo bo);
 
 	List<ClassGradeUserListVo> listGradeInform(ClassGradeQueryBo bo);

+ 67 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -36,6 +36,7 @@ import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.*;
 import com.zhongzheng.modules.grade.domain.*;
 import com.zhongzheng.modules.grade.mapper.ClassGradeMapper;
+import com.zhongzheng.modules.grade.mapper.ClassGradeUserMapper;
 import com.zhongzheng.modules.grade.service.*;
 import com.zhongzheng.modules.grade.vo.*;
 import com.zhongzheng.modules.inform.bo.InformUserAddBo;
@@ -163,6 +164,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     @Autowired
     private IOrderGoodsService iOrderGoodsService;
 
+    @Autowired
+    private ClassGradeUserMapper classGradeUserMapper;
+
     @Autowired
     private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
 
@@ -936,6 +940,69 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         return classGradeStudentVos;
     }
 
+    @Override
+    public List<ClassGradeStudentVo> listGradeAll(ClassGradeUserQueryBo bo) {
+        //身份证去重
+        if (Validator.isNotEmpty(bo.getIdCard()) && Validator.isNotEmpty(bo.getIdCards())) {
+            String idCard = bo.getIdCard();
+            List<String> idCards = bo.getIdCards();
+            Set<String> set = new HashSet<>();
+            for (String id : idCards) {
+                set.add(id);
+            }
+            set.add(idCard);
+            if (Validator.isNotEmpty(set)) {
+                bo.setIdCards(new ArrayList<>(set));
+            }
+            bo.setIdCard(null);
+        }
+        //查找班级学员
+        List<ClassGradeStudentVo> classGradeStudentVos = baseMapper.listGradeAll(bo);
+        //得到每个学员的课程学习记录
+        for (ClassGradeStudentVo classGradeStudentVo : classGradeStudentVos) {
+            Long secLong = 0L;
+            Long studyLong = 0L;
+
+            SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
+            subjectStudyRecordQueryBo.setGoodsId(classGradeStudentVo.getGoodsId());
+            subjectStudyRecordQueryBo.setUserId(classGradeStudentVo.getUserId());
+            subjectStudyRecordQueryBo.setGradeId(bo.getGradeId());
+            subjectStudyRecordQueryBo.setOrderGoodsId(classGradeStudentVo.getOrderGoodsId());
+            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();
+
+            }
+
+            List<Long> timeList = classGradeUserMapper.selectStart(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(),classGradeStudentVo.getOrderGoodsId());
+            if (!org.springframework.util.CollectionUtils.isEmpty(timeList)) {
+                //查找开始学习时间
+                classGradeStudentVo.setStartTime(timeList.get(0));
+            }else{
+                classGradeStudentVo.setStartTime(classGradeUserMapper.selectStartNoPhoto(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(),classGradeStudentVo.getOrderGoodsId())
+                );
+            }
+            //BigDecimal divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()),2,BigDecimal.ROUND_HALF_UP);
+            //classGradeStudentVo.setStudyNum(divide.multiply(new BigDecimal("100")).longValue());
+            classGradeStudentVo.setSecAllNum(secLong);
+            classGradeStudentVo.setStuAllNum(studyLong);
+            /*UserUpdateQueryBo userUpdateQueryBo = new UserUpdateQueryBo();
+            userUpdateQueryBo.setUserId(classGradeStudentVo.getUserId());
+            classGradeStudentVo.setUserUpdates(iUserUpdateService.queryList(userUpdateQueryBo));*/
+            /*if (Validator.isNotEmpty(classGradeStudentVo.getRebuyOrderGoodsId()) && classGradeStudentVo.getRebuyOrderGoodsId().longValue() > 0) {
+                classGradeStudentVo.setRebuy(orderMapper.getGradePeriod(classGradeStudentVo.getRebuyOrderGoodsId(), classGradeStudentVo.getUserId()));
+            }*/
+            if (ObjectUtils.isNotNull(classGradeStudentVo.getOrgId())){
+                SysTenant tenant = iSysTenantService.getById(classGradeStudentVo.getOrgId());
+                if (ObjectUtils.isNotNull(tenant)){
+                    classGradeStudentVo.setTenantName(tenant.getTenantName());
+                }
+            }
+        }
+        return classGradeStudentVos;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean editUserGrade(ClassGradeUserAddQueryBo bo) {

+ 12 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassGradeStudentVo.java

@@ -242,6 +242,17 @@ public class ClassGradeStudentVo {
 	@ApiModelProperty("所属机构")
 	private String tenantName;
 
-
+	@Excel(name = "工作单位")
+	private String companyName;
+
+	@ApiModelProperty("班级名称")
+	private String gradeName;
+
+	/** 学习有效期开始 */
+	@ApiModelProperty("学习开始")
+	private Long startTime;
+	/** 学习有效期结束 */
+	@ApiModelProperty("学习结束")
+	private Long endTime;
 
 }

+ 168 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml

@@ -182,6 +182,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="expendBefore" column="expend_before"/>
         <result property="periodPlushMsg" column="official_status_msg"/>
         <result property="officialStatusMsg" column="period_plush_msg"/>
+        <result property="companyName" column="company_name"/>
+        <result property="gradeName" column="class_name"/>
+        <result property="endTime" column="end_time"/>
     </resultMap>
 
 
@@ -562,6 +565,171 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by user_info_status desc ,user_status desc ,cgu.id desc
     </select>
 
+    <select id="listGradeAll"  parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="ClassGradeStudentVo">
+        SELECT
+        cgu.id,
+        cgu.official_status_time,
+        cgu.official_status_num,
+        u.user_account,
+        u.user_id,
+        u.company_name,
+        cgu.`status`,
+        u.realname,
+        og.goods_id,
+        u.id_card,
+        cgu.grade_id,
+        u.telphone,
+        g.class_hours,
+        cgu.period_status,
+        cgu.finish_status,
+        cgu.period_plush,
+        g.study_start_time,
+        g.study_end_time,
+        cg.class_start_time,
+        cg.class_end_time,
+        cg.interface_push_id,
+        cgu.official_status,
+        cgu.official_status_msg,
+        cgu.period_plush_msg,
+        cgu.learn_status,
+        cgu.period_wait_time as end_time,
+        (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id   where c.goods_id=og.goods_id and m.type  in (1,3) ) as exam_num,
+        (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.user_id = u.user_id and ubr.grade_id = cgu.grade_id and ubr.order_goods_id = cgu.order_goods_id and ubr.report_status=1 and ubr.current_status = 1) as record_num,
+        (og.study_count) as study_count,
+        og.order_goods_id,
+        og.rebuy_order_goods_id,
+        og.service_start_time,
+        og.service_end_time,
+        g.goods_name,
+        og.order_sn,
+        og.seven_year,
+        m.category_name,
+        g.major_id,
+        u.province,
+        cg.class_name,
+        cgu.reason,
+        cgu.tenant_id as org_id,
+        cb.business_name,
+        cpt.project_name,
+        (SELECT IFNULL(SUM(usr.study_duration),0) from user_study_record usr where usr.user_id = cgu.user_id and usr.grade_id = cgu.grade_id) as user_study_duration,
+        (SELECT count(*) from class_grade_user cgu where cgu.order_goods_id = og.order_goods_id) as use_study_count,
+        ueg.exam_number,
+        ueg.do_number,
+        ueg.expend_number,
+        ueg.expend_before
+        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
+        LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
+        LEFT JOIN goods g on og.goods_id = g.goods_id
+        LEFT JOIN major m ON g.major_id = m.id
+        LEFT JOIN course_business cb ON g.business_id = cb.id
+        LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+        LEFT JOIN user_exam_goods ueg ON ueg.order_goods_id = og.order_goods_id
+        where 1=1 and cgu.`status` = 1
+        <if test="sevenCode != null and sevenCode !='' ">
+            AND cg.seven_code = #{sevenCode}
+        </if>
+        <if test="gradeId != null and gradeId !='' and (sevenCode == null or sevenCode =='')">
+            and cgu.grade_id = #{gradeId}
+        </if>
+        <if test="choice != null and choice == 1 ">
+            and (SELECT COUNT(cge.grade_id) FROM class_grade cge LEFT JOIN class_grade_user cgur on cge.grade_id = cgur.grade_id where cgu.user_id =cgur.user_id and  cgur.order_goods_id = cgu.order_goods_id AND (unix_timestamp(now()) &lt; cge.class_end_time or cge.class_start_time is null) and cge.`status`=1 and cgur.`status` =1)= 0 and cgu.period_status=0
+            AND (SELECT COUNT(cgde.grade_id) FROM class_grade cgde where cgde.grade_id = cg.grade_id and (unix_timestamp(now()) &lt; cgde.class_end_time or cgde.class_start_time is null)) =0
+        </if>
+        <if test="choice != null and choice == 2 ">
+            and (SELECT COUNT(cge.grade_id) FROM class_grade cge LEFT JOIN class_grade_user cgur on cge.grade_id = cgur.grade_id where cgu.user_id =cgur.user_id and  cgur.order_goods_id = cgu.order_goods_id  AND (unix_timestamp(now()) &lt; cge.class_end_time or cge.class_start_time is null)
+            and cge.`status`=1 and cgur.`status` =1)> 0
+            AND (SELECT COUNT(cgde.grade_id) FROM class_grade cgde where cgde.grade_id = cg.grade_id and (unix_timestamp(now()) &lt; cgde.class_end_time or cgde.class_start_time is null)) =0
+        </if>
+        <if test="studyCountMore != null and studyCountMore == 2 ">
+            AND og.study_count > 0 AND cgu.change_grade = 0
+        </if>
+        <if test="studyCountMore != null and studyCountMore == 1 ">
+            AND og.study_count > 0 AND cgu.change_grade = 1
+        </if>
+        <if test="studyCountMore != null and studyCountMore == 0 ">
+            AND og.study_count = 0
+        </if>
+        <if test="officialStatus != null and officialStatus == 1 ">
+            AND cgu.official_status = 1
+        </if>
+        <if test="officialStatus != null and officialStatus == 0 ">
+            AND (cgu.official_status is NULL or cgu.official_status=0)
+        </if>
+        <if test="realname != null and realname != ''">
+            AND u.realname like concat('%', #{realname}, '%')
+        </if>
+        <if test="telphone != null and telphone != ''">
+            AND (u.telphone like concat('%', #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
+        </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 like concat('%', #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
+        </if>
+        <if test="idCards != null and idCards.size() != 0">
+            AND u.id_card IN
+            <foreach collection="idCards" item="item" index="index" open="(" close=")" separator=",">
+                #{item,typeHandler=com.zhongzheng.common.type.EncryptHandler}
+            </foreach>
+        </if>
+        <if test="orderSn != null and orderSn != ''">
+            AND og.order_sn = #{orderSn}
+        </if>
+        <if test="goodsName != null and goodsName != ''">
+            AND g.goods_name like concat('%', #{goodsName}, '%')
+        </if>
+        <if test="searchStartTime != null and searchStartTime != ''">
+            AND cgu.create_time &gt; #{searchStartTime}
+        </if>
+        <if test="searchEndTime != null and searchEndTime != ''">
+            AND cgu.create_time &lt; #{searchEndTime}
+        </if>
+        <if test="finishStatus != null">
+            AND cgu.finish_status = #{finishStatus}
+        </if>
+        <if test="learnStatus != null">
+            AND cgu.learn_status = #{learnStatus}
+        </if>
+        <if test="projectId != null and projectId != ''">
+            AND g.project_id = #{projectId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND g.education_type_id = #{educationTypeId}
+        </if>
+        <if test="majorId != null and majorId != ''">
+            AND m.id = #{majorId}
+        </if>
+        <if test="hasInterface != null and hasInterface == 0">
+            AND cg.interface_account_id is null AND cg.no_interface_account_id is null
+        </if>
+        <if test="hasInterface != null and hasInterface == 1">
+            AND cg.interface_account_id is not null
+        </if>
+        <if test="hasInterface != null and hasInterface == 2">
+            AND cg.no_interface_account_id is not null
+        </if>
+        <if test="hasBindWx != null and hasBindWx == 1 ">
+            AND u.union_id is not null
+        </if>
+        <if test="hasBindWx != null and hasBindWx == 0 ">
+            AND u.union_id is null
+        </if>
+        <if test="hasFollowWx != null and hasFollowWx == 1 ">
+            AND uwf.gzh_open_id is not null
+        </if>
+        <if test="hasFollowWx != null and hasFollowWx == 0 ">
+            AND uwf.gzh_open_id is null
+        </if>
+        order by user_info_status desc ,user_status desc ,cgu.id desc
+    </select>
+
     <select id="listGradeInform" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeQueryBo" resultMap="ClassGradeUserListVo">
         SELECT
         g.*,