mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-12 12:26:51 +08:00
fix: 【FCJDFDXTXS-82】修正置顶及置顶排序的逻辑
This commit is contained in:
@@ -149,7 +149,8 @@ public class CoursePageServiceImpl implements ICoursePageService {
|
||||
}
|
||||
return courseList.stream()
|
||||
.map(c -> convertToVo(c, courseTeacherList))
|
||||
.sorted(Comparator.comparing(CoursePageVo::getSortWeight, Comparator.nullsLast(Comparator.naturalOrder())))
|
||||
.sorted(Comparator.comparing(CoursePageVo::getSortWeight, Comparator.nullsLast(Comparator.naturalOrder()))
|
||||
.thenComparing(CoursePageVo::getTopTime, Comparator.nullsLast(Comparator.reverseOrder())))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -173,7 +174,8 @@ public class CoursePageServiceImpl implements ICoursePageService {
|
||||
// 2.3 设置置顶
|
||||
courseDao.updateMultiFieldById(courseId,
|
||||
UpdateBuilder.create("isTop", top),
|
||||
UpdateBuilder.create("topTime", LocalDateTime.now()));
|
||||
UpdateBuilder.create("topTime", LocalDateTime.now()),
|
||||
UpdateBuilder.create("sortWeight", 0));
|
||||
} else {
|
||||
// 3. 取消置顶
|
||||
// 3.1 课程是否已置顶
|
||||
@@ -380,17 +382,21 @@ public class CoursePageServiceImpl implements ICoursePageService {
|
||||
vo.setSysCreateBy(course.getSysCreateBy());
|
||||
vo.setCreateFrom(course.getCreateFrom());
|
||||
vo.setSysCreateTime(course.getSysCreateTime());
|
||||
vo.setSysUpdateTime(course.getSysUpdateTime());
|
||||
vo.setForUsers(course.getForUsers());
|
||||
vo.setStatus(course.getStatus());
|
||||
// auditType 需要从其他地方获取,这里暂时设置为默认值
|
||||
vo.setAuditType(1);
|
||||
vo.setPublished(course.getPublished());
|
||||
vo.setPublishTime(course.getPublishTime());
|
||||
vo.setStudys(course.getStudys());
|
||||
vo.setScore(course.getScore());
|
||||
// courseDuration 需要计算,这里暂时设置为默认值
|
||||
vo.setCourseDuration(course.getCourseDuration());
|
||||
vo.setEnabled(course.getEnabled());
|
||||
vo.setSortWeight(course.getSortWeight());
|
||||
vo.setTopTime(course.getTopTime());
|
||||
vo.setIsTop(course.getIsTop());
|
||||
|
||||
// 获取教师名称
|
||||
List<String> teacherNames = courseTeacherList.stream()
|
||||
|
||||
@@ -173,6 +173,13 @@ public class CoursePageVo {
|
||||
*/
|
||||
private Boolean isTop;
|
||||
|
||||
/**
|
||||
* 置顶时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime topTime;
|
||||
|
||||
/**
|
||||
* 排序权重
|
||||
*/
|
||||
@@ -184,4 +191,4 @@ public class CoursePageVo {
|
||||
* TODO 在线课优化二期会对此字段进行其他的赋值操作
|
||||
*/
|
||||
private Boolean isPermission = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user