mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
Merge branch 'zcwy0815-llf' into 104-master
# Conflicts: # servers/boe-server-all/src/main/java/com/xboe/school/study/api/StudyCourseApi.java
This commit is contained in:
@@ -84,7 +84,6 @@
|
||||
<artifactId>xboe-module-es</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>it.sauronsoftware</groupId>
|
||||
<artifactId>jave</artifactId>
|
||||
|
||||
@@ -133,4 +133,6 @@ public interface CacheName {
|
||||
* 字典缓存key
|
||||
* */
|
||||
String KEY_DICT="dict";
|
||||
|
||||
String STUDY_KEY = "StudyKey:";
|
||||
}
|
||||
|
||||
@@ -3,13 +3,11 @@ package com.xboe.school.study.api;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.common.util.concurrent.RateLimiter;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.api.vo.*;
|
||||
import com.xboe.constants.CacheName;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.usergroup.entity.UserGroupItem;
|
||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
@@ -67,8 +65,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
@RequestMapping(value="/xboe/school/study/course")
|
||||
public class StudyCourseApi extends ApiBaseController{
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
IStudyCourseService service;
|
||||
|
||||
@@ -324,29 +320,33 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
|
||||
|
||||
//检查是否已存在
|
||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||
|
||||
// 20240815 特训营结营考试 临时代码
|
||||
// if(item != null && redisTemplate.opsForValue().get(item.getId())==null){
|
||||
// redisTemplate.opsForValue().set(item.getId(),item.getId());
|
||||
// //设置过期时间为1天
|
||||
// redisTemplate.expire(item.getId(), 60, TimeUnit.SECONDS);
|
||||
// }else{
|
||||
// return success("");
|
||||
// }
|
||||
if(item!=null) {
|
||||
//如果记录存在,但是进度不100无成情况,就更新进度,一期不会有这种情况
|
||||
if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
||||
String studyKey = CacheName.NAME_AUTH + ":" + CacheName.STUDY_KEY + item.getCourseId()+":"+cuser.getAccountId()+":"+item.getContentId();
|
||||
String studyKey2 = CacheName.NAME_AUTH + ":" + CacheName.STUDY_KEY + sci.getCourseId()+":"+cuser.getAccountId()+":"+sci.getContentId();
|
||||
redisTemplate.opsForValue().set(studyKey,
|
||||
String.valueOf(item.getProgress()), 2, TimeUnit.HOURS);
|
||||
String progressStr = redisTemplate.opsForValue().get(studyKey2);
|
||||
if (progressStr != null && !progressStr.isEmpty()) {
|
||||
// 尝试将 Redis 中的字符串转换为整数
|
||||
int redisProgress = Integer.parseInt(progressStr);
|
||||
// 假设 item.getProgress() 返回的是 int 类型
|
||||
int sciProgress = sci.getProgress();
|
||||
|
||||
if (redisProgress < sciProgress && redisProgress < 100) {
|
||||
// 执行一些操作
|
||||
// if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
||||
// }
|
||||
studyService.updateProcess(item.getId(), sci.getStudyId(), sci.getCourseId(), sci.getContentTotal(), sci.getProgress(),token);
|
||||
}
|
||||
}
|
||||
//追加学习时长
|
||||
studyService.appendStudyDuration(sci.getStudyId(),item.getId(),sci.getContentId(),sci.getDuration());
|
||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(sci.getStudyId() ,sci.getCourseId(), token);
|
||||
log.info("在线课学习记录"+allUserList);
|
||||
return success(item.getId());
|
||||
//如果记录存在,但是进度不100无成情况,就更新进度,一期不会有这种情况
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(sci.getCourseId())){
|
||||
@@ -421,14 +421,6 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||
if(item!=null) {
|
||||
//如果记录存在,但是进度不到100,未完成情况,就更新进度,一期不会有这种情况
|
||||
// 20240815 特训营结营考试 临时代码
|
||||
// if(item != null && redisTemplate.opsForValue().get(item.getId())==null){
|
||||
// redisTemplate.opsForValue().set(item.getId(),item.getId());
|
||||
// //设置过期时间为1天
|
||||
// redisTemplate.expire(item.getId(), 60, TimeUnit.SECONDS);
|
||||
// }else{
|
||||
// return success("");
|
||||
// }
|
||||
if(item.getProgress()<100) {
|
||||
studyService.updateProcess(item.getId(),sci.getStudyId(),sci.getCourseId(), sci.getContentTotal(),100,token);
|
||||
}
|
||||
@@ -534,14 +526,6 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
try {
|
||||
// 20240815 特训营结营考试 临时代码
|
||||
// if(itemId != null && redisTemplate.opsForValue().get(itemId)==null){
|
||||
// redisTemplate.opsForValue().set(itemId,itemId);
|
||||
// //设置过期时间为1天
|
||||
// redisTemplate.expire(itemId, 60, TimeUnit.SECONDS);
|
||||
// }else{
|
||||
// return success(true);
|
||||
// }
|
||||
studyService.finishVideoStudyItem(itemId, studyId,courseId,cnum,token);
|
||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
||||
log.info("在线课学习记录"+allUserList);
|
||||
@@ -724,9 +708,8 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value="/study-course-content",method = {RequestMethod.GET,RequestMethod.POST})
|
||||
public JsonResponse<StudyCourseItem> findStudyCourseItem(String studyId,String contentId, HttpServletRequest request){
|
||||
public JsonResponse<StudyCourseItem> findStudyCourseItem(String studyId,String contentId){
|
||||
if(StringUtils.isBlank(studyId)){
|
||||
return error("无学习信息");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user