mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 09:26:48 +08:00
szx-1279 增加监控表
This commit is contained in:
@@ -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,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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ import javax.management.Query;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
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.dao.*;
|
||||||
@@ -116,6 +117,9 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
@Resource
|
@Resource
|
||||||
private CourseTeacherDeletedRecordDao courseTeacherDeletedRecordDao;
|
private CourseTeacherDeletedRecordDao courseTeacherDeletedRecordDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ModifyLogDao modifyLogDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成过滤条件
|
* 生成过滤条件
|
||||||
*
|
*
|
||||||
@@ -910,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()) {
|
||||||
@@ -1000,6 +1005,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.saveOrUpdate(ct);
|
courseTeacherDao.saveOrUpdate(ct);
|
||||||
|
addBoeCourseTeacherModifyLog(ct, "M2位置讲师名修改", JSONUtil.toJsonStr(ct), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||||
@@ -1056,6 +1062,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.saveOrUpdate(ct);
|
courseTeacherDao.saveOrUpdate(ct);
|
||||||
|
addBoeCourseTeacherModifyLog(ct, "M3位置讲师名修改", JSONUtil.toJsonStr(ct), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||||
@@ -1093,6 +1100,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.saveOrUpdate(ct);
|
courseTeacherDao.saveOrUpdate(ct);
|
||||||
|
addBoeCourseTeacherModifyLog(ct, "M4位置讲师名修改", JSONUtil.toJsonStr(ct), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||||
@@ -2030,4 +2038,20 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user