Commit 32c7bdbd authored by liqin's avatar liqin 💬

bug fixed

parent 375c4109
......@@ -60,7 +60,9 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
+ "and a.file_type = 'VIDEO' "
+ "and lc.applicable_scope = 'THIS_ORGAN' "
+ "and lc.organ_code = #{organCode} "
+ "UNION "
+ "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover "
+ "FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a "
+ "WHERE lcb.learning_content_id = lc.id "
......@@ -81,7 +83,9 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
+ "and a.file_type = 'VIDEO' "
+ "and lc.applicable_scope = 'THIS_ORGAN_SUB' "
+ "and lc.organ_code = #{organCode} "
+ "UNION "
+ "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a "
+ "WHERE lcb.learning_content_id = lc.id "
+ "and lcb.exhibition_board_id = eb.id "
......
......@@ -10,6 +10,7 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -46,6 +47,8 @@ public class ExhibitionBoardController extends BaseController {
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private ExhibitionBoardTmpService exhibitionBoardTmpService;
@Resource
private ExhibitionBoardCatService exhibitionBoardCatService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
......@@ -114,54 +117,11 @@ public class ExhibitionBoardController extends BaseController {
@ApiOperation(value = "修改展板信息", notes = "修改展板信息")
@MethodLog(operModule = OperModule.DISPLAYCONTENT, operType = OperType.UPDATE)
public Map<String, Object> updateExhibitionBoard(@Validated(value = {Update.class}) ExhibitionBoard exhibitionBoard) {
TUser user = getcurUser();
final VideoContent videoContent = this.videoContentService.getById(exhibitionBoard.getVideoContentId());
exhibitionBoard.setVideoContentName(videoContent.getName());
exhibitionBoard.setAuditStatus(AuditStatusEnum.TBC.name());
exhibitionBoard.setPublished(false);
boolean flag = exhibitionBoardService.updateById(exhibitionBoard);
final boolean flag = this.exhibitionBoardTmpService.save(ExhibitionBoardTmp.builder().id(exhibitionBoard.getId()).data(JSONObject.toJSONString(exhibitionBoard)).build());
if (flag) {
final List<String> audioIdList = exhibitionBoard.getAudioIdList();
if (audioIdList != null && !audioIdList.isEmpty()) {
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
final List<Asset> assetList = this.assetService.list(assetQueryWrapper);
final Map<String, String> collect = assetList.stream().collect(Collectors.toMap(Asset::getId, Asset::getFileUrl));
for (String audioId : audioIdList) {
final Asset asset = this.assetService.getById(audioId);
asset.setFileType(FileTypeEnum.AUDIO.name());
asset.setFileCat(FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
asset.setRefItemId(exhibitionBoard.getId());
this.assetService.updateById(asset);
collect.remove(audioId);
}
collect.forEach((k, v) -> this.assetService.removeById(k));
}
final List<String> datumIdList = exhibitionBoard.getDatumIdList();
if (datumIdList != null && !datumIdList.isEmpty()) {
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
final List<Asset> assetList = this.assetService.list(assetQueryWrapper);
final Map<String, String> collect = assetList.stream().collect(Collectors.toMap(Asset::getId, Asset::getFileUrl));
for (String datumId : datumIdList) {
final Asset asset = this.assetService.getById(datumId);
asset.setFileCat(FileCatEnum.EXHIBITION_BOARD_DATUM.name());
asset.setRefItemId(exhibitionBoard.getId());
this.assetService.updateById(asset);
collect.remove(datumId);
}
collect.forEach((k, v) -> this.assetService.removeById(k));
}
TUser user = getcurUser();
exhibitionBoard.setAuditStatus(AuditStatusEnum.TBC.name());
exhibitionBoardService.updateById(exhibitionBoard);
final Audit audit = Audit.builder()
.content(exhibitionBoard.getName())
.refItemId(exhibitionBoard.getId())
......
......@@ -72,8 +72,10 @@ public class FileUploadController extends BaseController {
final Asset asset = assetService.getById(id);
if (asset != null) {
final String fileUrl = asset.getFileUrl();
final String fileUrlCrypto = asset.getFileUrlCrypto();
try {
FastDFSUtils.deleteFile(fileUrl);
FastDFSUtils.deleteFile(fileUrlCrypto);
} catch (FdfsServerException e) {
this.assetService.removeById(id);
return getResult("文件被已删除");
......@@ -422,9 +424,6 @@ public class FileUploadController extends BaseController {
if (!matchChinese) {
return getFailResult("文件必须包含汉语视频");
}
if (files.length > 5) {
return getFailResult("一种语言只能对应一个文件,只能上传包含5种语言的视频");
}
String videoContentName = null;
String text;
LCSUtil strie = null;
......@@ -559,7 +558,9 @@ public class FileUploadController extends BaseController {
.build();
if (one != null) {
FastDFSUtils.deleteFile(fileUrl);
FastDFSUtils.deleteFile(fileUrlCrypto);
asset.setFileUrl(one.getFileUrl());
asset.setFileUrlCrypto(one.getFileUrl());
}
this.assetService.save(asset);
fileList.add(asset);
......
......@@ -150,7 +150,6 @@ public class LearningContentController extends BaseController {
public Map<String, Object> updateLearningContent(@Validated(value = {Update.class}) LearningContent learningContent) {
TUser user = getcurUser();
learningContent.setAuditStatus(AuditStatusEnum.TBC.name());
learningContent.setPublished(false);
// 保存业务节点信息
final String learningContentId = learningContent.getId();
......
......@@ -10,6 +10,7 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -47,6 +48,8 @@ public class VideoContentController extends BaseController {
@Resource
private VideoContentService videoContentService;
@Resource
private VideoContentTmpService videoContentTmpService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
@Resource
private VideoContentCatService videoContentCatService;
......@@ -107,35 +110,11 @@ public class VideoContentController extends BaseController {
@ApiOperation(value = "修改视频内容信息", notes = "修改视频内容信息")
@MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.UPDATE)
public Map<String, Object> updateVideoContent(@Validated(value = {Update.class}) VideoContent videoContent) {
TUser user = getcurUser();
videoContent.setAuditStatus(AuditStatusEnum.TBC.name());
videoContent.setPublished(false);
videoContent.setDeleted(false);
boolean flag = videoContentService.updateById(videoContent);
final boolean flag = this.videoContentTmpService.save(VideoContentTmp.builder().id(videoContent.getId()).data(JSONObject.toJSONString(videoContent)).build());
if (flag) {
final List<String> videoFileIdList = videoContent.getVideoFileIdList();
if (videoFileIdList != null && !videoFileIdList.isEmpty()) {
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContent.getId());
final List<Asset> assetList = this.assetService.list(assetQueryWrapper);
final Map<String, String> collect = assetList.stream().collect(Collectors.toMap(Asset::getId, Asset::getFileUrl));
for (String videoFileId : videoFileIdList) {
final Asset asset = this.assetService.getById(videoFileId);
asset.setThumbnail(videoContent.getThumbnail());
asset.setFileType(FileTypeEnum.VIDEO.name());
asset.setFileCat(FileCatEnum.VIDEO_CONTENT.name());
asset.setRefItemId(videoContent.getId());
this.assetService.updateById(asset);
if (StringUtils.isBlank(videoContent.getName())) {
videoContent.setName(asset.getVideoContentName());
this.videoContentService.updateById(videoContent);
}
collect.remove(videoFileId);
}
collect.forEach((k, v) -> this.assetService.removeById(k));
}
TUser user = getcurUser();
videoContent.setAuditStatus(AuditStatusEnum.TBC.name());
videoContentService.updateById(videoContent);
final Audit audit = Audit.builder()
.content(videoContent.getName())
.userId(user.getId())
......@@ -147,7 +126,6 @@ public class VideoContentController extends BaseController {
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
return getSuccessResult();
}
return getFailResult();
......
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