mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 03:16:48 +08:00
Compare commits
1 Commits
master-071
...
pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67c98a9a5a |
@@ -8,11 +8,9 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.boe.feign.api.courseweb.entity.ExamTestDto;
|
import com.boe.feign.api.courseweb.entity.ExamTestDto;
|
||||||
import com.boe.feign.api.courseweb.entity.ProjectStudyDto;
|
import com.boe.feign.api.courseweb.entity.ProjectStudyDto;
|
||||||
import com.boe.feign.api.courseweb.remote.ExternalRemoteClient;
|
|
||||||
import com.boe.feign.api.courseweb.remote.OffCourseRemoteClient;
|
import com.boe.feign.api.courseweb.remote.OffCourseRemoteClient;
|
||||||
import com.boe.feign.api.courseweb.remote.ProjectAdminRemoteClient;
|
import com.boe.feign.api.courseweb.remote.ProjectAdminRemoteClient;
|
||||||
import com.boe.feign.api.courseweb.remote.ProjectRemoteClient;
|
import com.boe.feign.api.courseweb.remote.ProjectRemoteClient;
|
||||||
import com.boe.feign.api.courseweb.reps.ExamStudyRecordParam;
|
|
||||||
import com.boe.feign.api.infrastructure.entity.CommonSearchVo;
|
import com.boe.feign.api.infrastructure.entity.CommonSearchVo;
|
||||||
import com.boe.feign.api.infrastructure.entity.Dict;
|
import com.boe.feign.api.infrastructure.entity.Dict;
|
||||||
import com.boe.feign.api.infrastructure.remote.DictRemoteClient;
|
import com.boe.feign.api.infrastructure.remote.DictRemoteClient;
|
||||||
@@ -75,8 +73,6 @@ public class ThirdApi {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectRemoteClient projectRemoteClient;
|
private ProjectRemoteClient projectRemoteClient;
|
||||||
@Resource
|
|
||||||
ExternalRemoteClient externalRemoteClient;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DictRemoteClient dictRemoteClient;
|
private DictRemoteClient dictRemoteClient;
|
||||||
@@ -98,8 +94,7 @@ public class ThirdApi {
|
|||||||
private String syncOnLineScore;
|
private String syncOnLineScore;
|
||||||
@Value("${coursesuilt.updateOnLineStatua}")
|
@Value("${coursesuilt.updateOnLineStatua}")
|
||||||
private String updateOnLineStatua;
|
private String updateOnLineStatua;
|
||||||
@Value("${coursesuilt.delOnLineById}")
|
|
||||||
private String delOnLineById;
|
|
||||||
|
|
||||||
//获取例外人员的id
|
//获取例外人员的id
|
||||||
public List<String> getUserId() {
|
public List<String> getUserId() {
|
||||||
@@ -267,19 +262,11 @@ public class ThirdApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<StudyCourse> getStudyCourseList(String studyId, String courseId, String token) {
|
public List<StudyCourse> getStudyCourseList(String studyId, String courseId, String token) {
|
||||||
log.info(" 1 studyId = "+ studyId + " ,courseId = " + courseId );
|
|
||||||
if ( studyId == null || courseId == null ){
|
|
||||||
log.error(" 在线课学习记录 参数不能为空 ");
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
StudyCourseVo studyCourseVo = new StudyCourseVo();
|
StudyCourseVo studyCourseVo = new StudyCourseVo();
|
||||||
studyCourseVo.setStudyId(studyId);
|
studyCourseVo.setStudyId(studyId);
|
||||||
studyCourseVo.setCourseId(courseId);
|
studyCourseVo.setCourseId(courseId);
|
||||||
ProjectStudyDto projectStudyDto = new ProjectStudyDto();
|
ProjectStudyDto projectStudyDto = new ProjectStudyDto();
|
||||||
// BeanUtil.copyProperties(studyCourseVo, studyCourseVo);
|
BeanUtil.copyProperties(studyCourseVo, studyCourseVo);
|
||||||
projectStudyDto.setStudyId(Long.parseLong(studyId));
|
|
||||||
projectStudyDto.setCourseId(Long.parseLong(courseId));
|
|
||||||
log.info(" 12 在线课学习记录 studyId = "+ projectStudyDto.getStudyId() + " ,courseId = " + projectStudyDto.getCourseId() );
|
|
||||||
projectRemoteClient.updateStudyStatus(projectStudyDto);
|
projectRemoteClient.updateStudyStatus(projectStudyDto);
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
@@ -395,16 +382,4 @@ public class ThirdApi {
|
|||||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||||
log.info("updateOrSaveCourse = " + resp);
|
log.info("updateOrSaveCourse = " + resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void syncExamStudyRecord(ExamStudyRecordParam param) {
|
|
||||||
externalRemoteClient.syncExamStudyRecord(param);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delOnLineById(CourseParam param, String token) {
|
|
||||||
log.info("---------------同步在线课删除 ------- param " + param);
|
|
||||||
String resp = Optional.ofNullable(
|
|
||||||
HttpRequest.post(delOnLineById).body(JSONUtil.toJsonStr(param)).header("token", token).execute()
|
|
||||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
|
||||||
log.info("-------delOnLineById = " + resp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,20 +122,13 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
//这里应该是单独的线程去处理
|
//这里应该是单独的线程去处理
|
||||||
user.setId(getNodeText(result.get("userId")));//最新接口变化,id改成userId
|
user.setId(getNodeText(result.get("userId")));//最新接口变化,id改成userId
|
||||||
String band=getNodeText(result.get("bandCode"));
|
String band=getNodeText(result.get("bandCode"));
|
||||||
try {
|
if(StringUtils.isNotBlank(band) && band.length()>4) {
|
||||||
if(StringUtils.isNotBlank(band) && band.length()>4 && band.contains("band")) {
|
String bandNum=band.substring(4);
|
||||||
String bandNum=band.substring(4);
|
user.setBandLevel(Integer.valueOf(bandNum));
|
||||||
user.setBandLevel(Integer.valueOf(bandNum));
|
}else {
|
||||||
}else if (StringUtils.isNotBlank(band) && band.length()>4 && band.contains("Level")) {
|
user.setBandLevel(0);
|
||||||
String bandNum=band.substring(5);
|
}
|
||||||
user.setBandLevel(Integer.valueOf(bandNum));
|
user.setAvatar(getNodeText(result.get("avatar")));
|
||||||
}else {
|
|
||||||
user.setBandLevel(0);
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
user.setBandLevel(0);
|
|
||||||
}
|
|
||||||
user.setAvatar(getNodeText(result.get("avatar")));
|
|
||||||
user.setCode(getNodeText(result.get("userNo")));
|
user.setCode(getNodeText(result.get("userNo")));
|
||||||
|
|
||||||
if(StringUtils.isBlank(user.getCode())) {
|
if(StringUtils.isBlank(user.getCode())) {
|
||||||
|
|||||||
@@ -2,16 +2,11 @@ package com.xboe.data.service.impl;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
import com.boe.feign.api.serverall.entity.UserData;
|
import com.boe.feign.api.serverall.entity.UserData;
|
||||||
import com.xboe.constants.CacheName;
|
|
||||||
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.cache.Cache;
|
|
||||||
import org.springframework.cache.CacheManager;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.retry.annotation.Recover;
|
import org.springframework.retry.annotation.Recover;
|
||||||
import org.springframework.retry.annotation.Retryable;
|
import org.springframework.retry.annotation.Retryable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -44,9 +39,6 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
TeacherDao teacherDao;
|
TeacherDao teacherDao;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CacheManager cacheManager;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -67,8 +59,6 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
|
|||||||
a.setDeleted(user.getDeleted());
|
a.setDeleted(user.getDeleted());
|
||||||
}
|
}
|
||||||
a.setLoginName(user.getCode());
|
a.setLoginName(user.getCode());
|
||||||
a.setMobile(user.getMobile());
|
|
||||||
a.setEmail(user.getEmail());
|
|
||||||
log.info("更新账号code");
|
log.info("更新账号code");
|
||||||
accountDao.update(a);
|
accountDao.update(a);
|
||||||
} else {
|
} else {
|
||||||
@@ -81,18 +71,14 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
|
|||||||
a.setRegTime(LocalDateTime.now());
|
a.setRegTime(LocalDateTime.now());
|
||||||
a.setSysId(user.getKid());
|
a.setSysId(user.getKid());
|
||||||
a.setStatus(1);
|
a.setStatus(1);
|
||||||
a.setMobile(user.getMobile());
|
|
||||||
a.setEmail(user.getEmail());
|
|
||||||
accountDao.save(a);
|
accountDao.save(a);
|
||||||
log.info("账号不存在,新添加账号【" + user.getId() + "】");
|
log.info("账号不存在,新添加账号【" + user.getId() + "】");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u != null) {
|
if (u != null) {
|
||||||
//更新部分用户字段
|
//更新部分用户字段
|
||||||
u.setDepartId(user.getDepartId());
|
u.setDepartId(user.getDepartId());
|
||||||
u.setDepartName(user.getDepartName());
|
u.setDepartName(user.getDepartName());
|
||||||
u.setName(user.getName());
|
u.setName(user.getName());
|
||||||
u.setMobileNo(user.getMobile());
|
|
||||||
//2022-12-8 去掉用户类型的更新,因为返回的数据都是学员,
|
//2022-12-8 去掉用户类型的更新,因为返回的数据都是学员,
|
||||||
//u.setUserType(user.getUserType());
|
//u.setUserType(user.getUserType());
|
||||||
if (user.getLearningDuration() > 0) { //不大于0才会更新
|
if (user.getLearningDuration() > 0) { //不大于0才会更新
|
||||||
@@ -120,17 +106,9 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
|
|||||||
} else {
|
} else {
|
||||||
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
||||||
}
|
}
|
||||||
u.setMobileNo(user.getMobile());
|
|
||||||
userDao.save(u);
|
userDao.save(u);
|
||||||
log.info("添加新用户");
|
log.info("添加新用户");
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache cache = cacheManager.getCache(CacheName.NAME_USER);
|
|
||||||
if(cache != null) {
|
|
||||||
cache.evict(CacheName.KEY_ACCOUNT + user.getId());
|
|
||||||
cache.evict(CacheName.KEY_USER + user.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
//对机构的判断,不为空时才会处理,为空时不处理
|
//对机构的判断,不为空时才会处理,为空时不处理
|
||||||
if (StringUtils.isNotBlank(user.getDepartId())) {
|
if (StringUtils.isNotBlank(user.getDepartId())) {
|
||||||
org = orgDao.get(user.getDepartId());
|
org = orgDao.get(user.getDepartId());
|
||||||
|
|||||||
@@ -140,9 +140,6 @@ public class CasesApi extends ApiBaseController {
|
|||||||
List<Cases> cases = views.getList();
|
List<Cases> cases = views.getList();
|
||||||
if (CollUtil.isNotEmpty(cases)) {
|
if (CollUtil.isNotEmpty(cases)) {
|
||||||
for (Cases c : cases) {
|
for (Cases c : cases) {
|
||||||
if ("null".equals(c.getSummary())) {
|
|
||||||
c.setSummary(null);
|
|
||||||
}
|
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
List<CasesMajorType> caseId = casesMajorTypeDao.findList(FieldFilters.eq("caseId", c.getId()));
|
List<CasesMajorType> caseId = casesMajorTypeDao.findList(FieldFilters.eq("caseId", c.getId()));
|
||||||
if (caseId != null && !caseId.isEmpty()) {
|
if (caseId != null && !caseId.isEmpty()) {
|
||||||
|
|||||||
@@ -886,7 +886,7 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
public JsonResponse<Boolean> delete(String id,Boolean erasable,String title,String remark, HttpServletRequest request){
|
public JsonResponse<Boolean> delete(String id,Boolean erasable,String title,String remark){
|
||||||
if(StringUtils.isBlank(id)){
|
if(StringUtils.isBlank(id)){
|
||||||
return badRequest("参数错误");
|
return badRequest("参数错误");
|
||||||
}
|
}
|
||||||
@@ -901,11 +901,6 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
try {
|
try {
|
||||||
CurrentUser cu=getCurrent();
|
CurrentUser cu=getCurrent();
|
||||||
courseService.delete(id, erasable,cu.getAccountId(), cu.getName(), remark);
|
courseService.delete(id, erasable,cu.getAccountId(), cu.getName(), remark);
|
||||||
|
|
||||||
String token = request.getHeader("Xboe-Access-Token");
|
|
||||||
CourseParam param = new CourseParam();
|
|
||||||
param.setId(id);
|
|
||||||
thirdApi.delOnLineById(param,token);
|
|
||||||
return success(true);
|
return success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("管理员删除课程错误",e);
|
log.error("管理员删除课程错误",e);
|
||||||
|
|||||||
@@ -314,10 +314,8 @@ public class CoursePortalApi extends ApiBaseController{
|
|||||||
User user = userService.get(ct.getTeacherId());
|
User user = userService.get(ct.getTeacherId());
|
||||||
if(t!=null) {
|
if(t!=null) {
|
||||||
ct.setRemark(t.getDescription());
|
ct.setRemark(t.getDescription());
|
||||||
ct.setSupplier(t.getSupplier());
|
|
||||||
ct.setTeacherType(t.getTeacherType());
|
|
||||||
if(redisTemplate.opsForValue().get(ct.getTeacherId())!=null){
|
if(redisTemplate.opsForValue().get(ct.getTeacherId())!=null){
|
||||||
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1") && ( t==null || t.getTeacherType() == 1)){
|
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||||
ct.setTeacherName("BOE教师");
|
ct.setTeacherName("BOE教师");
|
||||||
}
|
}
|
||||||
teacherCourseDto.setCourseId(ct.getCourseId());
|
teacherCourseDto.setCourseId(ct.getCourseId());
|
||||||
@@ -329,15 +327,13 @@ public class CoursePortalApi extends ApiBaseController{
|
|||||||
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
|
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
|
||||||
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
|
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
|
||||||
teacherCourseDto.setId(ct.getId());
|
teacherCourseDto.setId(ct.getId());
|
||||||
if(user!=null){
|
teacherCourseDto.setUserNo(user.getUserNo());
|
||||||
teacherCourseDto.setUserNo(user.getUserNo());
|
|
||||||
}
|
|
||||||
teacherCourseDtos.add(teacherCourseDto);
|
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());
|
||||||
getTeacherInfo(request.getHeader("Xboe-Access-Token"),list);
|
getTeacherInfo(request.getHeader("Xboe-Access-Token"),list);
|
||||||
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1") && ( t==null || t.getTeacherType() == 1)){
|
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||||
ct.setTeacherName("BOE教师");
|
ct.setTeacherName("BOE教师");
|
||||||
}
|
}
|
||||||
teacherCourseDto.setCourseId(ct.getCourseId());
|
teacherCourseDto.setCourseId(ct.getCourseId());
|
||||||
@@ -349,9 +345,7 @@ public class CoursePortalApi extends ApiBaseController{
|
|||||||
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
|
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
|
||||||
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
|
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
|
||||||
teacherCourseDto.setId(ct.getId());
|
teacherCourseDto.setId(ct.getId());
|
||||||
if(user!=null){
|
teacherCourseDto.setUserNo(user.getUserNo());
|
||||||
teacherCourseDto.setUserNo(user.getUserNo());
|
|
||||||
}
|
|
||||||
teacherCourseDtos.add(teacherCourseDto);
|
teacherCourseDtos.add(teacherCourseDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,12 +49,4 @@ public class CourseTeacher extends IdBaseEntity {
|
|||||||
@Transient
|
@Transient
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
/**供应商*/
|
|
||||||
@Transient
|
|
||||||
private String supplier;
|
|
||||||
|
|
||||||
/**讲师类型 1 内部讲师 2外部讲师*/
|
|
||||||
@Transient
|
|
||||||
private Integer teacherType;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,6 +341,8 @@ public interface ICourseService {
|
|||||||
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
||||||
|
|
||||||
|
|
||||||
List<Course> findByIds(List<String> courseIds);
|
|
||||||
void deletedStudyResourceBatchByCourseIdAndType(String courseId,Integer courseType);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.xboe.module.course.service.impl;
|
package com.xboe.module.course.service.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
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;
|
||||||
@@ -15,17 +14,11 @@ import java.util.stream.Stream;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.management.Query;
|
import javax.management.Query;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import com.xboe.api.ThirdApi;
|
import com.xboe.api.ThirdApi;
|
||||||
import com.xboe.core.orm.*;
|
import com.xboe.core.orm.*;
|
||||||
import com.xboe.school.study.dao.StudyCourseDao;
|
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.elasticsearch.client.RequestOptions;
|
|
||||||
import org.elasticsearch.client.RestHighLevelClient;
|
|
||||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
||||||
import org.elasticsearch.index.query.QueryBuilders;
|
|
||||||
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
|
|
||||||
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.data.redis.core.StringRedisTemplate;
|
||||||
@@ -122,9 +115,6 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private IEventDataSender eventSender;
|
private IEventDataSender eventSender;
|
||||||
|
|
||||||
@Resource
|
|
||||||
RestHighLevelClient restHighLevelClient;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -458,7 +448,6 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
List<Course> paginate = paginate(listByFilters2, pageIndex, pageSize);
|
List<Course> paginate = paginate(listByFilters2, pageIndex, pageSize);
|
||||||
PageList<Course> rs = new PageList<>();
|
PageList<Course> rs = new PageList<>();
|
||||||
rs.setCount(listByFilters2.size());
|
rs.setCount(listByFilters2.size());
|
||||||
rs.setPageSize(pageSize);
|
|
||||||
rs.setList(paginate);
|
rs.setList(paginate);
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
@@ -864,14 +853,12 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
log.error("未配置事件消息发送的实现");
|
log.error("未配置事件消息发送的实现");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除ES数据
|
|
||||||
deletedStudyResourceBatchByCourseIdAndType(id,c.getType());
|
|
||||||
} else {
|
} else {
|
||||||
//彻底删除,课件设置为无课程状态
|
//彻底删除,课件设置为无课程状态
|
||||||
courseDao.setDeleted(id);
|
courseDao.setDeleted(id);
|
||||||
}
|
}
|
||||||
//记录删除日志信息
|
//记录删除日志信息
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1580,13 +1567,6 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Course> findByIds(List<String> courseIds) {
|
|
||||||
QueryBuilder query = QueryBuilder.from(Course.class);
|
|
||||||
query.addFilter(FieldFilters.in("id", courseIds));
|
|
||||||
return courseDao.findList(query.builder());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int countWaitAudit(String aid) {
|
public int countWaitAudit(String aid) {
|
||||||
@@ -1998,17 +1978,5 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
return courseDao.findListByHql("Select new Course(id,studys,score) from Course where id in(?1)", ids);
|
return courseDao.findListByHql("Select new Course(id,studys,score) from Course where id in(?1)", ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deletedStudyResourceBatchByCourseIdAndType(String courseId, Integer courseType) {
|
|
||||||
DeleteByQueryRequest request = new DeleteByQueryRequest("new_study_resource");
|
|
||||||
BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
|
|
||||||
boolQueryBuilder.must(QueryBuilders.matchQuery("courseId", courseId));
|
|
||||||
boolQueryBuilder.must(QueryBuilders.matchQuery("courseType", courseType));
|
|
||||||
request.setQuery(boolQueryBuilder);
|
|
||||||
try {
|
|
||||||
restHighLevelClient.deleteByQuery(request, RequestOptions.DEFAULT);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import com.boe.feign.api.courseweb.reps.ExamStudyRecordParam;
|
|
||||||
import com.xboe.api.ThirdApi;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -39,10 +37,7 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
AloneExamDao aeDao;
|
AloneExamDao aeDao;
|
||||||
@Resource
|
|
||||||
private ThirdApi thirdApi;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void save(AloneExamAnswer aea){
|
public void save(AloneExamAnswer aea){
|
||||||
@@ -106,18 +101,7 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
// //这种情况汶是不存在的
|
// //这种情况汶是不存在的
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
try {
|
|
||||||
ExamStudyRecordParam param = new ExamStudyRecordParam();
|
|
||||||
param.setTestId(aea.getTestId());
|
|
||||||
param.setAid(aea.getAid());
|
|
||||||
thirdApi.syncExamStudyRecord(param);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
package com.xboe.school.study.api;
|
package com.xboe.school.study.api;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import com.alibaba.nacos.shaded.com.google.common.util.concurrent.RateLimiter;
|
import com.alibaba.nacos.shaded.com.google.common.util.concurrent.RateLimiter;
|
||||||
import com.xboe.api.ThirdApi;
|
import com.xboe.api.ThirdApi;
|
||||||
import com.xboe.constants.CacheName;
|
import com.xboe.constants.CacheName;
|
||||||
import com.xboe.module.course.vo.TeacherVo;
|
import com.xboe.module.course.vo.TeacherVo;
|
||||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
import com.xboe.module.usergroup.service.IUserGroupService;
|
||||||
import com.xboe.school.study.dao.StudyCourseDao;
|
import com.xboe.school.study.dao.StudyCourseDao;
|
||||||
import com.xboe.school.vo.StudyTimeVo;
|
|
||||||
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;
|
||||||
@@ -210,8 +204,6 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
Teacher t = teacherService.get(ct.getTeacherId());
|
Teacher t = teacherService.get(ct.getTeacherId());
|
||||||
if(t!=null) {
|
if(t!=null) {
|
||||||
ct.setRemark(t.getDescription());
|
ct.setRemark(t.getDescription());
|
||||||
ct.setSupplier(t.getSupplier());
|
|
||||||
ct.setTeacherType(t.getTeacherType());
|
|
||||||
}
|
}
|
||||||
if(redisTemplate.opsForValue().get(ct.getTeacherId())==null){
|
if(redisTemplate.opsForValue().get(ct.getTeacherId())==null){
|
||||||
List<String>list=new ArrayList<>();
|
List<String>list=new ArrayList<>();
|
||||||
@@ -220,11 +212,11 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
redisTemplate.opsForValue().set(teacherVo.get(0).getTeacherId(), teacherVo.get(0).getStatus());
|
redisTemplate.opsForValue().set(teacherVo.get(0).getTeacherId(), teacherVo.get(0).getStatus());
|
||||||
//设置过期时间为1天
|
//设置过期时间为1天
|
||||||
redisTemplate.expire(teacherVo.get(0).getTeacherId(), 24 * 60 * 60, TimeUnit.SECONDS);
|
redisTemplate.expire(teacherVo.get(0).getTeacherId(), 24 * 60 * 60, TimeUnit.SECONDS);
|
||||||
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1") && ( t==null || t.getTeacherType() == 1)){
|
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||||
ct.setTeacherName("BOE教师");
|
ct.setTeacherName("BOE教师");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1") && ( t==null || t.getTeacherType() == 1)){
|
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||||
ct.setTeacherName("BOE教师");
|
ct.setTeacherName("BOE教师");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,36 +251,6 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
rs.put("progress", sc.getProgress());
|
rs.put("progress", sc.getProgress());
|
||||||
//查询上次学习的是什么资源。查询用户的学习情况
|
//查询上次学习的是什么资源。查询用户的学习情况
|
||||||
List<StudyCourseItem> items=studyService.findByStudyId(sc.getId());
|
List<StudyCourseItem> items=studyService.findByStudyId(sc.getId());
|
||||||
// 和内容匹配,根据内容的视频时长,计算学习进度
|
|
||||||
if(CollectionUtil.isNotEmpty(items) && CollectionUtil.isNotEmpty(cclist)){
|
|
||||||
// 根据ID转换map
|
|
||||||
Map<String, CourseContent> contentMap = cclist.stream().collect(Collectors.toMap(CourseContent::getId, Function.identity()));
|
|
||||||
for (StudyCourseItem item : items) {
|
|
||||||
CourseContent content = contentMap.get(item.getContentId());
|
|
||||||
if(null == content){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(null==item.getLastStudyTime()
|
|
||||||
|| item.getLastStudyTime()<=0
|
|
||||||
|| null==content.getDuration()
|
|
||||||
|| content.getDuration()<=0){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
BigDecimal lastStudyTime = new BigDecimal(item.getLastStudyTime());
|
|
||||||
BigDecimal duration = new BigDecimal(content.getDuration());
|
|
||||||
BigDecimal progress = lastStudyTime.divide(duration, 10, RoundingMode.HALF_UP);
|
|
||||||
if(progress.compareTo(BigDecimal.ZERO) < 0){
|
|
||||||
progress = BigDecimal.ZERO;
|
|
||||||
}else if(progress.compareTo(BigDecimal.ONE) > 0){
|
|
||||||
progress = BigDecimal.ONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
item.setProgressVideo(progress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rs.put("contentStudys",items);//学习的内容
|
rs.put("contentStudys",items);//学习的内容
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,8 +343,6 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
//追加学习时长
|
//追加学习时长
|
||||||
studyService.appendStudyDuration(sci.getStudyId(),item.getId(),sci.getContentId(),sci.getDuration());
|
studyService.appendStudyDuration(sci.getStudyId(),item.getId(),sci.getContentId(),sci.getDuration());
|
||||||
|
|
||||||
log.info(" 1 在线课学习记录 sci.getStudyId() = "+ sci.getStudyId() + " , sci.getCourseId() = " + sci.getCourseId() );
|
|
||||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(sci.getStudyId() ,sci.getCourseId(), token);
|
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(sci.getStudyId() ,sci.getCourseId(), token);
|
||||||
log.info("在线课学习记录"+allUserList);
|
log.info("在线课学习记录"+allUserList);
|
||||||
return success(item.getId());
|
return success(item.getId());
|
||||||
@@ -613,7 +573,7 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
@RequestMapping(value="/appendtime",method = {RequestMethod.GET,RequestMethod.POST})
|
@RequestMapping(value="/appendtime",method = {RequestMethod.GET,RequestMethod.POST})
|
||||||
public JsonResponse<String> appendTime(StudyTime studyTime, HttpServletRequest request){
|
public JsonResponse<String> appendTime(StudyTime studyTime, HttpServletRequest request){
|
||||||
|
|
||||||
if(StringUtils.isBlank(studyTime.getStudyId())){
|
if(StringUtils.isBlank(studyTime.getStudyId())){
|
||||||
return error("参数错误");
|
return error("参数错误");
|
||||||
}
|
}
|
||||||
@@ -643,91 +603,7 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
return error("记录学习时长错误",e.getMessage());
|
return error("记录学习时长错误",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* appendtime 于 study-video-time 合并
|
|
||||||
* */
|
|
||||||
/*@RequestMapping(value="/updateStudyVideoTime1",method = {RequestMethod.GET,RequestMethod.POST})
|
|
||||||
public JsonResponse<String> updateStudyVideoTime1(StudyTimeVo studyTime, HttpServletRequest request){
|
|
||||||
|
|
||||||
// 0 study-video-time , 1 appendtime
|
|
||||||
if (studyTime.getType() == 0){
|
|
||||||
if(StringUtils.isBlank(studyTime.getItemId())){
|
|
||||||
return error("参数错误");
|
|
||||||
}
|
|
||||||
if(studyTime.getVideoTime()==null){
|
|
||||||
return error("无时间点");
|
|
||||||
}
|
|
||||||
//检查是否已存在
|
|
||||||
try {
|
|
||||||
studyService.updateLastTime(studyTime.getItemId(),studyTime.getVideoTime(), getCurrent().getAccountId());
|
|
||||||
if (studyTime.getContentId() != null && studyTime.getCourseId() != null && studyTime.getProgressVideo() != null){
|
|
||||||
contentService.updateProcessVideo(studyTime.getContentId(), studyTime.getCourseId(), studyTime.getProgressVideo());
|
|
||||||
}
|
|
||||||
return success("true");
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("updateStudyVideoTime type =0 记录最后学习时间错误",e);
|
|
||||||
return error("updateStudyVideoTime type =0 记录最后学习时间失败 ",e.getMessage());
|
|
||||||
}
|
|
||||||
}else if(studyTime.getType() == 1){
|
|
||||||
if(StringUtils.isBlank(studyTime.getStudyId())){
|
|
||||||
return error("参数错误");
|
|
||||||
}
|
|
||||||
if(StringUtils.isBlank(studyTime.getCourseId())){
|
|
||||||
return error("未指定课程");
|
|
||||||
}
|
|
||||||
if(StringUtils.isBlank(studyTime.getContentId())){
|
|
||||||
return error("未指定资源内容");
|
|
||||||
}
|
|
||||||
|
|
||||||
String token = request.getHeader("Xboe-Access-Token");
|
|
||||||
if (StringUtils.isEmpty(token)) {
|
|
||||||
token = request.getHeader("token");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
studyService.updateStudyDuration(studyTime.getStudyId(),null,studyTime.getContentId(),studyTime.getVideoTime(),studyTime.getCourseId());
|
|
||||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyTime.getStudyId() ,studyTime.getCourseId(), token);
|
|
||||||
log.info("updateStudyVideoTime type =1 在线课学习记录 = " + allUserList);
|
|
||||||
return success(studyTime.getId());
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("updateStudyVideoTime type =1 记录学习时长错误",e);
|
|
||||||
return error("updateStudyVideoTime type =1 记录学习时长错误 ",e.getMessage());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
return error("type不能为空");
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@RequestMapping(value="/updateStudyVideoTime",method = {RequestMethod.GET,RequestMethod.POST})
|
|
||||||
public JsonResponse<String> updateStudyVideoTime(StudyTimeVo studyTime, HttpServletRequest request){
|
|
||||||
try {
|
|
||||||
if(StringUtils.isBlank(studyTime.getItemId())){
|
|
||||||
return error("参数错误");
|
|
||||||
}
|
|
||||||
if(studyTime.getVideoTime()==null){
|
|
||||||
return error("无时间点");
|
|
||||||
}
|
|
||||||
if(StringUtils.isBlank(studyTime.getStudyId())){
|
|
||||||
return error("参数错误");
|
|
||||||
}
|
|
||||||
if(StringUtils.isBlank(studyTime.getCourseId())){
|
|
||||||
return error("未指定课程");
|
|
||||||
}
|
|
||||||
if(StringUtils.isBlank(studyTime.getContentId())){
|
|
||||||
return error("未指定资源内容");
|
|
||||||
}
|
|
||||||
studyService.updateStudyDuration(studyTime.getStudyId(),studyTime.getItemId(),studyTime.getContentId(),studyTime.getVideoTime(),studyTime.getCourseId());
|
|
||||||
if (studyTime.getContentId() != null && studyTime.getCourseId() != null && studyTime.getProgressVideo() != null){
|
|
||||||
contentService.updateProcessVideo(studyTime.getContentId(), studyTime.getCourseId(), studyTime.getProgressVideo());
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("updateStudyVideoTime",e);
|
|
||||||
return error("学习时长记录失败",e.getMessage(),null);
|
|
||||||
}
|
|
||||||
return success("true");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**获取最后一次的学习内容*/
|
/**获取最后一次的学习内容*/
|
||||||
@GetMapping("/last-study")
|
@GetMapping("/last-study")
|
||||||
public JsonResponse<Map<String,Object>> lastStudy(){
|
public JsonResponse<Map<String,Object>> lastStudy(){
|
||||||
|
|||||||
@@ -3,16 +3,9 @@ package com.xboe.school.study.api;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import com.xboe.module.course.entity.Course;
|
|
||||||
import com.xboe.module.course.service.ICourseService;
|
|
||||||
import org.apache.commons.compress.utils.Lists;
|
|
||||||
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.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -49,15 +42,6 @@ public class StudyCourseESApi extends ApiBaseController{
|
|||||||
@Autowired
|
@Autowired
|
||||||
IStudyCourseService service;
|
IStudyCourseService service;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
ICourseService courseService;
|
|
||||||
|
|
||||||
@Value("${xboe.upload.file.http_path}")
|
|
||||||
private String httpPath;
|
|
||||||
|
|
||||||
@Value("${xboe.image.course.default}")
|
|
||||||
private String defaultCourseImage;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PhpOnlineStudyRecordScheduledTasks phpOnlineStudyRecordScheduledTasks;
|
private PhpOnlineStudyRecordScheduledTasks phpOnlineStudyRecordScheduledTasks;
|
||||||
|
|
||||||
@@ -70,61 +54,13 @@ public class StudyCourseESApi extends ApiBaseController{
|
|||||||
try {
|
try {
|
||||||
dto.setAccountId(getCurrent().getAccountId());
|
dto.setAccountId(getCurrent().getAccountId());
|
||||||
PageList<CourseStudyDto> rs=search.search(page.getStartRow(),page.getPageSize(), dto);
|
PageList<CourseStudyDto> rs=search.search(page.getStartRow(),page.getPageSize(), dto);
|
||||||
|
|
||||||
handleCourseImage(rs);
|
|
||||||
|
|
||||||
return success(rs);
|
return success(rs);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
log.error("查询报名学习ES失败",e);
|
log.error("查询报名学习ES失败",e);
|
||||||
return error("查询失败",e.getMessage());
|
return error("查询失败",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleCourseImage(PageList<CourseStudyDto> rs) {
|
|
||||||
if (rs == null || CollectionUtil.isEmpty(rs.getList())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> emptyImageCourseIds = Lists.newArrayList();
|
|
||||||
for(CourseStudyDto courseStudyDto : rs.getList()) {
|
|
||||||
if(StringUtils.isBlank(courseStudyDto.getCourseImage())) {
|
|
||||||
// 过滤课程类型
|
|
||||||
if(courseStudyDto.getCourseType()==10
|
|
||||||
|| courseStudyDto.getCourseType()==20){
|
|
||||||
emptyImageCourseIds.add(courseStudyDto.getCourseId());
|
|
||||||
}else{
|
|
||||||
log.warn("课程图片为空,课程id为:{},课程类型:{}",courseStudyDto.getCourseId(),courseStudyDto.getCourseType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(CollectionUtil.isEmpty(emptyImageCourseIds)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Course> courseList = courseService.findByIds(emptyImageCourseIds);
|
|
||||||
if(CollectionUtil.isNotEmpty(courseList)){
|
|
||||||
// courseList转换成map
|
|
||||||
Map<String, Course> courseMap = courseList.stream().collect(Collectors.toMap(Course::getId, course -> course));
|
|
||||||
|
|
||||||
// 赋值ES图片
|
|
||||||
for(CourseStudyDto courseStudyDto : rs.getList()) {
|
|
||||||
if(emptyImageCourseIds.contains(courseStudyDto.getCourseId())) {
|
|
||||||
Course currentCourse = courseMap.get(courseStudyDto.getCourseId());
|
|
||||||
if(null!=currentCourse){
|
|
||||||
if(StringUtils.isNotBlank(currentCourse.getCoverImg())){
|
|
||||||
// 拼接域名
|
|
||||||
courseStudyDto.setCourseImage(httpPath + currentCourse.getCoverImg());
|
|
||||||
}else{
|
|
||||||
// 赋值默认图片
|
|
||||||
courseStudyDto.setCourseImage(defaultCourseImage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value="/list-by-ids",method = {RequestMethod.POST})
|
@RequestMapping(value="/list-by-ids",method = {RequestMethod.POST})
|
||||||
public JsonResponse<List<StudyCourse>> search(@RequestBody List<String> ids){
|
public JsonResponse<List<StudyCourse>> search(@RequestBody List<String> ids){
|
||||||
if(ids.isEmpty()) {
|
if(ids.isEmpty()) {
|
||||||
|
|||||||
@@ -1,262 +0,0 @@
|
|||||||
package com.xboe.school.study.api;
|
|
||||||
|
|
||||||
import com.xboe.api.ThirdApi;
|
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
|
||||||
import com.xboe.school.study.service.IStudyService;
|
|
||||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.data.redis.connection.RedisConnection;
|
|
||||||
import org.springframework.data.redis.core.Cursor;
|
|
||||||
import org.springframework.data.redis.core.ScanOptions;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author by lyc
|
|
||||||
* @date 2025/3/3
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class StudyCourseTask {
|
|
||||||
|
|
||||||
private final IStudyService studyService;
|
|
||||||
private final StringRedisTemplate redisTemplate;
|
|
||||||
@Resource
|
|
||||||
private ThirdApi thirdApi;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定时任务
|
|
||||||
* 获取redis 中学习结束的数据更新入库
|
|
||||||
* */
|
|
||||||
@XxlJob("saveStudyCourseItemLastTime2")
|
|
||||||
public void saveStudyCourseItemLastTime2() {
|
|
||||||
// 1. 定义匹配模式(匹配所有目标key)
|
|
||||||
final String KEY_PATTERN = "studyContentId:*:last_active";
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
|
|
||||||
// 2. 使用SCAN安全遍历(避免阻塞)
|
|
||||||
ScanOptions options = ScanOptions.scanOptions()
|
|
||||||
.match(KEY_PATTERN)
|
|
||||||
.count(100) // 分页大小
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try (RedisConnection connection = Objects.requireNonNull(redisTemplate.getConnectionFactory()).getConnection()) {
|
|
||||||
Cursor<byte[]> cursor = connection.scan(options);
|
|
||||||
// 3. 遍历处理符合条件的key
|
|
||||||
while (cursor.hasNext()) {
|
|
||||||
String redisKey = new String(cursor.next());
|
|
||||||
// 4. 获取剩余TTL(秒)
|
|
||||||
Long ttl = redisTemplate.getExpire(redisKey, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
// 5. 过滤条件:剩余时间 >= 29天23小时30分钟(转换为秒)
|
|
||||||
// 总需时间 = (30天 - 30分钟) = 29天23小时30分钟 = 2590200秒
|
|
||||||
// 5分钟 300秒 || 2592000 - 300 = 2591700
|
|
||||||
if (ttl <= 2590200) {
|
|
||||||
try {
|
|
||||||
// 6. 提取studyContentId
|
|
||||||
String[] parts = redisKey.split(":");
|
|
||||||
if (parts.length < 2) continue;
|
|
||||||
String studyContentId = parts[1];
|
|
||||||
// 7. 获取存储的时间点(示例逻辑)
|
|
||||||
String redisValue = redisTemplate.opsForValue().get(redisKey);
|
|
||||||
if (redisValue == null) continue;
|
|
||||||
String[] partValues = redisValue.split("&");
|
|
||||||
int lastStudyTime = Integer.parseInt(partValues[0]);
|
|
||||||
LocalDateTime timestamp = null;
|
|
||||||
if (partValues.length >= 2){
|
|
||||||
timestamp = LocalDateTime.parse(partValues[1], formatter);
|
|
||||||
}
|
|
||||||
// 8. 更新数据库(调用已有服务方法)
|
|
||||||
studyService.updateStudyCourseItemLastTime(studyContentId, lastStudyTime, timestamp);
|
|
||||||
// 9. 删除Redis键(原子操作)
|
|
||||||
redisTemplate.delete(redisKey);
|
|
||||||
log.info("处理成功 key: {}, lastStudyTime: {}", redisKey, lastStudyTime);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("处理失败 key: {}", redisKey, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("定时任务执行异常", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* // 新增日志逻辑
|
|
||||||
if (ttl <= 172800) {
|
|
||||||
studyService.saveCourseExpireLog(
|
|
||||||
studyContentId,
|
|
||||||
lastStudyTime,
|
|
||||||
redisKey,
|
|
||||||
ttl,
|
|
||||||
"system_job"
|
|
||||||
);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@XxlJob("saveStudyCourseItemLastTime")
|
|
||||||
public void saveStudyCourseItemLastTime() {
|
|
||||||
// 1. 定义匹配模式(匹配所有目标key)
|
|
||||||
final String KEY_PATTERN = "studyId:*:courseId:*:courseContentId:*:studyItemId:*";
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
|
|
||||||
// 2. 使用SCAN安全遍历(避免阻塞)
|
|
||||||
ScanOptions options = ScanOptions.scanOptions()
|
|
||||||
.match(KEY_PATTERN)
|
|
||||||
.count(100) // 分页大小
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try (RedisConnection connection = Objects.requireNonNull(redisTemplate.getConnectionFactory()).getConnection()) {
|
|
||||||
Cursor<byte[]> cursor = connection.scan(options);
|
|
||||||
// 3. 遍历处理符合条件的key
|
|
||||||
while (cursor.hasNext()) {
|
|
||||||
String redisKey = new String(cursor.next());
|
|
||||||
log.info("-定时任务 saveStudyCourseItemLastTime ---redisKey = " + redisKey);
|
|
||||||
// 4. 获取剩余TTL(秒)
|
|
||||||
Long ttl = redisTemplate.getExpire(redisKey, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
// 5. 过滤条件:剩余时间 >= 29天23小时30分钟(转换为秒)
|
|
||||||
// 总需时间 = (30天 - 30分钟) = 29天23小时30分钟 = 2590200秒
|
|
||||||
// 5分钟 300秒 || 2592000 - 300 = 2591700
|
|
||||||
if (ttl <= 2590200) {
|
|
||||||
try {
|
|
||||||
// 6. 提取studyContentId
|
|
||||||
String[] parts = redisKey.split(":");
|
|
||||||
if (parts.length < 7) continue;
|
|
||||||
String studyId = parts[1];
|
|
||||||
String courseId = parts[3];
|
|
||||||
String courseContentId = parts[5];
|
|
||||||
String studyItemId = parts[7];
|
|
||||||
// 7. 获取存储的时间点(示例逻辑)
|
|
||||||
String redisValue = redisTemplate.opsForValue().get(redisKey);
|
|
||||||
log.info("-定时任务 saveStudyCourseItemLastTime ---redisValue = " + redisValue);
|
|
||||||
if (redisValue == null) continue;
|
|
||||||
String[] partValues = redisValue.split("&");
|
|
||||||
int studyVideoTtime = Integer.parseInt(partValues[0]);
|
|
||||||
int appendtime = Integer.parseInt(partValues[1]);
|
|
||||||
LocalDateTime timestamp = null;
|
|
||||||
if (partValues.length >= 2){
|
|
||||||
timestamp = LocalDateTime.parse(partValues[2], formatter);
|
|
||||||
}
|
|
||||||
// 8. 更新数据库(调用已有服务方法)
|
|
||||||
studyService.newAppendStudyDuration(studyId,null,courseContentId,appendtime,timestamp);
|
|
||||||
log.info("-定时任务 saveStudyCourseItemLastTime ---studyItemId = " + studyItemId);
|
|
||||||
if (studyItemId != null && !studyItemId.equals("null")){
|
|
||||||
log.info("-定时任务 saveStudyCourseItemLastTime --- boolean studyItemId = " + (studyItemId != null));
|
|
||||||
// 8. 更新数据库(调用已有服务方法)
|
|
||||||
studyService.updateStudyCourseItemLastTime(studyItemId, studyVideoTtime, timestamp);
|
|
||||||
}
|
|
||||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId , courseId, null);
|
|
||||||
log.info("处理成功 allUserList: {}", allUserList);
|
|
||||||
// 9. 删除Redis键(原子操作)
|
|
||||||
redisTemplate.delete(redisKey);
|
|
||||||
log.info("处理成功 key: {}, lastStudyTime: {}", redisKey, appendtime);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("处理失败 key: {}", redisKey, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("定时任务执行异常", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@XxlJob("saveStudyCourseItemLastTime1")
|
|
||||||
public void saveStudyCourseItemLastTime1() {
|
|
||||||
// 定义需要处理的键模式集合
|
|
||||||
processKeys("studyContentId:*:last_active", this::handleLastActiveKey);
|
|
||||||
processKeys("studyId:*:courseId:*:courseContentId:*", this::handleDurationKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processKeys(String keyPattern, BiConsumer<String, String> keyHandler) {
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
|
|
||||||
ScanOptions options = ScanOptions.scanOptions()
|
|
||||||
.match(keyPattern)
|
|
||||||
.count(100)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
try (RedisConnection connection = Objects.requireNonNull(redisTemplate.getConnectionFactory()).getConnection()) {
|
|
||||||
Cursor<byte[]> cursor = connection.scan(options);
|
|
||||||
while (cursor.hasNext()) {
|
|
||||||
String redisKey = new String(cursor.next());
|
|
||||||
Long ttl = redisTemplate.getExpire(redisKey, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
if (ttl != null && ttl <= 2590200) {
|
|
||||||
try {
|
|
||||||
String redisValue = redisTemplate.opsForValue().get(redisKey);
|
|
||||||
if (redisValue != null) {
|
|
||||||
// 调用对应的处理方法
|
|
||||||
keyHandler.accept(redisKey, redisValue);
|
|
||||||
}
|
|
||||||
redisTemplate.delete(redisKey);
|
|
||||||
log.info("Key processed: {}", redisKey);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Process failed [{}]", redisKey, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Key processing error: {}", keyPattern, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理 last_active 类型键
|
|
||||||
private void handleLastActiveKey(String redisKey, String redisValue) {
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
|
|
||||||
String[] parts = redisKey.split(":");
|
|
||||||
String studyContentId = parts[1];
|
|
||||||
|
|
||||||
String[] values = redisValue.split("&");
|
|
||||||
int lastStudyTime = Integer.parseInt(values[0]);
|
|
||||||
LocalDateTime timestamp = values.length >= 2 ?
|
|
||||||
LocalDateTime.parse(values[1], formatter) : null;
|
|
||||||
|
|
||||||
studyService.updateStudyCourseItemLastTime(studyContentId, lastStudyTime, timestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理 duration 类型键
|
|
||||||
private void handleDurationKey(String redisKey, String redisValue) {
|
|
||||||
String[] parts = redisKey.split(":");
|
|
||||||
String studyId = parts[1];
|
|
||||||
String courseId = parts[3];
|
|
||||||
String courseContentId = parts[5];
|
|
||||||
|
|
||||||
String[] values = redisValue.split("&");
|
|
||||||
int duration = Integer.parseInt(values[0]);
|
|
||||||
LocalDateTime timestamp = values.length >= 2 ?
|
|
||||||
LocalDateTime.parse(values[1], DateTimeFormatter.ISO_LOCAL_DATE_TIME) : null;
|
|
||||||
|
|
||||||
studyService.newAppendStudyDuration(studyId, null, courseContentId, duration, timestamp);
|
|
||||||
|
|
||||||
// 保留第三方调用
|
|
||||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId, courseId, null);
|
|
||||||
log.info("Study records synced: {}", allUserList.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.xboe.school.study.entity;
|
package com.xboe.school.study.entity;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Transient;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.xboe.core.SysConstant;
|
import com.xboe.core.SysConstant;
|
||||||
@@ -130,12 +128,5 @@ public class StudyCourseItem extends IdEntity {
|
|||||||
*/
|
*/
|
||||||
@Column(name = "status",length=1)
|
@Column(name = "status",length=1)
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频播放进度
|
|
||||||
* */
|
|
||||||
// @Column(name = "progress_video")
|
|
||||||
@Transient
|
|
||||||
private BigDecimal progressVideo;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.xboe.school.study.service;
|
package com.xboe.school.study.service;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -8,6 +7,7 @@ import com.xboe.common.PageList;
|
|||||||
import com.xboe.school.study.dto.StudyContentDto;
|
import com.xboe.school.study.dto.StudyContentDto;
|
||||||
import com.xboe.school.study.entity.StudyCourseItem;
|
import com.xboe.school.study.entity.StudyCourseItem;
|
||||||
import com.xboe.school.study.entity.StudyTime;
|
import com.xboe.school.study.entity.StudyTime;
|
||||||
|
import com.xboe.system.user.entity.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 学习情况处理,比较综合一个处理类
|
* 学习情况处理,比较综合一个处理类
|
||||||
@@ -35,12 +35,11 @@ public interface IStudyService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新最后的学习时间,及学习时间点
|
* 更新最后的学习时间,及学习时间点
|
||||||
*
|
|
||||||
* @param studyContentId
|
* @param studyContentId
|
||||||
* @param lastStudyTime
|
* @param lastStudyTime
|
||||||
* @param aid
|
* @param aid
|
||||||
*/
|
*/
|
||||||
void updateLastTime(String studyContentId, int lastStudyTime, String aid);
|
void updateLastTime(String studyContentId,int lastStudyTime,String aid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资源学习记录
|
* 资源学习记录
|
||||||
@@ -100,9 +99,4 @@ public interface IStudyService {
|
|||||||
|
|
||||||
List<StudyCourseItem> getList(String courseId, String contentId, String name, Integer status);
|
List<StudyCourseItem> getList(String courseId, String contentId, String name, Integer status);
|
||||||
|
|
||||||
void updateStudyCourseItemLastTime(String studyContentId, int lastStudyTime, LocalDateTime timestamp);
|
|
||||||
|
|
||||||
void updateStudyDuration(String studyId,String studyItemId, String contentId, Integer videoTime,String courseId);
|
|
||||||
|
|
||||||
void newAppendStudyDuration(String studyId, String studyItemId, String courseContentId, int duration, LocalDateTime timestamp);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.xboe.school.study.service.impl;
|
package com.xboe.school.study.service.impl;
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
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.ArrayList;
|
||||||
@@ -10,9 +9,12 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
import com.xboe.module.article.entity.Article;
|
||||||
|
import com.xboe.module.interaction.entity.Shares;
|
||||||
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
|
import com.xboe.system.user.entity.User;
|
||||||
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.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.xboe.common.OrderCondition;
|
import com.xboe.common.OrderCondition;
|
||||||
@@ -49,10 +51,7 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
UserDao userDao;
|
UserDao userDao;
|
||||||
@Autowired
|
|
||||||
StringRedisTemplate redisTemplate;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StudyCourseItem checkHas(String studyId,String contentId) {
|
public StudyCourseItem checkHas(String studyId,String contentId) {
|
||||||
List<StudyCourseItem> items = scItemDao.findList(FieldFilters.eq("studyId", studyId),FieldFilters.eq("contentId", contentId));
|
List<StudyCourseItem> items = scItemDao.findList(FieldFilters.eq("studyId", studyId),FieldFilters.eq("contentId", contentId));
|
||||||
@@ -116,74 +115,34 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
//增加内容的学习时长
|
//增加内容的学习时长
|
||||||
if(StringUtils.isNotBlank(studyItemId)) {
|
if(StringUtils.isNotBlank(studyItemId)) {
|
||||||
//直接根据id更新
|
//直接根据id更新
|
||||||
|
// String hql="Update StudyCourseItem set studyDuration=studyDuration+"+duration+",status=(case when status<2 then 2 else status end) where id=?1";
|
||||||
|
// scItemDao.update(hql,studyItemId);
|
||||||
String sql="Update boe_study_course_item set study_duration=study_duration+"+duration+",status=(case when status<2 then 2 else status end) where id=?1";
|
String sql="Update boe_study_course_item set study_duration=study_duration+"+duration+",status=(case when status<2 then 2 else status end) where id=?1";
|
||||||
scItemDao.sqlUpdate(sql,studyItemId);
|
scItemDao.sqlUpdate(sql,studyItemId);
|
||||||
|
//scItemDao.updateMultiFieldById(studyItemId, UpdateBuilder.create("studyDuration", "studyDuration+"+duration,FieldUpdateType.EXPRESSION));
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
//根据学习id和课程内容id更新
|
||||||
|
// scItemDao.update(UpdateBuilder.from(StudyCourseItem.class)
|
||||||
|
// .addUpdateField("studyDuration", "studyDuration+"+duration,FieldUpdateType.EXPRESSION)
|
||||||
|
// .addFilter(FieldFilters.eq("studyId", studyId))
|
||||||
|
// .addFilter(FieldFilters.eq("contentId", courseContentId))
|
||||||
|
// .builder());
|
||||||
|
//
|
||||||
|
// String hql="Update StudyCourseItem set studyDuration=studyDuration+"+duration+",status=(case when status<2 then 2 else status end) where studyId=?1 and contentId=?2";
|
||||||
|
// scItemDao.update(hql,studyId,courseContentId);
|
||||||
String sql="Update boe_study_course_item set study_duration=study_duration+"+duration+",status=(case when status<2 then 2 else status end) where study_id=?1 and content_id=?2";
|
String sql="Update boe_study_course_item set study_duration=study_duration+"+duration+",status=(case when status<2 then 2 else status end) where study_id=?1 and content_id=?2";
|
||||||
scItemDao.sqlUpdate(sql,studyId,courseContentId);
|
scItemDao.sqlUpdate(sql,studyId,courseContentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//追加课程的学习时长
|
||||||
|
//scDao.updateMultiFieldById(studyId, UpdateBuilder.create("totalDuration", "totalDuration+"+duration,FieldUpdateType.EXPRESSION));
|
||||||
|
|
||||||
String sql="Update boe_study_course set total_duration=total_duration+"+duration+",status=(case when status<2 then 2 else status end),progress=(case when progress=0 then 1 else progress end),last_time = '"+LocalDateTime.now()+"' where id=?1";
|
String sql="Update boe_study_course set total_duration=total_duration+"+duration+",status=(case when status<2 then 2 else status end),progress=(case when progress=0 then 1 else progress end),last_time = '"+LocalDateTime.now()+"' where id=?1";
|
||||||
scDao.sqlUpdate(sql,studyId);
|
scDao.sqlUpdate(sql,studyId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void newAppendStudyDuration(String studyId,String studyItemId,String courseContentId, int duration,LocalDateTime timestamp) {
|
|
||||||
|
|
||||||
//增加内容的学习时长
|
|
||||||
if(StringUtils.isNotBlank(studyItemId)) {
|
|
||||||
//直接根据id更新
|
|
||||||
String sql="Update boe_study_course_item set study_duration=study_duration+"+duration+",status=(case when status<2 then 2 else status end) where id=?1";
|
|
||||||
scItemDao.sqlUpdate(sql,studyItemId);
|
|
||||||
|
|
||||||
}else {
|
|
||||||
String sql="Update boe_study_course_item set study_duration=study_duration+"+duration+",status=(case when status<2 then 2 else status end) where study_id=?1 and content_id=?2";
|
|
||||||
scItemDao.sqlUpdate(sql,studyId,courseContentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
String sql="Update boe_study_course set total_duration=total_duration+"+duration+",status=(case when status<2 then 2 else status end),progress=(case when progress=0 then 1 else progress end),last_time = '"+timestamp+"' where id=?1";
|
|
||||||
scDao.sqlUpdate(sql,studyId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新 前端传输已学习时长
|
|
||||||
@Override
|
|
||||||
public void updateStudyDuration(String studyId,String studyItemId,String courseContentId, Integer videoTime,String courseId) {
|
|
||||||
|
|
||||||
LocalDateTime now = LocalDateTime.now();
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
|
|
||||||
|
|
||||||
String key = "studyId:" + studyId + ":courseId:" + courseId + ":courseContentId:" + courseContentId + ":studyItemId:" + studyItemId;
|
|
||||||
String currentValue = redisTemplate.opsForValue().get(key);
|
|
||||||
Integer lastDuration = 0;
|
|
||||||
Integer oldVideoTime = 0;
|
|
||||||
Integer sum = 10; // 原appendtime改为固定10秒调用一次接口
|
|
||||||
if (currentValue != null) {
|
|
||||||
String[] partValues = currentValue.split("&");
|
|
||||||
oldVideoTime = Integer.parseInt(partValues[0]);
|
|
||||||
lastDuration = Integer.parseInt(partValues[1]);
|
|
||||||
sum += lastDuration;
|
|
||||||
if(oldVideoTime > videoTime){
|
|
||||||
videoTime = oldVideoTime;// 取最大值最终入库
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
String value = videoTime + "&" + sum + "&" + now.format(formatter); // study_video_time & appendtime & time
|
|
||||||
log.info("-study-video-time-----value = " + value);
|
|
||||||
|
|
||||||
// 20250303 优化 多次更新改一次更新
|
|
||||||
// 更新Redis中的最后活跃时间(带30秒过期)
|
|
||||||
redisTemplate.opsForValue().set(
|
|
||||||
key,
|
|
||||||
value,
|
|
||||||
Duration.ofSeconds(2592000)
|
|
||||||
);
|
|
||||||
log.info("- 合并 updateStudyDuration -redis保存---value = " + value);
|
|
||||||
// Duration.ofDays(30) 也就是 2592000秒
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void appendStudyDuration(StudyTime st) {
|
public void appendStudyDuration(StudyTime st) {
|
||||||
@@ -206,21 +165,7 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StudyCourseItem> findByStudyId(String studyId) {
|
public List<StudyCourseItem> findByStudyId(String studyId) {
|
||||||
List<StudyCourseItem> list = scItemDao.findList(OrderCondition.desc("lastTime"),FieldFilters.eq("studyId", studyId));
|
return scItemDao.findList(OrderCondition.desc("lastTime"),FieldFilters.eq("studyId", studyId));
|
||||||
for (StudyCourseItem item : list){
|
|
||||||
log.info("-- studyIndex -查询上次学习的是什么资源。mysql查询---------------- item = " + item);
|
|
||||||
String redisKey = "studyId:" + studyId + ":courseId:" + item.getCourseId() + ":courseContentId:" + item.getContentId() + ":studyItemId:" + item.getId();
|
|
||||||
log.info("-- studyIndex -查询上次学习的是什么资源。查询用户的学习情况---------------- redisKey = " + redisKey);
|
|
||||||
String redisValue = redisTemplate.opsForValue().get(redisKey);
|
|
||||||
log.info("-- studyIndex -查询上次学习的是什么资源。查询用户的学习情况---------------- redisValue = " + redisValue);
|
|
||||||
if (redisValue != null) {
|
|
||||||
String[] values = redisValue.split("&");
|
|
||||||
int duration = Integer.parseInt(values[0]);
|
|
||||||
item.setLastStudyTime(duration);
|
|
||||||
log.info("-- studyIndex -----set 结果---------------- LastStudyTime = " + item.getLastStudyTime());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -378,27 +323,9 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新 前端传输已学习时长
|
// 更新 前端传输已学习时长
|
||||||
@Override
|
|
||||||
public void updateLastTime(String studyContentId, int lastStudyTime,String aid) {
|
|
||||||
LocalDateTime now = LocalDateTime.now();
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
|
|
||||||
String value = lastStudyTime + "&" + now.format(formatter); // 使用ISO8601时间格式
|
|
||||||
log.info("-study-video-time-----value = " + value);
|
|
||||||
// 20250303 优化 多次更新改一次更新
|
|
||||||
// 更新Redis中的最后活跃时间(带30秒过期)
|
|
||||||
redisTemplate.opsForValue().set(
|
|
||||||
"studyContentId:" + studyContentId + ":last_active",
|
|
||||||
value,
|
|
||||||
Duration.ofSeconds(2592000)
|
|
||||||
);
|
|
||||||
log.info("-study-video-time-redis保存---value = " + value);
|
|
||||||
// Duration.ofDays(30) 也就是 2592000秒
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateStudyCourseItemLastTime(String studyContentId, int lastStudyTime,LocalDateTime timestamp) {
|
public void updateLastTime(String studyContentId, int lastStudyTime,String aid) {
|
||||||
log.info("-study-video-time-定时---studyContentId = " + studyContentId + ",lastStudyTime = " + lastStudyTime + ", timestamp = " + timestamp);
|
|
||||||
// 更新最后的学习时间点
|
// 更新最后的学习时间点
|
||||||
LocalDateTime now=LocalDateTime.now();
|
LocalDateTime now=LocalDateTime.now();
|
||||||
UpdateBuilder update=UpdateBuilder.from(StudyCourseItem.class);
|
UpdateBuilder update=UpdateBuilder.from(StudyCourseItem.class);
|
||||||
@@ -406,12 +333,11 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
//只记录时间长的时候的处理
|
//只记录时间长的时候的处理
|
||||||
update.addFilter(FieldFilters.lt("lastStudyTime", lastStudyTime));
|
update.addFilter(FieldFilters.lt("lastStudyTime", lastStudyTime));
|
||||||
update.addUpdateField("lastStudyTime", lastStudyTime);
|
update.addUpdateField("lastStudyTime", lastStudyTime);
|
||||||
update.addUpdateField("lastTime", timestamp==null ? now : timestamp);
|
update.addUpdateField("lastTime", now);
|
||||||
scItemDao.update(update.builder());
|
scItemDao.update(update.builder());
|
||||||
log.info("-study-video-time-mysql保存---studyContentId = " + studyContentId);
|
//增加用户的学习时长,在api中调用
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> getLast(String aid) {
|
public Map<String,Object> getLast(String aid) {
|
||||||
//按lastTime排序,第一条,只是课件内容
|
//按lastTime排序,第一条,只是课件内容
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.xboe.school.vo;
|
|
||||||
|
|
||||||
import com.xboe.school.study.entity.StudyTime;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/** appendtime 于 study-video-time 合并
|
|
||||||
* appendtime 参数 StudyTime
|
|
||||||
* study-video-time 参数 是 StudyTimeVo
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class StudyTimeVo extends StudyTime {
|
|
||||||
|
|
||||||
private String itemId;
|
|
||||||
private Integer videoTime;
|
|
||||||
// private String contentId; // 已继承
|
|
||||||
// private String courseId; // 已继承
|
|
||||||
private Float progressVideo;
|
|
||||||
private Integer type; // 0 study-video-time , 1 appendtime
|
|
||||||
}
|
|
||||||
@@ -1,105 +1,159 @@
|
|||||||
boe:
|
|
||||||
domain: http://192.168.0.253
|
|
||||||
spring:
|
spring:
|
||||||
|
# application.yml
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
max-file-size: 1000MB
|
max-file-size: 500MB
|
||||||
max-request-size: 1000MB
|
max-request-size: 500MB
|
||||||
web:
|
|
||||||
resources:
|
|
||||||
static-locations: file:E:/Projects/BOE/java/static
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
server-addr: 192.168.0.253:8848
|
|
||||||
config:
|
|
||||||
server-addr: 192.168.0.253:8848
|
|
||||||
redis:
|
redis:
|
||||||
database: 1
|
database: 1
|
||||||
host: 192.168.0.253
|
host: 192.168.0.101
|
||||||
password: boe@123
|
password: boe@123
|
||||||
port: 6379
|
port: 6379
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8
|
||||||
|
min-idle: 0
|
||||||
|
max-idle: 30
|
||||||
|
max-wait: 10000ms
|
||||||
|
shutdown-timeout: 100ms
|
||||||
jpa:
|
jpa:
|
||||||
|
database: MYSQL
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
naming_strategy: org.hibernate.cfg.EJB3NamingStrategy
|
||||||
|
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
|
||||||
|
current_session_context_class: org.springframework.orm.hibernate5.SpringSessionContext
|
||||||
|
show-sql: true
|
||||||
hibernate:
|
hibernate:
|
||||||
ddl-auto: none
|
ddl-auto: update
|
||||||
datasource:
|
datasource:
|
||||||
driverClassName: com.mysql.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://192.168.0.253:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
url: jdbc:mysql://192.168.0.101:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||||
username: root
|
username: root
|
||||||
password: boe#1234A
|
password: boe#1234A
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
web:
|
||||||
hikari:
|
resources:
|
||||||
auto-commit: true
|
static-locations: file:E:/Projects/BOE/10/static
|
||||||
minimum-idle: 5
|
server:
|
||||||
idle-timeout: 60000
|
port: 9090
|
||||||
connection-timeout: 30000
|
servlet:
|
||||||
max-lifetime: 1800000
|
multipart:
|
||||||
maximum-pool-size: 20
|
max-file-size: 500MB
|
||||||
logging:
|
max-request-size: 500MB
|
||||||
level:
|
session:
|
||||||
org:
|
timeout: 30m
|
||||||
hibernate:
|
encoding:
|
||||||
SQL: ERROR
|
charset: UTF-8
|
||||||
config: classpath:log/logback-@profileActive@.xml
|
enabled: true
|
||||||
|
force: true
|
||||||
|
tomcat:
|
||||||
|
uri-encoding: UTF-8
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
maxFileSize: 1024MB
|
||||||
|
maxRequestSize: 1024MB
|
||||||
|
mvc:
|
||||||
|
static-path-pattern: /cdn/**
|
||||||
|
|
||||||
|
#logging.level.org.hibernate.SQL=DEBUG
|
||||||
|
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||||
|
#logging.config=classpath:log/logback-@profileActive@.xml
|
||||||
|
|
||||||
|
# logging:
|
||||||
|
# config: classpath:log/logback-${spring.profiles.active}.xml
|
||||||
|
# level:
|
||||||
|
# org:
|
||||||
|
# hibernate:
|
||||||
|
# SQL: DEBUG
|
||||||
|
# type:
|
||||||
|
# descriptor:
|
||||||
|
# sql:
|
||||||
|
# BasicBinder: TRACE
|
||||||
|
|
||||||
|
xcaching:
|
||||||
|
specs:
|
||||||
|
favorites:
|
||||||
|
timeout: 10s
|
||||||
|
praises:
|
||||||
|
timeout: 10s
|
||||||
|
shares:
|
||||||
|
timeout: 10s
|
||||||
|
|
||||||
xboe:
|
xboe:
|
||||||
api:
|
api:
|
||||||
cross_filter: true
|
cross_filter: true
|
||||||
|
local:
|
||||||
|
dev: true
|
||||||
upload:
|
upload:
|
||||||
file:
|
file:
|
||||||
temp_path: /tmp
|
temp_path: D:/Projects/BOE/10/static/temp
|
||||||
save_path: /home/www/elearning/upload
|
save_path: /home/www/elearning/upload
|
||||||
http_path: http://192.168.0.253/upload
|
http_path: http://127.0.0.1/upload
|
||||||
externalinterface:
|
externalinterface:
|
||||||
url:
|
url:
|
||||||
system: http://127.0.0.1:9091
|
system: http://localhost:9091
|
||||||
old:
|
old:
|
||||||
base:
|
base:
|
||||||
url: http://192.168.0.253
|
url: http://192.168.0.101
|
||||||
|
server:
|
||||||
|
userbasic:
|
||||||
|
url: http://192.168.0.101/userbasic
|
||||||
stat:
|
stat:
|
||||||
base:
|
base:
|
||||||
url: http://127.0.0.1:9080
|
url: http://127.0.0.1:9080
|
||||||
server:
|
|
||||||
userbasic:
|
|
||||||
url: http://192.168.0.253/userbasic
|
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
server:
|
server:
|
||||||
ip: 192.168.0.253
|
ip: 192.168.0.101
|
||||||
port: 9200
|
port: 9200
|
||||||
user:
|
user:
|
||||||
password:
|
password:
|
||||||
email:
|
email:
|
||||||
url: http://192.168.0.253/api/b1/email/send
|
url: http://192.168.0.101/api/b1/email/send
|
||||||
from: boeu_learning@boe.com.cn
|
from: boeu_learning@boe.com.cn
|
||||||
user:
|
user:
|
||||||
security:
|
security:
|
||||||
jasypt:
|
|
||||||
encryptor:
|
jasypt:
|
||||||
algorithm: PBEWithMD5AndDES
|
encryptor:
|
||||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
algorithm: PBEWithMD5AndDES
|
||||||
image:
|
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||||
course:
|
|
||||||
default: http://192.168.0.253/pc/images/bgimg/course.png
|
boe:
|
||||||
xxl:
|
domain: http://127.0.0.1
|
||||||
job:
|
|
||||||
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
ok:
|
||||||
admin:
|
http:
|
||||||
addresses: http://192.168.0.253/jobAdmin
|
connect-timeout: 30
|
||||||
executor:
|
read-timeout: 30
|
||||||
appname: java-servers-job-api
|
write-timeout: 30
|
||||||
port: 9995
|
max-idle-connections: 200
|
||||||
address:
|
keep-alive-duration: 300
|
||||||
ip:
|
|
||||||
logpath: /var/log/xxl-job/dw/
|
|
||||||
logretentiondays: 30
|
|
||||||
aop-log-record:
|
orgTree:
|
||||||
#是否开启日志记录
|
orgTreeList: ${boe.domain}/userbasic/org/list
|
||||||
enabled: true
|
orgChildTreeList: ${boe.domain}/userbasic/org/childOrgs
|
||||||
#不进行拦截的包或者类
|
|
||||||
excludeClassNames:
|
userBasic:
|
||||||
activemq:
|
searchUserList: ${boe.domain}/userbasic/user/list
|
||||||
broker-url: tcp://192.168.0.253:61616
|
getUserBasicInfo: ${boe.domain}/userbasic/user/getUserBasicInfo
|
||||||
user: admin
|
getTeacherIds: ${boe.domain}/userbasic/user/getTeacherInfo
|
||||||
password: admin
|
|
||||||
elasticsearch:
|
audience:
|
||||||
host: 192.168.0.253
|
usersByAudienceList: ${boe.domain}/userbasic/audience/memberList
|
||||||
port: 9200
|
getOrgUsers: ${boe.domain}/userbasic/user/getOrgUsers
|
||||||
|
|
||||||
|
statApi:
|
||||||
|
userdynamicList: ${boe.domain}/statApi/xboe/m/stat/userdynamic/list
|
||||||
|
|
||||||
|
infrasApi:
|
||||||
|
dict: ${boe.domain}/infrasApi/dict/list
|
||||||
|
|
||||||
|
manageApi:
|
||||||
|
stu:
|
||||||
|
offcourse: ${boe.domain}/manageApi/stu/offcourse/getOffCourseId
|
||||||
|
editExam: ${boe.domain}/manageApi/admin/project/editExam
|
||||||
|
getStudyStatus: ${boe.domain}/manageApi/stu/project/completeStatus
|
||||||
|
coursesuilt:
|
||||||
|
getStudyStatus: ${boe.domain}/manageApi/stu/project/completeStatus
|
||||||
@@ -84,19 +84,19 @@ xboe:
|
|||||||
file:
|
file:
|
||||||
temp_path: /tmp
|
temp_path: /tmp
|
||||||
save_path: /home/www/elearning/upload
|
save_path: /home/www/elearning/upload
|
||||||
http_path: http://10.251.132.75/upload
|
http_path: http://10.251.132.177/upload
|
||||||
externalinterface:
|
externalinterface:
|
||||||
url:
|
url:
|
||||||
system: http://localhost:9091
|
system: http://localhost:9091
|
||||||
old:
|
old:
|
||||||
base:
|
base:
|
||||||
url: http://10.251.132.75
|
url: http://10.251.132.177
|
||||||
server:
|
server:
|
||||||
userbasic:
|
userbasic:
|
||||||
url: http://10.251.132.75/userbasic
|
url: http://10.251.132.177/userbasic
|
||||||
stat:
|
stat:
|
||||||
base:
|
base:
|
||||||
url: http://10.251.132.75:9080
|
url: http://10.251.132.177:9080
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
server:
|
server:
|
||||||
ip: 10.251.129.21
|
ip: 10.251.129.21
|
||||||
@@ -104,20 +104,18 @@ xboe:
|
|||||||
user:
|
user:
|
||||||
password:
|
password:
|
||||||
email:
|
email:
|
||||||
url: http://10.251.132.75/api/b1/email/send
|
url: http://10.251.132.177/api/b1/email/send
|
||||||
from: boeu_learning@boe.com.cn
|
from: boeu_learning@boe.com.cn
|
||||||
user:
|
user:
|
||||||
security:
|
security:
|
||||||
image:
|
|
||||||
course:
|
|
||||||
default: http://10.251.132.75/pc/images/bgimg/course.png
|
|
||||||
jasypt:
|
jasypt:
|
||||||
encryptor:
|
encryptor:
|
||||||
algorithm: PBEWithMD5AndDES
|
algorithm: PBEWithMD5AndDES
|
||||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||||
|
|
||||||
boe:
|
boe:
|
||||||
domain: http://10.251.132.75
|
domain: http://10.251.132.177
|
||||||
|
|
||||||
ok:
|
ok:
|
||||||
http:
|
http:
|
||||||
@@ -159,7 +157,7 @@ coursesuilt:
|
|||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
admin:
|
admin:
|
||||||
addresses: http://10.251.132.75/jobAdmin
|
addresses: http://10.251.132.177/jobAdmin
|
||||||
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
||||||
executor:
|
executor:
|
||||||
appname: java-servers-job-api
|
appname: java-servers-job-api
|
||||||
|
|||||||
@@ -74,14 +74,11 @@ xboe:
|
|||||||
encryptor:
|
encryptor:
|
||||||
algorithm: PBEWithMD5AndDES
|
algorithm: PBEWithMD5AndDES
|
||||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||||
image:
|
|
||||||
course:
|
|
||||||
default: https://u.boe.com/pc/images/bgimg/course.png
|
|
||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
|
||||||
admin:
|
admin:
|
||||||
addresses: http://u.boe.com/jobAdmin
|
addresses: http://u.boe.com/jobAdmin
|
||||||
|
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
||||||
executor:
|
executor:
|
||||||
appname: java-servers-job-api
|
appname: java-servers-job-api
|
||||||
port: 9995
|
port: 9995
|
||||||
|
|||||||
@@ -1,185 +0,0 @@
|
|||||||
spring:
|
|
||||||
# application.yml
|
|
||||||
servlet:
|
|
||||||
multipart:
|
|
||||||
max-file-size: 1000MB
|
|
||||||
max-request-size: 1000MB
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
server-addr: 10.251.186.27:8848
|
|
||||||
config:
|
|
||||||
server-addr: 10.251.186.27:8848
|
|
||||||
redis:
|
|
||||||
database: 1
|
|
||||||
host: 10.251.160.38
|
|
||||||
password: qwert!W577
|
|
||||||
port: 6379
|
|
||||||
lettuce:
|
|
||||||
pool:
|
|
||||||
max-active: 8
|
|
||||||
min-idle: 0
|
|
||||||
max-idle: 30
|
|
||||||
max-wait: 10000ms
|
|
||||||
shutdown-timeout: 100ms
|
|
||||||
jpa:
|
|
||||||
database: MYSQL
|
|
||||||
properties:
|
|
||||||
hibernate:
|
|
||||||
naming_strategy: org.hibernate.cfg.EJB3NamingStrategy
|
|
||||||
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
|
|
||||||
current_session_context_class: org.springframework.orm.hibernate5.SpringSessionContext
|
|
||||||
show-sql: true
|
|
||||||
hibernate:
|
|
||||||
ddl-auto: update
|
|
||||||
datasource:
|
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
|
||||||
url: jdbc:mysql://10.251.160.40:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
|
||||||
username: admin
|
|
||||||
password: boeRds01
|
|
||||||
web:
|
|
||||||
resources:
|
|
||||||
static-locations: file:E:/Projects/BOE/10/static
|
|
||||||
server:
|
|
||||||
port: 9090
|
|
||||||
tomcat:
|
|
||||||
uri-encoding: UTF-8
|
|
||||||
servlet:
|
|
||||||
multipart:
|
|
||||||
maxFileSize: 1024MB
|
|
||||||
maxRequestSize: 1024MB
|
|
||||||
mvc:
|
|
||||||
static-path-pattern: /cdn/**
|
|
||||||
|
|
||||||
#logging.level.org.hibernate.SQL=DEBUG
|
|
||||||
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
|
||||||
#logging.config=classpath:log/logback-@profileActive@.xml
|
|
||||||
|
|
||||||
# logging:
|
|
||||||
# config: classpath:log/logback-${spring.profiles.active}.xml
|
|
||||||
# level:
|
|
||||||
# org:
|
|
||||||
# hibernate:
|
|
||||||
# SQL: DEBUG
|
|
||||||
# type:
|
|
||||||
# descriptor:
|
|
||||||
# sql:
|
|
||||||
# BasicBinder: TRACE
|
|
||||||
|
|
||||||
xcaching:
|
|
||||||
specs:
|
|
||||||
favorites:
|
|
||||||
timeout: 10s
|
|
||||||
praises:
|
|
||||||
timeout: 10s
|
|
||||||
shares:
|
|
||||||
timeout: 10s
|
|
||||||
|
|
||||||
xboe:
|
|
||||||
api:
|
|
||||||
cross_filter: true
|
|
||||||
local:
|
|
||||||
dev: true
|
|
||||||
upload:
|
|
||||||
file:
|
|
||||||
temp_path: /tmp
|
|
||||||
save_path: /home/www/elearning/upload
|
|
||||||
http_path: https://u-pre.boe.com/upload
|
|
||||||
externalinterface:
|
|
||||||
url:
|
|
||||||
system: http://localhost:9091
|
|
||||||
old:
|
|
||||||
base:
|
|
||||||
url: http://10.251.186.27
|
|
||||||
server:
|
|
||||||
userbasic:
|
|
||||||
url: http://10.251.186.27/userbasic
|
|
||||||
stat:
|
|
||||||
base:
|
|
||||||
url: http://10.251.186.27:9080
|
|
||||||
elasticsearch:
|
|
||||||
server:
|
|
||||||
ip: 10.251.129.25
|
|
||||||
port: 9200
|
|
||||||
user: elastic
|
|
||||||
password: Boe@es123
|
|
||||||
email:
|
|
||||||
url: http://10.251.186.27/api/b1/email/send
|
|
||||||
from: boeu_learning@boe.com.cn
|
|
||||||
user:
|
|
||||||
security:
|
|
||||||
image:
|
|
||||||
course:
|
|
||||||
default: https://u-pre.boe.com/pc/images/bgimg/course.png
|
|
||||||
jasypt:
|
|
||||||
encryptor:
|
|
||||||
algorithm: PBEWithMD5AndDES
|
|
||||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
|
||||||
|
|
||||||
boe:
|
|
||||||
domain: http://10.251.186.27
|
|
||||||
|
|
||||||
ok:
|
|
||||||
http:
|
|
||||||
connect-timeout: 30
|
|
||||||
read-timeout: 30
|
|
||||||
write-timeout: 30
|
|
||||||
max-idle-connections: 200
|
|
||||||
keep-alive-duration: 300
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
orgTree:
|
|
||||||
orgTreeList: ${boe.domain}/userbasic/org/list
|
|
||||||
orgChildTreeList: ${boe.domain}/userbasic/org/childOrgs
|
|
||||||
|
|
||||||
userBasic:
|
|
||||||
searchUserList: ${boe.domain}/userbasic/user/list
|
|
||||||
getUserBasicInfo: ${boe.domain}/userbasic/user/getUserBasicInfo
|
|
||||||
getTeacherIds: ${boe.domain}/userbasic/user/getTeacherInfo
|
|
||||||
|
|
||||||
audience:
|
|
||||||
usersByAudienceList: ${boe.domain}/userbasic/audience/memberList
|
|
||||||
getOrgUsers: ${boe.domain}/userbasic/user/getOrgUsers
|
|
||||||
|
|
||||||
statApi:
|
|
||||||
userdynamicList: ${boe.domain}/statApi/xboe/m/stat/userdynamic/list
|
|
||||||
|
|
||||||
infrasApi:
|
|
||||||
dict: ${boe.domain}/infrasApi/dict/list
|
|
||||||
|
|
||||||
manageApi:
|
|
||||||
stu:
|
|
||||||
offcourse: ${boe.domain}/manageApi/stu/offcourse/getOffCourseId
|
|
||||||
editExam: ${boe.domain}/manageApi/admin/project/editExam
|
|
||||||
getStudyStatus: ${boe.domain}/manageApi/stu/project/completeStatus
|
|
||||||
coursesuilt:
|
|
||||||
getStudyStatus: ${boe.domain}/manageApi/stu/project/completeStatus
|
|
||||||
|
|
||||||
xxl:
|
|
||||||
job:
|
|
||||||
admin:
|
|
||||||
addresses: http://10.251.186.27/jobAdmin
|
|
||||||
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
|
||||||
executor:
|
|
||||||
appname: java-servers-job-api
|
|
||||||
port: 9995
|
|
||||||
address:
|
|
||||||
ip:
|
|
||||||
logpath: /var/log/xxl-job/system/
|
|
||||||
logretentiondays: 30
|
|
||||||
|
|
||||||
aop-log-record:
|
|
||||||
#是否开启日志记录
|
|
||||||
enabled: true
|
|
||||||
#不进行拦截的包或者类
|
|
||||||
excludeClassNames:
|
|
||||||
activemq:
|
|
||||||
broker-url: tcp://10.251.129.25:61616
|
|
||||||
user: admin
|
|
||||||
password: admin
|
|
||||||
elasticsearch:
|
|
||||||
host: 10.251.129.25
|
|
||||||
port: 9200
|
|
||||||
user: elastic
|
|
||||||
password: Boe@es123
|
|
||||||
@@ -73,5 +73,4 @@ coursesuilt:
|
|||||||
updateOrSaveCourse: ${boe.domain}/manageApi/admin/teacherRecord/updateOrSaveCourse
|
updateOrSaveCourse: ${boe.domain}/manageApi/admin/teacherRecord/updateOrSaveCourse
|
||||||
syncCourseStudent: ${boe.domain}/manageApi/admin/teacherRecord/syncCourseStudent
|
syncCourseStudent: ${boe.domain}/manageApi/admin/teacherRecord/syncCourseStudent
|
||||||
syncOnLineScore: ${boe.domain}/manageApi/admin/teacherRecord/syncOnLineScore
|
syncOnLineScore: ${boe.domain}/manageApi/admin/teacherRecord/syncOnLineScore
|
||||||
updateOnLineStatua: ${boe.domain}/manageApi/admin/teacherRecord/updateOnLineStatua
|
updateOnLineStatua: ${boe.domain}/manageApi/admin/teacherRecord/updateOnLineStatua
|
||||||
delOnLineById: ${boe.domain}/manageApi/admin/teacherRecord/delOnLineById
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="false">
|
|
||||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
|
||||||
<property name="log.path" value="/home/logs/${spring.application.name}"/>
|
|
||||||
<!-- 彩色日志格式 -->
|
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
|
||||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
|
||||||
<!-- 彩色日志依赖的渲染类 -->
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
|
||||||
<conversionRule conversionWord="wex"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
|
||||||
<conversionRule conversionWord="wEx"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
|
||||||
<!-- Console log output -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file debug output -->
|
|
||||||
<appender name="info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/debug.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file error output -->
|
|
||||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<level>ERROR</level>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
||||||
<root level="INFO">
|
|
||||||
<appender-ref ref="info"/>
|
|
||||||
<!-- <appender-ref ref="console"/>-->
|
|
||||||
<!-- <appender-ref ref="error"/> -->
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
@@ -51,6 +51,5 @@
|
|||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="debug"/>
|
<appender-ref ref="debug"/>
|
||||||
<appender-ref ref="error"/>
|
<appender-ref ref="error"/>
|
||||||
<appender-ref ref="console"/>
|
|
||||||
</root>
|
</root>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>application-*.yml</include>
|
<include>application-${profileActive}.yml</include>
|
||||||
<include>application.yml</include>
|
<include>application.yml</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
# application-pro.yml
|
# application-dev.yml
|
||||||
spring:
|
spring:
|
||||||
redis:
|
redis:
|
||||||
database: 1
|
database: 2
|
||||||
host: 192.168.0.253
|
|
||||||
password: boe@123
|
|
||||||
port: 6379
|
port: 6379
|
||||||
|
host: 192.168.0.101
|
||||||
|
password: boe@123
|
||||||
jpa:
|
jpa:
|
||||||
hibernate:
|
hibernate:
|
||||||
ddl-auto: update
|
ddl-auto: none
|
||||||
open-in-view: false
|
open-in-view: false
|
||||||
properties:
|
properties:
|
||||||
hibernate:
|
hibernate:
|
||||||
@@ -16,46 +16,41 @@ spring:
|
|||||||
driverClassName: com.mysql.jdbc.Driver
|
driverClassName: com.mysql.jdbc.Driver
|
||||||
db1:
|
db1:
|
||||||
driverClassName: com.mysql.jdbc.Driver
|
driverClassName: com.mysql.jdbc.Driver
|
||||||
jdbc-url: jdbc:mysql://192.168.0.253:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
jdbc-url: jdbc:mysql://192.168.0.101:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||||
username: root
|
username: root
|
||||||
password: boe#1234A
|
password: boe#1234A
|
||||||
db2:
|
db2:
|
||||||
driverClassName: com.mysql.jdbc.Driver
|
driverClassName: com.mysql.jdbc.Driver
|
||||||
jdbc-url: jdbc:mysql://192.168.0.253:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
jdbc-url: jdbc:mysql://192.168.0.101:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||||
username: root
|
username: root
|
||||||
password: boe#1234A
|
password: boe#1234A
|
||||||
|
web:
|
||||||
web:
|
resources:
|
||||||
resources:
|
static-locations: file:E:/Projects/BOE/java/static
|
||||||
static-locations: file:E:/Projects/BOE/java/static
|
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
org:
|
org:
|
||||||
hibernate:
|
hibernate:
|
||||||
SQL: ERROR
|
SQL: DEBUG
|
||||||
# type:
|
type:
|
||||||
# descriptor:
|
descriptor:
|
||||||
# sql:
|
sql:
|
||||||
# BasicBinder: TRACE
|
BasicBinder: TRACE
|
||||||
config: classpath:log/logback-dev.xml
|
config: classpath:log/logback-dev.xml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
xboe:
|
xboe:
|
||||||
api:
|
|
||||||
cross_filter: true
|
|
||||||
upload:
|
upload:
|
||||||
file:
|
file:
|
||||||
temp_path: /tmp
|
temp_path: E:/Projects/BOE/java/static/temp
|
||||||
save_path: /home/www/elearning/upload
|
save_path: E:/Projects/BOE/java/static/upload
|
||||||
http_path: http://192.168.0.253/upload
|
http_path: http://localhost:9090/upload
|
||||||
inner:
|
inner:
|
||||||
data:
|
data:
|
||||||
sync:
|
sync:
|
||||||
baseurl: http://127.0.0.1:9090
|
baseurl: http://localhost:9090
|
||||||
|
|
||||||
jasypt:
|
jasypt:
|
||||||
encryptor:
|
encryptor:
|
||||||
algorithm: PBEWithMD5AndDES
|
algorithm: PBEWithMD5AndDES
|
||||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
# application-pro.yml
|
# application-pro.yml
|
||||||
spring:
|
spring:
|
||||||
|
profiles:
|
||||||
|
active: pro
|
||||||
redis:
|
redis:
|
||||||
database: 1
|
database: 3
|
||||||
host: 10.251.88.213
|
host: 10.251.88.213
|
||||||
password: qwert!W588
|
password: qwert!W588
|
||||||
port: 6379
|
port: 6379
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# application.yml
|
# application.yml
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: @profileActive@
|
||||||
application:
|
application:
|
||||||
name: boe-server-basic
|
name: boe-server-basic
|
||||||
jackson:
|
jackson:
|
||||||
@@ -62,4 +62,4 @@ ok:
|
|||||||
|
|
||||||
# 设置logback.xml位置
|
# 设置logback.xml位置
|
||||||
logging:
|
logging:
|
||||||
config: classpath:log/logback-${spring.profiles.active}.xml
|
config: classpath:log/logback-@profileActive@.xml
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="false">
|
|
||||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
|
||||||
<property name="log.path" value="/home/logs/${spring.application.name}"/>
|
|
||||||
<!-- 彩色日志格式 -->
|
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
|
||||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
|
||||||
<!-- 彩色日志依赖的渲染类 -->
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
|
||||||
<conversionRule conversionWord="wex"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
|
||||||
<conversionRule conversionWord="wEx"
|
|
||||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
|
||||||
<!-- Console log output -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file debug output -->
|
|
||||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/debug.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Log file error output -->
|
|
||||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
|
||||||
<maxFileSize>50MB</maxFileSize>
|
|
||||||
<maxHistory>30</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<level>ERROR</level>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
|
||||||
<root level="WARN">
|
|
||||||
<appender-ref ref="debug"/>
|
|
||||||
<appender-ref ref="error"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
Reference in New Issue
Block a user