mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
Compare commits
142 Commits
dev250106-
...
20251024-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f5e8fe08d | ||
|
|
6fe6f7c6e5 | ||
|
|
249a8d81a6 | ||
|
|
7abb00772b | ||
|
|
04e11f2e71 | ||
|
|
2feb149e92 | ||
|
|
16fa9cb028 | ||
|
|
cac466ba73 | ||
|
|
30d2a0cde2 | ||
|
|
541e542d9b | ||
|
|
aa04e16209 | ||
|
|
57e22492e5 | ||
|
|
1917647a99 | ||
|
|
f5f7ab3bc5 | ||
|
|
413a2ebc33 | ||
|
|
22db916abf | ||
|
|
8ce284ea7e | ||
|
|
c485757061 | ||
|
|
9a00b41cde | ||
|
|
59beaa5b74 | ||
|
|
9b9e97a8d4 | ||
|
|
200ec38038 | ||
|
|
7613f30ca7 | ||
|
|
248e0799bd | ||
|
|
618b0b3f62 | ||
|
|
5836b147c4 | ||
|
|
fb1d11ebab | ||
|
|
add1d6abb2 | ||
|
|
eafe17b99a | ||
|
|
d1b6573c25 | ||
|
|
1039f80aec | ||
|
|
efc0605115 | ||
|
|
d938425151 | ||
|
|
00510562ca | ||
|
|
3e70e71e5a | ||
|
|
24011a4470 | ||
|
|
8948165296 | ||
|
|
076b1828ad | ||
|
|
95312696f6 | ||
|
|
1aca002b8f | ||
|
|
50bdc39ce8 | ||
|
|
4fff780970 | ||
|
|
47813ea565 | ||
|
|
5aa62de3cb | ||
|
|
a309bc1ddf | ||
|
|
6af4cdfc75 | ||
|
|
2a2759768b | ||
|
|
74bcec72bc | ||
|
|
b8c171bf86 | ||
|
|
175e7f6c28 | ||
|
|
5705bb8529 | ||
|
|
87e5dd81f8 | ||
|
|
9924769bc8 | ||
|
|
d4964ca7f1 | ||
|
|
efdfa6f00c | ||
|
|
ceb30f7f1d | ||
|
|
60d891edcf | ||
|
|
b9f00f2602 | ||
|
|
77884d3e7e | ||
|
|
3a9a8d86af | ||
|
|
3a139925c9 | ||
|
|
fdc0c7959e | ||
|
|
a1352ec813 | ||
|
|
c9db78ea94 | ||
|
|
f33de0c326 | ||
|
|
4be72391ad | ||
|
|
500fb090fb | ||
|
|
ee95435d01 | ||
|
|
76f0d1933a | ||
|
|
3d9b26982c | ||
|
|
a65fa797cc | ||
|
|
feba3237ab | ||
|
|
58d6f49006 | ||
|
|
c8ffdd561f | ||
|
|
98611edcaa | ||
|
|
8aea21bde7 | ||
|
|
a79f6b43b2 | ||
|
|
81ea19f0f3 | ||
|
|
2919fceef1 | ||
|
|
f7dcda551d | ||
|
|
cdf5d2a052 | ||
|
|
ba45fc53d9 | ||
|
|
5272e15449 | ||
|
|
d1fe0dc37f | ||
|
|
c886f05309 | ||
|
|
046886521d | ||
|
|
25e9043bea | ||
|
|
6d3a9955af | ||
|
|
2651d256a6 | ||
|
|
c3f58b25a2 | ||
|
|
87eeea4874 | ||
|
|
14d1a2e385 | ||
|
|
ee5df32588 | ||
|
|
3109b6faf7 | ||
|
|
d374c8213d | ||
|
|
799be39142 | ||
|
|
1f02bb419a | ||
|
|
412e8cd362 | ||
|
|
fc1515f018 | ||
|
|
b9ec978267 | ||
|
|
29229ba3ed | ||
|
|
1bc8c0ef01 | ||
|
|
8d94810c08 | ||
|
|
c0b80b6ee5 | ||
|
|
7345528c68 | ||
|
|
65b8deab27 | ||
|
|
be0386f2d1 | ||
|
|
e412f5b6eb | ||
|
|
255b854a08 | ||
|
|
3343474f33 | ||
|
|
cb8a333b4f | ||
|
|
09f64bdb08 | ||
|
|
b092cd3889 | ||
|
|
4ec4b861f7 | ||
|
|
ffe232eeb9 | ||
|
|
e54c8b457b | ||
|
|
f273e9df4a | ||
|
|
1a93ab8abd | ||
|
|
aab82de81b | ||
|
|
0b5b882a6c | ||
|
|
4205912db5 | ||
|
|
af6efd3151 | ||
|
|
c724080a3c | ||
|
|
aa63a6618f | ||
|
|
d3fcbaeab6 | ||
|
|
82bf84bbaa | ||
|
|
423b658e04 | ||
|
|
acc62c85e0 | ||
|
|
795966d944 | ||
|
|
ec00f55606 | ||
|
|
3f59552c2e | ||
|
|
e5c8dbabed | ||
|
|
e0d731e296 | ||
|
|
f5c26d02d1 | ||
|
|
a3aad61ac8 | ||
|
|
fc94e4aedd | ||
|
|
ae75aedff9 | ||
|
|
0e74f11615 | ||
|
|
3559553484 | ||
|
|
9faa8307ee | ||
|
|
1a6c8f8af9 | ||
|
|
f1b96c8af9 |
@@ -219,13 +219,13 @@
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>7.10.2</version> <!-- 请根据实际需求选择合适的版本 -->
|
||||
<version>7.9.0</version> <!-- 请根据实际需求选择合适的版本 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>7.10.2</version> <!-- 请根据实际需求选择合适的版本 -->
|
||||
<version>7.9.0</version> <!-- 请根据实际需求选择合适的版本 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -234,6 +234,12 @@
|
||||
<version>1.1.24</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.3.0</version> <!-- 请根据实际需求选择版本 -->
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -263,9 +269,9 @@
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>pro</id>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<profileActive>pro</profileActive>
|
||||
<profileActive>prod</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.xboe;
|
||||
|
||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class XxlJobConfig {
|
||||
|
||||
@Value("${xxl.job.admin.addresses}")
|
||||
private String adminAddresses;
|
||||
@Value("${xxl.job.executor.appname}")
|
||||
private String appName;
|
||||
@Value("${xxl.job.executor.ip}")
|
||||
private String ip;
|
||||
@Value("${xxl.job.executor.port}")
|
||||
private int port;
|
||||
@Value("${xxl.job.accessToken}")
|
||||
private String accessToken;
|
||||
@Value("${xxl.job.executor.logpath}")
|
||||
private String logPath;
|
||||
@Value("${xxl.job.executor.logretentiondays}")
|
||||
private int logRetentionDays;
|
||||
|
||||
@Bean
|
||||
public XxlJobSpringExecutor xxlJobExecutor() {
|
||||
// 创建 XxlJobSpringExecutor 执行器
|
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
||||
xxlJobSpringExecutor.setAppname(appName);
|
||||
xxlJobSpringExecutor.setIp(ip);
|
||||
xxlJobSpringExecutor.setPort(port);
|
||||
xxlJobSpringExecutor.setAccessToken(accessToken);
|
||||
xxlJobSpringExecutor.setLogPath(logPath);
|
||||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
|
||||
// 返回
|
||||
return xxlJobSpringExecutor;
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,11 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.boe.feign.api.courseweb.entity.ExamTestDto;
|
||||
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.ProjectAdminRemoteClient;
|
||||
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.Dict;
|
||||
import com.boe.feign.api.infrastructure.remote.DictRemoteClient;
|
||||
@@ -22,6 +24,8 @@ import com.boe.feign.api.usercenter.reps.AudienceMemberVo;
|
||||
import com.boe.feign.api.usercenter.reps.Response;
|
||||
import com.xboe.api.infrastructure.res.InfraResult;
|
||||
import com.xboe.api.vo.*;
|
||||
import com.xboe.module.course.dto.CourseParam;
|
||||
import com.xboe.module.course.dto.ScoreParam;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.core.JsonResponse;
|
||||
@@ -41,10 +45,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
@@ -71,6 +72,8 @@ public class ThirdApi {
|
||||
|
||||
@Resource
|
||||
private ProjectRemoteClient projectRemoteClient;
|
||||
@Resource
|
||||
ExternalRemoteClient externalRemoteClient;
|
||||
|
||||
@Resource
|
||||
private DictRemoteClient dictRemoteClient;
|
||||
@@ -84,6 +87,17 @@ public class ThirdApi {
|
||||
@Resource
|
||||
private UserDynamicApiRemoteClient userDynamicApiRemoteClient;
|
||||
|
||||
@Value("${coursesuilt.updateOrSaveCourse}")
|
||||
private String updateOrSaveCourse;
|
||||
@Value("${coursesuilt.syncCourseStudent}")
|
||||
private String syncCourseStudent;
|
||||
@Value("${coursesuilt.syncOnLineScore}")
|
||||
private String syncOnLineScore;
|
||||
@Value("${coursesuilt.updateOnLineStatua}")
|
||||
private String updateOnLineStatua;
|
||||
@Value("${coursesuilt.delOnLineById}")
|
||||
private String delOnLineById;
|
||||
|
||||
//获取例外人员的id
|
||||
public List<String> getUserId() {
|
||||
CommonSearchVo searcher = new CommonSearchVo();
|
||||
@@ -250,11 +264,19 @@ public class ThirdApi {
|
||||
}
|
||||
|
||||
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.setStudyId(studyId);
|
||||
studyCourseVo.setCourseId(courseId);
|
||||
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);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@@ -343,4 +365,59 @@ public class ThirdApi {
|
||||
return basicInfos;
|
||||
|
||||
}
|
||||
|
||||
public void updateOrSaveCourse(CourseParam param, String token){
|
||||
log.info("---------------准备同步在线课到讲师管理完毕 ------- param " + param);
|
||||
String resp = Optional.ofNullable(
|
||||
HttpRequest.post(updateOrSaveCourse).body(JSONUtil.toJsonStr(param)).header("token", token).execute()
|
||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
log.info("updateOrSaveCourse = " + resp);
|
||||
}
|
||||
public void syncCourseStudent(Long courseId, String token){
|
||||
String resp = Optional.ofNullable(
|
||||
HttpRequest.post(syncCourseStudent).body(JSONUtil.toJsonStr(courseId)).header("token", token).execute()
|
||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
log.info("syncCourseStudent = " + resp);
|
||||
}
|
||||
|
||||
public void syncOnLineScore(ScoreParam param, String token) {
|
||||
String resp = Optional.ofNullable(
|
||||
HttpRequest.post(syncOnLineScore).body(JSONUtil.toJsonStr(param)).header("token", token).execute()
|
||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
log.info("syncOnLineScore = " + resp);
|
||||
}
|
||||
public void updateOnLineStatua(CourseParam param, String token){
|
||||
String resp = Optional.ofNullable(
|
||||
HttpRequest.post(updateOnLineStatua).body(JSONUtil.toJsonStr(param)).header("token", token).execute()
|
||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
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);
|
||||
}
|
||||
|
||||
//获取字典信息
|
||||
public List<Dict> getDictItems(CommonSearchVo searcher) {
|
||||
try {
|
||||
List<Dict> dictList = dictRemoteClient.getList(searcher);
|
||||
if(!Objects.isNull(dictList) && dictList.size() > 0){
|
||||
// List<String> dicts = dictList.stream().map(Dict::getValue).collect(Collectors.toList());
|
||||
return dictList;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("-------获取字典信息 = " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.xboe.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
@@ -8,9 +7,11 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.cbor.MappingJackson2CborHttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.List;
|
||||
@@ -20,6 +21,15 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(WebConfig.class);
|
||||
|
||||
@Override
|
||||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||
configurer.favorParameter(true)
|
||||
.defaultContentType(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML)
|
||||
.parameterName("mediaType")
|
||||
.mediaType("json", MediaType.APPLICATION_JSON)
|
||||
.mediaType("xml", MediaType.APPLICATION_XML);
|
||||
}
|
||||
|
||||
//结果处理器
|
||||
@Bean
|
||||
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(ObjectMapper objectMapper) {
|
||||
@@ -30,9 +40,10 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
public ObjectMapper objectMapper() {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY,true);
|
||||
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
|
||||
return mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在默认的消息转换器基础上添加或移除某些转换器
|
||||
* 保证StringHttpMessageConverter在FastJsonHttpMessageConverter前被调用
|
||||
|
||||
@@ -122,13 +122,20 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
//这里应该是单独的线程去处理
|
||||
user.setId(getNodeText(result.get("userId")));//最新接口变化,id改成userId
|
||||
String band=getNodeText(result.get("bandCode"));
|
||||
if(StringUtils.isNotBlank(band) && band.length()>4) {
|
||||
String bandNum=band.substring(4);
|
||||
user.setBandLevel(Integer.valueOf(bandNum));
|
||||
}else {
|
||||
user.setBandLevel(0);
|
||||
}
|
||||
user.setAvatar(getNodeText(result.get("avatar")));
|
||||
try {
|
||||
if(StringUtils.isNotBlank(band) && band.length()>4 && band.contains("band")) {
|
||||
String bandNum=band.substring(4);
|
||||
user.setBandLevel(Integer.valueOf(bandNum));
|
||||
}else if (StringUtils.isNotBlank(band) && band.length()>4 && band.contains("Level")) {
|
||||
String bandNum=band.substring(5);
|
||||
user.setBandLevel(Integer.valueOf(bandNum));
|
||||
}else {
|
||||
user.setBandLevel(0);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
user.setBandLevel(0);
|
||||
}
|
||||
user.setAvatar(getNodeText(result.get("avatar")));
|
||||
user.setCode(getNodeText(result.get("userNo")));
|
||||
|
||||
if(StringUtils.isBlank(user.getCode())) {
|
||||
|
||||
@@ -2,11 +2,16 @@ package com.xboe.data.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.boe.feign.api.serverall.entity.UserData;
|
||||
import com.xboe.constants.CacheName;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.Retryable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -39,6 +44,9 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
|
||||
@Autowired
|
||||
TeacherDao teacherDao;
|
||||
|
||||
@Resource
|
||||
private CacheManager cacheManager;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -59,6 +67,8 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
|
||||
a.setDeleted(user.getDeleted());
|
||||
}
|
||||
a.setLoginName(user.getCode());
|
||||
a.setMobile(user.getMobile());
|
||||
a.setEmail(user.getEmail());
|
||||
log.info("更新账号code");
|
||||
accountDao.update(a);
|
||||
} else {
|
||||
@@ -71,14 +81,18 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
|
||||
a.setRegTime(LocalDateTime.now());
|
||||
a.setSysId(user.getKid());
|
||||
a.setStatus(1);
|
||||
a.setMobile(user.getMobile());
|
||||
a.setEmail(user.getEmail());
|
||||
accountDao.save(a);
|
||||
log.info("账号不存在,新添加账号【" + user.getId() + "】");
|
||||
}
|
||||
|
||||
if (u != null) {
|
||||
//更新部分用户字段
|
||||
u.setDepartId(user.getDepartId());
|
||||
u.setDepartName(user.getDepartName());
|
||||
u.setName(user.getName());
|
||||
u.setMobileNo(user.getMobile());
|
||||
//2022-12-8 去掉用户类型的更新,因为返回的数据都是学员,
|
||||
//u.setUserType(user.getUserType());
|
||||
if (user.getLearningDuration() > 0) { //不大于0才会更新
|
||||
@@ -106,9 +120,17 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
|
||||
} else {
|
||||
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
||||
}
|
||||
u.setMobileNo(user.getMobile());
|
||||
userDao.save(u);
|
||||
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())) {
|
||||
org = orgDao.get(user.getDepartId());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xboe.module.boecase.api;
|
||||
|
||||
import com.xboe.module.boecase.service.ICasesService;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -16,6 +17,7 @@ public class CaseScheduledTasks {
|
||||
* 每月的第一天的1:00执行
|
||||
*/
|
||||
// @Scheduled(cron = "0 0 1 1 * ?")
|
||||
@XxlJob("refreshViewsRankOfMajor")
|
||||
public void refreshViewsRankOfMajor() {
|
||||
casesService.refreshViewsRankOfMajor();
|
||||
}
|
||||
@@ -23,7 +25,8 @@ public class CaseScheduledTasks {
|
||||
/**
|
||||
* 季初第一天两点执行,cron表达式设置为每个季度的第一个月的第一天的特定时间。每个季度的第一个月是1月、4月、7月和10月:
|
||||
*/
|
||||
@Scheduled(cron = "0 0 2 1 1,4,7,10 ?")
|
||||
// @Scheduled(cron = "0 0 2 1 1,4,7,10 ?")
|
||||
@XxlJob("refreshLastQuarterStatistics")
|
||||
public void refreshLastQuarterStatistics() {
|
||||
casesService.refreshLastQuarterStatistics();
|
||||
}
|
||||
|
||||
@@ -140,6 +140,9 @@ public class CasesApi extends ApiBaseController {
|
||||
List<Cases> cases = views.getList();
|
||||
if (CollUtil.isNotEmpty(cases)) {
|
||||
for (Cases c : cases) {
|
||||
if ("null".equals(c.getSummary())) {
|
||||
c.setSummary(null);
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
List<CasesMajorType> caseId = casesMajorTypeDao.findList(FieldFilters.eq("caseId", c.getId()));
|
||||
if (caseId != null && !caseId.isEmpty()) {
|
||||
|
||||
@@ -5,7 +5,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.module.course.dto.CourseParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -55,7 +58,10 @@ public class CourseAuditApi extends ApiBaseController{
|
||||
|
||||
@Resource
|
||||
private ICourseContentService ccontentService;
|
||||
|
||||
@Resource
|
||||
private ThirdApi thirdApi;
|
||||
|
||||
|
||||
/**
|
||||
* 教师需要审核的课程
|
||||
* @param pager
|
||||
@@ -315,7 +321,7 @@ public class CourseAuditApi extends ApiBaseController{
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/hrbp-submit-audit")
|
||||
public JsonResponse<Boolean> hrbpAudit(String auditId,String courseId,String title,Boolean pass,String remark){
|
||||
public JsonResponse<Boolean> hrbpAudit(String auditId,String courseId,String title,Boolean pass,String remark, HttpServletRequest request){
|
||||
if(StringUtils.isBlank(auditId)){
|
||||
return badRequest("参数错误");
|
||||
}
|
||||
@@ -347,6 +353,14 @@ public class CourseAuditApi extends ApiBaseController{
|
||||
try {
|
||||
CurrentUser cu=getCurrent();
|
||||
service.hrbpSubmitAudit(auditId, courseId,open, pass,cu.getAccountId(),cu.getName(), remark);
|
||||
|
||||
if (pass){
|
||||
//修改在线课开课状态=已开课
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
CourseParam param = new CourseParam();
|
||||
param.setId(courseId);
|
||||
thirdApi.updateOnLineStatua(param,token);
|
||||
}
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("HRBP审核提交处理错误",e);
|
||||
@@ -378,7 +392,8 @@ public class CourseAuditApi extends ApiBaseController{
|
||||
*/
|
||||
@PostMapping("/submit-publish")
|
||||
@AutoLog(module = "课程",action = "默认管理员提交发布",info = "")
|
||||
public JsonResponse<Boolean> submitAndPublish(@RequestBody CourseFullDto dto){
|
||||
public JsonResponse<Boolean> submitAndPublish(@RequestBody CourseFullDto dto, HttpServletRequest request){
|
||||
log.info("---------------提交并直接发布,用于默认管理直接操作 -------");
|
||||
if(dto.getCourse()==null){
|
||||
return badRequest("无课程信息");
|
||||
}
|
||||
@@ -402,12 +417,22 @@ public class CourseAuditApi extends ApiBaseController{
|
||||
if(StringUtils.isBlank(dto.getCourse().getOrgId())) {
|
||||
return badRequest("请选择资源归属");
|
||||
}
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
|
||||
CurrentUser cuser=getCurrent();
|
||||
dto.getCourse().setStatus(Course.STATUS_AUDIT_FINISH);//设置为审核通过状态
|
||||
dto.getCourse().setEnabled(true);//设置启用状态问题
|
||||
dto.getCourse().setPublished(false);//重新提交审核设置为未发布状态
|
||||
try {
|
||||
|
||||
courseService.submitAndPublish(dto,cuser.getAccountId(),cuser.getName());
|
||||
log.info("---------------在线课开始同步到讲师管理 ------- token = " + token);
|
||||
CourseParam param = new CourseParam();
|
||||
param.setId(dto.getCourse().getId());
|
||||
param.setOrgId(dto.getCourse().getOrgId());
|
||||
param.setOrgName(dto.getCourse().getOrgName());
|
||||
thirdApi.updateOrSaveCourse(param,token);
|
||||
log.info("---------------在线课同步到讲师管理完毕 -------");
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("默认管理员提交直接发布处理失败",e);
|
||||
|
||||
@@ -2,11 +2,16 @@
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.boe.feign.api.infrastructure.entity.CommonSearchVo;
|
||||
import com.boe.feign.api.infrastructure.entity.Dict;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.module.course.dto.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -26,11 +31,6 @@ import com.xboe.data.dto.UserOrgIds;
|
||||
import com.xboe.data.outside.IOutSideDataService;
|
||||
import com.xboe.data.service.IDataUserSyncService;
|
||||
import com.xboe.module.assistance.service.IEmailService;
|
||||
import com.xboe.module.course.dto.CourseExportDto;
|
||||
import com.xboe.module.course.dto.CourseFullDto;
|
||||
import com.xboe.module.course.dto.CourseQueryDto;
|
||||
import com.xboe.module.course.dto.CourseTeacherAndCourse;
|
||||
import com.xboe.module.course.dto.CourseTeacherExportDto;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseContent;
|
||||
import com.xboe.module.course.entity.CourseCrowd;
|
||||
@@ -100,7 +100,8 @@ public class CourseManageApi extends ApiBaseController{
|
||||
|
||||
@Autowired
|
||||
IDataUserSyncService userSyncService;
|
||||
|
||||
@Resource
|
||||
private ThirdApi thirdApi;
|
||||
|
||||
// @PostMapping("/test")
|
||||
// public JsonResponse<PageList<Course>> findTest(Pagination pager,CourseQueryDto dto){
|
||||
@@ -171,19 +172,48 @@ public class CourseManageApi extends ApiBaseController{
|
||||
List<CourseSection> sectionlist=sectionService.getByCourseId(id);
|
||||
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(id);
|
||||
List<CourseCrowd> crowds=courseService.findCrowdByCourseId(id);
|
||||
|
||||
//
|
||||
|
||||
CommonSearchVo searcher = new CommonSearchVo();
|
||||
searcher.setPid(637L);
|
||||
searcher.setType(1);
|
||||
List<Dict> dictList = thirdApi.getDictItems(searcher);
|
||||
boolean isPermission = false;
|
||||
if(dictList != null && dictList.size() > 0){
|
||||
List<String> dicts = dictList.stream().map(Dict::getValue).collect(Collectors.toList());
|
||||
isPermission = dicts.contains(course.getOrgId());
|
||||
rs.put("dicts",dicts);
|
||||
}
|
||||
log.error("-------是否仅内网查看 = " + isPermission);
|
||||
rs.put("course",course);
|
||||
rs.put("contents",cclist);
|
||||
rs.put("sections",sectionlist);
|
||||
rs.put("teachers",teachers);
|
||||
rs.put("crowds",crowds);
|
||||
|
||||
rs.put("isPermission",isPermission);
|
||||
|
||||
|
||||
|
||||
return success(rs);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/getDictIds")
|
||||
public JsonResponse<Map<String,Object>> getDictIds(Long pid,Integer type){
|
||||
CommonSearchVo searcher = new CommonSearchVo();
|
||||
if(pid==null || type ==null){
|
||||
return badRequest("参数错误");
|
||||
}
|
||||
Map<String,Object> rs=new HashMap<String,Object>();
|
||||
searcher.setPid(pid);
|
||||
searcher.setType(type);
|
||||
List<Dict> dictList = thirdApi.getDictItems(searcher);
|
||||
rs.put("dicts",null);
|
||||
if(dictList != null && dictList.size() > 0){
|
||||
List<String> dicts = dictList.stream().map(Dict::getValue).collect(Collectors.toList());
|
||||
rs.put("dicts",dicts);
|
||||
}
|
||||
return success(rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员审核列表,教师的审核不在这里,此审核也应该移动CourseAuditApi中去
|
||||
* @param pager
|
||||
@@ -271,7 +301,7 @@ public class CourseManageApi extends ApiBaseController{
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@AutoLog(module = "课程",action = "保存课程基本信息",info = "")
|
||||
public JsonResponse<CourseFullDto> saveCourseFull(@RequestBody CourseFullDto dto){
|
||||
public JsonResponse<CourseFullDto> saveCourseFull(@RequestBody CourseFullDto dto, HttpServletRequest request){
|
||||
if(dto.getCourse()==null){
|
||||
return badRequest("无课程信息");
|
||||
}
|
||||
@@ -302,7 +332,14 @@ public class CourseManageApi extends ApiBaseController{
|
||||
dto.getCourse().setStatus(Course.STATUS_NONE);
|
||||
courseService.update(dto);
|
||||
}
|
||||
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
log.info("---------------在线课开始同步到讲师管理 ------- token = " + token);
|
||||
CourseParam param = new CourseParam();
|
||||
param.setId(dto.getCourse().getId());
|
||||
param.setOrgId(dto.getCourse().getOrgId());
|
||||
param.setOrgName(dto.getCourse().getOrgName());
|
||||
thirdApi.updateOrSaveCourse(param,token);
|
||||
log.info("---------------在线课同步到讲师管理完毕 -------");
|
||||
return success(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("整体保存课程信息错误",e);
|
||||
@@ -881,7 +918,7 @@ public class CourseManageApi extends ApiBaseController{
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public JsonResponse<Boolean> delete(String id,Boolean erasable,String title,String remark){
|
||||
public JsonResponse<Boolean> delete(String id,Boolean erasable,String title,String remark, HttpServletRequest request){
|
||||
if(StringUtils.isBlank(id)){
|
||||
return badRequest("参数错误");
|
||||
}
|
||||
@@ -896,6 +933,11 @@ public class CourseManageApi extends ApiBaseController{
|
||||
try {
|
||||
CurrentUser cu=getCurrent();
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
log.error("管理员删除课程错误",e);
|
||||
|
||||
@@ -314,8 +314,10 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
User user = userService.get(ct.getTeacherId());
|
||||
if(t!=null) {
|
||||
ct.setRemark(t.getDescription());
|
||||
ct.setSupplier(t.getSupplier());
|
||||
ct.setTeacherType(t.getTeacherType());
|
||||
if(redisTemplate.opsForValue().get(ct.getTeacherId())!=null){
|
||||
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1") && ( t==null || t.getTeacherType() == 1)){
|
||||
ct.setTeacherName("BOE教师");
|
||||
}
|
||||
teacherCourseDto.setCourseId(ct.getCourseId());
|
||||
@@ -327,13 +329,15 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
|
||||
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
|
||||
teacherCourseDto.setId(ct.getId());
|
||||
teacherCourseDto.setUserNo(user.getUserNo());
|
||||
if(user!=null){
|
||||
teacherCourseDto.setUserNo(user.getUserNo());
|
||||
}
|
||||
teacherCourseDtos.add(teacherCourseDto);
|
||||
}else if (redisTemplate.opsForValue().get(ct.getTeacherId())==null){
|
||||
List<String> list=new ArrayList<>();
|
||||
list.add(ct.getTeacherId());
|
||||
getTeacherInfo(request.getHeader("Xboe-Access-Token"),list);
|
||||
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1") && ( t==null || t.getTeacherType() == 1)){
|
||||
ct.setTeacherName("BOE教师");
|
||||
}
|
||||
teacherCourseDto.setCourseId(ct.getCourseId());
|
||||
@@ -345,7 +349,9 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
|
||||
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
|
||||
teacherCourseDto.setId(ct.getId());
|
||||
teacherCourseDto.setUserNo(user.getUserNo());
|
||||
if(user!=null){
|
||||
teacherCourseDto.setUserNo(user.getUserNo());
|
||||
}
|
||||
teacherCourseDtos.add(teacherCourseDto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.xboe.module.course.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CourseParam {
|
||||
private String id;
|
||||
private String orgId;
|
||||
private String orgName;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.xboe.module.course.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ScoreParam {
|
||||
private Long courseId;
|
||||
private Float score;
|
||||
}
|
||||
@@ -33,7 +33,10 @@ public class Course extends BaseEntity {
|
||||
|
||||
/**所有的设备*/
|
||||
public static int DEVICE_ALL=3;
|
||||
|
||||
|
||||
/**仅内网*/
|
||||
public static int DEVICE_INTERNAL=4;
|
||||
|
||||
/**未提交,草稿*/
|
||||
public static final int STATUS_NONE=1;
|
||||
|
||||
|
||||
@@ -49,4 +49,12 @@ public class CourseTeacher extends IdBaseEntity {
|
||||
@Transient
|
||||
private String code;
|
||||
|
||||
/**供应商*/
|
||||
@Transient
|
||||
private String supplier;
|
||||
|
||||
/**讲师类型 1 内部讲师 2外部讲师*/
|
||||
@Transient
|
||||
private Integer teacherType;
|
||||
|
||||
}
|
||||
|
||||
@@ -341,8 +341,6 @@ public interface ICourseService {
|
||||
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
List<Course> findByIds(List<String> courseIds);
|
||||
void deletedStudyResourceBatchByCourseIdAndType(String courseId,Integer courseType);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xboe.module.course.service.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -14,11 +15,17 @@ import java.util.stream.Stream;
|
||||
import javax.annotation.Resource;
|
||||
import javax.management.Query;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.core.orm.*;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
@@ -115,6 +122,9 @@ public class CourseServiceImpl implements ICourseService {
|
||||
@Autowired(required = false)
|
||||
private IEventDataSender eventSender;
|
||||
|
||||
@Resource
|
||||
RestHighLevelClient restHighLevelClient;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -173,6 +183,8 @@ public class CourseServiceImpl implements ICourseService {
|
||||
filters.add(FieldFilters.in("device", Course.DEVICE_MOBILE, Course.DEVICE_ALL));
|
||||
} else if (dto.getDevice() == Course.DEVICE_ALL) {
|
||||
filters.add(FieldFilters.eq("device", Course.DEVICE_ALL));
|
||||
}else if (dto.getDevice() == Course.DEVICE_INTERNAL) {
|
||||
filters.add(FieldFilters.eq("device", Course.DEVICE_INTERNAL));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -448,6 +460,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
List<Course> paginate = paginate(listByFilters2, pageIndex, pageSize);
|
||||
PageList<Course> rs = new PageList<>();
|
||||
rs.setCount(listByFilters2.size());
|
||||
rs.setPageSize(pageSize);
|
||||
rs.setList(paginate);
|
||||
return rs;
|
||||
}
|
||||
@@ -853,12 +866,14 @@ public class CourseServiceImpl implements ICourseService {
|
||||
log.error("未配置事件消息发送的实现");
|
||||
}
|
||||
}
|
||||
|
||||
// 删除ES数据
|
||||
deletedStudyResourceBatchByCourseIdAndType(id,c.getType());
|
||||
} else {
|
||||
//彻底删除,课件设置为无课程状态
|
||||
courseDao.setDeleted(id);
|
||||
}
|
||||
//记录删除日志信息
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1567,6 +1582,13 @@ public class CourseServiceImpl implements ICourseService {
|
||||
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
|
||||
public int countWaitAudit(String aid) {
|
||||
@@ -1978,5 +2000,17 @@ public class CourseServiceImpl implements ICourseService {
|
||||
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,6 +8,8 @@ import java.util.Map;
|
||||
|
||||
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.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -37,7 +39,10 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
||||
|
||||
@Resource
|
||||
AloneExamDao aeDao;
|
||||
|
||||
@Resource
|
||||
private ThirdApi thirdApi;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(AloneExamAnswer aea){
|
||||
@@ -101,7 +106,18 @@ 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
|
||||
@Transactional
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.xboe.module.interaction.api;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.module.course.dto.ScoreParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -25,18 +28,27 @@ public class CourseGradeApi extends ApiBaseController {
|
||||
|
||||
@Resource
|
||||
private ICourseGradeService service;
|
||||
@Resource
|
||||
private ThirdApi thirdApi;
|
||||
|
||||
/**
|
||||
* 评分
|
||||
* */
|
||||
@PostMapping("/grade")
|
||||
@AutoLog(module = "评分",action = "评分")
|
||||
public JsonResponse<Float> grade(String courseId,Float score,String studyId){
|
||||
public JsonResponse<Float> grade(String courseId,Float score,String studyId, HttpServletRequest request){
|
||||
CourseGrade courseGrade = new CourseGrade();
|
||||
courseGrade.setCourseId(courseId);
|
||||
courseGrade.setScores(score);
|
||||
courseGrade.setStudyId(studyId);
|
||||
try {
|
||||
Float aFloat = service.save(courseGrade);
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
ScoreParam param = new ScoreParam();
|
||||
param.setCourseId(Long.parseLong(courseId));
|
||||
param.setScore(score);
|
||||
// 同步在线课评分
|
||||
// thirdApi.syncOnLineScore(param,token);
|
||||
return success(aFloat);
|
||||
}catch(Exception e) {
|
||||
log.error("评分保存错误",e);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xboe.module.popup.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import lombok.Data;
|
||||
@@ -24,12 +25,14 @@ public class Popup extends IdEntity {
|
||||
* 开始时间
|
||||
* */
|
||||
@Column(name = "start_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
* */
|
||||
@Column(name = "end_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.xboe.module.teacher.entity;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -153,7 +155,7 @@ public class Teacher extends BaseEntity {
|
||||
*/
|
||||
@Column(name = "courses")
|
||||
private String courses;
|
||||
|
||||
|
||||
/**
|
||||
* 发薪地id
|
||||
*/
|
||||
@@ -206,4 +208,56 @@ public class Teacher extends BaseEntity {
|
||||
@Column(name = "expertise")
|
||||
private String expertise;
|
||||
|
||||
@Column(name = "user_no",length = 1)
|
||||
private String userNo;
|
||||
|
||||
// @ApiModelProperty(value = "讲师类型 1 内部讲师 2外部讲师")
|
||||
@Column(name = "teacher_type")
|
||||
private Integer teacherType;
|
||||
|
||||
// @ApiModelProperty(value = "默认授课时长(分钟)")
|
||||
@Column(name = "default_teaching_time")
|
||||
private Integer defaultTeachingTime;
|
||||
|
||||
// @ApiModelProperty(value = "认证人")
|
||||
@Column(name = "certify_by")
|
||||
private String certifyBy;
|
||||
|
||||
// @ApiModelProperty(value = "认证时间")
|
||||
@Column(name = "certify_at")
|
||||
private LocalDateTime certifyAt;
|
||||
|
||||
// @ApiModelProperty(value = "认证资料路径")
|
||||
@Column(name = "certification")
|
||||
private String certification;
|
||||
|
||||
// @ApiModelProperty(value = "认证资料路径名称")
|
||||
@Column(name = "certification_name")
|
||||
private String certificationName;
|
||||
|
||||
// @ApiModelProperty(value = "供应商")
|
||||
@Column(name = "supplier")
|
||||
private String supplier;
|
||||
|
||||
|
||||
// @ApiModelProperty(value = "教师专长名称 逗号分割")
|
||||
@Column(name = "expertise_names")
|
||||
private String expertiseNames;
|
||||
|
||||
// @ApiModelProperty(value = "标识 0:自动录入/1:手动录入")
|
||||
@Column(name = "create_from")
|
||||
private Integer createFrom;
|
||||
|
||||
// @ApiModelProperty(value = "组织id")
|
||||
@Column(name = "org_id")
|
||||
private Long orgId;
|
||||
|
||||
// @ApiModelProperty(value = "组织名称")
|
||||
@Column(name = "org_name")
|
||||
private String orgName;
|
||||
|
||||
// @ApiModelProperty(value = "旧系统kid字段")
|
||||
@Column(name = "kid")
|
||||
private String kid;
|
||||
|
||||
}
|
||||
|
||||
@@ -102,9 +102,12 @@ public class TeacherServiceImpl implements ITeacherService {
|
||||
public List<Teacher> findByName(String name) {
|
||||
String hql="Select t.id,t.name,u.userNo from "+Teacher.class.getSimpleName()+" t,"+User.class.getSimpleName()+" u ";
|
||||
hql+=" where t.id=u.id and (t.name like '%"+name+"%' or u.userNo=?1)";
|
||||
// String hql="Select t.id,t.name,t.userNo from "+Teacher.class.getSimpleName()+" t";
|
||||
// hql+=" where t.deleted =0 and t.status =1 and (t.name like '%"+name+"%' or t.userNo like '%"+name+"%' )";
|
||||
|
||||
List<Teacher> teachers=new ArrayList<Teacher>();
|
||||
try {
|
||||
List<Object[]> list =dao.findListFields(hql,name);
|
||||
List<Object[]> list =dao.findListFields(hql);
|
||||
for(Object[] objs :list) {
|
||||
Teacher t=new Teacher();
|
||||
t.setId((String)objs[0]);
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
package com.xboe.school.study.api;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xboe.module.course.dto.CourseStudyDto;
|
||||
import com.xboe.school.study.dao.PhpOnlineCourseDao;
|
||||
import com.xboe.school.study.dto.PhpOnlineDto;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class PhpOnlineStudyRecordScheduledTasks {
|
||||
|
||||
@Resource
|
||||
private PhpOnlineCourseDao phpOnlineCourseDao;
|
||||
|
||||
@Resource
|
||||
RestHighLevelClient restHighLevelClient;
|
||||
|
||||
// todo 定时、分批、数据库名
|
||||
@XxlJob("phpOnlineStudyRecordSyncEsTask")
|
||||
public List<String> phpOnlineStudyRecordSyncEs(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
||||
|
||||
log.info("开始同步PHP学习记录到ES");
|
||||
// 增量获取PHP中所有已完成的课程
|
||||
if (syncTimePointOfBegin == null || syncTimePointOfEnd == null) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime halfAnHourAgo = now.minusMinutes(30);
|
||||
syncTimePointOfBegin = halfAnHourAgo.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
|
||||
syncTimePointOfEnd = now.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
log.info("同步时间起点:{}", formatter.format(halfAnHourAgo));
|
||||
log.info("同步时间终点:{}", formatter.format(now));
|
||||
}
|
||||
|
||||
int pageSize = 1000;
|
||||
int totalRecordsCount = phpOnlineCourseDao.selectRecentLearnRecordListOfCount(syncTimePointOfBegin, syncTimePointOfEnd); // 总记录数
|
||||
|
||||
int totalPages = (int) Math.ceil((double) totalRecordsCount / pageSize);
|
||||
|
||||
ArrayList<String> tempResultList = new ArrayList<>();
|
||||
|
||||
for (int pageNumber = 1; pageNumber <= totalPages; pageNumber++) {
|
||||
int offset = (pageNumber - 1) * pageSize;
|
||||
List<PhpOnlineDto> pageData = phpOnlineCourseDao.selectRecentLearnRecordList(syncTimePointOfBegin, syncTimePointOfEnd, offset, pageSize);
|
||||
ArrayList<String> singleResultList = esDataHandle(isOnlyRead, pageData);
|
||||
tempResultList.addAll(singleResultList);
|
||||
}
|
||||
|
||||
return tempResultList;
|
||||
}
|
||||
|
||||
|
||||
private ArrayList<String> esDataHandle(Integer isOnlyRead, List<PhpOnlineDto> recentLearnRecordList) throws IOException {
|
||||
ArrayList<String> tempResultList = new ArrayList<>();
|
||||
// 将数据分批,每批50条
|
||||
int batchSize = 50;
|
||||
int totalSize = recentLearnRecordList.size();
|
||||
List<List<PhpOnlineDto>> batches = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < totalSize; i += batchSize) {
|
||||
int end = Math.min(i + batchSize, totalSize);
|
||||
batches.add(recentLearnRecordList.subList(i, end));
|
||||
}
|
||||
|
||||
for (List<PhpOnlineDto> batch : batches) {
|
||||
// 构建映射关系
|
||||
Map<String, PhpOnlineDto> map = batch.stream()
|
||||
.collect(Collectors.toMap(
|
||||
phpOnlineDto -> phpOnlineDto.getUserIdOfJava() + "-" + phpOnlineDto.getCourseId(),
|
||||
phpOnlineDto -> phpOnlineDto
|
||||
));
|
||||
|
||||
// 获取ES中的数据
|
||||
List<CourseStudyDto> esDataList = getEsData(batch);
|
||||
|
||||
|
||||
// 更新ES数据
|
||||
List<CourseStudyDto> toBeUpdatedEs = esDataList.stream()
|
||||
.map(esDataItem -> {
|
||||
String key = esDataItem.getAccountId() + "-" + esDataItem.getCourseId();
|
||||
PhpOnlineDto phpOnlineDto = map.get(key);
|
||||
|
||||
// 如果找到相应的 PhpOnlineDto 且进度有变化,则进行更新
|
||||
if (phpOnlineDto != null && !esDataItem.getProgress().equals(phpOnlineDto.getProgress())) {
|
||||
esDataItem.setProgress(phpOnlineDto.getProgress());
|
||||
if (phpOnlineDto.getProgress() == 100) {
|
||||
esDataItem.setStatus(9); // 完成
|
||||
} else {
|
||||
esDataItem.setStatus(2); // 进行中
|
||||
}
|
||||
return esDataItem;
|
||||
}
|
||||
return null; // 返回 null 表示不需要更新
|
||||
})
|
||||
.filter(Objects::nonNull) // 去掉返回为 null 的项
|
||||
.collect(Collectors.toList());
|
||||
|
||||
tempResultList.addAll(toBeUpdatedEs.stream().map(esDataItem -> esDataItem.getId()).collect(Collectors.toList()));
|
||||
|
||||
if (isOnlyRead != null && isOnlyRead == 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 调用批量更新方法
|
||||
// toBeUpdatedEs(toBeUpdatedEs, indexName);
|
||||
}
|
||||
return tempResultList;
|
||||
}
|
||||
|
||||
private List<CourseStudyDto> getEsData(List<PhpOnlineDto> finishedCourseList) throws IOException {
|
||||
SearchRequest searchRequest = new SearchRequest("new_study_resource");
|
||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
|
||||
for (PhpOnlineDto phpOnlineDto : finishedCourseList) {
|
||||
if (StringUtils.isBlank(phpOnlineDto.getUserIdOfJava()) || StringUtils.isBlank(phpOnlineDto.getCourseId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolQuery.should(QueryBuilders.boolQuery()
|
||||
.must(QueryBuilders.termQuery("courseId.keyword", phpOnlineDto.getCourseId()))
|
||||
.must(QueryBuilders.termQuery("accountId.keyword", phpOnlineDto.getUserIdOfJava()))
|
||||
.mustNot(QueryBuilders.termQuery("status", 9))
|
||||
);
|
||||
}
|
||||
|
||||
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder().query(boolQuery).timeout(new TimeValue(60, TimeUnit.SECONDS));
|
||||
searchRequest.source(sourceBuilder);
|
||||
if (boolQuery.hasClauses()) {
|
||||
sourceBuilder.query(boolQuery);
|
||||
}
|
||||
searchRequest.source(sourceBuilder);
|
||||
|
||||
SearchResponse response = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
|
||||
SearchHits hits = response.getHits();
|
||||
|
||||
List<CourseStudyDto> courseStudyDtoList = new ArrayList<>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
for (SearchHit hit : hits) {
|
||||
String sourceAsString = hit.getSourceAsString();
|
||||
try {
|
||||
CourseStudyDto cft = mapper.readValue(sourceAsString, CourseStudyDto.class);
|
||||
courseStudyDtoList.add(cft);
|
||||
} catch (Exception e) {
|
||||
log.error("转化json到对应失败", sourceAsString);
|
||||
}
|
||||
}
|
||||
return courseStudyDtoList;
|
||||
}
|
||||
|
||||
private void toBeUpdatedEs(List<CourseStudyDto> toBeUpdatedEsData, String indexName) {
|
||||
if (CollUtil.isEmpty(toBeUpdatedEsData)) {
|
||||
return;
|
||||
}
|
||||
BulkRequest bulkRequest = new BulkRequest();
|
||||
for (CourseStudyDto courseStudyDto : toBeUpdatedEsData) {
|
||||
Map<String, Object> docMap = new HashMap<>();
|
||||
docMap.put("status", courseStudyDto.getStatus());
|
||||
docMap.put("progress", courseStudyDto.getProgress());
|
||||
|
||||
// 创建更新请求,并传入单一的docMap
|
||||
UpdateRequest updateRequest = new UpdateRequest(indexName, courseStudyDto.getId())
|
||||
.doc(docMap, XContentType.JSON);
|
||||
|
||||
// 将请求添加到批量请求中
|
||||
bulkRequest.add(updateRequest);
|
||||
}
|
||||
|
||||
try {
|
||||
// 执行批量更新操作
|
||||
BulkResponse bulkResponse = restHighLevelClient.bulk(bulkRequest, RequestOptions.DEFAULT);
|
||||
// 检查是否有失败的操作
|
||||
if (bulkResponse.hasFailures()) {
|
||||
log.error("批量更新失败: {}", bulkResponse.buildFailureMessage());
|
||||
} else {
|
||||
List<String> collect = toBeUpdatedEsData.stream().map(CourseStudyDto::getId).collect(Collectors.toList());
|
||||
log.info("批量更新成功,更新的ES ID列表: {}", collect);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("执行批量更新时发生错误", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<String> phpOnlineStudyRecordSyncEsOfFull(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
||||
|
||||
log.info("开始同步PHP学习记录到ES");
|
||||
// 增量获取PHP中所有已完成的课程
|
||||
if (syncTimePointOfBegin == null || syncTimePointOfEnd == null) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime halfAnHourAgo = now.minusMinutes(30);
|
||||
syncTimePointOfBegin = halfAnHourAgo.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
|
||||
syncTimePointOfEnd = now.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
log.info("同步时间起点:{}", formatter.format(halfAnHourAgo));
|
||||
log.info("同步时间终点:{}", formatter.format(now));
|
||||
}
|
||||
|
||||
int pageSize = 1000;
|
||||
int totalRecordsCount = phpOnlineCourseDao.selectRecentRegRecordListOfCount(syncTimePointOfBegin, syncTimePointOfEnd); // 总记录数
|
||||
|
||||
int totalPages = (int) Math.ceil((double) totalRecordsCount / pageSize);
|
||||
|
||||
ArrayList<String> tempResultList = new ArrayList<>();
|
||||
|
||||
for (int pageNumber = 1; pageNumber <= totalPages; pageNumber++) {
|
||||
int offset = (pageNumber - 1) * pageSize;
|
||||
List<PhpOnlineDto> pageData = phpOnlineCourseDao.selectRecentRegRecordList(syncTimePointOfBegin, syncTimePointOfEnd, offset, pageSize);
|
||||
ArrayList<String> singleResultList = esDataHandle(isOnlyRead, pageData);
|
||||
tempResultList.addAll(singleResultList);
|
||||
}
|
||||
|
||||
return tempResultList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,15 +1,23 @@
|
||||
package com.xboe.school.study.api;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
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.boe.feign.api.infrastructure.entity.CommonSearchVo;
|
||||
import com.boe.feign.api.infrastructure.entity.Dict;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.constants.CacheName;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.vo.StudyTimeVo;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -204,6 +212,8 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
Teacher t = teacherService.get(ct.getTeacherId());
|
||||
if(t!=null) {
|
||||
ct.setRemark(t.getDescription());
|
||||
ct.setSupplier(t.getSupplier());
|
||||
ct.setTeacherType(t.getTeacherType());
|
||||
}
|
||||
if(redisTemplate.opsForValue().get(ct.getTeacherId())==null){
|
||||
List<String>list=new ArrayList<>();
|
||||
@@ -212,11 +222,11 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
redisTemplate.opsForValue().set(teacherVo.get(0).getTeacherId(), teacherVo.get(0).getStatus());
|
||||
//设置过期时间为1天
|
||||
redisTemplate.expire(teacherVo.get(0).getTeacherId(), 24 * 60 * 60, TimeUnit.SECONDS);
|
||||
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1") && ( t==null || t.getTeacherType() == 1)){
|
||||
ct.setTeacherName("BOE教师");
|
||||
}
|
||||
}
|
||||
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
|
||||
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1") && ( t==null || t.getTeacherType() == 1)){
|
||||
ct.setTeacherName("BOE教师");
|
||||
}
|
||||
}
|
||||
@@ -225,7 +235,30 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
rs.put("contents",cclist);
|
||||
rs.put("sections",sectionlist);
|
||||
rs.put("teachers",teachers);
|
||||
|
||||
// 未选择仅内网时isPermission = false,不用区分内外网
|
||||
boolean isPermission = false;
|
||||
if(course.getDevice() ==4){
|
||||
CommonSearchVo searcher = new CommonSearchVo();
|
||||
searcher.setPid(637L);
|
||||
searcher.setType(1);
|
||||
List<Dict> dictList = thirdApi.getDictItems(searcher);
|
||||
if(dictList != null && dictList.size() > 0){
|
||||
List<String> dicts = dictList.stream().map(Dict::getValue).collect(Collectors.toList());
|
||||
// 选择仅内网 并且字典中配置了此课程资源归属,那么只能内网观看 返回 truw
|
||||
isPermission = dicts.contains(course.getOrgId());
|
||||
}
|
||||
}
|
||||
rs.put("isPermission",isPermission);
|
||||
|
||||
CommonSearchVo warn = new CommonSearchVo();
|
||||
warn.setCode("course_warn");
|
||||
warn.setType(1);
|
||||
List<Dict> warns = thirdApi.getDictItems(warn);
|
||||
if(warns != null && warns.size() > 0){
|
||||
rs.put("warn",warns.get(0).getValue());
|
||||
rs.put("warnTitle",warns.get(0).getName());
|
||||
}
|
||||
|
||||
//检查是否已报名
|
||||
StudyCourse sc=service.findByCourseIdAndAid(cid, aid);
|
||||
if(pass==true && sc==null) {
|
||||
@@ -251,6 +284,36 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
rs.put("progress", sc.getProgress());
|
||||
//查询上次学习的是什么资源。查询用户的学习情况
|
||||
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);//学习的内容
|
||||
}
|
||||
|
||||
@@ -343,6 +406,8 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
}
|
||||
//追加学习时长
|
||||
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);
|
||||
log.info("在线课学习记录"+allUserList);
|
||||
return success(item.getId());
|
||||
@@ -527,8 +592,8 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
}
|
||||
try {
|
||||
studyService.finishVideoStudyItem(itemId, studyId,courseId,cnum,token);
|
||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
||||
log.info("在线课学习记录"+allUserList);
|
||||
// List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
||||
// log.info("在线课学习记录"+allUserList);
|
||||
return success(true);
|
||||
}catch(Exception e) {
|
||||
log.error("记录内容学习完成错误",e);
|
||||
@@ -573,7 +638,7 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
@Deprecated
|
||||
@RequestMapping(value="/appendtime",method = {RequestMethod.GET,RequestMethod.POST})
|
||||
public JsonResponse<String> appendTime(StudyTime studyTime, HttpServletRequest request){
|
||||
|
||||
|
||||
if(StringUtils.isBlank(studyTime.getStudyId())){
|
||||
return error("参数错误");
|
||||
}
|
||||
@@ -603,7 +668,91 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
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")
|
||||
public JsonResponse<Map<String,Object>> lastStudy(){
|
||||
@@ -750,18 +899,26 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
* @param courseId 课程id 用于删除课程报名信息和修改课程学习人数
|
||||
* */
|
||||
@PostMapping("/delete-signup")
|
||||
public JsonResponse<Boolean> deleteSignUp(String id,String courseId,String studentId){
|
||||
public JsonResponse<Boolean> deleteSignUp(String id,String courseId,String studentId, HttpServletRequest request){
|
||||
if(StringUtils.isBlank(id)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
//String aid = this.getCurrent().getAccountId();
|
||||
try {
|
||||
service.deleteSignUp(id,courseId,studentId);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("删除报名信息失败",e.getMessage());
|
||||
return error("删除失败",e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
thirdApi.syncCourseStudent(Long.parseLong(courseId),token);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return success(true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,9 +3,16 @@ package com.xboe.school.study.api;
|
||||
import java.io.IOException;
|
||||
import java.time.ZoneOffset;
|
||||
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.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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -24,6 +31,8 @@ import com.xboe.school.study.service.IStudyCourseService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* ES的课程检索
|
||||
* @author seastar
|
||||
@@ -39,6 +48,19 @@ public class StudyCourseESApi extends ApiBaseController{
|
||||
|
||||
@Autowired
|
||||
IStudyCourseService service;
|
||||
|
||||
@Autowired
|
||||
ICourseService courseService;
|
||||
|
||||
@Value("${xboe.upload.file.http_path}")
|
||||
private String httpPath;
|
||||
|
||||
@Value("${xboe.image.course.default}")
|
||||
private String defaultCourseImage;
|
||||
|
||||
@Resource
|
||||
private PhpOnlineStudyRecordScheduledTasks phpOnlineStudyRecordScheduledTasks;
|
||||
|
||||
|
||||
@RequestMapping(value="/search",method = {RequestMethod.GET,RequestMethod.POST})
|
||||
public JsonResponse<PageList<CourseStudyDto>> search(Pagination page, CourseStudyDto dto){
|
||||
@@ -48,13 +70,61 @@ public class StudyCourseESApi extends ApiBaseController{
|
||||
try {
|
||||
dto.setAccountId(getCurrent().getAccountId());
|
||||
PageList<CourseStudyDto> rs=search.search(page.getStartRow(),page.getPageSize(), dto);
|
||||
|
||||
handleCourseImage(rs);
|
||||
|
||||
return success(rs);
|
||||
}catch(Exception e) {
|
||||
log.error("查询报名学习ES失败",e);
|
||||
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})
|
||||
public JsonResponse<List<StudyCourse>> search(@RequestBody List<String> ids){
|
||||
if(ids.isEmpty()) {
|
||||
@@ -161,4 +231,26 @@ public class StudyCourseESApi extends ApiBaseController{
|
||||
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param syncTimePointOfBegin
|
||||
* @param syncTimePointOfEnd
|
||||
* @param isOnlyRead
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/phpOnlineStudyRecordSyncEs")
|
||||
public JsonResponse<List<String>> phpOnlineStudyRecordSyncEs(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
||||
List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEs(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
|
||||
return success(courseStudyDtoList);
|
||||
}
|
||||
|
||||
@PostMapping("/phpOnlineStudyRecordSyncEsOfFull")
|
||||
public JsonResponse<List<String>> phpOnlineStudyRecordSyncEsOfFull(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
||||
List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEsOfFull(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
|
||||
return success(courseStudyDtoList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
package com.xboe.school.study.dao;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.school.study.dto.PhpOnlineDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Repository
|
||||
@Slf4j
|
||||
public class PhpOnlineCourseDao extends BaseDao<PhpOnlineDto> {
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String activeProfile;
|
||||
|
||||
public List<PhpOnlineDto> selectRecentLearnRecordList(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer offset, Integer limit) {
|
||||
String sql =
|
||||
"SELECT\n" +
|
||||
" elc.kid AS courseId,\n" +
|
||||
" elcr.user_id AS userIdOfPhp,\n" +
|
||||
" ROUND((SUM(CASE WHEN elrc.kid IS NOT NULL THEN 1 ELSE 0 END) / COUNT(1)) * 100, 0) AS progress\n" +
|
||||
"FROM\n" +
|
||||
" elearninglms.eln_ln_course elc\n" +
|
||||
" INNER JOIN elearninglms.eln_ln_course_reg elcr \n" +
|
||||
" ON elc.kid = elcr.course_id\n" +
|
||||
" INNER JOIN (\n" +
|
||||
" SELECT\n" +
|
||||
" user_id,\n" +
|
||||
" course_id \n" +
|
||||
" FROM\n" +
|
||||
" elearninglms.eln_ln_res_complete\n" +
|
||||
" WHERE\n" +
|
||||
" complete_type = '1'\n" +
|
||||
" AND complete_status = '2'\n" +
|
||||
" AND updated_at > ?1 AND updated_at < ?2\n" +
|
||||
" AND is_deleted = 0\n" +
|
||||
" GROUP BY\n" +
|
||||
" user_id,\n" +
|
||||
" course_id\n" +
|
||||
" ) recentFinishStuent \n" +
|
||||
" ON recentFinishStuent.user_id = elcr.user_id \n" +
|
||||
" AND recentFinishStuent.course_id = elcr.course_id\n" +
|
||||
" INNER JOIN elearninglms.eln_ln_mod_res elms \n" +
|
||||
" ON elms.course_id = elcr.course_id\n" +
|
||||
" LEFT JOIN elearninglms.eln_ln_res_complete elrc \n" +
|
||||
" ON elrc.mod_res_id = elms.kid\n" +
|
||||
" AND elrc.user_id = elcr.user_id\n" +
|
||||
" AND elrc.complete_type = '1'\n" +
|
||||
" AND elrc.complete_status = '2'\n" +
|
||||
"WHERE\n" +
|
||||
" elc.is_deleted = 0\n" +
|
||||
" AND elcr.is_deleted = 0\n" +
|
||||
" AND elcr.reg_state = '1'\n" +
|
||||
" AND elms.publish_status = '1'\n" +
|
||||
" AND elms.is_deleted = '0'\n" +
|
||||
"GROUP BY\n" +
|
||||
" elc.kid,\n" +
|
||||
" elcr.user_id\n" +
|
||||
"LIMIT " + offset + "," + limit;
|
||||
|
||||
|
||||
List<Object[]> objectList1 = this.sqlFindList(sql, syncTimePointOfBegin, syncTimePointOfEnd);
|
||||
if (CollUtil.isEmpty(objectList1)) {
|
||||
log.info("没有找到已完成的数据");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<PhpOnlineDto> recentLearnRecordList = new ArrayList<>();
|
||||
for (Object[] objects : objectList1) {
|
||||
String courseId = objects[0].toString();
|
||||
String userIdOfPhp = objects[1].toString();
|
||||
Integer progress = ((BigDecimal) objects[2]).intValue();
|
||||
PhpOnlineDto phpOnlineDto = new PhpOnlineDto();
|
||||
phpOnlineDto.setCourseId(courseId);
|
||||
phpOnlineDto.setUserIdOfPhp(userIdOfPhp);
|
||||
phpOnlineDto.setProgress(progress);
|
||||
recentLearnRecordList.add(phpOnlineDto);
|
||||
}
|
||||
|
||||
// 拼接获取所有新系统用户id,这里不选择与上面的联表查询,有效率问题
|
||||
|
||||
String userBasicDataBase;
|
||||
if (activeProfile.equals("pro")) {
|
||||
userBasicDataBase = "user_basic";
|
||||
} else {
|
||||
userBasicDataBase = "userbasic";
|
||||
}
|
||||
|
||||
List<String> userIds = objectList1.stream().map(objects -> String.valueOf(objects[1])).distinct().collect(Collectors.toList());
|
||||
List<Object[]> objectList2 = this.sqlFindList("select kid,user_id from " + userBasicDataBase + ".user_account where kid in (?1) and deleted=0 and account_status = 0", userIds);
|
||||
|
||||
if (CollUtil.isEmpty(objectList1)) {
|
||||
log.info("新系统用户数据不存在");
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<Object, Object> userIdToKidMap = objectList2.stream().collect(Collectors.toMap(object -> object[0], object -> object[1]));
|
||||
|
||||
// 设置新系统用户ID
|
||||
recentLearnRecordList = recentLearnRecordList.stream()
|
||||
.map(phpOnlineDto -> {
|
||||
Object userIdOfJavaObj = userIdToKidMap.get(phpOnlineDto.getUserIdOfPhp());
|
||||
if (userIdOfJavaObj != null) {
|
||||
phpOnlineDto.setUserIdOfJava(userIdOfJavaObj.toString());
|
||||
}
|
||||
return phpOnlineDto;
|
||||
})
|
||||
.filter(phpOnlineDto -> StringUtils.isNotBlank(phpOnlineDto.getUserIdOfJava()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return recentLearnRecordList;
|
||||
}
|
||||
|
||||
|
||||
public int selectRecentLearnRecordListOfCount(Long syncTimePointOfBegin, Long syncTimePointOfEnd) {
|
||||
String sql =
|
||||
"SELECT COUNT(1) \n" +
|
||||
"FROM (\n" +
|
||||
" SELECT elc.kid\n" +
|
||||
" FROM elearninglms.eln_ln_course elc\n" +
|
||||
" INNER JOIN elearninglms.eln_ln_course_reg elcr\n" +
|
||||
" ON elc.kid = elcr.course_id\n" +
|
||||
" INNER JOIN (\n" +
|
||||
" SELECT user_id, course_id\n" +
|
||||
" FROM elearninglms.eln_ln_res_complete\n" +
|
||||
" WHERE complete_type = '1'\n" +
|
||||
" AND complete_status = '2'\n" +
|
||||
" AND updated_at > ?1\n" +
|
||||
" AND updated_at < ?2\n" +
|
||||
" AND is_deleted = 0\n" +
|
||||
" GROUP BY user_id, course_id\n" +
|
||||
" ) recentFinishStuent\n" +
|
||||
" ON recentFinishStuent.user_id = elcr.user_id\n" +
|
||||
" AND recentFinishStuent.course_id = elcr.course_id\n" +
|
||||
" INNER JOIN elearninglms.eln_ln_mod_res elms\n" +
|
||||
" ON elms.course_id = elcr.course_id\n" +
|
||||
" LEFT JOIN elearninglms.eln_ln_res_complete elrc\n" +
|
||||
" ON elrc.mod_res_id = elms.kid\n" +
|
||||
" AND elrc.user_id = elcr.user_id\n" +
|
||||
" AND elrc.complete_type = '1'\n" +
|
||||
" AND elrc.complete_status = '2'\n" +
|
||||
" WHERE elc.is_deleted = 0\n" +
|
||||
" AND elcr.is_deleted = 0\n" +
|
||||
" AND elcr.reg_state = '1'\n" +
|
||||
" AND elms.publish_status = '1'\n" +
|
||||
" AND elms.is_deleted = '0'\n" +
|
||||
" GROUP BY elc.kid, elcr.user_id\n" +
|
||||
") temp;\n"; // 每页 1000 条记录,OFFSET 计算分页
|
||||
|
||||
|
||||
int count = this.sqlCount(sql, syncTimePointOfBegin, syncTimePointOfEnd);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
public List<PhpOnlineDto> selectRecentRegRecordList(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer offset, Integer limit) {
|
||||
String sql =
|
||||
"SELECT\n" +
|
||||
" elc.kid AS courseId,\n" +
|
||||
" elcr.user_id AS userIdOfPhp,\n" +
|
||||
" ROUND((SUM(CASE WHEN elrc.kid IS NOT NULL THEN 1 ELSE 0 END) / COUNT(1)) * 100, 0) AS progress\n" +
|
||||
"FROM\n" +
|
||||
" elearninglms.eln_ln_course elc\n" +
|
||||
" INNER JOIN elearninglms.eln_ln_course_reg elcr ON elc.kid = elcr.course_id AND elcr.created_at > ?1 AND elcr.created_at < ?2\n" +
|
||||
" INNER JOIN elearninglms.eln_ln_mod_res elms \n" +
|
||||
" ON elms.course_id = elcr.course_id\n" +
|
||||
" LEFT JOIN elearninglms.eln_ln_res_complete elrc \n" +
|
||||
" ON elrc.mod_res_id = elms.kid\n" +
|
||||
" AND elrc.user_id = elcr.user_id\n" +
|
||||
" AND elrc.complete_type = '1'\n" +
|
||||
" AND elrc.complete_status = '2'\n" +
|
||||
"WHERE\n" +
|
||||
" elc.is_deleted = 0\n" +
|
||||
" AND elcr.is_deleted = 0\n" +
|
||||
" AND elcr.reg_state = '1'\n" +
|
||||
" AND elms.publish_status = '1'\n" +
|
||||
" AND elms.is_deleted = '0'\n" +
|
||||
"GROUP BY\n" +
|
||||
" elc.kid,\n" +
|
||||
" elcr.user_id\n" +
|
||||
"LIMIT " + offset + "," + limit;
|
||||
|
||||
|
||||
List<Object[]> objectList1 = this.sqlFindList(sql, syncTimePointOfBegin, syncTimePointOfEnd);
|
||||
if (CollUtil.isEmpty(objectList1)) {
|
||||
log.info("没有找到已完成的数据");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<PhpOnlineDto> recentLearnRecordList = new ArrayList<>();
|
||||
for (Object[] objects : objectList1) {
|
||||
String courseId = objects[0].toString();
|
||||
String userIdOfPhp = objects[1].toString();
|
||||
Integer progress = ((BigDecimal) objects[2]).intValue();
|
||||
PhpOnlineDto phpOnlineDto = new PhpOnlineDto();
|
||||
phpOnlineDto.setCourseId(courseId);
|
||||
phpOnlineDto.setUserIdOfPhp(userIdOfPhp);
|
||||
phpOnlineDto.setProgress(progress);
|
||||
recentLearnRecordList.add(phpOnlineDto);
|
||||
}
|
||||
|
||||
// 拼接获取所有新系统用户id,这里不选择与上面的联表查询,有效率问题
|
||||
|
||||
String userBasicDataBase;
|
||||
if (activeProfile.equals("pro")) {
|
||||
userBasicDataBase = "user_basic";
|
||||
} else {
|
||||
userBasicDataBase = "userbasic";
|
||||
}
|
||||
|
||||
List<String> userIds = objectList1.stream().map(objects -> String.valueOf(objects[1])).distinct().collect(Collectors.toList());
|
||||
List<Object[]> objectList2 = this.sqlFindList("select kid,user_id from " + userBasicDataBase + ".user_account where kid in (?1) and deleted=0 and account_status = 0", userIds);
|
||||
|
||||
if (CollUtil.isEmpty(objectList1)) {
|
||||
log.info("新系统用户数据不存在");
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<Object, Object> userIdToKidMap = objectList2.stream().collect(Collectors.toMap(object -> object[0], object -> object[1]));
|
||||
|
||||
// 设置新系统用户ID
|
||||
recentLearnRecordList = recentLearnRecordList.stream()
|
||||
.map(phpOnlineDto -> {
|
||||
Object userIdOfJavaObj = userIdToKidMap.get(phpOnlineDto.getUserIdOfPhp());
|
||||
if (userIdOfJavaObj != null) {
|
||||
phpOnlineDto.setUserIdOfJava(userIdOfJavaObj.toString());
|
||||
}
|
||||
return phpOnlineDto;
|
||||
})
|
||||
.filter(phpOnlineDto -> phpOnlineDto.getUserIdOfJava() != null)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return recentLearnRecordList;
|
||||
}
|
||||
|
||||
public int selectRecentRegRecordListOfCount(Long syncTimePointOfBegin, Long syncTimePointOfEnd) {
|
||||
String sql =
|
||||
"SELECT COUNT(1)\n" +
|
||||
"FROM (\n" +
|
||||
" SELECT\n" +
|
||||
" elc.kid\n" +
|
||||
" FROM\n" +
|
||||
" elearninglms.eln_ln_course elc\n" +
|
||||
" INNER JOIN elearninglms.eln_ln_course_reg elcr \n" +
|
||||
" ON elc.kid = elcr.course_id\n" +
|
||||
" AND elcr.created_at > ?1\n" +
|
||||
" AND elcr.created_at < ?2\n" +
|
||||
" INNER JOIN elearninglms.eln_ln_mod_res elms \n" +
|
||||
" ON elms.course_id = elcr.course_id\n" +
|
||||
" LEFT JOIN elearninglms.eln_ln_res_complete elrc \n" +
|
||||
" ON elrc.mod_res_id = elms.kid\n" +
|
||||
" AND elrc.user_id = elcr.user_id\n" +
|
||||
" AND elrc.complete_type = '1'\n" +
|
||||
" AND elrc.complete_status = '2'\n" +
|
||||
" WHERE\n" +
|
||||
" elc.is_deleted = 0\n" +
|
||||
" AND elcr.is_deleted = 0\n" +
|
||||
" AND elcr.reg_state = '1'\n" +
|
||||
" AND elms.publish_status = '1'\n" +
|
||||
" AND elms.is_deleted = '0'\n" +
|
||||
" GROUP BY\n" +
|
||||
" elc.kid,\n" +
|
||||
" elcr.user_id\n" +
|
||||
") temp;\n"; // 每页 1000 条记录,OFFSET 计算分页
|
||||
|
||||
|
||||
int count = this.sqlCount(sql, syncTimePointOfBegin, syncTimePointOfEnd);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.xboe.school.study.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 批量报名
|
||||
*
|
||||
* @author seastar
|
||||
*/
|
||||
@Data
|
||||
public class PhpOnlineDto {
|
||||
|
||||
/**
|
||||
* 课程id
|
||||
*/
|
||||
private String courseId;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String userIdOfPhp;
|
||||
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String userIdOfJava;
|
||||
|
||||
/**
|
||||
* 进度
|
||||
*/
|
||||
private Integer progress;
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.xboe.school.study.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
@@ -128,5 +130,12 @@ public class StudyCourseItem extends IdEntity {
|
||||
*/
|
||||
@Column(name = "status",length=1)
|
||||
private Integer status;
|
||||
|
||||
|
||||
/**
|
||||
* 视频播放进度
|
||||
* */
|
||||
// @Column(name = "progress_video")
|
||||
@Transient
|
||||
private BigDecimal progressVideo;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xboe.school.study.service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -7,7 +8,6 @@ import com.xboe.common.PageList;
|
||||
import com.xboe.school.study.dto.StudyContentDto;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudyTime;
|
||||
import com.xboe.system.user.entity.User;
|
||||
|
||||
/**
|
||||
* 学习情况处理,比较综合一个处理类
|
||||
@@ -35,11 +35,12 @@ public interface IStudyService {
|
||||
|
||||
/**
|
||||
* 更新最后的学习时间,及学习时间点
|
||||
*
|
||||
* @param studyContentId
|
||||
* @param lastStudyTime
|
||||
* @param aid
|
||||
*/
|
||||
void updateLastTime(String studyContentId,int lastStudyTime,String aid);
|
||||
void updateLastTime(String studyContentId, int lastStudyTime, String aid);
|
||||
|
||||
/**
|
||||
* 资源学习记录
|
||||
@@ -99,4 +100,9 @@ public interface IStudyService {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.xboe.module.course.entity.CourseExam;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.study.dao.StudyCourseItemDao;
|
||||
import com.xboe.school.study.dao.StudyExamDao;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudyExam;
|
||||
import com.xboe.school.study.service.IStudyExamService;
|
||||
@@ -170,15 +171,32 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
||||
}
|
||||
builder.addGroupBy("studyId");
|
||||
List<StudyExam> list1 = dao.findList(builder.builder());
|
||||
log.info("------------QueryBuilder list1.size = " + list1.size() + ",0 = " + list1.get(0));
|
||||
|
||||
for(StudyExam item : list1){
|
||||
log.info("-----------------CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId());
|
||||
int totalContent = courseContentDao.getCount(item.getCourseId());
|
||||
log.info("----------准备判断进度-------totalContent = " + totalContent);
|
||||
scDao.finishCheck1(item.getStudyId(),item.getCourseId(),totalContent);
|
||||
log.info("----------判断进度完毕----------------------");
|
||||
if(list1 != null && list1.size() > 0){
|
||||
log.info("----------StudyExam--QueryBuilder list1.size = " + list1.size() + ",0 = " + list1.get(0));
|
||||
for(StudyExam item : list1){
|
||||
log.info("--------------StudyExam---CourseId = " + item.getCourseId() + " , StudyId = " + item.getStudyId() + " , StudentId = " + item.getStudentId());
|
||||
int totalContent = courseContentDao.getCount(item.getCourseId());
|
||||
log.info("--------StudyExam--准备判断进度-------totalContent = " + totalContent);
|
||||
scDao.finishCheck1(item.getStudyId(),item.getCourseId(),totalContent);
|
||||
log.info("--------StudyExam--判断进度完毕----------------------");
|
||||
}
|
||||
}else{
|
||||
QueryBuilder builder1 = QueryBuilder.from(StudyCourse.class);
|
||||
if (StringUtils.isEmpty(courseId)){
|
||||
return;
|
||||
}
|
||||
builder1.addFilter(FieldFilters.eq("courseId", courseId));
|
||||
List<StudyCourse> list2 = scDao.findList(builder1.builder());
|
||||
log.info("------------StudyCourse list2.size = " + list2.size() + ",0 = " + list2.get(0));
|
||||
for(StudyCourse item : list2){
|
||||
log.info("-------------StudyCourse----CourseId = " + item.getCourseId() + " , StudyId = " + item.getId() + " , StudentId = " + item.getAid());
|
||||
int totalContent = courseContentDao.getCount(item.getCourseId());
|
||||
log.info("--------StudyCourse--准备判断进度-------totalContent = " + totalContent);
|
||||
scDao.finishCheck1(item.getId(),item.getCourseId(),totalContent);
|
||||
log.info("--------StudyCourse--判断进度完毕----------------------");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
log.info("------异常----------------------:" +exception.getMessage());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xboe.school.study.service.impl;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
@@ -9,12 +10,9 @@ import java.util.Map;
|
||||
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
@@ -51,7 +49,10 @@ public class StudyServiceImpl implements IStudyService{
|
||||
|
||||
@Autowired
|
||||
UserDao userDao;
|
||||
|
||||
@Autowired
|
||||
StringRedisTemplate redisTemplate;
|
||||
|
||||
|
||||
@Override
|
||||
public StudyCourseItem checkHas(String studyId,String contentId) {
|
||||
List<StudyCourseItem> items = scItemDao.findList(FieldFilters.eq("studyId", studyId),FieldFilters.eq("contentId", contentId));
|
||||
@@ -115,34 +116,74 @@ public class StudyServiceImpl implements IStudyService{
|
||||
//增加内容的学习时长
|
||||
if(StringUtils.isNotBlank(studyItemId)) {
|
||||
//直接根据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";
|
||||
scItemDao.sqlUpdate(sql,studyItemId);
|
||||
//scItemDao.updateMultiFieldById(studyItemId, UpdateBuilder.create("studyDuration", "studyDuration+"+duration,FieldUpdateType.EXPRESSION));
|
||||
|
||||
|
||||
}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";
|
||||
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";
|
||||
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
|
||||
@Transactional
|
||||
public void appendStudyDuration(StudyTime st) {
|
||||
@@ -165,7 +206,21 @@ public class StudyServiceImpl implements IStudyService{
|
||||
|
||||
@Override
|
||||
public List<StudyCourseItem> findByStudyId(String studyId) {
|
||||
return scItemDao.findList(OrderCondition.desc("lastTime"),FieldFilters.eq("studyId", studyId));
|
||||
List<StudyCourseItem> list = 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
|
||||
@@ -227,11 +282,12 @@ public class StudyServiceImpl implements IStudyService{
|
||||
return pageList;
|
||||
}
|
||||
}
|
||||
|
||||
String sql = "select a.id, a.course_id, a.course_name, a.aname, " +
|
||||
"IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " +
|
||||
"IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status,b.score " +
|
||||
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "' and aname like '%"+name+"%') a " +
|
||||
"left join " +
|
||||
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " +
|
||||
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status,MAX(item.score) score " +
|
||||
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
||||
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"%' group by bsc.id) b " +
|
||||
"on a.course_id = b.course_id and a.id = b.id " +
|
||||
@@ -260,6 +316,9 @@ public class StudyServiceImpl implements IStudyService{
|
||||
sc.setProgress(Integer.valueOf(objs[5].toString()));
|
||||
sc.setStatus(Integer.valueOf(objs[6].toString()));
|
||||
sc.setAname(objs[3].toString());
|
||||
if(objs[7] != null){
|
||||
sc.setScore(Float.valueOf(objs[7].toString()));
|
||||
}
|
||||
item.add(sc);
|
||||
}
|
||||
log.info("资源完成情况人员"+item);
|
||||
@@ -324,8 +383,26 @@ public class StudyServiceImpl implements IStudyService{
|
||||
|
||||
// 更新 前端传输已学习时长
|
||||
@Override
|
||||
@Transactional
|
||||
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
|
||||
@Transactional
|
||||
public void updateStudyCourseItemLastTime(String studyContentId, int lastStudyTime,LocalDateTime timestamp) {
|
||||
log.info("-study-video-time-定时---studyContentId = " + studyContentId + ",lastStudyTime = " + lastStudyTime + ", timestamp = " + timestamp);
|
||||
// 更新最后的学习时间点
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
UpdateBuilder update=UpdateBuilder.from(StudyCourseItem.class);
|
||||
@@ -333,11 +410,12 @@ public class StudyServiceImpl implements IStudyService{
|
||||
//只记录时间长的时候的处理
|
||||
update.addFilter(FieldFilters.lt("lastStudyTime", lastStudyTime));
|
||||
update.addUpdateField("lastStudyTime", lastStudyTime);
|
||||
update.addUpdateField("lastTime", now);
|
||||
update.addUpdateField("lastTime", timestamp==null ? now : timestamp);
|
||||
scItemDao.update(update.builder());
|
||||
//增加用户的学习时长,在api中调用
|
||||
log.info("-study-video-time-mysql保存---studyContentId = " + studyContentId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String,Object> getLast(String aid) {
|
||||
//按lastTime排序,第一条,只是课件内容
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
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
|
||||
}
|
||||
105
servers/boe-server-all/src/main/resources/application-dev.yml
Normal file
105
servers/boe-server-all/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,105 @@
|
||||
boe:
|
||||
domain: http://192.168.0.253
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 1000MB
|
||||
max-request-size: 1000MB
|
||||
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:
|
||||
database: 1
|
||||
host: 192.168.0.253
|
||||
password: boe@123
|
||||
port: 6379
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
datasource:
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.0.253:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
username: root
|
||||
password: boe#1234A
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
auto-commit: true
|
||||
minimum-idle: 5
|
||||
idle-timeout: 60000
|
||||
connection-timeout: 30000
|
||||
max-lifetime: 1800000
|
||||
maximum-pool-size: 20
|
||||
logging:
|
||||
level:
|
||||
org:
|
||||
hibernate:
|
||||
SQL: ERROR
|
||||
config: classpath:log/logback-@profileActive@.xml
|
||||
xboe:
|
||||
api:
|
||||
cross_filter: true
|
||||
upload:
|
||||
file:
|
||||
temp_path: /tmp
|
||||
save_path: /home/www/elearning/upload
|
||||
http_path: http://192.168.0.253/upload
|
||||
externalinterface:
|
||||
url:
|
||||
system: http://127.0.0.1:9091
|
||||
old:
|
||||
base:
|
||||
url: http://192.168.0.253
|
||||
stat:
|
||||
base:
|
||||
url: http://127.0.0.1:9080
|
||||
server:
|
||||
userbasic:
|
||||
url: http://192.168.0.253/userbasic
|
||||
elasticsearch:
|
||||
server:
|
||||
ip: 192.168.0.253
|
||||
port: 9200
|
||||
user:
|
||||
password:
|
||||
email:
|
||||
url: http://192.168.0.253/api/b1/email/send
|
||||
from: boeu_learning@boe.com.cn
|
||||
user:
|
||||
security:
|
||||
jasypt:
|
||||
encryptor:
|
||||
algorithm: PBEWithMD5AndDES
|
||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||
image:
|
||||
course:
|
||||
default: http://192.168.0.253/pc/images/bgimg/course.png
|
||||
xxl:
|
||||
job:
|
||||
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
||||
admin:
|
||||
addresses: http://192.168.0.253/jobAdmin
|
||||
executor:
|
||||
appname: java-servers-job-api
|
||||
port: 9995
|
||||
address:
|
||||
ip:
|
||||
logpath: /var/log/xxl-job/dw/
|
||||
logretentiondays: 30
|
||||
aop-log-record:
|
||||
#是否开启日志记录
|
||||
enabled: true
|
||||
#不进行拦截的包或者类
|
||||
excludeClassNames:
|
||||
activemq:
|
||||
broker-url: tcp://192.168.0.253:61616
|
||||
user: admin
|
||||
password: admin
|
||||
elasticsearch:
|
||||
host: 192.168.0.253
|
||||
port: 9200
|
||||
183
servers/boe-server-all/src/main/resources/application-pre.yml
Normal file
183
servers/boe-server-all/src/main/resources/application-pre.yml
Normal file
@@ -0,0 +1,183 @@
|
||||
spring:
|
||||
# application.yml
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 1000MB
|
||||
max-request-size: 1000MB
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 10.251.129.51:8848
|
||||
config:
|
||||
server-addr: 10.251.129.51:8848
|
||||
redis:
|
||||
database: 1
|
||||
host: 10.251.129.122
|
||||
password: qwert!W588
|
||||
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.129.126: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: http://10.251.132.75/upload
|
||||
externalinterface:
|
||||
url:
|
||||
system: http://localhost:9091
|
||||
old:
|
||||
base:
|
||||
url: http://10.251.132.75
|
||||
server:
|
||||
userbasic:
|
||||
url: http://10.251.132.75/userbasic
|
||||
stat:
|
||||
base:
|
||||
url: http://10.251.132.75:9080
|
||||
elasticsearch:
|
||||
server:
|
||||
ip: 10.251.129.21
|
||||
port: 9200
|
||||
user:
|
||||
password:
|
||||
email:
|
||||
url: http://10.251.132.75/api/b1/email/send
|
||||
from: boeu_learning@boe.com.cn
|
||||
user:
|
||||
security:
|
||||
image:
|
||||
course:
|
||||
default: http://10.251.132.75/pc/images/bgimg/course.png
|
||||
jasypt:
|
||||
encryptor:
|
||||
algorithm: PBEWithMD5AndDES
|
||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||
|
||||
boe:
|
||||
domain: http://10.251.132.75
|
||||
|
||||
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.132.75/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.51:61616
|
||||
user: admin
|
||||
password: admin
|
||||
elasticsearch:
|
||||
host: 10.251.129.21
|
||||
port: 9200
|
||||
103
servers/boe-server-all/src/main/resources/application-prod.yml
Normal file
103
servers/boe-server-all/src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,103 @@
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 1000MB
|
||||
max-request-size: 1000MB
|
||||
web:
|
||||
resources:
|
||||
static-locations: file:E:/Projects/BOE/java/static
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 10.251.113.100:8848
|
||||
config:
|
||||
server-addr: 10.251.113.100:8848
|
||||
redis:
|
||||
database: 1
|
||||
host: 10.251.88.213
|
||||
password: qwert!W588
|
||||
port: 6379
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
datasource:
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
username: admin
|
||||
password: boeRds01
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
auto-commit: true
|
||||
minimum-idle: 5
|
||||
idle-timeout: 60000
|
||||
connection-timeout: 30000
|
||||
max-lifetime: 1800000
|
||||
maximum-pool-size: 20
|
||||
logging:
|
||||
level:
|
||||
org:
|
||||
hibernate:
|
||||
SQL: ERROR
|
||||
config: classpath:log/logback-@profileActive@.xml
|
||||
xboe:
|
||||
api:
|
||||
cross_filter: true
|
||||
upload:
|
||||
file:
|
||||
temp_path: /tmp
|
||||
save_path: /home/www/elearning/upload
|
||||
http_path: https://u.boe.com/upload
|
||||
externalinterface:
|
||||
url:
|
||||
system: http://127.0.0.1:9091
|
||||
old:
|
||||
base:
|
||||
url: https://u.boe.com
|
||||
stat:
|
||||
base:
|
||||
url: http://127.0.0.1:9080
|
||||
server:
|
||||
userbasic:
|
||||
url: https://u.boe.com/userbasic
|
||||
elasticsearch:
|
||||
server:
|
||||
ip: 10.251.88.218
|
||||
port: 9200
|
||||
user:
|
||||
password:
|
||||
email:
|
||||
url: https://u.boe.com/api/b1/email/send
|
||||
from: boeu_learning@boe.com.cn
|
||||
user:
|
||||
security:
|
||||
jasypt:
|
||||
encryptor:
|
||||
algorithm: PBEWithMD5AndDES
|
||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||
image:
|
||||
course:
|
||||
default: https://u.boe.com/pc/images/bgimg/course.png
|
||||
xxl:
|
||||
job:
|
||||
accessToken: 65ddc683-22f5-83b4-de3a-3c97a0a29af0
|
||||
admin:
|
||||
addresses: http://u.boe.com/jobAdmin
|
||||
executor:
|
||||
appname: java-servers-job-api
|
||||
port: 9995
|
||||
address:
|
||||
ip:
|
||||
logpath: /var/log/xxl-job/dw/
|
||||
logretentiondays: 30
|
||||
aop-log-record:
|
||||
#是否开启日志记录
|
||||
enabled: true
|
||||
#不进行拦截的包或者类
|
||||
excludeClassNames:
|
||||
activemq:
|
||||
broker-url: tcp://10.251.113.100:61616
|
||||
user: admin
|
||||
password: admin
|
||||
elasticsearch:
|
||||
host: 10.251.88.218
|
||||
port: 9200
|
||||
185
servers/boe-server-all/src/main/resources/application-test.yml
Normal file
185
servers/boe-server-all/src/main/resources/application-test.yml
Normal file
@@ -0,0 +1,185 @@
|
||||
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: false
|
||||
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
|
||||
77
servers/boe-server-all/src/main/resources/application.yml
Normal file
77
servers/boe-server-all/src/main/resources/application.yml
Normal file
@@ -0,0 +1,77 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: boe-server-all
|
||||
redis:
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
min-idle: 0
|
||||
max-idle: 30
|
||||
max-wait: 10000ms
|
||||
shutdown-timeout: 100ms
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
mvc:
|
||||
static-path-pattern: /cdn/**
|
||||
jpa:
|
||||
database: MYSQL
|
||||
show-sql: false
|
||||
properties:
|
||||
hibernate:
|
||||
naming_strategy: org.hibernate.cfg.EJB3NamingStrategy
|
||||
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
current_session_context_class: org.springframework.orm.hibernate5.SpringSessionContext
|
||||
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
logging:
|
||||
config: classpath:log/logback-${spring.profiles.active}.xml
|
||||
server:
|
||||
port: 9090
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 500MB
|
||||
max-request-size: 500MB
|
||||
session:
|
||||
timeout: 30m
|
||||
encoding:
|
||||
charset: UTF-8
|
||||
enabled: true
|
||||
force: true
|
||||
|
||||
ok:
|
||||
http:
|
||||
connect-timeout: 30
|
||||
read-timeout: 30
|
||||
write-timeout: 30
|
||||
max-idle-connections: 200
|
||||
keep-alive-duration: 300
|
||||
boe:
|
||||
domain: http://127.0.0.1
|
||||
orgTree:
|
||||
orgTreeList: ${boe.domain}/userbasic/org/list
|
||||
orgChildTreeList: ${boe.domain}/userbasic/org/childOrgs
|
||||
userBasic:
|
||||
searchUserList: ${boe.domain}/userbasic/user/list
|
||||
getTeacherIds: ${boe.domain}/userbasic/user/getTeacherInfo
|
||||
getUserBasicInfo: ${boe.domain}/userbasic/user/getUserBasicInfo
|
||||
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
|
||||
coursesuilt:
|
||||
getStudyStatus: ${boe.domain}/manageApi/stu/project/completeStatus
|
||||
updateOrSaveCourse: ${boe.domain}/manageApi/admin/teacherRecord/updateOrSaveCourse
|
||||
syncCourseStudent: ${boe.domain}/manageApi/admin/teacherRecord/syncCourseStudent
|
||||
syncOnLineScore: ${boe.domain}/manageApi/admin/teacherRecord/syncOnLineScore
|
||||
updateOnLineStatua: ${boe.domain}/manageApi/admin/teacherRecord/updateOnLineStatua
|
||||
delOnLineById: ${boe.domain}/manageApi/admin/teacherRecord/delOnLineById
|
||||
@@ -1,24 +0,0 @@
|
||||
spring:
|
||||
application:
|
||||
name: boe-server-all
|
||||
profiles:
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.0.101:8848
|
||||
config:
|
||||
server-addr: 192.168.0.101:8848
|
||||
file-extension: yaml
|
||||
namespace: fd5741ee-c2aa-4002-a9b0-43a11436d35c
|
||||
name: boe-server-all
|
||||
group: SERVER_GROUP
|
||||
extension-configs:
|
||||
- data-id: redis0.yaml
|
||||
group: COMMON_GROUP
|
||||
refresh: true
|
||||
|
||||
# shared-configs:
|
||||
# - data-id: redis0.yaml
|
||||
# group: COMMON_GROUP
|
||||
# refresh: true
|
||||
@@ -52,4 +52,7 @@
|
||||
<appender-ref ref="debug"/>
|
||||
<appender-ref ref="error"/>
|
||||
</root>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<!-- 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>
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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,5 +51,6 @@
|
||||
<root level="INFO">
|
||||
<appender-ref ref="debug"/>
|
||||
<appender-ref ref="error"/>
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>application-${profileActive}.yml</include>
|
||||
<include>application-*.yml</include>
|
||||
<include>application.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
@@ -136,9 +136,9 @@
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>pro</id>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<profileActive>pro</profileActive>
|
||||
<profileActive>prod</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# application-dev.yml
|
||||
# application-pro.yml
|
||||
spring:
|
||||
redis:
|
||||
database: 2
|
||||
port: 6379
|
||||
host: 192.168.0.101
|
||||
database: 1
|
||||
host: 192.168.0.253
|
||||
password: boe@123
|
||||
port: 6379
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
ddl-auto: update
|
||||
open-in-view: false
|
||||
properties:
|
||||
hibernate:
|
||||
@@ -16,41 +16,46 @@ spring:
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
db1:
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
jdbc-url: jdbc:mysql://192.168.0.101:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
jdbc-url: jdbc:mysql://192.168.0.253:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
username: root
|
||||
password: boe#1234A
|
||||
db2:
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
jdbc-url: jdbc:mysql://192.168.0.101:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
jdbc-url: jdbc:mysql://192.168.0.253:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
username: root
|
||||
password: boe#1234A
|
||||
web:
|
||||
resources:
|
||||
static-locations: file:E:/Projects/BOE/java/static
|
||||
|
||||
web:
|
||||
resources:
|
||||
static-locations: file:E:/Projects/BOE/java/static
|
||||
|
||||
logging:
|
||||
level:
|
||||
org:
|
||||
hibernate:
|
||||
SQL: DEBUG
|
||||
type:
|
||||
descriptor:
|
||||
sql:
|
||||
BasicBinder: TRACE
|
||||
SQL: ERROR
|
||||
# type:
|
||||
# descriptor:
|
||||
# sql:
|
||||
# BasicBinder: TRACE
|
||||
config: classpath:log/logback-dev.xml
|
||||
|
||||
|
||||
|
||||
xboe:
|
||||
api:
|
||||
cross_filter: true
|
||||
upload:
|
||||
file:
|
||||
temp_path: E:/Projects/BOE/java/static/temp
|
||||
save_path: E:/Projects/BOE/java/static/upload
|
||||
http_path: http://localhost:9090/upload
|
||||
temp_path: /tmp
|
||||
save_path: /home/www/elearning/upload
|
||||
http_path: http://192.168.0.253/upload
|
||||
inner:
|
||||
data:
|
||||
sync:
|
||||
baseurl: http://localhost:9090
|
||||
baseurl: http://127.0.0.1:9090
|
||||
|
||||
jasypt:
|
||||
encryptor:
|
||||
algorithm: PBEWithMD5AndDES
|
||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||
iv-generator-classname: org.jasypt.iv.NoIvGenerator
|
||||
@@ -1,9 +1,7 @@
|
||||
# application-pro.yml
|
||||
spring:
|
||||
profiles:
|
||||
active: pro
|
||||
redis:
|
||||
database: 3
|
||||
database: 1
|
||||
host: 10.251.88.213
|
||||
password: qwert!W588
|
||||
port: 6379
|
||||
@@ -1,7 +1,7 @@
|
||||
# application.yml
|
||||
spring:
|
||||
profiles:
|
||||
active: @profileActive@
|
||||
active: dev
|
||||
application:
|
||||
name: boe-server-basic
|
||||
jackson:
|
||||
@@ -62,4 +62,4 @@ ok:
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging:
|
||||
config: classpath:log/logback-@profileActive@.xml
|
||||
config: classpath:log/logback-${spring.profiles.active}.xml
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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