he2802 3 år sedan
förälder
incheckning
bb5dcd0b69

+ 10 - 6
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/CourseSectionController.java

@@ -6,6 +6,7 @@ import java.util.Arrays;
 import cn.hutool.core.lang.Validator;
 import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.framework.web.service.TokenService;
 import com.zhongzheng.modules.bank.vo.QuestionImport;
 import com.zhongzheng.modules.course.bo.CourseSectionAddBo;
 import com.zhongzheng.modules.course.bo.CourseSectionEditBo;
@@ -13,6 +14,7 @@ import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
 import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
 import com.zhongzheng.modules.course.service.ICourseSectionService;
+import com.zhongzheng.modules.course.vo.CourseSectionImport;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -51,6 +53,9 @@ public class CourseSectionController extends BaseController {
 
     private final ICourseSectionBusinessService iCourseSectionBusinessService;
 
+    @Autowired
+    private TokenService tokenService;
+
     /**
      * 查询课程小节列表
      */
@@ -109,23 +114,22 @@ public class CourseSectionController extends BaseController {
         return toAjax(iCourseSectionService.updateByEditBo(bo) ? 1 : 0);
     }
 
-    @Log(title = "导入节模板", businessType = BusinessType.IMPORT)
     @ApiOperation("导入节模板")
+    @Log(title = "导入节模板", businessType = BusinessType.IMPORT)
     @PreAuthorize("@ss.hasPermi('system:section:import')")
     @PostMapping("/importData")
     public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
     {
-       /* ExcelUtil<QuestionImport> util = new ExcelUtil<QuestionImport>(QuestionImport.class);
-        List<QuestionImport> questionList = util.importExcel(file.getInputStream());
+        ExcelUtil<CourseSectionImport> util = new ExcelUtil<CourseSectionImport>(CourseSectionImport.class);
+        List<CourseSectionImport> sectionList = util.importExcel(file.getInputStream());
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         String operName = loginUser.getUsername();
-        String message = iQuestionService.importQuestion(questionList, updateSupport, operName);
+        String message = iCourseSectionService.importSection(sectionList, updateSupport, operName);
         if(Validator.isNotEmpty(message)){
             return AjaxResult.error(message);
         }else{
             return AjaxResult.success(message);
-        }*/
-        return AjaxResult.success(null);
+        }
     }
 
     /**

+ 29 - 29
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/poi/ExcelUtil.java

@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
 
 /**
  * Excel相关处理
- * 
+ *
  * @author zhongzheng
  */
 public class ExcelUtil<T>
@@ -88,12 +88,12 @@ public class ExcelUtil<T>
      * 统计列表
      */
     private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
-    
+
     /**
      * 数字格式
      */
     private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
-    
+
     /**
      * 实体对象
      */
@@ -119,7 +119,7 @@ public class ExcelUtil<T>
 
     /**
      * 对excel表单默认第一个索引名转换成list
-     * 
+     *
      * @param is 输入流
      * @return 转换后集合
      */
@@ -130,7 +130,7 @@ public class ExcelUtil<T>
 
     /**
      * 对excel表单指定表格索引名转换成list
-     * 
+     *
      * @param sheetName 表格索引名
      * @param is 输入流
      * @return 转换后集合
@@ -298,7 +298,7 @@ public class ExcelUtil<T>
 
     /**
      * 对list数据源将其里面的数据导入到excel表单
-     * 
+     *
      * @param list 导出数据集合
      * @param sheetName 工作表的名称
      * @return 结果
@@ -311,7 +311,7 @@ public class ExcelUtil<T>
 
     /**
      * 对list数据源将其里面的数据导入到excel表单
-     * 
+     *
      * @param sheetName 工作表的名称
      * @return 结果
      */
@@ -323,7 +323,7 @@ public class ExcelUtil<T>
 
     /**
      * 对list数据源将其里面的数据导入到excel表单
-     * 
+     *
      * @return 结果
      */
     public AjaxResult exportExcel()
@@ -391,7 +391,7 @@ public class ExcelUtil<T>
 
     /**
      * 填充excel数据
-     * 
+     *
      * @param index 序号
      * @param row 单元格行
      */
@@ -418,7 +418,7 @@ public class ExcelUtil<T>
 
     /**
      * 创建表格样式
-     * 
+     *
      * @param wb 工作薄对象
      * @return 样式列表
      */
