From a9e6d8a81eae6c943506c67765bbaf2d6559f162 Mon Sep 17 00:00:00 2001
From: DengMin <16679070171@qq.com>
Date: Thu, 4 Aug 2022 17:14:22 +0800
Subject: [PATCH] 经营范围
---
src/main/java/com/subsidy/controller/BusinessScopeDictController.java | 4 ++--
src/main/java/com/subsidy/controller/ContentVodMappingController.java | 10 +++++++++-
src/main/java/com/subsidy/controller/VodDictController.java | 14 +++++++++++---
src/main/java/com/subsidy/dto/businessScope/AddBusinessScopeDTO.java | 2 ++
src/main/java/com/subsidy/dto/businessScope/BusinessScopeDTO.java | 2 ++
src/main/java/com/subsidy/mapper/BusinessScopeDictMapper.java | 6 +++++-
src/main/java/com/subsidy/mapper/CourseDictMapper.java | 2 ++
src/main/java/com/subsidy/mapper/VodDictMapper.java | 6 ++++++
src/main/java/com/subsidy/model/BusinessScopeDictDO.java | 2 ++
src/main/java/com/subsidy/service/ContentVodMappingService.java | 2 ++
src/main/java/com/subsidy/service/VodDictService.java | 4 +++-
src/main/java/com/subsidy/service/impl/BusinessScopeDictServiceImpl.java | 17 ++++++++++-------
src/main/java/com/subsidy/service/impl/ContentVodMappingServiceImpl.java | 18 ++++++++++++++++++
src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java | 46 +++++++++++++++++++++++++++++++++++++++-------
src/main/java/com/subsidy/vo/vod/QueryVodPageVO.java | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/main/resources/mapper/BusinessScopeDictMapper.xml | 26 ++++++++++++++++++++++----
src/main/resources/mapper/CourseDictMapper.xml | 14 ++++++++++++++
src/main/resources/mapper/VodDictMapper.xml | 25 +++++++++++++++++++++++++
18 files changed, 240 insertions(+), 26 deletions(-)
create mode 100644 src/main/java/com/subsidy/vo/vod/QueryVodPageVO.java
diff --git a/src/main/java/com/subsidy/controller/BusinessScopeDictController.java b/src/main/java/com/subsidy/controller/BusinessScopeDictController.java
index ce5e902..2824ea4 100644
--- a/src/main/java/com/subsidy/controller/BusinessScopeDictController.java
+++ b/src/main/java/com/subsidy/controller/BusinessScopeDictController.java
@@ -33,7 +33,7 @@ public class BusinessScopeDictController {
private BusinessScopeDictService businessScopeDictService;
@PostMapping("addBusinessScope")
- @ApiOperation("添加经营范围:businessScopeName/经营范围名称, businessScopeItems[]/经营范围类目")
+ @ApiOperation("添加经营范围:companyId/公司ID, businessScopeName/经营范围名称, businessScopeItems[]/经营范围类目")
@LoginRequired
public ResponseVO addBusinessScope(@RequestBody AddBusinessScopeDTO addBusinessScopeDTO) {
businessScopeDictService.addBusinessScope(addBusinessScopeDTO);
@@ -57,7 +57,7 @@ public class BusinessScopeDictController {
}
@PostMapping("queryBusinessScopePage")
- @ApiOperation("分页查询经营范围:businessScopeName/经营范围名称、pageNum/当前页数、pageSize/每页显示条数")
+ @ApiOperation("分页查询经营范围:companyId/公司ID, businessScopeName/经营范围名称、pageNum/当前页数、pageSize/每页显示条数")
@LoginRequired
public ResponseVO queryBusinessScopePage(@RequestBody BusinessScopeDTO businessScopeDictDO) {
return ResponseData.generateCreatedResponse(0, businessScopeDictService.queryBusinessScopePage(businessScopeDictDO));
diff --git a/src/main/java/com/subsidy/controller/ContentVodMappingController.java b/src/main/java/com/subsidy/controller/ContentVodMappingController.java
index b252928..ce06b3f 100644
--- a/src/main/java/com/subsidy/controller/ContentVodMappingController.java
+++ b/src/main/java/com/subsidy/controller/ContentVodMappingController.java
@@ -55,11 +55,19 @@ public class ContentVodMappingController {
}
@PostMapping("deleteContentVod")
- @ApiOperation("删除课程内容下的视频: contentId/内容ID 、 vodId/视频ID")
+ @ApiOperation("删除课程内容下的视频: contentId/内容ID 、vodId/视频ID")
@LoginRequired
public ResponseVO deleteContentVod(@RequestBody ContentVodDTO contentVodDTO) {
contentVodMappingService.deleteContentVod(contentVodDTO);
return ResponseData.generateCreatedResponse(0);
}
+ @PostMapping("updateContentVod")
+ @ApiOperation("编辑课程内容下的视频: contentId/内容ID、vodIds [vodId, vodAliasName]")
+ @LoginRequired
+ public ResponseVO updateContentVod(@RequestBody AddContentVodDTO addContentVod) {
+ contentVodMappingService.updateContentVod(addContentVod);
+ return ResponseData.generateCreatedResponse(0);
+ }
+
}
diff --git a/src/main/java/com/subsidy/controller/VodDictController.java b/src/main/java/com/subsidy/controller/VodDictController.java
index 5571a1a..498302c 100644
--- a/src/main/java/com/subsidy/controller/VodDictController.java
+++ b/src/main/java/com/subsidy/controller/VodDictController.java
@@ -47,11 +47,19 @@ public class VodDictController {
return ResponseData.generateCreatedResponse(0);
}
+ @PostMapping("addCompanyVod")
+ @ApiOperation("新增企业内部视频 contentId vodName vodLength vodType vodSize vodUrl vodCode coverPage")
+ @LoginRequired
+ public ResponseVO addCompanyVod(@RequestBody AddVodDictDTO addVodDictDTO) {
+ vodDictService.addCompanyVod(addVodDictDTO);
+ return ResponseData.generateCreatedResponse(0, ConstantUtils.ADD_SUCCESS);
+ }
+
@PostMapping("addVod")
- @ApiOperation("新增视频 labelId contentId vodName vodLength vodType vodSize vodUrl vodCode coverPage")
+ @ApiOperation("新增视频 labelId vodName vodLength vodType vodSize vodUrl vodCode coverPage")
@LoginRequired
- public ResponseVO addVod(@RequestBody AddVodDictDTO addVodDictDTO) {
- vodDictService.addVod(addVodDictDTO);
+ public ResponseVO addVod(@RequestBody VodDictDO vodDictDO) {
+ vodDictService.addVod(vodDictDO);
return ResponseData.generateCreatedResponse(0, ConstantUtils.ADD_SUCCESS);
}
diff --git a/src/main/java/com/subsidy/dto/businessScope/AddBusinessScopeDTO.java b/src/main/java/com/subsidy/dto/businessScope/AddBusinessScopeDTO.java
index f5f37f1..2e33a3a 100644
--- a/src/main/java/com/subsidy/dto/businessScope/AddBusinessScopeDTO.java
+++ b/src/main/java/com/subsidy/dto/businessScope/AddBusinessScopeDTO.java
@@ -11,6 +11,8 @@ public class AddBusinessScopeDTO {
*/
private String businessScopeName;
+ private Long companyId;
+
/**
* 经营范围类目
*/
diff --git a/src/main/java/com/subsidy/dto/businessScope/BusinessScopeDTO.java b/src/main/java/com/subsidy/dto/businessScope/BusinessScopeDTO.java
index 2e4491e..e22f402 100644
--- a/src/main/java/com/subsidy/dto/businessScope/BusinessScopeDTO.java
+++ b/src/main/java/com/subsidy/dto/businessScope/BusinessScopeDTO.java
@@ -7,6 +7,8 @@ public class BusinessScopeDTO {
private String businessScopeName;
+ private Long companyId;
+
private Integer pageNum;
private Integer pageSize;
diff --git a/src/main/java/com/subsidy/mapper/BusinessScopeDictMapper.java b/src/main/java/com/subsidy/mapper/BusinessScopeDictMapper.java
index 1d7d980..b995031 100644
--- a/src/main/java/com/subsidy/mapper/BusinessScopeDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/BusinessScopeDictMapper.java
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.businessScope.BusinessScopeDictVO;
import org.springframework.stereotype.Repository;
+import java.util.List;
+
/**
*
* 经营范围表 Mapper 接口
@@ -18,5 +20,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface BusinessScopeDictMapper extends BaseMapper {
- IPage queryBusinessScopePage(Page page, String businessScopeName);
+ IPage queryBusinessScopePage(Page page, Long companyId, String businessScopeName);
+
+ List queryBusinessScopeChildNode();
}
diff --git a/src/main/java/com/subsidy/mapper/CourseDictMapper.java b/src/main/java/com/subsidy/mapper/CourseDictMapper.java
index 563613d..de11d4d 100644
--- a/src/main/java/com/subsidy/mapper/CourseDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/CourseDictMapper.java
@@ -6,6 +6,7 @@ import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.CourseDictDO;
import com.subsidy.vo.course.QueryCoursesVO;
import com.subsidy.vo.member.StudyPageVO;
+import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@@ -55,4 +56,5 @@ public interface CourseDictMapper extends BaseMapper {
void updateOpenStatus(CourseDictDO courseDictDO);
+ List getListByVodId(@Param("vodId") Long vodId);
}
diff --git a/src/main/java/com/subsidy/mapper/VodDictMapper.java b/src/main/java/com/subsidy/mapper/VodDictMapper.java
index 6a91578..637d65b 100644
--- a/src/main/java/com/subsidy/mapper/VodDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/VodDictMapper.java
@@ -1,10 +1,12 @@
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.model.VodDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.vod.ClassVodCompleteInfoVO;
import com.subsidy.vo.vod.GetContendVodsVO;
+import com.subsidy.vo.vod.QueryVodPageVO;
import com.subsidy.vo.vod.VodPlayStateVO;
import org.springframework.stereotype.Repository;
@@ -45,4 +47,8 @@ public interface VodDictMapper extends BaseMapper {
* 重复数据查找
*/
List testPlays(Long memberId,Long classId);
+
+ List getCompanyVod(Long contentId);
+
+ IPage queryVodPage(Page page, Long labelId, String vodName);
}
diff --git a/src/main/java/com/subsidy/model/BusinessScopeDictDO.java b/src/main/java/com/subsidy/model/BusinessScopeDictDO.java
index b11f71a..3fe8d05 100644
--- a/src/main/java/com/subsidy/model/BusinessScopeDictDO.java
+++ b/src/main/java/com/subsidy/model/BusinessScopeDictDO.java
@@ -27,6 +27,8 @@ public class BusinessScopeDictDO extends BaseModel {
private Long parentId;
+ private Long companyId;
+
/**
* 经营范围名称
*/
diff --git a/src/main/java/com/subsidy/service/ContentVodMappingService.java b/src/main/java/com/subsidy/service/ContentVodMappingService.java
index 695e234..fd1a6f4 100644
--- a/src/main/java/com/subsidy/service/ContentVodMappingService.java
+++ b/src/main/java/com/subsidy/service/ContentVodMappingService.java
@@ -27,4 +27,6 @@ public interface ContentVodMappingService extends IService
void deleteContentVod(ContentVodDTO contentVodDTO);
void addContentVod(AddContentVodDTO addContentVod);
+
+ void updateContentVod(AddContentVodDTO addContentVod);
}
diff --git a/src/main/java/com/subsidy/service/VodDictService.java b/src/main/java/com/subsidy/service/VodDictService.java
index 3dcdf4a..08cbfea 100644
--- a/src/main/java/com/subsidy/service/VodDictService.java
+++ b/src/main/java/com/subsidy/service/VodDictService.java
@@ -22,11 +22,13 @@ public interface VodDictService extends IService {
void deleteVod(VodDictDO vodDictDO);
- void addVod(AddVodDictDTO addVodDictDTO);
+ void addVod(VodDictDO vodDictDO);
void updateVod(VodDictDO vodDictDO);
void changeOrders(ChangeOrdersDTO changeOrdersDTO);
IPage queryVodPage(VodDictPageDTO vodDictPageDTO);
+
+ void addCompanyVod(AddVodDictDTO addVodDictDTO);
}
diff --git a/src/main/java/com/subsidy/service/impl/BusinessScopeDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/BusinessScopeDictServiceImpl.java
index 412bfcd..b3ee5af 100644
--- a/src/main/java/com/subsidy/service/impl/BusinessScopeDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/BusinessScopeDictServiceImpl.java
@@ -34,14 +34,15 @@ public class BusinessScopeDictServiceImpl extends ServiceImpl iPage = this.baseMapper.queryBusinessScopePage(page, businessScopeDictDO.getBusinessScopeName());
- iPage.getRecords().forEach(businessScopeDictVO -> {
- iPage.getRecords().forEach(bs -> {
- if(bs.getParentId().equals(businessScopeDictVO.getId())) {
- if(businessScopeDictVO.getChildNode() == null) {
- businessScopeDictVO.setChildNode(new ArrayList<>());
+ IPage iPage = this.baseMapper.queryBusinessScopePage(page, businessScopeDictDO.getCompanyId(), businessScopeDictDO.getBusinessScopeName());
+ iPage.getRecords().forEach(businessScope -> {
+ List list = this.baseMapper.queryBusinessScopeChildNode();
+ list.forEach(childNode -> {
+ if(childNode.getParentId().equals(businessScope.getId())) {
+ if(businessScope.getChildNode() == null) {
+ businessScope.setChildNode(new ArrayList<>());
}
- businessScopeDictVO.getChildNode().add(bs);
+ businessScope.getChildNode().add(childNode);
}
});
});
@@ -53,6 +54,7 @@ public class BusinessScopeDictServiceImpl extends ServiceImpl()
+ .lambda()
+ .eq(ContentVodMappingDO::getVodId, contentVodDTO.getVodId())
+ .eq(ContentVodMappingDO::getContentId, addContentVodDTO.getContentId()));
+ if(contentVodMappingDO != null) {
+ ContentVodMappingDO cvm = new ContentVodMappingDO();
+ cvm.setId(contentVodMappingDO.getId());
+ cvm.setVodAliasName(contentVodDTO.getVodAliasName());
+ this.baseMapper.updateById(cvm);
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java
index f60f565..812c39a 100644
--- a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java
@@ -12,21 +12,27 @@ import com.subsidy.dto.vod.AddVodDictDTO;
import com.subsidy.dto.vod.ChangeOrdersDTO;
import com.subsidy.dto.vod.VodDictPageDTO;
import com.subsidy.mapper.ContentVodMappingMapper;
+import com.subsidy.mapper.CourseDictMapper;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.model.ContentVodMappingDO;
+import com.subsidy.model.CourseDictDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.VodDictService;
import com.subsidy.util.Signature;
import com.subsidy.util.VodUtil;
import com.subsidy.vo.vod.GetContendVodsVO;
+import com.subsidy.vo.vod.QueryVodPageVO;
import com.subsidy.vo.vod.SignatureVO;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+import java.util.stream.Collectors;
/**
*
@@ -48,6 +54,9 @@ public class VodDictServiceImpl extends ServiceImpl im
@Autowired
private ContentVodMappingMapper contentVodMappingMapper;
+ @Autowired
+ private CourseDictMapper courseDictMapper;
+
@Override
public SignatureVO signature() {
SignatureVO signatureVO = new SignatureVO();
@@ -85,11 +94,11 @@ public class VodDictServiceImpl extends ServiceImpl im
}
@Override
- public void addVod(AddVodDictDTO addVodDictDTO) {
+ public void addVod(VodDictDO vodDictDO) {
int orderNo = 1;//排序
List vodDictDOS = this.baseMapper.selectList(new QueryWrapper()
.lambda()
- .eq(VodDictDO::getLabelId, addVodDictDTO.getLabelId())
+ .eq(VodDictDO::getLabelId, vodDictDO.getLabelId())
.orderByDesc(VodDictDO::getOrderNo));
if (CollectionUtils.isNotEmpty(vodDictDOS)){
@@ -99,6 +108,26 @@ public class VodDictServiceImpl extends ServiceImpl im
}
}
+ vodDictDO.setOrderNo(orderNo);
+ this.baseMapper.insert(vodDictDO);
+
+ //测试环境就不转码了
+ if (env.equals("prod")){
+ VodUtil.processMedia(vodConfig, vodDictDO.getVodCode());
+ }
+ }
+
+ @Override
+ public void addCompanyVod(AddVodDictDTO addVodDictDTO) {
+ int orderNo = 1;//排序
+ List vodDictDOS = this.baseMapper.getCompanyVod(addVodDictDTO.getContentId());
+ if (CollectionUtils.isNotEmpty(vodDictDOS)){
+ VodDictDO vod = vodDictDOS.get(0);
+ if (null != vod){
+ orderNo = vod.getOrderNo() + 1;
+ }
+ }
+
addVodDictDTO.setOrderNo(orderNo);
this.baseMapper.insert(addVodDictDTO);
@@ -130,12 +159,15 @@ public class VodDictServiceImpl extends ServiceImpl im
}
@Override
- public IPage queryVodPage(VodDictPageDTO vodDictPageDTO) {
+ public IPage queryVodPage(VodDictPageDTO vodDictPageDTO) {
Page page = new Page(vodDictPageDTO.getPageNum(), vodDictPageDTO.getPageSize());
- return this.baseMapper.selectPage(page, new QueryWrapper()
- .lambda()
- .eq(VodDictDO::getLabelId, vodDictPageDTO.getLabelId())
- .like(StringUtils.isNotBlank(vodDictPageDTO.getVodName()), VodDictDO::getVodName, vodDictPageDTO.getVodName()));
+ IPage iPage = this.baseMapper.queryVodPage(page, vodDictPageDTO.getLabelId(), vodDictPageDTO.getVodName());
+ for (QueryVodPageVO queryVodPageVO : iPage.getRecords()) {
+ List list = courseDictMapper.getListByVodId(queryVodPageVO.getId());
+ List courseNames = list.stream().map(CourseDictDO::getCourseName).collect(Collectors.toList());
+ queryVodPageVO.setCourseNames(courseNames);
+ }
+ return iPage;
}
}
diff --git a/src/main/java/com/subsidy/vo/vod/QueryVodPageVO.java b/src/main/java/com/subsidy/vo/vod/QueryVodPageVO.java
new file mode 100644
index 0000000..b9e5494
--- /dev/null
+++ b/src/main/java/com/subsidy/vo/vod/QueryVodPageVO.java
@@ -0,0 +1,66 @@
+package com.subsidy.vo.vod;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class QueryVodPageVO {
+
+ private Long id;
+
+ /**
+ * 类目id
+ */
+ private Long labelId;
+
+ /**
+ * 视频名称
+ */
+ private String vodName;
+
+ /**
+ * 视频时长
+ */
+ private Integer vodLength;
+
+ /**
+ * 视频格式
+ */
+ private String vodType;
+
+ /**
+ * 视频大小
+ */
+ private String vodSize;
+
+ /**
+ * 视频地址
+ */
+ private String vodUrl;
+
+ /**
+ * 视频编码
+ */
+ private String vodCode;
+
+ /**
+ * 讲师名称
+ */
+ private String teacherName;
+
+ /**
+ * 封面
+ */
+ private String coverPage;
+
+ /**
+ * 排序
+ */
+ private Integer orderNo;
+
+ /**
+ * 关联课程名称
+ */
+ private List courseNames;
+}
diff --git a/src/main/resources/mapper/BusinessScopeDictMapper.xml b/src/main/resources/mapper/BusinessScopeDictMapper.xml
index ccc689d..c499655 100644
--- a/src/main/resources/mapper/BusinessScopeDictMapper.xml
+++ b/src/main/resources/mapper/BusinessScopeDictMapper.xml
@@ -9,6 +9,7 @@
+
@@ -17,17 +18,34 @@
create_date,
update_date,
delete_date,
- id, parent_id, business_scope_name
+ id, parent_id, company_id, business_scope_name
+
+
diff --git a/src/main/resources/mapper/CourseDictMapper.xml b/src/main/resources/mapper/CourseDictMapper.xml
index 82802c4..265c64f 100644
--- a/src/main/resources/mapper/CourseDictMapper.xml
+++ b/src/main/resources/mapper/CourseDictMapper.xml
@@ -136,6 +136,20 @@
AND t1.course_id = #{courseId}
+
+
update course_dict set open_status = #{openStatus} where id = #{id}
diff --git a/src/main/resources/mapper/VodDictMapper.xml b/src/main/resources/mapper/VodDictMapper.xml
index 43d59a0..5fc7631 100644
--- a/src/main/resources/mapper/VodDictMapper.xml
+++ b/src/main/resources/mapper/VodDictMapper.xml
@@ -113,4 +113,29 @@
t.member_id,
start_date
+
+
+
+
--
libgit2 0.25.0