mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 19:36:50 +08:00
提交课程为符合管理端的要求做的修改
This commit is contained in:
@@ -817,13 +817,20 @@ public class CourseManageApi extends ApiBaseController{
|
||||
}
|
||||
|
||||
//@PostMapping("/copy")
|
||||
/**
|
||||
* 后续做的调整,增加反向关联
|
||||
* @param id
|
||||
* @param refId
|
||||
* @param refType
|
||||
* @return
|
||||
*/
|
||||
@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)){
|
||||
return badRequest("参数错误");
|
||||
}
|
||||
try {
|
||||
String mess = courseService.copyCourse(id);
|
||||
String mess = courseService.copyCourse(id,refId,refType);
|
||||
if(StringUtils.isBlank(mess)){
|
||||
return success(true);
|
||||
}else{
|
||||
|
||||
@@ -109,4 +109,9 @@ public class CourseQueryDto {
|
||||
* 是否是超级管理员
|
||||
*/
|
||||
private Boolean isSystemAdmin;
|
||||
|
||||
private Boolean visible;
|
||||
|
||||
private String refId;
|
||||
private String refType;
|
||||
}
|
||||
|
||||
@@ -349,6 +349,18 @@ public class Course extends BaseEntity {
|
||||
@Column(name = "open_course", length = 1,columnDefinition = "int comment '是否公开课,0表非公开课,1表公开课'")
|
||||
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
|
||||
private String orgName;
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ public interface ICourseService {
|
||||
* 复制课程
|
||||
* @param id
|
||||
*/
|
||||
String copyCourse(String id);
|
||||
String copyCourse(String id,String refId,String refType);
|
||||
|
||||
/**
|
||||
* 更新课程内容,是否记录修改日志
|
||||
|
||||
@@ -147,6 +147,16 @@ public class CourseServiceImpl implements ICourseService {
|
||||
if(StringUtils.isNotBlank(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()==Course.DEVICE_PC) {
|
||||
@@ -461,6 +471,9 @@ public class CourseServiceImpl implements ICourseService {
|
||||
if(course.getSource()==null) {
|
||||
course.setSource(1);//来源内部
|
||||
}
|
||||
if(course.getVisible()==null) {
|
||||
course.setVisible(true);
|
||||
}
|
||||
courseDao.save(course);
|
||||
|
||||
}
|
||||
@@ -638,7 +651,9 @@ public class CourseServiceImpl implements ICourseService {
|
||||
updateLog.setLogData(strJson);
|
||||
updateLogDao.save(updateLog);
|
||||
}
|
||||
|
||||
if(c.getVisible()==null) {
|
||||
c.setVisible(true);
|
||||
}
|
||||
courseDao.update(c);
|
||||
c.setSysVersion(courseDao.getVersion(c.getId()));
|
||||
full.getCourse().setSysVersion(c.getSysVersion());
|
||||
@@ -672,6 +687,9 @@ public class CourseServiceImpl implements ICourseService {
|
||||
public void submit(CourseFullDto full) throws Exception {
|
||||
|
||||
Course c=full.getCourse();//当前的课程信息
|
||||
if(c.getVisible()==null) {
|
||||
c.setVisible(true);
|
||||
}
|
||||
//提交审核,不再记录修改日志
|
||||
// Course nowCourse=courseDao.get(c.getId());//修改之前的课程信息
|
||||
// //审核不保存日志了
|
||||
@@ -948,7 +966,6 @@ public class CourseServiceImpl implements ICourseService {
|
||||
}
|
||||
}else {
|
||||
courseDao.updateMultiFieldById(id,UpdateBuilder.create("published", pass));
|
||||
|
||||
if(this.fullTextSearch!=null) {
|
||||
Object fullId=courseDao.findField("fullTextId", FieldFilters.eq("id", id));
|
||||
if(fullId!=null) {
|
||||
@@ -1471,25 +1488,35 @@ public class CourseServiceImpl implements ICourseService {
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
@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
|
||||
// insert info select
|
||||
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 courseName = this.courseName(id);
|
||||
String mess=null;
|
||||
if(courseName.length()<96) {
|
||||
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," +
|
||||
"erasable,favorites,for_scene,for_users,is_top,keywords,name,open_object," +
|
||||
"overview,pass_formula,praises,publish_time,published,res_owner1,res_owner2," +
|
||||
"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," +
|
||||
"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," +
|
||||
"erasable,0,for_scene,for_users,0,keywords,'" + courseName + "(1)" + "',open_object," +
|
||||
"overview,pass_formula,0,publish_time,0,res_owner1,res_owner2," +
|
||||
|
||||
@@ -59,7 +59,10 @@ public class PublishCourseUtil {
|
||||
CourseFullText cft=CourseToCourseFullText.convert(c);
|
||||
|
||||
try {
|
||||
|
||||
//不可见的,不会对课程发布到ES中
|
||||
if(c.getVisible()!=null && !c.getVisible()) {
|
||||
return;
|
||||
}
|
||||
//计算课程时长
|
||||
int duration=courseContentDao.sumDurationByCourseId(c.getId());
|
||||
cft.setDuration(duration);
|
||||
|
||||
Reference in New Issue
Block a user