he2802 1 gadu atpakaļ
vecāks
revīzija
66cf827ec2

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

@@ -266,6 +266,17 @@ public class ClassGradeController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询学时学员记录列表(新)
+     */
+    @ApiOperation("查询学员学时列表(新)")
+    @GetMapping("/listUserPeriod/new")
+    public TableDataInfo<ClassPeriodStudentNewVo> listUserPeriodNew(ClassGradeUserQueryBo bo) {
+        startPage();
+        List<ClassPeriodStudentNewVo> list = iClassGradeUserService.listUserPeriodNew(bo);
+        return getDataTable(list);
+    }
+
     /**
      * 查询学时学员记录列表
      */
@@ -316,6 +327,14 @@ public class ClassGradeController extends BaseController {
         return getDataTable(list);
     }
 
+    @ApiOperation("查询学员视频学习记录列表")
+    @GetMapping("/listUserVideoRecord/new")
+    public TableDataInfo<ClassPeriodStudentVo> listUserVideoRecordNew(ClassGradeUserQueryBo bo) {
+        startPage();
+        List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserVideoRecordNew(bo);
+        return getDataTable(list);
+    }
+
     /**
      * 查询学时学员记录列表
      */

+ 2 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/SecurityConfig.java

@@ -161,8 +161,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/grade/grade/listPeriod").anonymous()
                 .antMatchers("/course/business/queryFullId").anonymous()
                 .antMatchers("/grade/grade/listUserPeriod").anonymous()
+                .antMatchers("/grade/grade/listUserPeriod/new").anonymous()
                 .antMatchers("/grade/grade/listPeriodAudit").anonymous()
                 .antMatchers("/grade/grade/listUserVideoRecord").anonymous()
+                .antMatchers("/grade/grade/listUserVideoRecord/new").anonymous()
                 .antMatchers("/swagger-ui.html").anonymous()
                 .antMatchers("/swagger-resources/**").anonymous()
                 .antMatchers("/webjars/**").anonymous()

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassGradeUserQueryBo.java

@@ -315,4 +315,12 @@ public class ClassGradeUserQueryBo extends BaseEntity {
 	@ApiModelProperty("录单订单编号")
 	private String inputOrderSn;
 
+	private List<Long> tenantIds;
+
+	private List<Long> educationTypeIds;
+
+	private List<Long> projectIds;
+
+	private Long educationId;
+
 }

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

@@ -43,6 +43,12 @@ public interface ClassGradeUserMapper extends BaseMapper<ClassGradeUser> {
 
     List<ClassPeriodStudentVo> listUserVideoRecord(ClassGradeUserQueryBo bo);
 
+    @InterceptorIgnore(tenantLine = "true")
+    List<ClassPeriodStudentVo> listUserVideoRecordNew(ClassGradeUserQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Long listUserVideoRecordNew_COUNT(ClassGradeUserQueryBo bo);
+
     List<ClassPeriodStudentVo> listUserPeriodExport(ClassGradeUserQueryBo bo);
 
     List<ClassPeriodUserVo> listPeriod(ClassGradeUserQueryBo bo);
@@ -67,8 +73,14 @@ public interface ClassGradeUserMapper extends BaseMapper<ClassGradeUser> {
 
     List<Long> selectStart(@Param("userId") Long userId,@Param("goodsId") Long goodsId,@Param("gradeId") Long gradeId,@Param("orderGoodsId") Long orderGoodsId);
 
+    @InterceptorIgnore(tenantLine = "true")
+    List<Long> selectStartNew(@Param("userId") Long userId,@Param("goodsId") Long goodsId,@Param("gradeId") Long gradeId,@Param("orderGoodsId") Long orderGoodsId);
+
     Long selectStartNoPhoto(@Param("userId") Long userId,@Param("goodsId") Long goodsId,@Param("gradeId") Long gradeId,@Param("orderGoodsId") Long orderGoodsId);
 
+    @InterceptorIgnore(tenantLine = "true")
+    Long selectStartNoPhotoNew(@Param("userId") Long userId,@Param("goodsId") Long goodsId,@Param("gradeId") Long gradeId,@Param("orderGoodsId") Long orderGoodsId);
+
     List<Long> selectEnd(@Param("userId") Long userId,@Param("goodsId") Long goodsId,@Param("gradeId") Long gradeId);
 
     List<ClassGradeUserGoodsVo> sendClassGradeUser();
@@ -132,4 +144,15 @@ public interface ClassGradeUserMapper extends BaseMapper<ClassGradeUser> {
 
     OrderGoods getOrderGoods(@Param("userId") Long userId, @Param("goodsId")Long goodsId);
 
+    @InterceptorIgnore(tenantLine = "true")
+    List<ClassPeriodStudentNewVo> listUserPeriodNew(ClassGradeUserQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Long listUserPeriodNew_COUNT(ClassGradeUserQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Long getEduIdByTenant(@Param("tenantId") Long tenantId,@Param("eduName") String eduName);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Long getProIdByTenant(@Param("tenantId") Long tenantId,@Param("proName") String proName,@Param("eduId") Long eduId);
 }

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

@@ -164,4 +164,8 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 	boolean resetQdyCheckInfo();
 
 	List<ClassPeriodStudentVo> listUserPeriodRecordNew(ClassGradeUserQueryBo bo);
+
+    List<ClassPeriodStudentNewVo> listUserPeriodNew(ClassGradeUserQueryBo bo);
+
+    List<ClassPeriodStudentVo> listUserVideoRecordNew(ClassGradeUserQueryBo bo);
 }

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

@@ -67,8 +67,10 @@ import com.zhongzheng.modules.order.service.IOrderInputService;
 import com.zhongzheng.modules.order.service.IOrderService;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.system.domain.SysOldOrg;
+import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysOldOrgService;
+import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.system.service.ISysUserService;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.User;
@@ -130,6 +132,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private ISysUserService iSysUserService;
 
+    @Autowired
+    private ISysTenantService iSysTenantService;
+
     @Autowired
     private IOrderService iOrderService;
 
@@ -979,6 +984,105 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return classPeriodStudentVos;
     }
 
+    @Override
+    public List<ClassPeriodStudentNewVo> listUserPeriodNew(ClassGradeUserQueryBo bo) {
+        //查询机构
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        SysTenant sysTenant = iSysTenantService.getById(tenantId);
+        if (ObjectUtils.isNotNull(sysTenant) && sysTenant.getSevenClass() == 1){
+            //七大员继教共享祥粤
+            List<SysTenant> sysTenants = iSysTenantService.list(new LambdaQueryWrapper<SysTenant>()
+                    .eq(SysTenant::getSevenClass, 1)
+                    .eq(SysTenant::getStatus, 1));
+            if (!CollectionUtils.isEmpty(sysTenants)){
+                List<Long> tenantIds = new ArrayList<>();
+                List<Long> educationTypeIds = new ArrayList<>();
+                List<Long> projectIds = new ArrayList<>();
+                for (SysTenant tenant : sysTenants) {
+                    tenantIds.add(tenant.getTenantId());
+                    Long eduId = baseMapper.getEduIdByTenant(tenant.getTenantId(),"继续教育");
+                    if (ObjectUtils.isNotNull(eduId)){
+                        educationTypeIds.add(eduId);
+                        Long proId = baseMapper.getProIdByTenant(tenant.getTenantId(),"继续教育",eduId);
+                        if (ObjectUtils.isNotNull(proId)){
+                            projectIds.add(proId);
+                        }
+                    }
+                }
+                bo.setTenantIds(tenantIds);
+                bo.setEducationTypeIds(educationTypeIds);
+                bo.setProjectIds(projectIds);
+            }
+        }else {
+            bo.setTenantIds(Arrays.asList(Long.valueOf(tenantId)));
+            bo.setEducationTypeIds(Arrays.asList(bo.getEducationId()));
+            bo.setProjectIds(Arrays.asList(bo.getProjectId()));
+        }
+        //查询班级学员信息
+        List<ClassPeriodStudentNewVo> classPeriodStudentVos = baseMapper.listUserPeriodNew(bo);
+        //查找学员学习记录
+        for (ClassPeriodStudentNewVo classPeriodStudentVo : classPeriodStudentVos) {
+            classPeriodStudentVo.setIdCard(EncryptHandler.decrypt(classPeriodStudentVo.getIdCard()));
+            classPeriodStudentVo.setTelPhone(EncryptHandler.decrypt(classPeriodStudentVo.getTelPhone()));
+            List<Long> timeList = baseMapper.selectStartNew(classPeriodStudentVo.getUserId(), classPeriodStudentVo.getGoodsId(), classPeriodStudentVo.getGradeId(),classPeriodStudentVo.getOrderGoodsId());
+            if (!CollectionUtils.isEmpty(timeList)) {
+                //查找开始学习时间
+                classPeriodStudentVo.setStartTime(timeList.get(0));
+            }else{
+                classPeriodStudentVo.setStartTime(baseMapper.selectStartNoPhotoNew(classPeriodStudentVo.getUserId(), classPeriodStudentVo.getGoodsId(), classPeriodStudentVo.getGradeId(),classPeriodStudentVo.getOrderGoodsId())
+                );
+            }
+        }
+        return classPeriodStudentVos;
+    }
+
+    @Override
+    public List<ClassPeriodStudentVo> listUserVideoRecordNew(ClassGradeUserQueryBo bo) {
+        //查询机构
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        SysTenant sysTenant = iSysTenantService.getById(tenantId);
+        if (ObjectUtils.isNotNull(sysTenant) && sysTenant.getSevenClass() == 1){
+            //七大员继教共享祥粤
+            List<SysTenant> sysTenants = iSysTenantService.list(new LambdaQueryWrapper<SysTenant>()
+                    .eq(SysTenant::getSevenClass, 1)
+                    .eq(SysTenant::getStatus, 1));
+            if (!CollectionUtils.isEmpty(sysTenants)){
+                List<Long> tenantIds = new ArrayList<>();
+                List<Long> educationTypeIds = new ArrayList<>();
+                List<Long> projectIds = new ArrayList<>();
+                for (SysTenant tenant : sysTenants) {
+                    tenantIds.add(tenant.getTenantId());
+                    Long eduId = baseMapper.getEduIdByTenant(tenant.getTenantId(),"继续教育");
+                    if (ObjectUtils.isNotNull(eduId)){
+                        educationTypeIds.add(eduId);
+                        Long proId = baseMapper.getProIdByTenant(tenant.getTenantId(),"继续教育",eduId);
+                        if (ObjectUtils.isNotNull(proId)){
+                            projectIds.add(proId);
+                        }
+                    }
+                }
+                bo.setTenantIds(tenantIds);
+                bo.setEducationTypeIds(educationTypeIds);
+                bo.setProjectIds(projectIds);
+            }
+        }else {
+            bo.setTenantIds(Arrays.asList(Long.valueOf(tenantId)));
+            bo.setEducationTypeIds(Arrays.asList(bo.getEducationId()));
+            bo.setProjectIds(Arrays.asList(bo.getProjectId()));
+        }
+        //查询班级学员信息
+        List<ClassPeriodStudentVo> classPeriodStudentVos = baseMapper.listUserVideoRecordNew(bo);
+        //查找学员学习记录
+        for (ClassPeriodStudentVo classPeriodStudentVo : classPeriodStudentVos) {
+            //取学时所有拍照最新的一张
+            String recentPhoto = userStudyRecordPhotoMapper.selectGradeRecentOnePhotoNew(classPeriodStudentVo.getUserId(), classPeriodStudentVo.getGradeId(),classPeriodStudentVo.getOrderGoodsId());
+            if (Validator.isNotEmpty(recentPhoto)) {
+                classPeriodStudentVo.setIdCardImg1(recentPhoto);
+            }
+        }
+        return classPeriodStudentVos;
+    }
+
     @Override
     public ClassPeriodStudentVo DecryptOfficialInfo(ClassGradeDecryptQueryBo bo) {
         String pars;

+ 79 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentNewVo.java

@@ -0,0 +1,79 @@
+package com.zhongzheng.modules.grade.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * 学员记录视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-11-10
+ */
+@Data
+@ApiModel("学员学时视图对象")
+public class ClassPeriodStudentNewVo {
+	private static final long serialVersionUID = 1L;
+
+	/** $pkColumn.columnComment */
+	@ApiModelProperty("$pkColumn.columnComment")
+	private Long id;
+
+	/** 学员ID */
+	@ApiModelProperty("学员ID")
+	private Long userId;
+
+	/** 商品ID */
+	@ApiModelProperty("商品ID")
+	private Long goodsId;
+
+	/** 班级id */
+	@ApiModelProperty("班级id")
+	private Long gradeId;
+
+	/** 订单商品ID */
+	@ApiModelProperty("订单商品ID")
+	private Long orderGoodsId;
+
+	/** 1 进入 0移除 */
+	@ApiModelProperty("1 进入 0移除")
+	private Integer status;
+
+	/** 学员编码 */
+	@ApiModelProperty("学员姓名")
+	private String realName;
+
+	/** 学员编码 */
+	@ApiModelProperty("学员身份证")
+	private String idCard;
+
+	/** 学员编码 */
+	@ApiModelProperty("学员电话")
+	private String telPhone;
+
+	/** 学习有效期开始 */
+	@ApiModelProperty("学习开始")
+	private Long startTime;
+	/** 学习有效期结束 */
+	@ApiModelProperty("学习结束")
+	private Long endTime;
+
+	@ApiModelProperty("审核状态  1通过 3不通过 2待审")
+	private Integer profileStatus;
+
+	@ApiModelProperty("班级名称")
+	private String className;
+
+	@ApiModelProperty("商品名称")
+	private String goodsName;
+
+	@ApiModelProperty("学习年份")
+	private String sevenYear;
+
+	@ApiModelProperty("业务名称")
+	private String fullName;
+
+	private String tenantId;
+
+}

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserStudyRecordPhotoMapper.java

@@ -18,6 +18,9 @@ public interface UserStudyRecordPhotoMapper extends BaseMapper<UserStudyRecordPh
 
     String selectGradeRecentOnePhoto(@Param("userId") Long userId,@Param("gradeId") Long gradeId,@Param("orderGoodsId") Long orderGoodsId);
 
+    @InterceptorIgnore(tenantLine = "true")
+    String selectGradeRecentOnePhotoNew(@Param("userId") Long userId,@Param("gradeId") Long gradeId,@Param("orderGoodsId") Long orderGoodsId);
+
     List<String> selectGradePhotoWeek(@Param("userId") Long userId,@Param("gradeId") Long gradeId,@Param("searchWeekStartTime") Long searchWeekStartTime,@Param("searchWeekEndTime") Long searchWeekEndTime,@Param("orderGoodsId") Long orderGoodsId);
 
     @InterceptorIgnore(tenantLine = "true")

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

@@ -422,6 +422,105 @@
         order by up.create_time desc
     </select>
 
+    <select id="listUserVideoRecordNew" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultMap="ClassPeriodStudentVo">
+        SELECT
+        up.* ,cg.class_name,cs.duration_time,u.id_card,u.realname,u.one_inch_photos,u.company_name,cs.`name` as section_name,ups.record_start_time,ups.record_end_time,ups.update_time as on_line_time
+        FROM
+        user_period up
+        LEFT JOIN user_period_status ups ON up.id = ups.period_id
+        LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
+        LEFT JOIN  goods g ON up.goods_id = g.goods_id
+        LEFT JOIN course_section cs ON up.section_id = cs.section_id
+        LEFT JOIN `user` u ON up.user_id = u.user_id
+        WHERE
+        up.grade_id > 0  and up.type = 1
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        <if test="projectIds != null and projectIds.size()!=0 ">
+            AND g.project_id in
+            <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
+            AND g.education_type_id in
+            <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="realname != null and realname != ''">
+            AND u.realname like concat('%', #{realname}, '%')
+        </if>
+        <if test="telphone != null and telphone != ''">
+            AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
+        </if>
+        <if test="idCard != null and idCard != ''">
+            AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
+        </if>
+        <if test="companyName != null and companyName != ''">
+            AND u.company_name like concat('%', #{companyName}, '%')
+        </if>
+        <if test="tenantIds != null and tenantIds.size()!=0 ">
+            AND up.tenant_id in
+            <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        order by up.create_time desc
+    </select>
+
+
+    <select id="listUserVideoRecordNew_COUNT" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultType="java.lang.Long">
+        SELECT
+        count(up.id)
+        FROM
+        user_period up
+        LEFT JOIN user_period_status ups ON up.id = ups.period_id
+        LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
+        LEFT JOIN  goods g ON up.goods_id = g.goods_id
+        LEFT JOIN course_section cs ON up.section_id = cs.section_id
+        LEFT JOIN `user` u ON up.user_id = u.user_id
+        WHERE
+        up.grade_id > 0  and up.type = 1
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        <if test="projectIds != null and projectIds.size()!=0 ">
+            AND g.project_id in
+            <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
+            AND g.education_type_id in
+            <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="realname != null and realname != ''">
+            AND u.realname like concat('%', #{realname}, '%')
+        </if>
+        <if test="telphone != null and telphone != ''">
+            AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
+        </if>
+        <if test="idCard != null and idCard != ''">
+            AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
+        </if>
+        <if test="companyName != null and companyName != ''">
+            AND u.company_name like concat('%', #{companyName}, '%')
+        </if>
+        <if test="tenantIds != null and tenantIds.size()!=0 ">
+            AND up.tenant_id in
+            <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        order by up.create_time desc
+    </select>
+
 
     <select id="listUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
             resultMap="ClassPeriodStudentVo">
@@ -576,6 +675,122 @@
         </if>
     </select>
 
+
+    <select id="listUserPeriodNew_COUNT" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultType="java.lang.Long">
+        SELECT
+        count(cgu.id)
+        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_education_type cet ON g.education_type_id = cet.id
+        LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+        LEFT JOIN course_business cb ON g.business_id = cb.id
+        where 1=1
+        and cgu.`status` =1
+        and cb.`period_check_sign` = 1
+        <if test="projectIds != null and projectIds.size()!=0 ">
+            AND g.project_id in
+            <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
+            AND g.education_type_id in
+            <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="periodStatus != null ">
+            and cgu.period_status = #{periodStatus}
+        </if>
+        <if test="searchKey != null and searchKey != '' ">
+            and u.realname like concat('%', #{searchKey}, '%')
+        </if>
+        <if test="idCard != null and idCard !='' ">
+            AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
+        </if>
+        <if test="tenantIds != null and tenantIds.size()!=0 ">
+            AND cgu.tenant_id in
+            <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        order by cgu.update_time desc
+    </select>
+
+    <select id="listUserPeriodNew" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
+            resultType="com.zhongzheng.modules.grade.vo.ClassPeriodStudentNewVo">
+        SELECT
+        u.user_id,
+        u.realname,
+        og.goods_id,
+        u.id_card,
+        cgu.grade_id,
+        u.telphone,
+        up.`status` as profile_status,
+        g.goods_name,
+        cg.class_name,
+        cgu.order_goods_id,
+        (SELECT og.seven_year FROM order_goods og  where og.order_goods_id = cgu.order_goods_id ) as seven_year,
+        cgu.period_wait_time as end_time,
+        cgu.tenant_id,
+        CONCAT(cet.education_name,cpt.project_name,cb.business_name) AS fullName
+        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_education_type cet ON g.education_type_id = cet.id
+        LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+        LEFT JOIN course_business cb ON g.business_id = cb.id
+        where 1=1
+        and cgu.`status` =1
+        and cb.`period_check_sign` = 1
+        <if test="projectIds != null and projectIds.size()!=0 ">
+            AND g.project_id in
+            <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
+            AND g.education_type_id in
+            <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="periodStatus != null ">
+            and cgu.period_status = #{periodStatus}
+        </if>
+        <if test="searchKey != null and searchKey != '' ">
+            and u.realname like concat('%', #{searchKey}, '%')
+        </if>
+        <if test="idCard != null and idCard !='' ">
+            AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
+        </if>
+        <if test="tenantIds != null and tenantIds.size()!=0 ">
+            AND cgu.tenant_id in
+            <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        order by cgu.update_time desc
+    </select>
+
+    <select id="getEduIdByTenant" parameterType="map" resultType="java.lang.Long">
+        SELECT id FROM course_education_type WHERE tenant_id = #{tenantId} AND education_name = #{eduName} AND `status` = 1 LIMIT 1
+    </select>
+
+    <select id="getProIdByTenant" parameterType="map" resultType="java.lang.Long">
+        SELECT id FROM course_project_type WHERE tenant_id = #{tenantId} AND project_name = #{proName}  AND education_id = #{eduId} AND `status` = 1 LIMIT 1
+    </select>
+
     <select id="exportUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
             resultMap="ClassPeriodStudentVo">
         SELECT
@@ -1593,6 +1808,25 @@
             rp.create_time ASC
     </select>
 
+    <select id="selectStartNew" parameterType="map" resultType="long">
+        SELECT
+        rp.create_time
+        FROM
+        user_study_record_photo rp
+        LEFT JOIN user_period_status ups ON rp.period_id = ups.id
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        1=1
+        <if test="orderGoodsId != null ">
+            AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
+        </if>
+        AND ups.period_status = 1
+        AND up.grade_id = #{gradeId}
+        AND up.user_id = #{userId}
+        ORDER BY
+        rp.create_time ASC
+    </select>
+
     <select id="selectStartNoPhoto" parameterType="map" resultType="long">
         SELECT
         ups.record_start_time
@@ -1612,6 +1846,25 @@
         limit 1
     </select>
 
+    <select id="selectStartNoPhotoNew" parameterType="map" resultType="long">
+        SELECT
+        ups.record_start_time
+        FROM
+        user_period_status ups
+        LEFT JOIN user_period up ON up.id = ups.period_id
+        WHERE
+        1=1
+        <if test="orderGoodsId != null ">
+            AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
+        </if>
+        AND ups.period_status = 1
+        AND up.grade_id = #{gradeId}
+        AND up.user_id = #{userId}
+        ORDER BY
+        ups.record_start_time ASC
+        limit 1
+    </select>
+
     <select id="selectEnd" parameterType="map" resultType="long">
         SELECT
             usr.end_time

+ 17 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordPhotoMapper.xml

@@ -68,6 +68,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LIMIT 1
     </select>
 
+    <select id="selectGradeRecentOnePhotoNew" parameterType="map" resultType="string">
+        SELECT
+            rp.photo
+        FROM
+            user_period up
+                LEFT JOIN user_period_status ups ON up.id = ups.period_id
+                LEFT JOIN user_study_record_photo rp ON ups.id = rp.period_id
+        WHERE
+            up.grade_id = #{gradeId}
+          AND up.user_id = #{userId}
+          AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
+          AND rp.photo IS NOT NULL
+        ORDER BY
+            rp.id DESC
+            LIMIT 1
+    </select>
+
     <select id="listByPhoto" parameterType="java.lang.String" resultType="com.zhongzheng.modules.user.domain.UserStudyRecordPhoto">
         SELECT * FROM `user_study_record_photo` WHERE photo = #{imageUrl}
     </select>