mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 20:06:51 +08:00
Compare commits
7 Commits
250331-bug
...
master-202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5836b147c4 | ||
|
|
4fff780970 | ||
|
|
47813ea565 | ||
|
|
5aa62de3cb | ||
|
|
a309bc1ddf | ||
|
|
6af4cdfc75 | ||
|
|
2a2759768b |
@@ -98,7 +98,8 @@ public class ThirdApi {
|
|||||||
private String syncOnLineScore;
|
private String syncOnLineScore;
|
||||||
@Value("${coursesuilt.updateOnLineStatua}")
|
@Value("${coursesuilt.updateOnLineStatua}")
|
||||||
private String updateOnLineStatua;
|
private String updateOnLineStatua;
|
||||||
|
@Value("${coursesuilt.delOnLineById}")
|
||||||
|
private String delOnLineById;
|
||||||
|
|
||||||
//获取例外人员的id
|
//获取例外人员的id
|
||||||
public List<String> getUserId() {
|
public List<String> getUserId() {
|
||||||
@@ -398,4 +399,12 @@ public class ThirdApi {
|
|||||||
public void syncExamStudyRecord(ExamStudyRecordParam param) {
|
public void syncExamStudyRecord(ExamStudyRecordParam param) {
|
||||||
externalRemoteClient.syncExamStudyRecord(param);
|
externalRemoteClient.syncExamStudyRecord(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delOnLineById(CourseParam param, String token) {
|
||||||
|
log.info("---------------同步在线课删除 ------- param " + param);
|
||||||
|
String resp = Optional.ofNullable(
|
||||||
|
HttpRequest.post(delOnLineById).body(JSONUtil.toJsonStr(param)).header("token", token).execute()
|
||||||
|
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||||
|
log.info("-------delOnLineById = " + resp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -886,7 +886,7 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
public JsonResponse<Boolean> delete(String id,Boolean erasable,String title,String remark){
|
public JsonResponse<Boolean> delete(String id,Boolean erasable,String title,String remark, HttpServletRequest request){
|
||||||
if(StringUtils.isBlank(id)){
|
if(StringUtils.isBlank(id)){
|
||||||
return badRequest("参数错误");
|
return badRequest("参数错误");
|
||||||
}
|
}
|
||||||
@@ -901,6 +901,11 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
try {
|
try {
|
||||||
CurrentUser cu=getCurrent();
|
CurrentUser cu=getCurrent();
|
||||||
courseService.delete(id, erasable,cu.getAccountId(), cu.getName(), remark);
|
courseService.delete(id, erasable,cu.getAccountId(), cu.getName(), remark);
|
||||||
|
|
||||||
|
String token = request.getHeader("Xboe-Access-Token");
|
||||||
|
CourseParam param = new CourseParam();
|
||||||
|
param.setId(id);
|
||||||
|
thirdApi.delOnLineById(param,token);
|
||||||
return success(true);
|
return success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("管理员删除课程错误",e);
|
log.error("管理员删除课程错误",e);
|
||||||
|
|||||||
@@ -341,8 +341,6 @@ public interface ICourseService {
|
|||||||
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
||||||
|
|
||||||
|
|
||||||
|
List<Course> findByIds(List<String> courseIds);
|
||||||
|
void deletedStudyResourceBatchByCourseIdAndType(String courseId,Integer courseType);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.xboe.module.course.service.impl;
|
package com.xboe.module.course.service.impl;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@@ -14,11 +15,17 @@ 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;
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.elasticsearch.client.RequestOptions;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
|
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
|
||||||
import org.hibernate.mapping.IdGenerator;
|
import org.hibernate.mapping.IdGenerator;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
@@ -115,6 +122,9 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private IEventDataSender eventSender;
|
private IEventDataSender eventSender;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
RestHighLevelClient restHighLevelClient;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -854,12 +864,14 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
log.error("未配置事件消息发送的实现");
|
log.error("未配置事件消息发送的实现");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除ES数据
|
||||||
|
deletedStudyResourceBatchByCourseIdAndType(id,c.getType());
|
||||||
} else {
|
} else {
|
||||||
//彻底删除,课件设置为无课程状态
|
//彻底删除,课件设置为无课程状态
|
||||||
courseDao.setDeleted(id);
|
courseDao.setDeleted(id);
|
||||||
}
|
}
|
||||||
//记录删除日志信息
|
//记录删除日志信息
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1568,6 +1580,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) {
|
||||||
@@ -1979,5 +1998,17 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
return courseDao.findListByHql("Select new Course(id,studys,score) from Course where id in(?1)", ids);
|
return courseDao.findListByHql("Select new Course(id,studys,score) from Course where id in(?1)", ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deletedStudyResourceBatchByCourseIdAndType(String courseId, Integer courseType) {
|
||||||
|
DeleteByQueryRequest request = new DeleteByQueryRequest("new_study_resource");
|
||||||
|
BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
|
||||||
|
boolQueryBuilder.must(QueryBuilders.matchQuery("courseId", courseId));
|
||||||
|
boolQueryBuilder.must(QueryBuilders.matchQuery("courseType", courseType));
|
||||||
|
request.setQuery(boolQueryBuilder);
|
||||||
|
try {
|
||||||
|
restHighLevelClient.deleteByQuery(request, RequestOptions.DEFAULT);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,6 +70,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);
|
||||||
|
|
||||||
|
handleCourseImage(rs);
|
||||||
|
|
||||||
return success(rs);
|
return success(rs);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
log.error("查询报名学习ES失败",e);
|
log.error("查询报名学习ES失败",e);
|
||||||
@@ -61,6 +80,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()) {
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ public class StudyCourseItem extends IdEntity {
|
|||||||
/**
|
/**
|
||||||
* 视频播放进度
|
* 视频播放进度
|
||||||
* */
|
* */
|
||||||
|
// @Column(name = "progress_video")
|
||||||
@Transient
|
@Transient
|
||||||
private BigDecimal progressVideo;
|
private BigDecimal progressVideo;
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -74,3 +74,4 @@ coursesuilt:
|
|||||||
syncCourseStudent: ${boe.domain}/manageApi/admin/teacherRecord/syncCourseStudent
|
syncCourseStudent: ${boe.domain}/manageApi/admin/teacherRecord/syncCourseStudent
|
||||||
syncOnLineScore: ${boe.domain}/manageApi/admin/teacherRecord/syncOnLineScore
|
syncOnLineScore: ${boe.domain}/manageApi/admin/teacherRecord/syncOnLineScore
|
||||||
updateOnLineStatua: ${boe.domain}/manageApi/admin/teacherRecord/updateOnLineStatua
|
updateOnLineStatua: ${boe.domain}/manageApi/admin/teacherRecord/updateOnLineStatua
|
||||||
|
delOnLineById: ${boe.domain}/manageApi/admin/teacherRecord/delOnLineById
|
||||||
Reference in New Issue
Block a user