mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-08 02:16:49 +08:00
Merge branch 'release-20250328-master' into 251114-feature-course-online
This commit is contained in:
@@ -357,6 +357,7 @@ public class CourseManageApi extends ApiBaseController{
|
||||
@PostMapping("/save")
|
||||
@AutoLog(module = "课程",action = "保存课程基本信息",info = "")
|
||||
public JsonResponse<CourseFullDto> saveCourseFull(@RequestBody CourseFullDto dto, HttpServletRequest request){
|
||||
log.info("-------- 保存课程的全部信息 ------- 课程信息 = {} " , dto.getCourse());
|
||||
if(dto.getCourse()==null){
|
||||
return badRequest("无课程信息");
|
||||
}
|
||||
@@ -378,6 +379,7 @@ public class CourseManageApi extends ApiBaseController{
|
||||
//填充必要的信息
|
||||
try {
|
||||
log.info("-------- 标签相关开始 ------- 课程ID = {} " , dto.getCourse().getId());
|
||||
log.info("-------- 标签相关开始 ------- 课程TAG = {} " , dto.getCourse().getTags());
|
||||
CurrentUser userInfo = getCurrent();
|
||||
Course oldCourse = StringUtils.isBlank(dto.getCourse().getId()) ? null : courseService.get(dto.getCourse().getId());
|
||||
log.info("-------- 标签相关 ------- oldtags = {} " , oldCourse.getTags());
|
||||
@@ -386,15 +388,16 @@ public class CourseManageApi extends ApiBaseController{
|
||||
// 检查每个元素是否为纯数字
|
||||
for (String tag : tagArray) {
|
||||
if (!tag.matches("\\d+")) { // 使用正则表达式检查是否为纯数字
|
||||
log.info("-------- 不是纯数字 ------- tag = {} " , tag);
|
||||
log.info("-------- 不是纯数字 -------oldtags tag = {} " , tag);
|
||||
oldCourse.setTags(null); // 兼容
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("-------- 标签相关 updateTags ------- oldtags = {} " , oldCourse.getTags());
|
||||
log.info("-------- 标签相关 updateTags ------- newtags = {} " , dto.getCourse().getTags());
|
||||
tagService.updateTags(oldCourse,dto.getCourse(),userInfo);
|
||||
log.info("-------- 标签相关结束 -------");
|
||||
log.info("-------- 标签相关结束 ------newtags = {} " , dto.getCourse().getTags());
|
||||
|
||||
if(StringUtils.isBlank(dto.getCourse().getId())) {
|
||||
//只有在第一次添加保存时才会这样
|
||||
|
||||
@@ -13,10 +13,7 @@ import com.xboe.module.course.dto.CourseTeacherDto;
|
||||
import com.xboe.module.course.dto.RankingDto;
|
||||
import com.xboe.module.course.dto.TeacherCourseDto;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseSectionService;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.course.service.ICourseTeacherService;
|
||||
import com.xboe.module.course.service.*;
|
||||
import com.xboe.module.course.vo.CourseStudyVo;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.teacher.entity.Teacher;
|
||||
@@ -33,6 +30,7 @@ import com.xboe.system.user.entity.User;
|
||||
import com.xboe.system.user.service.IUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -97,6 +95,8 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
|
||||
@Autowired
|
||||
StringRedisTemplate redisTemplate;
|
||||
@Resource
|
||||
private ICourseTagService courseTagService;
|
||||
|
||||
/**
|
||||
* 根据多个课程id返回对应的课程的图片.返回结果如下,
|
||||
@@ -261,7 +261,14 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
if(course==null || course.getDeleted()){
|
||||
return badRequest("课程不存在或已被删除");
|
||||
}
|
||||
rs.put("course",course);
|
||||
Course course1 = new Course();
|
||||
BeanUtils.copyProperties(course,course1);
|
||||
if (StringUtils.isNotBlank(course.getTags()) && course.getTags().matches("[0-9,]+")) {
|
||||
List<CourseTag> tagList = courseTagService.getTagsByIds(course.getTags());
|
||||
String tags = tagList.stream().map(CourseTag::getTagName).collect(Collectors.joining(","));
|
||||
course1.setTags(tags);
|
||||
}
|
||||
rs.put("course",course1);
|
||||
|
||||
List<CourseCrowd> courseCrowdList = courseService.findCrowdByCourseId(id);
|
||||
if(crowd!=null && crowd) {
|
||||
|
||||
@@ -348,5 +348,7 @@ public interface ICourseService {
|
||||
|
||||
Boolean getCourseTip(String aid);
|
||||
|
||||
void rePublish(String courseId);
|
||||
|
||||
// void getPhpCourseData();
|
||||
}
|
||||
|
||||
@@ -893,11 +893,6 @@ public class CourseServiceImpl implements ICourseService {
|
||||
public Course getAddView(String id) {
|
||||
Course c = courseDao.get(id);
|
||||
courseDao.updateFieldById(id, "views", c.getViews() + 1);
|
||||
if (StringUtils.isNotBlank(c.getTags()) && c.getTags().matches("[0-9,]+")) {
|
||||
List<CourseTag> tagList = courseTagService.getTagsByIds(c.getTags());
|
||||
String tags = tagList.stream().map(CourseTag::getTagName).collect(Collectors.joining(","));
|
||||
c.setTags(tags);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -1028,13 +1023,12 @@ public class CourseServiceImpl implements ICourseService {
|
||||
}*/
|
||||
|
||||
if (!nowCourse.getSysVersion().equals(c.getSysVersion())) {
|
||||
log.warn("乐观锁冲突 - 课程ID: {}, 期望版本: {}, 实际版本: {}",
|
||||
log.warn(" - 课程ID: {}, 期望版本: {}, 实际版本: {}",
|
||||
c.getId(), c.getSysVersion(), nowCourse.getSysVersion());
|
||||
// throw new RuntimeException("数据已被其他用户修改,请刷新页面后重试");
|
||||
// 基本无概率同时修改同一课程 如有 以最后提交为准
|
||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||
}
|
||||
|
||||
log.info("-------- 课程保存 update ------- tag = {} " , c.getTags());
|
||||
courseDao.update(c);
|
||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||
full.getCourse().setSysVersion(c.getSysVersion());
|
||||
@@ -1132,6 +1126,13 @@ public class CourseServiceImpl implements ICourseService {
|
||||
Course c = full.getCourse();//当前的课程信息
|
||||
c.setPublished(true);
|
||||
c.setPublishTime(LocalDateTime.now());
|
||||
Course nowCourse = courseDao.get(c.getId());
|
||||
if (!nowCourse.getSysVersion().equals(c.getSysVersion())) {
|
||||
log.warn(" - 课程ID: {}, 期望版本: {}, 实际版本: {}",
|
||||
c.getId(), c.getSysVersion(), nowCourse.getSysVersion());
|
||||
// 基本无概率同时修改同一课程 如有 以最后提交为准
|
||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||
}
|
||||
courseDao.update(c);
|
||||
|
||||
// 兼容处理,记录下删除的关联数据
|
||||
@@ -2116,4 +2117,10 @@ public class CourseServiceImpl implements ICourseService {
|
||||
}
|
||||
return true; //用户需要提示
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rePublish(String courseId) {
|
||||
Course c = courseDao.get(courseId);
|
||||
publishUtil.fullTextPublish(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,10 +410,12 @@ public class CourseTagServiceImpl implements ICourseTagService {
|
||||
log.info(" --- 标签修改 --- 用户信息 userInfo = {} " , userInfo);
|
||||
|
||||
// 获取新旧课程的标签ID列表
|
||||
log.info(" --- 旧标签1 oldTagIds = {} " , oldCourse.getTags());
|
||||
log.info(" --- 新修改1 newTagIds = {} " , newCourse.getTags());
|
||||
List<String> oldTagIds = getTagIdsFromCourse(oldCourse);
|
||||
List<String> newTagIds = getTagIdsFromCourse(newCourse);
|
||||
log.info(" --- 旧标签 oldTagIds = {} " , oldTagIds);
|
||||
log.info(" --- 新修改 newTagIds = {} " , newTagIds);
|
||||
log.info(" --- 旧标签2 oldTagIds = {} " , oldTagIds);
|
||||
log.info(" --- 新修改2 newTagIds = {} " , newTagIds);
|
||||
if (oldCourse == null || oldTagIds.isEmpty()) {
|
||||
// 新增课程 - 处理所有新标签
|
||||
handleNewCourseTags(newCourse, newTagIds, userInfo);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xboe.module.course.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @date 2025/11/17
|
||||
*/
|
||||
@Data
|
||||
public class RePublishVo {
|
||||
/**
|
||||
* 课程id
|
||||
* */
|
||||
private String courseId;
|
||||
}
|
||||
@@ -14,12 +14,15 @@ import com.boe.feign.api.infrastructure.entity.CommonSearchVo;
|
||||
import com.boe.feign.api.infrastructure.entity.Dict;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.constants.CacheName;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.service.ICourseTagService;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.vo.StudyTimeVo;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -36,11 +39,6 @@ import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseContent;
|
||||
import com.xboe.module.course.entity.CourseCrowd;
|
||||
import com.xboe.module.course.entity.CourseSection;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseSectionService;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
@@ -102,6 +100,8 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
|
||||
@Autowired
|
||||
StringRedisTemplate redisTemplate;
|
||||
@Resource
|
||||
private ICourseTagService courseTagService;
|
||||
|
||||
/**
|
||||
* 用于查询课程的学习记录
|
||||
@@ -169,7 +169,14 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
if(course==null || course.getDeleted()){
|
||||
return badRequest("课程不存在或已被删除");
|
||||
}
|
||||
rs.put("course",course);
|
||||
Course course1 = new Course();
|
||||
BeanUtils.copyProperties(course,course1);
|
||||
if (StringUtils.isNotBlank(course.getTags()) && course.getTags().matches("[0-9,]+")) {
|
||||
List<CourseTag> tagList = courseTagService.getTagsByIds(course.getTags());
|
||||
String tags = tagList.stream().map(CourseTag::getTagName).collect(Collectors.joining(","));
|
||||
course1.setTags(tags);
|
||||
}
|
||||
rs.put("course",course1);
|
||||
|
||||
List<CourseCrowd> courseCrowdList = courseService.findCrowdByCourseId(cid);
|
||||
if(crowd!=null && crowd) {
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.xboe.common.beans.IdName;
|
||||
import com.xboe.common.beans.KeyValue;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.course.vo.RePublishVo;
|
||||
import com.xboe.school.study.dto.BatchSignup;
|
||||
import com.xboe.school.study.entity.StudySignup;
|
||||
import com.xboe.school.study.service.IStudySignupService;
|
||||
@@ -32,7 +34,8 @@ public class StudySignupRpcController extends ApiBaseController {
|
||||
|
||||
@Resource
|
||||
IStudySignupService signupService;
|
||||
|
||||
@Resource
|
||||
ICourseService courseService;
|
||||
/**
|
||||
* 批量添加学员
|
||||
*
|
||||
@@ -106,4 +109,18 @@ public class StudySignupRpcController extends ApiBaseController {
|
||||
return StringUtils.isBlank(string);
|
||||
}
|
||||
|
||||
@PostMapping("/rePublish")
|
||||
public JsonResponse<Boolean> rePublish(@RequestBody RePublishVo vo) {
|
||||
if(vo==null || StringUtils.isBlank(vo.getCourseId())) {
|
||||
return error("未指定id");
|
||||
}
|
||||
try {
|
||||
courseService.rePublish(vo.getCourseId());
|
||||
} catch (Exception e) {
|
||||
log.error("解绑重新发布", e);
|
||||
return error("解绑重新发布失败,请与管理员联系", e.getMessage());
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user