mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-14 05:16:49 +08:00
Merge remote-tracking branch 'yx/code-review-0827-yang'
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
||||||
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
|
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
|
||||||
<nacos-client.version>2.2.0</nacos-client.version>
|
<nacos-client.version>2.2.0</nacos-client.version>
|
||||||
|
<tomcat.version>9.0.69</tomcat.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- 引入Cloud -->
|
<!-- 引入Cloud -->
|
||||||
@@ -58,11 +59,19 @@
|
|||||||
<artifactId>xboe-module-scorm</artifactId>
|
<artifactId>xboe-module-scorm</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xboe</groupId>
|
<groupId>com.xboe</groupId>
|
||||||
<artifactId>xboe-core</artifactId>
|
<artifactId>xboe-core</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-text</artifactId>
|
||||||
|
<version>1.10.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xboe</groupId>
|
<groupId>com.xboe</groupId>
|
||||||
<artifactId>xboe-redis</artifactId>
|
<artifactId>xboe-redis</artifactId>
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.xboe.module.course.dao;
|
package com.xboe.module.course.dao;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.xboe.core.orm.BaseDao;
|
import com.xboe.core.orm.BaseDao;
|
||||||
import com.xboe.module.course.entity.CourseContent;
|
import com.xboe.module.course.entity.CourseContent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class CourseContentDao extends BaseDao<CourseContent> {
|
public class CourseContentDao extends BaseDao<CourseContent> {
|
||||||
|
|
||||||
@@ -20,4 +23,5 @@ public class CourseContentDao extends BaseDao<CourseContent> {
|
|||||||
int count=count(hql, courseId);
|
int count=count(hql, courseId);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -101,5 +106,20 @@ public class CourseContent extends BaseEntity {
|
|||||||
this.contentRefId=contentRefId;
|
this.contentRefId=contentRefId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "CourseContent{" +
|
||||||
|
"rid='" + rid + '\'' +
|
||||||
|
", typeId='" + typeId + '\'' +
|
||||||
|
", courseId='" + courseId + '\'' +
|
||||||
|
", csectionId='" + csectionId + '\'' +
|
||||||
|
", sortIndex=" + sortIndex +
|
||||||
|
", contentType=" + contentType +
|
||||||
|
", contentName='" + contentName + '\'' +
|
||||||
|
", contentRefId='" + contentRefId + '\'' +
|
||||||
|
", content='" + content + '\'' +
|
||||||
|
", duration=" + duration +
|
||||||
|
", status=" + status +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.xboe.api.vo.*;
|
|||||||
import com.xboe.module.course.vo.TeacherVo;
|
import com.xboe.module.course.vo.TeacherVo;
|
||||||
import com.xboe.module.usergroup.entity.UserGroupItem;
|
import com.xboe.module.usergroup.entity.UserGroupItem;
|
||||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
import com.xboe.module.usergroup.service.IUserGroupService;
|
||||||
|
import com.xboe.school.study.dao.StudyCourseDao;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -66,6 +67,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
@RequestMapping(value="/xboe/school/study/course")
|
@RequestMapping(value="/xboe/school/study/course")
|
||||||
public class StudyCourseApi extends ApiBaseController{
|
public class StudyCourseApi extends ApiBaseController{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IStudyCourseService service;
|
IStudyCourseService service;
|
||||||
|
|
||||||
@@ -321,8 +324,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 +421,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 +534,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 +559,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 +570,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);
|
||||||
@@ -691,8 +724,9 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value="/study-course-content",method = {RequestMethod.GET,RequestMethod.POST})
|
@RequestMapping(value="/study-course-content",method = {RequestMethod.GET,RequestMethod.POST})
|
||||||
public JsonResponse<StudyCourseItem> findStudyCourseItem(String studyId,String contentId){
|
public JsonResponse<StudyCourseItem> findStudyCourseItem(String studyId,String contentId, HttpServletRequest request){
|
||||||
if(StringUtils.isBlank(studyId)){
|
if(StringUtils.isBlank(studyId)){
|
||||||
return error("无学习信息");
|
return error("无学习信息");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import com.xboe.api.ThirdApi;
|
import com.xboe.api.ThirdApi;
|
||||||
|
import com.xboe.school.study.dao.StudyCourseDao;
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -32,6 +33,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value="/xboe/school/study/exam")
|
@RequestMapping(value="/xboe/school/study/exam")
|
||||||
public class StudyExamApi extends ApiBaseController{
|
public class StudyExamApi extends ApiBaseController{
|
||||||
|
@Autowired
|
||||||
|
StudyCourseDao scDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IStudyExamService sexamService;
|
IStudyExamService sexamService;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.xboe.common.OrderCondition;
|
|||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.common.beans.KeyValue;
|
import com.xboe.common.beans.KeyValue;
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
|
import com.xboe.school.study.entity.StudyCourseItem;
|
||||||
import com.xboe.school.study.entity.StudySignup;
|
import com.xboe.school.study.entity.StudySignup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,6 +50,13 @@ public interface IStudySignupService {
|
|||||||
*/
|
*/
|
||||||
StudyCourse addSignup(StudySignup signup);
|
StudyCourse addSignup(StudySignup signup);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员添加报名课件
|
||||||
|
* @param signup
|
||||||
|
*/
|
||||||
|
StudyCourseItem addStudyCourseItem(StudySignup signup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除报名,只有未审核过的才可以删除
|
* 删除报名,只有未审核过的才可以删除
|
||||||
* @param id
|
* @param id
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.xboe.school.study.service.impl;
|
package com.xboe.school.study.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -8,7 +11,8 @@ import java.util.Map;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
import com.xboe.api.ThirdApi;
|
import com.xboe.module.article.entity.Article;
|
||||||
|
import com.xboe.module.interaction.entity.Shares;
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -94,8 +98,12 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
//sci.setProgress(100);//直接设置为学习完成
|
//sci.setProgress(100);//直接设置为学习完成
|
||||||
sci.setLastTime(ldt);
|
sci.setLastTime(ldt);
|
||||||
scItemDao.saveOrUpdate(sci);
|
scItemDao.saveOrUpdate(sci);
|
||||||
|
if (sci.getId() != null){
|
||||||
dto.setStudyItemId(sci.getId());
|
dto.setStudyItemId(sci.getId());
|
||||||
|
}else {
|
||||||
|
log.info("学习记录插入失败"+sci.getId());
|
||||||
|
throw new IllegalArgumentException("学习记录插入失败");
|
||||||
|
}
|
||||||
//检查是否全部学习完成
|
//检查是否全部学习完成
|
||||||
scDao.finishCheck(dto.getStudyId(),dto.getCourseId(),dto.getContentTotal(),token);
|
scDao.finishCheck(dto.getStudyId(),dto.getCourseId(),dto.getContentTotal(),token);
|
||||||
|
|
||||||
@@ -163,9 +171,7 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageList<StudyCourseItem> findItemPage(int pageIndex, int pageSize, String contentId, String courseId,String name,Integer status) {
|
public PageList<StudyCourseItem> findItemPage(int pageIndex, int pageSize, String contentId, String courseId,String name,Integer status) {
|
||||||
|
|
||||||
QueryBuilder query = QueryBuilder.from(StudyCourseItem.class);
|
QueryBuilder query = QueryBuilder.from(StudyCourseItem.class);
|
||||||
|
|
||||||
query.setPageIndex(pageIndex);
|
query.setPageIndex(pageIndex);
|
||||||
query.setPageSize(pageSize);
|
query.setPageSize(pageSize);
|
||||||
|
|
||||||
@@ -177,19 +183,92 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
if(StringUtils.isNotBlank(courseId)) {
|
if(StringUtils.isNotBlank(courseId)) {
|
||||||
query.addFilter(FieldFilters.eq("courseId",courseId));
|
query.addFilter(FieldFilters.eq("courseId",courseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(status!=null) {
|
|
||||||
if(status==1) {
|
|
||||||
query.addFilter(FieldFilters.eq("progress", 0));
|
|
||||||
}else {
|
|
||||||
query.addFilter(FieldFilters.eq("progress",100));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if(StringUtils.isNotBlank(name)) {
|
if(StringUtils.isNotBlank(name)) {
|
||||||
query.addFilter(FieldFilters.eq("aname", name));
|
query.addFilter(FieldFilters.eq("aname", name));
|
||||||
}
|
}
|
||||||
|
int pageIndex2 = (pageIndex-1)*10;
|
||||||
|
if(status!=null) {
|
||||||
|
if(status==3) {
|
||||||
|
query.addFilter(FieldFilters.eq("status", 2));
|
||||||
return scItemDao.findPage(query.builder());
|
return scItemDao.findPage(query.builder());
|
||||||
|
}else if(status==2){
|
||||||
|
query.addFilter(FieldFilters.eq("status",9));
|
||||||
|
return scItemDao.findPage(query.builder());
|
||||||
|
}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 " +
|
||||||
|
" 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.aname like '%"+name+"%' and bsc.id not in(" +
|
||||||
|
" select item.study_id from boe_study_course_item item " +
|
||||||
|
" 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+";";
|
||||||
|
|
||||||
|
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" +
|
||||||
|
" 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 " +
|
||||||
|
" 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";
|
||||||
|
log.info("资源完成情况未开始sql"+sql);
|
||||||
|
List<Object[]> list = scDao.sqlFindList(sql);
|
||||||
|
log.info("资源完成情况人数"+list);
|
||||||
|
int totalCount = scDao.sqlCount(sql2);
|
||||||
|
List<StudyCourseItem> item = new ArrayList<>();
|
||||||
|
for (Object[] objs : list) {
|
||||||
|
StudyCourseItem sc = new StudyCourseItem();
|
||||||
|
sc.setProgress(Integer.valueOf(objs[5].toString()));
|
||||||
|
sc.setStatus(Integer.valueOf(objs[6].toString()));
|
||||||
|
sc.setAname(objs[3].toString());
|
||||||
|
item.add(sc);
|
||||||
|
}
|
||||||
|
log.info("资源完成情况人员"+item);
|
||||||
|
PageList<StudyCourseItem> pageList = new PageList<>(item);
|
||||||
|
pageList.setCount(totalCount);
|
||||||
|
pageList.setPageSize(pageSize);
|
||||||
|
pageList.setList(item);
|
||||||
|
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 " +
|
||||||
|
"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 " +
|
||||||
|
"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 " +
|
||||||
|
"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, " +
|
||||||
|
"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 + "' 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 " +
|
||||||
|
"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 " +
|
||||||
|
"group by a.id) as total";
|
||||||
|
log.info("资源完成情况全部sql"+sql);
|
||||||
|
List<Object[]> list = scDao.sqlFindList(sql);
|
||||||
|
log.info("资源完成情况人数"+list);
|
||||||
|
int totalCount = scDao.sqlCount(sql2);
|
||||||
|
List<StudyCourseItem> item = new ArrayList<>();
|
||||||
|
for (Object[] objs : list) {
|
||||||
|
StudyCourseItem sc = new StudyCourseItem();
|
||||||
|
if (!"0".equals(objs[4].toString())) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime finishTime = LocalDateTime.parse(objs[4].toString(), formatter);
|
||||||
|
sc.setFinishTime(finishTime);
|
||||||
|
}
|
||||||
|
sc.setProgress(Integer.valueOf(objs[5].toString()));
|
||||||
|
sc.setStatus(Integer.valueOf(objs[6].toString()));
|
||||||
|
sc.setAname(objs[3].toString());
|
||||||
|
item.add(sc);
|
||||||
|
}
|
||||||
|
log.info("资源完成情况人员"+item);
|
||||||
|
PageList<StudyCourseItem> pageList = new PageList<>(item);
|
||||||
|
pageList.setCount(totalCount);
|
||||||
|
pageList.setPageSize(pageSize);
|
||||||
|
pageList.setList(item);
|
||||||
|
return pageList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,15 @@ import java.io.IOException;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
import com.xboe.module.course.dao.CourseContentDao;
|
||||||
|
import com.xboe.module.course.dto.CourseContentDto;
|
||||||
|
import com.xboe.module.course.entity.CourseContent;
|
||||||
|
import com.xboe.school.study.dao.StudyCourseItemDao;
|
||||||
|
import com.xboe.school.study.entity.StudyCourseItem;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -40,6 +46,12 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
|||||||
@Autowired
|
@Autowired
|
||||||
StudyCourseDao studyCourseDao;
|
StudyCourseDao studyCourseDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StudyCourseItemDao scItemDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CourseContentDao contentDao;
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
ICourseStudySearch esSearch;
|
ICourseStudySearch esSearch;
|
||||||
|
|
||||||
@@ -69,7 +81,6 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
|||||||
signupDao.save(signup);
|
signupDao.save(signup);
|
||||||
//添加到课程学习
|
//添加到课程学习
|
||||||
LocalDateTime now=LocalDateTime.now();
|
LocalDateTime now=LocalDateTime.now();
|
||||||
|
|
||||||
StudyCourse sc=new StudyCourse();
|
StudyCourse sc=new StudyCourse();
|
||||||
sc.setAddTime(now);
|
sc.setAddTime(now);
|
||||||
sc.setAid(signup.getAid());
|
sc.setAid(signup.getAid());
|
||||||
@@ -124,11 +135,40 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
|||||||
//courseDao.updateMultiFieldById(signup.getCourseId(),UpdateBuilder.create("studys", "studys+1",FieldUpdateType.EXPRESSION));
|
//courseDao.updateMultiFieldById(signup.getCourseId(),UpdateBuilder.create("studys", "studys+1",FieldUpdateType.EXPRESSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StudyCourseItem addStudyCourseItem(StudySignup signup) {
|
||||||
|
String sql = "select id,course_id,content_name from boe_course_content where course_id = '"+signup.getCourseId()+"'";
|
||||||
|
List<Object[]> courseContents = contentDao.sqlFindList(sql);
|
||||||
|
if (!courseContents.isEmpty()) {
|
||||||
|
log.info("查看在线课集合内容数据(共 {} 条记录)", courseContents.size());
|
||||||
|
for (Object[] objs : courseContents){
|
||||||
|
log.info("查看在线课内容数据: {}", objs[0].toString());
|
||||||
|
// 使用toString()或自定义格式化字符串
|
||||||
|
StudyCourseItem scitem = new StudyCourseItem();
|
||||||
|
// 设置scitem的属性
|
||||||
|
scitem.setAname(signup.getName());
|
||||||
|
scitem.setAid(signup.getAid());
|
||||||
|
scitem.setCourseId(signup.getCourseId());
|
||||||
|
scitem.setProgress(0);
|
||||||
|
scitem.setScore(0f);
|
||||||
|
scitem.setStatus(1);
|
||||||
|
scitem.setContentId(objs[0].toString());
|
||||||
|
scitem.setStudyId(signup.getStudyId());
|
||||||
|
// 如果需要,可以取消注释以下行来设置contentName
|
||||||
|
// scitem.setContentName(c.getContentName());
|
||||||
|
scItemDao.save(scitem);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("没有找到在线课内容数据。");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void addList(List<StudySignup> list) {
|
public void addList(List<StudySignup> list) {
|
||||||
//用于管理员添加报名
|
//用于管理员添加报名
|
||||||
for(StudySignup ss : list) {
|
for(StudySignup ss : list) {
|
||||||
addSignup(ss);
|
addSignup(ss);
|
||||||
|
// addStudyCourseItem(ss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +176,6 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
|||||||
public void audit(String id, String aid, String user, boolean pass, String remark) {
|
public void audit(String id, String aid, String user, boolean pass, String remark) {
|
||||||
if(pass) {
|
if(pass) {
|
||||||
StudySignup signup =signupDao.get(id);
|
StudySignup signup =signupDao.get(id);
|
||||||
|
|
||||||
//是否需要检查是否已报名
|
//是否需要检查是否已报名
|
||||||
StudyCourse sc=new StudyCourse();
|
StudyCourse sc=new StudyCourse();
|
||||||
sc.setAddTime(LocalDateTime.now());
|
sc.setAddTime(LocalDateTime.now());
|
||||||
|
|||||||
Reference in New Issue
Block a user