yangdamao пре 1 година
родитељ
комит
9b378b0fd1

+ 17 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -2,11 +2,14 @@ package com.zhongzheng.controller.goods;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.exception.CustomException;
+import com.zhongzheng.common.utils.poi.EasyPoiUtil;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
 import com.zhongzheng.modules.bank.service.IQuestionService;
 import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
@@ -15,12 +18,14 @@ import com.zhongzheng.modules.goods.bo.*;
 import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.*;
+import com.zhongzheng.modules.top.order.bo.TopOrderQuestionImportBo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -394,4 +399,16 @@ public class GoodsController extends BaseController {
         return AjaxResult.success(list);
     }
 
+    /**
+     * 二建商品更换腾讯
+     */
+    @ApiOperation("二建商品更换腾讯")
+    @PostMapping("/update/recording/url")
+    public AjaxResult<Void> updateRecordUrl(MultipartFile file,String goodsId) {
+        List<SectionImportBo> boList = EasyPoiUtil.importExcel(file,0,1,SectionImportBo.class);
+        if (CollectionUtils.isEmpty(boList)){
+            throw new CustomException("导入文件格式不正确或文件为空,请检查文件!");
+        }
+        return toAjax(iGoodsService.updateRecordUrl(boList,goodsId) ? 1 : 0);
+    }
 }

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

@@ -53,8 +53,12 @@ private static final long serialVersionUID=1L;
     private Long liveEndTime;
     /** 录播和回放的url地址 */
     private String recordingUrl;
+    /** 录腾讯视频地址 */
+    private String tencentVideoUrl;
     /** 节时长(分钟) */
     private Long durationTime;
+    /** 腾讯视频时长 */
+    private Long tencentVideoTime;
     /** 封面地址 */
     private String coverUrl;
     /** 编码 */

+ 24 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/SectionImportBo.java

@@ -0,0 +1,24 @@
+package com.zhongzheng.modules.goods.bo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2024年06月04日 15:00
+ */
+@Data
+public class SectionImportBo implements Serializable {
+
+    @Excel(name = "节名称")
+    private String sectionName;
+
+    @Excel(name = "节地址")
+    private String sectionUrl;
+
+    @Excel(name = "节时长")
+    private String sectionTime;
+
+}

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsMapper.java

@@ -9,6 +9,7 @@ import com.zhongzheng.modules.bank.domain.QuestionModule;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.bo.ExternalQuestionBo;
 import com.zhongzheng.modules.course.bo.ReplenishExamBo;
+import com.zhongzheng.modules.course.domain.CourseSection;
 import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.course.vo.ExternalQuestionVo;
 import com.zhongzheng.modules.course.vo.ReplenishExamVo;
@@ -136,4 +137,6 @@ public interface GoodsMapper extends BaseMapper<Goods> {
     List<Exam> getExam();
 
     List<GoodsCourseTreeVo> getGoodsCourseTree(Long goodsId);
+
+    List<CourseSection> getGoodsSectionInfo(Long goodsId);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -173,4 +173,7 @@ public interface IGoodsService extends IService<Goods> {
 	String createUserAccount(UserAccountBo bo);
 
 	List<GoodsCourseTreeVo> getGoodsCourseTree(Long goodsId);
+
+    boolean updateRecordUrl(List<SectionImportBo> boList, String goodsId);
+
 }

+ 19 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -5491,6 +5491,25 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return baseMapper.getGoodsCourseTree(goodsId);
     }
 
+    @Override
+    public boolean updateRecordUrl(List<SectionImportBo> boList, String goodsId) {
+        //获取商品节信息
+        List<CourseSection> sections = baseMapper.getGoodsSectionInfo(Long.valueOf(goodsId));
+        if (CollectionUtils.isEmpty(sections)){
+            return false;
+        }
+        sections.forEach(x -> {
+            SectionImportBo bo = boList.stream().filter(k -> k.getSectionName().equals(x.getName())).findFirst().orElse(null);
+            if (ObjectUtils.isNull(bo)){
+                return;
+            }
+            x.setTencentVideoUrl(bo.getSectionUrl());
+            x.setTencentVideoTime(Long.valueOf(bo.getSectionTime()));
+        });
+
+        return iCourseSectionService.updateBatchById(sections);
+    }
+
     private void updateHandoutsId(Long goodsId, Long tenantId, Long handoutsId) {
         baseMapper.updateHandoutsId(goodsId, tenantId, handoutsId);
     }

+ 14 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -1225,4 +1225,18 @@
             g.goods_id = #{goodsId}
     </select>
 
+    <select id="getGoodsSectionInfo" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.course.domain.CourseSection">
+        SELECT
+            cs.*
+        FROM
+            goods_course gc
+                LEFT JOIN course_menu cm ON gc.course_id = cm.course_id
+                LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
+                LEFT JOIN course_chapter_section ccs ON cmc.chapter_id = ccs.chapter_id
+                LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
+        WHERE
+            gc.goods_id = #{goodsId}
+            AND cm.`status` = 1
+    </select>
+
 </mapper>