Commit 9311c247 authored by liqin's avatar liqin 💬

bug fixed

parent 088b5daa
...@@ -71,7 +71,12 @@ public class CopyrightOwnerController extends BaseController { ...@@ -71,7 +71,12 @@ public class CopyrightOwnerController extends BaseController {
@ApiOperation(value = "添加版权方", notes = "添加版权方") @ApiOperation(value = "添加版权方", notes = "添加版权方")
@MethodLog(operModule = OperModule.DISPLAYCOPYRIGHT, operType = OperType.ADD) @MethodLog(operModule = OperModule.DISPLAYCOPYRIGHT, operType = OperType.ADD)
public Map<String, Object> saveCopyrightOwner(@Validated(value = {Add.class}) CopyrightOwner copyrightOwner) { public Map<String, Object> saveCopyrightOwner(@Validated(value = {Add.class}) CopyrightOwner copyrightOwner) {
// 保存业务节点信息 final LambdaQueryWrapper<CopyrightOwner> lambdaQueryWrapper = Wrappers.<CopyrightOwner>lambdaQuery().eq(CopyrightOwner::getName, copyrightOwner.getName().trim());
lambdaQueryWrapper.eq(CopyrightOwner::getOwnerType, copyrightOwner.getOwnerType().trim());
final int count = this.copyrightOwnerService.count(lambdaQueryWrapper);
if (count > 0) {
return getFailResult("400", "名称已存在,请修改名称");
}
boolean result = copyrightOwnerService.save(copyrightOwner); boolean result = copyrightOwnerService.save(copyrightOwner);
final List<String> videoContentCatIdList = copyrightOwner.getVideoContentCatIdList(); final List<String> videoContentCatIdList = copyrightOwner.getVideoContentCatIdList();
...@@ -112,6 +117,12 @@ public class CopyrightOwnerController extends BaseController { ...@@ -112,6 +117,12 @@ public class CopyrightOwnerController extends BaseController {
@ApiOperation(value = "修改版权方信息", notes = "修改版权方信息") @ApiOperation(value = "修改版权方信息", notes = "修改版权方信息")
@MethodLog(operModule = OperModule.DISPLAYCOPYRIGHT, operType = OperType.UPDATE) @MethodLog(operModule = OperModule.DISPLAYCOPYRIGHT, operType = OperType.UPDATE)
public Map<String, Object> updateCopyrightOwner(@Validated(value = {Update.class}) CopyrightOwner copyrightOwner) { public Map<String, Object> updateCopyrightOwner(@Validated(value = {Update.class}) CopyrightOwner copyrightOwner) {
final LambdaQueryWrapper<CopyrightOwner> lambdaQueryWrapper = Wrappers.<CopyrightOwner>lambdaQuery().eq(CopyrightOwner::getName, copyrightOwner.getName().trim());
lambdaQueryWrapper.eq(CopyrightOwner::getOwnerType, copyrightOwner.getOwnerType().trim());
final int count = this.copyrightOwnerService.count(lambdaQueryWrapper);
if (count > 0) {
return getFailResult("400", "名称已存在,请修改名称");
}
boolean flag = copyrightOwnerService.updateById(copyrightOwner); boolean flag = copyrightOwnerService.updateById(copyrightOwner);
final List<String> videoContentCatIdList = copyrightOwner.getVideoContentCatIdList(); final List<String> videoContentCatIdList = copyrightOwner.getVideoContentCatIdList();
......
...@@ -645,30 +645,20 @@ public class FileUploadController extends BaseController { ...@@ -645,30 +645,20 @@ public class FileUploadController extends BaseController {
extName = "mp4"; extName = "mp4";
originalFilename = FilenameUtils.getBaseName(originalFilename) + "." + extName; originalFilename = FilenameUtils.getBaseName(originalFilename) + "." + extName;
} }
String language = null;
final Set<MetaData> metaDataSet = new HashSet<>(); final Set<MetaData> metaDataSet = new HashSet<>();
metaDataSet.add(new MetaData("fileName", originalFilename)); metaDataSet.add(new MetaData("fileName", originalFilename));
metaDataSet.add(new MetaData("fileType", FileTypeEnum.VIDEO.name())); metaDataSet.add(new MetaData("fileType", FileTypeEnum.VIDEO.name()));
String fileUrl = FastDFSUtils.uploadFile(file.getInputStream(), file.getSize(), originalFilename, metaDataSet); final String fileUrl = FastDFSUtils.uploadFile(file.getInputStream(), file.getSize(), originalFilename, metaDataSet);
final FileInfo fileInfo = FastDFSUtils.getFileInfo(fileUrl); final FileInfo fileInfo = FastDFSUtils.getFileInfo(fileUrl);
final int crc32 = fileInfo.getCrc32();
// final Asset one = this.assetService.getOne(Wrappers.<Asset>lambdaQuery().eq(Asset::getCrc32, (long) crc32).last(" limit 1"));
final long fileSize = fileInfo.getFileSize();
final Asset asset = Asset.builder() final Asset asset = Asset.builder()
.fileName(originalFilename) .fileName(originalFilename)
.fileExtName(extName) .fileExtName(extName)
.fileType(FileTypeEnum.VIDEO.name()) .fileType(FileTypeEnum.VIDEO.name())
.fileSize(fileSize) .fileSize(fileInfo.getFileSize())
.fileUrl(fileUrl) .fileUrl(fileUrl)
.fileCat(FileCatEnum.VIEWING_INTERACTION.name()) .fileCat(FileCatEnum.VIEWING_INTERACTION.name())
.language(language) .crc32((long) fileInfo.getCrc32())
.crc32((long) crc32)
.build(); .build();
// if (one != null) {
// FastDFSUtils.deleteFile(fileUrl);
// asset.setFileUrl(one.getFileUrl());
// }
this.assetService.save(asset); this.assetService.save(asset);
fileList.add(asset); fileList.add(asset);
......
...@@ -9,7 +9,10 @@ import cn.wisenergy.chnmuseum.party.model.CopyrightOwner; ...@@ -9,7 +9,10 @@ import cn.wisenergy.chnmuseum.party.model.CopyrightOwner;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerVideoContentCat; import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerVideoContentCat;
import cn.wisenergy.chnmuseum.party.model.VideoContent; import cn.wisenergy.chnmuseum.party.model.VideoContent;
import cn.wisenergy.chnmuseum.party.model.VideoContentCat; import cn.wisenergy.chnmuseum.party.model.VideoContentCat;
import cn.wisenergy.chnmuseum.party.service.*; import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerService;
import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerVideoContentCatService;
import cn.wisenergy.chnmuseum.party.service.VideoContentCatService;
import cn.wisenergy.chnmuseum.party.service.VideoContentService;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController; import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
...@@ -27,9 +30,9 @@ import org.springframework.web.bind.annotation.*; ...@@ -27,9 +30,9 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -58,12 +61,6 @@ public class VideoContentCatController extends BaseController { ...@@ -58,12 +61,6 @@ public class VideoContentCatController extends BaseController {
@Resource @Resource
private CopyrightOwnerService copyrightOwnerService; private CopyrightOwnerService copyrightOwnerService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private CopyrightOwnerBoardCatService copyrightOwnerBoardCatService;
@PostMapping(value = "/save") @PostMapping(value = "/save")
@RequiresAuthentication //@RequiresPermissions("video:content:cat:save") @RequiresAuthentication //@RequiresPermissions("video:content:cat:save")
@ApiOperation(value = "添加视频内容分类", notes = "添加视频内容分类") @ApiOperation(value = "添加视频内容分类", notes = "添加视频内容分类")
...@@ -146,14 +143,11 @@ public class VideoContentCatController extends BaseController { ...@@ -146,14 +143,11 @@ public class VideoContentCatController extends BaseController {
VideoContentCat::getUpdateTime); VideoContentCat::getUpdateTime);
Page<VideoContentCat> page = this.videoContentCatService.page(getPage(), queryWrapper); Page<VideoContentCat> page = this.videoContentCatService.page(getPage(), queryWrapper);
for (VideoContentCat videoContentCat : page.getRecords()) { for (VideoContentCat videoContentCat : page.getRecords()) {
LambdaQueryWrapper<VideoContent> lambdaQueryWrapper = Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getVideoContentCatId, videoContentCat.getId()); LambdaQueryWrapper<VideoContent> lambdaQueryWrapper = Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getVideoContentCatId, videoContentCat.getId()).select(VideoContent::getVideoContentCopyrightOwnerId);
lambdaQueryWrapper = lambdaQueryWrapper.select(VideoContent::getId).select(VideoContent::getVideoContentCopyrightOwnerId); final List<String> videoContentCopyrightOwnerIdList = this.videoContentService.listObjs(lambdaQueryWrapper, Object::toString);
List<VideoContent> videoContentList = this.videoContentService.list(lambdaQueryWrapper); if (!videoContentCopyrightOwnerIdList.isEmpty()) {
if (!videoContentList.isEmpty()) { List<CopyrightOwner> copyrightOwnerList = this.copyrightOwnerService.listByIds(new LinkedHashSet<>(videoContentCopyrightOwnerIdList));
final Set<String> videoContentCopyrightOwnerIdList = videoContentList.stream().map(VideoContent::getVideoContentCopyrightOwnerId).collect(Collectors.toSet()); videoContentCat.setCopyrightOwnerName(copyrightOwnerList.stream().map(CopyrightOwner::getName).collect(Collectors.joining("、")));
List<CopyrightOwner> copyrightOwnerList = this.copyrightOwnerService.listByIds(videoContentCopyrightOwnerIdList);
String copyrightOwnerName = copyrightOwnerList.stream().map(CopyrightOwner::getName).collect(Collectors.joining("、"));
videoContentCat.setCopyrightOwnerName(copyrightOwnerName);
} }
} }
return getResult(page); return getResult(page);
......
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