Commit 4704c9ef authored by nie'hong's avatar nie'hong

修改-“暂无版权方”和“暂无分类”不允许被修改和删除

parent 26576174
...@@ -67,10 +67,12 @@ public class ExhibitionBoard implements Serializable { ...@@ -67,10 +67,12 @@ public class ExhibitionBoard implements Serializable {
@ApiModelProperty("展板内容版权方ID") @ApiModelProperty("展板内容版权方ID")
@TableField("board_copyright_owner_id") @TableField("board_copyright_owner_id")
@NotBlank(message = "展板内容版权方不能为空", groups = {Add.class, Update.class})
private String boardCopyrightOwnerId; private String boardCopyrightOwnerId;
@ApiModelProperty("展板内容分类ID") @ApiModelProperty("展板内容分类ID")
@TableField("exhibition_board_cat_id") @TableField("exhibition_board_cat_id")
@NotBlank(message = "展板内容分类", groups = {Add.class, Update.class})
private String exhibitionBoardCatId; private String exhibitionBoardCatId;
@ApiModelProperty("展板内容图片URL") @ApiModelProperty("展板内容图片URL")
......
...@@ -2,6 +2,7 @@ package cn.chnmuseum.party.model; ...@@ -2,6 +2,7 @@ package cn.chnmuseum.party.model;
import cn.chnmuseum.party.common.validator.groups.Add; import cn.chnmuseum.party.common.validator.groups.Add;
import cn.chnmuseum.party.common.validator.groups.Update; import cn.chnmuseum.party.common.validator.groups.Update;
import cn.chnmuseum.party.vo.AssetVo;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -151,8 +152,12 @@ public class LearningContent implements Serializable { ...@@ -151,8 +152,12 @@ public class LearningContent implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private List<Audit> auditHistoryList; private List<Audit> auditHistoryList;
@ApiModelProperty("在app展示的学习资料") @ApiModelProperty("在app展示的学习资料Id")
@TableField(exist = false) @TableField(exist = false)
private List<String> fileList; private List<String> fileList;
@ApiModelProperty("在app展示的学习资料")
@TableField(exist = false)
private List<AssetVo> assetList;
} }
...@@ -555,7 +555,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements ...@@ -555,7 +555,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
// 删除原有信息 // 删除原有信息
this.learningContentAssetService.remove(updateWrapper); this.learningContentAssetService.remove(updateWrapper);
// 新增 // 新增
List<String> fileList = learningContent.getFileList(); List<String> fileList = one.getFileList();
if (!CollectionUtils.isEmpty(fileList)) { if (!CollectionUtils.isEmpty(fileList)) {
LambdaQueryWrapper<Asset> queryWrapper = Wrappers.<Asset>lambdaQuery().in(Asset::getId, fileList); LambdaQueryWrapper<Asset> queryWrapper = Wrappers.<Asset>lambdaQuery().in(Asset::getId, fileList);
List<Asset> list1 = this.assetService.list(queryWrapper); List<Asset> list1 = this.assetService.list(queryWrapper);
......
...@@ -11,9 +11,11 @@ import cn.chnmuseum.party.common.video.VideoEncryptUtil; ...@@ -11,9 +11,11 @@ import cn.chnmuseum.party.common.video.VideoEncryptUtil;
import cn.chnmuseum.party.common.vo.GenericPageParam; import cn.chnmuseum.party.common.vo.GenericPageParam;
import cn.chnmuseum.party.model.Asset; import cn.chnmuseum.party.model.Asset;
import cn.chnmuseum.party.model.ExhibitionBoard; import cn.chnmuseum.party.model.ExhibitionBoard;
import cn.chnmuseum.party.model.LearningContentAsset;
import cn.chnmuseum.party.model.TBoxOperation; import cn.chnmuseum.party.model.TBoxOperation;
import cn.chnmuseum.party.service.AssetService; import cn.chnmuseum.party.service.AssetService;
import cn.chnmuseum.party.service.ExhibitionBoardService; import cn.chnmuseum.party.service.ExhibitionBoardService;
import cn.chnmuseum.party.service.LearningContentAssetService;
import cn.chnmuseum.party.vo.AssetVo; import cn.chnmuseum.party.vo.AssetVo;
import cn.chnmuseum.party.web.controller.base.BaseController; import cn.chnmuseum.party.web.controller.base.BaseController;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
...@@ -68,6 +70,9 @@ public class AssetController extends BaseController { ...@@ -68,6 +70,9 @@ public class AssetController extends BaseController {
@Resource @Resource
private ExhibitionBoardService exhibitionBoardService; private ExhibitionBoardService exhibitionBoardService;
@Resource
private LearningContentAssetService learningContentAssetService;
@ApiImplicitParams(value = { @ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
...@@ -191,6 +196,5 @@ public class AssetController extends BaseController { ...@@ -191,6 +196,5 @@ public class AssetController extends BaseController {
} }
return getResult(assetVos); return getResult(assetVos);
} }
} }
...@@ -23,11 +23,13 @@ import io.swagger.annotations.ApiOperation; ...@@ -23,11 +23,13 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.hibernate.validator.constraints.Length;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -72,6 +74,8 @@ public class CopyrightOwnerController extends BaseController { ...@@ -72,6 +74,8 @@ public class CopyrightOwnerController extends BaseController {
@Resource @Resource
private AssetService assetService; private AssetService assetService;
private final static String NO_COPYRIGHT_PARTIES = "暂无版权方";
@PostMapping("/save") @PostMapping("/save")
@RequiresAuthentication //@RequiresPermissions("copyright:owner:save") @RequiresAuthentication //@RequiresPermissions("copyright:owner:save")
@ApiOperation(value = "添加版权方", notes = "添加版权方") @ApiOperation(value = "添加版权方", notes = "添加版权方")
...@@ -123,6 +127,12 @@ public class CopyrightOwnerController extends BaseController { ...@@ -123,6 +127,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) {
// “暂无版权方”这个版权方不允许修改
CopyrightOwner byId = this.copyrightOwnerService.getById(copyrightOwner.getId());
if (NO_COPYRIGHT_PARTIES.equals(byId.getName())) {
return getFailResult("这个版权方不允许被修改!");
}
final LambdaQueryWrapper<CopyrightOwner> lambdaQueryWrapper = Wrappers.<CopyrightOwner>lambdaQuery().eq(CopyrightOwner::getName, copyrightOwner.getName().trim()); final LambdaQueryWrapper<CopyrightOwner> lambdaQueryWrapper = Wrappers.<CopyrightOwner>lambdaQuery().eq(CopyrightOwner::getName, copyrightOwner.getName().trim());
lambdaQueryWrapper.eq(CopyrightOwner::getOwnerType, copyrightOwner.getOwnerType().trim()); lambdaQueryWrapper.eq(CopyrightOwner::getOwnerType, copyrightOwner.getOwnerType().trim());
lambdaQueryWrapper.ne(CopyrightOwner::getId, copyrightOwner.getId()); lambdaQueryWrapper.ne(CopyrightOwner::getId, copyrightOwner.getId());
...@@ -327,6 +337,7 @@ public class CopyrightOwnerController extends BaseController { ...@@ -327,6 +337,7 @@ public class CopyrightOwnerController extends BaseController {
@MethodLog(operModule = OperModule.DISPLAYCOPYRIGHT, operType = OperType.DELETE) @MethodLog(operModule = OperModule.DISPLAYCOPYRIGHT, operType = OperType.DELETE)
@Transactional @Transactional
public Map<String, Object> deleteCopyrightOwner(@PathVariable("id") String id) { public Map<String, Object> deleteCopyrightOwner(@PathVariable("id") String id) {
// 版权方有对应展板信息,则不能被删除 // 版权方有对应展板信息,则不能被删除
LambdaQueryWrapper<ExhibitionBoard> exhibitionBoardLambdaQueryWrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ExhibitionBoard> exhibitionBoardLambdaQueryWrapper1 = new LambdaQueryWrapper<>();
exhibitionBoardLambdaQueryWrapper1.eq(ExhibitionBoard::getBoardCopyrightOwnerId, id); exhibitionBoardLambdaQueryWrapper1.eq(ExhibitionBoard::getBoardCopyrightOwnerId, id);
...@@ -343,6 +354,11 @@ public class CopyrightOwnerController extends BaseController { ...@@ -343,6 +354,11 @@ public class CopyrightOwnerController extends BaseController {
return getFailResult("该版权方有关联视频信息,无法删除!"); return getFailResult("该版权方有关联视频信息,无法删除!");
} }
CopyrightOwner byId = this.copyrightOwnerService.getById(id);
if (NO_COPYRIGHT_PARTIES.equals(byId.getName())) {
return getFailResult("这个版权方不允许被删除!");
}
this.copyrightOwnerService.removeById(id); this.copyrightOwnerService.removeById(id);
LambdaUpdateWrapper<CopyrightOwnerBoardCat> copyrightOwnerBoardCatLambdaUpdateWrapper = Wrappers.<CopyrightOwnerBoardCat>lambdaUpdate().eq(CopyrightOwnerBoardCat::getCopyrightOwnerId, id); LambdaUpdateWrapper<CopyrightOwnerBoardCat> copyrightOwnerBoardCatLambdaUpdateWrapper = Wrappers.<CopyrightOwnerBoardCat>lambdaUpdate().eq(CopyrightOwnerBoardCat::getCopyrightOwnerId, id);
......
...@@ -67,6 +67,8 @@ public class ExhibitionBoardCatController extends BaseController { ...@@ -67,6 +67,8 @@ public class ExhibitionBoardCatController extends BaseController {
@Resource @Resource
private AssetService assetService; private AssetService assetService;
private final static String NO_BOARD_CAT = "暂无分类";
@PostMapping("/save") @PostMapping("/save")
@RequiresAuthentication //@RequiresPermissions("exhibition:board:cat:save") @RequiresAuthentication //@RequiresPermissions("exhibition:board:cat:save")
@ApiOperation(value = "添加展板分类", notes = "添加展板分类") @ApiOperation(value = "添加展板分类", notes = "添加展板分类")
...@@ -88,6 +90,11 @@ public class ExhibitionBoardCatController extends BaseController { ...@@ -88,6 +90,11 @@ public class ExhibitionBoardCatController extends BaseController {
@ApiOperation(value = "修改展板分类信息", notes = "修改展板分类信息") @ApiOperation(value = "修改展板分类信息", notes = "修改展板分类信息")
@MethodLog(operModule = OperModule.DISPLAYCLASSIFY, operType = OperType.UPDATE) @MethodLog(operModule = OperModule.DISPLAYCLASSIFY, operType = OperType.UPDATE)
public Map<String, Object> updateExhibitionBoardCat(@Validated(value = {Update.class}) ExhibitionBoardCat exhibitionBoardCat) { public Map<String, Object> updateExhibitionBoardCat(@Validated(value = {Update.class}) ExhibitionBoardCat exhibitionBoardCat) {
ExhibitionBoardCat byId = this.exhibitionBoardCatService.getById(exhibitionBoardCat.getId());
if (NO_BOARD_CAT.equals(byId.getName())) {
return getFailResult("该展板分类不允许被修改!");
}
boolean flag = exhibitionBoardCatService.updateById(exhibitionBoardCat); boolean flag = exhibitionBoardCatService.updateById(exhibitionBoardCat);
if (flag) { if (flag) {
return getSuccessResult(); return getSuccessResult();
...@@ -245,6 +252,11 @@ public class ExhibitionBoardCatController extends BaseController { ...@@ -245,6 +252,11 @@ public class ExhibitionBoardCatController extends BaseController {
return getFailResult("该展板分类正在被使用,不能删除!"); return getFailResult("该展板分类正在被使用,不能删除!");
} }
ExhibitionBoardCat byId = this.exhibitionBoardCatService.getById(id);
if (NO_BOARD_CAT.equals(byId.getName())) {
return getFailResult("该展板分类不允许被删除!");
}
// 删除展板分类信息 // 删除展板分类信息
this.exhibitionBoardCatService.removeById(id); this.exhibitionBoardCatService.removeById(id);
// 删除版权方展板分类信息 // 删除版权方展板分类信息
......
...@@ -463,6 +463,11 @@ public class ExhibitionBoardController extends BaseController { ...@@ -463,6 +463,11 @@ public class ExhibitionBoardController extends BaseController {
exhibitionBoard.setBoardCopyrightOwnerName("无"); exhibitionBoard.setBoardCopyrightOwnerName("无");
} }
// 展板简介
if (StringUtils.isEmpty(exhibitionBoard.getRemarks())) {
exhibitionBoard.setRemarks("无");
}
// 展板视频版权方信息 // 展板视频版权方信息
if (StringUtils.isNotEmpty(exhibitionBoard.getVideoContentCopyrightOwnerId())) { if (StringUtils.isNotEmpty(exhibitionBoard.getVideoContentCopyrightOwnerId())) {
final CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()); final CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId());
...@@ -516,13 +521,27 @@ public class ExhibitionBoardController extends BaseController { ...@@ -516,13 +521,27 @@ public class ExhibitionBoardController extends BaseController {
public Map<String, Object> getById(@PathVariable("id") String id) { public Map<String, Object> getById(@PathVariable("id") String id) {
ExhibitionBoard exhibitionBoard = exhibitionBoardService.getById(id); ExhibitionBoard exhibitionBoard = exhibitionBoardService.getById(id);
String exhibitionBoardCatId = exhibitionBoard.getExhibitionBoardCatId(); String exhibitionBoardCatId = exhibitionBoard.getExhibitionBoardCatId();
// 展板分类信息
if (StringUtils.isNotEmpty(exhibitionBoardCatId)) { if (StringUtils.isNotEmpty(exhibitionBoardCatId)) {
exhibitionBoard.setExhibitionBoardCatName(this.exhibitionBoardCatService.getById(exhibitionBoardCatId).getName()); exhibitionBoard.setExhibitionBoardCatName(this.exhibitionBoardCatService.getById(exhibitionBoardCatId).getName());
}else {
exhibitionBoard.setExhibitionBoardCatName("暂无数据");
} }
// 展板版权方信息
String boardCopyrightOwnerId = exhibitionBoard.getBoardCopyrightOwnerId(); String boardCopyrightOwnerId = exhibitionBoard.getBoardCopyrightOwnerId();
if (StringUtils.isNotEmpty(boardCopyrightOwnerId)) { if (StringUtils.isNotEmpty(boardCopyrightOwnerId)) {
exhibitionBoard.setBoardCopyrightOwnerName(this.copyrightOwnerService.getById(boardCopyrightOwnerId).getName()); exhibitionBoard.setBoardCopyrightOwnerName(this.copyrightOwnerService.getById(boardCopyrightOwnerId).getName());
}else {
exhibitionBoard.setBoardCopyrightOwnerName("暂无数据");
}
// 展板简介
if (StringUtils.isEmpty(exhibitionBoard.getRemarks())) {
exhibitionBoard.setRemarks("暂无数据");
} }
// 视频版权方信息
if (StringUtils.isNotEmpty(exhibitionBoard.getVideoContentCopyrightOwnerId())) { if (StringUtils.isNotEmpty(exhibitionBoard.getVideoContentCopyrightOwnerId())) {
String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName(); String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName();
exhibitionBoard.setVideoContentCopyrightOwnerName(name); exhibitionBoard.setVideoContentCopyrightOwnerName(name);
......
...@@ -13,7 +13,9 @@ import cn.chnmuseum.party.common.validator.groups.Update; ...@@ -13,7 +13,9 @@ import cn.chnmuseum.party.common.validator.groups.Update;
import cn.chnmuseum.party.common.vo.GenericPageParam; import cn.chnmuseum.party.common.vo.GenericPageParam;
import cn.chnmuseum.party.model.*; import cn.chnmuseum.party.model.*;
import cn.chnmuseum.party.service.*; import cn.chnmuseum.party.service.*;
import cn.chnmuseum.party.vo.AssetVo;
import cn.chnmuseum.party.web.controller.base.BaseController; import cn.chnmuseum.party.web.controller.base.BaseController;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -536,6 +538,21 @@ public class LearningContentController extends BaseController { ...@@ -536,6 +538,21 @@ public class LearningContentController extends BaseController {
LambdaQueryWrapper<LearningContentAsset> lambdaQueryWrapper = Wrappers.<LearningContentAsset>lambdaQuery().eq(LearningContentAsset::getLearningContentId, id); LambdaQueryWrapper<LearningContentAsset> lambdaQueryWrapper = Wrappers.<LearningContentAsset>lambdaQuery().eq(LearningContentAsset::getLearningContentId, id);
lambdaQueryWrapper.select(LearningContentAsset::getAssetId); lambdaQueryWrapper.select(LearningContentAsset::getAssetId);
List<String> list = this.learningContentAssetService.listObjs(lambdaQueryWrapper, Object::toString); List<String> list = this.learningContentAssetService.listObjs(lambdaQueryWrapper, Object::toString);
if (CollectionUtil.isNotEmpty(list)) {
List<Asset> assets = this.assetService.listByIds(list);
List<AssetVo> assetVos = new ArrayList<>();
for (Asset asset : assets) {
ExhibitionBoard board = this.exhibitionBoardService.getById(asset.getRefItemId());
AssetVo assetVo = AssetVo.builder()
.id(asset.getId())
.fileName(asset.getFileName())
.fileType(asset.getFileExtName())
.boardName(board.getName())
.build();
assetVos.add(assetVo);
}
learningContent.setAssetList(assetVos);
}
learningContent.setFileList(list); learningContent.setFileList(list);
final LambdaQueryWrapper<Audit> auditQueryWrapper = Wrappers.<Audit>lambdaQuery().eq(Audit::getRefItemId, id); final LambdaQueryWrapper<Audit> auditQueryWrapper = Wrappers.<Audit>lambdaQuery().eq(Audit::getRefItemId, id);
......
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