Compare commits

..

5 Commits

Author SHA1 Message Date
Caojr
4ede914452 szx-1279 增加监控表 2025-11-03 17:53:26 +08:00
Caojr
309599f43f 增加异常日志 2025-11-03 10:57:42 +08:00
Caojr
20e3b001d5 szx-1277 增加boe_course_teacher删除记录逻辑 2025-10-30 14:37:40 +08:00
Caojr
a37f90aeaa szx-1277 增加参数 2025-10-30 12:08:59 +08:00
Caojr
e767345c1e szx-1277 hrbp审核接口修改course服务调用接 2025-10-30 11:45:21 +08:00
12 changed files with 210 additions and 49 deletions

View File

@@ -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);

View File

@@ -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) {

View File

@@ -278,7 +278,7 @@ public class CourseFileApi extends ApiBaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.error("读取视频时长错误"); log.error("读取视频时长错误", e);
// e.printStackTrace(); // e.printStackTrace();
} }
} }

View File

@@ -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> {
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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,7 +114,11 @@ public class CourseServiceImpl implements ICourseService {
@Resource @Resource
RestHighLevelClient restHighLevelClient; RestHighLevelClient restHighLevelClient;
@Resource
private CourseTeacherDeletedRecordDao courseTeacherDeletedRecordDao;
@Resource
private ModifyLogDao modifyLogDao;
/** /**
* 生成过滤条件 * 生成过滤条件
@@ -367,6 +360,7 @@ 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); /// / PageList<Course> rs=courseDao.findPage(pageIndex, pageSize, filters, oc);
/// / long endTime = System.nanoTime(); /// / long endTime = System.nanoTime();
// //log.info("查询出的条数:"+rs.getCount()); // //log.info("查询出的条数:"+rs.getCount());
@@ -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);
}
}
} }

View File

@@ -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");

View File

@@ -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);
// } }
} }

View File

@@ -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:

View File

@@ -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: