|
@@ -1,6 +1,7 @@
|
|
|
package com.zhongzheng.modules.course.service.impl;
|
|
package com.zhongzheng.modules.course.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -203,11 +204,15 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
errorLog+="第"+Index+"条:"+"节标题空白。\r\n";
|
|
errorLog+="第"+Index+"条:"+"节标题空白。\r\n";
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- System.out.println(sectionImport);
|
|
|
|
|
|
|
+
|
|
|
if(!Validator.isNotEmpty(sectionImport.getPublishStatus())){
|
|
if(!Validator.isNotEmpty(sectionImport.getPublishStatus())){
|
|
|
errorLog+="第"+Index+"条:"+"发布状态空白。\r\n";
|
|
errorLog+="第"+Index+"条:"+"发布状态空白。\r\n";
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
+ if(!sectionImport.getPublishStatus().equals("发布")&&!sectionImport.getPublishStatus().equals("未发布")){
|
|
|
|
|
+ errorLog+="第"+Index+"条:"+"发布状态错误。\r\n";
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
//业务层次,导入每条只有一条业务层次
|
|
//业务层次,导入每条只有一条业务层次
|
|
|
List<CourseSectionBusinessAddBo> businessList = new ArrayList<>();
|
|
List<CourseSectionBusinessAddBo> businessList = new ArrayList<>();
|
|
|
CourseSectionBusinessAddBo addBo = new CourseSectionBusinessAddBo();
|
|
CourseSectionBusinessAddBo addBo = new CourseSectionBusinessAddBo();
|
|
@@ -216,14 +221,14 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
errorLog+="第"+Index+"条:"+sectionImport.getEducationType()+"-该教育类型不存在。\r\n";
|
|
errorLog+="第"+Index+"条:"+sectionImport.getEducationType()+"-该教育类型不存在。\r\n";
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- Long projectId = findProjectId(sectionImport.getProject());
|
|
|
|
|
|
|
+ Long projectId = findProjectId(sectionImport.getProject(),eduId);
|
|
|
if(!Validator.isNotEmpty(projectId)){
|
|
if(!Validator.isNotEmpty(projectId)){
|
|
|
- errorLog+="第"+Index+"条:"+sectionImport.getProject()+"-该项目类型不存在。\r\n";
|
|
|
|
|
|
|
+ errorLog+="第"+Index+"条:"+sectionImport.getProject()+"-该项目类型不存在或者和教育类型不匹配。\r\n";
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- Long businessId = findBusinessId(sectionImport.getBusiness());
|
|
|
|
|
|
|
+ Long businessId = findBusinessId(sectionImport.getBusiness(),projectId);
|
|
|
if(!Validator.isNotEmpty(businessId)){
|
|
if(!Validator.isNotEmpty(businessId)){
|
|
|
- errorLog+="第"+Index+"条:"+sectionImport.getBusiness()+"-该业务层次不存在。\r\n";
|
|
|
|
|
|
|
+ errorLog+="第"+Index+"条:"+sectionImport.getBusiness()+"-该业务层次不存在或者和项目类型不匹配。\r\n";
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
Long subjectId = findSubjectId(sectionImport.getSubject());
|
|
Long subjectId = findSubjectId(sectionImport.getSubject());
|
|
@@ -256,15 +261,28 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
bo.setStatus(1);
|
|
bo.setStatus(1);
|
|
|
bo.setCoverUrl("oss/images/avatar/20211013/1634097664410_1397766697");
|
|
bo.setCoverUrl("oss/images/avatar/20211013/1634097664410_1397766697");
|
|
|
if(Validator.isNotEmpty(sectionImport.getLiveStartTime())){
|
|
if(Validator.isNotEmpty(sectionImport.getLiveStartTime())){
|
|
|
-
|
|
|
|
|
- System.out.println(sectionImport.getLiveStartTime());
|
|
|
|
|
- System.out.println("开始时间");
|
|
|
|
|
- /* Long startTime = sectionImport.getLiveStartTime().getTime()/1000;
|
|
|
|
|
- bo.setLiveStartTime(startTime);*/
|
|
|
|
|
|
|
+ if(sectionImport.getLiveStartTime().length()!=19){
|
|
|
|
|
+ errorLog+="第"+Index+"条:直播开始时间不对。\r\n";
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ try{
|
|
|
|
|
+ bo.setLiveStartTime(Convert.toLong(DateUtils.dateTimeThrow("yyyy-MM-dd HH:mm:ss",sectionImport.getLiveStartTime()).getTime())/1000);
|
|
|
|
|
+ }catch (ParseException e){
|
|
|
|
|
+ errorLog+="第"+Index+"条:直播开始时间不对。\r\n";
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
if(Validator.isNotEmpty(sectionImport.getLiveEndTime())){
|
|
if(Validator.isNotEmpty(sectionImport.getLiveEndTime())){
|
|
|
- /*Long endTime = sectionImport.getLiveEndTime().getTime()/1000;
|
|
|
|
|
- bo.setLiveEndTime(endTime);*/
|
|
|
|
|
|
|
+ if(sectionImport.getLiveStartTime().length()!=19){
|
|
|
|
|
+ errorLog+="第"+Index+"条:直播结束时间不对。\r\n";
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ try{
|
|
|
|
|
+ bo.setLiveEndTime(Convert.toLong(DateUtils.dateTimeThrow("yyyy-MM-dd HH:mm:ss",sectionImport.getLiveEndTime()).getTime())/1000);
|
|
|
|
|
+ }catch (ParseException e){
|
|
|
|
|
+ errorLog+="第"+Index+"条:直播结束时间不对。\r\n";
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
errorLog = insertByAddBoImport(bo,errorLog,Index);
|
|
errorLog = insertByAddBoImport(bo,errorLog,Index);
|
|
|
i++;
|
|
i++;
|
|
@@ -342,7 +360,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public Long findProjectId(String project){
|
|
|
|
|
|
|
+ public Long findProjectId(String project,Long eduId){
|
|
|
if(project!=null){
|
|
if(project!=null){
|
|
|
String key = "PROJ_"+project;
|
|
String key = "PROJ_"+project;
|
|
|
Long value = redisCache.getCacheObject(key);
|
|
Long value = redisCache.getCacheObject(key);
|
|
@@ -353,7 +371,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
return value;
|
|
return value;
|
|
|
}
|
|
}
|
|
|
CourseProjectType info = iCourseProjectTypeService.getOne(new LambdaQueryWrapper<CourseProjectType>()
|
|
CourseProjectType info = iCourseProjectTypeService.getOne(new LambdaQueryWrapper<CourseProjectType>()
|
|
|
- .eq(CourseProjectType::getProjectName,project).eq(CourseProjectType::getStatus,1).last("limit 1"));
|
|
|
|
|
|
|
+ .eq(CourseProjectType::getProjectName,project).eq(CourseProjectType::getEducationId,eduId).eq(CourseProjectType::getStatus,1).last("limit 1"));
|
|
|
if(info!=null){
|
|
if(info!=null){
|
|
|
redisCache.setCacheObject(key,info.getId(),3, TimeUnit.MINUTES);//3分钟
|
|
redisCache.setCacheObject(key,info.getId(),3, TimeUnit.MINUTES);//3分钟
|
|
|
return info.getId();
|
|
return info.getId();
|
|
@@ -364,7 +382,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public Long findBusinessId(String business){
|
|
|
|
|
|
|
+ public Long findBusinessId(String business,Long projectId){
|
|
|
if(business!=null){
|
|
if(business!=null){
|
|
|
String key = "BUS_"+business;
|
|
String key = "BUS_"+business;
|
|
|
Long value = redisCache.getCacheObject(key);
|
|
Long value = redisCache.getCacheObject(key);
|
|
@@ -375,7 +393,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
return value;
|
|
return value;
|
|
|
}
|
|
}
|
|
|
CourseBusiness info = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>()
|
|
CourseBusiness info = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>()
|
|
|
- .eq(CourseBusiness::getBusinessName,business).eq(CourseBusiness::getStatus,1).last("limit 1"));
|
|
|
|
|
|
|
+ .eq(CourseBusiness::getBusinessName,business).eq(CourseBusiness::getProjectId,projectId).eq(CourseBusiness::getStatus,1).last("limit 1"));
|
|
|
if(info!=null){
|
|
if(info!=null){
|
|
|
redisCache.setCacheObject(key,info.getId(),3, TimeUnit.MINUTES);//3分钟
|
|
redisCache.setCacheObject(key,info.getId(),3, TimeUnit.MINUTES);//3分钟
|
|
|
return info.getId();
|
|
return info.getId();
|