|
|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
|
package com.xboe.module.course.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
@@ -19,6 +20,11 @@ import com.xboe.core.orm.*;
|
|
|
|
|
import com.xboe.school.study.dao.StudyCourseDao;
|
|
|
|
|
import com.xboe.school.study.entity.StudyCourse;
|
|
|
|
|
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.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
@@ -115,6 +121,9 @@ public class CourseServiceImpl implements ICourseService {
|
|
|
|
|
@Autowired(required = false)
|
|
|
|
|
private IEventDataSender eventSender;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
RestHighLevelClient restHighLevelClient;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -448,6 +457,7 @@ public class CourseServiceImpl implements ICourseService {
|
|
|
|
|
List<Course> paginate = paginate(listByFilters2, pageIndex, pageSize);
|
|
|
|
|
PageList<Course> rs = new PageList<>();
|
|
|
|
|
rs.setCount(listByFilters2.size());
|
|
|
|
|
rs.setPageSize(pageSize);
|
|
|
|
|
rs.setList(paginate);
|
|
|
|
|
return rs;
|
|
|
|
|
}
|
|
|
|
|
@@ -853,12 +863,14 @@ public class CourseServiceImpl implements ICourseService {
|
|
|
|
|
log.error("未配置事件消息发送的实现");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 删除ES数据
|
|
|
|
|
deletedStudyResourceBatchByCourseIdAndType(id,c.getType());
|
|
|
|
|
} else {
|
|
|
|
|
//彻底删除,课件设置为无课程状态
|
|
|
|
|
courseDao.setDeleted(id);
|
|
|
|
|
}
|
|
|
|
|
//记录删除日志信息
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -1978,5 +1990,17 @@ public class CourseServiceImpl implements ICourseService {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|