|
|
|
@ -32,7 +32,6 @@ import org.apache.poi.xwpf.usermodel.*;
|
|
|
|
|
import org.beetl.sql.core.SqlId;
|
|
|
|
|
import org.beetl.sql.core.engine.PageQuery;
|
|
|
|
|
import org.beetl.sql.core.query.LambdaQuery;
|
|
|
|
|
import org.beetl.sql.core.query.interfacer.StrongValue;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
@ -52,6 +51,7 @@ import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
|
|
|
|
|
import static cn.jlw.util.ConvertM3U8.booleanMap;
|
|
|
|
|
import static com.ibeetl.admin.core.util.StreamUtils.listJoin;
|
|
|
|
|
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUserId;
|
|
|
|
|
import static com.ibeetl.jlw.enums.CourseLabelTypeEnum.*;
|
|
|
|
|
import static java.lang.Math.min;
|
|
|
|
|
import static java.math.BigDecimal.ROUND_HALF_UP;
|
|
|
|
|
import static java.math.BigDecimal.ZERO;
|
|
|
|
@ -274,6 +274,48 @@ public class CourseInfoService extends CoreBaseService<CourseInfo>{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean courseBind(CourseInfoQuery courseInfoQuery){
|
|
|
|
|
if (CERTIFICATE.getType().equals(courseInfoQuery.getCourseLabelType())|| APPLICATION.getType().equals(courseInfoQuery.getCourseLabelType())){
|
|
|
|
|
CourseLabel param = new CourseLabel();
|
|
|
|
|
param.setCourseLabelType(courseInfoQuery.getCourseLabelType());
|
|
|
|
|
CourseLabel courseLabel = courseLabelService.getOnce(param);
|
|
|
|
|
if (courseLabel==null){
|
|
|
|
|
throw new PlatformException("课程模块数据异常");
|
|
|
|
|
}
|
|
|
|
|
courseInfoQuery.setCourseLabelId(courseLabel.getCourseLabelId());
|
|
|
|
|
} else if (THEORY.getType().equals(courseInfoQuery.getCourseLabelType())&&courseInfoQuery.getCourseLabelId()==null) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateTemplate(courseInfoQuery.pojo());
|
|
|
|
|
|
|
|
|
|
CourseInfo courseInfo = courseInfoDao.single(courseInfoQuery.getCourseInfoId());
|
|
|
|
|
|
|
|
|
|
// 不管有没有绑定应用,都先删除
|
|
|
|
|
deleteByCourseInfoId(courseInfo.getCourseInfoId());
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(courseInfoQuery.getResourcesApplicationIds())){
|
|
|
|
|
|
|
|
|
|
CourseLabel courseLabel = courseLabelService.queryById(courseInfo.getCourseLabelId());
|
|
|
|
|
Assert.isTrue(courseLabel != null && "应用课程类".equals(courseLabel.getCourseLabelType()), "只有应用课程类的课程,才能绑定应用!");
|
|
|
|
|
|
|
|
|
|
List<ResourcesApplicationCourse> resourcesApplicationCourseList = new ArrayList<>();
|
|
|
|
|
String[] resourcesApplicationIds = courseInfoQuery.getResourcesApplicationIds().split(",");
|
|
|
|
|
for(int i=0;i<resourcesApplicationIds.length;i++){
|
|
|
|
|
ResourcesApplicationCourse resourcesApplicationCourse = new ResourcesApplicationCourse();
|
|
|
|
|
resourcesApplicationCourse.setResourcesApplicationId(Long.parseLong(resourcesApplicationIds[i]));
|
|
|
|
|
resourcesApplicationCourse.setCourseInfoId(courseInfo.getCourseInfoId());
|
|
|
|
|
resourcesApplicationCourseList.add(resourcesApplicationCourse);
|
|
|
|
|
}
|
|
|
|
|
if(resourcesApplicationCourseList.size()>0){
|
|
|
|
|
resourcesApplicationCourseService.insertBatch(resourcesApplicationCourseList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
public void deleteCourseInfo(String ids){
|
|
|
|
|
try {
|
|
|
|
|
//遍历下级 TODO 有问题
|
|
|
|
|