@@ -456,7 +456,7 @@ public class ExcelUtil<T>
         headerFont.setColor(IndexedColors.WHITE.getIndex());
         style.setFont(headerFont);
         styles.put("header", style);
-        
+
         style = wb.createCellStyle();
         style.setAlignment(HorizontalAlignment.CENTER);
         style.setVerticalAlignment(VerticalAlignment.CENTER);
@@ -500,7 +500,7 @@ public class ExcelUtil<T>
 
     /**
      * 设置单元格信息
-     * 
+     *
      * @param value 单元格值
      * @param attr 注解相关
      * @param cell 单元格信息
@@ -531,7 +531,7 @@ public class ExcelUtil<T>
             }
         }
     }
-    
+
     /**
      * 获取画布
      */
@@ -646,7 +646,7 @@ public class ExcelUtil<T>
 
     /**
      * 设置 POI XSSFSheet 单元格提示
-     * 
+     *
      * @param sheet 表单
      * @param promptTitle 提示标题
      * @param promptContent 提示内容
@@ -669,7 +669,7 @@ public class ExcelUtil<T>
 
     /**
      * 设置某些列的值只能输入预制的数据,显示下拉框.
-     * 
+     *
      * @param sheet 要设置的sheet.
      * @param textlist 下拉框显示的内容
      * @param firstRow 开始行
@@ -703,7 +703,7 @@ public class ExcelUtil<T>
 
     /**
      * 解析导出值 0=男,1=女,2=未知
-     * 
+     *
      * @param propertyValue 参数值
      * @param converterExp 翻译注解
      * @param separator 分隔符
@@ -740,7 +740,7 @@ public class ExcelUtil<T>
 
     /**
      * 反向解析值 男=0,女=1,未知=2
-     * 
+     *
      * @param propertyValue 参数值
      * @param converterExp 翻译注解
      * @param separator 分隔符
@@ -774,10 +774,10 @@ public class ExcelUtil<T>
         }
         return StrUtil.strip(propertyString.toString(), null,separator);
     }
-    
+
     /**
      * 解析字典值
-     * 
+     *
      * @param dictValue 字典值
      * @param dictType 字典类型
      * @param separator 分隔符
@@ -790,7 +790,7 @@ public class ExcelUtil<T>
 
     /**
      * 反向解析值字典值
-     * 
+     *
      * @param dictLabel 字典标签
      * @param dictType 字典类型
      * @param separator 分隔符
@@ -800,7 +800,7 @@ public class ExcelUtil<T>
     {
         return DictUtils.getDictValue(dictType, dictLabel, separator);
     }
-    
+
     /**
      * 合计统计信息
      */
@@ -837,7 +837,7 @@ public class ExcelUtil<T>
             cell = row.createCell(0);
             cell.setCellStyle(styles.get("total"));
             cell.setCellValue("合计");
