提交 eb364cf0 authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 553440c9
......@@ -3,7 +3,6 @@ package com.zrqx.resource.bg.controller.courselibrary;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -21,26 +20,27 @@ import com.zrqx.core.exception.BaseException;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.resource.bg.service.ResourceRelationService;
import com.zrqx.resource.bg.service.courselibrary.CourseLibraryDiyTypeService;
import com.zrqx.resource.bg.service.courselibrary.CourseLibraryLabelContentDiyTypeService;
import com.zrqx.resource.bg.service.courselibrary.CourseLibraryService;
import com.zrqx.resource.bg.service.recommend.RecommendResourceService;
import com.zrqx.resource.bg.service.videolibrary.VideoLibraryService;
import com.zrqx.resource.commons.form.bg.courselibrary.BatchUpdateCourseLibraryForm;
import com.zrqx.resource.commons.form.bg.courselibrary.QueryCourseAndVideoForm;
import com.zrqx.resource.commons.form.bg.courselibrary.QueryCourseLibraryForm;
import com.zrqx.resource.commons.form.bg.courselibrary.SaveUpdateCourseLibraryForm;
import com.zrqx.resource.commons.form.bg.recommend.UpdateRecommendResourceForm;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibrary;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibraryDiyType;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibraryLabelContentDiyType;
import com.zrqx.resource.commons.model.videolibrary.VideoLibrary;
import com.zrqx.resource.commons.vo.bg.courselibrary.CourseLibraryListVO;
import com.zrqx.resource.commons.vo.bg.courselibrary.CourseLibraryVO;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;
/**
* 视频库Controller
......@@ -55,50 +55,25 @@ public class CourseLibraryController {
@Autowired
private CourseLibraryDiyTypeService courseLibraryDiyTypeService;
@Autowired
private CourseLibraryLabelContentDiyTypeService courseLibraryLabelContentDiyTypeService;
@Autowired
private ResourceRelationService resourceRelationService;
@Autowired
private RecommendResourceService recommendResourceService;
@Autowired
private VideoLibraryService videoLibraryService;
@ApiOperation(value = "新增" , notes ="新增一个")
@ApiOperation(value = "新增/修改 系列课资源" , notes ="新增/修改 系列课资源")
@PostMapping(value = "/save")
public CallBack<Boolean> save(@RequestBody SaveUpdateCourseLibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "更新" , notes ="根据ID更新")
@PostMapping(value = "/update")
public CallBack<Boolean> update(@RequestBody SaveUpdateCourseLibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
if(StringUtils.isNotBlank(form.getId())) {
CourseLibrary entity = service.selectByPrimaryKey(form.getId());
//推荐位内容修改
UpdateRecommendResourceForm res = new UpdateRecommendResourceForm();
res.setResId(form.getId());
res.setResType(entity.getResourceType());
res.setResImg(form.getCover());
res.setResImg(form.getImg());
res.setResName(form.getName());
recommendResourceService.updateResourceContent(res);
return CallBack.success();
}
@ApiOperation(value = "批量审核", notes = "批量审核")
@PostMapping(value = "/batch/update/status")
public CallBack<Boolean> updateArray(@RequestBody List<String> ids) {
Example example = service.createExample();
example.createCriteria().andIn("id", ids);
CourseLibrary entity = new CourseLibrary();
entity.setUpdateTime(new Date());
entity.setStatus(LibraryStatusEnum.STATUS_1.getCode());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}
......@@ -109,7 +84,12 @@ public class CourseLibraryController {
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
CourseLibrary entity = new CourseLibrary();
entity.setPriceOption(form.getPriceOption());
if(PriceOptionEnum.STATUS_0.getCode().equals(form.getPriceOption())) {
form.setRealPrice(new BigDecimal(0));
}
entity.setRealPrice(form.getRealPrice());
entity.setPrice(form.getPrice());
entity.setUpdateTime(new Date());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BaseException("操作失败");
......@@ -121,14 +101,8 @@ public class CourseLibraryController {
@PostMapping(value = "/batch/update/updown")
public CallBack<Boolean> updateShowState(@RequestBody BatchUpdateCourseLibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
List<CourseLibrary> list = service.selectByExample(example);
for (CourseLibrary entity : list) {
if(entity.getStatus() == LibraryStatusEnum.STATUS_0.getCode()){
throw new BaseException("待审核状态的课程不能直接操作上架状态需通过批量审核操作上架");
}
}
CourseLibrary entity = new CourseLibrary();
example.createCriteria().andIn("id", form.getIds());
entity.setStatus(form.getStatus());
entity.setUpdateTime(new Date());
if(!service.UpdateByExampleSelective(entity,example)){
......@@ -162,14 +136,6 @@ public class CourseLibraryController {
List<CourseLibraryDiyType> list = courseLibraryDiyTypeService.selectByExample(example);
//组装自定义分类
vo.setDiyType(list);
//组装标签分类
example = courseLibraryLabelContentDiyTypeService.createExample();
example.createCriteria().andEqualTo("courseLibraryId", oid);
List<CourseLibraryLabelContentDiyType> vlcdList = courseLibraryLabelContentDiyTypeService.selectByExample(example);
vo.setLabel(vlcdList);
// 选中的LabelContentDiyTypeId
List<Integer> labelContentDiyTypeIds = vlcdList.stream().map(CourseLibraryLabelContentDiyType :: getLabelContentDiyTypeId).collect(Collectors.toList());
vo.setLabelContentDiyTypeIds(labelContentDiyTypeIds);
return CallBack.success(vo);
}
......@@ -180,18 +146,96 @@ public class CourseLibraryController {
}
/**
* 修改视频价格为免费,id集合
* @param ids
* @param status
* @author ycw
* @date: 2019年8月1日 下午3:09:50
* 相关资源列表
* @param form 分页条件
* @return
* @author xjg
* @date 2018年9月11日 上午10:20:30
*/
private void updateVideoPrice(List<String> ids){
Example example = videoLibraryService.createExample();
example.createCriteria().andIn("bookId", ids);
VideoLibrary video = new VideoLibrary();
video.setPriceOption(PriceOptionEnum.STATUS_0.getCode());
video.setRealPrice(new BigDecimal(0));
videoLibraryService.UpdateByExampleSelective(video,example);
@ApiOperation("相关视频资源列表")
@GetMapping(value = "/relation-resource/page")
public CallBack<PageInfo<VideoLibraryListVO>> videoRelationPage(String courseId, PageParam pageParam) {
if (StringUtils.isBlank(courseId)) {
throw new BaseException("必须指定courseId");
}
return CallBack.success(service.videoRelationPage(courseId,pageParam));
}
/**
* 修改视频序号
* @param videoId 视频id
* @param sort 排序号
* @return
* @author xjg
* @date 2018年9月11日 上午10:21:22
*/
@ApiOperation(value = "修改相关视频资源序号", notes = "修改相关视频资源序号")
@PostMapping(value = "/update/relation-resource/sort")
public CallBack<Boolean> updateSort(String videoId, Integer sort) {
VideoLibrary video = videoLibraryService.selectByPrimaryKey(videoId);
if (video == null) {
throw new BaseException("视频不存在");
}
video.setSort(sort);
video.setUpdateTime(new Date());
if (!videoLibraryService.updateByPrimaryKey(video)) {
throw new BaseException("修改相关视频资源序号失败!");
}
return CallBack.success();
}
/**
* 批量取消视频关联
* @param ids 视频id数组
* @param courseId 课程id
* @return
* @author xjg
* @date 2018年9月11日 上午10:22:27
*/
@ApiOperation(value = "取消视频关联", notes = "批量取消视频关联")
@PostMapping(value = "/batch/delete/relation-resource")
public CallBack<Boolean> deleteByVideoIds(@RequestBody List<String>videoIds) {
Example example = new Example(VideoLibrary.class);
example.createCriteria().andIn("id", videoIds);
List<VideoLibrary> list = videoLibraryService.selectByExample(example);
list.forEach(f -> {
f.setCourseId(null);
videoLibraryService.updateByPrimaryKey(f);
});
return CallBack.success();
}
/**
* 选择弹窗中的列表
* @param form 选择弹窗中列表的条件
* @return 选择弹窗中的视频集合
* @author xjg
* @date 2018年9月11日 上午10:24:08
*/
@ApiOperation(value = "选择弹窗中的列表", notes = "查询选择弹窗中的列表")
@GetMapping(value = "/relation-resource/pop/page")
public CallBack<PageInfo<VideoLibraryListVO>> popPage(QueryCourseAndVideoForm form, PageParam pageParam) {
return CallBack.success(service.popPage(form,pageParam));
}
/**
* 保存相关资源
* @param videoIds 视频id数组
* @param courseId 课程id
* @return
* @author xjg
* @date 2018年9月11日 上午10:25:50
*/
@ApiOperation(value = "保存相关资源", notes = "保存相关资源")
@PostMapping(value = "/save/relation-resource")
public CallBack<Boolean> saveRelation(@RequestBody List<String> videoIds, String courseId) {
Example example = new Example(VideoLibrary.class);
example.createCriteria().andIn("id", videoIds);
VideoLibrary videoLibrary = new VideoLibrary();
videoLibrary.setCourseId(courseId);
videoLibrary.setUpdateTime(new Date());
videoLibraryService.UpdateByExampleSelective(videoLibrary, example);
return CallBack.success();
}
}
package com.zrqx.resource.bg.controller.videolibrary;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -17,26 +17,21 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.enums.resource.PriceOptionEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.resource.bg.service.ResourceRelationService;
import com.zrqx.resource.bg.service.marketing.PromotionContentService;
import com.zrqx.resource.bg.service.recommend.RecommendResourceService;
import com.zrqx.resource.bg.service.videolibrary.VideoLibraryDiyTypeService;
import com.zrqx.resource.bg.service.videolibrary.VideoLibraryLabelContentDiyTypeService;
import com.zrqx.resource.bg.service.videolibrary.VideoLibraryService;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.recommend.UpdateRecommendResourceForm;
import com.zrqx.resource.commons.form.bg.videolibrary.BatchUpdateVideoLibraryForm;
import com.zrqx.resource.commons.form.bg.videolibrary.QueryVideoLibraryForm;
import com.zrqx.resource.commons.form.bg.videolibrary.SaveUpdateVideoLibraryForm;
import com.zrqx.resource.commons.form.bg.videolibrary.SaveVideoLibraryForm;
import com.zrqx.resource.commons.model.marketing.PromotionContent;
import com.zrqx.resource.commons.model.videolibrary.VideoLibrary;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryDiyType;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryLabelContentDiyType;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryOneVO;
......@@ -56,58 +51,40 @@ public class VideoLibraryController {
private VideoLibraryService service;
@Autowired
private VideoLibraryDiyTypeService vdrService;
@Autowired
private ResourceRelationService resourceRelationService;
/** 推荐位内容*/
@Autowired
private RecommendResourceService recommendResourceService;
/** 促销内容*/
@Autowired
private PromotionContentService promotionContentService;
@Autowired
private VideoLibraryLabelContentDiyTypeService alcdService;
@ApiOperation(value = "新增" , notes ="新增一个")
@ApiOperation(value = "新增/修改 视频资源" , notes ="新增/修改 视频资源")
@PostMapping(value = "/save")
public CallBack<Boolean> save(@RequestBody SaveUpdateVideoLibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
if(StringUtils.isNotBlank(form.getId())) {
VideoLibrary entity = service.selectByPrimaryKey(form.getId());
//推荐位内容修改
UpdateRecommendResourceForm res = new UpdateRecommendResourceForm();
res.setResId(form.getId());
res.setResType(entity.getResourceType());
res.setResImg(form.getImg());
res.setResName(form.getName());
recommendResourceService.updateResourceContent(res);
}
return CallBack.success();
}
@ApiOperation(value = "导入视频" , notes ="导入视频")
@PostMapping(value = "/import")
public CallBack<Boolean> save(@RequestBody SaveVideoLibraryForm form){
public CallBack<Boolean> save(@RequestBody List<SaveVideoLibraryForm> form){
if(!service.batchInsert(form)){
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "更新" , notes ="根据ID更新")
@PostMapping(value = "/update")
public CallBack<Boolean> update(@RequestBody SaveUpdateVideoLibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
VideoLibrary entity = service.selectByPrimaryKey(form.getId());
//促销活动内容修改
PromotionContent con = new PromotionContent();
con.setResourceId(form.getId());
con.setResourceType(entity.getResourceType());
con.setName(form.getName());
promotionContentService.updateContent(con);
//推荐位内容修改
UpdateRecommendResourceForm res = new UpdateRecommendResourceForm();
res.setResId(form.getId());
res.setResType(entity.getResourceType());
res.setResImg(form.getCover());
res.setResName(form.getName());
recommendResourceService.updateResourceContent(res);
return CallBack.success();
}
@ApiOperation(value = "批量修改分类", notes = "批量修改分类")
@PostMapping(value = "/batch/update/diytype")
......@@ -129,13 +106,19 @@ public class VideoLibraryController {
return CallBack.success();
}
@ApiOperation(value = "批量修改价格" , notes ="批量修改价格")
@ApiOperation(value = "批量修改销售设置" , notes ="批量修改销售设置")
@PostMapping(value = "/batch/update/price")
public CallBack<Boolean> updatePrice(@RequestBody BatchUpdateVideoLibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
VideoLibrary entity = new VideoLibrary();
if(PriceOptionEnum.STATUS_0.getCode().equals(form.getPriceOption())) {
form.setRealPrice(new BigDecimal(0));
}
entity.setRealPrice(form.getRealPrice());
entity.setPrice(form.getPrice());
entity.setPriceOption(form.getPriceOption());
entity.setSalesType(form.getSaleType());
entity.setUpdateTime(new Date());
if(!service.UpdateByExampleSelective(entity,example)){
throw new BaseException("操作失败");
......@@ -143,37 +126,20 @@ public class VideoLibraryController {
return CallBack.success();
}
@ApiOperation(value = "批量审核", notes = "批量审核")
@PostMapping(value = "/batch/update/status")
public CallBack<Boolean> updateArray(@RequestBody List<String> ids) {
Example example = service.createExample();
example.createCriteria().andIn("id", ids);
VideoLibrary entity = new VideoLibrary();
entity.setUpdateTime(new Date());
entity.setStatus(LibraryStatusEnum.STATUS_1.getCode());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量 上架/下架" , notes ="批量 上架/下架")
@PostMapping(value = "/batch/update/updown")
public CallBack<Boolean> updateShowState(@RequestBody BatchUpdateVideoLibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
List<VideoLibrary> list = service.selectByExample(example);
for (VideoLibrary entity : list) {
if(entity.getStatus() == LibraryStatusEnum.STATUS_0.getCode()){
throw new BaseException("待审核状态的文章不能直接操作上架状态需通过批量审核操作上架");
}
}
VideoLibrary entity = new VideoLibrary();
entity.setStatus(form.getStatus());
entity.setUpdateTime(new Date());
if(!service.UpdateByExampleSelective(entity,example)){
throw new BaseException("操作失败");
list.forEach(f -> {
f.setStatus(form.getStatus());
f.setUpdateTime(new Date());
if(LibraryStatusEnum.STATUS_2.getCode().equals(form.getStatus())) {
f.setCourseId(null);
}
service.updateByPrimaryKey(f);
});
return CallBack.success();
}
......@@ -189,6 +155,7 @@ public class VideoLibraryController {
}
return CallBack.success(true);
}
@ApiOperation(value = "批量删除", notes = "批量删除")
@PostMapping(value = "/batch/delete")
public CallBack<Boolean> deleteByIds(@RequestBody List<String> ids) {
......@@ -217,14 +184,6 @@ public class VideoLibraryController {
List<VideoLibraryDiyType> list = vdrService.selectByExample(example);
//组装自定义分类
vo.setDiyType(list);
//组装标签分类
example = alcdService.createExample();
example.createCriteria().andEqualTo("videoId", oid);
List<VideoLibraryLabelContentDiyType> vlcdList = alcdService.selectByExample(example);
vo.setLabel(vlcdList);
// 选中的LabelContentDiyTypeId
List<Integer> labelContentDiyTypeIds = vlcdList.stream().map(VideoLibraryLabelContentDiyType :: getLabelContentDiyTypeId).collect(Collectors.toList());
vo.setLabelContentDiyTypeIds(labelContentDiyTypeIds);
return CallBack.success(vo);
}
......@@ -234,22 +193,4 @@ public class VideoLibraryController {
return CallBack.success(service.page(form, pageParam));
}
@ApiOperation(value = "选择弹窗中的列表" , notes ="查询选择弹窗中的列表")
@GetMapping(value = "/relation-resource/pop-page")
public CallBack<PageInfo<VideoLibraryListVO>> page(QueryResourceForPoPForm form, PageParam pageParam){
return CallBack.success(service.pageByTitleAndDiyType(form, pageParam));
}
@ApiOperation(value = "批量修改阅读权限", notes = "批量修改阅读权限")
@PostMapping(value = "/batch/update/read")
public CallBack<Boolean> updateReadTextPower(@RequestBody BatchUpdateVideoLibraryForm form) {
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
VideoLibrary entity = new VideoLibrary();
entity.setReadTextPower(form.getReadTextPower());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}
}
......@@ -8,16 +8,18 @@ import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.courselibrary.QueryCourseAndVideoForm;
import com.zrqx.resource.commons.form.bg.courselibrary.QueryCourseLibraryForm;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibrary;
import com.zrqx.resource.commons.vo.bg.courselibrary.CourseLibraryListVO;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
/**
* 课程库
*/
public interface CourseLibraryMapper extends BaseMapper<CourseLibrary> {
@Select("<script>"
+ "select a.id,a.name,a.author,a.source,a.cover,a.realPrice,DATE_FORMAT(a.authorizationTime,'%Y-%m-%d %H:%i:%s') authorizationTime, DATE_FORMAT(a.uploadTime,'%Y-%m-%d %H:%i:%s') uploadTime,a.status,a.resourceType "
+ "select a.id,a.name,a.author,a.img,a.realPrice, DATE_FORMAT(a.uploadTime,'%Y-%m-%d %H:%i') uploadTime,a.status,a.resourceType "
+ "from res_Course_Library a left join res_Course_Library_Diy_Type ad "
+ "on a.id = ad.CourseLibraryId "
+ "where 1=1 "
......@@ -54,4 +56,30 @@ public interface CourseLibraryMapper extends BaseMapper<CourseLibrary> {
+ "</if>"
+ "</script>")
List<CourseLibraryListVO> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm form);
/**
* 根据课程id查询关联视频
* @param courseId
* @return
*/
@Select("<script>"
+ "select id,name,timeLength,sort,status from res_video_library "
+ " where 1 = 1 and status = 1 and courseId = #{courseId}"
+ " order by sort asc,uploadTime desc "
+ "</script>")
List<VideoLibraryListVO> videoRelationPage(@Param("courseId")String courseId);
/**
* 查询未关联视频列表
* @param form
* @return
*/
@Select("<script>"
+ " select id,name,author,DATE_FORMAT(uploadTime,'%Y-%m-%d %H:%i') uploadTime,status from res_video_library "
+ " where 1 = 1 and status = 1 and courseId is null and salesType = 2 "
+ " like(name,form.name) "
+ " like(author,form.author) "
+ " order by uploadTime desc "
+ "</script>")
List<VideoLibraryListVO> popPage(@Param("form")QueryCourseAndVideoForm form);
}
......@@ -16,12 +16,10 @@ import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
*/
public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
@Select("<script>"
+ "select a.id,a.name,a.source,a.bookName,a.realprice,a.timeLength,a.size,a.uploadTime,a.status "
+ "select a.id,a.name,a.realprice, DATE_FORMAT(a.uploadTime,'%Y-%m-%d %H:%i') uploadTime,a.status,a.img,a.defaultImg,a.author "
+ "from res_Video_Library a left join res_Video_Library_Diy_Type ad "
+ "on a.id = ad.vlid "
+ "where 1=1 "
+ " eq(a.nationsType,form.nationsType) "
+ " like(ad.code,form.diyTypeCode) "
/*+ "<if test='form.diyTypeId != null and form.diyTypeId.size > 0'>"
......@@ -32,7 +30,6 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
+ "</if>" */
+ " like(a.name,form.name) "
+ " like(a.bookName,form.bookName) "
+ " eq(a.status,form.status) "
//+ "<if test = '" + NOTBLANK + "(form.beginTime)'>"
......@@ -47,15 +44,12 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
List<VideoLibraryListVO> query(@Param("form")QueryVideoLibraryForm form);
@Select("<script>"
+ "select a.id,a.name,a.source,a.author,a.bookName,a.price,a.timeLength,a.size,a.uploadTime,a.status,a.cover "
+ "select a.id,a.name,a.source,a.author,a.bookName,a.price,a.timeLength,a.size,a.uploadTime,a.status,a.img,a.defautImg "
+ "from res_Video_Library a left join res_Video_Library_Diy_Type ad "
+ "on a.id = ad.vlid "
+ "where 1=1 and a.status = 1 "
+ " eq(a.nationsType,form.nationsType) "
+ " like(ad.code,form.diyTypeCode) "
+ " like(a.name,form.name) "
+ "<if test='form.ids != null and form.ids.size > 0'>"
+ "and a.id not in "
+ " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
......
......@@ -3,7 +3,6 @@ package com.zrqx.resource.bg.service.courselibrary;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,7 +26,9 @@ import com.zrqx.resource.bg.mapper.membercollection.MemberCollectionMapper;
import com.zrqx.resource.bg.mapper.recommend.RecommendResourceMapper;
import com.zrqx.resource.bg.mapper.record.RecordMapper;
import com.zrqx.resource.bg.mapper.shoppingcart.ShoppingCartMapper;
import com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.courselibrary.QueryCourseAndVideoForm;
import com.zrqx.resource.commons.form.bg.courselibrary.QueryCourseLibraryForm;
import com.zrqx.resource.commons.form.bg.courselibrary.SaveUpdateCourseLibraryForm;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibrary;
......@@ -37,7 +38,9 @@ import com.zrqx.resource.commons.model.membercollection.MemberCollection;
import com.zrqx.resource.commons.model.record.Record;
import com.zrqx.resource.commons.model.resourcerelation.ResourceRelation;
import com.zrqx.resource.commons.model.shoppingcart.ShoppingCart;
import com.zrqx.resource.commons.model.videolibrary.VideoLibrary;
import com.zrqx.resource.commons.vo.bg.courselibrary.CourseLibraryListVO;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
import tk.mybatis.mapper.entity.Example;
......@@ -52,7 +55,7 @@ public class CourseLibrarySerivceImpl extends BaseServiceImpl<CourseLibrary,Stri
@Autowired
private CourseLibraryDiyTypeMapper courseLibraryDiyTypeMapper;
@Autowired
private CourseLibraryLabelContentDiyTypeMapper courseLibraryLabelContentDiyTypeMapper;
private VideoLibraryMapper videoMapper;
@Autowired
private RecommendResourceMapper recommendResourceMapper;
@Autowired
......@@ -89,10 +92,11 @@ public class CourseLibrarySerivceImpl extends BaseServiceImpl<CourseLibrary,Stri
}
if(entity.getId() == null){
//添加
entity.setStatus(LibraryStatusEnum.STATUS_0.getCode());
entity.setStatus(LibraryStatusEnum.STATUS_2.getCode());
entity.setUploadTime(new Date());
entity.setResourceType(AllResourceTypeEnum.COURSE.getCode());
entity.setBrowseNum(50);
entity.setBrowseNum(0);
entity.setSalesNum(0);
mapper.insert(entity);
}else{
//修改
......@@ -102,9 +106,6 @@ public class CourseLibrarySerivceImpl extends BaseServiceImpl<CourseLibrary,Stri
CourseLibraryDiyType old = new CourseLibraryDiyType();
old.setCourseLibraryId(entity.getId());
courseLibraryDiyTypeMapper.delete(old);
CourseLibraryLabelContentDiyType alcdy = new CourseLibraryLabelContentDiyType();
alcdy.setCourseLibraryId(entity.getId());
courseLibraryLabelContentDiyTypeMapper.delete(alcdy);
}
//添加当前对象与自定义分类的关系
if(form.getDiyType() != null && form.getDiyType().size() > 0){
......@@ -112,14 +113,6 @@ public class CourseLibrarySerivceImpl extends BaseServiceImpl<CourseLibrary,Stri
list.forEach(li -> li.setCourseLibraryId(entity.getId()));
courseLibraryDiyTypeMapper.insertList(list);
}
//添加与标签的关系
if(form.getLabel() != null && form.getLabel().size() > 0){
List<CourseLibraryLabelContentDiyType> aldcdList = form.getLabel().stream().filter(f -> f.getLabelId() != null).collect(Collectors.toList());
aldcdList.stream().forEach(li -> li.setCourseLibraryId(entity.getId()));
if(!aldcdList.isEmpty()){
courseLibraryLabelContentDiyTypeMapper.insertList(aldcdList);
}
}
return true;
}
......@@ -148,9 +141,6 @@ public class CourseLibrarySerivceImpl extends BaseServiceImpl<CourseLibrary,Stri
example = new Example(CourseLibraryDiyType.class);
example.createCriteria().andIn("courseLibraryId", ids);
courseLibraryDiyTypeMapper.deleteByExample(example);
example = new Example(CourseLibraryLabelContentDiyType.class);
example.createCriteria().andIn("courseLibraryId", ids);
courseLibraryLabelContentDiyTypeMapper.deleteByExample(example);
//这里需要级联删除其他接口关联资源
//----推荐位内容
recommendResourceMapper.delectByResourceIds(ids, AllResourceTypeEnum.COURSE.getCode());
......@@ -183,13 +173,15 @@ public class CourseLibrarySerivceImpl extends BaseServiceImpl<CourseLibrary,Stri
PageParam pageParam) {
startPage(pageParam);
List<CourseLibraryListVO> list = mapper.query(form);
ResourceRelation resourceRelation = new ResourceRelation();
VideoLibrary videoLibrary = new VideoLibrary();
list.forEach(f -> {
f.setStatus_zh(LibraryStatusEnum.getName(f.getStatus()));
// 视频数量
resourceRelation.setObjectId(f.getId());
int videoNum = resourceRelationMapper.selectCount(resourceRelation);
videoLibrary.setCourseId(f.getId());
videoLibrary.setStatus(LibraryStatusEnum.STATUS_1.getCode());
int videoNum = videoMapper.selectCount(videoLibrary);
f.setVideoNum(videoNum);
if(f.getStatus() != null) {
f.setStatus_zh(LibraryStatusEnum.getName(f.getStatus()));
}
});
return new PageInfo<CourseLibraryListVO>(list);
}
......@@ -209,4 +201,34 @@ public class CourseLibrarySerivceImpl extends BaseServiceImpl<CourseLibrary,Stri
return new PageInfo<CourseLibraryListVO>(list);
}
/**
* 根据课程id查询视频资源
*/
@Override
public PageInfo<VideoLibraryListVO> videoRelationPage(String courseId, PageParam pageParam) {
startPage(pageParam);
List<VideoLibraryListVO> list = mapper.videoRelationPage(courseId);
list.forEach(f -> {
if(f.getStatus() != null) {
f.setStatus_zh(LibraryStatusEnum.getName(f.getStatus()));
}
});
return new PageInfo<VideoLibraryListVO>(list);
}
/**
* 查询未关联视频资源
*/
@Override
public PageInfo<VideoLibraryListVO> popPage(QueryCourseAndVideoForm form, PageParam pageParam) {
startPage(pageParam);
List<VideoLibraryListVO> list = mapper.popPage(form);
list.forEach(f -> {
if(f.getStatus() != null) {
f.setStatus_zh(LibraryStatusEnum.getName(f.getStatus()));
}
});
return new PageInfo<VideoLibraryListVO>(list);
}
}
......@@ -6,10 +6,12 @@ import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.courselibrary.QueryCourseAndVideoForm;
import com.zrqx.resource.commons.form.bg.courselibrary.QueryCourseLibraryForm;
import com.zrqx.resource.commons.form.bg.courselibrary.SaveUpdateCourseLibraryForm;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibrary;
import com.zrqx.resource.commons.vo.bg.courselibrary.CourseLibraryListVO;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
/**
* 专题库
*/
......@@ -48,4 +50,17 @@ public interface CourseLibraryService extends BaseService<CourseLibrary,String>{
* @date: 2019年1月3日 下午7:12:29
*/
PageInfo<CourseLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam);
/**
* 相关视频资源
* @param courseId
* @param pageParam
* @return
*/
PageInfo<VideoLibraryListVO> videoRelationPage(String courseId, PageParam pageParam);
/**
* 关联视频弹窗列表
*/
PageInfo<VideoLibraryListVO> popPage(QueryCourseAndVideoForm form, PageParam pageParam);
}
......@@ -3,7 +3,6 @@ package com.zrqx.resource.bg.service.videolibrary;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -11,8 +10,11 @@ import org.springframework.stereotype.Service;
import com.zrqx.core.client.order.bg.OrderClient;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.enums.SaleResourceTypeEnum;
import com.zrqx.core.enums.StatusEnum;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.enums.resource.PriceOptionEnum;
import com.zrqx.core.enums.resource.SalsesTypeEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
......@@ -91,17 +93,19 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,String
}
}
BeanUtils.copyProperties(form, entity);
if(StringUtils.isNotBlank(entity.getDefaultImg())) {
String defaultImg = entity.getDefaultImg() + "/" + entity.getVideo() +"/1.jpg";
entity.setDefaultImg(defaultImg);
}
if(PriceOptionEnum.STATUS_0.getCode() == form.getPriceOption()){
entity.setRealPrice(new BigDecimal(0));
}
if(entity.getId() == null){
//添加
entity.setStatus(LibraryStatusEnum.STATUS_0.getCode());
entity.setStatus(LibraryStatusEnum.STATUS_2.getCode());
entity.setUploadTime(new Date());
entity.setResourceType(AllResourceTypeEnum.VIDEO.getCode());
entity.setBrowseNum(50);
entity.setReadTextPower(1);
entity.setClickNum(50);
entity.setBrowseNum(0);
entity.setSalesNum(0);
mapper.insert(entity);
}else{
......@@ -127,14 +131,6 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,String
list.forEach(li -> li.setVlId(entity.getId()));
vdrMapper.insertList(list);
}
//添加与标签的关系
if(form.getLabel() != null && form.getLabel().size() > 0){
List<VideoLibraryLabelContentDiyType> aldcdList = form.getLabel().stream().filter(f -> f.getLabelId() != null).collect(Collectors.toList());
aldcdList.stream().forEach(li -> li.setVideoId(entity.getId()));
if(!aldcdList.isEmpty()){
alcdMapper.insertList(aldcdList);
}
}
return true;
}
/**
......@@ -145,38 +141,27 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,String
* @date: 2018年11月22日 下午2:39:13
*/
@Override
public boolean batchInsert(SaveVideoLibraryForm form) {
if(form.getNames().size() != form.getVideo().size()){
throw new BaseException("视频数量错误");
public boolean batchInsert(List<SaveVideoLibraryForm> form) {
if(form.isEmpty()) {
throw new BaseException("请选择视频文件!");
}
//循环创建视频对象
for (int i = 0; i < form.getNames().size(); i++) {
VideoLibrary obj = new VideoLibrary();
BeanUtils.copyProperties(form, obj);
obj.setName(form.getNames().get(i));
obj.setVideo(form.getVideo().get(i));
obj.setVideoName(form.getVideoName().get(i));
obj.setSize(form.getSize().get(i));
obj.setFormats(form.getFormats().get(i));
obj.setTimeLength(form.getTimeLength().get(i));
obj.setUploadTime(new Date());
obj.setStatus(LibraryStatusEnum.STATUS_0.getCode());
obj.setResourceType(AllResourceTypeEnum.VIDEO.getCode());
obj.setBrowseNum(50);
obj.setReadTextPower(1);
obj.setClickNum(50);
obj.setSalesNum(0);
obj.setVideoName(form.getNames().get(i));
mapper.insert(obj);
if(form.getDiyType() != null){
VideoLibraryDiyType videoLibraryDiyType = new VideoLibraryDiyType();
videoLibraryDiyType.setCode(form.getDiyType().getCode());
videoLibraryDiyType.setDtId(form.getDiyType().getDtId());
videoLibraryDiyType.setVlId(obj.getId());
vdrMapper.insert(videoLibraryDiyType);
form.forEach(f -> {
VideoLibrary videoLibrary = new VideoLibrary();
BeanUtils.copyProperties(f, videoLibrary);
videoLibrary.setBrowseNum(0);
videoLibrary.setSalesType(SalsesTypeEnum.STATUS_1.getCode());
videoLibrary.setResourceType(AllResourceTypeEnum.VIDEO.getCode());
videoLibrary.setPriceOption(PriceOptionEnum.STATUS_0.getCode());
videoLibrary.setRealPrice(new BigDecimal(0));
videoLibrary.setSalesNum(0);
videoLibrary.setStatus(LibraryStatusEnum.STATUS_2.getCode());
videoLibrary.setUploadTime(new Date());
if(StringUtils.isNotBlank(f.getDefaultImg())) {
String defaultImg = f.getDefaultImg() + "/" + videoLibrary.getVideo() +"/1.jpg";
videoLibrary.setDefaultImg(defaultImg);
}
}
mapper.insert(videoLibrary);
});
return true;
}
/**
......@@ -246,6 +231,11 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,String
//暂不用自定义分类id 做in查询
form.setDiyTypeId(null);
List<VideoLibraryListVO> list = mapper.query(form);
list.forEach(f -> {
if(f.getStatus() != null) {
f.setStatus_zh(LibraryStatusEnum.getName(f.getStatus()));
}
});
return new PageInfo<VideoLibraryListVO>(list);
}
/**
......@@ -265,7 +255,7 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,String
List<VideoLibraryListVO> list = mapper.queryByTileAndDiyType(form);
if(!list.isEmpty()){
for(VideoLibraryListVO ebookListVO : list){
ebookListVO.setStatus_zh(LibraryStatusEnum.getName(Integer.parseInt(ebookListVO.getStatus())));
ebookListVO.setStatus_zh(LibraryStatusEnum.getName(ebookListVO.getStatus()));
}
}
return new PageInfo<VideoLibraryListVO>(list);
......
......@@ -30,7 +30,7 @@ public interface VideoLibraryService extends BaseService<VideoLibrary,String>{
* @author yzg
* @date: 2018年11月22日 下午2:39:13
*/
boolean batchInsert(SaveVideoLibraryForm form);
boolean batchInsert(List<SaveVideoLibraryForm> form);
/**
* 批量删除
* @param ids
......
......@@ -21,4 +21,6 @@ public class BatchUpdateCourseLibraryForm {
private BigDecimal price;
@ApiModelProperty("售价")
private BigDecimal realPrice;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
}
package com.zrqx.resource.commons.form.bg.courselibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="QueryCourseAndVideoForm",description="课程库")
public class QueryCourseAndVideoForm {
@ApiModelProperty(value = "资源名称")
private String name;
@ApiModelProperty("作者")
private String author;
}
......@@ -11,8 +11,6 @@ import lombok.Data;
public class QueryCourseLibraryForm {
@ApiModelProperty(value = "资源名称")
private String name;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("状态:0待审核,1已上架,2已下架")
private String status;
@ApiModelProperty(value="上传时间-开始")
......
......@@ -5,7 +5,6 @@ import java.util.Date;
import java.util.List;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibraryDiyType;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibraryLabelContentDiyType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -23,36 +22,27 @@ public class SaveUpdateCourseLibraryForm {
private String authorId;
@ApiModelProperty(value = "讲师名称和id(用,隔开)")
private String authorNameAndId;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("总期数")
private Integer totalPeriods;
@ApiModelProperty("广告语")
private String adSlogan;
@ApiModelProperty(value = "分类")
private List<CourseLibraryDiyType> diyType;
@ApiModelProperty("封面")
private String cover;
private String img;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("定价 元")
private BigDecimal price;
@ApiModelProperty("售价 元")
private BigDecimal realPrice;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("状态:0待审核,1已上架,2已下架")
private Integer status;
@ApiModelProperty("资源类型")
private Integer resourceType;
@ApiModelProperty("授权时间")
private Date authorizationTime;
@ApiModelProperty("上传时间")
private Date uploadTime;
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("播放次数")
private Integer clickNum;
@ApiModelProperty("浏览数量")
private Integer browseNum;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty(value = "分类id")
private List<CourseLibraryDiyType> diyType;
@ApiModelProperty(value = "标签id")
private List<CourseLibraryLabelContentDiyType> label;
}
......@@ -21,6 +21,11 @@ public class BatchUpdateVideoLibraryForm {
private BigDecimal price;
@ApiModelProperty("售价")
private BigDecimal realPrice;
@ApiModelProperty("全文阅读权限 0 游客可见 1会员可见")
private Integer readTextPower;
@ApiModelProperty("销售方式")
private Integer saleType;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("阅读权限")
private Integer ReadTextPower;
}
......@@ -10,8 +10,6 @@ import lombok.Data;
public class QueryVideoLibraryForm {
@ApiModelProperty(value = "资源名称")
private String name;
@ApiModelProperty("所属图书")
private String bookName;
@ApiModelProperty("状态:0待审核,1已上架,2已下架")
private String status;
@ApiModelProperty(value="上传时间-开始")
......@@ -22,6 +20,4 @@ public class QueryVideoLibraryForm {
private List<Integer> diyTypeId;
@ApiModelProperty("自定义分类code")
private String diyTypeCode;
@ApiModelProperty("民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族")
private Integer nationsType;
}
......@@ -4,7 +4,6 @@ import java.math.BigDecimal;
import java.util.List;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryDiyType;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryLabelContentDiyType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -16,40 +15,39 @@ public class SaveUpdateVideoLibraryForm {
private String id;
@ApiModelProperty(value = "视频名称")
private String name;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("定价")
private BigDecimal price;
@ApiModelProperty("售价")
private BigDecimal realPrice;
@ApiModelProperty(value = "作者名称和id(用,隔开)")
private String authorNameAndId;
@ApiModelProperty("作者id")
private String authorId;
@ApiModelProperty("作者")
private String author;
@ApiModelProperty("时长")
private String timeLength;
@ApiModelProperty("文件大小")
private String size;
@ApiModelProperty("广告语")
private String adSlogan;
@ApiModelProperty(value = "分类id")
private List<VideoLibraryDiyType> diyType;
@ApiModelProperty("封面")
private String img;
@ApiModelProperty("默认封面")
private String defaultImg;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("文本")
private String text;
@ApiModelProperty("video")
private String video;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty(value = "分类id")
private List<VideoLibraryDiyType> diyType;
@ApiModelProperty(value = "标签id")
private List<VideoLibraryLabelContentDiyType> label;
@ApiModelProperty("民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族")
private Integer nationsType;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("全文阅读权限 0 游客可见 1会员可见")
private Integer readTextPower;
@ApiModelProperty("video名称")
private String videoName;
@ApiModelProperty(value = "作者名称和id(用,隔开)")
private String authorNameAndId;
@ApiModelProperty("时长")
private String timeLength;
@ApiModelProperty("文件大小")
private String size;
@ApiModelProperty("销售方式")
private Integer salesType;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("定价")
private BigDecimal price;
@ApiModelProperty("售价")
private BigDecimal realPrice;
}
package com.zrqx.resource.commons.form.bg.videolibrary;
import java.math.BigDecimal;
import java.util.List;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryDiyType;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryLabelContentDiyType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -13,34 +7,16 @@ import lombok.Data;
@ApiModel(value="SaveVideoLibraryForm",description="添加视频库")
public class SaveVideoLibraryForm {
@ApiModelProperty(value = "视频名称集合")
private List<String> names;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("定价")
private BigDecimal price;
@ApiModelProperty("售价")
private BigDecimal realPrice;
@ApiModelProperty("简介")
private String synopsis;
private String name;
@ApiModelProperty("video")
private List<String> video;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty(value = "分类id")
private VideoLibraryDiyType diyType;
@ApiModelProperty(value = "标签id")
private VideoLibraryLabelContentDiyType label;
@ApiModelProperty("民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族")
private Integer nationsType;
@ApiModelProperty("格式")
private List<String> formats;
private String video;
@ApiModelProperty("文件大小")
private List<String> size;
private String size;
@ApiModelProperty("时长")
private List<String> timeLength;
private String timeLength;
@ApiModelProperty("video名称")
private List<String> videoName;
private String videoName;
@ApiModelProperty("默认封面")
private String defaultImg;
}
package com.zrqx.resource.commons.model.courcelibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="CourseLibrary",description="微课库")
......@@ -26,35 +26,31 @@ public class CourseLibrary {
private String author;
@ApiModelProperty("讲师id")
private String authorId;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("总期数")
private Integer totalPeriods;
@ApiModelProperty("广告语")
private String adSlogan;
@ApiModelProperty("封面")
private String cover;
private String img;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("定价 元")
private BigDecimal price;
@ApiModelProperty("售价 元")
private BigDecimal realPrice;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("状态:0待审核,1已上架,2已下架")
private Integer status;
@ApiModelProperty("资源类型")
private Integer resourceType;
@ApiModelProperty("授权时间")
private Date authorizationTime;
@ApiModelProperty("上传时间")
private Date uploadTime;
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("播放次数")
private Integer clickNum;
@ApiModelProperty("浏览数量")
private Integer browseNum;
@ApiModelProperty("销量")
private Integer salesNum;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("资源类型")
private Integer resourceType;
}
......@@ -23,58 +23,50 @@ public class VideoLibrary {
private String id;
@ApiModelProperty(value = "视频名称")
private String name;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("定价")
private BigDecimal price;
@ApiModelProperty("售价")
private BigDecimal realPrice;
@ApiModelProperty("时长")
private String timeLength;
@ApiModelProperty("文件大小")
private String size;
@ApiModelProperty("作者id")
private String authorId;
@ApiModelProperty("作者")
private String author;
@ApiModelProperty("广告语")
private String adSlogan;
@ApiModelProperty("封面")
private String img;
@ApiModelProperty("默认封面")
private String defaultImg;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("文本")
private String text;
@ApiModelProperty("video")
private String video;
@ApiModelProperty("正文")
private String text;
@ApiModelProperty("图书id")
private Integer bookId;
@ApiModelProperty("资源类型")
private Integer resourceType;
@ApiModelProperty("图书名称")
private String bookName;
@ApiModelProperty("状态:0已录入,1已上架,2已下架")
@ApiModelProperty("video名称")
private String videoName;
@ApiModelProperty("时长")
private String timeLength;
@ApiModelProperty("文件大小")
private String size;
@ApiModelProperty("销售方式")
private Integer salesType;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("定价")
private BigDecimal price;
@ApiModelProperty("售价")
private BigDecimal realPrice;
@ApiModelProperty("状态:1已上架,2已下架")
private Integer status;
@ApiModelProperty("上传时间")
private Date uploadTime;
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族")
private Integer nationsType;
@ApiModelProperty("课程Id")
private Integer courseId;
@ApiModelProperty("播放数")
private Integer clickNum;
@ApiModelProperty(value = "销量")
private Integer salesNum;
@ApiModelProperty("封面")
private String cover;
private String courseId;
@ApiModelProperty("浏览数量")
private Integer browseNum;
@ApiModelProperty("作者id")
private String authorId;
@ApiModelProperty("作者")
private String author;
@ApiModelProperty("全文阅读权限 0 游客可见 1会员可见")
private Integer readTextPower;
@ApiModelProperty("格式")
private String formats;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("video名称")
private String videoName;
@ApiModelProperty("销量")
private Integer salesNum;
@ApiModelProperty("排序")
private Integer sort;
@ApiModelProperty("资源类型")
private Integer resourceType;
}
......@@ -16,37 +16,19 @@ public class CourseLibraryListVO {
private String id;
@ApiModelProperty("资源名称")
private String name;
@ApiModelProperty("讲师")
private String author;
@ApiModelProperty("讲师id")
private String authorId;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("定价 元")
private String price;
private String img;
@ApiModelProperty("售价 元")
private String realPrice;
@ApiModelProperty("视频数量")
private Integer videoNum;
@ApiModelProperty("上传时间")
private String uploadTime;
@ApiModelProperty("状态:0已录入,1已上架,2已下架")
private Integer status;
@ApiModelProperty("状态:0已录入,1已上架,2已下架")
private String status_zh;
@ApiModelProperty("资源类型")
private Integer resourceType;
@ApiModelProperty("授权时间")
private Date authorizationTime;
@ApiModelProperty("上传时间")
private Date uploadTime;
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("播放次数")
private Integer clickNum;
@ApiModelProperty("浏览数量")
private Integer browseNum;
@ApiModelProperty("视频数量")
private Integer videoNum;
}
package com.zrqx.resource.commons.vo.bg.courselibrary;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibraryDiyType;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibraryLabelContentDiyType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -16,41 +14,35 @@ import lombok.Data;
public class CourseLibraryVO {
@ApiModelProperty("课程id,新增时不需要填写")
private String id;
@ApiModelProperty("课程名称")
@ApiModelProperty("资源名称")
private String name;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty("课程简介")
private String synopsis;
@ApiModelProperty("状态 0下线,1上线")
private Integer status;
@ApiModelProperty("授权时间")
private Date authorizationTime;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("创建时间")
private Date uploadTime;
@ApiModelProperty("作者")
@ApiModelProperty("讲师")
private String author;
@ApiModelProperty("作者id")
@ApiModelProperty("讲师id")
private String authorId;
@ApiModelProperty(value = "作者名称和id(用,隔开)")
@ApiModelProperty(value = "讲师名称和id(用,隔开)")
private String authorNameAndId;
@ApiModelProperty("浏览数量")
private Integer browseNum;
@ApiModelProperty("总期数")
private Integer totalPeriods;
@ApiModelProperty("广告语")
private String adSlogan;
@ApiModelProperty(value = "分类")
private List<CourseLibraryDiyType> diyType;
@ApiModelProperty("封面")
private String img;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("定价 元")
private String price;
@ApiModelProperty("售价 元")
private String realPrice;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty(value = "分类id")
private List<CourseLibraryDiyType> diyType;
@ApiModelProperty(value = "标签id")
private List<CourseLibraryLabelContentDiyType> label;
@ApiModelProperty(value = "标签内容id")
private List<Integer> labelContentDiyTypeIds;
@ApiModelProperty("状态:0待审核,1已上架,2已下架")
private Integer status;
@ApiModelProperty("资源类型")
private Integer resourceType;
@ApiModelProperty("浏览数量")
private Integer browseNum;
}
......@@ -13,22 +13,22 @@ public class VideoLibraryListVO {
private String id;
@ApiModelProperty(value = "资源名称")
private String name;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty(value = "讲师")
private String author;
@ApiModelProperty("售价")
private String realPrice;
@ApiModelProperty("上传时间")
private Date uploadTime;
@ApiModelProperty("时长")
private String timeLength;
@ApiModelProperty("大小")
private String size;
@ApiModelProperty("状态:0待审核,1已上架,2已下架")
private String status;
@ApiModelProperty("状态:0待审核,1已上架,2已下架")
private String uploadTime;
@ApiModelProperty("状态:1已上架,2已下架")
private Integer status;
@ApiModelProperty("状态:1已上架,2已下架")
private String status_zh;
@ApiModelProperty("作者")
private String author;
@ApiModelProperty("封面图片")
private String cover;
private String img;
@ApiModelProperty("默认封面")
private String defautImg;
@ApiModelProperty(value = "时长")
private String timeLength;
@ApiModelProperty(value = "排序")
private Integer sort;
}
package com.zrqx.resource.commons.vo.bg.videolibrary;
import java.math.BigDecimal;
import java.util.List;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryDiyType;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryLabelContentDiyType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -11,42 +11,41 @@ import lombok.Data;
@Data
@ApiModel(value="VideoLibraryOneVO",description="单个查询视频返回的实体")
public class VideoLibraryOneVO {
@ApiModelProperty("视频id")
@ApiModelProperty("视频id,新增时不需要填写")
private String id;
@ApiModelProperty(value = "视频标题")
@ApiModelProperty(value = "视频名称")
private String name;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("定价")
private String price;
@ApiModelProperty("售价")
private String realPrice;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("正文")
private String text;
@ApiModelProperty("video")
private String video;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty(value = "作者名称和id(用,隔开)")
private String authorNameAndId;
@ApiModelProperty("作者id")
private String authorId;
@ApiModelProperty("作者")
private String author;
@ApiModelProperty("广告语")
private String adSlogan;
@ApiModelProperty(value = "分类id")
private List<VideoLibraryDiyType> diyType;
@ApiModelProperty(value = "标签id")
private List<VideoLibraryLabelContentDiyType> label;
@ApiModelProperty(value = "标签内容id")
private List<Integer> labelContentDiyTypeIds;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("全文阅读权限 0 游客可见 1会员可见")
private Integer readTextPower;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("文本")
private String text;
@ApiModelProperty("video")
private String video;
@ApiModelProperty("video名称")
private String videoName;
@ApiModelProperty(value = "作者名称和id(用,隔开)")
private String authorNameAndId;
@ApiModelProperty("时长")
private String timeLength;
@ApiModelProperty("文件大小")
private String size;
@ApiModelProperty("销售方式")
private Integer salesType;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("定价")
private String price;
@ApiModelProperty("售价")
private String realPrice;
}
......@@ -671,7 +671,7 @@ public class FgResourceLibraryController {
orderInfo.setPrice(entity.getPrice());
}
orderInfo.setSalePrice(entity.getRealPrice());
orderInfo.setCover(entity.getCover());
orderInfo.setCover(entity.getImg());
//获取分类编号
VideoLibraryDiyType alrt = new VideoLibraryDiyType();
alrt.setVlId(entity.getId());
......@@ -707,7 +707,7 @@ public class FgResourceLibraryController {
orderInfo.setPrice(entity.getPrice());
}
orderInfo.setSalePrice(entity.getRealPrice());
orderInfo.setCover(entity.getCover());
orderInfo.setCover(entity.getImg());
//获取分类编号
CourseLibraryDiyType alrt = new CourseLibraryDiyType();
alrt.setCourseLibraryId(entity.getId());
......@@ -801,8 +801,8 @@ public class FgResourceLibraryController {
VideoLibrary entity = videoLibraryService.selectByPrimaryKey(id);
vo.setAuthor(entity.getAuthor());
vo.setAuthorId(entity.getAuthorId());
vo.setCover(entity.getCover());
vo.setSource(entity.getSource());
vo.setCover(entity.getImg());
//vo.setSource(entity.getSource());
vo.setSummary(removeLabel(entity.getSynopsis()));
return CallBack.success(vo);
}
......@@ -811,8 +811,8 @@ public class FgResourceLibraryController {
CourseLibrary entity = courseLibraryService.selectByPrimaryKey(id);
vo.setAuthor(entity.getAuthor());
vo.setAuthorId(entity.getAuthorId());
vo.setCover(entity.getCover());
vo.setSource(entity.getSource());
vo.setCover(entity.getImg());
//vo.setSource(entity.getSource());
vo.setSummary(removeLabel(entity.getSynopsis()));
return CallBack.success(vo);
}
......
......@@ -155,26 +155,6 @@ public class FgVideoLibraryController {
return input;
}
@ApiOperation("更新播放数")
@PostMapping("/update/video-library")
public CallBack<Boolean> updateDownloadNum(@RequestBody String fileName) {
boolean b = false;
VideoLibrary videoLibraryOne = new VideoLibrary();
videoLibraryOne.setVideo(fileName);
List<VideoLibrary> video = service.select(videoLibraryOne);
if(!video.isEmpty()){
for (VideoLibrary videoLibrary : video) {
if(videoLibrary.getClickNum() == null){
videoLibrary.setClickNum(1);
}else{
videoLibrary.setClickNum(videoLibrary.getClickNum() + 1);
}
b = service.updateByPrimaryKeySelective(videoLibrary);
}
}
return CallBack.success(b);
}
@ApiOperation(value = "查询视频全部信息(跨服务调用)", notes = "根据ID查询")
@GetMapping(value = "/{oid}")
public CallBack<VideoLibrary> getOneById(@PathVariable String oid) {
......
......@@ -204,7 +204,7 @@ public class FgResourceManageImpl implements FgResourceManage{
infoVo.setPrice(entity.getPrice());
}
infoVo.setSalePrice(entity.getRealPrice());
infoVo.setCover(entity.getCover());
infoVo.setCover(entity.getImg());
if(entity.getStatus().equals(LibraryStatusEnum.STATUS_1.getCode())){
infoVo.setBookStatus(Integer.parseInt(BooleanStatusEnum.YES.getCode()));
infoVo.setBookStatusZh(LibraryStatusEnum.STATUS_1.getName());
......
......@@ -151,7 +151,7 @@ public class FgResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelat
VideoLibrary sc = videoLibraryMapper.selectByPrimaryKey(e.getResourceId());
if (sc != null) {
e.setName(sc.getName());
e.setCover(sc.getCover());
e.setCover(sc.getImg());
e.setAuthor(sc.getAuthor());
e.setRealPrice(sc.getRealPrice() + "");
e.setTimeLength(sc.getTimeLength());
......@@ -178,7 +178,7 @@ public class FgResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelat
CourseLibrary sc = courseLibraryMapper.selectByPrimaryKey(e.getResourceId());
if (sc != null) {
e.setName(sc.getName());
e.setCover(sc.getCover());
e.setCover(sc.getImg());
e.setAuthor(sc.getAuthor());
e.setRealPrice(sc.getRealPrice() + "");
/*if(StringUtils.isNotBlank(sc.getSynopsis())){
......
......@@ -120,12 +120,12 @@ public class FgCourseLibrarySerivceImpl extends
Integer num = CourseLibrary.getBrowseNum();
num += 1;
CourseLibrary.setBrowseNum(num);
if(CourseLibrary.getClickNum() == null ){
CourseLibrary.setClickNum(50);
if(CourseLibrary.getBrowseNum() == null ){
CourseLibrary.setBrowseNum(0);
}
Integer clickNum = CourseLibrary.getClickNum();
Integer clickNum = CourseLibrary.getBrowseNum();
clickNum += 1;
CourseLibrary.setClickNum(clickNum);
CourseLibrary.setBrowseNum(clickNum);
mapper.updateByPrimaryKeySelective(CourseLibrary);
return true;
}
......
......@@ -171,9 +171,8 @@ public class FgRecordServiceImpl extends BaseServiceImpl<Record, Integer>
VideoLibrary videoLibrary = videoLibraryMapper.selectByPrimaryKey(vo.getGoodsId());
if(videoLibrary != null){
vo.setName(videoLibrary.getName());
vo.setImg(videoLibrary.getCover());
vo.setImg(videoLibrary.getImg());
vo.setText(videoLibrary.getSynopsis());
vo.setSource(videoLibrary.getSource());
}
}
//音频
......@@ -204,9 +203,8 @@ public class FgRecordServiceImpl extends BaseServiceImpl<Record, Integer>
CourseLibrary courseLibrary = courseLibraryMapper.selectByPrimaryKey(vo.getGoodsId());
if(courseLibrary != null){
vo.setName(courseLibrary.getName());
vo.setImg(courseLibrary.getCover());
vo.setImg(courseLibrary.getImg());
vo.setText(courseLibrary.getSynopsis());
vo.setSource(courseLibrary.getSource());
vo.setAuthor(courseLibrary.getAuthor());
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论