Compare commits

..

1 Commits

10 changed files with 168 additions and 184 deletions

View File

@@ -122,20 +122,13 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
//这里应该是单独的线程去处理
user.setId(getNodeText(result.get("userId")));//最新接口变化id改成userId
String band=getNodeText(result.get("bandCode"));
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")));
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")));
user.setCode(getNodeText(result.get("userNo")));
if(StringUtils.isBlank(user.getCode())) {

View File

@@ -2,16 +2,11 @@ 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;
@@ -44,9 +39,6 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService {
@Autowired
TeacherDao teacherDao;
@Resource
private CacheManager cacheManager;
@Override
@Transactional
@@ -67,8 +59,6 @@ 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 {
@@ -81,18 +71,14 @@ 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才会更新
@@ -120,17 +106,9 @@ 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());

View File

@@ -140,9 +140,6 @@ 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()) {

View File

@@ -314,10 +314,8 @@ 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") && ( t==null || t.getTeacherType() == 1)){
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
ct.setTeacherName("BOE教师");
}
teacherCourseDto.setCourseId(ct.getCourseId());
@@ -329,15 +327,13 @@ public class CoursePortalApi extends ApiBaseController{
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
teacherCourseDto.setId(ct.getId());
if(user!=null){
teacherCourseDto.setUserNo(user.getUserNo());
}
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") && ( t==null || t.getTeacherType() == 1)){
if(Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
ct.setTeacherName("BOE教师");
}
teacherCourseDto.setCourseId(ct.getCourseId());
@@ -349,9 +345,7 @@ public class CoursePortalApi extends ApiBaseController{
teacherCourseDto.setSysCreateBy(ct.getSysCreateBy());
teacherCourseDto.setSysCreateTime(ct.getSysCreateTime());
teacherCourseDto.setId(ct.getId());
if(user!=null){
teacherCourseDto.setUserNo(user.getUserNo());
}
teacherCourseDto.setUserNo(user.getUserNo());
teacherCourseDtos.add(teacherCourseDto);
}
}

View File

@@ -49,11 +49,4 @@ public class CourseTeacher extends IdBaseEntity {
@Transient
private String code;
/**供应商*/
@Transient
private String supplier;
/**讲师类型 1 内部讲师 2外部讲师*/
@Transient
private Integer teacherType;
}

View File

@@ -341,5 +341,8 @@ public interface ICourseService {
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
void deletedStudyResourceBatchByCourseIdAndType(String courseId,Integer courseType);
}

View File

@@ -1,6 +1,5 @@
package com.xboe.module.course.service.impl;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -20,11 +19,6 @@ 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;
@@ -121,9 +115,6 @@ public class CourseServiceImpl implements ICourseService {
@Autowired(required = false)
private IEventDataSender eventSender;
@Resource
RestHighLevelClient restHighLevelClient;
/**
@@ -457,7 +448,6 @@ 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;
}
@@ -490,7 +480,7 @@ public class CourseServiceImpl implements ICourseService {
String sql = "SELECT DISTINCT\n" +
"rt.course_id\n" +
"FROM\n" +
"boe_new.student s INNER JOIN boe_new.router_task rt on s.pid=rt.router_id inner join boe_course c on c.id=rt.course_id\n" +
"boe.student s INNER JOIN boe.router_task rt on s.pid=rt.router_id inner join boe_course c on c.id=rt.course_id\n" +
"\n" +
"WHERE\n" +
"\n" +
@@ -513,7 +503,7 @@ public class CourseServiceImpl implements ICourseService {
String sql = "SELECT DISTINCT\n" +
"pt.course_id\n" +
"FROM\n" +
"boe_new.student s INNER JOIN boe_new.project_task pt on s.pid=pt.project_id inner join boe_course c on c.id=pt.course_id\n" +
"boe.student s INNER JOIN boe.project_task pt on s.pid=pt.project_id inner join boe_course c on c.id=pt.course_id\n" +
"\n" +
"WHERE\n" +
"\n" +
@@ -570,8 +560,8 @@ public class CourseServiceImpl implements ICourseService {
String sql = "SELECT DISTINCT\n" +
"\tc.id \n" +
"FROM\n" +
"\tboe_new.student s\n" +
"\tINNER JOIN boe_new.grow_task gt ON s.pid = gt.grow_id\n" +
"\tboe.student s\n" +
"\tINNER JOIN boe.grow_task gt ON s.pid = gt.grow_id\n" +
"\tINNER JOIN boe_course c ON gt.course_id = c.id \n" +
"WHERE\n" +
"\ts.type = 14 \n" +
@@ -863,14 +853,12 @@ public class CourseServiceImpl implements ICourseService {
log.error("未配置事件消息发送的实现");
}
}
// 删除ES数据
deletedStudyResourceBatchByCourseIdAndType(id,c.getType());
} else {
//彻底删除,课件设置为无课程状态
courseDao.setDeleted(id);
}
//记录删除日志信息
}
@Override
@@ -1990,17 +1978,5 @@ 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();
}
}
}

View File

@@ -204,8 +204,6 @@ 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<>();
@@ -214,11 +212,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") && ( t==null || t.getTeacherType() == 1)){
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
ct.setTeacherName("BOE教师");
}
}
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1") && ( t==null || t.getTeacherType() == 1)){
if (Objects.equals(redisTemplate.opsForValue().get(ct.getTeacherId()), "1")){
ct.setTeacherName("BOE教师");
}
}

View File

@@ -1,102 +1,159 @@
boe:
domain: http://192.168.0.253
spring:
# application.yml
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
max-file-size: 500MB
max-request-size: 500MB
redis:
database: 1
host: 192.168.0.253
host: 192.168.0.101
password: boe@123
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: none
ddl-auto: update
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.0.253:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.0.101: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
web:
resources:
static-locations: file:E:/Projects/BOE/10/static
server:
port: 9090
servlet:
multipart:
max-file-size: 500MB
max-request-size: 500MB
session:
timeout: 30m
encoding:
charset: UTF-8
enabled: true
force: true
tomcat:
uri-encoding: UTF-8
servlet:
multipart:
maxFileSize: 1024MB
maxRequestSize: 1024MB
mvc:
static-path-pattern: /cdn/**
#logging.level.org.hibernate.SQL=DEBUG
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
#logging.config=classpath:log/logback-@profileActive@.xml
# logging:
# config: classpath:log/logback-${spring.profiles.active}.xml
# level:
# org:
# hibernate:
# SQL: DEBUG
# type:
# descriptor:
# sql:
# BasicBinder: TRACE
xcaching:
specs:
favorites:
timeout: 10s
praises:
timeout: 10s
shares:
timeout: 10s
xboe:
api:
cross_filter: true
local:
dev: true
upload:
file:
temp_path: /tmp
temp_path: D:/Projects/BOE/10/static/temp
save_path: /home/www/elearning/upload
http_path: http://192.168.0.253/upload
http_path: http://127.0.0.1/upload
externalinterface:
url:
system: http://127.0.0.1:9091
system: http://localhost:9091
old:
base:
url: http://192.168.0.253
url: http://192.168.0.101
server:
userbasic:
url: http://192.168.0.101/userbasic
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
ip: 192.168.0.101
port: 9200
user:
password:
email:
url: http://192.168.0.253/api/b1/email/send
url: http://192.168.0.101/api/b1/email/send
from: boeu_learning@boe.com.cn
user:
security:
jasypt:
encryptor:
algorithm: PBEWithMD5AndDES
iv-generator-classname: org.jasypt.iv.NoIvGenerator
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
jasypt:
encryptor:
algorithm: PBEWithMD5AndDES
iv-generator-classname: org.jasypt.iv.NoIvGenerator
boe:
domain: http://127.0.0.1
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

View File

@@ -1,13 +1,13 @@
# application-pro.yml
# application-dev.yml
spring:
redis:
database: 1
host: 192.168.0.253
password: boe@123
database: 2
port: 6379
host: 192.168.0.101
password: boe@123
jpa:
hibernate:
ddl-auto: update
ddl-auto: none
open-in-view: false
properties:
hibernate:
@@ -16,46 +16,41 @@ spring:
driverClassName: com.mysql.jdbc.Driver
db1:
driverClassName: com.mysql.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.0.253:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
jdbc-url: jdbc:mysql://192.168.0.101:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
username: root
password: boe#1234A
db2:
driverClassName: com.mysql.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.0.253:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
jdbc-url: jdbc:mysql://192.168.0.101:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
username: root
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: ERROR
# type:
# descriptor:
# sql:
# BasicBinder: TRACE
SQL: DEBUG
type:
descriptor:
sql:
BasicBinder: TRACE
config: classpath:log/logback-dev.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
temp_path: E:/Projects/BOE/java/static/temp
save_path: E:/Projects/BOE/java/static/upload
http_path: http://localhost:9090/upload
inner:
data:
sync:
baseurl: http://127.0.0.1:9090
baseurl: http://localhost:9090
jasypt:
encryptor:
algorithm: PBEWithMD5AndDES
iv-generator-classname: org.jasypt.iv.NoIvGenerator
iv-generator-classname: org.jasypt.iv.NoIvGenerator