-            
+
             for (Integer key : keys)
             {
                 cell = row.createCell(key);
@@ -859,7 +859,7 @@ public class ExcelUtil<T>
 
     /**
      * 获取下载路径
-     * 
+     *
      * @param filename 文件名称
      */
     public String getAbsoluteFile(String filename)
@@ -875,7 +875,7 @@ public class ExcelUtil<T>
 
     /**
      * 获取bean中的属性值
-     * 
+     *
      * @param vo 实体对象
      * @param field 字段
      * @param excel 注解
@@ -906,7 +906,7 @@ public class ExcelUtil<T>
 
     /**
      * 以类的属性的get方法方法形式获取值
-     * 
+     *
      * @param o
      * @param name
      * @return value
@@ -955,7 +955,7 @@ public class ExcelUtil<T>
         this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList());
         this.maxHeight = getRowHeight();
     }
-    
+
     /**
      * 根据注解获取最大行高
      */
@@ -991,7 +991,7 @@ public class ExcelUtil<T>
 
     /**
      * 创建工作表
-     * 
+     *
      * @param sheetNo sheet数量
      * @param index 序号
      */
@@ -1012,7 +1012,7 @@ public class ExcelUtil<T>
 
     /**
      * 获取单元格值
-     * 
+     *
      * @param row 获取的行
      * @param column 获取单元格列号
      * @return 单元格值
@@ -1069,4 +1069,4 @@ public class ExcelUtil<T>
         }
         return val;
     }
-}
+}

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -255,7 +255,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
             Long eduId = findEduId(question.getEducationType());
             if(!Validator.isNotEmpty(eduId)){
-                errorLog+=question.getEducationType()+"-该业务层次不存在\n";
+                errorLog+=question.getEducationType()+"-该教育类型不存在\n";
                 continue;
             }
             Long projectId = findProjectId(question.getProject());

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseAddBo.java

@@ -75,4 +75,5 @@ public class CourseAddBo {
     /** 项目id */
     @ApiModelProperty("项目id")
     private Integer projectId;
+
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseSectionAddBo.java

@@ -66,4 +66,10 @@ public class CourseSectionAddBo {
     /** 编码 */
     @ApiModelProperty("编码")
     private String code;
+    /** 导入者 */
+    @ApiModelProperty("导入者")
+    private String importBy;
+    /** 导入编号 */
+    @ApiModelProperty("导入编号")
+    private String importNo;
 }

+ 0 - 68
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseSectionImportBo.java

@@ -1,68 +0,0 @@
-package com.zhongzheng.modules.course.bo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.util.List;
-
-
-/**
- * 课程小节添加对象 course_section
- *
- * @author hjl
- * @date 2021-10-11
- */
-@Data
-@ApiModel("课程小节添加对象")
-public class CourseSectionImportBo {
-
-    /** 名称 */
-    @ApiModelProperty("名称")
-    private String name;
-    /** 排序 */
-    @ApiModelProperty("排序")
-    private Long sort;
-    /** 添加时间 */
-    @ApiModelProperty("添加时间")
-    private Long createTime;
-    /** 修改时间 */
-    @ApiModelProperty("修改时间")
-    private Long updateTime;
-    /** 前缀名称 */
-    @ApiModelProperty("前缀名称")
-    private String prefixName;
-    /** 状态 1正常 0关闭 */
-    @ApiModelProperty("状态 1正常 0关闭")
-    private Integer status;
-    /** 节类型 1录播 2直播 3回放 */
-    @ApiModelProperty("节类型 1录播 2直播 3回放")
-    private Integer sectionType;
-    /** 发布状态 1发布 0未发布 */
-    @ApiModelProperty("发布状态 1发布 0未发布")
-    private Integer publishStatus;
-    /** 直播流地址 */
-    @ApiModelProperty("直播流地址")
-    private String liveUrl;
-    /** 直播开始时间 */
-    @ApiModelProperty("直播开始时间")
-    private Long liveStartTime;
-    /** 直播结束时间 */
-    @ApiModelProperty("直播结束时间")
-    private Long liveEndTime;
-    /** 录播和回放的url地址 */
-    @ApiModelProperty("录播和回放的url地址")
-    private String recordingUrl;
-    /** 节时长(分钟) */
-    @ApiModelProperty("节时长(分钟)")
-    private Long durationTime;
-    /** 业务层级列表 */
-    @ApiModelProperty("业务层级列表")
-    private List<CourseSectionBusinessAddBo> businessList;
-    /** 封面地址 */
-    @ApiModelProperty("封面地址")
-    private String coverUrl;
-    /** 编码 */
-    @ApiModelProperty("编码")
-    private String code;
-}

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/CourseSection.java

@@ -58,4 +58,8 @@ private static final long serialVersionUID=1L;
     private String coverUrl;
     /** 编码 */
     private String code;
+    /** 导入者 */
+    private String importBy;
+    /** 导入编号 */
+    private String importNo;
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseSectionService.java

@@ -2,12 +2,15 @@ package com.zhongzheng.modules.course.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.bank.vo.QuestionImport;
 import com.zhongzheng.modules.course.bo.CourseSectionAddBo;
 import com.zhongzheng.modules.course.bo.CourseSectionEditBo;
 import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.CourseSection;
+import com.zhongzheng.modules.course.vo.CourseSectionImport;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
 
+import java.text.ParseException;
 import java.util.Collection;
 import java.util.List;
 
@@ -52,4 +55,6 @@ public interface ICourseSectionService extends IService<CourseSection> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+	String importSection(List<CourseSectionImport> sectionList, Boolean isUpdateSupport, String operName) throws ParseException;
 }

+ 231 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionServiceImpl.java

@@ -3,9 +3,16 @@ package com.zhongzheng.modules.course.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.modules.bank.bo.QuestionAddBo;
+import com.zhongzheng.modules.bank.bo.QuestionBusinessAddBo;
+import com.zhongzheng.modules.bank.domain.Question;
+import com.zhongzheng.modules.bank.domain.QuestionBusiness;
+import com.zhongzheng.modules.bank.vo.QuestionImport;
 import com.zhongzheng.modules.course.bo.CourseSectionAddBo;
 import com.zhongzheng.modules.course.bo.CourseSectionBusinessAddBo;
 import com.zhongzheng.modules.course.bo.CourseSectionEditBo;
@@ -13,6 +20,7 @@ import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.*;
 import com.zhongzheng.modules.course.mapper.CourseSectionMapper;
 import com.zhongzheng.modules.course.service.*;
+import com.zhongzheng.modules.course.vo.CourseSectionImport;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
 import com.zhongzheng.modules.system.domain.SysRoleMenu;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,10 +29,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.Page;
+import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -48,6 +58,20 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
     @Autowired
     private ICourseChapterSectionService iCourseChapterSectionService;
 
+    @Autowired
+    private RedisCache redisCache;
+    @Autowired
+    private ICourseEducationTypeService iCourseEducationTypeService;
+
+    @Autowired
+    private ICourseProjectTypeService iCourseProjectTypeService;
+
+    @Autowired
+    private ICourseBusinessService iCourseBusinessService;
+
+    @Autowired
+    private ICourseSubjectService iCourseSubjectService;
+
     @Override
     public CourseSectionVo queryById(Long sectionId){
         CourseSection db = this.baseMapper.selectById(sectionId);
@@ -160,6 +184,109 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
         return this.removeByIds(ids);
     }
 
+    @Override
+    public String importSection(List<CourseSectionImport> sectionList, Boolean isUpdateSupport, String operName) throws ParseException {
+        if (Validator.isNull(sectionList) || sectionList.size() == 0) {
+            throw new CustomException("导入数据不能为空!");
+        }
+        String errorLog = "";
+        String importNo = ServletUtils.getEncoded("IMPORT");
+        int i=10;
+        for (CourseSectionImport sectionImport : sectionList) {
+            CourseSectionAddBo bo = new CourseSectionAddBo();
+            if(!Validator.isNotEmpty(sectionImport.getName())){
+                errorLog+="节标题空白\n";
+                continue;
+            }
+            if(!Validator.isNotEmpty(sectionImport.getPrefixName())){
+                errorLog+="标题前缀空白\n";
+                continue;
+            }
+            if(!Validator.isNotEmpty(sectionImport.getPrefixName())){
+                errorLog+="标题前缀空白\n";
+                continue;
+            }
+            System.out.println(sectionImport);
+            if(!Validator.isNotEmpty(sectionImport.getPublishStatus())){
+                errorLog+="发布状态空白\n";
+                continue;
+            }
+            //业务层次,导入每条只有一条业务层次
+            List<CourseSectionBusinessAddBo> businessList = new ArrayList<>();
+            CourseSectionBusinessAddBo addBo = new CourseSectionBusinessAddBo();
+            Long eduId = findEduId(sectionImport.getEducationType());
+            if(!Validator.isNotEmpty(eduId)){
+                errorLog+=sectionImport.getEducationType()+"-该教育类型不存在\n";
+                continue;
+            }
+            Long projectId = findProjectId(sectionImport.getProject());
+            if(!Validator.isNotEmpty(projectId)){
+                errorLog+=sectionImport.getProject()+"-该项目类型不存在\n";
+                continue;
+            }
+            Long businessId = findBusinessId(sectionImport.getBusiness());
+            if(!Validator.isNotEmpty(businessId)){
+                errorLog+=sectionImport.getBusiness()+"-该业务层次不存在\n";
+                continue;
+            }
+            Long subjectId = findSubjectId(sectionImport.getSubject());
+            if(!Validator.isNotEmpty(subjectId)){
+                errorLog+=sectionImport.getSubject()+"-该科目不存在\n";
+                continue;
+            }
+            addBo.setEducationTypeId(eduId);
+            addBo.setProjectId(projectId);
+            addBo.setBusinessId(businessId);
+            addBo.setSubjectId(subjectId);
+            businessList.add(addBo);
+
+            bo.setPrefixName(sectionImport.getPrefixName());
+            bo.setName(sectionImport.getName());
+            bo.setName(sectionImport.getName());
+            bo.setBusinessList(businessList);
+            bo.setImportBy(operName);
+            bo.setImportNo(importNo);
+            bo.setSectionType(findType(sectionImport.getSectionType()));
+            bo.setDurationTime(sectionImport.getDurationTime());
+            bo.setRecordingUrl(sectionImport.getRecordingUrl());
+            bo.setLiveUrl(sectionImport.getLiveUrl());
+            bo.setPublishStatus(sectionImport.getPublishStatus().equals("发布")?1:0);
+            bo.setStatus(1);
+            bo.setCoverUrl("oss/images/avatar/20211013/1634097664410_1397766697");
+            if(Validator.isNotEmpty(sectionImport.getLiveStartTime())){
+                Long startTime = sectionImport.getLiveStartTime().getTime()/1000;
+                bo.setLiveStartTime(startTime);
+            }
+            if(Validator.isNotEmpty(sectionImport.getLiveEndTime())){
+                Long endTime = sectionImport.getLiveEndTime().getTime()/1000;
+                bo.setLiveEndTime(endTime);
+            }
+            errorLog = insertByAddBoImport(bo,errorLog,i);
+            i++;
+        }
+        return errorLog;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public String insertByAddBoImport(CourseSectionAddBo bo, String errorLog, Integer no) {
+        CourseSection add = BeanUtil.toBean(bo, CourseSection.class);
+        add.setCode(ServletUtils.getEncoded("J"));
+        validEntityBeforeSave(add);
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
+        boolean result = this.save(add);
+        if(bo.getBusinessList()!=null){
+            Collection<QuestionBusiness> coll = new HashSet<>();
+            for(int i=0;i<bo.getBusinessList().size();i++){
+                CourseSectionBusinessAddBo item = bo.getBusinessList().get(i);
+                CourseSectionBusiness addItem = BeanUtil.toBean(item, CourseSectionBusiness.class);
+                item.setSectionId(add.getSectionId());
+                iCourseSectionBusinessService.insertByAddBo(item);
+            }
+        }
+        return errorLog;
+    }
+
     private boolean checkNameUnique(CourseSection entity) {
         CourseSection info = getOne(new LambdaQueryWrapper<CourseSection>()
                 .eq(CourseSection::getPrefixName,entity.getPrefixName()).eq(CourseSection::getName,entity.getName()).ne(CourseSection::getStatus,-1).last("limit 1"));
@@ -174,4 +301,105 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
         }
         return false;
     }
