mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
Compare commits
12 Commits
feature/20
...
20250916-f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
880a9b5cc9 | ||
|
|
ab60d845e0 | ||
|
|
80aaeb8d1d | ||
|
|
68fcde11fb | ||
|
|
57dc5262fb | ||
|
|
62bda8bd58 | ||
|
|
8403678d0d | ||
|
|
02c0fa13dd | ||
|
|
de96d311c6 | ||
|
|
2456820251 | ||
|
|
12c07faf2a | ||
|
|
fea28d8832 |
@@ -1,12 +1,27 @@
|
||||
package com.xboe.module.course.dao;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Repository
|
||||
public class CourseTeacherDao extends BaseDao<CourseTeacher> {
|
||||
|
||||
//List<CourseTeacher>
|
||||
//List<CourseTeacher>
|
||||
|
||||
public List<CourseTeacher> findByCourseId(String courseId) {
|
||||
try {
|
||||
return sqlFindList("SELECT * FROM boe_course_teacher WHERE course_id = ?1", courseId);
|
||||
} catch (Exception e) {
|
||||
log.warn("查询课程教师列表失败", e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xboe.module.course.dao;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.entity.CourseTeacherModifyRecord;
|
||||
import com.xboe.module.course.util.RequestIdUtil;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author guo jia
|
||||
*/
|
||||
@Repository
|
||||
public class CourseTeacherModifyRecordDao extends BaseDao<CourseTeacherModifyRecord> {
|
||||
|
||||
public void insertRecord(String type, String location, CourseTeacher courseTeacher, String body) {
|
||||
CourseTeacherModifyRecord entity = new CourseTeacherModifyRecord();
|
||||
entity.setRequestId(RequestIdUtil.getCurrentRequestId());
|
||||
entity.setType(type);
|
||||
entity.setLocation(location);
|
||||
entity.setTeacherId(courseTeacher.getTeacherId());
|
||||
entity.setTeacherName(courseTeacher.getTeacherName());
|
||||
entity.setCourseId(courseTeacher.getCourseId());
|
||||
entity.setBody(body);
|
||||
entity.setDeleted(0);
|
||||
entity.setCreateTime(LocalDateTime.now());
|
||||
entity.setUpdateTime(LocalDateTime.now());
|
||||
save(entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.xboe.module.course.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 讲师操作记录表
|
||||
* 为了监控PngCode-SZX-1241问题临时创建的表
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "course_teacher_modify_record")
|
||||
public class CourseTeacherModifyRecord {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 请求ID
|
||||
* 同一个请求ID表示删除操作是在一次请求中完成的
|
||||
*/
|
||||
private String requestId;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
* INSERT、UPDATE、DELETE
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 讲师账号ID
|
||||
*/
|
||||
private String teacherId;
|
||||
|
||||
/**
|
||||
* 讲师姓名
|
||||
*/
|
||||
private String teacherName;
|
||||
|
||||
/**
|
||||
* 在线课ID
|
||||
*/
|
||||
private String courseId;
|
||||
|
||||
/**
|
||||
* 请求体
|
||||
*/
|
||||
private String body;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 更新人ID
|
||||
*/
|
||||
private Long updateId;
|
||||
}
|
||||
@@ -1,38 +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;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
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;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.xboe.TempFilterConfig;
|
||||
import com.xboe.account.service.IAccountService;
|
||||
import com.xboe.common.OrderCondition;
|
||||
@@ -41,31 +9,39 @@ import com.xboe.common.beans.KeyValue;
|
||||
import com.xboe.common.utils.IDGenerator;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
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.core.orm.*;
|
||||
import com.xboe.module.course.dao.*;
|
||||
import com.xboe.module.course.dto.CourseFullDto;
|
||||
import com.xboe.module.course.dto.CourseQueryDto;
|
||||
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.entity.*;
|
||||
import com.xboe.module.course.service.ICourseFullTextSearch;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.interaction.service.ICourseGradeService;
|
||||
import com.xboe.system.authority.service.IResDataManagerService;
|
||||
import com.xboe.system.logs.dao.SysLogAuditDao;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -125,7 +101,8 @@ public class CourseServiceImpl implements ICourseService {
|
||||
@Resource
|
||||
RestHighLevelClient restHighLevelClient;
|
||||
|
||||
|
||||
@Resource
|
||||
private CourseTeacherModifyRecordDao courseTeacherModifyRecordDao;
|
||||
|
||||
/**
|
||||
* 生成过滤条件
|
||||
@@ -837,6 +814,23 @@ public class CourseServiceImpl implements ICourseService {
|
||||
|
||||
@Override
|
||||
public void delete(String id, boolean erasable, String aid, String name, String remark) {
|
||||
// 增加操作boe_course_teacher表记录
|
||||
String body = "courseId=" + id + " aid=" + aid + " name=" + name + " remark=" + remark;
|
||||
String location = "/xboe/m/course/manage/delete";
|
||||
List<CourseTeacher> teacherList = courseTeacherDao.findByCourseId(id);
|
||||
String jsonStr = JSONUtil.toJsonStr(teacherList);
|
||||
log.info("teacherList:{}", jsonStr);
|
||||
try {
|
||||
List<List> list = JSONUtil.toList(jsonStr, List.class);
|
||||
list.forEach(item -> {
|
||||
for (Object teacher : item) {
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", location, (CourseTeacher) teacher, body);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("增加操作boe_course_teacher表记录失败", e);
|
||||
}
|
||||
|
||||
if (!erasable) {
|
||||
courseDao.setDeleted(id);
|
||||
courseDao.updateFieldById(id, "name", "已删除" + name);
|
||||
@@ -920,6 +914,9 @@ public class CourseServiceImpl implements ICourseService {
|
||||
for (CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.save(ct);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", "/xboe/m/course/manage/save", ct, JSONUtil.toJsonStr(full));
|
||||
}
|
||||
}
|
||||
if (full.getCrowds() != null && !full.getCrowds().isEmpty()) {
|
||||
@@ -1002,12 +999,29 @@ public class CourseServiceImpl implements ICourseService {
|
||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||
full.getCourse().setSysVersion(c.getSysVersion());
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
String body = null;
|
||||
String location = null;
|
||||
try {
|
||||
body = JSONUtil.toJsonStr(full);
|
||||
location = "/xboe/m/course/manage/save";
|
||||
List<CourseTeacher> teacherList = courseTeacherDao.findByCourseId(c.getId());
|
||||
for (CourseTeacher teacher : teacherList) {
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", location, teacher, body);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("增加操作boe_course_teacher表记录失败", e);
|
||||
}
|
||||
|
||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
||||
for (CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.saveOrUpdate(ct);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
courseTeacherModifyRecordDao.insertRecord("INSERT", location, ct, body);
|
||||
}
|
||||
}
|
||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||
@@ -1056,12 +1070,29 @@ public class CourseServiceImpl implements ICourseService {
|
||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||
full.getCourse().setSysVersion(c.getSysVersion());
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
String body = null;
|
||||
String location = null;
|
||||
try {
|
||||
body = JSONUtil.toJsonStr(full);
|
||||
location = "/xboe/m/course/manage/submit";
|
||||
List<CourseTeacher> teacherList = courseTeacherDao.findByCourseId(c.getId());
|
||||
for (CourseTeacher teacher : teacherList) {
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", location, teacher, body);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("增加操作boe_course_teacher表记录失败", e);
|
||||
}
|
||||
|
||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
||||
for (CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.saveOrUpdate(ct);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
courseTeacherModifyRecordDao.insertRecord("INSERT", location, ct, body);
|
||||
}
|
||||
}
|
||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||
@@ -1091,12 +1122,29 @@ public class CourseServiceImpl implements ICourseService {
|
||||
c.setPublishTime(LocalDateTime.now());
|
||||
courseDao.update(c);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
String body = null;
|
||||
String location = null;
|
||||
try {
|
||||
body = "body=" + JSONUtil.toJsonStr(full) + " aid=[" + aid + "] aname=[" + aname + "] ";
|
||||
location = "/xboe/m/course/audit/submit-publish";
|
||||
List<CourseTeacher> teacherList = courseTeacherDao.findByCourseId(c.getId());
|
||||
for (CourseTeacher teacher : teacherList) {
|
||||
courseTeacherModifyRecordDao.insertRecord("DELETE", location, teacher, body);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("增加操作boe_course_teacher表记录失败", e);
|
||||
}
|
||||
|
||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||
if (full.getTeachers() != null && !full.getTeachers().isEmpty()) {
|
||||
for (CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.saveOrUpdate(ct);
|
||||
|
||||
// 增加操作boe_course_teacher表记录
|
||||
courseTeacherModifyRecordDao.insertRecord("INSERT", location, ct, body);
|
||||
}
|
||||
}
|
||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.xboe.module.course.util;
|
||||
|
||||
import cn.hutool.core.util.HexUtil;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
/**
|
||||
* @author guo jia
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class RequestIdUtil {
|
||||
|
||||
private static final SecureRandom RANDOM = new SecureRandom();
|
||||
|
||||
public static final String REQUEST_ID_KEY = "requestId";
|
||||
|
||||
public static String genRequestId() {
|
||||
byte[] bytes = new byte[8];
|
||||
RequestIdUtil.RANDOM.nextBytes(bytes);
|
||||
return HexUtil.encodeHexStr(bytes);
|
||||
}
|
||||
|
||||
public static void genAndSetRequestId() {
|
||||
setRequestId(genRequestId());
|
||||
}
|
||||
|
||||
public static void setRequestId(String requestId) {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
request.setAttribute(REQUEST_ID_KEY, requestId);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCurrentRequestId() {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
String requestId = null;
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
requestId = (String) request.getAttribute(REQUEST_ID_KEY);
|
||||
}
|
||||
return requestId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -592,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);
|
||||
|
||||
Reference in New Issue
Block a user