Commit 32c7bdbd authored by liqin's avatar liqin 💬

bug fixed

parent 375c4109
...@@ -60,7 +60,9 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo ...@@ -60,7 +60,9 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
+ "and a.file_type = 'VIDEO' " + "and a.file_type = 'VIDEO' "
+ "and lc.applicable_scope = 'THIS_ORGAN' " + "and lc.applicable_scope = 'THIS_ORGAN' "
+ "and lc.organ_code = #{organCode} " + "and lc.organ_code = #{organCode} "
+ "UNION " + "UNION "
+ "SELECT a.*, eb.id exhibition_board_id, eb.name exhibition_board_name, eb.cover exhibition_board_cover " + "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 " + "FROM learning_content_board lcb, learning_content lc, exhibition_board eb, video_content vc, asset a "
+ "WHERE lcb.learning_content_id = lc.id " + "WHERE lcb.learning_content_id = lc.id "
...@@ -81,7 +83,9 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo ...@@ -81,7 +83,9 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
+ "and a.file_type = 'VIDEO' " + "and a.file_type = 'VIDEO' "
+ "and lc.applicable_scope = 'THIS_ORGAN_SUB' " + "and lc.applicable_scope = 'THIS_ORGAN_SUB' "
+ "and lc.organ_code = #{organCode} " + "and lc.organ_code = #{organCode} "
+ "UNION " + "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 " + "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 " + "WHERE lcb.learning_content_id = lc.id "
+ "and lcb.exhibition_board_id = eb.id " + "and lcb.exhibition_board_id = eb.id "
......
package cn.wisenergy.chnmuseum.party.service.impl; package cn.wisenergy.chnmuseum.party.service.impl;
import cn.wisenergy.chnmuseum.party.common.enums.AuditOperationEnum; import cn.wisenergy.chnmuseum.party.common.enums.*;
import cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum;
import cn.wisenergy.chnmuseum.party.common.enums.AuditTypeEnum;
import cn.wisenergy.chnmuseum.party.common.mvc.InterfaceException; import cn.wisenergy.chnmuseum.party.common.mvc.InterfaceException;
import cn.wisenergy.chnmuseum.party.mapper.AuditMapper; import cn.wisenergy.chnmuseum.party.mapper.AuditMapper;
import cn.wisenergy.chnmuseum.party.model.*; import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*; import cn.wisenergy.chnmuseum.party.service.*;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service; ...@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* <pre> * <pre>
...@@ -34,6 +36,9 @@ import java.util.List; ...@@ -34,6 +36,9 @@ import java.util.List;
@Service @Service
public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements AuditService { public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements AuditService {
@Resource
private AssetService assetService;
@Resource @Resource
private AuditMapper auditMapper; private AuditMapper auditMapper;
...@@ -43,15 +48,30 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -43,15 +48,30 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
@Resource @Resource
private VideoContentService videoContentService; private VideoContentService videoContentService;
@Resource
private VideoContentTmpService videoContentTmpService;
@Resource @Resource
private ExhibitionBoardService exhibitionBoardService; private ExhibitionBoardService exhibitionBoardService;
@Resource
private ExhibitionBoardTmpService exhibitionBoardTmpService;
@Resource @Resource
private LearningContentService learningContentService; private LearningContentService learningContentService;
@Resource
private LearningContentTmpService learningContentTmpService;
@Resource @Resource
private LearningContentBoardService learningContentBoardService; private LearningContentBoardService learningContentBoardService;
@Resource
private LearningContentBoardCatService learningContentBoardCatService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Override @Override
public Page<Audit> getUserList(Page<Audit> page, TUser user) { public Page<Audit> getUserList(Page<Audit> page, TUser user) {
return page.setRecords(auditMapper.getUserList(page, user)); return page.setRecords(auditMapper.getUserList(page, user));
...@@ -240,8 +260,9 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -240,8 +260,9 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
* @return * @return
*/ */
public boolean fillVideoContentByAudit(Audit audit) { public boolean fillVideoContentByAudit(Audit audit) {
final String videoContentId = audit.getRefItemId();
VideoContent videoContent = new VideoContent(); VideoContent videoContent = new VideoContent();
videoContent.setId(audit.getRefItemId()); videoContent.setId(videoContentId);
videoContent.setAuditStatus(audit.getStatus()); videoContent.setAuditStatus(audit.getStatus());
//当审核级别为复审,审核状态为通过是,会修改审核项其它表中的 发布与删除字段,不是此情况下是直接修改审核状态 //当审核级别为复审,审核状态为通过是,会修改审核项其它表中的 发布与删除字段,不是此情况下是直接修改审核状态
boolean continueFill = AuditStatusEnum.APPROVED_FINAL.name().equals(audit.getStatus()) && AuditStatusEnum.TBCA.name().equals(audit.getLevel()); boolean continueFill = AuditStatusEnum.APPROVED_FINAL.name().equals(audit.getStatus()) && AuditStatusEnum.TBCA.name().equals(audit.getLevel());
...@@ -269,11 +290,33 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -269,11 +290,33 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
break; break;
case ADD: case ADD:
videoContent.setPublished(true); videoContent.setPublished(true);
update = this.videoContentService.updateById(videoContent);; update = this.videoContentService.updateById(videoContent);
break; break;
case EDIT: case EDIT:
videoContent.setPublished(true); final String data = this.videoContentTmpService.getById(videoContentId).getData();
update = this.videoContentService.updateById(videoContent);; final VideoContent one = JSONObject.parseObject(data, VideoContent.class);
final List<String> videoFileIdList = one.getVideoFileIdList();
if (videoFileIdList != null && !videoFileIdList.isEmpty()) {
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContentId);
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(videoContentId);
this.assetService.updateById(asset);
if (StringUtils.isBlank(one.getName())) {
videoContent.setName(asset.getVideoContentName());
}
collect.remove(videoFileId);
}
collect.forEach((k, v) -> this.assetService.removeById(k));
}
one.setAuditStatus(audit.getStatus());
one.setPublished(true); //todo
update = this.videoContentService.updateById(one);
break; break;
default: default:
} }
...@@ -287,8 +330,9 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -287,8 +330,9 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
* @return * @return
*/ */
public boolean fillExhibitionBoardByAudit(Audit audit) { public boolean fillExhibitionBoardByAudit(Audit audit) {
final String exhibitionBoardId = audit.getRefItemId();
ExhibitionBoard exhibitionBoard = new ExhibitionBoard(); ExhibitionBoard exhibitionBoard = new ExhibitionBoard();
exhibitionBoard.setId(audit.getRefItemId()); exhibitionBoard.setId(exhibitionBoardId);
exhibitionBoard.setAuditStatus(audit.getStatus()); exhibitionBoard.setAuditStatus(audit.getStatus());
//当审核级别为复审,审核状态为通过是,会修改审核项其它表中的 发布与删除字段,不是此情况下是直接修改审核状态 //当审核级别为复审,审核状态为通过是,会修改审核项其它表中的 发布与删除字段,不是此情况下是直接修改审核状态
boolean continueFill = AuditStatusEnum.APPROVED_FINAL.name().equals(audit.getStatus()) && AuditStatusEnum.TBCA.name().equals(audit.getLevel()); boolean continueFill = AuditStatusEnum.APPROVED_FINAL.name().equals(audit.getStatus()) && AuditStatusEnum.TBCA.name().equals(audit.getLevel());
...@@ -313,11 +357,45 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -313,11 +357,45 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
break; break;
case ADD: case ADD:
exhibitionBoard.setPublished(true); exhibitionBoard.setPublished(true);
update = this.exhibitionBoardService.updateById(exhibitionBoard);; update = this.exhibitionBoardService.updateById(exhibitionBoard);
break; break;
case EDIT: case EDIT:
exhibitionBoard.setPublished(true); final String data = this.exhibitionBoardTmpService.getById(exhibitionBoardId).getData();
update = this.exhibitionBoardService.updateById(exhibitionBoard);; final ExhibitionBoard one = JSONObject.parseObject(data, ExhibitionBoard.class);
final List<String> audioIdList = one.getAudioIdList();
if (audioIdList != null && !audioIdList.isEmpty()) {
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoardId);
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(exhibitionBoardId);
this.assetService.updateById(asset);
collect.remove(audioId);
}
collect.forEach((k, v) -> this.assetService.removeById(k));
}
final List<String> datumIdList = one.getDatumIdList();
if (datumIdList != null && !datumIdList.isEmpty()) {
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoardId);
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(exhibitionBoardId);
this.assetService.updateById(asset);
collect.remove(datumId);
}
collect.forEach((k, v) -> this.assetService.removeById(k));
}
one.setAuditStatus(audit.getStatus());
one.setPublished(true); //todo
update = this.exhibitionBoardService.updateById(one);
break; break;
default: default:
} }
...@@ -331,9 +409,10 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -331,9 +409,10 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
* @return * @return
*/ */
public boolean fillLearningContentByAudit(Audit audit) { public boolean fillLearningContentByAudit(Audit audit) {
final String learningContentId = audit.getRefItemId();
LearningContent learningContent = new LearningContent(); LearningContent learningContent = new LearningContent();
learningContent.setAuditStatus(audit.getStatus()); learningContent.setAuditStatus(audit.getStatus());
learningContent.setId(audit.getRefItemId()); learningContent.setId(learningContentId);
//当审核级别为复审,审核状态为通过是,会修改审核项其它表中的 发布与删除字段,不是此情况下是直接修改审核状态 //当审核级别为复审,审核状态为通过是,会修改审核项其它表中的 发布与删除字段,不是此情况下是直接修改审核状态
boolean continueFill = AuditStatusEnum.APPROVED_FINAL.name().equals(audit.getStatus()) && AuditStatusEnum.TBCA.name().equals(audit.getLevel()); boolean continueFill = AuditStatusEnum.APPROVED_FINAL.name().equals(audit.getStatus()) && AuditStatusEnum.TBCA.name().equals(audit.getLevel());
if (!continueFill) { if (!continueFill) {
...@@ -359,8 +438,45 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -359,8 +438,45 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
update = this.learningContentService.updateById(learningContent); update = this.learningContentService.updateById(learningContent);
break; break;
case EDIT: case EDIT:
learningContent.setPublished(true); final String data = this.learningContentTmpService.getById(learningContentId).getData();
update = this.learningContentService.updateById(learningContent); final LearningContent one = JSONObject.parseObject(data, LearningContent.class);
final List<String> exhibitionBoardCatIdList = one.getExhibitionBoardCatIdList();
if (exhibitionBoardCatIdList != null && !exhibitionBoardCatIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentBoardCat> lambdaUpdateWrapper = Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, learningContentId);
this.learningContentBoardCatService.remove(lambdaUpdateWrapper);
for (String exhibitionBoardCatId : exhibitionBoardCatIdList) {
LearningContentBoardCat learningContentBoardCat = LearningContentBoardCat.builder().exhibitionBoardCatId(exhibitionBoardCatId).learningContentId(learningContentId).build();
this.learningContentBoardCatService.save(learningContentBoardCat);
}
}
final List<String> copyrightOwnerIdList = learningContent.getCopyrightOwnerIdList();
if (copyrightOwnerIdList != null && !copyrightOwnerIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentCopyrightOwner> lambdaUpdateWrapper = Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, learningContentId);
this.learningContentCopyrightOwnerService.remove(lambdaUpdateWrapper);
for (String copyrightOwnerId : copyrightOwnerIdList) {
LearningContentCopyrightOwner contentCopyrightOwner = LearningContentCopyrightOwner.builder().copyrightOwnerId(copyrightOwnerId).learningContentId(learningContentId).build();
this.learningContentCopyrightOwnerService.save(contentCopyrightOwner);
}
}
final List<String> exhibitionBoardIdList = learningContent.getExhibitionBoardIdList();
if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentBoard> lambdaUpdateWrapper = Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, learningContentId);
this.learningContentBoardService.remove(lambdaUpdateWrapper);
for (String exhibitionBoardId : exhibitionBoardIdList) {
LearningContentBoard learningContentBoard = LearningContentBoard.builder()
.learningContentId(learningContentId)
.exhibitionBoardCatId(this.exhibitionBoardService.getById(exhibitionBoardId).getExhibitionBoardCatId())
.exhibitionBoardId(exhibitionBoardId)
.build();
this.learningContentBoardService.save(learningContentBoard);
}
}
one.setAuditStatus(audit.getStatus());
one.setPublished(true); //todo
update = this.learningContentService.updateById(one);
break; break;
default: default:
} }
......
...@@ -10,6 +10,7 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam; ...@@ -10,6 +10,7 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.*; import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*; import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -46,6 +47,8 @@ public class ExhibitionBoardController extends BaseController { ...@@ -46,6 +47,8 @@ public class ExhibitionBoardController extends BaseController {
@Resource @Resource
private ExhibitionBoardService exhibitionBoardService; private ExhibitionBoardService exhibitionBoardService;
@Resource @Resource
private ExhibitionBoardTmpService exhibitionBoardTmpService;
@Resource
private ExhibitionBoardCatService exhibitionBoardCatService; private ExhibitionBoardCatService exhibitionBoardCatService;
@Resource @Resource
private CopyrightOwnerService copyrightOwnerService; private CopyrightOwnerService copyrightOwnerService;
...@@ -114,54 +117,11 @@ public class ExhibitionBoardController extends BaseController { ...@@ -114,54 +117,11 @@ public class ExhibitionBoardController extends BaseController {
@ApiOperation(value = "修改展板信息", notes = "修改展板信息") @ApiOperation(value = "修改展板信息", notes = "修改展板信息")
@MethodLog(operModule = OperModule.DISPLAYCONTENT, operType = OperType.UPDATE) @MethodLog(operModule = OperModule.DISPLAYCONTENT, operType = OperType.UPDATE)
public Map<String, Object> updateExhibitionBoard(@Validated(value = {Update.class}) ExhibitionBoard exhibitionBoard) { public Map<String, Object> updateExhibitionBoard(@Validated(value = {Update.class}) ExhibitionBoard exhibitionBoard) {
TUser user = getcurUser(); final boolean flag = this.exhibitionBoardTmpService.save(ExhibitionBoardTmp.builder().id(exhibitionBoard.getId()).data(JSONObject.toJSONString(exhibitionBoard)).build());
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);
if (flag) { if (flag) {
final List<String> audioIdList = exhibitionBoard.getAudioIdList(); TUser user = getcurUser();
if (audioIdList != null && !audioIdList.isEmpty()) { exhibitionBoard.setAuditStatus(AuditStatusEnum.TBC.name());
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId()); exhibitionBoardService.updateById(exhibitionBoard);
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));
}
final Audit audit = Audit.builder() final Audit audit = Audit.builder()
.content(exhibitionBoard.getName()) .content(exhibitionBoard.getName())
.refItemId(exhibitionBoard.getId()) .refItemId(exhibitionBoard.getId())
......
...@@ -72,8 +72,10 @@ public class FileUploadController extends BaseController { ...@@ -72,8 +72,10 @@ public class FileUploadController extends BaseController {
final Asset asset = assetService.getById(id); final Asset asset = assetService.getById(id);
if (asset != null) { if (asset != null) {
final String fileUrl = asset.getFileUrl(); final String fileUrl = asset.getFileUrl();
final String fileUrlCrypto = asset.getFileUrlCrypto();
try { try {
FastDFSUtils.deleteFile(fileUrl); FastDFSUtils.deleteFile(fileUrl);
FastDFSUtils.deleteFile(fileUrlCrypto);
} catch (FdfsServerException e) { } catch (FdfsServerException e) {
this.assetService.removeById(id); this.assetService.removeById(id);
return getResult("文件被已删除"); return getResult("文件被已删除");
...@@ -422,9 +424,6 @@ public class FileUploadController extends BaseController { ...@@ -422,9 +424,6 @@ public class FileUploadController extends BaseController {
if (!matchChinese) { if (!matchChinese) {
return getFailResult("文件必须包含汉语视频"); return getFailResult("文件必须包含汉语视频");
} }
if (files.length > 5) {
return getFailResult("一种语言只能对应一个文件,只能上传包含5种语言的视频");
}
String videoContentName = null; String videoContentName = null;
String text; String text;
LCSUtil strie = null; LCSUtil strie = null;
...@@ -559,7 +558,9 @@ public class FileUploadController extends BaseController { ...@@ -559,7 +558,9 @@ public class FileUploadController extends BaseController {
.build(); .build();
if (one != null) { if (one != null) {
FastDFSUtils.deleteFile(fileUrl); FastDFSUtils.deleteFile(fileUrl);
FastDFSUtils.deleteFile(fileUrlCrypto);
asset.setFileUrl(one.getFileUrl()); asset.setFileUrl(one.getFileUrl());
asset.setFileUrlCrypto(one.getFileUrl());
} }
this.assetService.save(asset); this.assetService.save(asset);
fileList.add(asset); fileList.add(asset);
......
...@@ -150,7 +150,6 @@ public class LearningContentController extends BaseController { ...@@ -150,7 +150,6 @@ public class LearningContentController extends BaseController {
public Map<String, Object> updateLearningContent(@Validated(value = {Update.class}) LearningContent learningContent) { public Map<String, Object> updateLearningContent(@Validated(value = {Update.class}) LearningContent learningContent) {
TUser user = getcurUser(); TUser user = getcurUser();
learningContent.setAuditStatus(AuditStatusEnum.TBC.name()); learningContent.setAuditStatus(AuditStatusEnum.TBC.name());
learningContent.setPublished(false);
// 保存业务节点信息 // 保存业务节点信息
final String learningContentId = learningContent.getId(); final String learningContentId = learningContent.getId();
......
...@@ -10,6 +10,7 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam; ...@@ -10,6 +10,7 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.*; import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*; import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -47,6 +48,8 @@ public class VideoContentController extends BaseController { ...@@ -47,6 +48,8 @@ public class VideoContentController extends BaseController {
@Resource @Resource
private VideoContentService videoContentService; private VideoContentService videoContentService;
@Resource @Resource
private VideoContentTmpService videoContentTmpService;
@Resource
private CopyrightOwnerService copyrightOwnerService; private CopyrightOwnerService copyrightOwnerService;
@Resource @Resource
private VideoContentCatService videoContentCatService; private VideoContentCatService videoContentCatService;
...@@ -107,35 +110,11 @@ public class VideoContentController extends BaseController { ...@@ -107,35 +110,11 @@ public class VideoContentController extends BaseController {
@ApiOperation(value = "修改视频内容信息", notes = "修改视频内容信息") @ApiOperation(value = "修改视频内容信息", notes = "修改视频内容信息")
@MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.UPDATE) @MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.UPDATE)
public Map<String, Object> updateVideoContent(@Validated(value = {Update.class}) VideoContent videoContent) { public Map<String, Object> updateVideoContent(@Validated(value = {Update.class}) VideoContent videoContent) {
TUser user = getcurUser(); final boolean flag = this.videoContentTmpService.save(VideoContentTmp.builder().id(videoContent.getId()).data(JSONObject.toJSONString(videoContent)).build());
videoContent.setAuditStatus(AuditStatusEnum.TBC.name());
videoContent.setPublished(false);
videoContent.setDeleted(false);
boolean flag = videoContentService.updateById(videoContent);
if (flag) { if (flag) {
final List<String> videoFileIdList = videoContent.getVideoFileIdList(); TUser user = getcurUser();
if (videoFileIdList != null && !videoFileIdList.isEmpty()) { videoContent.setAuditStatus(AuditStatusEnum.TBC.name());
final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, videoContent.getId()); videoContentService.updateById(videoContent);
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));
}
final Audit audit = Audit.builder() final Audit audit = Audit.builder()
.content(videoContent.getName()) .content(videoContent.getName())
.userId(user.getId()) .userId(user.getId())
...@@ -147,7 +126,6 @@ public class VideoContentController extends BaseController { ...@@ -147,7 +126,6 @@ public class VideoContentController extends BaseController {
.level(AuditStatusEnum.TBC.name()) .level(AuditStatusEnum.TBC.name())
.build(); .build();
this.auditService.save(audit); this.auditService.save(audit);
return getSuccessResult(); return getSuccessResult();
} }
return getFailResult(); 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