Commit 53c7c01e by 杨卫

feat:1047116:学习中心-我的课程/状态页签数据量/剩余锁单时间

1 parent aceb9d0e
Showing 14 changed files with 481 additions and 7 deletions
package cn.com.glsx.dj.riskmanage.dto.learningcenter;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 学习中心-各页签数据总数响应对象
* @author yangwei
* @version 1.0
* @since 2025/11/26 15:32
*/
@Data
public class LearningCenterMyselfCourseCountDTO implements Serializable {
private static final long serialVersionUID = 3426375905777555656L;
/** 手机号码 */
@NotBlank(message = "手机号码不能为空")
private String phone;
}
package cn.com.glsx.dj.riskmanage.dto.learningcenter;
import lombok.Data;
import java.io.Serializable;
/**
* 学习中心-各页签数据总数响应对象
* @author yangwei
* @version 1.0
* @since 2025/11/26 15:32
*/
@Data
public class LearningCenterMyselfCourseCountRespDTO implements Serializable {
private static final long serialVersionUID = 3426375905777555656L;
/** 正在学习数量 */
private Long unLearnCount;
/** 学习中数量 */
private Long learningCount;
/** 已完成数量 */
private Long completedCount;
}
package cn.com.glsx.dj.riskmanage.dto.learningcenter;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 学习中心-我的课程
* @author yangwei
* @version 1.0
* @since 2025/11/26 15:32
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class LearningCenterMyselfCourseDTO implements Serializable {
private static final long serialVersionUID = -4811308989776259758L;
/** 学习状态 0:待学习 1: 正在学习 2:已学完 */
@Builder.Default
private String learnStatus = "0";
/**
* 北森人员标识
*/
private Integer personId;
/**
* 手机号码
*/
@NotBlank(message = "手机号码不能为空")
private String phone;
/**
* 北森课程标识
*/
private String courseId;
/**
* 课程类型 (1:必修, 2:选修)
*/
private Byte planCourseType;
/**
* 课程标题
*/
private String title;
/**
* 总时长(分钟)
*/
private BigDecimal totalDuration;
/**
* 总评分结果
*/
private BigDecimal totalStar;
/**
* 学习总人数
*/
private Integer learnTotal;
/**
* 课程文件类型 10:视频 80:音频 20:混合 30:文档 40:H5 70:URL 120:图文
*/
private String courseFileType;
/**
* 学习进度(百分比)
*/
private BigDecimal process;
}
package cn.com.glsx.dj.riskmanage.dto.learningcenter;
import cn.com.glsx.dj.riskmanage.enums.learningcenter.RemindTypeEnum;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
/**
* 学习中心-剩余锁单时间响应对象
* @author yangwei
* @version 1.0
* @since 2025/11/26 15:32
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class LearningCenterResidueTimeRespDTO implements Serializable {
private static final long serialVersionUID = 3426375905777555656L;
/** 提醒类型 0:未锁定 1:限时锁定还有剩余时间 2:已锁定 */
@Builder.Default
private String remindType = RemindTypeEnum.UNLOCKED.getCode();
/** 剩余天数 */
private Integer residueDays;
}
......@@ -20,6 +20,8 @@ public enum RiskmanageErrorEnum implements ErrorEnum {
LEVEL_EXAM_TIME_ERROR("30990507", "等级考试时间为空"),
TRAINING_PLAN_DATA_ERROR("30990508", "培训计划数据异常"),
MYSELF_LEARN_STATUS_ERROR("30990509", "不支持的我的学习类型"),
;
private String value;
......
package cn.com.glsx.dj.riskmanage.enums.learningcenter;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 学习状态 0:待学习 1: 正在学习 2:已学完
* @author yangwei
* @version 1.0
* @since 2025/12/02 14:16
*/
@Getter
@AllArgsConstructor
public enum MyselfLearnStatusEnum {
UNLEARNED("0", "待学习"),
LEARNING("1", "正在学习"),
FINISHED("2", "已学完");
private final String code;
private final String info;
public static MyselfLearnStatusEnum getInfoByCode(String code) {
for (MyselfLearnStatusEnum value : MyselfLearnStatusEnum.values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
}
......@@ -16,7 +16,7 @@ public enum OrderPermissionTypeEnum {
LOCK((byte) 1, "锁定开单权限, 完成培训计划后开放"),
OPEN((byte) 2, "开单权限已开放, 限时锁定");
private Byte code;
private String message;
private final Byte code;
private final String message;
}
package cn.com.glsx.dj.riskmanage.enums.learningcenter;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 提醒类型 (0:未锁定 1:限时锁定还有剩余时间 2:已锁定)
* @author yangwei
* @version 1.0
* @since 2025/12/02 16:30
*/
@Getter
@AllArgsConstructor
public enum RemindTypeEnum {
UNLOCKED("0", "未锁定"),
LIMITED_LOCK("1", "限时锁定还有剩余时间"),
LOCKED("2", "已锁定");
private final String code;
private final String message;
}
\ No newline at end of file
package cn.com.glsx.dj.riskmanage.remote.learningcenter;
import cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterLevelExamDTO;
import cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterLevelExamRespDTO;
import cn.com.glsx.dj.riskmanage.dto.activity.ActivityQryDTO;
import cn.com.glsx.dj.riskmanage.dto.activity.ActivityRespDTO;
import cn.com.glsx.dj.riskmanage.dto.learningcenter.*;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
import cn.com.glsx.framework.core.annotation.ApiResponse;
import cn.com.glsx.framework.core.annotation.ApiService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.scrm.proxy.dto.RopResponse;
import io.swagger.annotations.ApiOperation;
/**
......@@ -26,8 +31,22 @@ public interface PadLearningCenterRemote {
@ApiOperation("学习中心-限制录单弹窗")
@ApiMethod("学习中心-限制录单弹窗")
@ApiParam(name = "request", notes = "开始测评请求对象", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiParam(name = "request", notes = "限制录单弹窗请求对象", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("{@code true} 具备权限 {@code false} 不具备开单权限")
RpcResponse<Boolean> learningCenterPermissionOrder(LearningCenterLevelExamDTO request);
@ApiMethod("学习中心-我的课程")
@ApiParam(name = "rpcPagination", notes = "分页条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("我的课程列表")
RpcResponse<RpcPagination<LearningCenterMyselfCourseDTO>> learningCenterMyselfCourse(RpcPagination<LearningCenterMyselfCourseDTO> rpcPagination);
@ApiMethod("学习中心-我的课程-查询各页签数据量")
@ApiParam(name = "request", notes = "查询各页签数据量请求对象", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("各页签数据量")
RpcResponse<LearningCenterMyselfCourseCountRespDTO> learningCenterMyselfCourseCount(LearningCenterMyselfCourseCountDTO request);
@ApiMethod("学习中心-我的课程-剩余开单时间")
@ApiParam(name = "request", notes = "剩余开单时间请求对象", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("剩余开单时间")
RpcResponse<LearningCenterResidueTimeRespDTO> learningCenterResidueTime(LearningCenterMyselfCourseCountDTO request);
}
package cn.com.glsx.dj.riskmanage.mapper.learningcenter;
import cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseDTO;
import cn.com.glsx.dj.riskmanage.model.learningcenter.LearningCenterPersonCourse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface LearningCenterPersonCourseMapper extends OreMapper<LearningCenterPersonCourse> {
......@@ -14,4 +17,22 @@ public interface LearningCenterPersonCourseMapper extends OreMapper<LearningCent
* @return
*/
Integer countUnReadCourse(@Param("personId") Integer personId);
/**
* 未学习课程
* @author yangwei
* @since 2025/12/2 14:34
* @param condition 查询条件
* @return java.util.List<cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseDTO>
*/
List<LearningCenterMyselfCourseDTO> unLearnedCourses(LearningCenterMyselfCourseDTO condition);
/**
* 已学习课程
* @author yangwei
* @since 2025/12/2 14:34
* @param condition 筛选条件
* @return java.util.List<cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseDTO>
*/
List<LearningCenterMyselfCourseDTO> learningCenterMyselfCourse(LearningCenterMyselfCourseDTO condition);
}
\ No newline at end of file
package cn.com.glsx.dj.riskmanage.remote.learningcenter;
import cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterLevelExamDTO;
import cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterLevelExamRespDTO;
import cn.com.glsx.dj.riskmanage.dto.learningcenter.*;
import cn.com.glsx.dj.riskmanage.service.learningcenter.PadLearningCenterService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
......@@ -62,4 +63,66 @@ public class PadLearningCenterRemoteImpl implements PadLearningCenterRemote {
return RpcResponse.error(e);
}
}
/**
* 学习中心-我的课程
* @author yangwei
* @since 2025/12/2 13:56
* @param rpcPagination 分页条件
* @return cn.com.glsx.framework.core.beans.rpc.RpcResponse<cn.com.glsx.framework.core.beans.rpc.RpcPagination<cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseDTO>>
*/
@Override
public RpcResponse<RpcPagination<LearningCenterMyselfCourseDTO>> learningCenterMyselfCourse(RpcPagination<LearningCenterMyselfCourseDTO> rpcPagination) {
try {
Page<LearningCenterMyselfCourseDTO> page = padLearningCenterService.learningCenterMyselfCourse(rpcPagination);
return RpcResponse.success(RpcPagination.copyPage(page));
} catch (RpcServiceException e) {
log.error("学习中心-我的课程调用异常!", e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("学习中心-我的课程调用异常!", e);
return RpcResponse.error(e);
}
}
/**
* 学习中心-我的课程-查询各页签数据量
* @author yangwei
* @since 2025/12/2 16:09
* @param request 请求对象
* @return cn.com.glsx.framework.core.beans.rpc.RpcResponse<cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseCountRespDTO>
*/
@Override
public RpcResponse<LearningCenterMyselfCourseCountRespDTO> learningCenterMyselfCourseCount(LearningCenterMyselfCourseCountDTO request) {
try {
return RpcResponse.success(padLearningCenterService.learningCenterMyselfCourseCount(request));
} catch (RpcServiceException e) {
log.error("学习中心-我的课程-查询各页签数据量调用异常!", e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("学习中心-我的课程-查询各页签数据量调用异常!", e);
return RpcResponse.error(e);
}
}
/**
* 学习中心-我的课程-剩余开单时间
* @author yangwei
* @since 2025/12/2 16:42
* @param request 请求对象
* @return cn.com.glsx.framework.core.beans.rpc.RpcResponse<cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterResidueTimeRespDTO>
*/
@Override
public RpcResponse<LearningCenterResidueTimeRespDTO> learningCenterResidueTime(LearningCenterMyselfCourseCountDTO request) {
try {
return RpcResponse.success(padLearningCenterService.learningCenterResidueTime(request));
} catch (RpcServiceException e) {
log.error("学习中心-我的课程-剩余开单时间调用异常!", e);
return RpcResponse.error(e);
} catch (Exception e) {
log.error("学习中心-我的课程-剩余开单时间调用异常!", e);
return RpcResponse.error(e);
}
}
}
package cn.com.glsx.dj.riskmanage.service.learningcenter;
import cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseDTO;
import cn.com.glsx.dj.riskmanage.mapper.learningcenter.LearningCenterPersonCourseMapper;
import cn.com.glsx.dj.riskmanage.model.learningcenter.LearningCenterPersonCourse;
import cn.com.glsx.dj.riskmanage.util.validation.BeanValidationUtils;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import javax.validation.groups.Default;
import java.util.*;
import java.util.stream.Collectors;
/**
* 学习中心课程推送记录
* @author yangwei
* @version 1.0
* @since 2025/12/02 14:21
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class LearningCenterPersonCourseService {
private final LearningCenterPersonCourseMapper learningCenterPersonCourseMapper;
/**
* 未学习课程
* @author yangwei
* @since 2025/12/2 14:25
* @param rpcPagination 分页参数
* @return com.github.pagehelper.Page<cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseDTO>
*/
public Page<LearningCenterMyselfCourseDTO> unLearnedCourses(RpcPagination<LearningCenterMyselfCourseDTO> rpcPagination) {
LearningCenterMyselfCourseDTO condition = Optional.ofNullable(rpcPagination.getCondition()).orElseGet(LearningCenterMyselfCourseDTO::new);
BeanValidationUtils.validateAndThrow(condition, Default.class);
Page<LearningCenterMyselfCourseDTO> page = PageHelper.startPage(rpcPagination.getPageNum(), rpcPagination.getPageSize());
learningCenterPersonCourseMapper.unLearnedCourses(condition);
return page;
}
/**
* 学习中/已完成课程
* @author yangwei
* @since 2025/12/2 14:25
* @param rpcPagination 分页参数
* @return com.github.pagehelper.Page<cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseDTO>
*/
public Page<LearningCenterMyselfCourseDTO> learningCenterMyselfCourse(RpcPagination<LearningCenterMyselfCourseDTO> rpcPagination) {
LearningCenterMyselfCourseDTO condition = Optional.ofNullable(rpcPagination.getCondition()).orElseGet(LearningCenterMyselfCourseDTO::new);
BeanValidationUtils.validateAndThrow(condition, Default.class);
Page<LearningCenterMyselfCourseDTO> page = PageHelper.startPage(rpcPagination.getPageNum(), rpcPagination.getPageSize());
learningCenterPersonCourseMapper.learningCenterMyselfCourse(condition);
List<LearningCenterMyselfCourseDTO> result = page.getResult();
if (CollUtil.isEmpty(result)) {
return page;
}
// 处理选必修课程
Set<String> courseId = result.stream().map(LearningCenterMyselfCourseDTO::getCourseId).collect(Collectors.toSet());
Example example = new Example(LearningCenterPersonCourse.class);
example.orderBy("createdDate").desc();
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("deletedFlag", DeleteFlagEnum.N.getValue())
.andIn("courseId", courseId)
.andEqualTo("personId", condition.getPersonId());
List<LearningCenterPersonCourse> learningCenterPersonCourses = learningCenterPersonCourseMapper.selectByExample(example);
Map<String, Byte> courseIdMapCourseType = Optional.ofNullable(learningCenterPersonCourses).orElseGet(ArrayList::new)
.stream()
.collect(Collectors.toMap(LearningCenterPersonCourse::getCourseId, LearningCenterPersonCourse::getPlanCourseType, (pre, curr) -> curr));
result.forEach(course -> course.setPlanCourseType(courseIdMapCourseType.get(course.getCourseId())));
return page;
}
}
......@@ -34,4 +34,73 @@
where deleted_flag = 'N'and person_id = #{personId} and look_status = '0' and course_push_source = '0'
</select>
<select id="unLearnedCourses"
resultType="cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseDTO">
SELECT
t1.course_id AS courseId,
t1.plan_course_type AS planCourseType,
t3.title AS title,
t3.total_duration AS totalDuration,
t3.total_star AS totalStar,
t3.learn_total AS learnTotal,
t3.course_file_type AS courseFileType
FROM learning_center_person_course t1
JOIN dj_beisen_course t3 ON t1.course_id = t3.id
WHERE t1.course_push_source = '0'
AND t1.person_id = #{personId}
AND t3.course_status = '40'
AND t1.deleted_flag = 'N'
AND t3.deleted_flag = 'N'
AND (
EXISTS (
SELECT 1
FROM dj_beisen_course_staff t2
WHERE t1.course_id = t2.course_id
AND t1.person_id = t2.user_id
AND t2.learn_status = 10
)
OR NOT EXISTS (
SELECT 1
FROM dj_beisen_course_staff t2
WHERE t1.course_id = t2.course_id
AND t1.person_id = t2.user_id
)
)
ORDER BY learn_total DESC
</select>
<select id="learningCenterMyselfCourse"
resultType="cn.com.glsx.dj.riskmanage.dto.learningcenter.LearningCenterMyselfCourseDTO">
SELECT
t1.process AS process,
t1.course_id AS courseId,
t2.title AS title,
t2.total_duration AS totalDuration,
t2.total_star AS totalStar,
t2.learn_total AS learnTotal,
t2.course_file_type AS courseFileType
FROM dj_beisen_course_staff t1
INNER JOIN dj_beisen_course t2 ON t1.course_id = t2.id
WHERE t1.user_id = #{personId}
AND t2.course_status = '40'
AND t1.deleted_flag = 'N'
AND t2.deleted_flag = 'N'
<choose>
<when test="'1'.toString().equals(learnStatus)">
AND t1.learn_status = '20'
</when>
<otherwise>
AND t1.learn_status = '50'
</otherwise>
</choose>
<choose>
<when test="'1'.toString().equals(learnStatus)">
ORDER BY t1.modified_time DESC
</when>
<otherwise>
ORDER BY t1.learn_end_time DESC
</otherwise>
</choose>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!