+
+    public Integer findType(String type){
+        if("录播".equals(type)){
+            return 1;
+        }
+        else if("直播".equals(type)){
+            return 2;
+        }
+        else if("回放".equals(type)){
+            return 3;
+        }
+        return null;
+    }
+
+    public Long findEduId(String edu){
+        if(edu!=null){
+            String key = "EDU_"+edu;
+            Long value = redisCache.getCacheObject(key);
+            if(value!=null){
+                if(value==0L){
+                    return null;
+                }
+                return value;
+            }
+            CourseEducationType info = iCourseEducationTypeService.getOne(new LambdaQueryWrapper<CourseEducationType>()
+                    .eq(CourseEducationType::getEducationName,edu));
+            if(info!=null){
+                redisCache.setCacheObject(key,info.getId(),3, TimeUnit.MINUTES);//3分钟
+                return info.getId();
+            }else{
+                redisCache.setCacheObject(key,0L,3, TimeUnit.MINUTES);//3分钟
+            }
+        }
+        return null;
+    }
+
+    public Long findProjectId(String project){
+        if(project!=null){
+            String key = "PROJ_"+project;
+            Long value = redisCache.getCacheObject(key);
+            if(value!=null){
+                if(value==0L){
+                    return null;
+                }
+                return value;
+            }
+            CourseProjectType info = iCourseProjectTypeService.getOne(new LambdaQueryWrapper<CourseProjectType>()
+                    .eq(CourseProjectType::getProjectName,project).eq(CourseProjectType::getStatus,1).last("limit 1"));
+            if(info!=null){
+                redisCache.setCacheObject(key,info.getId(),3, TimeUnit.MINUTES);//3分钟
+                return info.getId();
+            }else{
+                redisCache.setCacheObject(key,0L,3, TimeUnit.MINUTES);//3分钟
+            }
+        }
+        return null;
+    }
+
+    public Long findBusinessId(String business){
+        if(business!=null){
+            String key = "BUS_"+business;
+            Long value = redisCache.getCacheObject(key);
+            if(value!=null){
+                if(value==0L){
+                    return null;
+                }
+                return value;
+            }
+            CourseBusiness info = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>()
+                    .eq(CourseBusiness::getBusinessName,business).eq(CourseBusiness::getStatus,1).last("limit 1"));
+            if(info!=null){
+                redisCache.setCacheObject(key,info.getId(),3, TimeUnit.MINUTES);//3分钟
+                return info.getId();
+            }else{
+                redisCache.setCacheObject(key,0L,3, TimeUnit.MINUTES);//3分钟
+            }
+        }
+        return null;
+    }
+
+    public Long findSubjectId(String subject){
+        if(subject!=null){
+            String key = "SUB_"+subject;
+            Long value = redisCache.getCacheObject(key);
+            if(value!=null){
+                if(value==0L){
+                    return null;
+                }
+                return value;
+            }
+            CourseSubject info = iCourseSubjectService.getOne(new LambdaQueryWrapper<CourseSubject>()
+                    .eq(CourseSubject::getSubjectName,subject).eq(CourseSubject::getStatus,1).last("limit 1"));
+            if(info!=null){
+                redisCache.setCacheObject(key,info.getId(),3, TimeUnit.MINUTES);//3分钟
+                return info.getId();
+            }else{
+                redisCache.setCacheObject(key,0L,3, TimeUnit.MINUTES);//3分钟
+            }
+        }
+        return null;
+    }
 }

+ 78 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseSectionImport.java

@@ -0,0 +1,78 @@
+package com.zhongzheng.modules.course.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.modules.course.bo.CourseSectionBusinessAddBo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * 课程小节添加对象 course_section
+ *
+ * @author hjl
+ * @date 2021-10-11
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+public class CourseSectionImport {
+
+    private static final long serialVersionUID = 1L;
+
+
+
+    /** 名称 */
+    @Excel(name = "*节标题")
+    @ApiModelProperty("名称")
+    private String name;
+    /** 前缀名称 */
+    @Excel(name = "*标题前缀")
+    @ApiModelProperty("前缀名称")
+    private String prefixName;
+    /** 节类型 1录播 2直播 3回放 */
+    @Excel(name = "节类型")
+    @ApiModelProperty("节类型 1录播 2直播 3回放")
+    private String sectionType;
+    /** 发布状态 1发布 0未发布 */
+    @Excel(name = "*发布状态")
+    private String publishStatus;
+    /** 直播流地址 */
+    @Excel(name = "直播地址")
+    @ApiModelProperty("直播流地址")
+    private String liveUrl;
+    /** 直播开始时间 */
+    @Excel(name = "直播开始时间")
+    @ApiModelProperty("直播开始时间")
+    private Date liveStartTime;
+    /** 直播结束时间 */
+    @Excel(name = "直播结束时间")
+    @ApiModelProperty("直播结束时间")
+    private Date liveEndTime;
+    /** 录播和回放的url地址 */
+    @Excel(name = "URL地址")
+    @ApiModelProperty("录播和回放的url地址")
+    private String recordingUrl;
+    /** 节时长(分钟) */
+    @Excel(name = "节时长")
+    @ApiModelProperty("节时长(分钟)")
+    private Long durationTime;
+
+    /** 教育类型ID */
+    @Excel(name = "教育类型")
+    private String educationType;
+    /** 业务层次id */
+    @Excel(name = "业务层次")
+    private String business;
+    /** 科目id */
+    @Excel(name = "科目")
+    private String subject;
+    /** 项目ID */
+    @Excel(name = "项目类型")
+    private String project;
+}

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseSectionMapper.xml

@@ -21,6 +21,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="durationTime" column="duration_time"/>
         <result property="coverUrl" column="cover_url"/>
         <result property="code" column="code"/>
+        <result property="importBy" column="import_by"/>
+        <result property="importNo" column="import_no"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.course.vo.CourseSectionVo" id="CourseSectionResultVo">