mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 19:06:49 +08:00
Compare commits
5 Commits
yx1107-bug
...
zcwy-addXx
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4205912db5 | ||
|
|
423b658e04 | ||
|
|
795966d944 | ||
|
|
e5c8dbabed | ||
|
|
a3aad61ac8 |
@@ -232,6 +232,13 @@
|
|||||||
<artifactId>spring-retry</artifactId>
|
<artifactId>spring-retry</artifactId>
|
||||||
<version>1.3.1</version>
|
<version>1.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xuxueli</groupId>
|
||||||
|
<artifactId>xxl-job-core</artifactId>
|
||||||
|
<version>2.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.xboe.module.boecase.api;
|
package com.xboe.module.boecase.api;
|
||||||
|
|
||||||
import com.xboe.module.boecase.service.ICasesService;
|
import com.xboe.module.boecase.service.ICasesService;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ public class CaseScheduledTasks {
|
|||||||
* 每月的第一天的1:00执行
|
* 每月的第一天的1:00执行
|
||||||
*/
|
*/
|
||||||
// @Scheduled(cron = "0 0 1 1 * ?")
|
// @Scheduled(cron = "0 0 1 1 * ?")
|
||||||
|
@XxlJob("refreshViewsRankOfMajor")
|
||||||
public void refreshViewsRankOfMajor() {
|
public void refreshViewsRankOfMajor() {
|
||||||
casesService.refreshViewsRankOfMajor();
|
casesService.refreshViewsRankOfMajor();
|
||||||
}
|
}
|
||||||
@@ -23,7 +25,8 @@ public class CaseScheduledTasks {
|
|||||||
/**
|
/**
|
||||||
* 季初第一天两点执行,cron表达式设置为每个季度的第一个月的第一天的特定时间。每个季度的第一个月是1月、4月、7月和10月:
|
* 季初第一天两点执行,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() {
|
public void refreshLastQuarterStatistics() {
|
||||||
casesService.refreshLastQuarterStatistics();
|
casesService.refreshLastQuarterStatistics();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.xboe.core.orm.FieldFilters;
|
|||||||
import com.xboe.module.course.dto.CourseQueryDto;
|
import com.xboe.module.course.dto.CourseQueryDto;
|
||||||
import com.xboe.module.course.dto.CourseTeacherDto;
|
import com.xboe.module.course.dto.CourseTeacherDto;
|
||||||
import com.xboe.module.course.dto.RankingDto;
|
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.entity.*;
|
||||||
import com.xboe.module.course.service.ICourseContentService;
|
import com.xboe.module.course.service.ICourseContentService;
|
||||||
import com.xboe.module.course.service.ICourseSectionService;
|
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.IStudyCourseService;
|
||||||
import com.xboe.school.study.service.IStudyHomeWorkService;
|
import com.xboe.school.study.service.IStudyHomeWorkService;
|
||||||
import com.xboe.school.study.service.IStudyService;
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
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;
|
||||||
@@ -60,7 +63,8 @@ public class CoursePortalApi extends ApiBaseController{
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ICourseService courseService;
|
private ICourseService courseService;
|
||||||
|
@Resource
|
||||||
|
private IUserService userService;
|
||||||
@Resource
|
@Resource
|
||||||
private ITeacherService teacherService;
|
private ITeacherService teacherService;
|
||||||
|
|
||||||
@@ -301,17 +305,30 @@ public class CoursePortalApi extends ApiBaseController{
|
|||||||
List<CourseContent> cclist=contentService.getByCourseId(id);
|
List<CourseContent> cclist=contentService.getByCourseId(id);
|
||||||
List<CourseSection> sectionlist=sectionService.getByCourseId(id);
|
List<CourseSection> sectionlist=sectionService.getByCourseId(id);
|
||||||
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(id);
|
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(id);
|
||||||
|
List<TeacherCourseDto> teacherCourseDtos = new ArrayList<>();
|
||||||
|
|
||||||
//获取教师的介绍信息,因为一门课程 的教师不会太多,所以这里简单直接遍历查询,后续再优化
|
//获取教师的介绍信息,因为一门课程 的教师不会太多,所以这里简单直接遍历查询,后续再优化
|
||||||
for(CourseTeacher ct : teachers) {
|
for(CourseTeacher ct : teachers) {
|
||||||
|
TeacherCourseDto teacherCourseDto = new TeacherCourseDto();
|
||||||
Teacher t = teacherService.get(ct.getTeacherId());
|
Teacher t = teacherService.get(ct.getTeacherId());
|
||||||
|
User user = userService.get(ct.getTeacherId());
|
||||||
if(t!=null) {
|
if(t!=null) {
|
||||||
ct.setRemark(t.getDescription());
|
ct.setRemark(t.getDescription());
|
||||||
if(redisTemplate.opsForValue().get(ct.getTeacherId())!=null){
|
if(redisTemplate.opsForValue().get(ct.getTeacherId())!=null){
|
||||||
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||||
ct.setTeacherName("BOE教师");
|
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){
|
}else if (redisTemplate.opsForValue().get(ct.getTeacherId())==null){
|
||||||
List<String> list=new ArrayList<>();
|
List<String> list=new ArrayList<>();
|
||||||
list.add(ct.getTeacherId());
|
list.add(ct.getTeacherId());
|
||||||
@@ -319,6 +336,17 @@ public class CoursePortalApi extends ApiBaseController{
|
|||||||
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||||
ct.setTeacherName("BOE教师");
|
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("isCrowd",pass);
|
||||||
rs.put("contents", cclist);
|
rs.put("contents", cclist);
|
||||||
rs.put("sections",sectionlist);
|
rs.put("sections",sectionlist);
|
||||||
rs.put("teachers",teachers);
|
rs.put("teachers",teacherCourseDtos);
|
||||||
//查询课程
|
//查询课程
|
||||||
return success(rs);
|
return success(rs);
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -228,7 +228,7 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
|
|
||||||
//检查是否已报名
|
//检查是否已报名
|
||||||
StudyCourse sc=service.findByCourseIdAndAid(cid, aid);
|
StudyCourse sc=service.findByCourseIdAndAid(cid, aid);
|
||||||
if(sc==null) {
|
if(pass==true && sc==null) {
|
||||||
//未报名,这里直接报名
|
//未报名,这里直接报名
|
||||||
StudySignup signup=new StudySignup();
|
StudySignup signup=new StudySignup();
|
||||||
signup.setCourseId(cid);
|
signup.setCourseId(cid);
|
||||||
@@ -246,13 +246,13 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
signup.setSignTime(LocalDateTime.now());
|
signup.setSignTime(LocalDateTime.now());
|
||||||
sc=service.autoSignup(signup);
|
sc=service.autoSignup(signup);
|
||||||
}
|
}
|
||||||
|
if (sc !=null){
|
||||||
rs.put("signup",true);
|
|
||||||
rs.put("studyId", sc.getId());//学习id
|
rs.put("studyId", sc.getId());//学习id
|
||||||
rs.put("progress", sc.getProgress());
|
rs.put("progress", sc.getProgress());
|
||||||
//查询上次学习的是什么资源。查询用户的学习情况
|
//查询上次学习的是什么资源。查询用户的学习情况
|
||||||
List<StudyCourseItem> items=studyService.findByStudyId(sc.getId());
|
List<StudyCourseItem> items=studyService.findByStudyId(sc.getId());
|
||||||
rs.put("contentStudys",items);//学习的内容
|
rs.put("contentStudys",items);//学习的内容
|
||||||
|
}
|
||||||
|
|
||||||
return success(rs);
|
return success(rs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.from=boeu_learning@boe.com.cn
|
||||||
xboe.email.user=
|
xboe.email.user=
|
||||||
xboe.email.security=
|
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
|
||||||
@@ -81,3 +81,12 @@ xboe.email.user=
|
|||||||
xboe.email.security=
|
xboe.email.security=
|
||||||
|
|
||||||
boe.domain=https://u-pre.boe.com
|
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
|
||||||
Reference in New Issue
Block a user