Commit 7d9b2e91 authored by liqin's avatar liqin 💬

bug fixed

parent 93db1527
......@@ -8,8 +8,8 @@ import java.util.stream.Collectors;
*/
public enum CopyrightOwnerTypeEnum {
ASSET(1, "视频"),
EXHIBITION_BOARD(2, "展板");
VIDEO_CONTENT(1, "视频内容"),
EXHIBITION_BOARD(2, "展板内容");
public String name;
public static String names;
......
......@@ -3,7 +3,7 @@ package cn.wisenergy.chnmuseum.party.common.mybatis;
public class MysqlGenerator {
private static final String[] tableNames = new String[]{
"asset", "video_content", "video_content_cat"
"copyright_owner_video_content_cat"
};
// private static final String projectPath = "D:\\develop\\Project\\chnmuseum-party";
private static final String projectPath = "/opt/ss";
......
package cn.wisenergy.chnmuseum.party.mapper;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerAssetType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerVideoContentCat;
/**
* <pre>
......@@ -10,9 +9,8 @@ import org.springframework.stereotype.Repository;
* </pre>
*
* @author Danny Lee
* @since 2021-03-18
* @since 2021-04-02
*/
@Repository
public interface CopyrightOwnerAssetTypeMapper extends BaseMapper<CopyrightOwnerAssetType> {
public interface CopyrightOwnerVideoContentCatMapper extends BaseMapper<CopyrightOwnerVideoContentCat> {
}
......@@ -45,7 +45,7 @@ public class CopyrightOwner implements Serializable {
@NotBlank(message = "版权方名称不能为空", groups = {Add.class, Update.class})
private String name;
@ApiModelProperty(value = "版权方类型", allowableValues = "ASSET, EXHIBITION_BOARD")
@ApiModelProperty(value = "版权方类型", allowableValues = "VIDEO_CONTENT, EXHIBITION_BOARD")
@TableField("owner_type")
@NotBlank(message = "版权方类型不能为空", groups = {Add.class, Update.class})
private String ownerType;
......@@ -72,16 +72,16 @@ public class CopyrightOwner implements Serializable {
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@ApiModelProperty("视频分类ID集合(详情使用)")
@ApiModelProperty("视频内容分类ID集合(详情使用)")
@TableField(exist = false)
private List<String> assetTypeIdList;
private List<String> videoContentCatIdList;
@ApiModelProperty("视频分类名称集合(详情使用)")
@ApiModelProperty("视频内容分类名称集合(详情使用)")
@TableField(exist = false)
private List<String> assetTypeNameList;
private List<String> videoContentCatNameList;
@ApiModelProperty("视频分类名称(列表使用)")
@ApiModelProperty("视频内容分类名称(列表使用)")
@TableField(exist = false)
private String assetTypeNames;
private String videoContentCatNames;
}
......@@ -21,7 +21,7 @@ import java.io.Serializable;
* </p>
*
* @author Danny Lee
* @since 2021-03-23
* @since 2021-04-02
*/
@Data
@Builder
......@@ -29,9 +29,9 @@ import java.io.Serializable;
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("copyright_owner_asset_type")
@TableName("copyright_owner_video_content_cat")
@ApiModel(value = "版权方视频分类", description = "版权方视频分类")
public class CopyrightOwnerAssetType implements Serializable {
public class CopyrightOwnerVideoContentCat implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -40,14 +40,17 @@ public class CopyrightOwnerAssetType implements Serializable {
@NotNull(message = "标识ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty("视频版权方ID")
@ApiModelProperty("视频内容版权方ID")
@TableField("copyright_owner_id")
@NotBlank(message = "视频版权方ID不能为空", groups = {Add.class, Update.class})
private String copyrightOwnerId;
@NotBlank(message = "视频内容版权方ID不能为空", groups = {Add.class, Update.class})
private String copyrightOwnerId;
@ApiModelProperty("视频内容分类ID")
@TableField("video_content_cat_id")
@NotBlank(message = "视频内容分类ID不能为空", groups = {Add.class, Update.class})
private String videoContentCatId;
@ApiModelProperty("视频分类ID")
@TableField("asset_type_id")
@NotBlank(message = "视频分类ID不能为空", groups = {Add.class, Update.class})
private String assetTypeId;
}
package cn.wisenergy.chnmuseum.party.service;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerAssetType;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerVideoContentCat;
import com.baomidou.mybatisplus.extension.service.IService;
/**
......@@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author Danny Lee
* @since 2021-03-18
* @since 2021-04-02
*/
public interface CopyrightOwnerAssetTypeService extends IService<CopyrightOwnerAssetType> {
public interface CopyrightOwnerVideoContentCatService extends IService<CopyrightOwnerVideoContentCat> {
}
......@@ -103,7 +103,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
break;
case ACCOUNT:
break;
case ASSET:
case VIDEO_CONTENT:
selectPage = auditMapper.getAssetPage(auditPage, ew);
default:
}
......
package cn.wisenergy.chnmuseum.party.service.impl;
import cn.wisenergy.chnmuseum.party.mapper.CopyrightOwnerAssetTypeMapper;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerAssetType;
import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerAssetTypeService;
import cn.wisenergy.chnmuseum.party.mapper.CopyrightOwnerVideoContentCatMapper;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerVideoContentCat;
import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerVideoContentCatService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -13,11 +13,10 @@ import org.springframework.stereotype.Service;
* </pre>
*
* @author Danny Lee
* @since 2021-03-18
* @since 2021-04-02
*/
@Slf4j
@Service
public class CopyrightOwnerAssetTypeServiceImpl extends ServiceImpl<CopyrightOwnerAssetTypeMapper, CopyrightOwnerAssetType> implements CopyrightOwnerAssetTypeService {
public class CopyrightOwnerVideoContentCatServiceImpl extends ServiceImpl<CopyrightOwnerVideoContentCatMapper, CopyrightOwnerVideoContentCat> implements CopyrightOwnerVideoContentCatService {
}
......@@ -5,11 +5,14 @@ import cn.wisenergy.chnmuseum.party.common.util.TimeUtils;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.VideoContentCat;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwner;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerAssetType;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerVideoContentCat;
import cn.wisenergy.chnmuseum.party.model.ExhibitionBoard;
import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.model.VideoContentCat;
import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerService;
import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerVideoContentCatService;
import cn.wisenergy.chnmuseum.party.service.ExhibitionBoardService;
import cn.wisenergy.chnmuseum.party.service.VideoContentCatService;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -50,13 +53,10 @@ public class CopyrightOwnerController extends BaseController {
private CopyrightOwnerService copyrightOwnerService;
@Resource
private AssetService assetService;
@Resource
private AssetTypeService assetTypeService;
private VideoContentCatService videoContentCatService;
@Resource
private CopyrightOwnerAssetTypeService copyrightOwnerAssetTypeService;
private CopyrightOwnerVideoContentCatService copyrightOwnerVideoContentCatService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
......@@ -64,23 +64,20 @@ public class CopyrightOwnerController extends BaseController {
@PostMapping("/save")
@RequiresPermissions("copyright:owner:save")
@ApiOperation(value = "添加版权方", notes = "添加版权方")
public Map<String, Object> saveCopyrightOwner(@Validated(value = {Add.class}) CopyrightOwner copyrightOwner
//, @RequestParam("copyrightOwnerType") CopyrightOwnerTypeEnum copyrightOwnerTypeEnum
) {
//copyrightOwner.setOwnerType(copyrightOwnerTypeEnum.name());
public Map<String, Object> saveCopyrightOwner(@Validated(value = {Add.class}) CopyrightOwner copyrightOwner) {
// 保存业务节点信息
boolean result = copyrightOwnerService.save(copyrightOwner);
List<String> assetTypeIdList = copyrightOwner.getAssetTypeIdList();
if (assetTypeIdList != null && !assetTypeIdList.isEmpty()) {
List<CopyrightOwnerAssetType> copyrightOwnerAssetTypeList = new ArrayList<>();
for (String assetTypeId : assetTypeIdList) {
copyrightOwnerAssetTypeList.add(CopyrightOwnerAssetType.builder()
.assetTypeId(assetTypeId)
final List<String> videoContentCatIdList = copyrightOwner.getVideoContentCatIdList();
if (videoContentCatIdList != null && !videoContentCatIdList.isEmpty()) {
List<CopyrightOwnerVideoContentCat> copyrightOwnerVideoContentCatList = new ArrayList<>();
for (String videoContentCatId : videoContentCatIdList) {
copyrightOwnerVideoContentCatList.add(CopyrightOwnerVideoContentCat.builder()
.videoContentCatId(videoContentCatId)
.copyrightOwnerId(copyrightOwner.getId())
.build());
}
this.copyrightOwnerAssetTypeService.saveBatch(copyrightOwnerAssetTypeList);
this.copyrightOwnerVideoContentCatService.saveBatch(copyrightOwnerVideoContentCatList);
}
// 返回操作结果
......@@ -98,19 +95,19 @@ public class CopyrightOwnerController extends BaseController {
public Map<String, Object> updateCopyrightOwner(@Validated(value = {Update.class}) CopyrightOwner copyrightOwner) {
boolean flag = copyrightOwnerService.updateById(copyrightOwner);
List<String> assetTypeIdList = copyrightOwner.getAssetTypeIdList();
if (assetTypeIdList != null && !assetTypeIdList.isEmpty()) {
LambdaUpdateWrapper<CopyrightOwnerAssetType> updateWrapper = Wrappers.<CopyrightOwnerAssetType>lambdaUpdate().eq(CopyrightOwnerAssetType::getCopyrightOwnerId, copyrightOwner.getId());
this.copyrightOwnerAssetTypeService.remove(updateWrapper);
final List<String> videoContentCatIdList = copyrightOwner.getVideoContentCatIdList();
if (videoContentCatIdList != null && !videoContentCatIdList.isEmpty()) {
LambdaUpdateWrapper<CopyrightOwnerVideoContentCat> updateWrapper = Wrappers.<CopyrightOwnerVideoContentCat>lambdaUpdate().eq(CopyrightOwnerVideoContentCat::getCopyrightOwnerId, copyrightOwner.getId());
this.copyrightOwnerVideoContentCatService.remove(updateWrapper);
List<CopyrightOwnerAssetType> copyrightOwnerAssetTypeList = new ArrayList<>();
for (String assetTypeId : assetTypeIdList) {
copyrightOwnerAssetTypeList.add(CopyrightOwnerAssetType.builder()
.assetTypeId(assetTypeId)
List<CopyrightOwnerVideoContentCat> copyrightOwnerVideoContentCatList = new ArrayList<>();
for (String videoContentCatId : videoContentCatIdList) {
copyrightOwnerVideoContentCatList.add(CopyrightOwnerVideoContentCat.builder()
.videoContentCatId(videoContentCatId)
.copyrightOwnerId(copyrightOwner.getId())
.build());
}
this.copyrightOwnerAssetTypeService.saveBatch(copyrightOwnerAssetTypeList);
this.copyrightOwnerVideoContentCatService.saveBatch(copyrightOwnerVideoContentCatList);
}
if (flag) {
return getSuccessResult();
......@@ -118,16 +115,6 @@ public class CopyrightOwnerController extends BaseController {
return getFailResult();
}
@DeleteMapping("/delete/{id}")
@RequiresPermissions("copyright:owner:delete")
@ApiOperation(value = "根据ID删除版权方", notes = "根据ID删除版权方")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "id", value = "标识ID", paramType = "path", dataType = "String")
})
public Map<String, Object> deleteCopyrightOwner(@PathVariable("id") String id) {
return getSuccessResult();
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "copyrightOwnerType", value = "版权方类型", paramType = "query", dataType = "String", required = true)
})
......@@ -145,7 +132,7 @@ public class CopyrightOwnerController extends BaseController {
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "ownerType", value = "版权方类型", paramType = "query", dataType = "String", required = true, allowableValues = "ASSET, EXHIBITION_BOARD"),
@ApiImplicitParam(name = "ownerType", value = "版权方类型", paramType = "query", dataType = "String", required = true, allowableValues = "VIDEO_CONTENT, EXHIBITION_BOARD"),
@ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startDate", value = "创建时间-开始", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "创建时间-结束", paramType = "query", dataType = "String")
......@@ -171,6 +158,7 @@ public class CopyrightOwnerController extends BaseController {
queryWrapper.select(
CopyrightOwner::getId,
CopyrightOwner::getName,
CopyrightOwner::getOwnerType,
CopyrightOwner::getExpireDateStart,
CopyrightOwner::getExpireDateEnd,
CopyrightOwner::getRemarks,
......@@ -178,22 +166,22 @@ public class CopyrightOwnerController extends BaseController {
CopyrightOwner::getUpdateTime);
Page<CopyrightOwner> page = this.copyrightOwnerService.page(getPage(), queryWrapper);
for (CopyrightOwner copyrightOwner : page.getRecords()) {
if (CopyrightOwnerTypeEnum.ASSET.name().equals(genericPageParam.getOwnerType())) {
List<CopyrightOwnerAssetType> CopyrightOwnerAssetTypeList = this.copyrightOwnerAssetTypeService.list(Wrappers.<CopyrightOwnerAssetType>lambdaQuery().eq(CopyrightOwnerAssetType::getCopyrightOwnerId, copyrightOwner.getId()));
if (!CopyrightOwnerAssetTypeList.isEmpty()) {
Set<String> idList = CopyrightOwnerAssetTypeList.stream().map(CopyrightOwnerAssetType::getAssetTypeId).collect(Collectors.toSet());
List<VideoContentCat> videoContentCatList = this.assetTypeService.listByIds(idList);
String assetTypeNameList = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.joining("、"));
copyrightOwner.setAssetTypeNames(assetTypeNameList);
if (CopyrightOwnerTypeEnum.VIDEO_CONTENT.name().equals(genericPageParam.getOwnerType())) {
List<CopyrightOwnerVideoContentCat> copyrightOwnerVideoContentCatList = this.copyrightOwnerVideoContentCatService.list(Wrappers.<CopyrightOwnerVideoContentCat>lambdaQuery().eq(CopyrightOwnerVideoContentCat::getCopyrightOwnerId, copyrightOwner.getId()));
if (!copyrightOwnerVideoContentCatList.isEmpty()) {
Set<String> idList = copyrightOwnerVideoContentCatList.stream().map(CopyrightOwnerVideoContentCat::getVideoContentCatId).collect(Collectors.toSet());
List<VideoContentCat> videoContentCatList = this.videoContentCatService.listByIds(idList);
String videoContentCatNames = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.joining("、"));
copyrightOwner.setVideoContentCatNames(videoContentCatNames);
}
} else if (CopyrightOwnerTypeEnum.EXHIBITION_BOARD.name().equals(genericPageParam.getOwnerType())) {
LambdaQueryWrapper<ExhibitionBoard> lambdaQueryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getBoardCopyrightOwnerId, copyrightOwner.getId());
List<ExhibitionBoard> exhibitionBoardList = this.exhibitionBoardService.list(lambdaQueryWrapper);
if (!exhibitionBoardList.isEmpty()) {
Set<String> assetTypeIdList = exhibitionBoardList.stream().map(ExhibitionBoard::getAssetTypeId).collect(Collectors.toSet());
List<VideoContentCat> videoContentCatList = this.assetTypeService.listByIds(assetTypeIdList);
String assetTypeNames = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.joining("、"));
copyrightOwner.setAssetTypeNames(assetTypeNames);
Set<String> videoContentCatIdList = exhibitionBoardList.stream().map(ExhibitionBoard::getVideoContentCatId).collect(Collectors.toSet());
List<VideoContentCat> videoContentCatList = this.videoContentCatService.listByIds(videoContentCatIdList);
String videoContentCatNames = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.joining("、"));
copyrightOwner.setVideoContentCatNames(videoContentCatNames);
}
}
}
......@@ -209,16 +197,16 @@ public class CopyrightOwnerController extends BaseController {
public Map<String, Object> getById(@PathVariable("id") String id) {
CopyrightOwner copyrightOwner = copyrightOwnerService.getById(id);
String ownerType = copyrightOwner.getOwnerType();
if (CopyrightOwnerTypeEnum.ASSET.name().equals(ownerType)) {
LambdaQueryWrapper<CopyrightOwnerAssetType> lambdaQueryWrapper = Wrappers.<CopyrightOwnerAssetType>lambdaQuery().eq(CopyrightOwnerAssetType::getCopyrightOwnerId, id);
List<CopyrightOwnerAssetType> copyrightOwnerAssetTypeList = this.copyrightOwnerAssetTypeService.list(lambdaQueryWrapper);
if (!copyrightOwnerAssetTypeList.isEmpty()) {
List<String> assetTypeIdArrayList = copyrightOwnerAssetTypeList.stream().map(CopyrightOwnerAssetType::getAssetTypeId).distinct().collect(Collectors.toList());
copyrightOwner.setAssetTypeIdList(assetTypeIdArrayList);
final List<VideoContentCat> videoContentCatList = this.assetTypeService.listByIds(assetTypeIdArrayList);
if (CopyrightOwnerTypeEnum.VIDEO_CONTENT.name().equals(ownerType)) {
LambdaQueryWrapper<CopyrightOwnerVideoContentCat> lambdaQueryWrapper = Wrappers.<CopyrightOwnerVideoContentCat>lambdaQuery().eq(CopyrightOwnerVideoContentCat::getCopyrightOwnerId, id);
final List<CopyrightOwnerVideoContentCat> copyrightOwnerVideoContentCatList = this.copyrightOwnerVideoContentCatService.list(lambdaQueryWrapper);
if (!copyrightOwnerVideoContentCatList.isEmpty()) {
List<String> videoContentCatIdList = copyrightOwnerVideoContentCatList.stream().map(CopyrightOwnerVideoContentCat::getVideoContentCatId).distinct().collect(Collectors.toList());
copyrightOwner.setVideoContentCatIdList(videoContentCatIdList);
final List<VideoContentCat> videoContentCatList = this.videoContentCatService.listByIds(videoContentCatIdList);
if (!videoContentCatList.isEmpty()) {
final List<String> assetTypeNameList = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.toList());
copyrightOwner.setAssetTypeNameList(assetTypeNameList);
final List<String> videoContentCatNameList = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.toList());
copyrightOwner.setVideoContentCatNameList(videoContentCatNameList);
}
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.CopyrightOwnerAssetTypeMapper">
<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.CopyrightOwnerVideoContentCatMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.CopyrightOwnerAssetType">
<id column="id" property="id" />
<result column="copyright_owner_id" property="copyrightOwnerId" />
<result column="asset_type_id" property="assetTypeId" />
</resultMap>
<resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.CopyrightOwnerVideoContentCat">
<id column="id" property="id"/>
<result column="copyright_owner_id" property="copyrightOwnerId"/>
<result column="video_content_cat_id" property="videoContentCatId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, copyright_owner_id, asset_type_id
id, copyright_owner_id, video_content_cat_id
</sql>
</mapper>
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