mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46:50 +08:00
Compare commits
5 Commits
feature/20
...
20251031-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ede914452 | ||
|
|
309599f43f | ||
|
|
20e3b001d5 | ||
|
|
a37f90aeaa | ||
|
|
e767345c1e |
@@ -56,11 +56,12 @@ public class EmailServiceImpl implements IEmailService {
|
|||||||
String cfgWord=SysConstant.getConfigValue("xboe.email.security");
|
String cfgWord=SysConstant.getConfigValue("xboe.email.security");
|
||||||
|
|
||||||
Map<String,Object> data=new HashMap<String,Object>();
|
Map<String,Object> data=new HashMap<String,Object>();
|
||||||
// php剥离,不再使用老系统发邮件,使用基础服务的发邮件功能
|
data.put("to",to);
|
||||||
data.put("email",to);
|
data.put("subject",subject);
|
||||||
data.put("title",subject);
|
|
||||||
data.put("content", htmlMsg);
|
data.put("content", htmlMsg);
|
||||||
data.put("userName", cfgUser);
|
data.put("fromName", cfgFrom);
|
||||||
|
data.put("cc", "");
|
||||||
|
data.put("type", 0);
|
||||||
ObjectMapper mapper=new ObjectMapper();
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
String json=mapper.writeValueAsString(data);
|
String json=mapper.writeValueAsString(data);
|
||||||
|
|
||||||
|
|||||||
@@ -358,8 +358,10 @@ public class CourseAuditApi extends ApiBaseController{
|
|||||||
//修改在线课开课状态=已开课
|
//修改在线课开课状态=已开课
|
||||||
String token = request.getHeader("Xboe-Access-Token");
|
String token = request.getHeader("Xboe-Access-Token");
|
||||||
CourseParam param = new CourseParam();
|
CourseParam param = new CourseParam();
|
||||||
param.setId(courseId);
|
param.setId(c.getId());
|
||||||
thirdApi.updateOnLineStatua(param,token);
|
param.setOrgId(c.getOrgId());
|
||||||
|
param.setOrgName(c.getOrgName());
|
||||||
|
thirdApi.updateOrSaveCourse(param,token);
|
||||||
}
|
}
|
||||||
return success(true);
|
return success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ public class CourseFileApi extends ApiBaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("读取视频时长错误");
|
log.error("读取视频时长错误", e);
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xboe.module.course.dao;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.BaseDao;
|
||||||
|
import com.xboe.module.course.entity.CourseTeacherDeletedRecord;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class CourseTeacherDeletedRecordDao extends BaseDao<CourseTeacherDeletedRecord> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xboe.module.course.dao;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.BaseDao;
|
||||||
|
import com.xboe.module.course.entity.ModifyLog;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class ModifyLogDao extends BaseDao<ModifyLog> {
|
||||||
|
|
||||||
|
public void insert(String requestId, String location, String body, String remark) {
|
||||||
|
ModifyLog entity = new ModifyLog();
|
||||||
|
entity.setRequestId(requestId);
|
||||||
|
entity.setLocation(location);
|
||||||
|
entity.setBody(body);
|
||||||
|
entity.setRemark(remark);
|
||||||
|
|
||||||
|
save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.xboe.module.course.entity;
|
||||||
|
|
||||||
|
import com.xboe.core.SysConstant;
|
||||||
|
import com.xboe.core.orm.IdBaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程任课教师删除记录
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Table(name = SysConstant.TABLE_PRE + "course_teacher_deleted_record")
|
||||||
|
public class CourseTeacherDeletedRecord extends IdBaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程id
|
||||||
|
*/
|
||||||
|
@Column(name = "course_id", nullable = false, length = 20)
|
||||||
|
private String courseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教师id,实际上就是aid
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column(name = "teacher_id", nullable = false, length = 20)
|
||||||
|
private String teacherId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教师姓名
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column(name = "teacher_name", length = 30)
|
||||||
|
private String teacherName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.xboe.module.course.entity;
|
||||||
|
|
||||||
|
import com.xboe.core.SysConstant;
|
||||||
|
import com.xboe.core.orm.IdBaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 讲师删除记录表
|
||||||
|
* 为了监控PngCode-SZX-1227问题临时创建的表
|
||||||
|
*
|
||||||
|
* @author guo jia
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Table(name = SysConstant.TABLE_PRE + "modify_log")
|
||||||
|
public class ModifyLog extends IdBaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求ID
|
||||||
|
*/
|
||||||
|
private String requestId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 位置
|
||||||
|
*/
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求body
|
||||||
|
*/
|
||||||
|
private String body;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注信息
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,9 +15,13 @@ import java.util.stream.Stream;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.management.Query;
|
import javax.management.Query;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.xboe.api.ThirdApi;
|
import com.xboe.api.ThirdApi;
|
||||||
import com.xboe.core.orm.*;
|
import com.xboe.core.orm.*;
|
||||||
|
import com.xboe.module.course.dao.*;
|
||||||
|
import com.xboe.module.course.entity.*;
|
||||||
import com.xboe.school.study.dao.StudyCourseDao;
|
import com.xboe.school.study.dao.StudyCourseDao;
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -41,24 +45,9 @@ import com.xboe.common.beans.KeyValue;
|
|||||||
import com.xboe.common.utils.IDGenerator;
|
import com.xboe.common.utils.IDGenerator;
|
||||||
import com.xboe.common.utils.StringUtil;
|
import com.xboe.common.utils.StringUtil;
|
||||||
import com.xboe.core.event.IEventDataSender;
|
import com.xboe.core.event.IEventDataSender;
|
||||||
import com.xboe.module.course.dao.CourseContentDao;
|
|
||||||
import com.xboe.module.course.dao.CourseCrowdDao;
|
|
||||||
import com.xboe.module.course.dao.CourseDao;
|
|
||||||
import com.xboe.module.course.dao.CourseExamDao;
|
|
||||||
import com.xboe.module.course.dao.CourseHRBPAuditDao;
|
|
||||||
import com.xboe.module.course.dao.CourseHomeWorkDao;
|
|
||||||
import com.xboe.module.course.dao.CourseSectionDao;
|
|
||||||
import com.xboe.module.course.dao.CourseTeacherDao;
|
|
||||||
import com.xboe.module.course.dao.CourseUpdateLogDao;
|
|
||||||
import com.xboe.module.course.dto.CourseFullDto;
|
import com.xboe.module.course.dto.CourseFullDto;
|
||||||
import com.xboe.module.course.dto.CourseQueryDto;
|
import com.xboe.module.course.dto.CourseQueryDto;
|
||||||
import com.xboe.module.course.dto.RankingDto;
|
import com.xboe.module.course.dto.RankingDto;
|
||||||
import com.xboe.module.course.entity.Course;
|
|
||||||
import com.xboe.module.course.entity.CourseCrowd;
|
|
||||||
import com.xboe.module.course.entity.CourseHRBPAudit;
|
|
||||||
import com.xboe.module.course.entity.CourseSection;
|
|
||||||
import com.xboe.module.course.entity.CourseTeacher;
|
|
||||||
import com.xboe.module.course.entity.CourseUpdateLog;
|
|
||||||
import com.xboe.module.course.service.ICourseFullTextSearch;
|
import com.xboe.module.course.service.ICourseFullTextSearch;
|
||||||
import com.xboe.module.course.service.ICourseService;
|
import com.xboe.module.course.service.ICourseService;
|
||||||
import com.xboe.module.interaction.service.ICourseGradeService;
|
import com.xboe.module.interaction.service.ICourseGradeService;
|
||||||
@@ -125,8 +114,12 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
@Resource
|
@Resource
|
||||||
RestHighLevelClient restHighLevelClient;
|
RestHighLevelClient restHighLevelClient;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CourseTeacherDeletedRecordDao courseTeacherDeletedRecordDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ModifyLogDao modifyLogDao;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成过滤条件
|
* 生成过滤条件
|
||||||
*
|
*
|
||||||
@@ -183,7 +176,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
filters.add(FieldFilters.in("device", Course.DEVICE_MOBILE, Course.DEVICE_ALL));
|
filters.add(FieldFilters.in("device", Course.DEVICE_MOBILE, Course.DEVICE_ALL));
|
||||||
} else if (dto.getDevice() == Course.DEVICE_ALL) {
|
} else if (dto.getDevice() == Course.DEVICE_ALL) {
|
||||||
filters.add(FieldFilters.eq("device", Course.DEVICE_ALL));
|
filters.add(FieldFilters.eq("device", Course.DEVICE_ALL));
|
||||||
}else if (dto.getDevice() == Course.DEVICE_INTERNAL) {
|
} else if (dto.getDevice() == Course.DEVICE_INTERNAL) {
|
||||||
filters.add(FieldFilters.eq("device", Course.DEVICE_INTERNAL));
|
filters.add(FieldFilters.eq("device", Course.DEVICE_INTERNAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,13 +274,13 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
//// Set<String>list=new HashSet<>();
|
//// Set<String>list=new HashSet<>();
|
||||||
//// if(s!=null&&!s.isEmpty()){
|
//// if(s!=null&&!s.isEmpty()){
|
||||||
//// list=Arrays.stream(s.split(",")).collect(Collectors.toSet());
|
//// list=Arrays.stream(s.split(",")).collect(Collectors.toSet());
|
||||||
//// }else {
|
//// }else {
|
||||||
//// Set<String> ss = getSeache(dto);
|
//// Set<String> ss = getSeache(dto);
|
||||||
//// String courseSearch=String.join(",",ss);
|
//// String courseSearch=String.join(",",ss);
|
||||||
//// redisTemplate.opsForValue().set("course_search",courseSearch);
|
//// redisTemplate.opsForValue().set("course_search",courseSearch);
|
||||||
//// //设置过期时间为1分钟
|
//// //设置过期时间为1分钟
|
||||||
//// redisTemplate.expire("course_search", 1, TimeUnit.MINUTES);
|
//// redisTemplate.expire("course_search", 1, TimeUnit.MINUTES);
|
||||||
//// }
|
//// }
|
||||||
// Set<String> list = getSeache(dto);
|
// Set<String> list = getSeache(dto);
|
||||||
// //有权限的查询,也同时查询出创建人的数据,在权限上
|
// //有权限的查询,也同时查询出创建人的数据,在权限上
|
||||||
// if(TempFilterConfig.Manager_CourseFile_ByOrgIds) {
|
// if(TempFilterConfig.Manager_CourseFile_ByOrgIds) {
|
||||||
@@ -367,8 +360,9 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
// // 使用distinct()配合自定义的去重条件
|
// // 使用distinct()配合自定义的去重条件
|
||||||
// .filter(distinctByKey(c -> c.getId()))
|
// .filter(distinctByKey(c -> c.getId()))
|
||||||
// .collect(Collectors.toList());
|
// .collect(Collectors.toList());
|
||||||
//// PageList<Course> rs=courseDao.findPage(pageIndex, pageSize, filters, oc);
|
|
||||||
//// long endTime = System.nanoTime();
|
/// / PageList<Course> rs=courseDao.findPage(pageIndex, pageSize, filters, oc);
|
||||||
|
/// / long endTime = System.nanoTime();
|
||||||
// //log.info("查询出的条数:"+rs.getCount());
|
// //log.info("查询出的条数:"+rs.getCount());
|
||||||
// if(!mergedList.isEmpty()){
|
// if(!mergedList.isEmpty()){
|
||||||
// //去掉未发布的课程
|
// //去掉未发布的课程
|
||||||
@@ -425,30 +419,30 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
if (TempFilterConfig.Manager_CourseFile_ByOrgIds) {
|
if (TempFilterConfig.Manager_CourseFile_ByOrgIds) {
|
||||||
if (dto.getIsSystemAdmin() == null || !dto.getIsSystemAdmin()) {
|
if (dto.getIsSystemAdmin() == null || !dto.getIsSystemAdmin()) {
|
||||||
List<String> finalStrings = strings;
|
List<String> finalStrings = strings;
|
||||||
log.info("dto为"+dto);
|
log.info("dto为" + dto);
|
||||||
if(dto.getIsCreateCourse()!=null&&dto.getIsCreateCourse()){
|
if (dto.getIsCreateCourse() != null && dto.getIsCreateCourse()) {
|
||||||
listByFilters2.removeIf(e -> {
|
listByFilters2.removeIf(e -> {
|
||||||
//去掉未发布的课程
|
//去掉未发布的课程
|
||||||
if (!e.getPublished() && seache.contains(e.getId()) && !finalStrings.contains(e.getOrgId()) && !dto.getOrgAid().equals(e.getSysCreateAid())) {
|
if (!e.getPublished() && seache.contains(e.getId()) && !finalStrings.contains(e.getOrgId()) && !dto.getOrgAid().equals(e.getSysCreateAid())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//去掉所有条件都不符合的课程
|
//去掉所有条件都不符合的课程
|
||||||
if(!seache.contains(e.getId())&&!dto.getReadIds().contains(e.getId())&& !finalStrings.contains(e.getOrgId()) && !dto.getOrgAid().equals(e.getSysCreateAid())){
|
if (!seache.contains(e.getId()) && !dto.getReadIds().contains(e.getId()) && !finalStrings.contains(e.getOrgId()) && !dto.getOrgAid().equals(e.getSysCreateAid())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
//将需要隐藏的做标记
|
//将需要隐藏的做标记
|
||||||
listByFilters2.forEach(e -> {
|
listByFilters2.forEach(e -> {
|
||||||
if ((seache.contains(e.getId())||dto.getReadIds().contains(e.getOrgId())) && !finalStrings.contains(e.getOrgId()) && !dto.getOrgAid().equals(e.getSysCreateAid())) {
|
if ((seache.contains(e.getId()) || dto.getReadIds().contains(e.getOrgId())) && !finalStrings.contains(e.getOrgId()) && !dto.getOrgAid().equals(e.getSysCreateAid())) {
|
||||||
e.setIsPermission(false);
|
e.setIsPermission(false);
|
||||||
} else {
|
} else {
|
||||||
e.setIsPermission(true);
|
e.setIsPermission(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
listByFilters2.sort(Comparator.comparing(Course::getIsPermission).reversed());
|
listByFilters2.sort(Comparator.comparing(Course::getIsPermission).reversed());
|
||||||
}else{
|
} else {
|
||||||
List<Course> collect = listByFilters2.stream().filter(e ->dto.getReadIds().contains(e.getOrgId())||dto.getOrgAid().equals(e.getSysCreateAid())||finalStrings.contains(e.getOrgId())).collect(Collectors.toList());
|
List<Course> collect = listByFilters2.stream().filter(e -> dto.getReadIds().contains(e.getOrgId()) || dto.getOrgAid().equals(e.getSysCreateAid()) || finalStrings.contains(e.getOrgId())).collect(Collectors.toList());
|
||||||
List<Course> paginate = paginate(collect, pageIndex, pageSize);
|
List<Course> paginate = paginate(collect, pageIndex, pageSize);
|
||||||
PageList<Course> rs = new PageList<>();
|
PageList<Course> rs = new PageList<>();
|
||||||
rs.setCount(collect.size());
|
rs.setCount(collect.size());
|
||||||
@@ -868,7 +862,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除ES数据
|
// 删除ES数据
|
||||||
deletedStudyResourceBatchByCourseIdAndType(id,c.getType());
|
deletedStudyResourceBatchByCourseIdAndType(id, c.getType());
|
||||||
} else {
|
} else {
|
||||||
//彻底删除,课件设置为无课程状态
|
//彻底删除,课件设置为无课程状态
|
||||||
courseDao.setDeleted(id);
|
courseDao.setDeleted(id);
|
||||||
@@ -920,6 +914,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
for (CourseTeacher ct : full.getTeachers()) {
|
for (CourseTeacher ct : full.getTeachers()) {
|
||||||
ct.setCourseId(c.getId());
|
ct.setCourseId(c.getId());
|
||||||
courseTeacherDao.save(ct);
|
courseTeacherDao.save(ct);
|
||||||
|
addBoeCourseTeacherModifyLog(ct, "M1位置讲师名修改", JSONUtil.toJsonStr(ct), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (full.getCrowds() != null && !full.getCrowds().isEmpty()) {
|
if (full.getCrowds() != null && !full.getCrowds().isEmpty()) {
|
||||||
@@ -1002,12 +997,15 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||||
full.getCourse().setSysVersion(c.getSysVersion());
|
full.getCourse().setSysVersion(c.getSysVersion());
|
||||||
|
|
||||||
|
// 兼容处理,记录下删除的关联数据
|
||||||
|
createCourseTeacherDeletedRecord(c.getId());
|
||||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||||
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
||||||
for (CourseTeacher ct : full.getTeachers()) {
|
for (CourseTeacher ct : full.getTeachers()) {
|
||||||
ct.setCourseId(c.getId());
|
ct.setCourseId(c.getId());
|
||||||
courseTeacherDao.saveOrUpdate(ct);
|
courseTeacherDao.saveOrUpdate(ct);
|
||||||
|
addBoeCourseTeacherModifyLog(ct, "M2位置讲师名修改", JSONUtil.toJsonStr(ct), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||||
@@ -1056,12 +1054,15 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||||
full.getCourse().setSysVersion(c.getSysVersion());
|
full.getCourse().setSysVersion(c.getSysVersion());
|
||||||
|
|
||||||
|
// 兼容处理,记录下删除的关联数据
|
||||||
|
createCourseTeacherDeletedRecord(c.getId());
|
||||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||||
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
||||||
for (CourseTeacher ct : full.getTeachers()) {
|
for (CourseTeacher ct : full.getTeachers()) {
|
||||||
ct.setCourseId(c.getId());
|
ct.setCourseId(c.getId());
|
||||||
courseTeacherDao.saveOrUpdate(ct);
|
courseTeacherDao.saveOrUpdate(ct);
|
||||||
|
addBoeCourseTeacherModifyLog(ct, "M3位置讲师名修改", JSONUtil.toJsonStr(ct), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||||
@@ -1091,12 +1092,15 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
c.setPublishTime(LocalDateTime.now());
|
c.setPublishTime(LocalDateTime.now());
|
||||||
courseDao.update(c);
|
courseDao.update(c);
|
||||||
|
|
||||||
|
// 兼容处理,记录下删除的关联数据
|
||||||
|
createCourseTeacherDeletedRecord(c.getId());
|
||||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||||
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
||||||
for (CourseTeacher ct : full.getTeachers()) {
|
for (CourseTeacher ct : full.getTeachers()) {
|
||||||
ct.setCourseId(c.getId());
|
ct.setCourseId(c.getId());
|
||||||
courseTeacherDao.saveOrUpdate(ct);
|
courseTeacherDao.saveOrUpdate(ct);
|
||||||
|
addBoeCourseTeacherModifyLog(ct, "M4位置讲师名修改", JSONUtil.toJsonStr(ct), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||||
@@ -2013,4 +2017,41 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除boe_course_teacher数据时把删除的数据储存到boe_course_teacher_deleted_record表
|
||||||
|
* boe_course_teacher表没有deleted字段,兼容处理
|
||||||
|
*
|
||||||
|
* @param courseId 课程ID
|
||||||
|
*/
|
||||||
|
private void createCourseTeacherDeletedRecord(String courseId) {
|
||||||
|
List<CourseTeacherDeletedRecord> courseTeacherList = courseTeacherDao.findList(FieldFilters.eq("courseId", courseId)).stream().map(ct -> {
|
||||||
|
CourseTeacherDeletedRecord courseTeacherDeletedRecord = new CourseTeacherDeletedRecord();
|
||||||
|
courseTeacherDeletedRecord.setCourseId(ct.getCourseId());
|
||||||
|
courseTeacherDeletedRecord.setTeacherId(ct.getTeacherId());
|
||||||
|
courseTeacherDeletedRecord.setTeacherName(ct.getTeacherName());
|
||||||
|
return courseTeacherDeletedRecord;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(courseTeacherList)) {
|
||||||
|
courseTeacherDeletedRecordDao.saveList(courseTeacherList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加boe_course_teacher的teacher_name字段被改为"BOE教师"的监控
|
||||||
|
*/
|
||||||
|
private void addBoeCourseTeacherModifyLog(CourseTeacher ct, String location, String body, String remark) {
|
||||||
|
try {
|
||||||
|
if (ct == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Objects.equals(ct.getTeacherName(), "BOE教师")) {
|
||||||
|
modifyLogDao.insert(null, location, body, remark);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("创建boe_course_teacher记录失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class PhpOnlineStudyRecordScheduledTasks {
|
|||||||
RestHighLevelClient restHighLevelClient;
|
RestHighLevelClient restHighLevelClient;
|
||||||
|
|
||||||
// todo 定时、分批、数据库名
|
// todo 定时、分批、数据库名
|
||||||
//@XxlJob("phpOnlineStudyRecordSyncEsTask")
|
@XxlJob("phpOnlineStudyRecordSyncEsTask")
|
||||||
public List<String> phpOnlineStudyRecordSyncEs(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
public List<String> phpOnlineStudyRecordSyncEs(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
||||||
|
|
||||||
log.info("开始同步PHP学习记录到ES");
|
log.info("开始同步PHP学习记录到ES");
|
||||||
|
|||||||
@@ -240,17 +240,17 @@ public class StudyCourseESApi extends ApiBaseController{
|
|||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
// @PostMapping("/phpOnlineStudyRecordSyncEs")
|
@PostMapping("/phpOnlineStudyRecordSyncEs")
|
||||||
// public JsonResponse<List<String>> phpOnlineStudyRecordSyncEs(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
public JsonResponse<List<String>> phpOnlineStudyRecordSyncEs(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
||||||
// List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEs(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
|
List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEs(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
|
||||||
// return success(courseStudyDtoList);
|
return success(courseStudyDtoList);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @PostMapping("/phpOnlineStudyRecordSyncEsOfFull")
|
@PostMapping("/phpOnlineStudyRecordSyncEsOfFull")
|
||||||
// public JsonResponse<List<String>> phpOnlineStudyRecordSyncEsOfFull(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
public JsonResponse<List<String>> phpOnlineStudyRecordSyncEsOfFull(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
|
||||||
// List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEsOfFull(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
|
List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEsOfFull(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
|
||||||
// return success(courseStudyDtoList);
|
return success(courseStudyDtoList);
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ xboe:
|
|||||||
user:
|
user:
|
||||||
password:
|
password:
|
||||||
email:
|
email:
|
||||||
url: http://u.boe.com/infrasApi/sendMsg/sendMail
|
url: https://u.boe.com/api/b1/email/send
|
||||||
from: boeu_learning@boe.com.cn
|
from: boeu_learning@boe.com.cn
|
||||||
user:
|
user:
|
||||||
security:
|
security:
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ xboe:
|
|||||||
user: elastic
|
user: elastic
|
||||||
password: Boe@es123
|
password: Boe@es123
|
||||||
email:
|
email:
|
||||||
url: http://127.0.0.1/infrasApi/sendMsg/sendMail
|
url: http://10.251.186.27/api/b1/email/send
|
||||||
from: boeu_learning@boe.com.cn
|
from: boeu_learning@boe.com.cn
|
||||||
user:
|
user:
|
||||||
security:
|
security:
|
||||||
|
|||||||
Reference in New Issue
Block a user