Compare commits

...

5 Commits

Author SHA1 Message Date
yang
4205912db5 定时任务测试 2024-11-30 12:08:11 +08:00
nisen
423b658e04 Merge branch 'yx1107-bug-l' into 104-master 2024-11-18 20:08:14 +08:00
nisen
795966d944 Merge branch 'yx1107-bug-l' into 104-master 2024-11-18 15:46:23 +08:00
zhaolongfei
e5c8dbabed 无目录无权限不能报名 2024-11-10 14:00:11 +08:00
zhaolongfei
a3aad61ac8 讲师审批添加讲师工号 2024-11-08 15:04:12 +08:00
8 changed files with 120 additions and 13 deletions

View File

@@ -232,6 +232,13 @@
<artifactId>spring-retry</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
<resources>

View File

@@ -0,0 +1,40 @@
package com.xboe;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class XxlJobConfig {
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.executor.appname}")
private String appName;
@Value("${xxl.job.executor.ip}")
private String ip;
@Value("${xxl.job.executor.port}")
private int port;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;
@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
// 创建 XxlJobSpringExecutor 执行器
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppname(appName);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
// 返回
return xxlJobSpringExecutor;
}
}

View File

@@ -1,6 +1,7 @@
package com.xboe.module.boecase.api;
import com.xboe.module.boecase.service.ICasesService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -16,6 +17,7 @@ public class CaseScheduledTasks {
* 每月的第一天的1:00执行
*/
// @Scheduled(cron = "0 0 1 1 * ?")
@XxlJob("refreshViewsRankOfMajor")
public void refreshViewsRankOfMajor() {
casesService.refreshViewsRankOfMajor();
}
@@ -23,7 +25,8 @@ public class CaseScheduledTasks {
/**
* 季初第一天两点执行cron表达式设置为每个季度的第一个月的第一天的特定时间。每个季度的第一个月是1月、4月、7月和10月
*/
@Scheduled(cron = "0 0 2 1 1,4,7,10 ?")
// @Scheduled(cron = "0 0 2 1 1,4,7,10 ?")
@XxlJob("refreshLastQuarterStatistics")
public void refreshLastQuarterStatistics() {
casesService.refreshLastQuarterStatistics();
}

View File

@@ -11,6 +11,7 @@ import com.xboe.core.orm.FieldFilters;
import com.xboe.module.course.dto.CourseQueryDto;
import com.xboe.module.course.dto.CourseTeacherDto;
import com.xboe.module.course.dto.RankingDto;
import com.xboe.module.course.dto.TeacherCourseDto;
import com.xboe.module.course.entity.*;
import com.xboe.module.course.service.ICourseContentService;
import com.xboe.module.course.service.ICourseSectionService;
@@ -28,6 +29,8 @@ import com.xboe.school.study.entity.StudyHomeWork;
import com.xboe.school.study.service.IStudyCourseService;
import com.xboe.school.study.service.IStudyHomeWorkService;
import com.xboe.school.study.service.IStudyService;
import com.xboe.system.user.entity.User;
import com.xboe.system.user.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -60,7 +63,8 @@ public class CoursePortalApi extends ApiBaseController{
@Resource
private ICourseService courseService;
@Resource
private IUserService userService;
@Resource
private ITeacherService teacherService;
@@ -301,17 +305,30 @@ public class CoursePortalApi extends ApiBaseController{
List<CourseContent> cclist=contentService.getByCourseId(id);
List<CourseSection> sectionlist=sectionService.getByCourseId(id);
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(id);
List<TeacherCourseDto> teacherCourseDtos = new ArrayList<>();
//获取教师的介绍信息,因为一门课程 的教师不会太多,所以这里简单直接遍历查询,后续再优化
for(CourseTeacher ct : teachers) {
TeacherCourseDto teacherCourseDto = new TeacherCourseDto();
Teacher t = teacherService.get(ct.getTeacherId());
User user = userService.get(ct.getTeacherId());
if(t!=null) {
ct.setRemark(t.getDescription());
if(redisTemplate.opsForValue().get(ct.getTeacherId())!=null){
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
ct.setTeacherName("BOE教师");
}
teacherCourseDto.setCourseId(ct.getCourseId());
teacherCourseDto.setTeacherName(ct.getTeacherName());
teacherCourseDto.setTeacherId(ct.getTeacherId());
teacherCourseDto.setCode(ct.getCode());
teacherCourseDto.setRemark(ct.getRemark());
teacherCourseDto.setSysCreateAid(ct.getSysCreateAid());
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
teacherCourseDto.setId(ct.getId());
teacherCourseDto.setUserNo(user.getUserNo());
teacherCourseDtos.add(teacherCourseDto);
}else if (redisTemplate.opsForValue().get(ct.getTeacherId())==null){
List<String> list=new ArrayList<>();
list.add(ct.getTeacherId());
@@ -319,6 +336,17 @@ public class CoursePortalApi extends ApiBaseController{
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
ct.setTeacherName("BOE教师");
}
teacherCourseDto.setCourseId(ct.getCourseId());
teacherCourseDto.setTeacherName(ct.getTeacherName());
teacherCourseDto.setTeacherId(ct.getTeacherId());
teacherCourseDto.setCode(ct.getCode());
teacherCourseDto.setRemark(ct.getRemark());
teacherCourseDto.setSysCreateAid(ct.getSysCreateAid());
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
teacherCourseDto.setId(ct.getId());
teacherCourseDto.setUserNo(user.getUserNo());
teacherCourseDtos.add(teacherCourseDto);
}
}
@@ -327,7 +355,7 @@ public class CoursePortalApi extends ApiBaseController{
rs.put("isCrowd",pass);
rs.put("contents", cclist);
rs.put("sections",sectionlist);
rs.put("teachers",teachers);
rs.put("teachers",teacherCourseDtos);
//查询课程
return success(rs);

View File

@@ -0,0 +1,11 @@
package com.xboe.module.course.dto;
import com.xboe.module.course.entity.CourseTeacher;
import lombok.Data;
import java.util.List;
@Data
public class TeacherCourseDto extends CourseTeacher {
private String userNo;
}

View File

@@ -228,7 +228,7 @@ public class StudyCourseApi extends ApiBaseController{
//检查是否已报名
StudyCourse sc=service.findByCourseIdAndAid(cid, aid);
if(sc==null) {
if(pass==true && sc==null) {
//未报名,这里直接报名
StudySignup signup=new StudySignup();
signup.setCourseId(cid);
@@ -246,13 +246,13 @@ public class StudyCourseApi extends ApiBaseController{
signup.setSignTime(LocalDateTime.now());
sc=service.autoSignup(signup);
}
rs.put("signup",true);
if (sc !=null){
rs.put("studyId", sc.getId());//学习id
rs.put("progress", sc.getProgress());
//查询上次学习的是什么资源。查询用户的学习情况
List<StudyCourseItem> items=studyService.findByStudyId(sc.getId());
rs.put("contentStudys",items);//学习的内容
}
return success(rs);
}

View File

@@ -74,3 +74,12 @@ xboe.email.url=https://u.boe.com/api/b1/email/send
xboe.email.from=boeu_learning@boe.com.cn
xboe.email.user=
xboe.email.security=
xxl.job.admin.addresses=http://u.boe.com/jobAdmin
xxl.job.accessToken=65ddc683-22f5-83b4-de3a-3c97a0a29af0
xxl.job.executor.appname=java-servers-job-api
xxl.job.executor.port=9995
xxl.job.executor.address=
xxl.job.executor.ip=
xxl.job.executor.logpath=/var/log/xxl-job/dw/
xxl.job.executor.logretentiondays=30

View File

@@ -81,3 +81,12 @@ xboe.email.user=
xboe.email.security=
boe.domain=https://u-pre.boe.com
xxl.job.admin.addresses=http://u-pre.boe.com/jobAdmin
xxl.job.accessToken=65ddc683-22f5-83b4-de3a-3c97a0a29af0
xxl.job.executor.appname=java-servers-job-api
xxl.job.executor.port=9995
xxl.job.executor.address=
xxl.job.executor.ip=
xxl.job.executor.logpath=/var/log/xxl-job/dw/
xxl.job.executor.logretentiondays=30