mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 09:26:48 +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-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
|
||||
<nacos-client.version>2.2.0</nacos-client.version>
|
||||
<tomcat.version>9.0.69</tomcat.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- 引入Cloud -->
|
||||
@@ -58,11 +59,19 @@
|
||||
<artifactId>xboe-module-scorm</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<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.school.study.entity.StudyCourse;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import com.xboe.system.user.entity.User;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -17,5 +17,7 @@ public class UserOrgIds {
|
||||
private Map<String,Boolean> permissions=new HashMap<String,Boolean>();
|
||||
|
||||
private List<String> ids;
|
||||
//hrbp只读权限
|
||||
private List<String> readIds;
|
||||
|
||||
}
|
||||
|
||||
@@ -229,8 +229,10 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
public UserOrgIds getOrgIds() {
|
||||
UserOrgIds uids=new UserOrgIds();
|
||||
List<String> orgIds = new ArrayList<>();
|
||||
|
||||
List<String> readIds = new ArrayList<>();
|
||||
|
||||
uids.setIds(orgIds);
|
||||
uids.setReadIds(readIds);
|
||||
String token = TokenProxy.getToken(request);
|
||||
String type="application/json";
|
||||
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||
@@ -281,7 +283,8 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
while (elements.hasNext()){
|
||||
String oid=elements.next().asText();
|
||||
if(!orgSetIds.contains(oid)) {
|
||||
orgIds.add(oid);
|
||||
// orgIds.add(oid);
|
||||
readIds.add(oid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.xboe.module.course.api;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -134,7 +130,6 @@ public class CourseManageApi extends ApiBaseController{
|
||||
}else {
|
||||
dto.setIsSystemAdmin(false);
|
||||
}
|
||||
|
||||
String ids="";
|
||||
if(userOrgIds.getIds()!=null && !userOrgIds.getIds().isEmpty())
|
||||
{
|
||||
@@ -142,12 +137,14 @@ public class CourseManageApi extends ApiBaseController{
|
||||
}
|
||||
//log.info("获取到的用户的组织机构权限ids",ids);
|
||||
String aid=getCurrent().getAccountId();
|
||||
// String aid="1706272694871445506";
|
||||
//如果前端查询当前人的,这里去掉
|
||||
if(StringUtils.isNotBlank(dto.getAid())) {
|
||||
dto.setAid(null);
|
||||
}
|
||||
dto.setOrgAid(aid);
|
||||
dto.setOrgIds(ids);
|
||||
dto.setReadIds(userOrgIds.getReadIds());
|
||||
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
|
||||
return success(coursePageList);
|
||||
}catch(Exception e) {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.xboe.module.course.dao;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.course.entity.CourseContent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class CourseContentDao extends BaseDao<CourseContent> {
|
||||
|
||||
@@ -20,4 +23,5 @@ public class CourseContentDao extends BaseDao<CourseContent> {
|
||||
int count=count(hql, courseId);
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.xboe.module.course.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 课程查询的条件对象
|
||||
*/
|
||||
@@ -102,6 +104,9 @@ public class CourseQueryDto {
|
||||
* */
|
||||
private String orgIds;
|
||||
|
||||
//hrpb只读
|
||||
private List<String> readIds;
|
||||
|
||||
/**用户权限的查询*/
|
||||
private String orgAid;
|
||||
|
||||
@@ -110,6 +115,11 @@ public class CourseQueryDto {
|
||||
*/
|
||||
private Boolean isSystemAdmin;
|
||||
|
||||
/**
|
||||
* 是否是新建在线可
|
||||
*/
|
||||
private Boolean isCreateCourse;
|
||||
|
||||
private Boolean visible;
|
||||
|
||||
private String refId;
|
||||
@@ -129,4 +139,5 @@ public class CourseQueryDto {
|
||||
* 登录人id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
}
|
||||
|
||||
@@ -370,6 +370,9 @@ public class Course extends BaseEntity {
|
||||
|
||||
@Column(name = "ref_type",length=32,columnDefinition="varchar(32) comment '反向关联的类型'")
|
||||
private String refType;
|
||||
|
||||
@Transient
|
||||
private Boolean isPermission=true;
|
||||
|
||||
@Transient
|
||||
private String orgName;
|
||||
|
||||
@@ -83,8 +83,13 @@ public class CourseContent extends BaseEntity {
|
||||
* */
|
||||
@Column(name = "duration")
|
||||
private Integer duration;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 视频播放进度
|
||||
* */
|
||||
@Column(name = "progress_video")
|
||||
private Float progressVideo;
|
||||
|
||||
/**用于学习时的状态显示,非存储字段*/
|
||||
@Transient
|
||||
private Integer status;
|
||||
@@ -100,6 +105,21 @@ public class CourseContent extends BaseEntity {
|
||||
this.contentType=contentType;
|
||||
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
|
||||
*/
|
||||
CourseAssess getAssess(String ccid);
|
||||
|
||||
void updateProcessVideo(String contentId, String courseId, Float processVideo);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.xboe.module.course.service.impl;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -141,6 +143,17 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
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
|
||||
@Transactional
|
||||
public void updateName(String id, String name) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public class ExamTest extends BaseEntity {
|
||||
/**
|
||||
* 考试时长 分钟
|
||||
* */
|
||||
@Column(name = "test_duration",nullable = false)
|
||||
@Column(name = "test_duration")
|
||||
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;
|
||||
|
||||
/**
|
||||
* 发布状态 ,是否已发布
|
||||
*/
|
||||
@Column(name = "published",length = 1,nullable = false)
|
||||
@Column(name = "published",length = 1)
|
||||
private Boolean published;
|
||||
/**
|
||||
* 发布时间
|
||||
@@ -154,7 +154,7 @@ public class ExamTest extends BaseEntity {
|
||||
/**
|
||||
* 范围,1表独立使用,2表课程内部
|
||||
* */
|
||||
@Column(name = "range_type",nullable = false)
|
||||
@Column(name = "range_type")
|
||||
private Integer rangeType;
|
||||
|
||||
/**
|
||||
|
||||
@@ -95,7 +95,7 @@ public class ExamTestServiceImpl implements IExamTestService {
|
||||
|
||||
@Override
|
||||
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));
|
||||
if(et==null){
|
||||
return true;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.xboe.api.vo.*;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.usergroup.entity.UserGroupItem;
|
||||
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.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -65,7 +66,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
@RestController
|
||||
@RequestMapping(value="/xboe/school/study/course")
|
||||
public class StudyCourseApi extends ApiBaseController{
|
||||
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
IStudyCourseService service;
|
||||
|
||||
@@ -321,8 +324,19 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
|
||||
|
||||
//检查是否已存在
|
||||
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) {
|
||||
//如果记录存在,但是进度不100无成情况,就更新进度,一期不会有这种情况
|
||||
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());
|
||||
if(item!=null) {
|
||||
//如果记录存在,但是进度不到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) {
|
||||
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");
|
||||
}
|
||||
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);
|
||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
||||
log.info("在线课学习记录"+allUserList);
|
||||
@@ -529,7 +559,7 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
* @return
|
||||
*/
|
||||
@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)){
|
||||
return error("参数错误");
|
||||
@@ -539,7 +569,10 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
}
|
||||
//检查是否已存在
|
||||
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);
|
||||
}catch(Exception e) {
|
||||
log.error("记录最后学习时间错误",e);
|
||||
@@ -690,9 +723,10 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
return error("查询失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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)){
|
||||
return error("无学习信息");
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -32,6 +33,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
@RestController
|
||||
@RequestMapping(value="/xboe/school/study/exam")
|
||||
public class StudyExamApi extends ApiBaseController{
|
||||
@Autowired
|
||||
StudyCourseDao scDao;
|
||||
|
||||
@Autowired
|
||||
IStudyExamService sexamService;
|
||||
|
||||
@@ -94,5 +94,5 @@ public interface IStudyService {
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
PageList<StudyCourseItem> findItemPage(int pageIndex,int pageSize,String contentId,String courseId,String name,Integer status);
|
||||
PageList<StudyCourseItem> findItemPage(int pageIndex, int pageSize, String contentId, String courseId, String name, Integer status);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.beans.KeyValue;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudySignup;
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,13 @@ public interface IStudySignupService {
|
||||
* @param signup
|
||||
*/
|
||||
StudyCourse addSignup(StudySignup signup);
|
||||
|
||||
|
||||
/**
|
||||
* 管理员添加报名课件
|
||||
* @param signup
|
||||
*/
|
||||
StudyCourseItem addStudyCourseItem(StudySignup signup);
|
||||
|
||||
/**
|
||||
* 删除报名,只有未审核过的才可以删除
|
||||
|
||||
@@ -44,7 +44,7 @@ public class StudyAssessServiceImpl implements IStudyAssessService{
|
||||
LocalDateTime ldt=LocalDateTime.now();
|
||||
sci.setStudyId(assess.getStudyId());
|
||||
sci.setContentId(assess.getContentId());
|
||||
//sci.setContentName(homework.getContentName());
|
||||
sci.setContentName("评估");
|
||||
sci.setCourseId(assess.getCourseId());
|
||||
//sci.setCsectionId(homework.getCsectionId());
|
||||
sci.setProgress(100);//直接设置为学习完成
|
||||
|
||||
@@ -82,7 +82,7 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
||||
LocalDateTime ldt=LocalDateTime.now();
|
||||
sci.setStudyId(exam.getStudyId());
|
||||
sci.setContentId(exam.getContentId());
|
||||
//sci.setContentName(homework.getContentName());
|
||||
sci.setContentName("考试");
|
||||
sci.setCourseId(exam.getCourseId());
|
||||
//sci.setCsectionId(homework.getCsectionId());
|
||||
sci.setProgress(prog);//直接设置为学习完成
|
||||
|
||||
@@ -46,7 +46,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
||||
LocalDateTime ldt=LocalDateTime.now();
|
||||
sci.setStudyId(homework.getStudyId());
|
||||
sci.setContentId(homework.getContentId());
|
||||
//sci.setContentName(homework.getContentName());
|
||||
sci.setContentName(homework.getHwName());
|
||||
sci.setCourseId(homework.getCourseId());
|
||||
//sci.setCsectionId(homework.getCsectionId());
|
||||
sci.setProgress(100);//直接设置为学习完成
|
||||
@@ -67,7 +67,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
||||
//只是保留一条作业记录,不再保存多条记录了
|
||||
//dao.save(homework);
|
||||
//设置id。然后进行悠
|
||||
homework.setId(obj.toString());
|
||||
homework.setId(homework.getStudyItemId());
|
||||
dao.update(homework);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.xboe.school.study.service.impl;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -8,7 +11,8 @@ import java.util.Map;
|
||||
import javax.annotation.Resource;
|
||||
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 org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -94,8 +98,12 @@ public class StudyServiceImpl implements IStudyService{
|
||||
//sci.setProgress(100);//直接设置为学习完成
|
||||
sci.setLastTime(ldt);
|
||||
scItemDao.saveOrUpdate(sci);
|
||||
|
||||
dto.setStudyItemId(sci.getId());
|
||||
if (sci.getId() != null){
|
||||
dto.setStudyItemId(sci.getId());
|
||||
}else {
|
||||
log.info("学习记录插入失败"+sci.getId());
|
||||
throw new IllegalArgumentException("学习记录插入失败");
|
||||
}
|
||||
//检查是否全部学习完成
|
||||
scDao.finishCheck(dto.getStudyId(),dto.getCourseId(),dto.getContentTotal(),token);
|
||||
|
||||
@@ -163,12 +171,10 @@ public class StudyServiceImpl implements IStudyService{
|
||||
|
||||
@Override
|
||||
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.setPageSize(pageSize);
|
||||
|
||||
|
||||
OrderCondition oc=OrderCondition.desc("id");
|
||||
query.addOrder(oc);
|
||||
if(StringUtils.isNotBlank(contentId)) {
|
||||
@@ -177,19 +183,92 @@ public class StudyServiceImpl implements IStudyService{
|
||||
if(StringUtils.isNotBlank(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)) {
|
||||
query.addFilter(FieldFilters.eq("aname", name));
|
||||
}
|
||||
return scItemDao.findPage(query.builder());
|
||||
int pageIndex2 = (pageIndex-1)*10;
|
||||
if(status!=null) {
|
||||
if(status==3) {
|
||||
query.addFilter(FieldFilters.eq("status", 2));
|
||||
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.ZoneOffset;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -39,7 +45,13 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
||||
|
||||
@Autowired
|
||||
StudyCourseDao studyCourseDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
StudyCourseItemDao scItemDao;
|
||||
|
||||
@Autowired
|
||||
CourseContentDao contentDao;
|
||||
|
||||
@Autowired(required = false)
|
||||
ICourseStudySearch esSearch;
|
||||
|
||||
@@ -69,7 +81,6 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
||||
signupDao.save(signup);
|
||||
//添加到课程学习
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
|
||||
StudyCourse sc=new StudyCourse();
|
||||
sc.setAddTime(now);
|
||||
sc.setAid(signup.getAid());
|
||||
@@ -124,11 +135,40 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
||||
//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
|
||||
public void addList(List<StudySignup> list) {
|
||||
//用于管理员添加报名
|
||||
for(StudySignup ss : list) {
|
||||
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) {
|
||||
if(pass) {
|
||||
StudySignup signup =signupDao.get(id);
|
||||
|
||||
//是否需要检查是否已报名
|
||||
StudyCourse sc=new StudyCourse();
|
||||
sc.setAddTime(LocalDateTime.now());
|
||||
|
||||
Reference in New Issue
Block a user