mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-16 14:26:49 +08:00
Merge branch '250331-bugfix-shl-newmaster' into test
# Conflicts: # servers/boe-server-all/src/main/java/com/xboe/school/study/api/StudyCourseESApi.java
This commit is contained in:
@@ -341,8 +341,5 @@ public interface ICourseService {
|
|||||||
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
||||||
|
|
||||||
|
|
||||||
|
List<Course> findByIds(List<String> courseIds);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.stream.Stream;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.management.Query;
|
import javax.management.Query;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.xboe.api.ThirdApi;
|
import com.xboe.api.ThirdApi;
|
||||||
import com.xboe.core.orm.*;
|
import com.xboe.core.orm.*;
|
||||||
import com.xboe.school.study.dao.StudyCourseDao;
|
import com.xboe.school.study.dao.StudyCourseDao;
|
||||||
@@ -1568,6 +1569,13 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
return list;
|
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
|
@Override
|
||||||
public int countWaitAudit(String aid) {
|
public int countWaitAudit(String aid) {
|
||||||
|
|||||||
@@ -5,7 +5,13 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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 cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.xboe.core.orm.FieldFilters;
|
import com.xboe.core.orm.FieldFilters;
|
||||||
@@ -15,6 +21,7 @@ import com.xboe.module.course.dto.RankingDto;
|
|||||||
import com.xboe.module.course.entity.Course;
|
import com.xboe.module.course.entity.Course;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -51,8 +58,14 @@ public class StudyCourseESApi extends ApiBaseController{
|
|||||||
@Autowired
|
@Autowired
|
||||||
IStudyCourseService service;
|
IStudyCourseService service;
|
||||||
|
|
||||||
@Resource
|
@Autowired
|
||||||
private CourseDao courseDao;
|
ICourseService courseService;
|
||||||
|
|
||||||
|
@Value("${xboe.upload.file.http_path}")
|
||||||
|
private String httpPath;
|
||||||
|
|
||||||
|
@Value("${xboe.image.course.default}")
|
||||||
|
private String defaultCourseImage;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PhpOnlineStudyRecordScheduledTasks phpOnlineStudyRecordScheduledTasks;
|
private PhpOnlineStudyRecordScheduledTasks phpOnlineStudyRecordScheduledTasks;
|
||||||
@@ -66,58 +79,9 @@ public class StudyCourseESApi extends ApiBaseController{
|
|||||||
try {
|
try {
|
||||||
dto.setAccountId(getCurrent().getAccountId());
|
dto.setAccountId(getCurrent().getAccountId());
|
||||||
PageList<CourseStudyDto> rs=search.search(page.getStartRow(),page.getPageSize(), dto);
|
PageList<CourseStudyDto> rs=search.search(page.getStartRow(),page.getPageSize(), dto);
|
||||||
List<CourseStudyDto> list = rs.getList();
|
|
||||||
List<String> emptyIds = new ArrayList<>();
|
|
||||||
log.info("test data gengxin CourseStudyDto list ==> {}", JSON.toJSONString(list));
|
|
||||||
if(CollectionUtil.isNotEmpty(list)){
|
|
||||||
log.info("test data gengxin CourseStudyDto isNotEmpty list ==> {}", JSON.toJSONString(list));
|
|
||||||
//todo 过滤数据
|
|
||||||
for(CourseStudyDto courseStudyDto : list){
|
|
||||||
log.info("test data gengxin CourseStudyDto isNotEmpty item ==> {}", JSON.toJSONString(courseStudyDto));
|
|
||||||
//在线课 录播课
|
|
||||||
if(courseStudyDto.getCourseType() == 20 || courseStudyDto.getCourseType() == 21){
|
|
||||||
if(StringUtils.isBlank(courseStudyDto.getCourseImage())){
|
|
||||||
emptyIds.add(courseStudyDto.getCourseId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//todo 图片空返回结果
|
|
||||||
List<CourseStudyDto> emptyImgCourseStudyDtos = new ArrayList();
|
|
||||||
|
|
||||||
//在线课查询
|
handleCourseImage(rs);
|
||||||
if(CollectionUtil.isNotEmpty(emptyIds)){
|
|
||||||
QueryBuilder query = QueryBuilder.from(Course.class);
|
|
||||||
query.addFields("id","name","type","coverImg");
|
|
||||||
//todo 确认下 是否是这个字段
|
|
||||||
query.addFilter(FieldFilters.in("id",emptyIds));
|
|
||||||
query.addFilter(FieldFilters.eq("enabled",true));
|
|
||||||
query.addFilter(FieldFilters.eq("deleted",false));
|
|
||||||
List<Object[]> listFields = courseDao.findListFields(query.builder());
|
|
||||||
log.info("test data gengxin CourseStudyDto isNotEmpty listFields ==> {}", JSON.toJSONString(listFields));
|
|
||||||
if(CollectionUtil.isNotEmpty(listFields)){
|
|
||||||
for(Object[] objs : listFields) {
|
|
||||||
CourseStudyDto CourseStudyDtoResult=new CourseStudyDto();
|
|
||||||
CourseStudyDtoResult.setId((String) objs[0]);
|
|
||||||
CourseStudyDtoResult.setCourseName((String)objs[1]);
|
|
||||||
CourseStudyDtoResult.setCourseType((Integer) objs[2]);
|
|
||||||
CourseStudyDtoResult.setCourseImage((String)objs[3]);
|
|
||||||
emptyImgCourseStudyDtos.add(CourseStudyDtoResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.info("test data gengxin CourseStudyDto isNotEmpty emptyImgCourseStudyDtos ==> {}", JSON.toJSONString(emptyImgCourseStudyDtos));
|
|
||||||
|
|
||||||
//todo 进行赋值处理 最外层
|
|
||||||
emptyImgCourseStudyDtos.forEach(item -> {
|
|
||||||
list.forEach(subjectItem -> {
|
|
||||||
if(item.getCourseId().equals(subjectItem.getCourseId())){
|
|
||||||
//赋值
|
|
||||||
subjectItem.setCourseImage(item.getCourseImage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
log.info("test data gengxin CourseStudyDto isNotEmpty result ==> {}", JSON.toJSONString(list));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return success(rs);
|
return success(rs);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
log.error("查询报名学习ES失败",e);
|
log.error("查询报名学习ES失败",e);
|
||||||
@@ -125,6 +89,51 @@ public class StudyCourseESApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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})
|
@RequestMapping(value="/list-by-ids",method = {RequestMethod.POST})
|
||||||
public JsonResponse<List<StudyCourse>> search(@RequestBody List<String> ids){
|
public JsonResponse<List<StudyCourse>> search(@RequestBody List<String> ids){
|
||||||
if(ids.isEmpty()) {
|
if(ids.isEmpty()) {
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ xboe:
|
|||||||
encryptor:
|
encryptor:
|
||||||
algorithm: PBEWithMD5AndDES
|
algorithm: PBEWithMD5AndDES
|
||||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||||
|
image:
|
||||||
|
course:
|
||||||
|
default: http://192.168.0.253/pc/images/bgimg/course.png
|
||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
||||||
|
|||||||
@@ -108,7 +108,9 @@ xboe:
|
|||||||
from: boeu_learning@boe.com.cn
|
from: boeu_learning@boe.com.cn
|
||||||
user:
|
user:
|
||||||
security:
|
security:
|
||||||
|
image:
|
||||||
|
course:
|
||||||
|
default: http://10.251.132.75/pc/images/bgimg/course.png
|
||||||
jasypt:
|
jasypt:
|
||||||
encryptor:
|
encryptor:
|
||||||
algorithm: PBEWithMD5AndDES
|
algorithm: PBEWithMD5AndDES
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ xboe:
|
|||||||
encryptor:
|
encryptor:
|
||||||
algorithm: PBEWithMD5AndDES
|
algorithm: PBEWithMD5AndDES
|
||||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||||
|
image:
|
||||||
|
course:
|
||||||
|
default: https://u.boe.com/pc/images/bgimg/course.png
|
||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
||||||
|
|||||||
@@ -108,7 +108,9 @@ xboe:
|
|||||||
from: boeu_learning@boe.com.cn
|
from: boeu_learning@boe.com.cn
|
||||||
user:
|
user:
|
||||||
security:
|
security:
|
||||||
|
image:
|
||||||
|
course:
|
||||||
|
default: http://10.251.186.27/pc/images/bgimg/course.png
|
||||||
jasypt:
|
jasypt:
|
||||||
encryptor:
|
encryptor:
|
||||||
algorithm: PBEWithMD5AndDES
|
algorithm: PBEWithMD5AndDES
|
||||||
|
|||||||
Reference in New Issue
Block a user