Commit 93db1527 authored by liqin's avatar liqin 💬

bug fixed

parent 7f3e7a0f
package cn.wisenergy.chnmuseum.party.common.dfs;
import cn.wisenergy.chnmuseum.party.common.mvc.InterfaceException;
import cn.wisenergy.chnmuseum.party.common.util.*;
import cn.wisenergy.chnmuseum.party.common.util.CopyStreamUtils;
import cn.wisenergy.chnmuseum.party.common.util.FileTypeUtil;
import cn.wisenergy.chnmuseum.party.common.util.FileUtil;
import com.github.tobato.fastdfs.domain.fdfs.FileInfo;
import com.github.tobato.fastdfs.domain.fdfs.MetaData;
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
......@@ -23,9 +25,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
......@@ -53,23 +53,13 @@ public class FastDFSUtils {
FastDFSUtils.imageConfig = thumbImageConfig;
}
public static String uploadFile(InputStream inputStream, long size, String fileName) {
final Set<MetaData> metaDataSet = new HashSet<>();
metaDataSet.add(new MetaData("fileName", fileName));
metaDataSet.add(new MetaData("fileSize", size + ""));
metaDataSet.add(new MetaData("fileExtName", FilenameUtils.getExtension(fileName)));
metaDataSet.add(new MetaData("updateTime", TimeUtils.format(LocalDateTime.now(), TimeUtils.FORMAT_ONE)));
final StorePath storePath = storageClient.uploadFile(inputStream, size, FilenameUtils.getExtension(fileName), metaDataSet);
return dfsFileAccessBasePath + "/" + storePath.getFullPath();
}
public static Map<String, Object> uploadUeImage(InputStream inputStream, long fileSize, String fileName) {
boolean isImage = FileTypeUtil.isImageByExtension(fileName);
if (isImage) {
String mimeType = FileUtil.getMimeType(fileName);
final String storePath = FastDFSUtils.uploadFile(inputStream, fileSize, fileName);
final String storePath = FastDFSUtils.uploadFile(inputStream, fileSize, fileName, null);
Map<String, Object> uploadResult = new HashMap<>();
uploadResult.put("url", dfsFileAccessBasePath + "/" + storePath);
uploadResult.put("url", storePath);
uploadResult.put("status", true);
uploadResult.put("message", "文件上传成功!");
uploadResult.put("title", fileName);
......@@ -80,16 +70,16 @@ public class FastDFSUtils {
throw new InterfaceException("400", "文件不是图片类型");
}
public static String uploadVideo(InputStream inputStream, long size, String fileName) {
public static String uploadFile(InputStream inputStream, long size, String fileName, Set<MetaData> metaDataSet) {
final StorePath storePath = storageClient.uploadFile(inputStream, size, FilenameUtils.getExtension(fileName), metaDataSet);
return dfsFileAccessBasePath + "/" + storePath.getFullPath();
}
public static String uploadVideo(InputStream inputStream, long size, String fileName, Set<MetaData> metaDataSet) {
Map<String, Object> map = CopyStreamUtils.copyInputStream(inputStream);
String md5 = (String) map.get("md5");
InputStream is = (InputStream) map.get("inputStream");
final Set<MetaData> metaDataSet = new HashSet<>();
metaDataSet.add(new MetaData("fileName", fileName));
metaDataSet.add(new MetaData("fileSize", size + ""));
metaDataSet.add(new MetaData("updateTime", TimeUtils.format(LocalDateTime.now(), TimeUtils.FORMAT_ONE)));
metaDataSet.add(new MetaData("MD5", md5));
InputStream is = (InputStream) map.get("inputStream");
final StorePath storePath = storageClient.uploadFile(is, size, FilenameUtils.getExtension(fileName), metaDataSet);
return dfsFileAccessBasePath + "/" + storePath.getFullPath();
}
......@@ -97,12 +87,11 @@ public class FastDFSUtils {
/**
* 使用 FastDFS 提供的客户端 storageClient 来进行文件上传,最后将上传结果返回。
* 根据 groupName 和文件名获取文件信息。
*
* @param groupName
* @param path
* @return
*/
public static FileInfo getFileInfo(String groupName, String path) {
public static FileInfo getFileInfo(String fileUrl) {
fileUrl = fileUrl.replace(dfsFileAccessBasePath + "/", "");
String groupName = fileUrl.substring(0, fileUrl.indexOf("/"));
String path = fileUrl.substring(fileUrl.indexOf("/") + 1);
return storageClient.queryFileInfo(groupName, path);
}
......
......@@ -5,7 +5,7 @@ package cn.wisenergy.chnmuseum.party.common.enums;
*/
public enum AuditTypeEnum {
ASSET(1, "视频内容"),
VIDEO_CONTENT(1, "视频内容"),
EXHIBITION_BOARD(2, "展板内容"),
LEARNING_CONTENT(3, "学习内容"),
ACCOUNT(4, "账户");
......@@ -13,12 +13,12 @@ public enum AuditTypeEnum {
// 错误编码
private Integer code;
// 信息
private String operation;
private String type;
// 相应编码有参构造函数
AuditTypeEnum(Integer code, String operation) {
AuditTypeEnum(Integer code, String type) {
this.code = code;
this.operation = operation;
this.type = type;
}
public Integer getCode() {
......@@ -29,12 +29,11 @@ public enum AuditTypeEnum {
this.code = code;
}
public String getOperation() {
return operation;
public String getType() {
return type;
}
public void setOperation(String operation) {
this.operation = operation;
public void setType(String type) {
this.type = type;
}
}
package cn.wisenergy.chnmuseum.party.common.enums;
public enum FileCatEnum {
VIDEO_CONTENT("VIDEO_CONTENT", "视频内容"),
EXHIBITION_BOARD_AUDIO("EXHIBITION_BOARD_AUDIO", "展板音频"),
EXHIBITION_BOARD_VIDEO("EXHIBITION_BOARD_VIDEO", "展板视频"),
EXHIBITION_BOARD_DATUM("EXHIBITION_BOARD_DATUM", "展板参考资料"),
LEARNING_CONTENT("LEARNING_CONTENT", "学习内容"),
LEARNING_PROJECT("LEARNING_PROJECT", "学习项目");
private String cat;
private String name;
FileCatEnum(String cat, String name) {
this.cat = cat;
this.name = name;
}
public String getCat() {
return cat;
}
public void setCat(String cat) {
this.cat = cat;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -2,10 +2,10 @@ package cn.wisenergy.chnmuseum.party.common.enums;
public enum FileTypeEnum {
DATUM("Datum", "资料"),
IMAGE("Image", "图片"),
AUDIO("Audio", "音频"),
VIDEO("Video", "视频");
DOCUMENT("DOCUMENT", "文档"),
IMAGE("IMAGE", "图片"),
AUDIO("AUDIO", "音频"),
VIDEO("VIDEO", "视频");
// 错误编码
private String type;
......
......@@ -3,9 +3,9 @@ package cn.wisenergy.chnmuseum.party.common.mybatis;
public class MysqlGenerator {
private static final String[] tableNames = new String[]{
"t_audit"
"asset", "video_content", "video_content_cat"
};
// private static final String projectPath = "D:\\develop\\Project\\chnmuseum-party";
// private static final String projectPath = "D:\\develop\\Project\\chnmuseum-party";
private static final String projectPath = "/opt/ss";
public static void main(String[] args) {
......
......@@ -11,7 +11,7 @@ import java.util.List;
import java.util.Map;
public class ImportExcelUtil {
// abc.xls
public static boolean isXls(String fileName) {
// (?i)忽略大小写
if (fileName.matches("^.+\\.(?i)(xls)$")) {
......
......@@ -45,11 +45,11 @@ public abstract class BasePageOrderParam extends BasePageParam {
@ApiModelProperty("版权方类型")
private String ownerType;
@ApiModelProperty("视频分类ID")
private String assetTypeId;
@ApiModelProperty("视频内容分类ID")
private String videoContentCatId;
@ApiModelProperty("视频版权方ID")
private String assetCopyrightOwnerId;
@ApiModelProperty("视频内容版权方ID")
private String videoContentCopyrightOwnerId;
@ApiModelProperty("展板版权方ID")
private String boardCopyrightOwnerId;
......
package cn.wisenergy.chnmuseum.party.common.vo;
import cn.wisenergy.chnmuseum.party.model.Asset;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -17,6 +18,7 @@ import java.util.List;
@Accessors(chain = true)
@ApiModel(value = "批量操作响应参数", description = "批量操作响应参数")
public class BatchUploadResVO {
private static final long serialVersionUID = 51873394122822866L;
@ApiModelProperty("成功数量")
......@@ -31,8 +33,8 @@ public class BatchUploadResVO {
@ApiModelProperty("处理结果集合")
private List<HandleResult> handleList;
@ApiModelProperty("成功上传的URL集合")
private List<String> urlList;
@ApiModelProperty("成功上传的文件集合")
private List<Asset> fileList;
@Data
public static class HandleResult {
......
package cn.wisenergy.chnmuseum.party.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.wisenergy.chnmuseum.party.model.VideoContentCat;
/**
* <pre>
* 视频内容分类 Mapper 接口
* </pre>
*
* @author Danny Lee
* @since 2021-04-01
*/
public interface VideoContentCatMapper extends BaseMapper<VideoContentCat> {
}
package cn.wisenergy.chnmuseum.party.mapper;
import cn.wisenergy.chnmuseum.party.model.AssetType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.wisenergy.chnmuseum.party.model.VideoContent;
/**
* <p>
* 视频分类 Mapper 接口
* </p>
* <pre>
* 视频内容 Mapper 接口
* </pre>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-04-01
*/
public interface AssetTypeMapper extends BaseMapper<AssetType> {
public interface VideoContentMapper extends BaseMapper<VideoContent> {
}
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
* 视频
* 文件资产
* </p>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-04-01
*/
@Data
@Builder
......@@ -29,64 +27,59 @@ import java.util.List;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("asset")
@ApiModel(value = "视频", description = "视频")
@ApiModel(value = "文件资产", description = "文件资产")
public class Asset implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("视频ID")
@ApiModelProperty("文件资产ID")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "视频ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty("视频名称")
@TableField("name")
@NotBlank(message = "视频名称不能为空", groups = {Add.class, Update.class})
private String name;
@ApiModelProperty("所属项ID")
@TableField("ref_item_id")
private String refItemId;
@ApiModelProperty("视频缩略图")
@TableField("thumbnail")
@NotBlank(message = "视频缩略图不能为空", groups = {Add.class, Update.class})
private String thumbnail;
@ApiModelProperty("文件名")
@TableField("file_name")
private String fileName;
@ApiModelProperty("视频类别ID")
@TableField("asset_type_id")
private String assetTypeId;
@ApiModelProperty("扩展名")
@TableField("file_ext_name")
private String fileExtName;
@ApiModelProperty("视频版权方ID")
@TableField("asset_copyright_owner_id")
private String assetCopyrightOwnerId;
@ApiModelProperty("多媒体类型")
@TableField("file_type")
private String fileType;
@ApiModelProperty("文件大小(B)")
@TableField("file_size")
private Long fileSize;
@ApiModelProperty("文件分类")
@TableField("file_cat")
private String fileCat;
@ApiModelProperty("下载链接")
@TableField("video_url")
private String videoUrl;
@TableField("file_url")
private String fileUrl;
@ApiModelProperty("视频缩略图")
@TableField("thumbnail")
private String thumbnail;
@ApiModelProperty("审核状态")
@TableField("audit_status")
private String auditStatus;
@ApiModelProperty("语言")
@TableField("language")
private String language;
@ApiModelProperty("是否上架")
@TableField("is_published")
private Boolean published;
@ApiModelProperty("MD5")
@TableField("md5")
private String md5;
@ApiModelProperty("创建日期")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
@ApiModelProperty("修改日期")
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@ApiModelProperty("视频分类")
@TableField(exist = false)
private String assetTypeName;
@ApiModelProperty("视频版权方名称")
@TableField(exist = false)
private String assetCopyrightOwnerName;
@ApiModelProperty("视频URL列表")
@TableField(exist = false)
private List<String> videoUrlList;
}
......@@ -29,7 +29,7 @@ import java.util.List;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("exhibition_board")
@ApiModel(value = "展板", description = "展板")
@ApiModel(value = "展板内容", description = "展板内容")
public class ExhibitionBoard implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -67,31 +67,25 @@ public class ExhibitionBoard implements Serializable {
@NotBlank(message = "简介不能为空", groups = {Add.class, Update.class})
private String remarks;
@ApiModelProperty("视频版权方ID")
@TableField("asset_copyright_owner_id")
private String assetCopyrightOwnerId;
@ApiModelProperty("视频内容版权方ID")
@TableField("video_content_copyright_owner_id")
@NotBlank(message = "视频内容版权方ID不能为空", groups = {Add.class, Update.class})
private String videoContentCopyrightOwnerId;
@ApiModelProperty("视频类别ID")
@TableField("asset_type_id")
private String assetTypeId;
@TableField("video_content_cat_id")
@NotBlank(message = "视频类别ID不能为空", groups = {Add.class, Update.class})
private String videoContentCatId;
@ApiModelProperty("视频ID")
@TableField("asset_id")
@NotBlank(message = "视频ID不能为空", groups = {Add.class, Update.class})
private String assetId;
@ApiModelProperty("导览音频URL")
@TableField("guide_audio_url")
private String guideAudioUrl;
@ApiModelProperty("视频内容ID")
@TableField("video_content_id")
@NotBlank(message = "视频内容ID不能为空", groups = {Add.class, Update.class})
private String videoContentId;
@ApiModelProperty("参考资料文件夹")
@TableField("ref_material_dir")
private String refMaterialDir;
@ApiModelProperty("参考资料URL")
@TableField("ref_material_url")
private String refMaterialUrl;
@ApiModelProperty("审核状态")
@TableField("audit_status")
private String auditStatus;
......@@ -108,40 +102,48 @@ public class ExhibitionBoard implements Serializable {
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@ApiModelProperty("展板版权方名称")
@ApiModelProperty("展板音频文件ID列表(添加或更新使用)")
@TableField(exist = false)
private String boardCopyrightOwnerName;
private List<String> audioIdList;
@ApiModelProperty("参考资料文件ID列表(添加或更新使用)")
@TableField(exist = false)
private List<String> datumIdList;
@ApiModelProperty("所属学习内容ID")
@TableField(exist = false)
private String learningContentId;
@ApiModelProperty("视频版权方名称")
@ApiModelProperty("展板版权方名称")
@TableField(exist = false)
private String assetCopyrightOwnerName;
private String boardCopyrightOwnerName;
@ApiModelProperty("展板分类名称")
@TableField(exist = false)
private String exhibitionBoardCatName;
@ApiModelProperty("关联视频名称")
@ApiModelProperty("视频资料-视频内容版权方名称")
@TableField(exist = false)
private String assetName;
private String videoContentCopyrightOwnerName;
@ApiModelProperty("展板视频URL")
@ApiModelProperty("视频资料-视频内容分类名称")
@TableField(exist = false)
private String videoUrl;
private String videoContentCatName;
@ApiModelProperty("展板视频URL列表")
@ApiModelProperty("视频资料-视频内容名称")
@TableField(exist = false)
private List<String> videoUrlList;
private String videoContentName;
@ApiModelProperty("展板音频URL列表")
@ApiModelProperty("展板视频")
@TableField(exist = false)
private List<String> audioUrlList;
private List<Asset> videoList;
@ApiModelProperty("参考资料URL列表")
@ApiModelProperty("展板视频")
@TableField(exist = false)
private List<String> materialUrlList;
private List<Asset> audioList;
@ApiModelProperty("所属学习内容ID")
@ApiModelProperty("参考资料列表")
@TableField(exist = false)
private String learningContentId;
private List<Asset> datumList;
}
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
* 视频
* </p>
*
* @author Danny Lee
* @since 2021-03-16
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("video_content")
@ApiModel(value = "视频内容", description = "视频内容")
public class VideoContent implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("视频内容ID")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "视频内容ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty("视频内容名称")
@TableField("name")
@NotBlank(message = "视频内容名称不能为空", groups = {Add.class, Update.class})
private String name;
@ApiModelProperty("视频内容版权方ID")
@TableField("video_content_copyright_owner_id")
private String videoContentCopyrightOwnerId;
@ApiModelProperty("视频内容分类ID")
@TableField("video_content_cat_id")
private String videoContentCatId;
@ApiModelProperty("视频内容缩略图")
@TableField("thumbnail")
@NotBlank(message = "视频内容缩略图不能为空", groups = {Add.class})
private String thumbnail;
@ApiModelProperty("审核状态")
@TableField("audit_status")
private String auditStatus;
@ApiModelProperty("是否上架")
@TableField("is_published")
private Boolean published;
@ApiModelProperty("是否已删除")
@TableField("is_deleted")
private Boolean deleted;
@ApiModelProperty("创建日期")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private LocalDateTime createTime;
@ApiModelProperty("修改日期")
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@ApiModelProperty("视频内容分类名称")
@TableField(exist = false)
private String videoContentCatName;
@ApiModelProperty("视频内容版权方名称")
@TableField(exist = false)
private String videoContentCopyrightOwnerName;
@ApiModelProperty("视频ID列表(添加/更新使用)")
@TableField(exist = false)
private List<String> videoIdList;
@ApiModelProperty("视频文件信息列表")
@TableField(exist = false)
private List<Asset> videoFileList;
}
......@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
/**
* <p>
* 视频分类
* 视频内容分类
* </p>
*
* @author Danny Lee
......@@ -27,20 +27,20 @@ import java.time.LocalDateTime;
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("asset_type")
@ApiModel(value = "视频分类", description = "视频分类")
public class AssetType implements Serializable {
@TableName("video_content_cat")
@ApiModel(value = "视频内容分类", description = "视频内容分类")
public class VideoContentCat implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("视频分类ID")
@ApiModelProperty("视频内容分类ID")
@TableId(value = "id", type = IdType.ASSIGN_ID)
@NotNull(message = "视频分类IDID不能为空", groups = {Update.class})
@NotNull(message = "视频内容分类不能为空", groups = {Update.class})
private String id;
@ApiModelProperty("视频分类名称")
@ApiModelProperty("视频内容分类名称")
@TableField("name")
@NotBlank(message = "视频分类名称不能为空", groups = {Add.class, Update.class})
@NotBlank(message = "视频内容分类名称不能为空", groups = {Add.class, Update.class})
private String name;
@ApiModelProperty("备注")
......@@ -59,7 +59,7 @@ public class AssetType implements Serializable {
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@ApiModelProperty("版权方")
@ApiModelProperty("版权方名称")
@TableField(exist = false)
private String copyrightOwnerName;
......
......@@ -23,6 +23,6 @@ public interface LearningContentBoardService extends IService<LearningContentBoa
IPage<ExhibitionBoard> getBoardPageByLearningContentId(Page<ExhibitionBoard> page, String learningContentId, String nameOrCode);
IPage<Asset> getAssetPageByOrganCode(Page<ExhibitionBoard> page, String organCode);
IPage<Asset> getAssetPageByOrganCode(Page<Asset> page, String organCode);
}
package cn.wisenergy.chnmuseum.party.service;
import cn.wisenergy.chnmuseum.party.model.VideoContentCat;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 视频内容分类 服务接口
* </p>
*
* @author Danny Lee
* @since 2021-04-01
*/
public interface VideoContentCatService extends IService<VideoContentCat> {
}
package cn.wisenergy.chnmuseum.party.service;
import cn.wisenergy.chnmuseum.party.model.AssetType;
import cn.wisenergy.chnmuseum.party.model.VideoContent;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 视频分类 服务类
* 视频内容 服务接口
* </p>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-04-01
*/
public interface AssetTypeService extends IService<AssetType> {
public interface VideoContentService extends IService<VideoContent> {
}
package cn.wisenergy.chnmuseum.party.service.impl;
import cn.wisenergy.chnmuseum.party.model.Asset;
import cn.wisenergy.chnmuseum.party.mapper.AssetMapper;
import cn.wisenergy.chnmuseum.party.model.Asset;
import cn.wisenergy.chnmuseum.party.service.AssetService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
......
......@@ -38,7 +38,7 @@ public class LearningContentBoardServiceImpl extends ServiceImpl<LearningContent
}
@Override
public IPage<Asset> getAssetPageByOrganCode(Page<ExhibitionBoard> page, String organCode) {
public IPage<Asset> getAssetPageByOrganCode(Page<Asset> page, String organCode) {
return learningContentBoardMapper.selectAssetPageByOrganCode(page, organCode);
}
......
package cn.wisenergy.chnmuseum.party.service.impl;
import cn.wisenergy.chnmuseum.party.model.AssetType;
import cn.wisenergy.chnmuseum.party.mapper.AssetTypeMapper;
import cn.wisenergy.chnmuseum.party.service.AssetTypeService;
import cn.wisenergy.chnmuseum.party.mapper.VideoContentCatMapper;
import cn.wisenergy.chnmuseum.party.model.VideoContentCat;
import cn.wisenergy.chnmuseum.party.service.VideoContentCatService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* <p>
* 视频分类 服务实现类
* </p>
* <pre>
* 视频内容分类 服务实现类
* </pre>
*
* @author Danny Lee
* @since 2021-03-16
* @since 2021-04-01
*/
@Slf4j
@Service
public class AssetTypeServiceImpl extends ServiceImpl<AssetTypeMapper, AssetType> implements AssetTypeService {
public class VideoContentCatServiceImpl extends ServiceImpl<VideoContentCatMapper, VideoContentCat> implements VideoContentCatService {
}
package cn.wisenergy.chnmuseum.party.service.impl;
import cn.wisenergy.chnmuseum.party.model.VideoContent;
import cn.wisenergy.chnmuseum.party.mapper.VideoContentMapper;
import cn.wisenergy.chnmuseum.party.service.VideoContentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
/**
* <pre>
* 视频内容 服务实现类
* </pre>
*
* @author Danny Lee
* @since 2021-04-01
*/
@Slf4j
@Service
public class VideoContentServiceImpl extends ServiceImpl<VideoContentMapper, VideoContent> implements VideoContentService {
@Autowired
private VideoContentMapper videoContentMapper;
}
......@@ -2,21 +2,18 @@ package cn.wisenergy.chnmuseum.party.web.controller;
import cn.wisenergy.chnmuseum.party.auth.SHA256PasswordEncryptionService;
import cn.wisenergy.chnmuseum.party.auth.util.JwtTokenUtil;
import cn.wisenergy.chnmuseum.party.common.enums.FileCatEnum;
import cn.wisenergy.chnmuseum.party.common.enums.FileTypeEnum;
import cn.wisenergy.chnmuseum.party.common.enums.LanguageEnum;
import cn.wisenergy.chnmuseum.party.common.mvc.InterfaceException;
import cn.wisenergy.chnmuseum.party.common.util.TimeUtils;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.vo.AudioVo;
import cn.wisenergy.chnmuseum.party.common.vo.DatumVo;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.common.vo.VideoVo;
import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.service.impl.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.Feature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
......@@ -77,6 +74,9 @@ public class ChinaMobileRestApiController extends BaseController {
@Resource
private AssetServiceImpl assetService;
@Resource
private VideoContentService videoContentService;
@Resource
private TBoxOperationServiceImpl boxOperationService;
......@@ -116,12 +116,6 @@ public class ChinaMobileRestApiController extends BaseController {
//用户登录是否被锁定 一小时 redisKey 前缀
private static final String SHIRO_IS_LOCK = "shiro_is_lock_";
/**
* 机顶盒激活状态查询
*
* @param
* @return
*/
@ApiOperation(value = "获取机顶盒密钥", notes = "获取机顶盒密钥")
@GetMapping("/equitment/key")
@RequiresPermissions("equitment:key")
......@@ -147,12 +141,6 @@ public class ChinaMobileRestApiController extends BaseController {
return getFailResult();
}
/**
* 机顶盒激活状态查询
*
* @param
* @return
*/
@ApiOperation(value = "机顶盒激活状态查询", notes = "机顶盒激活状态查询")
@GetMapping("/equitment/activity")
@RequiresPermissions("/equitment/activity/")
......@@ -174,14 +162,6 @@ public class ChinaMobileRestApiController extends BaseController {
return getFailResult();
}
/**
* 管理员ajax登录请求 后端用户登录
*
* @param username
* @param password
* @return
*/
@RequestMapping(value = "/user/webLogin", method = RequestMethod.POST)
public ResponseEntity<JSONObject> login(@RequestParam(value = "username") String username,
@RequestParam(value = "password") String password,
......@@ -373,22 +353,18 @@ public class ChinaMobileRestApiController extends BaseController {
public Map<String, Object> getExhibitionBoardPageList(@RequestParam(value = "learningContentId") String learningContentId) {
final IPage<ExhibitionBoard> page = this.learningContentBoardService.getBoardPageByLearningContentId(getPage(), learningContentId, null);
for (ExhibitionBoard exhibitionBoard : page.getRecords()) {
if (exhibitionBoard.getAssetCopyrightOwnerId() != null) {
String name = this.copyrightOwnerService.getById(exhibitionBoard.getAssetCopyrightOwnerId()).getName();
exhibitionBoard.setLearningContentId(learningContentId);
if (exhibitionBoard.getVideoContentCopyrightOwnerId() != null) {
String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName();
exhibitionBoard.setBoardCopyrightOwnerName(name);
}
if (exhibitionBoard.getExhibitionBoardCatId() != null) {
String name = this.exhibitionBoardCatService.getById(exhibitionBoard.getExhibitionBoardCatId()).getName();
exhibitionBoard.setExhibitionBoardCatName(name);
}
final String assetId = exhibitionBoard.getAssetId();
final Asset asset = this.assetService.getById(assetId);
final String videoUrl = asset.getVideoUrl();
final List<VideoVo> videoVoList = JSONObject.parseObject(videoUrl, new TypeReference<List<VideoVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setVideoUrlList(videoVoList.stream().map(VideoVo::getFileUrl).collect(Collectors.toList()));
exhibitionBoard.setVideoUrl(videoUrl);
exhibitionBoard.setLearningContentId(learningContentId);
LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getVideoContentId()).eq(Asset::getFileType, FileTypeEnum.VIDEO.name());
List<Asset> videoList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setVideoList(videoList);
}
return getResult(page);
}
......@@ -409,29 +385,32 @@ public class ChinaMobileRestApiController extends BaseController {
if (boardCopyrightOwnerId != null) {
exhibitionBoard.setBoardCopyrightOwnerName(this.copyrightOwnerService.getById(boardCopyrightOwnerId).getName());
}
if (exhibitionBoard.getVideoContentCopyrightOwnerId() != null) {
String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName();
exhibitionBoard.setVideoContentCopyrightOwnerName(name);
}
final String guideAudioUrl = exhibitionBoard.getGuideAudioUrl();
final List<AudioVo> audioVoList = JSONObject.parseObject(guideAudioUrl, new TypeReference<List<AudioVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setAudioUrlList(audioVoList.stream().map(AudioVo::getFileUrl).collect(Collectors.toList()));
LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
final List<Asset> audioList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setAudioList(audioList);
final String refMaterialUrl = exhibitionBoard.getRefMaterialUrl();
final List<AudioVo> refMaterialVoList = JSONObject.parseObject(refMaterialUrl, new TypeReference<List<AudioVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setMaterialUrlList(refMaterialVoList.stream().map(AudioVo::getFileUrl).collect(Collectors.toList()));
assetQueryWrapper.clear();
assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
final List<Asset> datumList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setDatumList(datumList);
String assetId = exhibitionBoard.getAssetId();
if (assetId != null) {
final Asset asset = this.assetService.getById(assetId);
exhibitionBoard.setAssetName(this.assetService.getById(assetId).getName());
final String assetCopyrightOwnerId = asset.getAssetCopyrightOwnerId();
final String assetCopyrightOwnerName = this.copyrightOwnerService.getById(assetCopyrightOwnerId).getName();
exhibitionBoard.setAssetCopyrightOwnerName(assetCopyrightOwnerName);
final String videoContentId = exhibitionBoard.getVideoContentId();
if (videoContentId != null) {
final VideoContent videoContent = this.videoContentService.getById(videoContentId);
exhibitionBoard.setVideoContentName(videoContent.getName());
final String videoUrl = asset.getVideoUrl();
final List<VideoVo> videoVoList = JSONObject.parseObject(videoUrl, new TypeReference<List<VideoVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setVideoUrlList(videoVoList.stream().map(VideoVo::getFileUrl).collect(Collectors.toList()));
assetQueryWrapper.clear();
assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContentId);
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.VIDEO_CONTENT.name());
final List<Asset> videoList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setVideoList(videoList);
}
return getResult(exhibitionBoard);
}
......@@ -547,11 +526,10 @@ public class ChinaMobileRestApiController extends BaseController {
@ApiOperation(value = "展板参考资料查询", notes = "展板参考资料查询")
public Map<String, Object> getBoardRefMaterial(@PathVariable(value = "boardId") String boardId) {
final ExhibitionBoard exhibitionBoard = this.exhibitionBoardService.getById(boardId);
final String refMaterialUrl = exhibitionBoard.getRefMaterialUrl();
final List<DatumVo> datumVoList = JSONObject.parseObject(refMaterialUrl, new TypeReference<List<DatumVo>>() {
}, Feature.OrderedField);
return getResult(datumVoList);
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
final List<Asset> datumList = this.assetService.list(assetQueryWrapper);
return getResult(datumList);
}
@ApiImplicitParams(value = {
......
......@@ -5,7 +5,7 @@ import cn.wisenergy.chnmuseum.party.common.util.TimeUtils;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.AssetType;
import cn.wisenergy.chnmuseum.party.model.VideoContentCat;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwner;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerAssetType;
import cn.wisenergy.chnmuseum.party.model.ExhibitionBoard;
......@@ -182,8 +182,8 @@ public class CopyrightOwnerController extends BaseController {
List<CopyrightOwnerAssetType> CopyrightOwnerAssetTypeList = this.copyrightOwnerAssetTypeService.list(Wrappers.<CopyrightOwnerAssetType>lambdaQuery().eq(CopyrightOwnerAssetType::getCopyrightOwnerId, copyrightOwner.getId()));
if (!CopyrightOwnerAssetTypeList.isEmpty()) {
Set<String> idList = CopyrightOwnerAssetTypeList.stream().map(CopyrightOwnerAssetType::getAssetTypeId).collect(Collectors.toSet());
List<AssetType> assetTypeList = this.assetTypeService.listByIds(idList);
String assetTypeNameList = assetTypeList.stream().map(AssetType::getName).collect(Collectors.joining("、"));
List<VideoContentCat> videoContentCatList = this.assetTypeService.listByIds(idList);
String assetTypeNameList = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.joining("、"));
copyrightOwner.setAssetTypeNames(assetTypeNameList);
}
} else if (CopyrightOwnerTypeEnum.EXHIBITION_BOARD.name().equals(genericPageParam.getOwnerType())) {
......@@ -191,8 +191,8 @@ public class CopyrightOwnerController extends BaseController {
List<ExhibitionBoard> exhibitionBoardList = this.exhibitionBoardService.list(lambdaQueryWrapper);
if (!exhibitionBoardList.isEmpty()) {
Set<String> assetTypeIdList = exhibitionBoardList.stream().map(ExhibitionBoard::getAssetTypeId).collect(Collectors.toSet());
List<AssetType> assetTypeList = this.assetTypeService.listByIds(assetTypeIdList);
String assetTypeNames = assetTypeList.stream().map(AssetType::getName).collect(Collectors.joining("、"));
List<VideoContentCat> videoContentCatList = this.assetTypeService.listByIds(assetTypeIdList);
String assetTypeNames = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.joining("、"));
copyrightOwner.setAssetTypeNames(assetTypeNames);
}
}
......@@ -215,9 +215,9 @@ public class CopyrightOwnerController extends BaseController {
if (!copyrightOwnerAssetTypeList.isEmpty()) {
List<String> assetTypeIdArrayList = copyrightOwnerAssetTypeList.stream().map(CopyrightOwnerAssetType::getAssetTypeId).distinct().collect(Collectors.toList());
copyrightOwner.setAssetTypeIdList(assetTypeIdArrayList);
final List<AssetType> assetTypeList = this.assetTypeService.listByIds(assetTypeIdArrayList);
if (!assetTypeList.isEmpty()) {
final List<String> assetTypeNameList = assetTypeList.stream().map(AssetType::getName).collect(Collectors.toList());
final List<VideoContentCat> videoContentCatList = this.assetTypeService.listByIds(assetTypeIdArrayList);
if (!videoContentCatList.isEmpty()) {
final List<String> assetTypeNameList = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.toList());
copyrightOwner.setAssetTypeNameList(assetTypeNameList);
}
}
......
......@@ -3,17 +3,13 @@ package cn.wisenergy.chnmuseum.party.web.controller;
import cn.wisenergy.chnmuseum.party.common.enums.AuditOperationEnum;
import cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum;
import cn.wisenergy.chnmuseum.party.common.enums.AuditTypeEnum;
import cn.wisenergy.chnmuseum.party.common.enums.FileCatEnum;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.AudioVo;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.common.vo.VideoVo;
import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.Feature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -51,7 +47,9 @@ public class LearningContentController extends BaseController {
@Resource
private ExhibitionBoardCatService exhibitionBoardCatService;
@Resource
private AssetTypeService assetTypeService;
private VideoContentCatService videoContentCatService;
@Resource
private VideoContentService videoContentService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
@Resource
......@@ -334,30 +332,32 @@ public class LearningContentController extends BaseController {
if (boardCopyrightOwnerId != null) {
exhibitionBoard.setBoardCopyrightOwnerName(this.copyrightOwnerService.getById(boardCopyrightOwnerId).getName());
}
if (exhibitionBoard.getVideoContentCopyrightOwnerId() != null) {
String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName();
exhibitionBoard.setVideoContentCopyrightOwnerName(name);
}
LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
final List<Asset> audioList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setAudioList(audioList);
assetQueryWrapper.clear();
assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
final List<Asset> datumList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setDatumList(datumList);
String videoContentId = exhibitionBoard.getVideoContentId();
if (videoContentId != null) {
final VideoContent videoContent = this.videoContentService.getById(videoContentId);
exhibitionBoard.setVideoContentName(videoContent.getName());
final String guideAudioUrl = exhibitionBoard.getGuideAudioUrl();
final List<AudioVo> audioVoList = JSONObject.parseObject(guideAudioUrl, new TypeReference<List<AudioVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setAudioUrlList(audioVoList.stream().map(AudioVo::getFileUrl).collect(Collectors.toList()));
final String refMaterialUrl = exhibitionBoard.getRefMaterialUrl();
final List<AudioVo> refMaterialVoList = JSONObject.parseObject(refMaterialUrl, new TypeReference<List<AudioVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setMaterialUrlList(refMaterialVoList.stream().map(AudioVo::getFileUrl).collect(Collectors.toList()));
String assetId = exhibitionBoard.getAssetId();
if (assetId != null) {
final Asset asset = this.assetService.getById(assetId);
exhibitionBoard.setAssetName(this.assetService.getById(assetId).getName());
final String assetCopyrightOwnerId = asset.getAssetCopyrightOwnerId();
final String assetCopyrightOwnerName = this.copyrightOwnerService.getById(assetCopyrightOwnerId).getName();
exhibitionBoard.setAssetCopyrightOwnerName(assetCopyrightOwnerName);
final String videoUrl = asset.getVideoUrl();
final List<VideoVo> videoVoList = JSONObject.parseObject(videoUrl, new TypeReference<List<VideoVo>>() {
}, Feature.OrderedField);
exhibitionBoard.setVideoUrl(videoUrl);
exhibitionBoard.setVideoUrlList(videoVoList.stream().map(VideoVo::getFileUrl).collect(Collectors.toList()));
assetQueryWrapper.clear();
assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContentId);
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.VIDEO_CONTENT.name());
final List<Asset> videoList = this.assetService.list(assetQueryWrapper);
exhibitionBoard.setVideoList(videoList);
}
}
learningContent.setExhibitionBoardList(exhibitionBoardList);
......
......@@ -2,12 +2,12 @@ package cn.wisenergy.chnmuseum.party.web.controller;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.Asset;
import cn.wisenergy.chnmuseum.party.model.AssetType;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwner;
import cn.wisenergy.chnmuseum.party.service.AssetService;
import cn.wisenergy.chnmuseum.party.service.AssetTypeService;
import cn.wisenergy.chnmuseum.party.model.VideoContent;
import cn.wisenergy.chnmuseum.party.model.VideoContentCat;
import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerService;
import cn.wisenergy.chnmuseum.party.service.VideoContentCatService;
import cn.wisenergy.chnmuseum.party.service.VideoContentService;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -30,7 +30,7 @@ import java.util.stream.Collectors;
/**
* <pre>
* 视频分类 前端控制器
* 视频内容分类 前端控制器
* </pre>
*
* @author Danny Lee
......@@ -38,25 +38,25 @@ import java.util.stream.Collectors;
*/
@Slf4j
@RestController
@RequestMapping("/assetType")
@Api(tags = {"视频分类接口"})
public class AssetTypeController extends BaseController {
@RequestMapping("/videoContentCat")
@Api(tags = {"视频内容分类接口"})
public class VideoContentCatController extends BaseController {
@Resource
private AssetTypeService assetTypeService;
private VideoContentCatService videoContentCatService;
@Resource
private AssetService assetService;
private VideoContentService videoContentService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
@PostMapping(value = "/save")
@RequiresPermissions("asset:type:save")
@ApiOperation(value = "添加视频分类", notes = "添加视频分类")
public Map<String, Object> saveAssetType(@Validated(value = {Add.class}) AssetType assetType) {
@RequiresPermissions("video:content:cat:save")
@ApiOperation(value = "添加视频内容分类", notes = "添加视频内容分类")
public Map<String, Object> saveVideoContentCat(@Validated(value = {Add.class}) VideoContentCat videoContentCat) {
// 保存业务节点信息
boolean result = assetTypeService.save(assetType);
boolean result = videoContentCatService.save(videoContentCat);
// 返回操作结果
if (result) {
return getSuccessResult();
......@@ -67,31 +67,21 @@ public class AssetTypeController extends BaseController {
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改视频分类信息", notes = "修改视频分类信息")
public Map<String, Object> updateAssetType(@Validated AssetType assetType) {
boolean flag = assetTypeService.updateById(assetType);
@ApiOperation(value = "修改视频内容分类信息", notes = "修改视频内容分类信息")
public Map<String, Object> updateVideoContentCat(@Validated VideoContentCat videoContentCat) {
boolean flag = videoContentCatService.updateById(videoContentCat);
if (flag) {
return getSuccessResult();
}
return getFailResult();
}
@DeleteMapping(value = "/delete/{id}")
@RequiresPermissions("asset:type:delete")
@ApiOperation(value = "根据ID删除视频分类", notes = "根据ID删除视频分类")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "id", value = "标识ID", paramType = "path", dataType = "String")
})
public Map<String, Object> deleteAssetType(@PathVariable("id") String id) {
return getSuccessResult();
}
@GetMapping("/getList")
@RequiresPermissions("asset:type:list")
@ApiOperation(value = "获取视频分类全部列表(无分页)", notes = "获取视频分类全部列表(无分页)")
public Map<String, Object> getAssetTypeList() {
List<AssetType> assetTypeList = assetTypeService.list();
return getResult(assetTypeList);
@RequiresPermissions("video:content:cat:list")
@ApiOperation(value = "获取视频内容分类全部列表(无分页)", notes = "获取视频内容分类全部列表(无分页)")
public Map<String, Object> getVideoContentCatList() {
List<VideoContentCat> videoContentCatList = videoContentCatService.list();
return getResult(videoContentCatList);
}
@ApiImplicitParams(value = {
......@@ -102,51 +92,51 @@ public class AssetTypeController extends BaseController {
@ApiImplicitParam(name = "endDate", value = "创建时间-结束", paramType = "query", dataType = "String")
})
@PostMapping("/getPageList")
@RequiresPermissions("asset:type:page")
@ApiOperation(value = "获取视频分类分页列表", notes = "获取视频分类分页列表")
public Map<String, Object> getAssetTypePageList(GenericPageParam genericPageParam) {
LambdaQueryWrapper<AssetType> queryWrapper = new LambdaQueryWrapper<>();
@RequiresPermissions("video:content:cat:page")
@ApiOperation(value = "获取视频内容分类分页列表", notes = "获取视频内容分类分页列表")
public Map<String, Object> getVideoContentCatPageList(GenericPageParam genericPageParam) {
LambdaQueryWrapper<VideoContentCat> queryWrapper = new LambdaQueryWrapper<>();
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(genericPageParam.getNameOrCode())) {
queryWrapper.like(AssetType::getName, genericPageParam.getNameOrCode());
queryWrapper.like(VideoContentCat::getName, genericPageParam.getNameOrCode());
}
// 根据创建时间区间检索
if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
queryWrapper.ge(AssetType::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0))
.le(AssetType::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59));
queryWrapper.ge(VideoContentCat::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0))
.le(VideoContentCat::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59));
}
// 设置排序规则
queryWrapper.orderByDesc(AssetType::getCreateTime);
queryWrapper.orderByDesc(VideoContentCat::getCreateTime);
// 设置查询内容
queryWrapper.select(
AssetType::getId,
AssetType::getName,
AssetType::getCreateTime,
AssetType::getUpdateTime);
Page<AssetType> page = this.assetTypeService.page(getPage(), queryWrapper);
for (AssetType assetType : page.getRecords()) {
LambdaQueryWrapper<Asset> lambdaQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getAssetTypeId, assetType.getId());
lambdaQueryWrapper = lambdaQueryWrapper.select(Asset::getId).select(Asset::getAssetCopyrightOwnerId);
List<Asset> assetList = this.assetService.list(lambdaQueryWrapper);
if (!assetList.isEmpty()) {
final Set<String> assetCopyrightOwnerIdList = assetList.stream().map(Asset::getAssetCopyrightOwnerId).collect(Collectors.toSet());
VideoContentCat::getId,
VideoContentCat::getName,
VideoContentCat::getCreateTime,
VideoContentCat::getUpdateTime);
Page<VideoContentCat> page = this.videoContentCatService.page(getPage(), queryWrapper);
for (VideoContentCat videoContentCat : page.getRecords()) {
LambdaQueryWrapper<VideoContent> lambdaQueryWrapper = Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getVideoContentCatId, videoContentCat.getId());
lambdaQueryWrapper = lambdaQueryWrapper.select(VideoContent::getId).select(VideoContent::getVideoContentCopyrightOwnerId);
List<VideoContent> videoContentList = this.videoContentService.list(lambdaQueryWrapper);
if (!videoContentList.isEmpty()) {
final Set<String> assetCopyrightOwnerIdList = videoContentList.stream().map(VideoContent::getVideoContentCopyrightOwnerId).collect(Collectors.toSet());
List<CopyrightOwner> copyrightOwnerList = this.copyrightOwnerService.listByIds(assetCopyrightOwnerIdList);
String copyrightOwnerName = copyrightOwnerList.stream().map(CopyrightOwner::getName).collect(Collectors.joining("、"));
assetType.setCopyrightOwnerName(copyrightOwnerName);
videoContentCat.setCopyrightOwnerName(copyrightOwnerName);
}
}
return getResult(page);
}
@ApiOperation(value = "获取视频分类详情", notes = "获取视频分类详情")
@ApiOperation(value = "获取视频内容分类详情", notes = "获取视频内容分类详情")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path")
})
@GetMapping("/get/{id}")
@RequiresPermissions("asset:type:get:id")
@RequiresPermissions("video:content:cat:get:id")
public Map<String, Object> getById(@PathVariable("id") String id) {
AssetType assetType = assetTypeService.getById(id);
return getResult(assetType);
VideoContentCat videoContentCat = videoContentCatService.getById(id);
return getResult(videoContentCat);
}
}
......
......@@ -3,23 +3,26 @@
<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.AssetMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.Asset">
<id column="id" property="id" />
<result column="name" property="name" />
<result column="thumbnail" property="thumbnail" />
<result column="asset_type_id" property="assetTypeId" />
<result column="asset_copyright_owner_id" property="assetCopyrightOwnerId" />
<result column="video_url" property="videoUrl" />
<result column="audit_status" property="auditStatus" />
<result column="is_published" property="isPublished" />
<result column="is_deleted" property="isDeleted" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.VideoContent">
<id column="id" property="id"/>
<result column="ref_item_id" property="refItemId"/>
<result column="file_name" property="fileName"/>
<result column="file_ext_name" property="fileExtName"/>
<result column="file_type" property="fileType"/>
<result column="file_size" property="fileSize"/>
<result column="file_cat" property="fileCat"/>
<result column="file_url" property="fileUrl"/>
<result column="thumbnail" property="thumbnail"/>
<result column="language" property="language"/>
<result column="md5" property="md5"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, name, thumbnail, asset_type_id, asset_copyright_owner_id, video_url, audit_status, is_published, is_deleted, create_time, update_time
id, ref_item_id, file_name, file_ext_name, file_type, file_size, file_cat, file_url, thumbnail, language, md5,
create_time, update_time
</sql>
</mapper>
......@@ -54,7 +54,7 @@
a.*,b.`name`,c.user_name AS userName
FROM
t_audit a
LEFT JOIN asset b ON a.ref_item_id = b.id
LEFT JOIN videoContent b ON a.ref_item_id = b.id
LEFT JOIN t_user c ON a.user_id = c.id
${ew.customSqlSegment}
</select>
......
......@@ -8,13 +8,13 @@
<result column="board_id" property="boardId" />
<result column="real_name" property="realName" />
<result column="comment" property="comment" />
<result column="asset" property="asset" />
<result column="videoContent" property="videoContent" />
<result column="create_time" property="createTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, board_id, real_name, comment, asset, create_time
id, board_id, real_name, comment, videoContent, create_time
</sql>
</mapper>
......@@ -4,29 +4,29 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.ExhibitionBoard">
<id column="id" property="id" />
<result column="name" property="name" />
<result column="board_copyright_owner_id" property="boardCopyrightOwnerId" />
<result column="exhibition_board_cat_id" property="exhibitionBoardCatId" />
<result column="cover" property="cover" />
<result column="qrcode_url" property="qrcodeUrl" />
<result column="remarks" property="remarks" />
<result column="asset_copyright_owner_id" property="assetCopyrightOwnerId" />
<result column="asset_type_id" property="assetTypeId" />
<result column="asset_id" property="assetId" />
<result column="guide_audio_url" property="guideAudioUrl" />
<result column="ref_material_dir" property="refMaterialDir" />
<result column="ref_material_url" property="refMaterialUrl" />
<result column="audit_status" property="auditStatus" />
<result column="is_published" property="isPublished" />
<result column="is_deleted" property="isDeleted" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="board_copyright_owner_id" property="boardCopyrightOwnerId"/>
<result column="exhibition_board_cat_id" property="exhibitionBoardCatId"/>
<result column="cover" property="cover"/>
<result column="qrcode_url" property="qrcodeUrl"/>
<result column="remarks" property="remarks"/>
<result column="video_content_copyright_owner_id" property="videoContentCopyrightOwnerId"/>
<result column="video_content_cat_id" property="videoContentCatId"/>
<result column="video_content_id" property="videoContentId"/>
<result column="ref_material_dir" property="refMaterialDir"/>
<result column="audit_status" property="auditStatus"/>
<result column="is_published" property="isPublished"/>
<result column="is_deleted" property="isDeleted"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, name, board_copyright_owner_id, exhibition_board_cat_id, cover, qrcode_url, remarks, asset_copyright_owner_id, asset_type_id, asset_id, guide_audio_url, ref_material_dir, ref_material_url, audit_status, is_published, is_deleted, create_time, update_time
id, name, board_copyright_owner_id, exhibition_board_cat_id, cover, qrcode_url, remarks,
video_content_copyright_owner_id, video_content_cat_id, video_content_id, ref_material_dir,
audit_status, is_published, is_deleted, create_time, update_time
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.AssetTypeMapper">
<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.VideoContentCatMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.AssetType">
<id column="id" property="id" />
<result column="name" property="name" />
<result column="remarks" property="remarks" />
<result column="copyright_owner_id" property="copyrightOwnerId" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.VideoContentCat">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="remarks" property="remarks"/>
<result column="copyright_owner_id" property="copyrightOwnerId"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 通用查询结果列 -->
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.VideoContentMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.VideoContent">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="video_content_copyright_owner_id" property="videoContentCopyrightOwnerId"/>
<result column="video_content_cat_id" property="videoContentCatId"/>
<result column="thumbnail" property="thumbnail"/>
<result column="audit_status" property="auditStatus"/>
<result column="is_published" property="published"/>
<result column="is_deleted" property="deleted"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, name, video_content_copyright_owner_id, video_content_cat_id, thumbnail, audit_status, is_published, is_deleted, create_time, update_time
</sql>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment