|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
@ -10,7 +12,9 @@ import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.FileEntity;
|
|
|
|
|
import com.ibeetl.jlw.entity.ResourcesInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseMergeResourcesInfo;
|
|
|
|
|
import com.ibeetl.jlw.web.query.ResourcesInfoQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesInfoQuery;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
@ -25,10 +29,13 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
|
|
|
|
|
import static org.apache.commons.lang3.StringUtils.join;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 开课资源拉取 Service
|
|
|
|
@ -41,6 +48,8 @@ import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
|
|
|
|
|
public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService<TeacherOpenCourseMergeResourcesInfo>{
|
|
|
|
|
|
|
|
|
|
@Autowired private TeacherOpenCourseMergeResourcesInfoDao teacherOpenCourseMergeResourcesInfoDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ResourcesInfoService resourcesInfoService;
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseMergeResourcesInfo>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = teacherOpenCourseMergeResourcesInfoDao.queryByCondition(query);
|
|
|
|
@ -299,4 +308,25 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService<
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 教师端-导入资源操作,逻辑拆分
|
|
|
|
|
*
|
|
|
|
|
* 从系统资源库拉取到教师开课的资源中。
|
|
|
|
|
* @param resourcesInfoIds 资源信息ID集合
|
|
|
|
|
* @param teacherOpenCourseId 开课ID
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void copyFromResourcesInfo(@NotEmpty(message = "资源信息ID集合不能为空!") Set<Long> resourcesInfoIds,
|
|
|
|
|
@NotNull(message = "开课ID不能为空!") final Long teacherOpenCourseId) {
|
|
|
|
|
ResourcesInfoQuery resourcesInfoQuery = new ResourcesInfoQuery();
|
|
|
|
|
resourcesInfoQuery.setResourcesInfoIds(join(resourcesInfoIds.toArray(), ","));
|
|
|
|
|
List<ResourcesInfo> resourcesInfoList = resourcesInfoService.getValuesByQuery(resourcesInfoQuery);
|
|
|
|
|
if (ObjectUtil.isEmpty(resourcesInfoList)) { return; }
|
|
|
|
|
|
|
|
|
|
List<TeacherOpenCourseMergeResourcesInfo> copyToList = BeanUtil.copyToList(resourcesInfoList, TeacherOpenCourseMergeResourcesInfo.class);
|
|
|
|
|
copyToList.forEach(item -> item.setTeacherOpenCourseId(teacherOpenCourseId));
|
|
|
|
|
|
|
|
|
|
// 批量插入资源和开课关联表
|
|
|
|
|
insertBatch(copyToList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|