Compare commits

..

1 Commits

Author SHA1 Message Date
sunhonglai
cdf9698f71 修改注解 2025-04-07 15:09:04 +08:00
8 changed files with 8 additions and 88 deletions

View File

@@ -341,5 +341,8 @@ public interface ICourseService {
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
List<Course> findByIds(List<String> courseIds);
}

View File

@@ -14,7 +14,6 @@ import java.util.stream.Stream;
import javax.annotation.Resource;
import javax.management.Query;
import cn.hutool.core.collection.CollectionUtil;
import com.xboe.api.ThirdApi;
import com.xboe.core.orm.*;
import com.xboe.school.study.dao.StudyCourseDao;
@@ -1569,13 +1568,6 @@ public class CourseServiceImpl implements ICourseService {
return list;
}
@Override
public List<Course> findByIds(List<String> courseIds) {
QueryBuilder query = QueryBuilder.from(Course.class);
query.addFilter(FieldFilters.in("id", courseIds));
return courseDao.findList(query.builder());
}
@Override
public int countWaitAudit(String aid) {

View File

@@ -3,16 +3,9 @@ package com.xboe.school.study.api;
import java.io.IOException;
import java.time.ZoneOffset;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import com.xboe.module.course.entity.Course;
import com.xboe.module.course.service.ICourseService;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -49,15 +42,6 @@ public class StudyCourseESApi extends ApiBaseController{
@Autowired
IStudyCourseService service;
@Autowired
ICourseService courseService;
@Value("${xboe.upload.file.http_path}")
private String httpPath;
@Value("${xboe.image.course.default}")
private String defaultCourseImage;
@Resource
private PhpOnlineStudyRecordScheduledTasks phpOnlineStudyRecordScheduledTasks;
@@ -70,61 +54,13 @@ public class StudyCourseESApi extends ApiBaseController{
try {
dto.setAccountId(getCurrent().getAccountId());
PageList<CourseStudyDto> rs=search.search(page.getStartRow(),page.getPageSize(), dto);
handleCourseImage(rs);
return success(rs);
}catch(Exception e) {
log.error("查询报名学习ES失败",e);
return error("查询失败",e.getMessage());
}
}
private void handleCourseImage(PageList<CourseStudyDto> rs) {
if (rs == null || CollectionUtil.isEmpty(rs.getList())) {
return;
}
List<String> emptyImageCourseIds = Lists.newArrayList();
for(CourseStudyDto courseStudyDto : rs.getList()) {
if(StringUtils.isBlank(courseStudyDto.getCourseImage())) {
// 过滤课程类型
if(courseStudyDto.getCourseType()==10
|| courseStudyDto.getCourseType()==20){
emptyImageCourseIds.add(courseStudyDto.getCourseId());
}else{
log.warn("课程图片为空课程id为{},课程类型:{}",courseStudyDto.getCourseId(),courseStudyDto.getCourseType());
}
}
}
if(CollectionUtil.isEmpty(emptyImageCourseIds)){
return;
}
List<Course> courseList = courseService.findByIds(emptyImageCourseIds);
if(CollectionUtil.isNotEmpty(courseList)){
// courseList转换成map
Map<String, Course> courseMap = courseList.stream().collect(Collectors.toMap(Course::getId, course -> course));
// 赋值ES图片
for(CourseStudyDto courseStudyDto : rs.getList()) {
if(emptyImageCourseIds.contains(courseStudyDto.getCourseId())) {
Course currentCourse = courseMap.get(courseStudyDto.getCourseId());
if(null!=currentCourse){
if(StringUtils.isNotBlank(currentCourse.getCoverImg())){
// 拼接域名
courseStudyDto.setCourseImage(httpPath + currentCourse.getCoverImg());
}else{
// 赋值默认图片
courseStudyDto.setCourseImage(defaultCourseImage);
}
}
}
}
}
}
@RequestMapping(value="/list-by-ids",method = {RequestMethod.POST})
public JsonResponse<List<StudyCourse>> search(@RequestBody List<String> ids){
if(ids.isEmpty()) {

View File

@@ -134,7 +134,6 @@ public class StudyCourseItem extends IdEntity {
/**
* 视频播放进度
* */
// @Column(name = "progress_video")
@Transient
private BigDecimal progressVideo;

View File

@@ -76,9 +76,6 @@ xboe:
encryptor:
algorithm: PBEWithMD5AndDES
iv-generator-classname: org.jasypt.iv.NoIvGenerator
image:
course:
default: http://192.168.0.253/pc/images/bgimg/course.png
xxl:
job:
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0

View File

@@ -108,9 +108,7 @@ xboe:
from: boeu_learning@boe.com.cn
user:
security:
image:
course:
default: http://10.251.132.75/pc/images/bgimg/course.png
jasypt:
encryptor:
algorithm: PBEWithMD5AndDES

View File

@@ -74,9 +74,6 @@ xboe:
encryptor:
algorithm: PBEWithMD5AndDES
iv-generator-classname: org.jasypt.iv.NoIvGenerator
image:
course:
default: https://u.boe.com/pc/images/bgimg/course.png
xxl:
job:
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0

View File

@@ -84,7 +84,7 @@ xboe:
file:
temp_path: /tmp
save_path: /home/www/elearning/upload
http_path: https://u-pre.boe.com/upload
http_path: http://10.251.186.27/upload
externalinterface:
url:
system: http://localhost:9091
@@ -108,9 +108,7 @@ xboe:
from: boeu_learning@boe.com.cn
user:
security:
image:
course:
default: https://u-pre.boe.com/pc/images/bgimg/course.png
jasypt:
encryptor:
algorithm: PBEWithMD5AndDES