mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
Compare commits
34 Commits
20250912-t
...
20250916-f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
880a9b5cc9 | ||
|
|
ab60d845e0 | ||
|
|
80aaeb8d1d | ||
|
|
68fcde11fb | ||
|
|
57dc5262fb | ||
|
|
62bda8bd58 | ||
|
|
8403678d0d | ||
|
|
02c0fa13dd | ||
|
|
de96d311c6 | ||
|
|
2456820251 | ||
|
|
12c07faf2a | ||
|
|
fea28d8832 | ||
|
|
249a8d81a6 | ||
|
|
7abb00772b | ||
|
|
04e11f2e71 | ||
|
|
2feb149e92 | ||
|
|
16fa9cb028 | ||
|
|
cac466ba73 | ||
|
|
30d2a0cde2 | ||
|
|
541e542d9b | ||
|
|
aa04e16209 | ||
|
|
57e22492e5 | ||
|
|
1917647a99 | ||
|
|
f5f7ab3bc5 | ||
|
|
413a2ebc33 | ||
|
|
22db916abf | ||
|
|
8ce284ea7e | ||
|
|
c485757061 | ||
|
|
9a00b41cde | ||
|
|
59beaa5b74 | ||
|
|
9b9e97a8d4 | ||
|
|
200ec38038 | ||
|
|
7613f30ca7 | ||
|
|
248e0799bd |
@@ -45,10 +45,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
@@ -407,4 +404,20 @@ public class ThirdApi {
|
||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
log.info("-------delOnLineById = " + resp);
|
||||
}
|
||||
|
||||
//获取字典信息
|
||||
public List<Dict> getDictItems(CommonSearchVo searcher) {
|
||||
try {
|
||||
List<Dict> dictList = dictRemoteClient.getList(searcher);
|
||||
if(!Objects.isNull(dictList) && dictList.size() > 0){
|
||||
// List<String> dicts = dictList.stream().map(Dict::getValue).collect(Collectors.toList());
|
||||
return dictList;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("-------获取字典信息 = " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.data.outside.IOutSideDataService;
|
||||
import com.xboe.module.course.entity.CourseTag;
|
||||
import com.xboe.module.course.service.*;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.service.IStudyCourseService;
|
||||
@@ -36,6 +34,11 @@ import com.xboe.module.course.dto.CourseTeacherDto;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseCrowd;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.service.CourseToCourseFullText;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseFullTextSearch;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.course.service.ICourseTeacherService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -60,8 +63,7 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
ICourseFullTextSearch fullTextSearch;
|
||||
@Resource
|
||||
IOrganizationService organizationService;
|
||||
@Autowired
|
||||
ICourseTagService courseTagService;
|
||||
|
||||
@Resource
|
||||
IStudyCourseService IStudyCourseService;
|
||||
|
||||
@@ -308,18 +310,7 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
}
|
||||
|
||||
paras.setDevice(dto.getDevice());
|
||||
String tagIds = dto.getTags();
|
||||
if (tagIds != null && tagIds != ""){
|
||||
paras.setTags(tagIds);
|
||||
}else {
|
||||
String tagName = paras.getKeywords();
|
||||
if (tagName != null && tagName != ""){
|
||||
CourseTag courseTag = courseTagService.getTagByName(tagName);
|
||||
if (courseTag != null){
|
||||
paras.setTags(courseTag.getId().toString()+",");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
//后续会根据当前用户的资源归属查询
|
||||
PageList<CourseFullText> coursePageList = fullTextSearch.search(ICourseFullTextSearch.DEFAULT_INDEX_NAME,pager.getStartRow(), pager.getPageSize(),paras);
|
||||
@@ -412,24 +403,8 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
}
|
||||
// 获取课程对应的标签
|
||||
for (CourseFullText c : coursePageList.getList()){
|
||||
String tags = c.getTags();
|
||||
String[] split = tags.split(",",0);
|
||||
List<String> courseTagIds = new ArrayList<>();
|
||||
for (String tagId : split) {
|
||||
courseTagIds.add(tagId);
|
||||
}
|
||||
List<CourseTag> courseTags = courseTagService.getTagsByTagIds(courseTagIds);
|
||||
List<Map<String,Object>> tagList = new ArrayList<>();
|
||||
for (CourseTag courseTag : courseTags) {
|
||||
Map<String,Object> tag = new HashMap<>();
|
||||
tag.put("tagName", courseTag.getTagName());
|
||||
tag.put("id", courseTag.getId());
|
||||
tagList.add(tag);
|
||||
}
|
||||
c.setTagList(tagList);
|
||||
}
|
||||
|
||||
|
||||
return success(coursePageList);
|
||||
}catch(Exception e) {
|
||||
log.error("课程全文检索错误",e);
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.boe.feign.api.infrastructure.entity.CommonSearchVo;
|
||||
import com.boe.feign.api.infrastructure.entity.Dict;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.module.course.dto.*;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.service.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -30,6 +31,19 @@ import com.xboe.data.dto.UserOrgIds;
|
||||
import com.xboe.data.outside.IOutSideDataService;
|
||||
import com.xboe.data.service.IDataUserSyncService;
|
||||
import com.xboe.module.assistance.service.IEmailService;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseContent;
|
||||
import com.xboe.module.course.entity.CourseCrowd;
|
||||
import com.xboe.module.course.entity.CourseHRBPAudit;
|
||||
import com.xboe.module.course.entity.CourseSection;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.entity.CourseUpdateLog;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseCrowdService;
|
||||
import com.xboe.module.course.service.ICourseHRBPAuditService;
|
||||
import com.xboe.module.course.service.ICourseSectionService;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.course.service.ICourseTeacherService;
|
||||
import com.xboe.module.excel.ExportsExcelSenderUtil;
|
||||
import com.xboe.standard.enums.BoedxContentType;
|
||||
import com.xboe.standard.enums.BoedxCourseType;
|
||||
@@ -80,10 +94,10 @@ public class CourseManageApi extends ApiBaseController{
|
||||
|
||||
@Resource
|
||||
private ICourseHRBPAuditService hrbpAuditService;
|
||||
@Resource
|
||||
private ICourseTagService tagService;
|
||||
|
||||
@Resource
|
||||
IOutSideDataService outSideDataService;
|
||||
|
||||
@Autowired
|
||||
IDataUserSyncService userSyncService;
|
||||
@Resource
|
||||
@@ -158,23 +172,48 @@ public class CourseManageApi extends ApiBaseController{
|
||||
List<CourseSection> sectionlist=sectionService.getByCourseId(id);
|
||||
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(id);
|
||||
List<CourseCrowd> crowds=courseService.findCrowdByCourseId(id);
|
||||
if (StringUtils.isNotBlank(course.getTags())){
|
||||
List<CourseTag> tagList = tagService.getTagsByIds(course.getTags());
|
||||
rs.put("tagList", tagList);
|
||||
|
||||
CommonSearchVo searcher = new CommonSearchVo();
|
||||
searcher.setPid(637L);
|
||||
searcher.setType(1);
|
||||
List<Dict> dictList = thirdApi.getDictItems(searcher);
|
||||
boolean isPermission = false;
|
||||
if(dictList != null && dictList.size() > 0){
|
||||
List<String> dicts = dictList.stream().map(Dict::getValue).collect(Collectors.toList());
|
||||
isPermission = dicts.contains(course.getOrgId());
|
||||
rs.put("dicts",dicts);
|
||||
}
|
||||
|
||||
|
||||
log.error("-------是否仅内网查看 = " + isPermission);
|
||||
rs.put("course",course);
|
||||
rs.put("contents",cclist);
|
||||
rs.put("sections",sectionlist);
|
||||
rs.put("teachers",teachers);
|
||||
rs.put("crowds",crowds);
|
||||
rs.put("isPermission",isPermission);
|
||||
|
||||
|
||||
|
||||
return success(rs);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/getDictIds")
|
||||
public JsonResponse<Map<String,Object>> getDictIds(Long pid,Integer type){
|
||||
CommonSearchVo searcher = new CommonSearchVo();
|
||||
if(pid==null || type ==null){
|
||||
return badRequest("参数错误");
|
||||
}
|
||||
Map<String,Object> rs=new HashMap<String,Object>();
|
||||
searcher.setPid(pid);
|
||||
searcher.setType(type);
|
||||
List<Dict> dictList = thirdApi.getDictItems(searcher);
|
||||
rs.put("dicts",null);
|
||||
if(dictList != null && dictList.size() > 0){
|
||||
List<String> dicts = dictList.stream().map(Dict::getValue).collect(Collectors.toList());
|
||||
rs.put("dicts",dicts);
|
||||
}
|
||||
return success(rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员审核列表,教师的审核不在这里,此审核也应该移动CourseAuditApi中去
|
||||
* @param pager
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.xboe.module.course.api;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.IFieldFilter;
|
||||
import com.xboe.module.article.entity.Article;
|
||||
import com.xboe.module.article.service.IArticleService;
|
||||
import com.xboe.module.course.dto.CourseTagQueryDto;
|
||||
import com.xboe.module.course.dto.CourseTagRelationDto;
|
||||
import com.xboe.module.course.entity.CourseTag;
|
||||
import com.xboe.module.course.entity.CourseTagRelation;
|
||||
import com.xboe.module.course.service.ICourseTagService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName:CourseTagApi
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/7/2614:27
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping(value="/xboe/m/coursetag")
|
||||
public class CourseTagApi extends ApiBaseController {
|
||||
|
||||
@Resource
|
||||
ICourseTagService courseTagService;
|
||||
|
||||
/**
|
||||
* 标签列表:分页查询
|
||||
* @param pager
|
||||
* @param courseTagQueryDto
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/page",method= {RequestMethod.GET,RequestMethod.POST})
|
||||
public JsonResponse<PageList<CourseTag>> find(Pagination pager, CourseTagQueryDto courseTagQueryDto){
|
||||
List<IFieldFilter> filters=new ArrayList<IFieldFilter>();
|
||||
OrderCondition order = null;
|
||||
if (courseTagQueryDto != null){
|
||||
String tagId = courseTagQueryDto.getId();
|
||||
String tagName = courseTagQueryDto.getTagName();
|
||||
Boolean isHot = courseTagQueryDto.getIsHot();
|
||||
String orderField = courseTagQueryDto.getOrderField();
|
||||
Boolean isAsc = courseTagQueryDto.getOrderAsc();
|
||||
if (StringUtils.isNotBlank(tagId)){
|
||||
filters.add(FieldFilters.eq("id",tagId));
|
||||
}
|
||||
//课程标签名称:模糊查询
|
||||
if (StringUtils.isNotBlank(tagName)){
|
||||
filters.add(FieldFilters.like("tagName",tagName));
|
||||
}
|
||||
// 构建排序条件:支持先按lastSetHotTime降序,再按动态字段升/降序排列
|
||||
if (isHot !=null ){
|
||||
filters.add(FieldFilters.eq("isHot",isHot));
|
||||
//order = OrderCondition.desc("lastSetHotTime");//固定降序
|
||||
}
|
||||
// 动态排序处理
|
||||
if (StringUtils.isNotBlank(orderField)) {
|
||||
if (order == null) {
|
||||
order = isAsc ? OrderCondition.asc(orderField) : OrderCondition.desc(orderField);
|
||||
} else {
|
||||
order = isAsc ? order.asc(orderField) : order.desc(orderField); // 链式追加排序条件
|
||||
}
|
||||
}
|
||||
}
|
||||
PageList<CourseTag> list=courseTagService.query(pager.getPageIndex(),pager.getPageSize(),filters,order);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改指定id的课程标签的公共属性
|
||||
* @param id
|
||||
* @param isPublic
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/changePublicStatus",method= RequestMethod.POST)
|
||||
public JsonResponse<Void> changePublicStatus(Long id,Boolean isPublic){
|
||||
courseTagService.changePublicStatus(id,isPublic);
|
||||
return success(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改指定id的课程标签的热点属性
|
||||
* @param id
|
||||
* @param isHot
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/changeHotStatus",method= RequestMethod.POST)
|
||||
public JsonResponse<Boolean> changeHotStatus(Long id,Boolean isHot){
|
||||
return courseTagService.changeHotStatus(id,isHot);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询:指定id的标签关联的所有课程
|
||||
* @param courseTagQueryDto
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/showCourseByTag",method= RequestMethod.POST)
|
||||
public JsonResponse<PageList<CourseTagRelationDto>> showCourseByTag(Pagination pager, CourseTagQueryDto courseTagQueryDto){
|
||||
PageList<CourseTagRelationDto> list=null;
|
||||
if (courseTagQueryDto != null) {
|
||||
Long tagId = Long.valueOf(courseTagQueryDto.getId());
|
||||
Boolean isAsc = courseTagQueryDto.getOrderAsc()!=null?courseTagQueryDto.getOrderAsc():false;
|
||||
list=courseTagService.getCourseByTag(pager.getPageIndex(),pager.getPageSize(),tagId,isAsc);
|
||||
}
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解除指定id的课程和某个标签之间的关联关系
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/unbind",method= RequestMethod.POST)
|
||||
public JsonResponse<Void> unbindCourseTagRelation(CourseTagRelationDto courseTagRelationDto){
|
||||
if (courseTagRelationDto!=null){
|
||||
courseTagService.unbind(courseTagRelationDto.getId());
|
||||
return success(null);
|
||||
}
|
||||
return error("解绑失败!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 模糊检索标签
|
||||
* @return 符合检索条件的所有公共标签
|
||||
*/
|
||||
@RequestMapping(value="/searchTags",method= RequestMethod.POST)
|
||||
public JsonResponse<List<CourseTag>> searchTags(String tagName){
|
||||
if (StringUtils.isNotBlank(tagName)){
|
||||
List<CourseTag> courseTagList = courseTagService.searchTags(tagName);
|
||||
return success(courseTagList);
|
||||
}
|
||||
return error("服务器端异常!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建新标签,并与当前课程绑定
|
||||
* @param courseTagRelationDto
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/createTag",method= RequestMethod.POST)
|
||||
public JsonResponse<CourseTag> createTag(CourseTagRelationDto courseTagRelationDto){
|
||||
if (courseTagRelationDto!=null){
|
||||
CourseTag courseTag = courseTagService.createTag(courseTagRelationDto);
|
||||
return success(courseTag);
|
||||
}
|
||||
return error("创建标签失败!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建新标签,并与当前课程绑定
|
||||
* @param courseTagRelationDto
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getHotTagList",method= RequestMethod.POST)
|
||||
public JsonResponse<List<CourseTag>> getHotTagList(CourseTagRelationDto courseTagRelationDto){
|
||||
List<CourseTag> hotTagList = courseTagService.getHotTagList(courseTagRelationDto);
|
||||
return success(hotTagList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.xboe.module.course.dao;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.IFieldFilter;
|
||||
import com.xboe.core.orm.IQuery;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseFile;
|
||||
import com.xboe.module.course.entity.CourseTag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName:CourseTagDao
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/7/2516:50
|
||||
*/
|
||||
@Repository
|
||||
public class CourseTagDao extends BaseDao<CourseTag> {
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
|
||||
/**
|
||||
* 获取热门标签列表(前10条)
|
||||
* @return 热门标签列表
|
||||
*/
|
||||
public List<CourseTag> getHotTagList() {
|
||||
// 原生SQL:注意表名和列名需与数据库实际一致
|
||||
String sql = "select t.*,COUNT(r.tag_id) AS relation_count\n" +
|
||||
"from boe_course_tag t\n" +
|
||||
"left join boe_course_tag_relation r\n" +
|
||||
"on t.id = r.tag_id\n" +
|
||||
"where t.is_hot = true\n" +
|
||||
"GROUP BY t.id\n" +
|
||||
"order by t.last_set_hot_time desc,relation_count desc"; // 数据库字段为last_set_hot_time
|
||||
|
||||
// 创建原生查询并指定结果映射到CourseTag实体
|
||||
javax.persistence.Query query = entityManager.createNativeQuery(sql, CourseTag.class);
|
||||
|
||||
// 分页:取前10条
|
||||
query.setFirstResult(0);
|
||||
query.setMaxResults(10);
|
||||
|
||||
// 执行查询并返回结果(已映射为CourseTag类型)
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据课程类型获取热门标签列表(前10条)
|
||||
* @param sysType1 系统类型1
|
||||
* @param sysType2 系统类型2
|
||||
* @param sysType3 系统类型3
|
||||
* @return 热门标签列表
|
||||
*/
|
||||
public List<CourseTag> getHotTagListBySysTypes(String sysType1, String sysType2, String sysType3) {
|
||||
// 原生SQL:注意表名和列名需与数据库实际一致(此处假设表名为course_tag、course_type_tag_relation)
|
||||
String sql = "SELECT DISTINCT c.* FROM boe_course_tag c " +
|
||||
"JOIN boe_course_type_tag_relation r ON c.id = r.tag_id " +
|
||||
"WHERE r.deleted = 0 " +
|
||||
"AND c.is_hot = true "; // 假设数据库字段为is_hot(与实体属性isHot对应)
|
||||
if (StringUtils.isNotBlank(sysType1)){
|
||||
sql += "AND r.sys_type1 = ?1 ORDER BY c.last_set_hot_time DESC";
|
||||
}else if(StringUtils.isNotBlank(sysType2)){
|
||||
sql += "AND r.sys_type2 = ?1 ORDER BY c.last_set_hot_time DESC";
|
||||
}else {
|
||||
sql += "AND r.sys_type3 = ?1 ORDER BY c.last_set_hot_time DESC";
|
||||
}
|
||||
// 创建原生查询并指定结果映射到CourseTag实体
|
||||
javax.persistence.Query query = entityManager.createNativeQuery(sql, CourseTag.class);
|
||||
|
||||
// 绑定参数(注意参数索引从1开始)
|
||||
if (StringUtils.isNotBlank(sysType1)){
|
||||
query.setParameter(1, sysType1);
|
||||
} else if (StringUtils.isNotBlank(sysType2)) {
|
||||
query.setParameter(1, sysType2);
|
||||
}else {
|
||||
query.setParameter(1, sysType3);
|
||||
}
|
||||
// 分页:取前10条
|
||||
query.setFirstResult(0);
|
||||
query.setMaxResults(10);
|
||||
|
||||
// 执行查询并返回结果(已映射为CourseTag类型)
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
public List<CourseTag> getTagsByIds(String id) {
|
||||
String sql = "select * from " + SysConstant.TABLE_PRE + "course_tag where id in (" + id + "0)";
|
||||
// 创建原生查询并指定结果映射到CourseTag实体
|
||||
javax.persistence.Query query = entityManager.createNativeQuery(sql, CourseTag.class);
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
public CourseTag getTagByName(String tagName) {
|
||||
CourseTag courseTag = this.findOne((FieldFilters.eq("tag_name", tagName)));
|
||||
return courseTag;
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
package com.xboe.module.course.dao;
|
||||
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.course.dto.CourseTagRelationDto;
|
||||
import com.xboe.module.course.entity.CourseTagRelation;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName:CourseTagRelationDao
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/7/2815:09
|
||||
*/
|
||||
@Repository
|
||||
public class CourseTagRelationDao extends BaseDao<CourseTagRelation> {
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
|
||||
private String sqlStr = "SELECT " +
|
||||
" r1.id as id, " +
|
||||
" c.id as courseId, " +
|
||||
" r1.tag_id as tagId, " +
|
||||
" c.`name` as courseName, " +
|
||||
" r1.sys_create_by as sysCreateBy, " +
|
||||
" r1.sys_create_time as sysCreateTime, " +
|
||||
" COALESCE(GROUP_CONCAT(DISTINCT t.tag_name ORDER BY t.tag_name), '') AS otherTags " +
|
||||
"FROM " +
|
||||
" boe_course c " +
|
||||
"JOIN " +
|
||||
" boe_course_tag_relation r1 ON c.id = r1.course_id " +
|
||||
"LEFT JOIN " +
|
||||
" ( " +
|
||||
" boe_course_tag_relation r2 " +
|
||||
" JOIN boe_course_tag t ON r2.tag_id = t.id AND t.deleted = 0 " +
|
||||
" ) " +
|
||||
" ON c.id = r2.course_id AND r2.tag_id != r1.tag_id " +
|
||||
"WHERE " +
|
||||
" r1.tag_id = :tagId AND r1.deleted = 0 " +
|
||||
" AND c.id IN ( " +
|
||||
" SELECT course_id " +
|
||||
" FROM boe_course_tag_relation " +
|
||||
" WHERE tag_id = :tagId " +
|
||||
" ) " +
|
||||
"GROUP BY " +
|
||||
" c.id, c.`name` ";
|
||||
|
||||
public PageList<CourseTagRelationDto> findCoursesWithRelatedTagsDesc(Integer pageIndex, Integer pageSize, Long tagId){
|
||||
String sql = sqlStr + " ORDER BY r1.sys_create_time DESC";
|
||||
Query query = entityManager.createNativeQuery(sql);
|
||||
query.setParameter("tagId", tagId);
|
||||
query.setFirstResult((pageIndex - 1) * pageSize); // 设置起始位置
|
||||
query.setMaxResults(pageSize); // 设置每页大小
|
||||
|
||||
Query countQuery = entityManager.createNativeQuery(sql);
|
||||
countQuery.setParameter("tagId", tagId);
|
||||
List<Object[]> totalresults = countQuery.getResultList();
|
||||
|
||||
List<Object[]> results = query.getResultList();
|
||||
List<CourseTagRelationDto> list = results.stream()
|
||||
.map(row -> {
|
||||
String id = String.valueOf(row[0]);
|
||||
String courseId = String.valueOf(row[1]);
|
||||
String tagId2 = String.valueOf(row[2]);
|
||||
return new CourseTagRelationDto(
|
||||
id,
|
||||
courseId,
|
||||
tagId2,
|
||||
(String) row[3],
|
||||
(String) row[4],
|
||||
(Date) row[5],
|
||||
(String) row[6]
|
||||
);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return new PageList<CourseTagRelationDto>(list,totalresults!=null?totalresults.size():0);
|
||||
}
|
||||
|
||||
public PageList<CourseTagRelationDto> findCoursesWithRelatedTagsAsc(Integer pageIndex, Integer pageSize, Long tagId) {
|
||||
String sql = sqlStr + " ORDER BY r1.sys_create_time ASC";
|
||||
Query query = entityManager.createNativeQuery(sql);
|
||||
query.setParameter("tagId", tagId);
|
||||
query.setFirstResult((pageIndex - 1) * pageSize); // 设置起始位置
|
||||
query.setMaxResults(pageSize); // 设置每页大小
|
||||
|
||||
Query countQuery = entityManager.createNativeQuery(sql);
|
||||
countQuery.setParameter("tagId", tagId);
|
||||
List<Object[]> totalresults = countQuery.getResultList();
|
||||
|
||||
List<Object[]> results = query.getResultList();
|
||||
List<CourseTagRelationDto> list = results.stream()
|
||||
.map(row ->{
|
||||
String id = String.valueOf(row[0]);
|
||||
String courseId = String.valueOf(row[1]);
|
||||
String tagId2 = String.valueOf(row[2]);
|
||||
return new CourseTagRelationDto(
|
||||
id,
|
||||
courseId,
|
||||
tagId2,
|
||||
(String) row[3],
|
||||
(String) row[4],
|
||||
(Date) row[5],
|
||||
(String) row[6]
|
||||
);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return new PageList<CourseTagRelationDto>(list,totalresults!=null?totalresults.size():0);
|
||||
}
|
||||
|
||||
public boolean countHotTags() {
|
||||
String sql = "SELECT COUNT(*) FROM boe_course_tag WHERE is_hot = 1";
|
||||
Query query = entityManager.createNativeQuery(sql);
|
||||
Object result = query.getSingleResult();
|
||||
long count = Long.parseLong(result.toString());
|
||||
return count >= 10;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,27 @@
|
||||
package com.xboe.module.course.dao;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Repository
|
||||
public class CourseTeacherDao extends BaseDao<CourseTeacher> {
|
||||
|
||||
//List<CourseTeacher>
|
||||
//List<CourseTeacher>
|
||||
|
||||
public List<CourseTeacher> findByCourseId(String courseId) {
|
||||
try {
|
||||
return sqlFindList("SELECT * FROM boe_course_teacher WHERE course_id = ?1", courseId);
|
||||
} catch (Exception e) {
|
||||
log.warn("查询课程教师列表失败", e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xboe.module.course.dao;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.entity.CourseTeacherModifyRecord;
|
||||
import com.xboe.module.course.util.RequestIdUtil;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author guo jia
|
||||
*/
|
||||
@Repository
|
||||
public class CourseTeacherModifyRecordDao extends BaseDao<CourseTeacherModifyRecord> {
|
||||
|
||||
public void insertRecord(String type, String location, CourseTeacher courseTeacher, String body) {
|
||||
CourseTeacherModifyRecord entity = new CourseTeacherModifyRecord();
|
||||
entity.setRequestId(RequestIdUtil.getCurrentRequestId());
|
||||
entity.setType(type);
|
||||
entity.setLocation(location);
|
||||
entity.setTeacherId(courseTeacher.getTeacherId());
|
||||
entity.setTeacherName(courseTeacher.getTeacherName());
|
||||
entity.setCourseId(courseTeacher.getCourseId());
|
||||
entity.setBody(body);
|
||||
entity.setDeleted(0);
|
||||
entity.setCreateTime(LocalDateTime.now());
|
||||
entity.setUpdateTime(LocalDateTime.now());
|
||||
save(entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.xboe.module.course.dao;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.course.entity.CourseTagRelation;
|
||||
import com.xboe.module.course.entity.CourseTypeTagRelation;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @ClassName:CourseTypeTagRelationDao
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/8/113:42
|
||||
*/
|
||||
@Repository
|
||||
public class CourseTypeTagRelationDao extends BaseDao<CourseTypeTagRelation> {
|
||||
|
||||
|
||||
}
|
||||
@@ -140,5 +140,4 @@ public class CourseQueryDto {
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
private String tags;
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.xboe.module.course.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 课程标签查询的条件对象
|
||||
* @ClassName:CourseTagQueryDto
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/7/2517:02
|
||||
*/
|
||||
@Data
|
||||
public class CourseTagQueryDto {
|
||||
|
||||
/**
|
||||
* 标签id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
private String tagName;
|
||||
|
||||
|
||||
/**
|
||||
* 是否热点标签( 0-否(默认) 1-是)
|
||||
*/
|
||||
private Boolean isHot;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private String orderField;
|
||||
|
||||
/**
|
||||
* 排序顺序
|
||||
*/
|
||||
private Boolean orderAsc;
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.xboe.module.course.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName:CourseTagRelationDto
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/7/2815:00
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class CourseTagRelationDto{
|
||||
|
||||
private String id;
|
||||
private String courseId;
|
||||
private String tagId;
|
||||
private String tagName;
|
||||
private String courseName;
|
||||
private String sysCreateBy;
|
||||
private Date sysCreateTime;
|
||||
private String otherTags; // 改为字符串类型,与 GROUP_CONCAT 结果匹配
|
||||
private String sysType1;
|
||||
private String sysType2;
|
||||
private String sysType3;
|
||||
|
||||
// 添加匹配查询字段顺序的构造函数
|
||||
public CourseTagRelationDto(
|
||||
String id,
|
||||
String courseId,
|
||||
String tagId,
|
||||
String courseName,
|
||||
String sysCreateBy,
|
||||
Date sysCreateTime,
|
||||
String otherTags
|
||||
) {
|
||||
this.id = id;
|
||||
this.courseId = courseId;
|
||||
this.tagId = tagId;
|
||||
this.courseName = courseName;
|
||||
this.sysCreateBy = sysCreateBy;
|
||||
this.sysCreateTime = sysCreateTime;
|
||||
this.otherTags = otherTags;
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,10 @@ public class Course extends BaseEntity {
|
||||
|
||||
/**所有的设备*/
|
||||
public static int DEVICE_ALL=3;
|
||||
|
||||
|
||||
/**仅内网*/
|
||||
public static int DEVICE_INTERNAL=4;
|
||||
|
||||
/**未提交,草稿*/
|
||||
public static final int STATUS_NONE=1;
|
||||
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
package com.xboe.module.course.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 在线课程的标签类
|
||||
* @ClassName:CourseTag
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/7/25 16:37
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE+"course_tag")
|
||||
public class CourseTag extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
@Column(name = "tag_name",nullable=false, length = 50)
|
||||
private String tagName;
|
||||
|
||||
/**
|
||||
* 是否设置为公共标签
|
||||
*/
|
||||
@Column(name = "is_public",length = 1)
|
||||
private Boolean isPublic;
|
||||
|
||||
/**
|
||||
* 是否设置为热点标签
|
||||
*/
|
||||
@Column(name = "is_hot",length = 1)
|
||||
private Boolean isHot;
|
||||
|
||||
/**
|
||||
* 使用次数(关联课程数)
|
||||
*/
|
||||
@Column(name = "use_count",length = 1)
|
||||
private Integer useCount;
|
||||
|
||||
/**
|
||||
* 最近设置为公共标签的时间
|
||||
*/
|
||||
@Column(name = "last_set_public_time", nullable = true)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastSetPublicTime;
|
||||
|
||||
/**
|
||||
* 最近设置为热点标签的时间
|
||||
*/
|
||||
@Column(name = "last_set_hot_time", nullable = true)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastSetHotTime;
|
||||
|
||||
public CourseTag() {
|
||||
|
||||
}
|
||||
public CourseTag(Long id, Boolean isPublic,Boolean isHot) {
|
||||
this.setId(String.valueOf(id));
|
||||
this.isPublic=isPublic;
|
||||
this.isHot=isHot;
|
||||
}
|
||||
|
||||
|
||||
public CourseTag(String id,String tagName,String sysCreateBy,String sysCreateAid,LocalDateTime sysCreateTime,
|
||||
Boolean isPublic,Boolean isHot,Integer useCount,LocalDateTime lastSetPublicTime,LocalDateTime lastSetHotTime,Boolean deleted){
|
||||
this.setId(id);
|
||||
this.setTagName(tagName);
|
||||
super.setSysCreateBy(sysCreateBy);
|
||||
super.setSysCreateAid(sysCreateAid);
|
||||
super.setSysCreateTime(sysCreateTime);
|
||||
this.isPublic = isPublic;
|
||||
this.isHot = isHot;
|
||||
this.useCount = useCount;
|
||||
this.lastSetPublicTime = lastSetPublicTime;
|
||||
this.lastSetHotTime = lastSetHotTime;
|
||||
super.setDeleted(deleted);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.xboe.module.course.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* @ClassName:CourseTagRelation
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/7/2814:54
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE+"course_tag_relation")
|
||||
public class CourseTagRelation extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 课程Id
|
||||
*/
|
||||
@Column(name = "course_id",length = 20)
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 标签id
|
||||
*/
|
||||
@Column(name = "tag_id",length = 20)
|
||||
private Long tagId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.xboe.module.course.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 讲师操作记录表
|
||||
* 为了监控PngCode-SZX-1241问题临时创建的表
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "course_teacher_modify_record")
|
||||
public class CourseTeacherModifyRecord {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 请求ID
|
||||
* 同一个请求ID表示删除操作是在一次请求中完成的
|
||||
*/
|
||||
private String requestId;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
* INSERT、UPDATE、DELETE
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 讲师账号ID
|
||||
*/
|
||||
private String teacherId;
|
||||
|
||||
/**
|
||||
* 讲师姓名
|
||||
*/
|
||||
private String teacherName;
|
||||
|
||||
/**
|
||||
* 在线课ID
|
||||
*/
|
||||
private String courseId;
|
||||
|
||||
/**
|
||||
* 请求体
|
||||
*/
|
||||
private String body;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
private Long updateId;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.xboe.module.course.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* @ClassName:CourseTypeTagRelation
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/8/111:02
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE+"course_type_tag_relation")
|
||||
public class CourseTypeTagRelation extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "sys_type1",length = 20)
|
||||
private String sysType1;
|
||||
|
||||
@Column(name = "sys_type2",length = 20)
|
||||
private String sysType2;
|
||||
|
||||
@Column(name = "sys_type3",length = 20)
|
||||
private String sysType3;
|
||||
|
||||
@Column(name = "tag_id",length = 20)
|
||||
private String tagId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -52,7 +52,6 @@ public class CourseToCourseFullText {
|
||||
cft.setTeacher("");
|
||||
cft.setTeacherCode("");
|
||||
cft.setType(c.getType());
|
||||
cft.setTags(c.getTags());
|
||||
if(c.getOpenCourse()==null) {
|
||||
cft.setOpenCourse(0);
|
||||
}else {
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.xboe.module.course.service;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.orm.IFieldFilter;
|
||||
import com.xboe.module.course.dto.CourseTagRelationDto;
|
||||
import com.xboe.module.course.entity.CourseTag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @InterfaceName:ICourseTagService
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/7/2516:53
|
||||
*/
|
||||
public interface ICourseTagService {
|
||||
|
||||
/**
|
||||
* 分页查询标签列表,使用自定义filter
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
PageList<CourseTag> query(Integer pageIndex, Integer pageSize, List<IFieldFilter> filters, OrderCondition order);
|
||||
|
||||
/**
|
||||
* 分页查询指定id标签关联的课程列表,使用自定义filter
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
PageList<CourseTagRelationDto> getCourseByTag(Integer pageIndex, Integer pageSize, Long tagId, Boolean isAsc);
|
||||
|
||||
/**
|
||||
* 修改指定id的课程标签的公共属性
|
||||
* @param id
|
||||
* @param isPublic
|
||||
* @return
|
||||
*/
|
||||
void changePublicStatus(Long id,Boolean isPublic);
|
||||
|
||||
/**
|
||||
* 修改指定id的课程标签的热点属性
|
||||
*
|
||||
* @param id
|
||||
* @param isHot
|
||||
* @return
|
||||
*/
|
||||
JsonResponse<Boolean> changeHotStatus(Long id, Boolean isHot);
|
||||
|
||||
/**
|
||||
* 解除指定id的课程和某个标签之间的关联关系
|
||||
* @return
|
||||
*/
|
||||
void unbind(String id);
|
||||
|
||||
/**
|
||||
* 根据标签名称进行检索(模糊查询)
|
||||
* @param tagName
|
||||
* @return 符合检索条件的所有公共标签
|
||||
*/
|
||||
List<CourseTag> searchTags(String tagName);
|
||||
|
||||
/**
|
||||
* 创建新标签,并与当前课程绑定
|
||||
* @param courseTagRelationDto
|
||||
* @return
|
||||
*/
|
||||
CourseTag createTag(CourseTagRelationDto courseTagRelationDto);
|
||||
|
||||
/**
|
||||
* 根据课程类型获取热点标签
|
||||
* @param courseTagRelationDto
|
||||
* @return
|
||||
*/
|
||||
List<CourseTag> getHotTagList(CourseTagRelationDto courseTagRelationDto);
|
||||
|
||||
/**
|
||||
* 根据多个id获取标签
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<CourseTag> getTagsByIds(String id);
|
||||
|
||||
CourseTag getTagByName(String tagName);
|
||||
|
||||
void bindTag(String id, String tags);
|
||||
|
||||
List<CourseTag> getTagsByTagIds(List<String> courseTagIds);
|
||||
}
|
||||
@@ -1,39 +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;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
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.module.course.service.ICourseTagService;
|
||||
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;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.xboe.TempFilterConfig;
|
||||
import com.xboe.account.service.IAccountService;
|
||||
import com.xboe.common.OrderCondition;
|
||||
@@ -42,31 +9,39 @@ import com.xboe.common.beans.KeyValue;
|
||||
import com.xboe.common.utils.IDGenerator;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.event.IEventDataSender;
|
||||
import com.xboe.module.course.dao.CourseContentDao;
|
||||
import com.xboe.module.course.dao.CourseCrowdDao;
|
||||
import com.xboe.module.course.dao.CourseDao;
|
||||
import com.xboe.module.course.dao.CourseExamDao;
|
||||
import com.xboe.module.course.dao.CourseHRBPAuditDao;
|
||||
import com.xboe.module.course.dao.CourseHomeWorkDao;
|
||||
import com.xboe.module.course.dao.CourseSectionDao;
|
||||
import com.xboe.module.course.dao.CourseTeacherDao;
|
||||
import com.xboe.module.course.dao.CourseUpdateLogDao;
|
||||
import com.xboe.core.orm.*;
|
||||
import com.xboe.module.course.dao.*;
|
||||
import com.xboe.module.course.dto.CourseFullDto;
|
||||
import com.xboe.module.course.dto.CourseQueryDto;
|
||||
import com.xboe.module.course.dto.RankingDto;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseCrowd;
|
||||
import com.xboe.module.course.entity.CourseHRBPAudit;
|
||||
import com.xboe.module.course.entity.CourseSection;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.entity.CourseUpdateLog;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.service.ICourseFullTextSearch;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.interaction.service.ICourseGradeService;
|
||||
import com.xboe.system.authority.service.IResDataManagerService;
|
||||
import com.xboe.system.logs.dao.SysLogAuditDao;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -99,8 +74,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
|
||||
@Resource
|
||||
private CourseHRBPAuditDao courseHRBPAuditDao;
|
||||
@Resource
|
||||
private ICourseTagService courseTagService;
|
||||
|
||||
|
||||
@Resource
|
||||
private SysLogAuditDao logAuditDao;//审核日志记录
|
||||
@@ -127,7 +101,8 @@ public class CourseServiceImpl implements ICourseService {
|
||||
@Resource
|
||||
RestHighLevelClient restHighLevelClient;
|
||||
|
||||
|
||||
@Resource
|
||||
private CourseTeacherModifyRecordDao courseTeacherModifyRecordDao;
|
||||
|
||||
/**
|
||||
* 生成过滤条件
|
||||
@@ -185,6 +160,8 @@ public class CourseServiceImpl implements ICourseService {
|
||||
filters.add(FieldFilters.in("device", Course.DEVICE_MOBILE, Course.DEVICE_ALL));
|
||||
} else if (dto.getDevice() == Course.DEVICE_ALL) {
|
||||
filters.add(FieldFilters.eq("device", Course.DEVICE_ALL));
|
||||
}else if (dto.getDevice() == Course.DEVICE_INTERNAL) {
|
||||
filters.add(FieldFilters.eq("device", Course.DEVICE_INTERNAL));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -493,7 +470,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
String sql = "SELECT DISTINCT\n" +
|
||||
"rt.course_id\n" +
|
||||
"FROM\n" +
|
||||
"boe.student s INNER JOIN boe.router_task rt on s.pid=rt.router_id inner join boe_course c on c.id=rt.course_id\n" +
|
||||
"boe_new.student s INNER JOIN boe_new.router_task rt on s.pid=rt.router_id inner join boe_course c on c.id=rt.course_id\n" +
|
||||
"\n" +
|
||||
"WHERE\n" +
|
||||
"\n" +
|
||||
@@ -516,7 +493,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
String sql = "SELECT DISTINCT\n" +
|
||||
"pt.course_id\n" +
|
||||
"FROM\n" +
|
||||
"boe.student s INNER JOIN boe.project_task pt on s.pid=pt.project_id inner join boe_course c on c.id=pt.course_id\n" +
|
||||
"boe_new.student s INNER JOIN boe_new.project_task pt on s.pid=pt.project_id inner join boe_course c on c.id=pt.course_id\n" +
|
||||
"\n" +
|
||||
"WHERE\n" +
|
||||
"\n" +
|
||||
@@ -573,8 +550,8 @@ public class CourseServiceImpl implements ICourseService {
|
||||
String sql = "SELECT DISTINCT\n" +
|
||||
"\tc.id \n" +
|
||||
"FROM\n" +
|
||||
"\tboe.student s\n" +
|
||||
"\tINNER JOIN boe.grow_task gt ON s.pid = gt.grow_id\n" +
|
||||
"\tboe_new.student s\n" +
|
||||
"\tINNER JOIN boe_new.grow_task gt ON s.pid = gt.grow_id\n" +
|
||||
"\tINNER JOIN boe_course c ON gt.course_id = c.id \n" +
|
||||
"WHERE\n" +
|
||||
"\ts.type = 14 \n" +
|
||||
@@ -837,6 +814,23 @@ public class CourseServiceImpl implements ICourseService {
|
||||
|
||||
@Override
|
||||
public void delete(String id, boolean erasable, String aid, String name, String remark) {
|
||||
// 增加操作boe_course_teacher表记录
|
||||
String body = "courseId=" + id + " aid=" + aid + " name=" + name + " remark=" + remark;
|
||||
String location = "/xboe/m/course/manage/delete";
|
||||
List<CourseTeacher> teacherList = courseTeacherDao.findByCourseId(id);
|
||||
String jsonStr = JSONUtil.toJsonStr(teacherList);
|
||||
log.info("teacherList:{}", jsonStr);
|
||||
try {
|
||||
List<List> list = JSONUtil.toList(jsonStr, List.class);
|
||||
list.forEach(item -> {
|
||||
for (Object teacher : item) {
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", location, (CourseTeacher) teacher, body);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("增加操作boe_course_teacher表记录失败", e);
|
||||
}
|
||||
|
||||
if (!erasable) {
|
||||
courseDao.setDeleted(id);
|
||||
courseDao.updateFieldById(id, "name", "已删除" + name);
|
||||
@@ -920,6 +914,9 @@ public class CourseServiceImpl implements ICourseService {
|
||||
for (CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.save(ct);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", "/xboe/m/course/manage/save", ct, JSONUtil.toJsonStr(full));
|
||||
}
|
||||
}
|
||||
if (full.getCrowds() != null && !full.getCrowds().isEmpty()) {
|
||||
@@ -1002,12 +999,29 @@ public class CourseServiceImpl implements ICourseService {
|
||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||
full.getCourse().setSysVersion(c.getSysVersion());
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
String body = null;
|
||||
String location = null;
|
||||
try {
|
||||
body = JSONUtil.toJsonStr(full);
|
||||
location = "/xboe/m/course/manage/save";
|
||||
List<CourseTeacher> teacherList = courseTeacherDao.findByCourseId(c.getId());
|
||||
for (CourseTeacher teacher : teacherList) {
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", location, teacher, body);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("增加操作boe_course_teacher表记录失败", e);
|
||||
}
|
||||
|
||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
||||
for (CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.saveOrUpdate(ct);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
courseTeacherModifyRecordDao.insertRecord("INSERT", location, ct, body);
|
||||
}
|
||||
}
|
||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||
@@ -1024,9 +1038,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
publishUtil.removeByDocId(c.getFullTextId());
|
||||
|
||||
}
|
||||
// 添加课程对应的标签
|
||||
String tags = full.getCourse().getTags();
|
||||
courseTagService.bindTag(c.getId(), tags);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1058,12 +1070,29 @@ public class CourseServiceImpl implements ICourseService {
|
||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||
full.getCourse().setSysVersion(c.getSysVersion());
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
String body = null;
|
||||
String location = null;
|
||||
try {
|
||||
body = JSONUtil.toJsonStr(full);
|
||||
location = "/xboe/m/course/manage/submit";
|
||||
List<CourseTeacher> teacherList = courseTeacherDao.findByCourseId(c.getId());
|
||||
for (CourseTeacher teacher : teacherList) {
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", location, teacher, body);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("增加操作boe_course_teacher表记录失败", e);
|
||||
}
|
||||
|
||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
||||
for (CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.saveOrUpdate(ct);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
courseTeacherModifyRecordDao.insertRecord("INSERT", location, ct, body);
|
||||
}
|
||||
}
|
||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||
@@ -1093,12 +1122,29 @@ public class CourseServiceImpl implements ICourseService {
|
||||
c.setPublishTime(LocalDateTime.now());
|
||||
courseDao.update(c);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
String body = null;
|
||||
String location = null;
|
||||
try {
|
||||
body = "body=" + JSONUtil.toJsonStr(full) + " aid=[" + aid + "] aname=[" + aname + "] ";
|
||||
location = "/xboe/m/course/audit/submit-publish";
|
||||
List<CourseTeacher> teacherList = courseTeacherDao.findByCourseId(c.getId());
|
||||
for (CourseTeacher teacher : teacherList) {
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", location, teacher, body);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("增加操作boe_course_teacher表记录失败", e);
|
||||
}
|
||||
|
||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
||||
for (CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.saveOrUpdate(ct);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
courseTeacherModifyRecordDao.insertRecord("INSERT", location, ct, body);
|
||||
}
|
||||
}
|
||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||
|
||||
@@ -1,399 +0,0 @@
|
||||
package com.xboe.module.course.service.impl;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.IFieldFilter;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.module.course.dao.CourseDao;
|
||||
import com.xboe.module.course.dao.CourseTagDao;
|
||||
import com.xboe.module.course.dao.CourseTagRelationDao;
|
||||
import com.xboe.module.course.dao.CourseTypeTagRelationDao;
|
||||
import com.xboe.module.course.dto.CourseTagRelationDto;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseTag;
|
||||
import com.xboe.module.course.entity.CourseTagRelation;
|
||||
import com.xboe.module.course.entity.CourseTypeTagRelation;
|
||||
import com.xboe.module.course.service.ICourseTagService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @ClassName:CourseTagServiceImpl
|
||||
* @author:zhengge@oracle.com
|
||||
* @since:2025/7/2516:55
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class CourseTagServiceImpl implements ICourseTagService {
|
||||
|
||||
@Resource
|
||||
private CourseTagDao courseTagDao;
|
||||
@Resource
|
||||
PublishCourseUtil publishUtil;
|
||||
@Resource
|
||||
private CourseTagRelationDao courseTagRelationDao;
|
||||
@Resource
|
||||
private CourseTypeTagRelationDao courseTypeTagRelationDao;
|
||||
@Resource
|
||||
private CourseDao courseDao;
|
||||
|
||||
/**
|
||||
* 课程标签分页查询
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @param filters
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageList<CourseTag> query(Integer pageIndex, Integer pageSize, List<IFieldFilter> filters, OrderCondition order) {
|
||||
QueryBuilder query=QueryBuilder.from(CourseTag.class);
|
||||
query.setPageIndex(pageIndex);
|
||||
query.setPageSize(pageSize);
|
||||
filters.add(FieldFilters.eq("deleted",false));
|
||||
query.addFilters(filters);
|
||||
if(order!=null) {
|
||||
query.addOrder(order);
|
||||
}else {
|
||||
query.addOrder(OrderCondition.desc("sysCreateTime"));
|
||||
}
|
||||
return courseTagDao.findPage(query.builder());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询指定id标签关联的课程
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @param tagId
|
||||
* @param isAsc
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageList<CourseTagRelationDto> getCourseByTag(Integer pageIndex, Integer pageSize, Long tagId, Boolean isAsc) {
|
||||
PageList<CourseTagRelationDto> list = null;
|
||||
if(isAsc) {
|
||||
list = courseTagRelationDao.findCoursesWithRelatedTagsAsc(pageIndex,pageSize,tagId);
|
||||
}else {
|
||||
list = courseTagRelationDao.findCoursesWithRelatedTagsDesc(pageIndex,pageSize,tagId);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改指定id的课程标签的公共属性
|
||||
* @param id
|
||||
* @param isPublic
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void changePublicStatus(Long id, Boolean isPublic) {
|
||||
CourseTag courseTag = courseTagDao.findOne(FieldFilters.eq("id", String.valueOf(id)));
|
||||
if (courseTag!=null){
|
||||
courseTag.setIsPublic(isPublic);
|
||||
courseTag.setLastSetPublicTime(isPublic?LocalDateTime.now():null);
|
||||
courseTagDao.update(courseTag);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改指定id的课程标签的热点属性
|
||||
*
|
||||
* @param id
|
||||
* @param isHot
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JsonResponse<Boolean> changeHotStatus(Long id, Boolean isHot) {
|
||||
// 当标签切换为热点标签时才会判断,超过十个热点标签则禁止设置
|
||||
JsonResponse<Boolean> objectJsonResponse = new JsonResponse<>();
|
||||
if (isHot){
|
||||
if (courseTagRelationDao.countHotTags()){
|
||||
objectJsonResponse.setStatus(400);
|
||||
objectJsonResponse.setMessage("超过十个热点标签,无法进行设置");
|
||||
objectJsonResponse.setResult(false);
|
||||
return objectJsonResponse;
|
||||
}
|
||||
}
|
||||
CourseTag courseTag = courseTagDao.findOne(FieldFilters.eq("id", String.valueOf(id)));
|
||||
if (courseTag!=null){
|
||||
courseTag.setIsHot(isHot);
|
||||
courseTag.setLastSetHotTime(isHot?LocalDateTime.now():null);
|
||||
courseTagDao.update(courseTag);
|
||||
}
|
||||
objectJsonResponse.setStatus(200);
|
||||
objectJsonResponse.setMessage("修改成功");
|
||||
return objectJsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解除指定id的课程和某个标签之间的关联关系
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void unbind(String id) {
|
||||
//根据主键查询关联关系
|
||||
CourseTagRelation courseTagRelation = courseTagRelationDao.findOne(FieldFilters.eq("id", id));
|
||||
if (courseTagRelation != null){
|
||||
//修改该标签关联课程数
|
||||
CourseTag courseTag = courseTagDao.findOne(FieldFilters.eq("id", String.valueOf(courseTagRelation.getTagId())));
|
||||
if (courseTag != null){
|
||||
courseTag.setUseCount(courseTag.getUseCount()>1?courseTag.getUseCount()-1:0);
|
||||
courseTagDao.updateFieldById(courseTag.getId(),"useCount",courseTag.getUseCount());
|
||||
}
|
||||
//解绑(删除关联关系)
|
||||
courseTagRelationDao.setDeleted(id);
|
||||
Course course = courseDao.get(courseTagRelation.getCourseId().toString());
|
||||
String tags = course.getTags();
|
||||
if (StringUtils.isNotBlank(tags)){
|
||||
String[] tagIds = tags.split(",");
|
||||
List<String> tagIdList = new ArrayList<>();
|
||||
for (String tagId : tagIds){
|
||||
if (!tagId.equals(courseTagRelation.getTagId().toString())){
|
||||
tagIdList.add(tagId);
|
||||
}
|
||||
}
|
||||
// 数据格式:1,2,3
|
||||
String s = StringUtils.join(tagIdList, ",");
|
||||
if (!"".equals(s)){
|
||||
s+=",";
|
||||
}
|
||||
course.setTags(s);
|
||||
}
|
||||
// 同步ES
|
||||
publishUtil.fullTextPublish(course);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据标签名称进行检索(模糊查询)
|
||||
* @param tagName
|
||||
* @return 符合检索条件的所有公共标签
|
||||
*/
|
||||
@Override
|
||||
public List<CourseTag> searchTags(String tagName){
|
||||
QueryBuilder query=QueryBuilder.from(CourseTag.class);
|
||||
List<IFieldFilter> filters = new ArrayList<>();
|
||||
filters.add(FieldFilters.eq("deleted",false));//未删除
|
||||
filters.add(FieldFilters.eq("isPublic",true));//公共标签
|
||||
filters.add(FieldFilters.like("tagName",tagName));//模糊检索
|
||||
query.addFilters(filters);
|
||||
List<CourseTag> courseTagList = courseTagDao.findList(query.builder());
|
||||
return courseTagList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建新标签,并与指定课程绑定
|
||||
* @param courseTagRelationDto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CourseTag createTag(CourseTagRelationDto courseTagRelationDto) {
|
||||
CourseTag courseTag = null;
|
||||
String tagName = courseTagRelationDto.getTagName();
|
||||
Long courseId = Long.valueOf(courseTagRelationDto.getCourseId());
|
||||
//1.创建标签:先判断是否已经存在该标签
|
||||
QueryBuilder query=QueryBuilder.from(CourseTag.class);
|
||||
List<IFieldFilter> filters = new ArrayList<>();
|
||||
filters.add(FieldFilters.eq("tagName",tagName));//精确匹配
|
||||
query.addFilters(filters);
|
||||
List<CourseTag> courseTagList = courseTagDao.findList(query.builder());
|
||||
if (courseTagList==null || courseTagList.size()==0){//1.1 如果该标签不存在,则新建标签
|
||||
courseTag = new CourseTag();
|
||||
courseTag.setTagName(tagName);
|
||||
courseTag.setIsPublic(false);
|
||||
courseTag.setIsHot(false);
|
||||
courseTag.setUseCount(0);
|
||||
courseTagDao.save(courseTag);
|
||||
// //新建一条标签和课程的关联关系
|
||||
// CourseTagRelation courseTagRelation = new CourseTagRelation();
|
||||
// courseTagRelation.setTagId(Long.valueOf(courseTag.getId()));
|
||||
// courseTagRelation.setCourseId(courseId);
|
||||
// courseTagRelationDao.save(courseTagRelation);
|
||||
}else {//1.2 否则修改标签
|
||||
courseTag=courseTagList.get(0);
|
||||
// 当同一标签被3个及以上课管创建时,默认开启这个标签的公共化
|
||||
if(courseTag.getUseCount() >= 3){
|
||||
courseTag.setIsPublic(true);
|
||||
}
|
||||
courseTag.setDeleted(false);//有可能是之前被删除的标签,这里恢复为有效
|
||||
//查找改课程与这个标签是否已经建立关联关系
|
||||
query=QueryBuilder.from(CourseTagRelation.class);
|
||||
filters = new ArrayList<>();
|
||||
filters.add(FieldFilters.eq("tagId",Long.valueOf(courseTag.getId())));//精确匹配
|
||||
filters.add(FieldFilters.eq("courseId",courseId));//精确匹配
|
||||
query.addFilters(filters);
|
||||
List<CourseTagRelation> courseTagRelationList = courseTagRelationDao.findList(query.builder());
|
||||
//1.2.1 如果还未建立关联关系,则新建一条标签和课程的关联关系
|
||||
if (courseTagRelationList==null || courseTagRelationList.size()==0){
|
||||
CourseTagRelation courseTagRelation = new CourseTagRelation();
|
||||
courseTagRelation.setTagId(Long.valueOf(courseTag.getId()));
|
||||
courseTagRelation.setCourseId(courseId);
|
||||
courseTagRelationDao.save(courseTagRelation);
|
||||
//更新该标签的关联课程数量
|
||||
courseTag.setUseCount(courseTag.getUseCount()+1);
|
||||
}else {//1.2.2 否则修改该标签和课程的关联关系
|
||||
CourseTagRelation courseTagRelation = courseTagRelationList.get(0);
|
||||
if (courseTagRelation.getDeleted()){//之前"解绑",这里恢复为有效
|
||||
courseTagRelation.setDeleted(false);
|
||||
courseTagRelationDao.saveOrUpdate(courseTagRelation);
|
||||
//更新该标签的关联课程数量
|
||||
courseTag.setUseCount(courseTag.getUseCount()+1);
|
||||
}
|
||||
}
|
||||
courseTagDao.saveOrUpdate(courseTag);
|
||||
}
|
||||
//2.创建该标签和课程分类之间的关联关系
|
||||
courseTagRelationDto.setTagId(courseTag.getId());
|
||||
createCourseTypeAndTagRelation(courseTagRelationDto);
|
||||
return courseTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CourseTag> getTagsByTagIds(List<String> courseTagIds) {
|
||||
List<CourseTag> courseTagList = courseTagDao.findList(FieldFilters.in("id", courseTagIds));
|
||||
return courseTagList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindTag(String id, String tags) {
|
||||
// 将tags转换为数组
|
||||
String[] tagIds = tags.split(",");
|
||||
List<Long> tagIdList = new ArrayList<>();
|
||||
for (String tagId : tagIds){
|
||||
tagIdList.add(Long.valueOf(tagId));
|
||||
}
|
||||
for (Long tagId : tagIdList){
|
||||
QueryBuilder courseTagQuery=QueryBuilder.from(CourseTag.class);
|
||||
List<IFieldFilter> courseTagFilters = new ArrayList<>();
|
||||
courseTagFilters.add(FieldFilters.eq("id",tagId.toString()));//精确匹配
|
||||
courseTagQuery.addFilters(courseTagFilters);
|
||||
//修改该标签关联课程数
|
||||
CourseTag courseTag = courseTagDao.findOne(FieldFilters.eq("id", String.valueOf(tagId)));
|
||||
if (courseTag!=null){
|
||||
//更新该标签的关联课程数量
|
||||
courseTag.setUseCount(courseTag.getUseCount()+1);
|
||||
courseTagDao.saveOrUpdate(courseTag);
|
||||
}
|
||||
// 查询课程是否绑定了标签
|
||||
QueryBuilder query=QueryBuilder.from(CourseTagRelation.class);
|
||||
List<IFieldFilter> filters = new ArrayList<>();
|
||||
filters.add(FieldFilters.eq("courseId",Long.valueOf(id)));
|
||||
filters.add(FieldFilters.eq("tagId",Long.valueOf(tagId)));
|
||||
query.addFilters(filters);
|
||||
List<CourseTagRelation> courseTagRelationList = courseTagRelationDao.findList(query.builder());
|
||||
// 如果没有绑定标签,那么就进行绑定
|
||||
if (courseTagRelationList==null || courseTagRelationList.size()==0){
|
||||
CourseTagRelation courseTagRelation = new CourseTagRelation();
|
||||
courseTagRelation.setTagId(Long.valueOf(tagId));
|
||||
courseTagRelation.setCourseId(Long.valueOf(id));
|
||||
courseTagRelationDao.save(courseTagRelation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseTag getTagByName(String tagName) {
|
||||
CourseTag courseTag = courseTagDao.getTagByName(tagName);
|
||||
return courseTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CourseTag> getTagsByIds(String id) {
|
||||
// id=17,18
|
||||
List<CourseTag> courseTagList = courseTagDao.getTagsByIds(id);
|
||||
return courseTagList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取热门标签
|
||||
* @param courseTagRelationDto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CourseTag> getHotTagList(CourseTagRelationDto courseTagRelationDto) {
|
||||
List<CourseTag> hotTagList = null;
|
||||
if (StringUtils.isNotBlank(courseTagRelationDto.getSysType1()) ||
|
||||
StringUtils.isNotBlank(courseTagRelationDto.getSysType2()) ||
|
||||
StringUtils.isNotBlank(courseTagRelationDto.getSysType3())){
|
||||
String sysType1 = courseTagRelationDto.getSysType1();
|
||||
String sysType2 = courseTagRelationDto.getSysType2();
|
||||
String sysType3 = courseTagRelationDto.getSysType3();
|
||||
hotTagList = courseTagDao.getHotTagListBySysTypes(sysType1,sysType2,sysType3);
|
||||
}else {
|
||||
hotTagList = courseTagDao.getHotTagList();
|
||||
}
|
||||
return hotTagList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建标签和课程分类之间的关联关系
|
||||
* @param courseTagRelationDto
|
||||
*/
|
||||
private void createCourseTypeAndTagRelation(CourseTagRelationDto courseTagRelationDto){
|
||||
String sysType1 = courseTagRelationDto!=null?courseTagRelationDto.getSysType1():null;
|
||||
String tagId = courseTagRelationDto!=null?courseTagRelationDto.getTagId():null;
|
||||
if (StringUtils.isNotBlank(sysType1) && StringUtils.isNotBlank(tagId)){
|
||||
String sysType2 = courseTagRelationDto.getSysType2();
|
||||
String sysType3 = courseTagRelationDto.getSysType3();
|
||||
//判断数据库中该课程分类和标签是否已经存在关联关系
|
||||
if (!isHadCourseTypeAndTagRelation(courseTagRelationDto,true)){//不存在,则新建
|
||||
CourseTypeTagRelation courseTypeTagRelation = new CourseTypeTagRelation();
|
||||
courseTypeTagRelation.setSysType1(sysType1);
|
||||
courseTypeTagRelation.setSysType2(StringUtils.isNotBlank(sysType2)?sysType2:"0");
|
||||
courseTypeTagRelation.setSysType3(StringUtils.isNotBlank(sysType3)?sysType3:"0");
|
||||
courseTypeTagRelation.setTagId(tagId);
|
||||
courseTypeTagRelationDao.save(courseTypeTagRelation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断数据库制定的课程分类和标签是否已经存在关联关系
|
||||
* @param courseTagRelationDto
|
||||
* @param clearFlag 清理标识 true:清理已存在的数据,只保留一条有效数据
|
||||
* @return true:已存在;false:不存在
|
||||
*/
|
||||
private Boolean isHadCourseTypeAndTagRelation(CourseTagRelationDto courseTagRelationDto,Boolean clearFlag){
|
||||
QueryBuilder query=QueryBuilder.from(CourseTypeTagRelation.class);
|
||||
List<IFieldFilter> filters = new ArrayList<>();
|
||||
filters.add(FieldFilters.eq("sysType1",courseTagRelationDto.getSysType1()));//一级分类
|
||||
filters.add(FieldFilters.eq("sysType2",courseTagRelationDto.getSysType1()));//二级分类
|
||||
filters.add(FieldFilters.eq("sysType3",courseTagRelationDto.getSysType1()));//三级分类
|
||||
filters.add(FieldFilters.eq("tagId",courseTagRelationDto.getTagId()));
|
||||
List<CourseTypeTagRelation> courseTypeTagRelList = courseTypeTagRelationDao.findList(query.addFilters(filters).builder());
|
||||
Boolean isExist = (courseTypeTagRelList!=null && courseTypeTagRelList.size()>0)?true:false;
|
||||
if (isExist && clearFlag ){
|
||||
List<CourseTypeTagRelation> toRemove = new ArrayList<>();
|
||||
for (CourseTypeTagRelation courseTypeTagRel : courseTypeTagRelList) {
|
||||
if (courseTypeTagRel.getDeleted()) {//如果是逻辑删的本次物理删除
|
||||
courseTypeTagRelationDao.getGenericDao().delete(courseTypeTagRel);
|
||||
toRemove.add(courseTypeTagRel);
|
||||
}
|
||||
}
|
||||
courseTypeTagRelList.removeAll(toRemove);//移除逻辑删的数据
|
||||
//如果还存在有效数据
|
||||
if (courseTypeTagRelList!=null && courseTypeTagRelList.size()>0){
|
||||
//只保留一条有效数据,其余物理删除
|
||||
for (int i = courseTypeTagRelList.size() - 1; i >= 1; i--) {
|
||||
CourseTypeTagRelation courseTypeTagRel = courseTypeTagRelList.get(i);
|
||||
if (courseTypeTagRel.getDeleted()) {
|
||||
courseTypeTagRelationDao.getGenericDao().delete(courseTypeTagRel);
|
||||
courseTypeTagRelList.remove(i); // 倒序删除不影响未遍历的索引
|
||||
}
|
||||
}
|
||||
isExist = true;//存在一条有效数据
|
||||
}else {
|
||||
isExist = false;//不存在有效数据了
|
||||
}
|
||||
}
|
||||
return isExist;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.xboe.module.course.util;
|
||||
|
||||
import cn.hutool.core.util.HexUtil;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
/**
|
||||
* @author guo jia
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class RequestIdUtil {
|
||||
|
||||
private static final SecureRandom RANDOM = new SecureRandom();
|
||||
|
||||
public static final String REQUEST_ID_KEY = "requestId";
|
||||
|
||||
public static String genRequestId() {
|
||||
byte[] bytes = new byte[8];
|
||||
RequestIdUtil.RANDOM.nextBytes(bytes);
|
||||
return HexUtil.encodeHexStr(bytes);
|
||||
}
|
||||
|
||||
public static void genAndSetRequestId() {
|
||||
setRequestId(genRequestId());
|
||||
}
|
||||
|
||||
public static void setRequestId(String requestId) {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
request.setAttribute(REQUEST_ID_KEY, requestId);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCurrentRequestId() {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
String requestId = null;
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
requestId = (String) request.getAttribute(REQUEST_ID_KEY);
|
||||
}
|
||||
return requestId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xboe.module.popup.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import lombok.Data;
|
||||
@@ -24,12 +25,14 @@ public class Popup extends IdEntity {
|
||||
* 开始时间
|
||||
* */
|
||||
@Column(name = "start_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
* */
|
||||
@Column(name = "end_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.common.util.concurrent.RateLimiter;
|
||||
import com.boe.feign.api.infrastructure.entity.CommonSearchVo;
|
||||
import com.boe.feign.api.infrastructure.entity.Dict;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.constants.CacheName;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
@@ -233,7 +235,30 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
rs.put("contents",cclist);
|
||||
rs.put("sections",sectionlist);
|
||||
rs.put("teachers",teachers);
|
||||
|
||||
// 未选择仅内网时isPermission = false,不用区分内外网
|
||||
boolean isPermission = false;
|
||||
if(course.getDevice() ==4){
|
||||
CommonSearchVo searcher = new CommonSearchVo();
|
||||
searcher.setPid(637L);
|
||||
searcher.setType(1);
|
||||
List<Dict> dictList = thirdApi.getDictItems(searcher);
|
||||
if(dictList != null && dictList.size() > 0){
|
||||
List<String> dicts = dictList.stream().map(Dict::getValue).collect(Collectors.toList());
|
||||
// 选择仅内网 并且字典中配置了此课程资源归属,那么只能内网观看 返回 truw
|
||||
isPermission = dicts.contains(course.getOrgId());
|
||||
}
|
||||
}
|
||||
rs.put("isPermission",isPermission);
|
||||
|
||||
CommonSearchVo warn = new CommonSearchVo();
|
||||
warn.setCode("course_warn");
|
||||
warn.setType(1);
|
||||
List<Dict> warns = thirdApi.getDictItems(warn);
|
||||
if(warns != null && warns.size() > 0){
|
||||
rs.put("warn",warns.get(0).getValue());
|
||||
rs.put("warnTitle",warns.get(0).getName());
|
||||
}
|
||||
|
||||
//检查是否已报名
|
||||
StudyCourse sc=service.findByCourseIdAndAid(cid, aid);
|
||||
if(pass==true && sc==null) {
|
||||
@@ -567,8 +592,8 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
}
|
||||
try {
|
||||
studyService.finishVideoStudyItem(itemId, studyId,courseId,cnum,token);
|
||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
||||
log.info("在线课学习记录"+allUserList);
|
||||
// List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
||||
// log.info("在线课学习记录"+allUserList);
|
||||
return success(true);
|
||||
}catch(Exception e) {
|
||||
log.error("记录内容学习完成错误",e);
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.xboe.module.course.entity.CourseExam;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.study.dao.StudyCourseItemDao;
|
||||
import com.xboe.school.study.dao.StudyExamDao;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudyExam;
|
||||
import com.xboe.school.study.service.IStudyExamService;
|
||||
@@ -170,15 +171,32 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
||||
}
|
||||
builder.addGroupBy("studyId");
|
||||
List<StudyExam> list1 = dao.findList(builder.builder());
|
||||
log.info("------------QueryBuilder list1.size = " + list1.size() + ",0 = " + list1.get(0));
|
||||
|
||||
for(StudyExam item : list1){
|
||||
log.info("-----------------CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId());
|
||||
int totalContent = courseContentDao.getCount(item.getCourseId());
|
||||
log.info("----------准备判断进度-------totalContent = " + totalContent);
|
||||
scDao.finishCheck1(item.getStudyId(),item.getCourseId(),totalContent);
|
||||
log.info("----------判断进度完毕----------------------");
|
||||
if(list1 != null && list1.size() > 0){
|
||||
log.info("----------StudyExam--QueryBuilder list1.size = " + list1.size() + ",0 = " + list1.get(0));
|
||||
for(StudyExam item : list1){
|
||||
log.info("--------------StudyExam---CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId());
|
||||
int totalContent = courseContentDao.getCount(item.getCourseId());
|
||||
log.info("--------StudyExam--准备判断进度-------totalContent = " + totalContent);
|
||||
scDao.finishCheck1(item.getStudyId(),item.getCourseId(),totalContent);
|
||||
log.info("--------StudyExam--判断进度完毕----------------------");
|
||||
}
|
||||
}else{
|
||||
QueryBuilder builder1 = QueryBuilder.from(StudyCourse.class);
|
||||
if (StringUtils.isEmpty(courseId)){
|
||||
return;
|
||||
}
|
||||
builder1.addFilter(FieldFilters.eq("courseId", courseId));
|
||||
List<StudyCourse> list2 = scDao.findList(builder1.builder());
|
||||
log.info("------------StudyCourse list2.size = " + list2.size() + ",0 = " + list2.get(0));
|
||||
for(StudyCourse item : list2){
|
||||
log.info("-------------StudyCourse----CourseId = " + item.getCourseId() + " , StudyId = " + item.getId() + " , StudentId = " + item.getAid());
|
||||
int totalContent = courseContentDao.getCount(item.getCourseId());
|
||||
log.info("--------StudyCourse--准备判断进度-------totalContent = " + totalContent);
|
||||
scDao.finishCheck1(item.getId(),item.getCourseId(),totalContent);
|
||||
log.info("--------StudyCourse--判断进度完毕----------------------");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
log.info("------异常----------------------:" +exception.getMessage());
|
||||
|
||||
@@ -282,11 +282,12 @@ public class StudyServiceImpl implements IStudyService{
|
||||
return pageList;
|
||||
}
|
||||
}
|
||||
|
||||
String sql = "select a.id, a.course_id, a.course_name, a.aname, " +
|
||||
"IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " +
|
||||
"IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status,b.score " +
|
||||
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "' and aname like '%"+name+"%') a " +
|
||||
"left join " +
|
||||
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " +
|
||||
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status,MAX(item.score) score " +
|
||||
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
||||
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"%' group by bsc.id) b " +
|
||||
"on a.course_id = b.course_id and a.id = b.id " +
|
||||
@@ -315,6 +316,9 @@ public class StudyServiceImpl implements IStudyService{
|
||||
sc.setProgress(Integer.valueOf(objs[5].toString()));
|
||||
sc.setStatus(Integer.valueOf(objs[6].toString()));
|
||||
sc.setAname(objs[3].toString());
|
||||
if(objs[7] != null){
|
||||
sc.setScore(Float.valueOf(objs[7].toString()));
|
||||
}
|
||||
item.add(sc);
|
||||
}
|
||||
log.info("资源完成情况人员"+item);
|
||||
|
||||
Reference in New Issue
Block a user