fix: 导出的score四舍五入

This commit is contained in:
liu.zixi
2025-12-19 17:53:34 +08:00
parent b2bfcbeda8
commit 1bb5b95ad9

View File

@@ -300,7 +300,7 @@ public class CoursePageServiceImpl implements ICoursePageService {
map.put("courseDuration", coursePageVo.getCourseDuration() / 60);
map.put("studys", coursePageVo.getStudys());
// 课程评分显示1位小数四舍五入
map.put("score", coursePageVo.getScore() == null ? "0.0" : String.format("%.1f", coursePageVo.getScore()));
map.put("score", coursePageVo.getScore() == null ? "0.0" : String.format("%.1f", Math.round(coursePageVo.getScore() * 10.0) / 10.0));
map.put("status", CourseStatusEnum.getByCode(coursePageVo.getStatus()).getLabel());
map.put("published", coursePageVo.getPublished() == null || !coursePageVo.getPublished() ? "未发布" : "已发布");
map.put("enabled", coursePageVo.getEnabled() == null || !coursePageVo.getEnabled() ? "停用" : "启用");