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 "
......
package cn.wisenergy.chnmuseum.party.service.impl;
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.*;
import cn.wisenergy.chnmuseum.party.common.mvc.InterfaceException;
import cn.wisenergy.chnmuseum.party.mapper.AuditMapper;
import cn.wisenergy.chnmuseum.party.model.*;
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.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <pre>
......@@ -34,6 +36,9 @@ import java.util.List;
@Service
public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements AuditService {
@Resource
private AssetService assetService;
@Resource
private AuditMapper auditMapper;
......@@ -43,15 +48,30 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
@Resource
private VideoContentService videoContentService;
@Resource
private VideoContentTmpService videoContentTmpService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private ExhibitionBoardTmpService exhibitionBoardTmpService;
@Resource
private LearningContentService learningContentService;
@Resource
private LearningContentTmpService learningContentTmpService;
@Resource
private LearningContentBoardService learningContentBoardService;
@Resource
private LearningContentBoardCatService learningContentBoardCatService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Override
public Page<Audit> getUserList(Page<Audit> page, TUser user) {
return page.setRecords(auditMapper.getUserList(page, user));
......@@ -240,8 +260,9 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
* @return
*/
public boolean fillVideoContentByAudit(Audit audit) {
final String videoContentId = audit.getRefItemId();
VideoContent videoContent = new VideoContent();
videoContent.setId(audit.getRefItemId());
videoContent.setId(videoContentId);
videoContent.setAuditStatus(audit.getStatus());
//当审核级别为复审,审核状态为通过是,会修改审核项其它表中的 发布与删除字段,不是此情况下是直接修改审核状态
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
break;
case ADD:
videoContent.setPublished(true);
update = this.videoContentService.updateById(videoContent);;
update = this.videoContentService.updateById(videoContent);
break;
case EDIT:
videoContent.setPublished(true);
update = this.videoContentService.updateById(videoContent);;
final String data = this.videoContentTmpService.getById(videoContentId).getData();
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;
default:
}
......@@ -287,8 +330,9 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
* @return
*/
public boolean fillExhibitionBoardByAudit(Audit audit) {
final String exhibitionBoardId = audit.getRefItemId();
ExhibitionBoard exhibitionBoard = new ExhibitionBoard();
exhibitionBoard.setId(audit.getRefItemId());
exhibitionBoard.setId(exhibitionBoardId);
exhibitionBoard.setAuditStatus(audit.getStatus());
//当审核级别为复审,审核状态为通过是,会修改审核项其它表中的 发布与删除字段,不是此情况下是直接修改审核状态
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
break;
case ADD:
exhibitionBoard.setPublished(true);
update = this.exhibitionBoardService.updateById(exhibitionBoard);;
update = this.exhibitionBoardService.updateById(exhibitionBoard);
break;
case EDIT:
exhibitionBoard.setPublished(true);
update = this.exhibitionBoardService.updateById(exhibitionBoard);;
final String data = this.exhibitionBoardTmpService.getById(exhibitionBoardId).getData();
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;
default:
}
......@@ -331,9 +409,10 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
* @return
*/
public boolean fillLearningContentByAudit(Audit audit) {
final String learningContentId = audit.getRefItemId();
LearningContent learningContent = new LearningContent();
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());
if (!continueFill) {
......@@ -359,8 +438,45 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
update = this.learningContentService.updateById(learningContent);
break;
case EDIT:
learningContent.setPublished(true);
update = this.learningContentService.updateById(learningContent);
final String data = this.learningContentTmpService.getById(learningContentId).getData();
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;
default:
}
......
......@@ -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) {
final boolean flag = this.exhibitionBoardTmpService.save(ExhibitionBoardTmp.builder().id(exhibitionBoard.getId()).data(JSONObject.toJSONString(exhibitionBoard)).build());
if (flag) {
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);
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));
}
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) {
final boolean flag = this.videoContentTmpService.save(VideoContentTmp.builder().id(videoContent.getId()).data(JSONObject.toJSONString(videoContent)).build());
if (flag) {
TUser user = getcurUser();
videoContent.setAuditStatus(AuditStatusEnum.TBC.name());
videoContent.setPublished(false);
videoContent.setDeleted(false);
boolean flag = videoContentService.updateById(videoContent);
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));
}
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