提交课程为符合管理端的要求做的修改

This commit is contained in:
daihh
2023-03-02 16:09:46 +08:00
parent bcf5d108f6
commit bed13b49c9
6 changed files with 63 additions and 9 deletions

View File

@@ -817,13 +817,20 @@ public class CourseManageApi extends ApiBaseController{
} }
//@PostMapping("/copy") //@PostMapping("/copy")
/**
* 后续做的调整,增加反向关联
* @param id
* @param refId
* @param refType
* @return
*/
@RequestMapping(value="/copy",method = {RequestMethod.GET,RequestMethod.POST}) @RequestMapping(value="/copy",method = {RequestMethod.GET,RequestMethod.POST})
public JsonResponse<Boolean> copyCourse(String id){ public JsonResponse<Boolean> copyCourse(String id,String refId,String refType){
if(StringUtils.isBlank(id)){ if(StringUtils.isBlank(id)){
return badRequest("参数错误"); return badRequest("参数错误");
} }
try { try {
String mess = courseService.copyCourse(id); String mess = courseService.copyCourse(id,refId,refType);
if(StringUtils.isBlank(mess)){ if(StringUtils.isBlank(mess)){
return success(true); return success(true);
}else{ }else{

View File

@@ -109,4 +109,9 @@ public class CourseQueryDto {
* 是否是超级管理员 * 是否是超级管理员
*/ */
private Boolean isSystemAdmin; private Boolean isSystemAdmin;
private Boolean visible;
private String refId;
private String refType;
} }

View File

@@ -349,6 +349,18 @@ public class Course extends BaseEntity {
@Column(name = "open_course", length = 1,columnDefinition = "int comment '是否公开课0表非公开课1表公开课'") @Column(name = "open_course", length = 1,columnDefinition = "int comment '是否公开课0表非公开课1表公开课'")
private Integer openCourse; private Integer openCourse;
/**
* 是否可见
*/
@Column(name = "visible",columnDefinition = "bit comment '是否可见'")
private Boolean visible;
@Column(name = "ref_id",length=32,columnDefinition="varchar(32) comment '反向关联的id'")
private String refId;
@Column(name = "ref_type",length=32,columnDefinition="varchar(32) comment '反向关联的类型'")
private String refType;
@Transient @Transient
private String orgName; private String orgName;

View File

@@ -131,7 +131,7 @@ public interface ICourseService {
* 复制课程 * 复制课程
* @param id * @param id
*/ */
String copyCourse(String id); String copyCourse(String id,String refId,String refType);
/** /**
* 更新课程内容,是否记录修改日志 * 更新课程内容,是否记录修改日志

View File

@@ -148,6 +148,16 @@ public class CourseServiceImpl implements ICourseService {
filters.add(FieldFilters.eq("resOwner1",dto.getResOwner1())); filters.add(FieldFilters.eq("resOwner1",dto.getResOwner1()));
} }
if(StringUtils.isNotBlank(dto.getRefId())){
filters.add(FieldFilters.eq("refId",dto.getRefId()));
}
if(StringUtils.isNotBlank(dto.getRefType())){
filters.add(FieldFilters.eq("refType",dto.getRefType()));
}
// if(dto.getVisible()!=null) {
// filters.add(FieldFilters.eq("visible",dto.getVisible()));
// }
if(dto.getDevice()!=null){ if(dto.getDevice()!=null){
if(dto.getDevice()==Course.DEVICE_PC) { if(dto.getDevice()==Course.DEVICE_PC) {
filters.add(FieldFilters.in("device",Course.DEVICE_PC,Course.DEVICE_ALL)); filters.add(FieldFilters.in("device",Course.DEVICE_PC,Course.DEVICE_ALL));
@@ -461,6 +471,9 @@ public class CourseServiceImpl implements ICourseService {
if(course.getSource()==null) { if(course.getSource()==null) {
course.setSource(1);//来源内部 course.setSource(1);//来源内部
} }
if(course.getVisible()==null) {
course.setVisible(true);
}
courseDao.save(course); courseDao.save(course);
} }
@@ -638,7 +651,9 @@ public class CourseServiceImpl implements ICourseService {
updateLog.setLogData(strJson); updateLog.setLogData(strJson);
updateLogDao.save(updateLog); updateLogDao.save(updateLog);
} }
if(c.getVisible()==null) {
c.setVisible(true);
}
courseDao.update(c); courseDao.update(c);
c.setSysVersion(courseDao.getVersion(c.getId())); c.setSysVersion(courseDao.getVersion(c.getId()));
full.getCourse().setSysVersion(c.getSysVersion()); full.getCourse().setSysVersion(c.getSysVersion());
@@ -672,6 +687,9 @@ public class CourseServiceImpl implements ICourseService {
public void submit(CourseFullDto full) throws Exception { public void submit(CourseFullDto full) throws Exception {
Course c=full.getCourse();//当前的课程信息 Course c=full.getCourse();//当前的课程信息
if(c.getVisible()==null) {
c.setVisible(true);
}
//提交审核,不再记录修改日志 //提交审核,不再记录修改日志
// Course nowCourse=courseDao.get(c.getId());//修改之前的课程信息 // Course nowCourse=courseDao.get(c.getId());//修改之前的课程信息
// //审核不保存日志了 // //审核不保存日志了
@@ -948,7 +966,6 @@ public class CourseServiceImpl implements ICourseService {
} }
}else { }else {
courseDao.updateMultiFieldById(id,UpdateBuilder.create("published", pass)); courseDao.updateMultiFieldById(id,UpdateBuilder.create("published", pass));
if(this.fullTextSearch!=null) { if(this.fullTextSearch!=null) {
Object fullId=courseDao.findField("fullTextId", FieldFilters.eq("id", id)); Object fullId=courseDao.findField("fullTextId", FieldFilters.eq("id", id));
if(fullId!=null) { if(fullId!=null) {
@@ -1471,25 +1488,35 @@ public class CourseServiceImpl implements ICourseService {
@Transactional(propagation = Propagation.REQUIRED) @Transactional(propagation = Propagation.REQUIRED)
@Override @Override
public String copyCourse(String id) { public String copyCourse(String id,String refId,String refType) {
//复制课程,boe_course,boe_course_content,boe_course_homework,boe_course_section,boe_course_teacher,boe_course_exam //复制课程,boe_course,boe_course_content,boe_course_homework,boe_course_section,boe_course_teacher,boe_course_exam
// insert info select // insert info select
List<CourseSection> sectionList = courseSectionDao.findList("courseId", id); List<CourseSection> sectionList = courseSectionDao.findList("courseId", id);
if(refId==null) {
refId="";
}
if(refType==null) {
refType="";
}
boolean visible=true;
if(StringUtils.isNotBlank(refId)) {
visible=false;
}
String newId = IDGenerator.generate(); String newId = IDGenerator.generate();
String courseName = this.courseName(id); String courseName = this.courseName(id);
String mess=null; String mess=null;
if(courseName.length()<96) { if(courseName.length()<96) {
LocalDateTime time = LocalDateTime.now(); LocalDateTime time = LocalDateTime.now();
String sql = "insert into boe_course(id,sys_create_aid,sys_create_by,sys_create_time,deleted,sys_update_by," + String sql = "insert into boe_course(id,ref_id,ref_type,visible,sys_create_aid,sys_create_by,sys_create_time,deleted,sys_update_by," +
"sys_update_time,sys_version,comments,cover_img,dead_time,device,enable_remark,enabled," + "sys_update_time,sys_version,comments,cover_img,dead_time,device,enable_remark,enabled," +
"erasable,favorites,for_scene,for_users,is_top,keywords,name,open_object," + "erasable,favorites,for_scene,for_users,is_top,keywords,name,open_object," +
"overview,pass_formula,praises,publish_time,published,res_owner1,res_owner2," + "overview,pass_formula,praises,publish_time,published,res_owner1,res_owner2," +
"res_owner3,score,score_formula,shares,source,study_time,studys,summary," + "res_owner3,score,score_formula,shares,source,study_time,studys,summary," +
"sys_type1,sys_type2,sys_type3,tags,top_time,trample_count,type,value,views," + "sys_type1,sys_type2,sys_type3,tags,top_time,trample_count,type,value,views," +
"order_study,status)" + "order_study,status)" +
"select '" + newId + "',sys_create_aid,sys_create_by,'" + time + "',deleted,sys_update_by," + "select '" + newId + "','"+refId+"','"+refType+"',"+visible+",sys_create_aid,sys_create_by,'" + time + "',deleted,sys_update_by," +
"'" + time + "',sys_version,comments,cover_img,dead_time,device,enable_remark,enabled," + "'" + time + "',sys_version,comments,cover_img,dead_time,device,enable_remark,enabled," +
"erasable,0,for_scene,for_users,0,keywords,'" + courseName + "(1)" + "',open_object," + "erasable,0,for_scene,for_users,0,keywords,'" + courseName + "(1)" + "',open_object," +
"overview,pass_formula,0,publish_time,0,res_owner1,res_owner2," + "overview,pass_formula,0,publish_time,0,res_owner1,res_owner2," +

View File

@@ -59,7 +59,10 @@ public class PublishCourseUtil {
CourseFullText cft=CourseToCourseFullText.convert(c); CourseFullText cft=CourseToCourseFullText.convert(c);
try { try {
//不可见的不会对课程发布到ES中
if(c.getVisible()!=null && !c.getVisible()) {
return;
}
//计算课程时长 //计算课程时长
int duration=courseContentDao.sumDurationByCourseId(c.getId()); int duration=courseContentDao.sumDurationByCourseId(c.getId());
cft.setDuration(duration); cft.setDuration(duration);