|
@@ -155,6 +155,8 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
return this.updateById(update);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 保存前的数据校验
|
|
|
*
|
|
@@ -163,7 +165,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
private void validEntityBeforeSave(CourseSection entity){
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
if(checkNameUnique(entity)){
|
|
|
- throw new CustomException("名称重复");
|
|
|
+ throw new CustomException("节标题重复");
|
|
|
}
|
|
|
if(entity.getSectionId()!=null&&entity.getPublishStatus()!=null&&entity.getPublishStatus()==0){
|
|
|
CourseMenu one = iCourseMenuService.getOne(new LambdaQueryWrapper<CourseMenu>().eq(CourseMenu::getMenuId, entity.getSectionId()).eq(CourseMenu::getType,3).last("limit 1"));
|
|
@@ -192,23 +194,25 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
String errorLog = "";
|
|
|
String importNo = ServletUtils.getEncoded("IMPORT");
|
|
|
int i=10;
|
|
|
+ int Index = 0;
|
|
|
for (CourseSectionImport sectionImport : sectionList) {
|
|
|
+ Index++;
|
|
|
CourseSectionAddBo bo = new CourseSectionAddBo();
|
|
|
if(!Validator.isNotEmpty(sectionImport.getName())){
|
|
|
- errorLog+="节标题空白\n";
|
|
|
+ errorLog+="第"+Index+"条:"+"节标题空白\n";
|
|
|
continue;
|
|
|
}
|
|
|
if(!Validator.isNotEmpty(sectionImport.getPrefixName())){
|
|
|
- errorLog+="标题前缀空白\n";
|
|
|
+ errorLog+="第"+Index+"条:"+"标题前缀空白\n";
|
|
|
continue;
|
|
|
}
|
|
|
if(!Validator.isNotEmpty(sectionImport.getPrefixName())){
|
|
|
- errorLog+="标题前缀空白\n";
|
|
|
+ errorLog+="第"+Index+"条:"+"标题前缀空白\n";
|
|
|
continue;
|
|
|
}
|
|
|
System.out.println(sectionImport);
|
|
|
if(!Validator.isNotEmpty(sectionImport.getPublishStatus())){
|
|
|
- errorLog+="发布状态空白\n";
|
|
|
+ errorLog+="第"+Index+"条:"+"发布状态空白\n";
|
|
|
continue;
|
|
|
}
|
|
|
//业务层次,导入每条只有一条业务层次
|
|
@@ -216,22 +220,27 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
CourseSectionBusinessAddBo addBo = new CourseSectionBusinessAddBo();
|
|
|
Long eduId = findEduId(sectionImport.getEducationType());
|
|
|
if(!Validator.isNotEmpty(eduId)){
|
|
|
- errorLog+=sectionImport.getEducationType()+"-该教育类型不存在\n";
|
|
|
+ errorLog+="第"+Index+"条:"+sectionImport.getEducationType()+"-该教育类型不存在\n";
|
|
|
continue;
|
|
|
}
|
|
|
Long projectId = findProjectId(sectionImport.getProject());
|
|
|
if(!Validator.isNotEmpty(projectId)){
|
|
|
- errorLog+=sectionImport.getProject()+"-该项目类型不存在\n";
|
|
|
+ errorLog+="第"+Index+"条:"+sectionImport.getProject()+"-该项目类型不存在\n";
|
|
|
continue;
|
|
|
}
|
|
|
Long businessId = findBusinessId(sectionImport.getBusiness());
|
|
|
if(!Validator.isNotEmpty(businessId)){
|
|
|
- errorLog+=sectionImport.getBusiness()+"-该业务层次不存在\n";
|
|
|
+ errorLog+="第"+Index+"条:"+sectionImport.getBusiness()+"-该业务层次不存在\n";
|
|
|
continue;
|
|
|
}
|
|
|
Long subjectId = findSubjectId(sectionImport.getSubject());
|
|
|
if(!Validator.isNotEmpty(subjectId)){
|
|
|
- errorLog+=sectionImport.getSubject()+"-该科目不存在\n";
|
|
|
+ errorLog+="第"+Index+"条:"+sectionImport.getSubject()+"-该科目不存在\n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Integer sectionType = findType(sectionImport.getSectionType());
|
|
|
+ if(!Validator.isNotEmpty(sectionType)){
|
|
|
+ errorLog+="第"+Index+"条:"+sectionImport.getSectionType()+"-该节类型不存在\n";
|
|
|
continue;
|
|
|
}
|
|
|
addBo.setEducationTypeId(eduId);
|
|
@@ -246,7 +255,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
bo.setBusinessList(businessList);
|
|
|
bo.setImportBy(operName);
|
|
|
bo.setImportNo(importNo);
|
|
|
- bo.setSectionType(findType(sectionImport.getSectionType()));
|
|
|
+ bo.setSectionType(sectionType);
|
|
|
bo.setDurationTime(sectionImport.getDurationTime());
|
|
|
bo.setRecordingUrl(sectionImport.getRecordingUrl());
|
|
|
bo.setLiveUrl(sectionImport.getLiveUrl());
|
|
@@ -261,7 +270,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
Long endTime = sectionImport.getLiveEndTime().getTime()/1000;
|
|
|
bo.setLiveEndTime(endTime);
|
|
|
}
|
|
|
- errorLog = insertByAddBoImport(bo,errorLog,i);
|
|
|
+ errorLog = insertByAddBoImport(bo,errorLog,Index);
|
|
|
i++;
|
|
|
}
|
|
|
return errorLog;
|
|
@@ -271,7 +280,9 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
public String insertByAddBoImport(CourseSectionAddBo bo, String errorLog, Integer no) {
|
|
|
CourseSection add = BeanUtil.toBean(bo, CourseSection.class);
|
|
|
add.setCode(ServletUtils.getEncoded("J"));
|
|
|
- validEntityBeforeSave(add);
|
|
|
+ if(checkNameUnique(add)){
|
|
|
+ return errorLog+"第"+no+"条:"+"节标题重复";
|
|
|
+ }
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
boolean result = this.save(add);
|
|
@@ -309,9 +320,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
else if("直播".equals(type)){
|
|
|
return 2;
|
|
|
}
|
|
|
- else if("回放".equals(type)){
|
|
|
- return 3;
|
|
|
- }
|
|
|
+
|
|
|
return null;
|
|
|
}
|
|
|
|