mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 20:06:51 +08:00
Merge branch '250331-bugfix-shl-newmaster' into release-20250328-master
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) {
|
||||||
|
|||||||
@@ -3,9 +3,16 @@ package com.xboe.school.study.api;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
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 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;
|
||||||
@@ -42,6 +49,15 @@ public class StudyCourseESApi extends ApiBaseController{
|
|||||||
@Autowired
|
@Autowired
|
||||||
IStudyCourseService service;
|
IStudyCourseService service;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
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;
|
||||||
|
|
||||||
@@ -54,13 +70,61 @@ 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);
|
||||||
|
|
||||||
|
handleCourseImage(rs);
|
||||||
|
|
||||||
return success(rs);
|
return success(rs);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
log.error("查询报名学习ES失败",e);
|
log.error("查询报名学习ES失败",e);
|
||||||
return error("查询失败",e.getMessage());
|
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})
|
@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
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ xboe:
|
|||||||
file:
|
file:
|
||||||
temp_path: /tmp
|
temp_path: /tmp
|
||||||
save_path: /home/www/elearning/upload
|
save_path: /home/www/elearning/upload
|
||||||
http_path: http://10.251.186.27/upload
|
http_path: https://u-pre.boe.com/upload
|
||||||
externalinterface:
|
externalinterface:
|
||||||
url:
|
url:
|
||||||
system: http://localhost:9091
|
system: http://localhost:9091
|
||||||
@@ -108,7 +108,9 @@ xboe:
|
|||||||
from: boeu_learning@boe.com.cn
|
from: boeu_learning@boe.com.cn
|
||||||
user:
|
user:
|
||||||
security:
|
security:
|
||||||
|
image:
|
||||||
|
course:
|
||||||
|
default: https://u-pre.boe.com/pc/images/bgimg/course.png
|
||||||
jasypt:
|
jasypt:
|
||||||
encryptor:
|
encryptor:
|
||||||
algorithm: PBEWithMD5AndDES
|
algorithm: PBEWithMD5AndDES
|
||||||
|
|||||||
Reference in New Issue
Block a user