提交 c7d77ec1 authored 作者: renjianyu's avatar renjianyu

--no commit message

上级 97d15c40
package com.zrqx.resource.fg.controller.cartoonlibrary;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.client.file.FileClient;
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.RelationAuthorService;
import com.zrqx.resource.bg.service.cartoonlibrary.CartoonLibraryService;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.BatchUpdateCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.QueryCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.SaveCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.SaveUpdateCartoonLibraryForm;
import com.zrqx.resource.commons.model.cartoonlibrary.CartoonLibrary;
import com.zrqx.resource.commons.model.resourcerelation.RelationAuthor;
import com.zrqx.resource.commons.solr.SolrManage;
import com.zrqx.resource.commons.vo.bg.cartoonlibrary.CartoonLibraryListVO;
import com.zrqx.resource.commons.vo.bg.cartoonlibrary.CartoonLibraryOneVO;
import com.zrqx.resource.fg.service.FgRelationAuthorService;
import com.zrqx.resource.fg.service.cartoonlibrary.FgCartoonLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
* 漫画Controller
*/
@RestController
@RequestMapping("/fg/cartoon-library")
@Api(description = "资源管理-漫画库")
public class FgCartoonLibraryController {
private static final Logger logger = LoggerFactory.getLogger(FgCartoonLibraryController.class);
@Autowired
private FgCartoonLibraryService service;
@Autowired
private FgRelationAuthorService relationAuthorService;
@Autowired
private FileClient fileClient;
@Autowired
private SolrManage solrManage;
@ApiOperation(value = "新增/修改 视频资源" , notes ="新增/修改 视频资源")
@PostMapping(value = "/save")
public CallBack<Boolean> save(@RequestBody SaveUpdateCartoonLibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "导入视频" , notes ="导入视频")
@PostMapping(value = "/import")
public CallBack<Boolean> save(@RequestBody List<SaveCartoonLibraryForm> form){
if(!service.batchInsert(form)){
throw new BaseException("操作失败");
}
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "批量 上架/下架" , notes ="批量 上架/下架")
@PostMapping(value = "/batch/update/updown")
public CallBack<Boolean> updateShowState(@RequestBody BatchUpdateCartoonLibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
List<CartoonLibrary> list = service.selectByExample(example);
list.forEach(f -> {
f.setStatus(form.getStatus());
f.setUpdateTime(new Date());
service.updateByPrimaryKey(f);
});
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "批量删除", notes = "批量删除")
@PostMapping(value = "/batch/delete")
public CallBack<Boolean> deleteByIds(@RequestBody List<String> ids) {
if(service.batchDelete(ids)){
// 增量索引
solrManage.asyncDeltaIndex();
}
return CallBack.success();
}
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/{oid}")
public CallBack<CartoonLibraryOneVO> getById(@PathVariable String oid) {
CartoonLibrary entity = service.selectByPrimaryKey(oid);
CartoonLibraryOneVO vo = new CartoonLibraryOneVO();
BeanUtils.copyProperties(entity,vo);
/*if(StringUtils.isNotBlank(entity.getAuthorId())){
vo.setAuthorNameAndId(entity.getAuthor() + "," + entity.getAuthorId());
}else{
vo.setAuthorNameAndId(entity.getAuthor());
}*/
// 获取第一帧封面以及m3u8
if(vo != null && StringUtils.isNotBlank(vo.getVideo())){
CallBack<String> result1 = fileClient.getVideoDefaultImg(vo.getVideo());
if(result1.hasEntity()){
vo.setImgPath(result1.getData());
}else{
logger.info("查询视频图片地址失败");
}
CallBack<String> result2 = fileClient.getVideoPath(vo.getVideo());
if(result2.hasEntity()){
vo.setVideoPath(result2.getData());
}else{
logger.info("查询视频切片地址失败");
}
}
// 关联作者集合
Example example = relationAuthorService.createExample();
example.createCriteria().andEqualTo("resourceId", oid);
List<RelationAuthor> baList = relationAuthorService.selectByExample(example);
vo.setAuthorList(baList);
return CallBack.success(vo);
}
@ApiOperation(value = "分页查询" , notes ="查询列表")
@GetMapping(value = "/page")
public CallBack<PageInfo<CartoonLibraryListVO>> page(QueryCartoonLibraryForm form, PageParam pageParam){
return CallBack.success(service.page(form, pageParam));
}
}
package com.zrqx.resource.fg.controller.h5;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.client.file.FileClient;
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.h5.H5LibraryService;
import com.zrqx.resource.commons.form.bg.h5.BatchUpdateH5LibraryForm;
import com.zrqx.resource.commons.form.bg.h5.QueryH5LibraryForm;
import com.zrqx.resource.commons.form.bg.h5.SaveUpdateH5LibraryForm;
import com.zrqx.resource.commons.model.h5.H5Library;
import com.zrqx.resource.commons.solr.SolrManage;
import com.zrqx.resource.commons.vo.bg.h5.H5LibraryListVO;
import com.zrqx.resource.commons.vo.bg.h5.H5LibraryOneVO;
import com.zrqx.resource.fg.service.h5.FgH5LibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
* H5Controller
*/
@RestController
@RequestMapping("/fg/h5-library")
@Api(description = "资源管理-漫画库")
public class FgH5LibraryController {
private static final Logger logger = LoggerFactory.getLogger(FgH5LibraryController.class);
@Autowired
private FgH5LibraryService service;
@Autowired
private SolrManage solrManage;
@Autowired
private FileClient fileClient;
@ApiOperation(value = "新增/修改 " , notes ="新增/修改 ")
@PostMapping(value = "/save")
public CallBack<Boolean> save(@RequestBody SaveUpdateH5LibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "批量 上架/下架" , notes ="批量 上架/下架")
@PostMapping(value = "/batch/update/updown")
public CallBack<Boolean> updateShowState(@RequestBody BatchUpdateH5LibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
List<H5Library> list = service.selectByExample(example);
list.forEach(f -> {
f.setStatus(form.getStatus());
f.setUpdateTime(new Date());
service.updateByPrimaryKey(f);
});
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "批量删除", notes = "批量删除")
@PostMapping(value = "/batch/delete")
public CallBack<Boolean> deleteByIds(@RequestBody List<String> ids) {
if(service.batchDelete(ids)){
// 增量索引
solrManage.asyncDeltaIndex();
}
return CallBack.success();
}
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/{oid}")
public CallBack<H5LibraryOneVO> getById(@PathVariable String oid) {
H5Library entity = service.selectByPrimaryKey(oid);
H5LibraryOneVO vo = new H5LibraryOneVO();
BeanUtils.copyProperties(entity,vo);
return CallBack.success(vo);
}
@ApiOperation(value = "分页查询" , notes ="查询列表")
@GetMapping(value = "/page")
public CallBack<PageInfo<H5LibraryListVO>> page(QueryH5LibraryForm form, PageParam pageParam){
return CallBack.success(service.page(form, pageParam));
}
}
package com.zrqx.resource.fg.controller.paintinglibrary;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.client.file.FileClient;
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.RelationAuthorService;
import com.zrqx.resource.bg.service.paintinglibrary.PaintingLibraryService;
import com.zrqx.resource.commons.form.bg.paintinglibrary.BatchUpdatePaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.QueryPaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.SavePaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.SaveUpdatePaintingLibraryForm;
import com.zrqx.resource.commons.model.paintinglibrary.PaintingLibrary;
import com.zrqx.resource.commons.model.resourcerelation.RelationAuthor;
import com.zrqx.resource.commons.solr.SolrManage;
import com.zrqx.resource.commons.vo.bg.paintinglibrary.PaintingLibraryListVO;
import com.zrqx.resource.commons.vo.bg.paintinglibrary.PaintingLibraryOneVO;
import com.zrqx.resource.fg.service.FgRelationAuthorService;
import com.zrqx.resource.fg.service.paintinglibrary.FgPaintingLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
* 沙画库Controller
*/
@RestController
@RequestMapping("/fg/painting-library")
@Api(description = "资源管理-沙画库")
public class FgPaintingLibraryController {
private static final Logger logger = LoggerFactory.getLogger(FgPaintingLibraryController.class);
@Autowired
private FgPaintingLibraryService service;
@Autowired
private FgRelationAuthorService relationAuthorService;
@Autowired
private FileClient fileClient;
@Autowired
private SolrManage solrManage;
@ApiOperation(value = "新增/修改 视频资源" , notes ="新增/修改 视频资源")
@PostMapping(value = "/save")
public CallBack<Boolean> save(@RequestBody SaveUpdatePaintingLibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "导入视频" , notes ="导入视频")
@PostMapping(value = "/import")
public CallBack<Boolean> save(@RequestBody List<SavePaintingLibraryForm> form){
if(!service.batchInsert(form)){
throw new BaseException("操作失败");
}
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "批量 上架/下架" , notes ="批量 上架/下架")
@PostMapping(value = "/batch/update/updown")
public CallBack<Boolean> updateShowState(@RequestBody BatchUpdatePaintingLibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
List<PaintingLibrary> list = service.selectByExample(example);
list.forEach(f -> {
f.setStatus(form.getStatus());
f.setUpdateTime(new Date());
service.updateByPrimaryKey(f);
});
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "批量删除", notes = "批量删除")
@PostMapping(value = "/batch/delete")
public CallBack<Boolean> deleteByIds(@RequestBody List<String> ids) {
if(service.batchDelete(ids)){
// 增量索引
solrManage.asyncDeltaIndex();
}
return CallBack.success();
}
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/{oid}")
public CallBack<PaintingLibraryOneVO> getById(@PathVariable String oid) {
PaintingLibrary entity = service.selectByPrimaryKey(oid);
PaintingLibraryOneVO vo = new PaintingLibraryOneVO();
BeanUtils.copyProperties(entity,vo);
/*if(StringUtils.isNotBlank(entity.getAuthorId())){
vo.setAuthorNameAndId(entity.getAuthor() + "," + entity.getAuthorId());
}else{
vo.setAuthorNameAndId(entity.getAuthor());
}*/
// 获取第一帧封面以及m3u8
if(vo != null && StringUtils.isNotBlank(vo.getVideo())){
CallBack<String> result1 = fileClient.getVideoDefaultImg(vo.getVideo());
if(result1.hasEntity()){
vo.setImgPath(result1.getData());
}else{
logger.info("查询视频图片地址失败");
}
CallBack<String> result2 = fileClient.getVideoPath(vo.getVideo());
if(result2.hasEntity()){
vo.setVideoPath(result2.getData());
}else{
logger.info("查询视频切片地址失败");
}
}
// 关联作者集合
Example example = relationAuthorService.createExample();
example.createCriteria().andEqualTo("resourceId", oid);
List<RelationAuthor> baList = relationAuthorService.selectByExample(example);
vo.setAuthorList(baList);
return CallBack.success(vo);
}
@ApiOperation(value = "分页查询" , notes ="查询列表")
@GetMapping(value = "/page")
public CallBack<PageInfo<PaintingLibraryListVO>> page(QueryPaintingLibraryForm form, PageParam pageParam){
return CallBack.success(service.page(form, pageParam));
}
}
package com.zrqx.resource.fg.controller.vr;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.client.file.FileClient;
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.vr.VrLibraryService;
import com.zrqx.resource.commons.form.bg.vr.BatchUpdateVrLibraryForm;
import com.zrqx.resource.commons.form.bg.vr.QueryVrLibraryForm;
import com.zrqx.resource.commons.form.bg.vr.SaveUpdateVrLibraryForm;
import com.zrqx.resource.commons.model.vr.VrLibrary;
import com.zrqx.resource.commons.solr.SolrManage;
import com.zrqx.resource.commons.vo.bg.vr.VrLibraryListVO;
import com.zrqx.resource.commons.vo.bg.vr.VrLibraryOneVO;
import com.zrqx.resource.fg.service.vr.FgVrLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
* VrController
*/
@RestController
@RequestMapping("/fg/vr-library")
@Api(description = "资源管理-Vr库")
public class FgVrLibraryController {
private static final Logger logger = LoggerFactory.getLogger(FgVrLibraryController.class);
@Autowired
private FgVrLibraryService service;
@Autowired
private SolrManage solrManage;
@Autowired
private FileClient fileClient;
@ApiOperation(value = "新增/修改 视频资源" , notes ="新增/修改 视频资源")
@PostMapping(value = "/save")
public CallBack<Boolean> save(@RequestBody SaveUpdateVrLibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "批量 上架/下架" , notes ="批量 上架/下架")
@PostMapping(value = "/batch/update/updown")
public CallBack<Boolean> updateShowState(@RequestBody BatchUpdateVrLibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
List<VrLibrary> list = service.selectByExample(example);
list.forEach(f -> {
f.setStatus(form.getStatus());
f.setUpdateTime(new Date());
service.updateByPrimaryKey(f);
});
// 增量索引
solrManage.asyncDeltaIndex();
return CallBack.success();
}
@ApiOperation(value = "批量删除", notes = "批量删除")
@PostMapping(value = "/batch/delete")
public CallBack<Boolean> deleteByIds(@RequestBody List<String> ids) {
if(service.batchDelete(ids)){
// 增量索引
solrManage.asyncDeltaIndex();
}
return CallBack.success();
}
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/{oid}")
public CallBack<VrLibraryOneVO> getById(@PathVariable String oid) {
VrLibrary entity = service.selectByPrimaryKey(oid);
VrLibraryOneVO vo = new VrLibraryOneVO();
BeanUtils.copyProperties(entity,vo);
return CallBack.success(vo);
}
@ApiOperation(value = "分页查询" , notes ="查询列表")
@GetMapping(value = "/page")
public CallBack<PageInfo<VrLibraryListVO>> page(QueryVrLibraryForm form, PageParam pageParam){
return CallBack.success(service.page(form, pageParam));
}
}
package com.zrqx.resource.fg.mapper.cartoonlibrary;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.bg.mapper.MapperConstants;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.QueryCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.model.cartoonlibrary.CartoonLibrary;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.cartoonlibrary.CartoonLibraryListVO;
/**
* 漫画库
*/
public interface FgCartoonLibraryMapper extends BaseMapper<CartoonLibrary> {
@Select("<script>"
+ "select a.id,c.name articleName,a.name,a.uploadTime,a.status,a.cover,a.author "
+ "from res_cartoon_library a "
+ " left join res_resource_relation ad on a.id = ad.resourceId "
+ " LEFT JOIN res_article_library c on ad.objectId = c.id "
+ "where 1=1 "
+ " eq(a.status,form.status) "
+ " like(a.name,form.name) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<CartoonLibraryListVO> query(@Param("form")QueryCartoonLibraryForm form);
@Select("<script>"
+ "select a.id,a.name,a.author,a.timeLength,a.size,a.uploadTime,a.status,a.cover,a.resourceType "
+ "from res_cartoon_library a "
+ "where 1=1 and a.status = 1 "
+ " 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=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"
+ "</script>")
List<CartoonLibraryListVO> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity);
@Select("<script>"
+ "select a.id,a.name, DATE_FORMAT(a.uploadTime,'%Y-%m-%d %H:%i') uploadTime,a.status,a.cover,a.author,a.video,a.timeLength "
+ "from res_cartoon_library "
+ "where liveId = #{form.liveId}"
+ " like(a.name,form.name) "
+ " eq(a.status,form.status) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<CartoonLibraryListVO> liveQuery(@Param("form")QueryCartoonLibraryForm form);
/**
* 查询视频最大排序
* @param courseId
* @return
*/
@Select("select max(sort) from res_cartoon_library where courseId = #{courseId}")
Integer selectMaxSort(String courseId);
/**
* 统计视频详情
* @param form
* @return
*/
@Select("<script>"
+ "select DISTINCT a.id,a.name,a.uploadTime,a.cover,a.resourceType,browseNum, "
+ "(SELECT COUNT(*) FROM hxwza_order.ord_orderinfo c LEFT JOIN hxwza_order.ord_order b ON c.orderId = b.id WHERE b.status = 6 AND c.goodsid = a.id) tradeNum, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_record WHERE goodsId = a.id) readersNum, "
+ "shares, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_resource_relation WHERE objectId = a.id) relatedNum "
+ "from hxwza_resource.res_cartoon_library a "
+ "where 1=1 "
+ " like(a.name,form.name) "
+ " in(bb.id,form.ids) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<StatisticsResourceVO> getStatisticsResource(@Param("form")SearchForm form);
/**
* 导出音频详情统计
* @param form
* @return
*/
@Select("<script>"
+ "select DISTINCT a.id,a.name,a.uploadTime,a.cover,a.resourceType,browseNum, "
+ "(SELECT COUNT(*) FROM hxwza_order.ord_orderinfo c LEFT JOIN hxwza_order.ord_order b ON c.orderId = b.id WHERE b.status = 6 AND c.goodsid = a.id) tradeNum, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_record WHERE goodsId = a.id) readersNum, "
+ "shares, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_resource_relation WHERE objectId = a.id) relatedNum "
+ "from hxwza_resource.res_cartoon_library a "
+ "where 1=1 "
+ " like(a.name,form.name) "
+ " in(a.id,form.ids) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<StatisticsResourceExportVO> exportStatisticsResource(@Param("form")SearchForm form);
}
package com.zrqx.resource.fg.mapper.h5;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.bg.mapper.MapperConstants;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.h5.QueryH5LibraryForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.model.h5.H5Library;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.h5.H5LibraryListVO;
/**
* H5库
*/
public interface FgH5LibraryMapper extends BaseMapper<H5Library> {
@Select("<script>"
+ "select a.id,c.name articleName,a.name,a.uploadTime,a.status,a.cover,a.address "
+ "from res_h5_library a "
+ " left join res_resource_relation ad on a.id = ad.resourceId "
+ " LEFT JOIN res_article_library c on ad.objectId = c.id "
+ "where 1=1 "
+ " eq(a.status,form.status) "
+ " like(a.name,form.name) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<H5LibraryListVO> query(@Param("form")QueryH5LibraryForm form);
@Select("<script>"
+ "select a.id,a.name,a.address,a.uploadTime,a.status,a.cover,a.resourceType "
+ "from res_h5_library a "
+ "where 1=1 and a.status = 1 "
+ " 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=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"
+ "</script>")
List<H5LibraryListVO> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity);
/**
* 查询视频最大排序
* @param courseId
* @return
*/
@Select("select max(sort) from res_h5_library where courseId = #{courseId}")
Integer selectMaxSort(String courseId);
/**
* 统计视频详情
* @param form
* @return
*/
@Select("<script>"
+ "select DISTINCT a.id,a.name,a.uploadTime,a.cover,a.resourceType,browseNum, "
+ "(SELECT COUNT(*) FROM hxwza_order.ord_orderinfo c LEFT JOIN hxwza_order.ord_order b ON c.orderId = b.id WHERE b.status = 6 AND c.goodsid = a.id) tradeNum, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_record WHERE goodsId = a.id) readersNum, "
+ "shares, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_resource_relation WHERE objectId = a.id) relatedNum "
+ "from hxwza_resource.res_h5_library a "
+ "where 1=1 "
+ " like(a.name,form.name) "
+ " in(bb.id,form.ids) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<StatisticsResourceVO> getStatisticsResource(@Param("form")SearchForm form);
/**
* 导出音频详情统计
* @param form
* @return
*/
@Select("<script>"
+ "select DISTINCT a.id,a.name,a.uploadTime,a.cover,a.resourceType,browseNum, "
+ "(SELECT COUNT(*) FROM hxwza_order.ord_orderinfo c LEFT JOIN hxwza_order.ord_order b ON c.orderId = b.id WHERE b.status = 6 AND c.goodsid = a.id) tradeNum, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_record WHERE goodsId = a.id) readersNum, "
+ "shares, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_resource_relation WHERE objectId = a.id) relatedNum "
+ "from hxwza_resource.res_h5_library a "
+ "where 1=1 "
+ " like(a.name,form.name) "
+ " in(a.id,form.ids) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<StatisticsResourceExportVO> exportStatisticsResource(@Param("form")SearchForm form);
}
package com.zrqx.resource.fg.mapper.paintinglibrary;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.bg.mapper.MapperConstants;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.QueryPaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.form.bg.videolibrary.QueryVideoLibraryForm;
import com.zrqx.resource.commons.model.paintinglibrary.PaintingLibrary;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.paintinglibrary.PaintingLibraryListVO;
/**
* 沙画库
*/
public interface FgPaintingLibraryMapper extends BaseMapper<PaintingLibrary> {
@Select("<script>"
+ "select a.id,c.name articleName,a.name,a.uploadTime,a.status,a.cover,a.author "
+ "from res_painting_library a "
+ " left join res_resource_relation ad on a.id = ad.resourceId "
+ " LEFT JOIN res_article_library c on ad.objectId = c.id "
+ "where 1=1 "
+ " eq(a.status,form.status) "
+ " like(a.name,form.name) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<PaintingLibraryListVO> query(@Param("form")QueryPaintingLibraryForm form);
@Select("<script>"
+ "select a.id,a.name,a.author,a.timeLength,a.size,a.uploadTime,a.status,a.cover,a.resourceType "
+ "from res_painting_library a "
+ "where 1=1 and a.status = 1 "
+ " 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=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"
+ "</script>")
List<PaintingLibraryListVO> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity);
@Select("<script>"
+ "select DISTINCT a.id,a.name, DATE_FORMAT(a.uploadTime,'%Y-%m-%d %H:%i') uploadTime,a.status,a.cover,a.author,a.video,a.timeLength "
+ "from res_painting_library a "
+ "where liveId = #{form.liveId}"
+ " like(a.name,form.name) "
+ " eq(a.status,form.status) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<PaintingLibraryListVO> liveQuery(@Param("form")QueryPaintingLibraryForm form);
/**
* 查询视频最大排序
* @param courseId
* @return
*/
@Select("select max(sort) from res_Video_Library where courseId = #{courseId}")
Integer selectMaxSort(String courseId);
/**
* 统计视频详情
* @param form
* @return
*/
@Select("<script>"
+ "select DISTINCT a.id,a.name,a.uploadTime,a.cover,a.resourceType,browseNum, "
+ "(SELECT COUNT(*) FROM hxwza_order.ord_orderinfo c LEFT JOIN hxwza_order.ord_order b ON c.orderId = b.id WHERE b.status = 6 AND c.goodsid = a.id) tradeNum, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_record WHERE goodsId = a.id) readersNum, "
+ "shares, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_resource_relation WHERE objectId = a.id) relatedNum "
+ "from hxwza_resource.res_painting_library a "
+ "where 1=1 "
+ " like(a.name,form.name) "
+ " in(bb.id,form.ids) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<StatisticsResourceVO> getStatisticsResource(@Param("form")SearchForm form);
/**
* 导出音频详情统计
* @param form
* @return
*/
@Select("<script>"
+ "select DISTINCT a.id,a.name,a.uploadTime,a.cover,a.resourceType,browseNum, "
+ "(SELECT COUNT(*) FROM hxwza_order.ord_orderinfo c LEFT JOIN hxwza_order.ord_order b ON c.orderId = b.id WHERE b.status = 6 AND c.goodsid = a.id) tradeNum, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_record WHERE goodsId = a.id) readersNum, "
+ "shares, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_resource_relation WHERE objectId = a.id) relatedNum "
+ "from hxwza_resource.res_painting_library a "
+ "where 1=1 "
+ " like(a.name,form.name) "
+ " in(a.id,form.ids) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<StatisticsResourceExportVO> exportStatisticsResource(@Param("form")SearchForm form);
}
package com.zrqx.resource.fg.mapper.vr;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.bg.mapper.MapperConstants;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.form.bg.vr.QueryVrLibraryForm;
import com.zrqx.resource.commons.model.vr.VrLibrary;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.vr.VrLibraryListVO;
/**
* Vr库
*/
public interface FgVrLibraryMapper extends BaseMapper<VrLibrary> {
@Select("<script>"
+ "select a.id,c.name articleName,a.name,a.uploadTime,a.status,a.cover,a.address "
+ "from res_vr_library a "
+ " left join res_resource_relation ad on a.id = ad.resourceId "
+ " LEFT JOIN res_article_library c on ad.objectId = c.id "
+ "where 1=1 "
+ " eq(a.status,form.status) "
+ " like(a.name,form.name) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<VrLibraryListVO> query(@Param("form")QueryVrLibraryForm form);
@Select("<script>"
+ "select a.id,a.name,a.address,a.uploadTime,a.status,a.cover,a.resourceType "
+ "from res_vr_library a "
+ "where 1=1 and a.status = 1 "
+ " 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=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"
+ "</script>")
List<VrLibraryListVO> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity);
/**
* 查询视频最大排序
* @param courseId
* @return
*/
@Select("select max(sort) from res_vr_library where courseId = #{courseId}")
Integer selectMaxSort(String courseId);
/**
* 统计视频详情
* @param form
* @return
*/
@Select("<script>"
+ "select DISTINCT a.id,a.name,a.uploadTime,a.cover,a.resourceType,browseNum, "
+ "(SELECT COUNT(*) FROM hxwza_order.ord_orderinfo c LEFT JOIN hxwza_order.ord_order b ON c.orderId = b.id WHERE b.status = 6 AND c.goodsid = a.id) tradeNum, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_record WHERE goodsId = a.id) readersNum, "
+ "shares, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_resource_relation WHERE objectId = a.id) relatedNum "
+ "from hxwza_resource.res_vr_library a "
+ "where 1=1 "
+ " like(a.name,form.name) "
+ " in(bb.id,form.ids) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<StatisticsResourceVO> getStatisticsResource(@Param("form")SearchForm form);
/**
* 导出音频详情统计
* @param form
* @return
*/
@Select("<script>"
+ "select DISTINCT a.id,a.name,a.uploadTime,a.cover,a.resourceType,browseNum, "
+ "(SELECT COUNT(*) FROM hxwza_order.ord_orderinfo c LEFT JOIN hxwza_order.ord_order b ON c.orderId = b.id WHERE b.status = 6 AND c.goodsid = a.id) tradeNum, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_record WHERE goodsId = a.id) readersNum, "
+ "shares, "
+ "(SELECT COUNT(*) FROM hxwza_resource.res_resource_relation WHERE objectId = a.id) relatedNum "
+ "from hxwza_resource.res_vr_library a "
+ "where 1=1 "
+ " like(a.name,form.name) "
+ " in(a.id,form.ids) "
+ MapperConstants.DATETIME_QUERY_CONDITION
+ " order by a.uploadTime desc "
+ "</script>")
List<StatisticsResourceExportVO> exportStatisticsResource(@Param("form")SearchForm form);
}
package com.zrqx.resource.fg.service.cartoonlibrary;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.zrqx.core.client.sysuser.bg.SysuserClient;
import com.zrqx.core.commons.redis.Redis;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.bg.mapper.RelationAuthorMapper;
import com.zrqx.resource.bg.mapper.cartoonlibrary.CartoonLibraryMapper;
import com.zrqx.resource.bg.mapper.qrcode.QrCodeMapper;
import com.zrqx.resource.bg.mapper.record.RecordMapper;
import com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryDiyTypeMapper;
import com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryLabelContentDiyTypeMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.QueryCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.SaveCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.SaveUpdateCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.model.cartoonlibrary.CartoonLibrary;
import com.zrqx.resource.commons.model.resourcerelation.RelationAuthor;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryDiyType;
import com.zrqx.resource.commons.model.videolibrary.VideoLibraryLabelContentDiyType;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.cartoonlibrary.CartoonLibraryListVO;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
import com.zrqx.resource.fg.mapper.FgRelationAuthorMapper;
import com.zrqx.resource.fg.mapper.cartoonlibrary.FgCartoonLibraryMapper;
import com.zrqx.resource.fg.mapper.record.FgRecordMapper;
import com.zrqx.resource.fg.mapper.videolibrary.FgVideoLibraryDiyTypeMapper;
import com.zrqx.resource.fg.mapper.videolibrary.FgVideoLibraryLabelContentDiyTypeMapper;
import tk.mybatis.mapper.entity.Example;
/**
* 漫画库
*/
@Service
public class FgCartoonLibrarySerivceImpl extends BaseServiceImpl<CartoonLibrary,String> implements FgCartoonLibraryService {
@Autowired
private FgCartoonLibraryMapper mapper;
@Autowired
private FgVideoLibraryDiyTypeMapper vdrMapper;
@Autowired
private FgVideoLibraryLabelContentDiyTypeMapper alcdMapper;
@Autowired
private FgRecordMapper recordMapper;
@Autowired
private FgRelationAuthorMapper relationAuthorMapper;
@Autowired
private Redis redis;
@Autowired
private SysuserClient sysuserClient;
@Autowired
private QrCodeMapper qrCodeMapper;
@Value("${qrcode-upload-path}")
private String qrCodeUploadPath;
@Value("${realm-name-path}")
private String realmNamePath;
@Override
public BaseMapper<CartoonLibrary> getMapper() {
return mapper;
}
/**
* 保存或修改
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:38:56
*/
@Override
public boolean saveOrUpdate(SaveUpdateCartoonLibraryForm form) {
CartoonLibrary entity = new CartoonLibrary();
if(StringUtils.isNotBlank(form.getId())) {
entity = mapper.selectByPrimaryKey(form.getId());
}
/*if(StringUtils.isNotBlank(form.getAuthorNameAndId())){
String[] authorNameAndId = form.getAuthorNameAndId().split(",");
form.setAuthor(authorNameAndId[0]);
if(authorNameAndId.length > 1){
form.setAuthorId(authorNameAndId[1]);
}
}*/
BeanUtils.copyProperties(form, entity);
if(StringUtils.isBlank(entity.getId())){
//添加
entity.setStatus(LibraryStatusEnum.STATUS_0.getCode());
entity.setUploadTime(new Date());
entity.setUpdateTime(new Date());
entity.setBrowseNum(0);
entity.setResourceType(AllResourceTypeEnum.CARTOON.getCode());
mapper.insert(entity);
}else{
//修改
entity.setUpdateTime(new Date());
mapper.updateByPrimaryKey(entity);
// 删除作者关联表
RelationAuthor ba = new RelationAuthor();
ba.setResourceId(entity.getId());
relationAuthorMapper.delete(ba);
}
// 添加作者关系
if (ArrayUtils.isNotEmpty(form.getAuthorList())) {
List<RelationAuthor> baList = form.getAuthorList().stream().filter(a -> StringUtils.isNotBlank(a.getAuthor())).collect(Collectors.toList());
for (RelationAuthor li : baList) {
li.setResourceId(entity.getId());
}
relationAuthorMapper.insertList(baList);
}
return true;
}
/**
* 批量导入
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:13
*/
@Override
public boolean batchInsert(List<SaveCartoonLibraryForm> form) {
if(form.isEmpty()) {
throw new BaseException("请选择视频文件!");
}
form.forEach(f -> {
CartoonLibrary entity = new CartoonLibrary();
BeanUtils.copyProperties(f, entity);
entity.setResourceType(AllResourceTypeEnum.CARTOON.getCode());
entity.setStatus(LibraryStatusEnum.STATUS_0.getCode());
entity.setUploadTime(new Date());
entity.setUploadTime(new Date());
if(StringUtils.isNotBlank(f.getVideoName())) {
entity.setName(f.getVideoName().substring(0, f.getVideoName().lastIndexOf(".")));
}
mapper.insert(entity);
});
return true;
}
/**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
@Override
public boolean batchDelete(List<String> ids) {
if (ids.size() == 0) {
throw new BaseException("没有选中任何数据,请重新选择");
}
Example example = createExample();
example.createCriteria().andIn("id", ids);
List<CartoonLibrary> list = mapper.selectByExample(example);
for (CartoonLibrary entity : list) {
if (entity.getStatus() == LibraryStatusEnum.STATUS_1.getCode()) {
throw new BaseException("不能删除已上架的资源");
}
}
mapper.deleteByExample(example);
return true;
}
/**
* 后台分页查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:32
*/
@Override
public PageInfo<CartoonLibraryListVO> page(QueryCartoonLibraryForm form, PageParam pageParam) {
startPage(pageParam);
List<CartoonLibraryListVO> list = mapper.query(form);
list.forEach(f -> {
if(f.getStatus() != null) {
f.setStatus_zh(LibraryStatusEnum.getName(f.getStatus()));
}
});
return new PageInfo<CartoonLibraryListVO>(list);
}
/**
* 根据标题和分类查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:42
*/
@Override
public PageInfo<CartoonLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam) {
if(pageParam != null && StringUtils.isBlank(pageParam.getOrderBy())){
pageParam.setOrderBy("uploadTime desc, id desc");
}
startPage(pageParam);
List<CartoonLibraryListVO> list = mapper.queryByTileAndDiyType(form);
if(!list.isEmpty()){
for(CartoonLibraryListVO li : list){
li.setStatus_zh(LibraryStatusEnum.getName(li.getStatus()));
}
}
return new PageInfo<CartoonLibraryListVO>(list);
}
/**
* 获取原始文件名
* @param code
* @return
* @author ycw
* @date: 2019年1月29日 上午10:05:21
*/
@Override
public String getOriginalFileName(String code){
CartoonLibrary video = new CartoonLibrary();
video.setVideo(code);
List<CartoonLibrary> list = mapper.select(video);
if(list != null && list.size() > 0){
return list.get(0).getName();
}
return null;
}
/**
* 查询最大排序
*/
@Override
public Integer selectMaxSort(String courseId) {
return mapper.selectMaxSort(courseId);
}
/**
* 统计音频详情
*/
@Override
public PageInfo<StatisticsResourceVO> getStatisticsResource(SearchForm form, PageParam pageParam) {
startPage(pageParam);
List<StatisticsResourceVO> list = mapper.getStatisticsResource(form);
return new PageInfo<StatisticsResourceVO>(list);
}
/**
* 导出音频详情统计
*/
@Override
public List<StatisticsResourceExportVO> exportStatisticsResource(SearchForm form) {
List<StatisticsResourceExportVO> list = mapper.exportStatisticsResource(form);
return list;
}
}
package com.zrqx.resource.fg.service.cartoonlibrary;
import java.util.List;
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.cartoonlibrary.QueryCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.SaveCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.cartoonlibrary.SaveUpdateCartoonLibraryForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.model.cartoonlibrary.CartoonLibrary;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.cartoonlibrary.CartoonLibraryListVO;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
/**
* 漫画库
*/
public interface FgCartoonLibraryService extends BaseService<CartoonLibrary,String>{
/**
* 保存或修改
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:38:56
*/
boolean saveOrUpdate(SaveUpdateCartoonLibraryForm form);
/**
* 批量导入
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:13
*/
boolean batchInsert(List<SaveCartoonLibraryForm> form);
/**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
boolean batchDelete(List<String> ids);
/**
* 后台分页查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:32
*/
PageInfo<CartoonLibraryListVO> page(QueryCartoonLibraryForm form, PageParam pageParam);
/**
* 选择弹窗中的列表-根据标题和分类查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:42
*/
PageInfo<CartoonLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam);
/**
* 获取原始文件名
* @param code
* @return
* @author ycw
* @date: 2019年1月29日 上午10:05:21
*/
String getOriginalFileName(String code);
/***
* 查询视频最大排序号
* @param courseId
* @return
*/
Integer selectMaxSort(String courseId);
/**
* 统计视频资源
* @param form
* @param pageParam
* @return
*/
PageInfo<StatisticsResourceVO> getStatisticsResource(SearchForm form, PageParam pageParam);
/**
* 导出视频详情统计
* @param form
* @return
*/
List<StatisticsResourceExportVO> exportStatisticsResource(SearchForm form);
}
package com.zrqx.resource.fg.service.h5;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.zrqx.core.client.sysuser.bg.SysuserClient;
import com.zrqx.core.commons.redis.Redis;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.bg.mapper.RelationAuthorMapper;
import com.zrqx.resource.bg.mapper.h5.H5LibraryMapper;
import com.zrqx.resource.bg.mapper.qrcode.QrCodeMapper;
import com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryDiyTypeMapper;
import com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryLabelContentDiyTypeMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.h5.QueryH5LibraryForm;
import com.zrqx.resource.commons.form.bg.h5.SaveUpdateH5LibraryForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.SaveUpdatePaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.model.h5.H5Library;
import com.zrqx.resource.commons.model.resourcerelation.RelationAuthor;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.h5.H5LibraryListVO;
import com.zrqx.resource.fg.mapper.FgRelationAuthorMapper;
import com.zrqx.resource.fg.mapper.h5.FgH5LibraryMapper;
import com.zrqx.resource.fg.mapper.videolibrary.FgVideoLibraryDiyTypeMapper;
import com.zrqx.resource.fg.mapper.videolibrary.FgVideoLibraryLabelContentDiyTypeMapper;
import tk.mybatis.mapper.entity.Example;
/**
* 沙画库
*/
@Service
public class FgH5LibrarySerivceImpl extends BaseServiceImpl<H5Library,String> implements FgH5LibraryService {
@Autowired
private FgH5LibraryMapper mapper;
@Autowired
private FgVideoLibraryDiyTypeMapper vdrMapper;
@Autowired
private FgVideoLibraryLabelContentDiyTypeMapper alcdMapper;
@Autowired
private FgRelationAuthorMapper relationAuthorMapper;
@Autowired
private Redis redis;
@Autowired
private SysuserClient sysuserClient;
@Autowired
private QrCodeMapper qrCodeMapper;
@Value("${qrcode-upload-path}")
private String qrCodeUploadPath;
@Value("${realm-name-path}")
private String realmNamePath;
@Override
public BaseMapper<H5Library> getMapper() {
return mapper;
}
/**
* 保存或修改
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:38:56
*/
@Override
public boolean saveOrUpdate(SaveUpdateH5LibraryForm form) {
H5Library entity = new H5Library();
if(StringUtils.isNotBlank(form.getId())) {
entity = mapper.selectByPrimaryKey(form.getId());
}
BeanUtils.copyProperties(form, entity);
if(StringUtils.isBlank(entity.getId())){
//添加
entity.setStatus(LibraryStatusEnum.STATUS_0.getCode());
entity.setUploadTime(new Date());
entity.setUpdateTime(new Date());
entity.setBrowseNum(0);
entity.setResourceType(AllResourceTypeEnum.H5.getCode());
mapper.insert(entity);
}else{
//修改
entity.setUpdateTime(new Date());
mapper.updateByPrimaryKey(entity);
}
return true;
}
/**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
@Override
public boolean batchDelete(List<String> ids) {
if (ids.size() == 0) {
throw new BaseException("没有选中任何数据,请重新选择");
}
Example example = createExample();
example.createCriteria().andIn("id", ids);
List<H5Library> list = mapper.selectByExample(example);
for (H5Library entity : list) {
if (entity.getStatus() == LibraryStatusEnum.STATUS_1.getCode()) {
throw new BaseException("不能删除已上架的资源");
}
}
mapper.deleteByExample(example);
return true;
}
/**
* 后台分页查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:32
*/
@Override
public PageInfo<H5LibraryListVO> page(QueryH5LibraryForm form, PageParam pageParam) {
startPage(pageParam);
List<H5LibraryListVO> list = mapper.query(form);
list.forEach(f -> {
if(f.getStatus() != null) {
f.setStatus_zh(LibraryStatusEnum.getName(f.getStatus()));
}
});
return new PageInfo<H5LibraryListVO>(list);
}
/**
* 根据标题和分类查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:42
*/
@Override
public PageInfo<H5LibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam) {
if(pageParam != null && StringUtils.isBlank(pageParam.getOrderBy())){
pageParam.setOrderBy("uploadTime desc, id desc");
}
startPage(pageParam);
List<H5LibraryListVO> list = mapper.queryByTileAndDiyType(form);
if(!list.isEmpty()){
for(H5LibraryListVO li : list){
li.setStatus_zh(LibraryStatusEnum.getName(li.getStatus()));
}
}
return new PageInfo<H5LibraryListVO>(list);
}
/**
* 查询最大排序
*/
@Override
public Integer selectMaxSort(String courseId) {
return mapper.selectMaxSort(courseId);
}
/**
* 统计音频详情
*/
@Override
public PageInfo<StatisticsResourceVO> getStatisticsResource(SearchForm form, PageParam pageParam) {
startPage(pageParam);
List<StatisticsResourceVO> list = mapper.getStatisticsResource(form);
return new PageInfo<StatisticsResourceVO>(list);
}
/**
* 导出音频详情统计
*/
@Override
public List<StatisticsResourceExportVO> exportStatisticsResource(SearchForm form) {
List<StatisticsResourceExportVO> list = mapper.exportStatisticsResource(form);
return list;
}
}
package com.zrqx.resource.fg.service.h5;
import java.util.List;
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.h5.QueryH5LibraryForm;
import com.zrqx.resource.commons.form.bg.h5.SaveH5LibraryForm;
import com.zrqx.resource.commons.form.bg.h5.SaveUpdateH5LibraryForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.model.h5.H5Library;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.h5.H5LibraryListVO;
/**
* 沙画库
*/
public interface FgH5LibraryService extends BaseService<H5Library,String>{
/**
* 保存或修改
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:38:56
*/
boolean saveOrUpdate(SaveUpdateH5LibraryForm form);
/**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
boolean batchDelete(List<String> ids);
/**
* 后台分页查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:32
*/
PageInfo<H5LibraryListVO> page(QueryH5LibraryForm form, PageParam pageParam);
/**
* 选择弹窗中的列表-根据标题和分类查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:42
*/
PageInfo<H5LibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam);
/***
* 查询视频最大排序号
* @param courseId
* @return
*/
Integer selectMaxSort(String courseId);
/**
* 统计视频资源
* @param form
* @param pageParam
* @return
*/
PageInfo<StatisticsResourceVO> getStatisticsResource(SearchForm form, PageParam pageParam);
/**
* 导出视频详情统计
* @param form
* @return
*/
List<StatisticsResourceExportVO> exportStatisticsResource(SearchForm form);
}
package com.zrqx.resource.fg.service.paintinglibrary;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.zrqx.core.client.sysuser.bg.SysuserClient;
import com.zrqx.core.commons.redis.Redis;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.bg.mapper.qrcode.QrCodeMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.QueryPaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.SavePaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.SaveUpdatePaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.model.paintinglibrary.PaintingLibrary;
import com.zrqx.resource.commons.model.resourcerelation.RelationAuthor;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.paintinglibrary.PaintingLibraryListVO;
import com.zrqx.resource.fg.mapper.FgRelationAuthorMapper;
import com.zrqx.resource.fg.mapper.paintinglibrary.FgPaintingLibraryMapper;
import com.zrqx.resource.fg.mapper.videolibrary.FgVideoLibraryDiyTypeMapper;
import com.zrqx.resource.fg.mapper.videolibrary.FgVideoLibraryLabelContentDiyTypeMapper;
import tk.mybatis.mapper.entity.Example;
/**
* 沙画库
*/
@Service
public class FgPaintingLibrarySerivceImpl extends BaseServiceImpl<PaintingLibrary,String> implements FgPaintingLibraryService {
@Autowired
private FgPaintingLibraryMapper mapper;
@Autowired
private FgVideoLibraryDiyTypeMapper vdrMapper;
@Autowired
private FgVideoLibraryLabelContentDiyTypeMapper alcdMapper;
@Autowired
private FgRelationAuthorMapper relationAuthorMapper;
@Autowired
private Redis redis;
@Autowired
private SysuserClient sysuserClient;
@Autowired
private QrCodeMapper qrCodeMapper;
@Value("${qrcode-upload-path}")
private String qrCodeUploadPath;
@Value("${realm-name-path}")
private String realmNamePath;
@Override
public BaseMapper<PaintingLibrary> getMapper() {
return mapper;
}
/**
* 保存或修改
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:38:56
*/
@Override
public boolean saveOrUpdate(SaveUpdatePaintingLibraryForm form) {
PaintingLibrary entity = new PaintingLibrary();
if(StringUtils.isNotBlank(form.getId())) {
entity = mapper.selectByPrimaryKey(form.getId());
}
/*if(StringUtils.isNotBlank(form.getAuthorNameAndId())){
String[] authorNameAndId = form.getAuthorNameAndId().split(",");
form.setAuthor(authorNameAndId[0]);
if(authorNameAndId.length > 1){
form.setAuthorId(authorNameAndId[1]);
}
}*/
BeanUtils.copyProperties(form, entity);
if(StringUtils.isBlank(entity.getId())){
//添加
entity.setStatus(LibraryStatusEnum.STATUS_0.getCode());
entity.setUploadTime(new Date());
entity.setUpdateTime(new Date());
entity.setBrowseNum(0);
entity.setResourceType(AllResourceTypeEnum.PAINTING.getCode());
mapper.insert(entity);
}else{
//修改
entity.setUpdateTime(new Date());
mapper.updateByPrimaryKey(entity);
// 删除作者关联表
RelationAuthor ba = new RelationAuthor();
ba.setResourceId(entity.getId());
relationAuthorMapper.delete(ba);
}
// 添加作者关系
if (ArrayUtils.isNotEmpty(form.getAuthorList())) {
List<RelationAuthor> baList = form.getAuthorList().stream().filter(a -> StringUtils.isNotBlank(a.getAuthor())).collect(Collectors.toList());
for (RelationAuthor li : baList) {
li.setResourceId(entity.getId());
}
relationAuthorMapper.insertList(baList);
}
return true;
}
/**
* 批量导入
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:13
*/
@Override
public boolean batchInsert(List<SavePaintingLibraryForm> form) {
if(form.isEmpty()) {
throw new BaseException("请选择视频文件!");
}
form.forEach(f -> {
PaintingLibrary entity = new PaintingLibrary();
BeanUtils.copyProperties(f, entity);
entity.setResourceType(AllResourceTypeEnum.PAINTING.getCode());
entity.setStatus(LibraryStatusEnum.STATUS_0.getCode());
entity.setUploadTime(new Date());
entity.setUploadTime(new Date());
if(StringUtils.isNotBlank(f.getVideoName())) {
entity.setName(f.getVideoName().substring(0, f.getVideoName().lastIndexOf(".")));
}
mapper.insert(entity);
});
return true;
}
/**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
@Override
public boolean batchDelete(List<String> ids) {
if (ids.size() == 0) {
throw new BaseException("没有选中任何数据,请重新选择");
}
Example example = createExample();
example.createCriteria().andIn("id", ids);
List<PaintingLibrary> list = mapper.selectByExample(example);
for (PaintingLibrary entity : list) {
if (entity.getStatus() == LibraryStatusEnum.STATUS_1.getCode()) {
throw new BaseException("不能删除已上架的资源");
}
}
mapper.deleteByExample(example);
return true;
}
/**
* 后台分页查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:32
*/
@Override
public PageInfo<PaintingLibraryListVO> page(QueryPaintingLibraryForm form, PageParam pageParam) {
startPage(pageParam);
List<PaintingLibraryListVO> list = mapper.query(form);
list.forEach(f -> {
if(f.getStatus() != null) {
f.setStatus_zh(LibraryStatusEnum.getName(f.getStatus()));
}
});
return new PageInfo<PaintingLibraryListVO>(list);
}
/**
* 根据标题和分类查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:42
*/
@Override
public PageInfo<PaintingLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam) {
if(pageParam != null && StringUtils.isBlank(pageParam.getOrderBy())){
pageParam.setOrderBy("uploadTime desc, id desc");
}
startPage(pageParam);
List<PaintingLibraryListVO> list = mapper.queryByTileAndDiyType(form);
if(!list.isEmpty()){
for(PaintingLibraryListVO li : list){
li.setStatus_zh(LibraryStatusEnum.getName(li.getStatus()));
}
}
return new PageInfo<PaintingLibraryListVO>(list);
}
/**
* 获取原始文件名
* @param code
* @return
* @author ycw
* @date: 2019年1月29日 上午10:05:21
*/
@Override
public String getOriginalFileName(String code){
PaintingLibrary video = new PaintingLibrary();
video.setVideo(code);
List<PaintingLibrary> list = mapper.select(video);
if(list != null && list.size() > 0){
return list.get(0).getName();
}
return null;
}
/**
* 查询最大排序
*/
@Override
public Integer selectMaxSort(String courseId) {
return mapper.selectMaxSort(courseId);
}
/**
* 统计音频详情
*/
@Override
public PageInfo<StatisticsResourceVO> getStatisticsResource(SearchForm form, PageParam pageParam) {
startPage(pageParam);
List<StatisticsResourceVO> list = mapper.getStatisticsResource(form);
return new PageInfo<StatisticsResourceVO>(list);
}
/**
* 导出音频详情统计
*/
@Override
public List<StatisticsResourceExportVO> exportStatisticsResource(SearchForm form) {
List<StatisticsResourceExportVO> list = mapper.exportStatisticsResource(form);
return list;
}
}
package com.zrqx.resource.fg.service.paintinglibrary;
import java.util.List;
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.paintinglibrary.QueryPaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.SavePaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.paintinglibrary.SaveUpdatePaintingLibraryForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.model.paintinglibrary.PaintingLibrary;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.paintinglibrary.PaintingLibraryListVO;
/**
* 沙画库
*/
public interface FgPaintingLibraryService extends BaseService<PaintingLibrary,String>{
/**
* 保存或修改
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:38:56
*/
boolean saveOrUpdate(SaveUpdatePaintingLibraryForm form);
/**
* 批量导入
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:13
*/
boolean batchInsert(List<SavePaintingLibraryForm> form);
/**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
boolean batchDelete(List<String> ids);
/**
* 后台分页查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:32
*/
PageInfo<PaintingLibraryListVO> page(QueryPaintingLibraryForm form, PageParam pageParam);
/**
* 选择弹窗中的列表-根据标题和分类查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:42
*/
PageInfo<PaintingLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam);
/**
* 获取原始文件名
* @param code
* @return
* @author ycw
* @date: 2019年1月29日 上午10:05:21
*/
String getOriginalFileName(String code);
/***
* 查询视频最大排序号
* @param courseId
* @return
*/
Integer selectMaxSort(String courseId);
/**
* 统计视频资源
* @param form
* @param pageParam
* @return
*/
PageInfo<StatisticsResourceVO> getStatisticsResource(SearchForm form, PageParam pageParam);
/**
* 导出视频详情统计
* @param form
* @return
*/
List<StatisticsResourceExportVO> exportStatisticsResource(SearchForm form);
}
package com.zrqx.resource.fg.service.vr;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.zrqx.core.client.sysuser.bg.SysuserClient;
import com.zrqx.core.commons.redis.Redis;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.bg.mapper.qrcode.QrCodeMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.resource.SearchForm;
import com.zrqx.resource.commons.form.bg.vr.QueryVrLibraryForm;
import com.zrqx.resource.commons.form.bg.vr.SaveUpdateVrLibraryForm;
import com.zrqx.resource.commons.model.vr.VrLibrary;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.vr.VrLibraryListVO;
import com.zrqx.resource.fg.mapper.FgRelationAuthorMapper;
import com.zrqx.resource.fg.mapper.videolibrary.FgVideoLibraryDiyTypeMapper;
import com.zrqx.resource.fg.mapper.videolibrary.FgVideoLibraryLabelContentDiyTypeMapper;
import com.zrqx.resource.fg.mapper.vr.FgVrLibraryMapper;
import tk.mybatis.mapper.entity.Example;
/**
* 沙画库
*/
@Service
public class FgVrLibrarySerivceImpl extends BaseServiceImpl<VrLibrary,String> implements FgVrLibraryService {
@Autowired
private FgVrLibraryMapper mapper;
@Autowired
private FgVideoLibraryDiyTypeMapper vdrMapper;
@Autowired
private FgVideoLibraryLabelContentDiyTypeMapper alcdMapper;
@Autowired
private FgRelationAuthorMapper relationAuthorMapper;
@Autowired
private Redis redis;
@Autowired
private SysuserClient sysuserClient;
@Autowired
private QrCodeMapper qrCodeMapper;
@Value("${qrcode-upload-path}")
private String qrCodeUploadPath;
@Value("${realm-name-path}")
private String realmNamePath;
@Override
public BaseMapper<VrLibrary> getMapper() {
return mapper;
}
/**
* 保存或修改
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:38:56
*/
@Override
public boolean saveOrUpdate(SaveUpdateVrLibraryForm form) {
VrLibrary entity = new VrLibrary();
if(StringUtils.isNotBlank(form.getId())) {
entity = mapper.selectByPrimaryKey(form.getId());
}
BeanUtils.copyProperties(form, entity);
if(StringUtils.isBlank(entity.getId())){
//添加
entity.setStatus(LibraryStatusEnum.STATUS_0.getCode());
entity.setUploadTime(new Date());
entity.setUpdateTime(new Date());
entity.setBrowseNum(0);
entity.setResourceType(AllResourceTypeEnum.VR.getCode());
mapper.insert(entity);
}else{
//修改
entity.setUpdateTime(new Date());
mapper.updateByPrimaryKey(entity);
}
return true;
}
/**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
@Override
public boolean batchDelete(List<String> ids) {
if (ids.size() == 0) {
throw new BaseException("没有选中任何数据,请重新选择");
}
Example example = createExample();
example.createCriteria().andIn("id", ids);
List<VrLibrary> list = mapper.selectByExample(example);
for (VrLibrary entity : list) {
if (entity.getStatus() == LibraryStatusEnum.STATUS_1.getCode()) {
throw new BaseException("不能删除已上架的资源");
}
}
mapper.deleteByExample(example);
return true;
}
/**
* 后台分页查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:32
*/
@Override
public PageInfo<VrLibraryListVO> page(QueryVrLibraryForm form, PageParam pageParam) {
startPage(pageParam);
List<VrLibraryListVO> list = mapper.query(form);
list.forEach(f -> {
if(f.getStatus() != null) {
f.setStatus_zh(LibraryStatusEnum.getName(f.getStatus()));
}
});
return new PageInfo<VrLibraryListVO>(list);
}
/**
* 根据标题和分类查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:42
*/
@Override
public PageInfo<VrLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam) {
if(pageParam != null && StringUtils.isBlank(pageParam.getOrderBy())){
pageParam.setOrderBy("uploadTime desc, id desc");
}
startPage(pageParam);
List<VrLibraryListVO> list = mapper.queryByTileAndDiyType(form);
if(!list.isEmpty()){
for(VrLibraryListVO li : list){
li.setStatus_zh(LibraryStatusEnum.getName(li.getStatus()));
}
}
return new PageInfo<VrLibraryListVO>(list);
}
/**
* 查询最大排序
*/
@Override
public Integer selectMaxSort(String courseId) {
return mapper.selectMaxSort(courseId);
}
/**
* 统计音频详情
*/
@Override
public PageInfo<StatisticsResourceVO> getStatisticsResource(SearchForm form, PageParam pageParam) {
startPage(pageParam);
List<StatisticsResourceVO> list = mapper.getStatisticsResource(form);
return new PageInfo<StatisticsResourceVO>(list);
}
/**
* 导出音频详情统计
*/
@Override
public List<StatisticsResourceExportVO> exportStatisticsResource(SearchForm form) {
List<StatisticsResourceExportVO> list = mapper.exportStatisticsResource(form);
return list;
}
}
package com.zrqx.resource.fg.service.vr;
import java.util.List;
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.resource.SearchForm;
import com.zrqx.resource.commons.form.bg.vr.QueryVrLibraryForm;
import com.zrqx.resource.commons.form.bg.vr.SaveUpdateVrLibraryForm;
import com.zrqx.resource.commons.form.bg.vr.SaveVrLibraryForm;
import com.zrqx.resource.commons.model.vr.VrLibrary;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceExportVO;
import com.zrqx.resource.commons.vo.bg.StatisticsResourceVO;
import com.zrqx.resource.commons.vo.bg.vr.VrLibraryListVO;
/**
* 沙画库
*/
public interface FgVrLibraryService extends BaseService<VrLibrary,String>{
/**
* 保存或修改
* @param form
* @return
* @author yzg
* @date: 2018年11月22日 下午2:38:56
*/
boolean saveOrUpdate(SaveUpdateVrLibraryForm form);
/**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
boolean batchDelete(List<String> ids);
/**
* 后台分页查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:32
*/
PageInfo<VrLibraryListVO> page(QueryVrLibraryForm form, PageParam pageParam);
/**
* 选择弹窗中的列表-根据标题和分类查询
* @param form
* @param pageParam
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:42
*/
PageInfo<VrLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam);
/***
* 查询视频最大排序号
* @param courseId
* @return
*/
Integer selectMaxSort(String courseId);
/**
* 统计视频资源
* @param form
* @param pageParam
* @return
*/
PageInfo<StatisticsResourceVO> getStatisticsResource(SearchForm form, PageParam pageParam);
/**
* 导出视频详情统计
* @param form
* @return
*/
List<StatisticsResourceExportVO> exportStatisticsResource(SearchForm form);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论