Commit a9e6d8a8 by 邓敏

经营范围

1 parent 05c3ab8d
......@@ -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));
......
......@@ -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);
}
}
......@@ -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);
}
......
......@@ -11,6 +11,8 @@ public class AddBusinessScopeDTO {
*/
private String businessScopeName;
private Long companyId;
/**
* 经营范围类目
*/
......
......@@ -7,6 +7,8 @@ public class BusinessScopeDTO {
private String businessScopeName;
private Long companyId;
private Integer pageNum;
private Integer pageSize;
......
......@@ -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;
/**
* <p>
* 经营范围表 Mapper 接口
......@@ -18,5 +20,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface BusinessScopeDictMapper extends BaseMapper<BusinessScopeDictDO> {
IPage<BusinessScopeDictVO> queryBusinessScopePage(Page page, String businessScopeName);
IPage<BusinessScopeDictVO> queryBusinessScopePage(Page page, Long companyId, String businessScopeName);
List<BusinessScopeDictVO> queryBusinessScopeChildNode();
}
......@@ -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<CourseDictDO> {
void updateOpenStatus(CourseDictDO courseDictDO);
List<CourseDictDO> getListByVodId(@Param("vodId") Long vodId);
}
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<VodDictDO> {
* 重复数据查找
*/
List<VodPlayStateVO> testPlays(Long memberId,Long classId);
List<VodDictDO> getCompanyVod(Long contentId);
IPage<QueryVodPageVO> queryVodPage(Page page, Long labelId, String vodName);
}
......@@ -27,6 +27,8 @@ public class BusinessScopeDictDO extends BaseModel {
private Long parentId;
private Long companyId;
/**
* 经营范围名称
*/
......
......@@ -27,4 +27,6 @@ public interface ContentVodMappingService extends IService<ContentVodMappingDO>
void deleteContentVod(ContentVodDTO contentVodDTO);
void addContentVod(AddContentVodDTO addContentVod);
void updateContentVod(AddContentVodDTO addContentVod);
}
......@@ -22,11 +22,13 @@ public interface VodDictService extends IService<VodDictDO> {
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);
}
......@@ -34,14 +34,15 @@ public class BusinessScopeDictServiceImpl extends ServiceImpl<BusinessScopeDictM
@Override
public IPage queryBusinessScopePage(BusinessScopeDTO businessScopeDictDO) {
Page page = new Page(businessScopeDictDO.getPageNum(), businessScopeDictDO.getPageSize());
IPage<BusinessScopeDictVO> 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<BusinessScopeDictVO> iPage = this.baseMapper.queryBusinessScopePage(page, businessScopeDictDO.getCompanyId(), businessScopeDictDO.getBusinessScopeName());
iPage.getRecords().forEach(businessScope -> {
List<BusinessScopeDictVO> 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<BusinessScopeDictM
if(addBusinessScopeDTO != null) {
BusinessScopeDictDO businessScopeDictDO = new BusinessScopeDictDO();
businessScopeDictDO.setBusinessScopeName(addBusinessScopeDTO.getBusinessScopeName());
businessScopeDictDO.setCompanyId(addBusinessScopeDTO.getCompanyId());
this.baseMapper.insert(businessScopeDictDO);
if(CollectionUtils.isNotEmpty(addBusinessScopeDTO.getBusinessScopeItems())) {
......@@ -60,6 +62,7 @@ public class BusinessScopeDictServiceImpl extends ServiceImpl<BusinessScopeDictM
BusinessScopeDictDO childNode = new BusinessScopeDictDO();
childNode.setParentId(businessScopeDictDO.getId());
childNode.setBusinessScopeName(businessScopeName);
childNode.setCompanyId(addBusinessScopeDTO.getCompanyId());
this.baseMapper.insert(childNode);
}
}
......
......@@ -86,4 +86,22 @@ public class ContentVodMappingServiceImpl extends ServiceImpl<ContentVodMappingM
}
}
}
@Override
public void updateContentVod(AddContentVodDTO addContentVodDTO) {
if(CollectionUtils.isNotEmpty(addContentVodDTO.getVodIds())) {
for (ContentVodDTO contentVodDTO : addContentVodDTO.getVodIds()) {
ContentVodMappingDO contentVodMappingDO = this.baseMapper.selectOne(new QueryWrapper<ContentVodMappingDO>()
.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);
}
}
}
}
}
......@@ -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;
/**
* <p>
......@@ -48,6 +54,9 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> 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<VodDictMapper, VodDictDO> im
}
@Override
public void addVod(AddVodDictDTO addVodDictDTO) {
public void addVod(VodDictDO vodDictDO) {
int orderNo = 1;//排序
List<VodDictDO> vodDictDOS = this.baseMapper.selectList(new QueryWrapper<VodDictDO>()
.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<VodDictMapper, VodDictDO> 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<VodDictDO> 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<VodDictMapper, VodDictDO> im
}
@Override
public IPage<VodDictDO> queryVodPage(VodDictPageDTO vodDictPageDTO) {
public IPage queryVodPage(VodDictPageDTO vodDictPageDTO) {
Page page = new Page(vodDictPageDTO.getPageNum(), vodDictPageDTO.getPageSize());
return this.baseMapper.selectPage(page, new QueryWrapper<VodDictDO>()
.lambda()
.eq(VodDictDO::getLabelId, vodDictPageDTO.getLabelId())
.like(StringUtils.isNotBlank(vodDictPageDTO.getVodName()), VodDictDO::getVodName, vodDictPageDTO.getVodName()));
IPage<QueryVodPageVO> iPage = this.baseMapper.queryVodPage(page, vodDictPageDTO.getLabelId(), vodDictPageDTO.getVodName());
for (QueryVodPageVO queryVodPageVO : iPage.getRecords()) {
List<CourseDictDO> list = courseDictMapper.getListByVodId(queryVodPageVO.getId());
List<String> courseNames = list.stream().map(CourseDictDO::getCourseName).collect(Collectors.toList());
queryVodPageVO.setCourseNames(courseNames);
}
return iPage;
}
}
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<String> courseNames;
}
......@@ -9,6 +9,7 @@
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="parent_id" property="parentId" />
<result column="company_id" property="companyId" />
<result column="business_scope_name" property="businessScopeName" />
</resultMap>
......@@ -17,17 +18,34 @@
create_date,
update_date,
delete_date,
id, parent_id, business_scope_name
id, parent_id, company_id, business_scope_name
</sql>
<select id="queryBusinessScopePage" resultType="com.subsidy.vo.businessScope.BusinessScopeDictVO">
select * from business_scope_dict
SELECT * FROM business_scope_dict
<where>
<if test="businessScopeName != null">
business_scope_name like concat('%', #{businessScopeName} ,'%')
AND business_scope_name LIKE concat('%', #{businessScopeName} ,'%')
</if>
delete_date is null
<if test="companyId != null and companyId != ''">
AND company_id = #{companyId}
</if>
<if test="companyId == null or companyId == ''">
AND company_id IS NULL
</if>
AND parent_id = 0
AND delete_date IS NULL
</where>
</select>
<select id="queryBusinessScopeChildNode" resultType="com.subsidy.vo.businessScope.BusinessScopeDictVO">
SELECT
*
FROM
business_scope_dict
WHERE
parent_id != 0
AND delete_date IS NULL
</select>
</mapper>
......@@ -136,6 +136,20 @@
AND t1.course_id = #{courseId}
</select>
<select id="getListByVodId" resultType="com.subsidy.model.CourseDictDO">
SELECT
t1.*
FROM
course_dict t1
LEFT JOIN course_content t2 ON t2.course_id = t1.id
LEFT JOIN content_vod_mapping t3 ON t3.content_id = t2.id
WHERE
t3.vod_id = #{vodId}
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
</select>
<update id="updateOpenStatus">
update course_dict set open_status = #{openStatus} where id = #{id}
</update>
......
......@@ -113,4 +113,29 @@
t.member_id,
start_date
</select>
<select id="getCompanyVod" resultType="com.subsidy.model.VodDictDO">
SELECT
t1.*
FROM
vod_dict t1
LEFT JOIN content_vod_mapping t2 ON t2.vod_id = t1.id
WHERE
t2.content_id = #{conetntId}
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
GROUP BY
t1.order_no DESC
</select>
<select id="queryVodPage" resultType="com.subsidy.vo.vod.QueryVodPageVO">
SELECT * FROM vod_dict
<where>
<if test="vodName != null and vodName != ''">
AND vod_name LIKE concat('%', #{vodName}, '%')
</if>
AND label_id = #{labelId}
AND delete_date IS NULL
</where>
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!