mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 03:46:50 +08:00
Compare commits
90 Commits
zcwy0716-l
...
yx0815-l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61754d3852 | ||
|
|
a26ee1c707 | ||
|
|
1f0060c4dc | ||
|
|
6b0050286c | ||
|
|
2b07029aca | ||
|
|
d2d7fab96c | ||
|
|
be3bae969c | ||
|
|
8e1b7519ef | ||
|
|
bddb11caf8 | ||
|
|
f0fe015561 | ||
|
|
91bcec00ef | ||
|
|
7a210ec701 | ||
|
|
6c616a1163 | ||
|
|
939325d5bd | ||
|
|
4eddbc8e8f | ||
|
|
50bdd59a26 | ||
|
|
b85eb97bc1 | ||
|
|
28b58a73cf | ||
|
|
b9adf4c45f | ||
|
|
49aab74463 | ||
|
|
9f30910d04 | ||
|
|
6658b8c04b | ||
|
|
19df4224a9 | ||
|
|
95ddc9f5d5 | ||
|
|
f3b6bb6fee | ||
|
|
64965f5ec6 | ||
|
|
a407ca2dad | ||
|
|
16f1c2337b | ||
|
|
0f0edaf2cd | ||
|
|
68d00e8c51 | ||
|
|
41a542ea23 | ||
|
|
83e71dc5d6 | ||
|
|
fc98025a3a | ||
|
|
f5f53557b6 | ||
|
|
4b4f30b412 | ||
|
|
6f19ff7b0f | ||
|
|
f8566d2321 | ||
|
|
d6102d1ce1 | ||
|
|
6521464676 | ||
|
|
b6378b6565 | ||
|
|
66d7f2a3cf | ||
|
|
faea4f8b2a | ||
|
|
c203956bc6 | ||
|
|
cf4004f073 | ||
|
|
6bf5ccbcec | ||
|
|
63867db58e | ||
|
|
7ef0f976fc | ||
|
|
5a05ff74b7 | ||
|
|
a93580c387 | ||
|
|
78184d3a11 | ||
|
|
bcb8b59e8a | ||
|
|
1025f8f716 | ||
|
|
4c6f15a707 | ||
|
|
488e6c2872 | ||
|
|
e86afad4ef | ||
|
|
3285c639b9 | ||
|
|
db3695019a | ||
|
|
84dd5cb192 | ||
|
|
407c7693bb | ||
|
|
564bf42464 | ||
|
|
55717e4dde | ||
|
|
2698061eae | ||
|
|
eb401d8fdf | ||
|
|
20374e274a | ||
|
|
c7a39a1f22 | ||
|
|
7eb578127d | ||
|
|
f2be349301 | ||
|
|
e0037b8814 | ||
|
|
0b0bd748d9 | ||
|
|
9fd4171107 | ||
|
|
625c41f466 | ||
|
|
f950788e08 | ||
|
|
a26ceb86d1 | ||
|
|
a2317d0b59 | ||
|
|
53c38baf22 | ||
|
|
e2c697f860 | ||
|
|
de69ba1c11 | ||
|
|
c6a785bb4f | ||
|
|
2fcdb6b4b6 | ||
|
|
62884bcc15 | ||
|
|
8567fa9ecc | ||
|
|
359b66e48a | ||
|
|
8125a6bd77 | ||
|
|
9b37e8a73d | ||
|
|
2fa3378e94 | ||
|
|
dd0af3cbef | ||
|
|
0b7784779f | ||
|
|
e03118275d | ||
|
|
1b1cb17861 | ||
|
|
a35c1faa49 |
@@ -12,13 +12,10 @@ import com.xboe.module.dict.entity.DictDto;
|
|||||||
import com.xboe.module.exam.entity.ExamTest;
|
import com.xboe.module.exam.entity.ExamTest;
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
import com.xboe.system.user.dao.UserDao;
|
import com.xboe.system.user.dao.UserDao;
|
||||||
import com.xboe.system.user.entity.User;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|||||||
@@ -17,5 +17,7 @@ public class UserOrgIds {
|
|||||||
private Map<String,Boolean> permissions=new HashMap<String,Boolean>();
|
private Map<String,Boolean> permissions=new HashMap<String,Boolean>();
|
||||||
|
|
||||||
private List<String> ids;
|
private List<String> ids;
|
||||||
|
//hrbp只读权限
|
||||||
|
private List<String> readIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,8 +229,10 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
public UserOrgIds getOrgIds() {
|
public UserOrgIds getOrgIds() {
|
||||||
UserOrgIds uids=new UserOrgIds();
|
UserOrgIds uids=new UserOrgIds();
|
||||||
List<String> orgIds = new ArrayList<>();
|
List<String> orgIds = new ArrayList<>();
|
||||||
|
List<String> readIds = new ArrayList<>();
|
||||||
|
|
||||||
uids.setIds(orgIds);
|
uids.setIds(orgIds);
|
||||||
|
uids.setReadIds(readIds);
|
||||||
String token = TokenProxy.getToken(request);
|
String token = TokenProxy.getToken(request);
|
||||||
String type="application/json";
|
String type="application/json";
|
||||||
String[] headers=new String[] {"token",token,"Content-Type",type};
|
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||||
@@ -281,7 +283,8 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
while (elements.hasNext()){
|
while (elements.hasNext()){
|
||||||
String oid=elements.next().asText();
|
String oid=elements.next().asText();
|
||||||
if(!orgSetIds.contains(oid)) {
|
if(!orgSetIds.contains(oid)) {
|
||||||
orgIds.add(oid);
|
// orgIds.add(oid);
|
||||||
|
readIds.add(oid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package com.xboe.module.course.api;
|
package com.xboe.module.course.api;
|
||||||
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -134,7 +130,6 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
}else {
|
}else {
|
||||||
dto.setIsSystemAdmin(false);
|
dto.setIsSystemAdmin(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
String ids="";
|
String ids="";
|
||||||
if(userOrgIds.getIds()!=null && !userOrgIds.getIds().isEmpty())
|
if(userOrgIds.getIds()!=null && !userOrgIds.getIds().isEmpty())
|
||||||
{
|
{
|
||||||
@@ -142,12 +137,14 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
//log.info("获取到的用户的组织机构权限ids",ids);
|
//log.info("获取到的用户的组织机构权限ids",ids);
|
||||||
String aid=getCurrent().getAccountId();
|
String aid=getCurrent().getAccountId();
|
||||||
|
// String aid="1706272694871445506";
|
||||||
//如果前端查询当前人的,这里去掉
|
//如果前端查询当前人的,这里去掉
|
||||||
if(StringUtils.isNotBlank(dto.getAid())) {
|
if(StringUtils.isNotBlank(dto.getAid())) {
|
||||||
dto.setAid(null);
|
dto.setAid(null);
|
||||||
}
|
}
|
||||||
dto.setOrgAid(aid);
|
dto.setOrgAid(aid);
|
||||||
dto.setOrgIds(ids);
|
dto.setOrgIds(ids);
|
||||||
|
dto.setReadIds(userOrgIds.getReadIds());
|
||||||
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
|
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
|
||||||
return success(coursePageList);
|
return success(coursePageList);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.xboe.module.course.dto;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程查询的条件对象
|
* 课程查询的条件对象
|
||||||
*/
|
*/
|
||||||
@@ -102,6 +104,9 @@ public class CourseQueryDto {
|
|||||||
* */
|
* */
|
||||||
private String orgIds;
|
private String orgIds;
|
||||||
|
|
||||||
|
//hrpb只读
|
||||||
|
private List<String> readIds;
|
||||||
|
|
||||||
/**用户权限的查询*/
|
/**用户权限的查询*/
|
||||||
private String orgAid;
|
private String orgAid;
|
||||||
|
|
||||||
@@ -110,6 +115,11 @@ public class CourseQueryDto {
|
|||||||
*/
|
*/
|
||||||
private Boolean isSystemAdmin;
|
private Boolean isSystemAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是新建在线可
|
||||||
|
*/
|
||||||
|
private Boolean isCreateCourse;
|
||||||
|
|
||||||
private Boolean visible;
|
private Boolean visible;
|
||||||
|
|
||||||
private String refId;
|
private String refId;
|
||||||
@@ -129,4 +139,5 @@ public class CourseQueryDto {
|
|||||||
* 登录人id
|
* 登录人id
|
||||||
*/
|
*/
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -371,6 +371,9 @@ public class Course extends BaseEntity {
|
|||||||
@Column(name = "ref_type",length=32,columnDefinition="varchar(32) comment '反向关联的类型'")
|
@Column(name = "ref_type",length=32,columnDefinition="varchar(32) comment '反向关联的类型'")
|
||||||
private String refType;
|
private String refType;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private Boolean isPermission=true;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String orgName;
|
private String orgName;
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,11 @@ public class CourseContent extends BaseEntity {
|
|||||||
@Column(name = "duration")
|
@Column(name = "duration")
|
||||||
private Integer duration;
|
private Integer duration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频播放进度
|
||||||
|
* */
|
||||||
|
@Column(name = "progress_video")
|
||||||
|
private Float progressVideo;
|
||||||
|
|
||||||
/**用于学习时的状态显示,非存储字段*/
|
/**用于学习时的状态显示,非存储字段*/
|
||||||
@Transient
|
@Transient
|
||||||
|
|||||||
@@ -82,4 +82,7 @@ public interface ICourseContentService{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CourseAssess getAssess(String ccid);
|
CourseAssess getAssess(String ccid);
|
||||||
|
|
||||||
|
void updateProcessVideo(String contentId, String courseId, Float processVideo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.xboe.module.course.service.impl;
|
package com.xboe.module.course.service.impl;
|
||||||
|
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -141,6 +143,17 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
|||||||
return assess;
|
return assess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void updateProcessVideo(String id, String courseId, Float progressVideo) {
|
||||||
|
// 处理 processVideo 为 null 的情况
|
||||||
|
if (progressVideo == null) {
|
||||||
|
progressVideo = 0.00f;
|
||||||
|
}
|
||||||
|
String sql = "UPDATE boe_course_content SET progress_video = "+ progressVideo+" WHERE id = "+ id+" AND course_id = "+ courseId+" ";
|
||||||
|
ccDao.sqlUpdate(sql);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateName(String id, String name) {
|
public void updateName(String id, String name) {
|
||||||
|
|||||||
@@ -3,17 +3,26 @@ package com.xboe.module.course.service.impl;
|
|||||||
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;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.List;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.Map;
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.management.Query;
|
||||||
|
|
||||||
|
import com.xboe.api.ThirdApi;
|
||||||
|
import com.xboe.core.orm.*;
|
||||||
|
import com.xboe.data.dto.UserData;
|
||||||
|
import com.xboe.school.study.dao.StudyCourseDao;
|
||||||
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
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.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -26,11 +35,6 @@ import com.xboe.common.beans.KeyValue;
|
|||||||
import com.xboe.common.utils.IDGenerator;
|
import com.xboe.common.utils.IDGenerator;
|
||||||
import com.xboe.common.utils.StringUtil;
|
import com.xboe.common.utils.StringUtil;
|
||||||
import com.xboe.core.event.IEventDataSender;
|
import com.xboe.core.event.IEventDataSender;
|
||||||
import com.xboe.core.orm.FieldFilters;
|
|
||||||
import com.xboe.core.orm.IFieldFilter;
|
|
||||||
import com.xboe.core.orm.LikeMatchMode;
|
|
||||||
import com.xboe.core.orm.QueryBuilder;
|
|
||||||
import com.xboe.core.orm.UpdateBuilder;
|
|
||||||
import com.xboe.module.course.dao.CourseContentDao;
|
import com.xboe.module.course.dao.CourseContentDao;
|
||||||
import com.xboe.module.course.dao.CourseCrowdDao;
|
import com.xboe.module.course.dao.CourseCrowdDao;
|
||||||
import com.xboe.module.course.dao.CourseDao;
|
import com.xboe.module.course.dao.CourseDao;
|
||||||
@@ -112,8 +116,11 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private IEventDataSender eventSender;
|
private IEventDataSender eventSender;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成过滤条件
|
* 生成过滤条件
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -254,36 +261,133 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
return courseDao.findList(query.builder());
|
return courseDao.findList(query.builder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public PageList<Course> findPage(int pageIndex, int pageSize, CourseQueryDto dto) {
|
||||||
|
// List<IFieldFilter> filters = createFilters(dto);
|
||||||
|
// List<IFieldFilter> filters1 = createFilters(dto);
|
||||||
|
// List<IFieldFilter> filters2 = createFilters(dto);
|
||||||
|
//// String s = redisTemplate.opsForValue().get("course_search");
|
||||||
|
//// Set<String>list=new HashSet<>();
|
||||||
|
//// if(s!=null&&!s.isEmpty()){
|
||||||
|
//// list=Arrays.stream(s.split(",")).collect(Collectors.toSet());
|
||||||
|
//// }else {
|
||||||
|
//// Set<String> ss = getSeache(dto);
|
||||||
|
//// String courseSearch=String.join(",",ss);
|
||||||
|
//// redisTemplate.opsForValue().set("course_search",courseSearch);
|
||||||
|
//// //设置过期时间为1分钟
|
||||||
|
//// redisTemplate.expire("course_search", 1, TimeUnit.MINUTES);
|
||||||
|
//// }
|
||||||
|
// Set<String> list = getSeache(dto);
|
||||||
|
// //有权限的查询,也同时查询出创建人的数据,在权限上
|
||||||
|
// if(TempFilterConfig.Manager_CourseFile_ByOrgIds) {
|
||||||
|
// if(dto.getIsSystemAdmin()==null || !dto.getIsSystemAdmin()) {
|
||||||
|
// if(StringUtil.isNotBlank(dto.getOrgIds())){
|
||||||
|
// //log.info("【"+dto.getOrgAid()+"】 按机构过滤和自己创建的课程");
|
||||||
|
// //log.info(" orgids "+dto.getOrgIds());
|
||||||
|
// if(dto.getOrgIds().contains(",")){
|
||||||
|
// String[] split = dto.getOrgIds().split(",");
|
||||||
|
// List<String> strings = Arrays.asList(split);
|
||||||
|
//// filters.add(FieldFilters.or(FieldFilters.in("orgId",strings),FieldFilters.eq("sysCreateAid",dto.getOrgAid())));
|
||||||
|
// filters.add(FieldFilters.in("orgId",strings));
|
||||||
|
// filters1.add(FieldFilters.eq("sysCreateAid",dto.getOrgAid()));
|
||||||
|
// if(!list.isEmpty()){
|
||||||
|
// filters2.add(FieldFilters.in("id",list));
|
||||||
|
// }
|
||||||
|
// }else {
|
||||||
|
//// filters.add(FieldFilters.or(FieldFilters.eq("orgId",dto.getOrgIds()),FieldFilters.eq("sysCreateAid",dto.getOrgAid())));
|
||||||
|
// filters.add(FieldFilters.eq("orgId",dto.getOrgIds()));
|
||||||
|
// filters1.add(FieldFilters.eq("sysCreateAid",dto.getOrgAid()));
|
||||||
|
// if(!list.isEmpty()){
|
||||||
|
// filters2.add(FieldFilters.in("id",list));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (!StringUtil.isNotBlank(dto.getOrgIds())){
|
||||||
|
// //log.info("【"+dto.getOrgAid()+"】 机构ids没有, 只查询自己创建的课程");
|
||||||
|
// //没有机构权限,只能查出自己创建的
|
||||||
|
//// filters.add(FieldFilters.eq("sysCreateAid",dto.getOrgAid()));
|
||||||
|
// filters1.add(FieldFilters.eq("sysCreateAid",dto.getOrgAid()));
|
||||||
|
// if(!list.isEmpty()){
|
||||||
|
// filters2.add(FieldFilters.in("id",list));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }else {
|
||||||
|
// //log.info("【"+dto.getOrgAid()+"】IsSystemAdmin is true 不过机构过滤,查询全部");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //自动添加过滤已删除
|
||||||
|
// filters.add(FieldFilters.eq("deleted",false));
|
||||||
|
// filters1.add(FieldFilters.eq("deleted",false));
|
||||||
|
// filters2.add(FieldFilters.eq("deleted",false));
|
||||||
|
// //同时查出所有项目内课程
|
||||||
|
// OrderCondition oc=null;
|
||||||
|
// if(StringUtils.isNotBlank(dto.getOrderField())) {
|
||||||
|
// if(dto.getOrderAsc()||dto.getOrderAsc()==null) {
|
||||||
|
// oc=OrderCondition.asc(dto.getOrderField());
|
||||||
|
// }else {
|
||||||
|
// oc=OrderCondition.desc(dto.getOrderField());
|
||||||
|
// }
|
||||||
|
// }else {
|
||||||
|
// oc=OrderCondition.desc("id");
|
||||||
|
// }
|
||||||
|
// List<Course> listByFilters = new ArrayList<>();
|
||||||
|
// //根据组织筛选
|
||||||
|
// if(StringUtil.isNotBlank(dto.getOrgIds())){
|
||||||
|
// listByFilters = courseDao.findListByFilters(oc, filters);
|
||||||
|
// }
|
||||||
|
// //根据创建人筛选
|
||||||
|
// List<Course> listByFilters1;
|
||||||
|
// if(!list.isEmpty()){
|
||||||
|
// listByFilters1 = courseDao.findListByFilters(oc, filters1);
|
||||||
|
// } else {
|
||||||
|
// listByFilters1 = new ArrayList<>();
|
||||||
|
// }
|
||||||
|
// //根据list筛选
|
||||||
|
//// List<Course> listByFilters2 = courseDao.findListByFilters(oc, filters2);
|
||||||
|
// //去除根据组织和创建人筛选的课程id
|
||||||
|
// List<Course> finalListByFilters = listByFilters;
|
||||||
|
//// List<Course> collect = list.stream()
|
||||||
|
//// .filter(element -> !finalListByFilters.contains(element))
|
||||||
|
//// .filter(element -> !listByFilters1.contains(element)).collect(Collectors.toList());
|
||||||
|
//// List<String> courseIds = collect.stream().map(Course::getId).collect(Collectors.toList());
|
||||||
|
// //合并
|
||||||
|
// List<Course> mergedList = Stream.concat(listByFilters.stream(), listByFilters1.stream())
|
||||||
|
// // 使用distinct()配合自定义的去重条件
|
||||||
|
// .filter(distinctByKey(c -> c.getId()))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//// PageList<Course> rs=courseDao.findPage(pageIndex, pageSize, filters, oc);
|
||||||
|
//// long endTime = System.nanoTime();
|
||||||
|
// //log.info("查询出的条数:"+rs.getCount());
|
||||||
|
// if(!mergedList.isEmpty()){
|
||||||
|
// //去掉未发布的课程
|
||||||
|
// mergedList.removeIf(e->{
|
||||||
|
// if(!e.getPublished()&&courseIds.contains(e.getId())){
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// });
|
||||||
|
// //
|
||||||
|
// //将需要隐藏的做标记
|
||||||
|
// mergedList.forEach(e->{
|
||||||
|
// if(courseIds.contains(e.getId())){
|
||||||
|
// e.setIsPermission(false);
|
||||||
|
// }else {
|
||||||
|
// e.setIsPermission(true);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// List<Course> paginate = paginate(mergedList, pageIndex, pageSize);
|
||||||
|
// PageList<Course> rs=new PageList<>();
|
||||||
|
// rs.setCount(mergedList.size());
|
||||||
|
// rs.setList(paginate);
|
||||||
|
// return rs;
|
||||||
|
// }
|
||||||
@Override
|
@Override
|
||||||
public PageList<Course> findPage(int pageIndex, int pageSize, CourseQueryDto dto) {
|
public PageList<Course> findPage(int pageIndex, int pageSize, CourseQueryDto dto) {
|
||||||
List<IFieldFilter> filters = createFilters(dto);
|
List<IFieldFilter> filters2 = createFilters(dto);
|
||||||
|
filters2.add(FieldFilters.eq("deleted", false));
|
||||||
//有权限的查询,也同时查询出创建人的数据,在权限上
|
//同时查出所有项目内课程
|
||||||
if(TempFilterConfig.Manager_CourseFile_ByOrgIds) {
|
|
||||||
if(dto.getIsSystemAdmin()==null || !dto.getIsSystemAdmin()) {
|
|
||||||
|
|
||||||
if(StringUtil.isNotBlank(dto.getOrgIds())){
|
|
||||||
//log.info("【"+dto.getOrgAid()+"】 按机构过滤和自己创建的课程");
|
|
||||||
//log.info(" orgids "+dto.getOrgIds());
|
|
||||||
if(dto.getOrgIds().contains(",")){
|
|
||||||
String[] split = dto.getOrgIds().split(",");
|
|
||||||
List<String> strings = Arrays.asList(split);
|
|
||||||
filters.add(FieldFilters.or(FieldFilters.in("orgId",strings),FieldFilters.eq("sysCreateAid",dto.getOrgAid())));
|
|
||||||
}else {
|
|
||||||
filters.add(FieldFilters.or(FieldFilters.eq("orgId",dto.getOrgIds()),FieldFilters.eq("sysCreateAid",dto.getOrgAid())));
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
//log.info("【"+dto.getOrgAid()+"】 机构ids没有, 只查询自己创建的课程");
|
|
||||||
//没有机构权限,只能查出自己创建的
|
|
||||||
filters.add(FieldFilters.eq("sysCreateAid",dto.getOrgAid()));
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
//log.info("【"+dto.getOrgAid()+"】IsSystemAdmin is true 不过机构过滤,查询全部");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//自动添加过滤已删除
|
|
||||||
filters.add(FieldFilters.eq("deleted",false));
|
|
||||||
OrderCondition oc = null;
|
OrderCondition oc = null;
|
||||||
if (StringUtils.isNotBlank(dto.getOrderField())) {
|
if (StringUtils.isNotBlank(dto.getOrderField())) {
|
||||||
if (dto.getOrderAsc() || dto.getOrderAsc() == null) {
|
if (dto.getOrderAsc() || dto.getOrderAsc() == null) {
|
||||||
@@ -294,11 +398,225 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
} else {
|
} else {
|
||||||
oc = OrderCondition.desc("id");
|
oc = OrderCondition.desc("id");
|
||||||
}
|
}
|
||||||
|
//组织id
|
||||||
PageList<Course> rs=courseDao.findPage(pageIndex, pageSize, filters, oc);
|
List<String> strings = new ArrayList<>();
|
||||||
//log.info("查询出的条数:"+rs.getCount());
|
if (StringUtil.isNotBlank(dto.getOrgIds())) {
|
||||||
|
if (dto.getOrgIds().contains(",")) {
|
||||||
|
String[] split = dto.getOrgIds().split(",");
|
||||||
|
strings = Arrays.asList(split);
|
||||||
|
} else {
|
||||||
|
strings.add(dto.getOrgIds());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Set<String> seache = getSeache(dto);
|
||||||
|
//查出全部的课程
|
||||||
|
List<Course> listByFilters2 = courseDao.findListByFilters(oc, filters2);
|
||||||
|
if (TempFilterConfig.Manager_CourseFile_ByOrgIds) {
|
||||||
|
if (dto.getIsSystemAdmin() == null || !dto.getIsSystemAdmin()) {
|
||||||
|
List<String> finalStrings = strings;
|
||||||
|
log.info("dto为"+dto);
|
||||||
|
if(dto.getIsCreateCourse()!=null&&dto.getIsCreateCourse()){
|
||||||
|
listByFilters2.removeIf(e -> {
|
||||||
|
//去掉未发布的课程
|
||||||
|
if (!e.getPublished() && seache.contains(e.getId()) && !finalStrings.contains(e.getOrgId()) && !dto.getOrgAid().equals(e.getSysCreateAid())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//去掉所有条件都不符合的课程
|
||||||
|
if(!seache.contains(e.getId())&&!dto.getReadIds().contains(e.getId())&& !finalStrings.contains(e.getOrgId()) && !dto.getOrgAid().equals(e.getSysCreateAid())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
//将需要隐藏的做标记
|
||||||
|
listByFilters2.forEach(e -> {
|
||||||
|
if ((seache.contains(e.getId())||dto.getReadIds().contains(e.getOrgId())) && !finalStrings.contains(e.getOrgId()) && !dto.getOrgAid().equals(e.getSysCreateAid())) {
|
||||||
|
e.setIsPermission(false);
|
||||||
|
} else {
|
||||||
|
e.setIsPermission(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
listByFilters2.sort(Comparator.comparing(Course::getIsPermission).reversed());
|
||||||
|
}else{
|
||||||
|
List<Course> collect = listByFilters2.stream().filter(e ->dto.getReadIds().contains(e.getOrgId())||dto.getOrgAid().equals(e.getSysCreateAid())||finalStrings.contains(e.getOrgId())).collect(Collectors.toList());
|
||||||
|
List<Course> paginate = paginate(collect, pageIndex, pageSize);
|
||||||
|
PageList<Course> rs = new PageList<>();
|
||||||
|
rs.setCount(collect.size());
|
||||||
|
rs.setList(paginate);
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Course> paginate = paginate(listByFilters2, pageIndex, pageSize);
|
||||||
|
PageList<Course> rs = new PageList<>();
|
||||||
|
rs.setCount(listByFilters2.size());
|
||||||
|
rs.setList(paginate);
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set<String> getSeache(CourseQueryDto dto) {
|
||||||
|
//需要设置为隐藏的课程id
|
||||||
|
Set<String> list = new HashSet<>();
|
||||||
|
List<String> list1 = getProject(dto);
|
||||||
|
List<String> list2 = getRouter(dto);
|
||||||
|
// //有受众权限的课程
|
||||||
|
if (dto.getAudiences() != null && !dto.getAudiences().isEmpty()) {
|
||||||
|
List<String> audiences = getAudiences(dto);
|
||||||
|
list.addAll(audiences);
|
||||||
|
}
|
||||||
|
// //没有受众的课程
|
||||||
|
List<String> noAudiences = getNoAudiences(dto);
|
||||||
|
list.addAll(noAudiences);
|
||||||
|
// //成长路径的课
|
||||||
|
// List<String> grow = getGrow(dto);
|
||||||
|
// //已报名的课
|
||||||
|
List<String> enroll = getEnroll(dto);
|
||||||
|
// list.addAll(grow);
|
||||||
|
list.addAll(enroll);
|
||||||
|
list.addAll(list1);
|
||||||
|
list.addAll(list2);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getRouter(CourseQueryDto dto) {
|
||||||
|
String sql = "SELECT DISTINCT\n" +
|
||||||
|
"rt.course_id\n" +
|
||||||
|
"FROM\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" +
|
||||||
|
"s.deleted = 0 \n" +
|
||||||
|
"and rt.deleted=0\n" +
|
||||||
|
"and rt.type=1\n" +
|
||||||
|
"and c.deleted=0\n" +
|
||||||
|
"AND s.type =2 \n" +
|
||||||
|
"AND s.student_id = ?1";
|
||||||
|
List<String> list = courseTeacherDao.sqlFindList(sql, dto.getOrgAid());
|
||||||
|
List<String> list1 = new ArrayList<>();
|
||||||
|
for (Object obj : list) {
|
||||||
|
list1.add(obj.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return list1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getProject(CourseQueryDto dto) {
|
||||||
|
String sql = "SELECT DISTINCT\n" +
|
||||||
|
"pt.course_id\n" +
|
||||||
|
"FROM\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" +
|
||||||
|
"s.deleted = 0 \n" +
|
||||||
|
"and pt.deleted=0\n" +
|
||||||
|
"and pt.type=1\n" +
|
||||||
|
"and c.deleted=0\n" +
|
||||||
|
"AND s.type =1 \n" +
|
||||||
|
"AND s.student_id = ?1\n";
|
||||||
|
List<Long> list = courseTeacherDao.sqlFindList(sql, dto.getOrgAid());
|
||||||
|
List<String> list1 = new ArrayList<>();
|
||||||
|
for (Object obj : list) {
|
||||||
|
list1.add(obj.toString());
|
||||||
|
}
|
||||||
|
return list1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAudiences(CourseQueryDto dto) {
|
||||||
|
List<String> s = Arrays.asList(dto.getAudiences().split(","));
|
||||||
|
String sql = "SELECT DISTINCT\n" +
|
||||||
|
"\tcc.course_id \n" +
|
||||||
|
"FROM\n" +
|
||||||
|
"\t`boe_course_crowd` cc\n" +
|
||||||
|
"\tINNER JOIN boe_course c ON cc.course_id = c.id \n" +
|
||||||
|
"WHERE\n" +
|
||||||
|
"\tcc.group_id IN (?1) \n" +
|
||||||
|
"\tAND c.deleted =0 ";
|
||||||
|
List<Long> list = courseTeacherDao.sqlFindList(sql, s);
|
||||||
|
List<String> list1 = new ArrayList<>();
|
||||||
|
for (Object obj : list) {
|
||||||
|
list1.add(obj.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return list1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getNoAudiences(CourseQueryDto dto) {
|
||||||
|
String sql = "SELECT\n" +
|
||||||
|
"\tc.id \n" +
|
||||||
|
"FROM\n" +
|
||||||
|
"\tboe_course c \n" +
|
||||||
|
"WHERE\n" +
|
||||||
|
"\t NOT EXISTS ( SELECT 1 FROM boe_course_crowd cc where cc.course_id = c.id ) \n" +
|
||||||
|
"\tAND c.deleted =0 \n";
|
||||||
|
List<Course> list = courseDao.sqlFindList(sql);
|
||||||
|
List<String> list1 = new ArrayList<>();
|
||||||
|
for (Object obj : list) {
|
||||||
|
list1.add(obj.toString());
|
||||||
|
}
|
||||||
|
return list1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getGrow(CourseQueryDto dto) {
|
||||||
|
String sql = "SELECT DISTINCT\n" +
|
||||||
|
"\tc.id \n" +
|
||||||
|
"FROM\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" +
|
||||||
|
"\tAND gt.type = 1 \n" +
|
||||||
|
"\tAND s.deleted = 0 \n" +
|
||||||
|
"\tAND gt.deleted = 0 \n" +
|
||||||
|
"\tAND c.deleted = 0\n" +
|
||||||
|
"\tAND s.student_id = ?1\n";
|
||||||
|
List<Long> list = courseTeacherDao.sqlFindList(sql, dto.getOrgAid());
|
||||||
|
List<String> list1 = new ArrayList<>();
|
||||||
|
for (Object obj : list) {
|
||||||
|
list1.add(obj.toString());
|
||||||
|
}
|
||||||
|
return list1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getEnroll(CourseQueryDto dto) {
|
||||||
|
String sql = "SELECT DISTINCT\n" +
|
||||||
|
"\tsc.course_id \n" +
|
||||||
|
"FROM\n" +
|
||||||
|
"\tboe_study_course sc\n" +
|
||||||
|
"\tINNER JOIN boe_course c ON sc.course_id = c.id \n" +
|
||||||
|
"WHERE\n" +
|
||||||
|
"\tsc.aid = ?1 \n" +
|
||||||
|
"\tAND c.deleted =0";
|
||||||
|
List<Long> list = courseTeacherDao.sqlFindList(sql, dto.getOrgAid());
|
||||||
|
List<String> list1 = new ArrayList<>();
|
||||||
|
for (Object obj : list) {
|
||||||
|
list1.add(obj.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return list1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> List<T> paginate(List<T> list, int pageNumber, int pageSize) {
|
||||||
|
if (list == null || list.isEmpty() || pageNumber <= 0 || pageSize <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fromIndex = (pageNumber - 1) * pageSize;
|
||||||
|
int toIndex = Math.min(fromIndex + pageSize, list.size());
|
||||||
|
|
||||||
|
if (fromIndex >= list.size()) {
|
||||||
|
// 请求的页码超过了最大页数,返回空列表
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list.subList(fromIndex, toIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
||||||
|
Set<Object> seen = ConcurrentHashMap.newKeySet();
|
||||||
|
return t -> seen.add(keyExtractor.apply(t));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Course> findList(CourseQueryDto dto) {
|
public List<Course> findList(CourseQueryDto dto) {
|
||||||
@@ -543,6 +861,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
//记录删除日志信息
|
//记录删除日志信息
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Course get(String id) {
|
public Course get(String id) {
|
||||||
Course c = courseDao.get(id);
|
Course c = courseDao.get(id);
|
||||||
@@ -599,6 +918,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 追加修改日志,共用方法,在其它的修改的地方也可能调用
|
* 追加修改日志,共用方法,在其它的修改的地方也可能调用
|
||||||
|
*
|
||||||
* @param old
|
* @param old
|
||||||
* @param now
|
* @param now
|
||||||
*/
|
*/
|
||||||
@@ -882,7 +1202,6 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
// log.error("课程发布全文检索失败",e);
|
// log.error("课程发布全文检索失败",e);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void audit(String auditId, String courseId, Boolean pass, String aid, String name, String remark, boolean publish, Integer from) {
|
public void audit(String auditId, String courseId, Boolean pass, String aid, String name, String remark, boolean publish, Integer from) {
|
||||||
|
|
||||||
@@ -1028,9 +1347,10 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 赋值赞踩数
|
* 赋值赞踩数
|
||||||
* */
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateTrampleCount(String id, Integer trampleCount) {
|
public void updateTrampleCount(String id, Integer trampleCount) {
|
||||||
courseDao.updateMultiFieldById(id, UpdateBuilder.create("trampleCount", trampleCount));
|
courseDao.updateMultiFieldById(id, UpdateBuilder.create("trampleCount", trampleCount));
|
||||||
@@ -1039,7 +1359,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 赋值点赞数
|
* 赋值点赞数
|
||||||
* */
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CourseTeacher> findTeachersByCourseId(String courseId) {
|
public List<CourseTeacher> findTeachersByCourseId(String courseId) {
|
||||||
@@ -1096,7 +1416,6 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RankingDto> scoreList(int num, int index) {
|
public List<RankingDto> scoreList(int num, int index) {
|
||||||
QueryBuilder builder = QueryBuilder.from(Course.class);
|
QueryBuilder builder = QueryBuilder.from(Course.class);
|
||||||
@@ -1250,7 +1569,6 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int countWaitAudit(String aid) {
|
public int countWaitAudit(String aid) {
|
||||||
//查询待审核的课程
|
//查询待审核的课程
|
||||||
@@ -1490,7 +1808,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回当前课程名字
|
* 返回当前课程名字
|
||||||
* */
|
*/
|
||||||
private String courseName(String id) {
|
private String courseName(String id) {
|
||||||
Course course = courseDao.get(id);
|
Course course = courseDao.get(id);
|
||||||
return course.getName();
|
return course.getName();
|
||||||
@@ -1637,8 +1955,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
"teacher_name from boe_course_teacher where course_id=?1";
|
"teacher_name from boe_course_teacher where course_id=?1";
|
||||||
courseTeacherDao.sqlUpdate(sqlTeacher, id);
|
courseTeacherDao.sqlUpdate(sqlTeacher, id);
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
mess = "长度超出范围";
|
mess = "长度超出范围";
|
||||||
}
|
}
|
||||||
return mess;
|
return mess;
|
||||||
@@ -1663,6 +1980,4 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class ExamTest extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 考试名称
|
* 考试名称
|
||||||
* */
|
* */
|
||||||
@Column(name = "test_name",nullable = false,length = 50)
|
@Column(name = "test_name",length = 50)
|
||||||
private String testName;
|
private String testName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +46,7 @@ public class ExamTest extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 考试时长 分钟
|
* 考试时长 分钟
|
||||||
* */
|
* */
|
||||||
@Column(name = "test_duration",nullable = false)
|
@Column(name = "test_duration")
|
||||||
private Integer testDuration;
|
private Integer testDuration;
|
||||||
/**
|
/**
|
||||||
* 显示解析
|
* 显示解析
|
||||||
@@ -107,13 +107,13 @@ public class ExamTest extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 考试的类型
|
* 考试的类型
|
||||||
* */
|
* */
|
||||||
@Column(name = "test_type",nullable = false)
|
@Column(name = "test_type")
|
||||||
private Integer testType;
|
private Integer testType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布状态 ,是否已发布
|
* 发布状态 ,是否已发布
|
||||||
*/
|
*/
|
||||||
@Column(name = "published",length = 1,nullable = false)
|
@Column(name = "published",length = 1)
|
||||||
private Boolean published;
|
private Boolean published;
|
||||||
/**
|
/**
|
||||||
* 发布时间
|
* 发布时间
|
||||||
@@ -154,7 +154,7 @@ public class ExamTest extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 范围,1表独立使用,2表课程内部
|
* 范围,1表独立使用,2表课程内部
|
||||||
* */
|
* */
|
||||||
@Column(name = "range_type",nullable = false)
|
@Column(name = "range_type")
|
||||||
private Integer rangeType;
|
private Integer rangeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class ExamTestServiceImpl implements IExamTestService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean has(String paperId) {
|
public Boolean has(String paperId) {
|
||||||
ExamTest et=examTestDao.findOne(FieldFilters.eq("paperId", paperId));
|
ExamTest et=examTestDao.findOne(FieldFilters.eq("paperId", paperId),FieldFilters.eq("deleted", false));
|
||||||
//String etId= (String)examTestDao.findField("id", FieldFilters.eq("paperId", paperId));
|
//String etId= (String)examTestDao.findField("id", FieldFilters.eq("paperId", paperId));
|
||||||
if(et==null){
|
if(et==null){
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -321,8 +321,19 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
if (StringUtils.isEmpty(token)) {
|
if (StringUtils.isEmpty(token)) {
|
||||||
token = request.getHeader("token");
|
token = request.getHeader("token");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//检查是否已存在
|
//检查是否已存在
|
||||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||||
|
|
||||||
|
// 20240815 特训营结营考试 临时代码
|
||||||
|
// if(item != null && redisTemplate.opsForValue().get(item.getId())==null){
|
||||||
|
// redisTemplate.opsForValue().set(item.getId(),item.getId());
|
||||||
|
// //设置过期时间为1天
|
||||||
|
// redisTemplate.expire(item.getId(), 60, TimeUnit.SECONDS);
|
||||||
|
// }else{
|
||||||
|
// return success("");
|
||||||
|
// }
|
||||||
if(item!=null) {
|
if(item!=null) {
|
||||||
//如果记录存在,但是进度不100无成情况,就更新进度,一期不会有这种情况
|
//如果记录存在,但是进度不100无成情况,就更新进度,一期不会有这种情况
|
||||||
if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
||||||
@@ -407,6 +418,14 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||||
if(item!=null) {
|
if(item!=null) {
|
||||||
//如果记录存在,但是进度不到100,未完成情况,就更新进度,一期不会有这种情况
|
//如果记录存在,但是进度不到100,未完成情况,就更新进度,一期不会有这种情况
|
||||||
|
// 20240815 特训营结营考试 临时代码
|
||||||
|
// if(item != null && redisTemplate.opsForValue().get(item.getId())==null){
|
||||||
|
// redisTemplate.opsForValue().set(item.getId(),item.getId());
|
||||||
|
// //设置过期时间为1天
|
||||||
|
// redisTemplate.expire(item.getId(), 60, TimeUnit.SECONDS);
|
||||||
|
// }else{
|
||||||
|
// return success("");
|
||||||
|
// }
|
||||||
if(item.getProgress()<100) {
|
if(item.getProgress()<100) {
|
||||||
studyService.updateProcess(item.getId(),sci.getStudyId(),sci.getCourseId(), sci.getContentTotal(),100,token);
|
studyService.updateProcess(item.getId(),sci.getStudyId(),sci.getCourseId(), sci.getContentTotal(),100,token);
|
||||||
}
|
}
|
||||||
@@ -512,6 +531,14 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
token = request.getHeader("token");
|
token = request.getHeader("token");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
// 20240815 特训营结营考试 临时代码
|
||||||
|
// if(itemId != null && redisTemplate.opsForValue().get(itemId)==null){
|
||||||
|
// redisTemplate.opsForValue().set(itemId,itemId);
|
||||||
|
// //设置过期时间为1天
|
||||||
|
// redisTemplate.expire(itemId, 60, TimeUnit.SECONDS);
|
||||||
|
// }else{
|
||||||
|
// return success(true);
|
||||||
|
// }
|
||||||
studyService.finishVideoStudyItem(itemId, studyId,courseId,cnum,token);
|
studyService.finishVideoStudyItem(itemId, studyId,courseId,cnum,token);
|
||||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
||||||
log.info("在线课学习记录"+allUserList);
|
log.info("在线课学习记录"+allUserList);
|
||||||
@@ -529,7 +556,7 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/study-video-time")
|
@PostMapping("/study-video-time")
|
||||||
public JsonResponse<Boolean> study(String studyId,String itemId,Integer videoTime){
|
public JsonResponse<Boolean> study(String itemId,Integer videoTime,String contentId , String courseId,Float progressVideo){
|
||||||
|
|
||||||
if(StringUtils.isBlank(itemId)){
|
if(StringUtils.isBlank(itemId)){
|
||||||
return error("参数错误");
|
return error("参数错误");
|
||||||
@@ -540,6 +567,9 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
//检查是否已存在
|
//检查是否已存在
|
||||||
try {
|
try {
|
||||||
studyService.updateLastTime(itemId,videoTime, getCurrent().getAccountId());
|
studyService.updateLastTime(itemId,videoTime, getCurrent().getAccountId());
|
||||||
|
if (contentId != null && courseId != null && progressVideo != null){
|
||||||
|
contentService.updateProcessVideo(contentId, courseId, progressVideo);
|
||||||
|
}
|
||||||
return success(true);
|
return success(true);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
log.error("记录最后学习时间错误",e);
|
log.error("记录最后学习时间错误",e);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class StudyAssessServiceImpl implements IStudyAssessService{
|
|||||||
LocalDateTime ldt=LocalDateTime.now();
|
LocalDateTime ldt=LocalDateTime.now();
|
||||||
sci.setStudyId(assess.getStudyId());
|
sci.setStudyId(assess.getStudyId());
|
||||||
sci.setContentId(assess.getContentId());
|
sci.setContentId(assess.getContentId());
|
||||||
//sci.setContentName(homework.getContentName());
|
sci.setContentName("评估");
|
||||||
sci.setCourseId(assess.getCourseId());
|
sci.setCourseId(assess.getCourseId());
|
||||||
//sci.setCsectionId(homework.getCsectionId());
|
//sci.setCsectionId(homework.getCsectionId());
|
||||||
sci.setProgress(100);//直接设置为学习完成
|
sci.setProgress(100);//直接设置为学习完成
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
|||||||
LocalDateTime ldt=LocalDateTime.now();
|
LocalDateTime ldt=LocalDateTime.now();
|
||||||
sci.setStudyId(exam.getStudyId());
|
sci.setStudyId(exam.getStudyId());
|
||||||
sci.setContentId(exam.getContentId());
|
sci.setContentId(exam.getContentId());
|
||||||
//sci.setContentName(homework.getContentName());
|
sci.setContentName("考试");
|
||||||
sci.setCourseId(exam.getCourseId());
|
sci.setCourseId(exam.getCourseId());
|
||||||
//sci.setCsectionId(homework.getCsectionId());
|
//sci.setCsectionId(homework.getCsectionId());
|
||||||
sci.setProgress(prog);//直接设置为学习完成
|
sci.setProgress(prog);//直接设置为学习完成
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
|||||||
LocalDateTime ldt=LocalDateTime.now();
|
LocalDateTime ldt=LocalDateTime.now();
|
||||||
sci.setStudyId(homework.getStudyId());
|
sci.setStudyId(homework.getStudyId());
|
||||||
sci.setContentId(homework.getContentId());
|
sci.setContentId(homework.getContentId());
|
||||||
//sci.setContentName(homework.getContentName());
|
sci.setContentName(homework.getHwName());
|
||||||
sci.setCourseId(homework.getCourseId());
|
sci.setCourseId(homework.getCourseId());
|
||||||
//sci.setCsectionId(homework.getCsectionId());
|
//sci.setCsectionId(homework.getCsectionId());
|
||||||
sci.setProgress(100);//直接设置为学习完成
|
sci.setProgress(100);//直接设置为学习完成
|
||||||
@@ -67,7 +67,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
|||||||
//只是保留一条作业记录,不再保存多条记录了
|
//只是保留一条作业记录,不再保存多条记录了
|
||||||
//dao.save(homework);
|
//dao.save(homework);
|
||||||
//设置id。然后进行悠
|
//设置id。然后进行悠
|
||||||
homework.setId(obj.toString());
|
homework.setId(homework.getStudyItemId());
|
||||||
dao.update(homework);
|
dao.update(homework);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,16 +193,16 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
}else if (status == 1) {
|
}else if (status == 1) {
|
||||||
String sql = "select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
|
String sql = "select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
|
||||||
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
|
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
|
||||||
" where bsc.course_id = '"+courseId+"' and bsc.id not in(" +
|
" where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' and bsc.id not in(" +
|
||||||
" select item.study_id from boe_study_course_item item " +
|
" select item.study_id from boe_study_course_item item " +
|
||||||
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" +
|
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" +
|
||||||
" ) group by bsc.id limit "+ pageIndex2+","+ pageSize+";";
|
" ) group by bsc.id limit "+ pageIndex2+","+ pageSize+";";
|
||||||
|
|
||||||
String sql2 = "select count(*) as total from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
|
String sql2 = "select count(*) as total from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
|
||||||
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
|
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
|
||||||
" where bsc.course_id = '"+courseId+"' and bsc.id not in(" +
|
" where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' and bsc.id not in(" +
|
||||||
" select item.study_id from boe_study_course_item item " +
|
" select item.study_id from boe_study_course_item item " +
|
||||||
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" +
|
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" +
|
||||||
" ) group by bsc.id) as total";
|
" ) group by bsc.id) as total";
|
||||||
log.info("资源完成情况未开始sql"+sql);
|
log.info("资源完成情况未开始sql"+sql);
|
||||||
List<Object[]> list = scDao.sqlFindList(sql);
|
List<Object[]> list = scDao.sqlFindList(sql);
|
||||||
@@ -224,46 +224,22 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
return pageList;
|
return pageList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// String sql = "select * from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.progress,item.status 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.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " +
|
|
||||||
// " UNION ALL " +
|
|
||||||
// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " +
|
|
||||||
// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " +
|
|
||||||
// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" +
|
|
||||||
// " select bsc.id 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+"' group by bsc.id" +
|
|
||||||
// " )group by bsc.id) a group by a.id limit "+ pageIndex+","+ pageSize+";";
|
|
||||||
|
|
||||||
// String sql2 = "select count(*) from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.progress,item.status 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.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " +
|
|
||||||
// " UNION ALL " +
|
|
||||||
// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " +
|
|
||||||
// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " +
|
|
||||||
// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" +
|
|
||||||
// " select bsc.id 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+"' group by bsc.id" +
|
|
||||||
// " )group by bsc.id) a group by a.id";
|
|
||||||
|
|
||||||
String sql = "select a.id, a.course_id, a.course_name, a.aname, " +
|
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 " +
|
||||||
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') a " +
|
"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 " +
|
"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 " +
|
||||||
"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 " +
|
"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 + "' group by bsc.id) b " +
|
"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 " +
|
"on a.course_id = b.course_id and a.id = b.id " +
|
||||||
"group by a.id limit "+ pageIndex2+","+ pageSize+";";
|
"group by a.id limit "+ pageIndex2+","+ pageSize+";";
|
||||||
String sql2 = "select count(*) as total from (select a.id, a.course_id, a.course_name, a.aname, " +
|
String sql2 = "select count(*) as total from (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 " +
|
||||||
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') a " +
|
"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 " +
|
"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 " +
|
||||||
"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 " +
|
"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 + "' group by bsc.id) b " +
|
"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 " +
|
"on a.course_id = b.course_id and a.id = b.id " +
|
||||||
"group by a.id) as total";
|
"group by a.id) as total";
|
||||||
log.info("资源完成情况全部sql"+sql);
|
log.info("资源完成情况全部sql"+sql);
|
||||||
|
|||||||
Reference in New Issue
Block a user