Commit a30d39f8 authored by 33's avatar 33

Api版权接口

parent 0efddbd7
package com.fzm.admin.controller;
import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException;
import com.fzm.common.model.ResponseModel;
import com.fzm.common.open.entity.dataobject.CopyrightApiDO;
import com.fzm.common.open.entity.queryobject.CopyrightApiQO;
import com.fzm.common.open.entity.queryobject.CopyrightManagerQO;
import com.fzm.common.open.entity.viewobject.CopyrightApiVO;
import com.fzm.common.open.service.CopyrightApiService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author tangtuo
* @date 2021/12/15 10:27
*/
@RestController
@RequestMapping(value = "/copyright/api/apply")
@Api(tags = "Api版权审核")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApiController {
private final CopyrightApiService copyrightApiService;
@PostMapping(value = "/pages")
@ApiOperation(value = "分页查询")
public ResponseModel<PageInfo<CopyrightApiDO>> page(@RequestBody CopyrightApiQO copyrightApiQO) {
PageInfo<CopyrightApiDO> pages = copyrightApiService.pages(copyrightApiQO);
return ResponseModel.success(pages);
}
@GetMapping(value = "/detail")
@ApiOperation(value = "获取详情")
public ResponseModel<CopyrightApiVO> details(@RequestParam Integer id) {
return ResponseModel.success(copyrightApiService.getDetail(id));
}
@PostMapping(value = "/pass")
@ApiOperation(value = "通过")
public ResponseModel<Object> pass(@RequestBody CopyrightManagerQO managerQO) {
Integer id = managerQO.getId();
verify(id);
copyrightApiService.pass(id);
return ResponseModel.success();
}
@PostMapping(value = "/reject")
@ApiOperation(value = "驳回")
public ResponseModel<Object> reject(@RequestBody CopyrightManagerQO managerQO) {
Integer id = managerQO.getId();
verify(id);
copyrightApiService.reject(id, managerQO.getRejectReason());
return ResponseModel.success();
}
private void verify(Integer id) {
if (id == null || id < 0) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试");
}
CopyrightApiDO copyrightApiDO = copyrightApiService.getById(id);
if (copyrightApiDO == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试");
}
if (CopyrightApplyState.TO_BE_REVIEWED.getCode() != copyrightApiDO.getRegisterState()) {
throw GlobalException.newException(ResultCode.OPERATION_FAILED, "此版权申请记录的状态不是待提交,无法审核通过");
}
}
}
package com.fzm.admin.schedule;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.TypeReference;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.fzm.common.entity.dto.CopyrightQueryRequest;
import com.fzm.common.entity.dto.CopyrightQueryResponse;
import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.open.entity.dataobject.CopyrightApiDO;
import com.fzm.common.open.service.CopyrightApiService;
import com.fzm.common.properties.CopyrightProperties;
import com.fzm.common.utils.CopyrightSignUtil;
import com.fzm.common.utils.JsonUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
/**
* @author tangtuo
* @date 2022/1/10 15:17
*/
@Slf4j
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApiTask {
private final CopyrightApiService copyrightApiService;
private final CopyrightProperties copyrightProperties;
private final Redisson redisson;
/**
* 定时任务更新版权申请状态
*/
@Scheduled(cron = "0 */10 * * * ?")
@Transactional(rollbackFor = Exception.class)
public void updateCopyrightState() throws InterruptedException {
// 加锁,防止集群部署时,定时任务在多个节点上执行
RLock lock = redisson.getLock("update:copyright:api:state");
if (!lock.tryLock(30, TimeUnit.SECONDS)) {
if (log.isDebugEnabled()) {
log.debug("更新版权状态的定时任务已在其他节点运行");
}
return;
}
try {
List<String> list = copyrightApiService.getSerialCodes();
if (CollectionUtil.isEmpty(list)) {
if (log.isDebugEnabled()) {
log.debug("当前无待更新状态的申请记录");
}
return;
}
for (String serialCode : list) {
try {
log.info("更新状态: 当前流水号为: {}", serialCode);
CopyrightQueryRequest request = new CopyrightQueryRequest(serialCode, copyrightProperties.getAppId());
TreeMap<String, String> map = this.beanToMap(request, copyrightProperties.getAppSecret());
String sign = CopyrightSignUtil.generateSign(map);
request.setSign(sign);
String json = JSONUtil.toJsonStr(request);
log.info("查询审核结果, 当前流水号为:{} , 请求参数为 : {}", serialCode, json);
String response = HttpUtil.post(copyrightProperties.getQueryUrl(), json, 10000);
log.info("查询审核结果接口响应内容: {}", response);
if (StringUtils.isBlank(response)) {
log.error("版权局查询存证接口无响应, 流水号: {}", serialCode);
continue;
}
CopyrightQueryResponse copyrightResponse = JsonUtil.toObject(response, CopyrightQueryResponse.class);
if (copyrightResponse == null) {
log.error("版权局查询存证接口无响应, 流水号: {}", serialCode);
continue;
}
if (!copyrightResponse.isSuccess()) {
log.error("接口响应失败, 失败原因:{}, 流水号: {}", copyrightResponse.getMessage(), serialCode);
continue;
}
// 审核状态(0:未提交,1:待审核,2:同意,3:驳回,4:已提交,5:待终审,6:审核通过)
Integer audit_status = copyrightResponse.getAudit_status();
Integer registerState = getRegisterState(audit_status);
if (registerState == null) {
log.info("当前版权状态无更新, 流水号为: {}", serialCode);
continue;
}
CopyrightApiDO copyrightApiDO = copyrightApiService.getBySerialNum(serialCode);
if (registerState.equals(copyrightApiDO.getRegisterState())) {
log.info("当前版权状态无更新, 流水号为: {}", serialCode);
continue;
}
CopyrightApiDO apiDO = new CopyrightApiDO();
apiDO.setId(copyrightApiDO.getId());
apiDO.setRegisterState(registerState);
apiDO.setUpdateDate(new Date());
copyrightApiService.updateById(apiDO);
} catch (Exception e) {
log.error("更新版权状态发送异常, 当前流水号为:{}", serialCode);
log.error(e.getMessage(), e);
}
}
} finally {
lock.unlock();
}
}
private TreeMap<String, String> beanToMap(CopyrightQueryRequest request, String app_secret) {
TreeMap<String, String> map = JSONUtil.toBean(JSONUtil.toJsonStr(request), new TypeReference<TreeMap<String, String>>() {
}, true);
map.put("app_secret", app_secret);
return map;
}
private Integer getRegisterState(Integer audi_status) {
// audi_status 审核状态(0:未提交,1:待审核,2:同意,3:驳回,4:已提交,5:待终审,6:审核通过)
switch (audi_status) {
case 1:
return CopyrightApplyState.EXAMINE.getCode();
case 5:
return CopyrightApplyState.FINAL_JUDGMENT.getCode();
case 3:
return CopyrightApplyState.FAILED.getCode();
case 6:
return CopyrightApplyState.SUCCEEDED.getCode();
default:
return null;
}
}
}
......@@ -35,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
......@@ -67,6 +68,7 @@ public class CopyrightTask {
* 定时任务更新版权申请状态
*/
@Scheduled(cron = "0 */10 * * * ?")
@Transactional(rollbackFor = Exception.class)
public void updateCopyrightState() throws InterruptedException {
// 加锁,防止集群部署时,定时任务在多个节点上执行
RLock lock = redisson.getLock("update:copyright:state");
......
......@@ -5,6 +5,11 @@ import cn.hutool.json.JSONUtil;
import com.fzm.common.entity.*;
import com.fzm.common.entity.vo.CopyrightVo;
import com.fzm.common.enums.*;
import com.fzm.common.open.entity.dataobject.CopyrightApiAuthorDO;
import com.fzm.common.open.entity.dataobject.CopyrightApiDO;
import com.fzm.common.open.entity.dataobject.CopyrightApiFileDO;
import com.fzm.common.open.entity.dataobject.CopyrightApiOwnerRelationDO;
import com.fzm.common.open.entity.viewobject.CopyrightApiVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
......@@ -194,6 +199,63 @@ public class CopyrightRequest {
this.works_type_desc = "";
this.works_type_name = opusCategory.getValue();
}
public CopyrightDetail(CopyrightApiVO copyrightApiVO) {
CopyrightApiDO copyright = copyrightApiVO.getCopyright();
this.serial_code = copyright.getSerialNum();
this.affilia_photo = copyright.getAuthorityAscriptionProve();
this.agency_photo = copyright.getRegisterEntrust();
this.author_photo = "";
this.end_address = copyright.getOpusCompleteProvince() + copyright.getOpusCompleteCity();
this.end_time = DateUtil.format(copyright.getOpusCompleteDate(), "yyyy-MM-dd");
this.entrust_photo = "";
this.gain_code = AuthorityAcquire.getByType(copyright.getAuthorityAcquireMode());
this.gain_name = copyright.getAuthorityAcquireMode();
this.gain_photo = "";
List<CopyrightApiAuthorDO> authors = copyrightApiVO.getAuthors();
if (copyright.getAuthorityAscriptionMode().equals(AuthorityType.PERSONAL.getVal())) {
CopyrightApiAuthorDO author = authors.get(0);
this.geren_uname = author.getName();
this.geren_uxname = author.getSign();
this.geren_uxname_type = String.valueOf(SignatureType.getCode(author.getSignType()));
this.geren_uxname_type_name = author.getSignType();
} else {
for (CopyrightApiAuthorDO author : authors) {
this.cooperator.add(new Cooperator(author));
}
}
this.is_grade = 0;
this.nature_code = OpusProperty.getCode(copyright.getOpusProperty());
this.nature_desc = "";
this.nature_name = copyright.getOpusProperty();
this.other_photo = "";
for (CopyrightApiOwnerRelationDO copyrightOwner : copyrightApiVO.getOwners()) {
this.owner_list.add(new Owner(copyrightOwner));
}
this.publish_status = copyright.getPublishState() + 1;
if (this.publish_status == 2) {
this.publish_address = copyright.getFirstPublishProvince() + copyright.getFirstPublishCity();
this.publish_time = DateUtil.format(copyright.getFirstPublishDate(), "yyyy-MM-dd");
}
this.rights_affilia_code = AuthorityType.getByType(copyright.getAuthorityAscriptionMode());
this.rights_affilia_name = copyright.getAuthorityAscriptionMode();
this.rights_desc = StringUtils.join(
copyrightApiVO.getAuthorities().stream().map(
Authority::getId).collect(
Collectors.toList()), "、");
this.rights_guarantee_photo = copyright.getOpusPowerGuarantee();
this.works_create_desc = copyright.getCreateProcess();
this.works_desc = copyright.getContentSynopsis();
for (CopyrightApiFileDO file : copyrightApiVO.getFiles()) {
this.works_files.add(new WorksFile(file));
}
this.works_name = copyright.getOpusName();
OpusCategory opusCategory = copyrightApiVO.getOpusCategory();
this.works_type_code = String.valueOf(opusCategory.getId());
this.works_type_desc = "";
this.works_type_name = opusCategory.getValue();
}
}
......@@ -218,6 +280,13 @@ public class CopyrightRequest {
this.uxname = author.getSign();
this.signature_type_name = author.getSignType();
}
public Cooperator(CopyrightApiAuthorDO author) {
this.signature_type = String.valueOf(SignatureType.getCode(author.getSignType()));
this.uname = author.getName();
this.uxname = author.getSign();
this.signature_type_name = author.getSignType();
}
}
@Data
......@@ -318,6 +387,33 @@ public class CopyrightRequest {
this.valid_end_date = DateUtil.format(copyrightOwner.getEffectiveEndDate(), "yyyy-MM-dd");
}
}
public Owner(CopyrightApiOwnerRelationDO copyrightOwner) {
this.address = copyrightOwner.getProvince() + copyrightOwner.getCity();
this.back_photo = copyrightOwner.getPositivePhoto();
this.city = copyrightOwner.getCity();
this.city_id = copyrightOwner.getCityCode();
this.company_photo = copyrightOwner.getCertificatesPhoto();
this.document_code = copyrightOwner.getIdNumber();
this.document_image = "";
CertificatesType certificatesType = CertificatesType.getByType(copyrightOwner.getIdType());
this.document_type_code = certificatesType.getCode();
this.document_type_name = certificatesType.getValue();
this.front_photo = copyrightOwner.getBackPhoto();
this.handheld_photo = copyrightOwner.getPersonalPhoto();
this.is_forever = copyrightOwner.getIsEffective() == 1 ? 1 : 2;
this.owner_name = copyrightOwner.getOwner();
this.owner_sign_name = "";
this.owner_type_code = String.valueOf(copyrightOwner.getType() + 1);
this.owner_type_name = OwnerType.getByType(copyrightOwner.getCopyrightId());
this.prove_photo = copyrightOwner.getEntrustProve();
this.province = copyrightOwner.getProvince();
this.province_id = copyrightOwner.getProvinceCode();
this.valid_start_date = DateUtil.format(copyrightOwner.getEffectiveStartDate(), "yyyy-MM-dd");
if (this.is_forever == 2) {
this.valid_end_date = DateUtil.format(copyrightOwner.getEffectiveEndDate(), "yyyy-MM-dd");
}
}
}
......@@ -350,6 +446,15 @@ public class CopyrightRequest {
this.file_token = file.getFileHash();
this.keywords = "";
}
public WorksFile(CopyrightApiFileDO file) {
this.file = file.getFileUrl();
this.file_format = file.getFileSuffix();
this.file_name = file.getFileName();
this.file_size = String.valueOf(file.getFileSize());
this.file_token = file.getFileHash();
this.keywords = "";
}
}
......@@ -358,4 +463,9 @@ public class CopyrightRequest {
this.app_id = app_id;
this.sign = sign;
}
public CopyrightRequest(CopyrightApiVO copyrightApiVO, String app_id) {
this.biz_content = JSONUtil.toJsonStr(new CopyrightDetail(copyrightApiVO));
this.app_id = app_id;
}
}
\ No newline at end of file
......@@ -20,4 +20,6 @@ public interface AuthorityMapper extends BaseMapper<Authority> {
* @return
*/
List<Authority> getByCopyrightId(Integer copyrightId);
List<Authority> getApiByCopyrightId(Integer copyrightId);
}
package com.fzm.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fzm.common.open.entity.dataobject.CopyrightApiAuthorDO;
import org.apache.ibatis.annotations.Mapper;
/**
* @author tangtuo
* @date 2021/12/9 11:29
*/
@Mapper
public interface CopyrightApiAuthorMapper extends BaseMapper<CopyrightApiAuthorDO> {
}
package com.fzm.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fzm.common.open.entity.dataobject.CopyrightApiAuthorityRelationDO;
import org.apache.ibatis.annotations.Mapper;
/**
* @author tangtuo
* @date 2021/12/9 11:38
*/
@Mapper
public interface CopyrightApiAuthorityRelationMapper extends BaseMapper<CopyrightApiAuthorityRelationDO> {
}
package com.fzm.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fzm.common.open.entity.dataobject.CopyrightApiFileDO;
import org.apache.ibatis.annotations.Mapper;
/**
* @author tangtuo
* @date 2021/12/9 11:27
*/
@Mapper
public interface CopyrightApiFileMapper extends BaseMapper<CopyrightApiFileDO> {
}
package com.fzm.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fzm.common.open.entity.dataobject.CopyrightApiDO;
import com.fzm.common.open.entity.queryobject.CopyrightApiMapperQO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/9 11:27
*/
@Mapper
public interface CopyrightApiMapper extends BaseMapper<CopyrightApiDO> {
List<CopyrightApiDO> getList(CopyrightApiMapperQO mapperQO);
List<String> getSerialCodes();
}
package com.fzm.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fzm.common.open.entity.dataobject.CopyrightApiOwnerRelationDO;
import org.apache.ibatis.annotations.Mapper;
/**
* @author tangtuo
* @date 2021/12/13 11:24
*/
@Mapper
public interface CopyrightApiOwnerRelationMapper extends BaseMapper<CopyrightApiOwnerRelationDO> {
}
package com.fzm.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fzm.common.open.entity.dataobject.OpenKeyDO;
import org.apache.ibatis.annotations.Mapper;
/**
* @author tangtuo
* @date 2021/7/1 14:35
*/
@Mapper
public interface OpenKeyMapper extends BaseMapper<OpenKeyDO> {
}
package com.fzm.common.open.entity.dataobject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("tb_open_copyright_author")
public class CopyrightApiAuthorDO {
@TableId(type = IdType.AUTO)
private Integer id;
private Integer copyrightId;
private String name;
private String signType;
private String sign;
}
package com.fzm.common.open.entity.dataobject;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "tb_open_copyright_authority_relation")
public class CopyrightApiAuthorityRelationDO {
private Integer copyrightId;
private Integer authorityId;
}
package com.fzm.common.open.entity.dataobject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.Date;
@Data
@TableName("tb_open_copyright_apply")
public class CopyrightApiDO {
@TableId(type = IdType.AUTO)
private Integer id;
private String serialNum;
private String appKey;
private String appName;
private String bizId;
private String registerEntrust;
private String opusName;
private Integer opusCategoryId;
private String opusProperty;
private String contentSynopsis;
private String createProcess;
private Date opusCompleteDate;
private String opusCompleteProvince;
private String opusCompleteCity;
private Integer publishState;
private Date firstPublishDate;
private String firstPublishProvince;
private String firstPublishCity;
private String authorityAcquireMode;
private String authorityAcquireProve;
private String authorityAscriptionMode;
private String authorityAscriptionProve;
private String opusPowerGuarantee;
private Date applyTime;
private Date passTime;
private String checkUsername;
// 参考枚举类-com.fzm.common.enums.CopyrightApplyState
private Integer registerState;
private String evidenceHash;
private Date evidenceDate;
private String rejectReason;
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String content;
private String registerCode;
private String registerOwner;
private String registerTime;
private Date createDate;
private Date updateDate;
}
package com.fzm.common.open.entity.dataobject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("tb_open_copyright_file")
public class CopyrightApiFileDO {
@TableId(type = IdType.AUTO)
private Integer id;
private Integer copyrightId;
private String fileName;
private String fileUrl;
private String fileHash;
private String fileSuffix;
private Long fileSize;
}
package com.fzm.common.open.entity.dataobject;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* @author tangtuo
* @date 2021/12/13 11:22
*/
@Data
@TableName(value = "tb_open_copyright_apply_owner_relation")
public class CopyrightApiOwnerRelationDO {
private Integer copyrightId;
private Integer type;
private String owner;
private String idNumber;
private Integer isEffective;
private Date effectiveStartDate;
private Date effectiveEndDate;
private String province;
private String provinceCode;
private String city;
private String cityCode;
private Integer idType;
private String positivePhoto;
private String backPhoto;
private String personalPhoto;
private String certificatesPhoto;
private String entrustProve;
}
package com.fzm.common.open.entity.dataobject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @author wt
* @date 2022/4/24
*/
@Data
@TableName(value = "tb_open_key")
public class OpenKeyDO {
@TableId(type = IdType.AUTO)
private Integer id;
private String appKey;
private String appKeySecret;
private String appName;
}
package com.fzm.common.open.entity.openobject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @author wt
* @date 2022/4/24
*/
@Data
public class BaseOO<T> {
@NotBlank(message = "appKey不能为空")
@ApiModelProperty(value = "appKey")
private String appKey;
@NotBlank(message = "业务id不能为空")
@ApiModelProperty(value = "业务id")
private String bizId;
@NotBlank(message = "签名不能为空")
@ApiModelProperty("签名")
private String signature;
@NotNull(message = "数据不能为空")
@ApiModelProperty("数据")
private T data;
}
package com.fzm.common.open.entity.openobject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @author wt
* @date 2022/4/24
*/
@Data
public class CopyrightAuthorOO {
@NotBlank(message = "作者姓名不能为空")
@ApiModelProperty(value = "作者姓名或名称")
private String name;
@NotBlank(message = "署名类型不能为空")
@ApiModelProperty(value = "署名类型 (本名 | 别名 | 匿名)")
private String signType;
@NotBlank(message = "签名不能为空")
@ApiModelProperty(value = "签名")
private String sign;
}
package com.fzm.common.open.entity.openobject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @author wt
* @date 2022/4/24
*/
@Data
public class CopyrightFileOO {
@NotBlank(message = "附件名不能为空")
@ApiModelProperty("附件名")
private String fileName;
@NotBlank(message = "附件路径不能为空")
@ApiModelProperty("附件路径")
private String fileUrl;
@NotBlank(message = "文件hash不能为空")
@ApiModelProperty("文件hash")
private String fileHash;
@NotBlank(message = "文件扩展名不能为空")
@ApiModelProperty("文件扩展名")
private String fileSuffix;
@NotBlank(message = "文件大小不能为空")
@ApiModelProperty("文件大小")
private Long fileSize;
}
package com.fzm.common.open.entity.openobject;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/9 14:35
*/
@Data
public class CopyrightOO {
@NotBlank(message = "登记委托书不能为空")
@ApiModelProperty(value = "登记委托书")
private String registerEntrust;
@NotBlank(message = "作品名称不能为空")
@ApiModelProperty(value = "作品名称")
private String opusName;
@NotNull(message = "作品类别id不能为空")
@ApiModelProperty(value = "作品类别id")
private Integer opusCategoryId;
@NotBlank(message = "作品性质不能为空")
@ApiModelProperty(value = "作品性质")
private String opusProperty;
@NotBlank(message = "内容简介不能为空")
@ApiModelProperty(value = "内容简介")
private String contentSynopsis;
@NotBlank(message = "创作过程不能为空")
@ApiModelProperty(value = "创作过程")
private String createProcess;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@NotNull(message = "作品完成日期不能为空")
@ApiModelProperty(value = "作品完成日期,yyyy-MM-dd")
private Date opusCompleteDate;
@NotBlank(message = "作品完成省份不能为空")
@ApiModelProperty(value = "作品完成省份")
private String opusCompleteProvince;
@NotBlank(message = "作品完成城市不能为空")
@ApiModelProperty(value = "作品完成城市")
private String opusCompleteCity;
@NotNull(message = "发表状态不能为空")
@ApiModelProperty(value = "'发表状态 0-未发表 1-已发表")
private Integer publishState;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "首次发表日期,yyyy-MM-dd")
private Date firstPublishDate;
@ApiModelProperty(value = "首次发表省份")
private String firstPublishProvince;
@ApiModelProperty(value = "首次发表城市")
private String firstPublishCity;
@NotBlank(message = "权力取得方式不能为空")
@ApiModelProperty(value = "权力取得方式")
private String authorityAcquireMode;
@ApiModelProperty(value = "权力取得证明材料")
private String authorityAcquireProve;
@NotBlank(message = "权力归属方式不能为空")
@ApiModelProperty(value = "权力归属方式")
private String authorityAscriptionMode;
@ApiModelProperty(value = "权力归属证明材料的文件地址")
private String authorityAscriptionProve;
@NotBlank(message = "作品权力保证书不能为空")
@ApiModelProperty(value = "作品权力保证书")
private String opusPowerGuarantee;
@NotEmpty(message = "作者列表不能为空")
@ApiModelProperty(value = "作者列表")
private List<CopyrightAuthorOO> authors;
@NotEmpty(message = "您还未选择任何著作权人")
@ApiModelProperty(value = "著作权人列表")
private List<CopyrightOwnerOO> owners;
@NotEmpty(message = "您还未勾选任何权力拥有情况")
@ApiModelProperty("权力id集合")
private List<Integer> authorityIds;
@NotEmpty(message = "您还没有上传任何文件作品")
@ApiModelProperty("文件列表")
private List<CopyrightFileOO> files;
@ApiModelProperty("内容")
private String content;
}
package com.fzm.common.open.entity.openobject;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* @author wt
* @date 2022/4/24
*/
@Data
public class CopyrightOwnerOO {
@NotNull(message = "著作权人类型不能为空")
@ApiModelProperty(value = "类别 0-自然人 1-法人")
private Integer type;
@NotBlank(message = "著作权人不能为空")
@ApiModelProperty(value = "著作权人")
private String owner;
@NotBlank(message = "证件号码不能为空")
@ApiModelProperty(value = "证件号码")
private String idNumber;
@NotNull(message = "证件是否长期有效不能为空")
@ApiModelProperty(value = "是否长期有效 0-否 1-是")
private Integer isEffective;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@NotNull(message = "证件有效期起始时间不能为空")
@ApiModelProperty(value = "证件有效起止时间")
private Date effectiveStartDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "证件有效终止时间")
private Date effectiveEndDate;
@NotBlank(message = "用户所在省份不能为空")
@ApiModelProperty(value = "用户所在省份")
private String province;
@NotBlank(message = "用户所在省份code不能为空")
@ApiModelProperty(value = "用户所在省份code")
private String provinceCode;
@NotBlank(message = "用户所在城市不能为空")
@ApiModelProperty(value = "用户所在城市")
private String city;
@NotBlank(message = "用户所在城市code不能为空")
@ApiModelProperty(value = "用户所在城市code")
private String cityCode;
@NotNull(message = "证件类型不能为空")
@ApiModelProperty(value = "证件类型 0-身份证 1-营业执照 2-企业法人营业执照 3-组织机构代码证书 4-事业单位法人证书 5-社团法人证书 6-统一社会信用代码 7其他有效证件")
private Integer idType;
@ApiModelProperty(value = "正面照片 (身份证人像面照片)")
private String positivePhoto;
@ApiModelProperty(value = "反面照片(身份证国徽面照片)")
private String backPhoto;
@ApiModelProperty(value = "手持身份证照片")
private String personalPhoto;
@ApiModelProperty(value = "证件照片(营业执照等)")
private String certificatesPhoto;
@ApiModelProperty(value = "委托证明")
private String entrustProve;
}
package com.fzm.common.open.entity.queryobject;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author wt
* @date 2022/4/24
*/
@Data
public class CopyrightApiMapperQO {
private String serialNum;
private Integer state;
private String appKey;
private LocalDateTime startDate;
private LocalDateTime endDate;
}
package com.fzm.common.open.entity.queryobject;
import lombok.Data;
/**
* @author wt
* @date 2022/4/24
*/
@Data
public class CopyrightApiQO {
private Integer page;
private Integer size;
private String serialNum;
private Integer state;
private String appKey;
private String startDate;
private String endDate;
public Integer getPage() {
return page == null ? 1 : page < 1 ? 1 : page;
}
public Integer getSize() {
return size == null ? 40 : size < 1 ? 40 : size > 200 ? 200 : size;
}
}
package com.fzm.common.open.entity.queryobject;
import lombok.Data;
/**
* @author wt
* @date 2022/4/24
*/
@Data
public class CopyrightManagerQO {
private Integer id;
private String rejectReason;
}
package com.fzm.common.open.entity.viewobject;
import com.fzm.common.entity.Authority;
import com.fzm.common.entity.OpusCategory;
import com.fzm.common.open.entity.dataobject.CopyrightApiAuthorDO;
import com.fzm.common.open.entity.dataobject.CopyrightApiDO;
import com.fzm.common.open.entity.dataobject.CopyrightApiFileDO;
import com.fzm.common.open.entity.dataobject.CopyrightApiOwnerRelationDO;
import lombok.Data;
import java.util.List;
/**
* @author wt
* @date 2022/4/24
*/
@Data
public class CopyrightApiVO {
private CopyrightApiDO copyright;
private OpusCategory opusCategory;
private List<CopyrightApiFileDO> files;
private List<CopyrightApiAuthorDO> authors;
private List<Authority> authorities;
private List<CopyrightApiOwnerRelationDO> owners;
}
package com.fzm.common.open.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.open.entity.dataobject.CopyrightApiAuthorDO;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/9 11:41
*/
public interface CopyrightApiAuthorService extends IService<CopyrightApiAuthorDO> {
/**
* 根据版权id查询作者列表
*
* @param copyrightId
* @return
*/
List<CopyrightApiAuthorDO> getByCopyrightId(int copyrightId);
}
package com.fzm.common.open.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.open.entity.dataobject.CopyrightApiAuthorityRelationDO;
/**
* @author tangtuo
* @date 2021/12/9 11:44
*/
public interface CopyrightApiAuthorityRelationService extends IService<CopyrightApiAuthorityRelationDO> {
}
package com.fzm.common.open.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.open.entity.dataobject.CopyrightApiFileDO;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/9 11:43
*/
public interface CopyrightApiFileService extends IService<CopyrightApiFileDO> {
/**
* 根据版权id查询
*
* @param copyrightId
* @return
*/
List<CopyrightApiFileDO> getByCopyrightId(Integer copyrightId);
}
package com.fzm.common.open.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.open.entity.dataobject.CopyrightApiOwnerRelationDO;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/13 11:24
*/
public interface CopyrightApiOwnerRelationService extends IService<CopyrightApiOwnerRelationDO> {
/**
* 根据版权id查询
*
* @param copyrightId
* @return
*/
List<CopyrightApiOwnerRelationDO> getByCopyrightId(Integer copyrightId);
}
package com.fzm.common.open.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.entity.CopyrightOwner;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/9 11:40
*/
public interface CopyrightApiOwnerService extends IService<CopyrightOwner> {
/**
* 根据著作权id查询列表
*
* @param copyrightId
* @return
*/
List<CopyrightOwner> getByCopyrightId(Integer copyrightId);
}
package com.fzm.common.open.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.open.entity.dataobject.CopyrightApiDO;
import com.fzm.common.open.entity.dataobject.OpenKeyDO;
import com.fzm.common.open.entity.openobject.BaseOO;
import com.fzm.common.open.entity.openobject.CopyrightOO;
import com.fzm.common.open.entity.queryobject.CopyrightApiQO;
import com.fzm.common.open.entity.viewobject.CopyrightApiVO;
import com.github.pagehelper.PageInfo;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/9 11:40
*/
public interface CopyrightApiService extends IService<CopyrightApiDO> {
Integer apply(BaseOO<CopyrightOO> baseOO, OpenKeyDO openKeyDO);
CopyrightApiDO getByAppKeyAndBizId(String appKey, String bizId);
PageInfo<CopyrightApiDO> pages(CopyrightApiQO copyrightApiQO);
CopyrightApiVO getDetail(Integer id);
void pass(Integer id);
void reject(Integer id, String rejectReason);
List<String> getSerialCodes();
CopyrightApiDO getBySerialNum(String serialCode);
}
package com.fzm.common.open.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.open.entity.dataobject.OpenKeyDO;
/**
* @author wt
* @date 2022/4/24
*/
public interface OpenKeyService extends IService<OpenKeyDO> {
OpenKeyDO getByAppKey(String appKey);
}
package com.fzm.common.open.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.mapper.CopyrightApiAuthorMapper;
import com.fzm.common.open.entity.dataobject.CopyrightApiAuthorDO;
import com.fzm.common.open.service.CopyrightApiAuthorService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/9 11:41
*/
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApiAuthorServiceImpl extends ServiceImpl<CopyrightApiAuthorMapper, CopyrightApiAuthorDO> implements CopyrightApiAuthorService {
private final CopyrightApiAuthorMapper copyrightApiAuthorMapper;
@Override
public List<CopyrightApiAuthorDO> getByCopyrightId(int copyrightId) {
QueryWrapper<CopyrightApiAuthorDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("copyright_id", copyrightId);
return copyrightApiAuthorMapper.selectList(queryWrapper);
}
}
package com.fzm.common.open.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.mapper.CopyrightApiAuthorityRelationMapper;
import com.fzm.common.open.entity.dataobject.CopyrightApiAuthorityRelationDO;
import com.fzm.common.open.service.CopyrightApiAuthorityRelationService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author tangtuo
* @date 2021/12/9 11:44
*/
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApiAuthorityRelationServiceImpl extends ServiceImpl<CopyrightApiAuthorityRelationMapper, CopyrightApiAuthorityRelationDO> implements CopyrightApiAuthorityRelationService {
}
package com.fzm.common.open.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.mapper.CopyrightApiFileMapper;
import com.fzm.common.open.entity.dataobject.CopyrightApiFileDO;
import com.fzm.common.open.service.CopyrightApiFileService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/9 11:43
*/
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApiFileServiceImpl extends ServiceImpl<CopyrightApiFileMapper, CopyrightApiFileDO> implements CopyrightApiFileService {
private final CopyrightApiFileMapper copyrightApiFileMapper;
@Override
public List<CopyrightApiFileDO> getByCopyrightId(Integer copyrightId) {
QueryWrapper<CopyrightApiFileDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("copyright_id", copyrightId);
return copyrightApiFileMapper.selectList(queryWrapper);
}
}
package com.fzm.common.open.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.mapper.CopyrightApiOwnerRelationMapper;
import com.fzm.common.open.entity.dataobject.CopyrightApiOwnerRelationDO;
import com.fzm.common.open.service.CopyrightApiOwnerRelationService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/13 11:25
*/
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApiOwnerRelationServiceImpl extends ServiceImpl<CopyrightApiOwnerRelationMapper, CopyrightApiOwnerRelationDO> implements CopyrightApiOwnerRelationService {
@Override
public List<CopyrightApiOwnerRelationDO> getByCopyrightId(Integer copyrightId) {
QueryWrapper<CopyrightApiOwnerRelationDO> wrapper = new QueryWrapper<>();
wrapper.eq("copyright_id", copyrightId);
return this.list(wrapper);
}
}
package com.fzm.common.open.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.CopyrightOwner;
import com.fzm.common.mapper.CopyrightOwnerMapper;
import com.fzm.common.open.service.CopyrightApiOwnerService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author tangtuo
* @date 2021/12/9 11:40
*/
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApiOwnerServiceImpl extends ServiceImpl<CopyrightOwnerMapper, CopyrightOwner> implements CopyrightApiOwnerService {
private final CopyrightOwnerMapper ownerMapper;
@Override
public List<CopyrightOwner> getByCopyrightId(Integer copyrightId) {
return ownerMapper.getByCopyrightId(copyrightId);
}
}
package com.fzm.common.open.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.mapper.OpenKeyMapper;
import com.fzm.common.open.entity.dataobject.OpenKeyDO;
import com.fzm.common.open.service.OpenKeyService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author wt
* @date 2022/4/24
*/
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OpenKeyServiceImpl extends ServiceImpl<OpenKeyMapper, OpenKeyDO> implements OpenKeyService {
@Override
public OpenKeyDO getByAppKey(String appKey) {
QueryWrapper<OpenKeyDO> wrapper = new QueryWrapper<>();
wrapper.eq("app_key", appKey);
return getOne(wrapper);
}
}
......@@ -21,4 +21,6 @@ public interface AuthorityService extends IService<Authority> {
* @return
*/
List<Authority> getByCopyrightId(Integer id);
List<Authority> getApiByCopyrightId(Integer id);
}
......@@ -31,4 +31,9 @@ public class AuthorityServiceImpl extends ServiceImpl<AuthorityMapper, Authority
public List<Authority> getByCopyrightId(Integer copyrightId) {
return authorityMapper.getByCopyrightId(copyrightId);
}
@Override
public List<Authority> getApiByCopyrightId(Integer id) {
return authorityMapper.getApiByCopyrightId(id);
}
}
......@@ -154,11 +154,11 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
CopyrightAuthorityRelation relation = new CopyrightAuthorityRelation(copyrightApply.getId(), authorityId);
relations.add(relation);
}
copyrightAuthorityRelationService.saveBatch(relations);
// 如果是从草稿箱进来的需要删除草稿信息
if (copyrightDTO.getDraftId() != null) {
draftService.removeById(copyrightDTO.getDraftId());
}
copyrightAuthorityRelationService.saveBatch(relations);
return copyrightApply.getId();
}
......
......@@ -9,4 +9,10 @@
where id in
(select authority_id from tb_copyright_authority_relation where copyright_id = #{copyrightId})
</select>
<select id="getApiByCopyrightId" resultType="com.fzm.common.entity.Authority">
select *
from tb_authority
where id in
(select authority_id from tb_open_copyright_authority_relation where copyright_id = #{copyrightId})
</select>
</mapper>
\ No newline at end of file
<?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="com.fzm.common.mapper.CopyrightApiMapper">
<select id="getList" resultType="com.fzm.common.open.entity.dataobject.CopyrightApiDO">
select *
from tb_open_copyright_apply
<where>
<if test="serialNum != null and serialNum != ''">
and serial_num = #{serialNum}
</if>
<if test="state != null">
and register_state = #{state}
</if>
<if test="appKey != null and appKey != ''">
and app_key = #{appKey}
</if>
<if test="startDate != null">
and apply_time >= #{startDate}
</if>
<if test="endDate != null">
and apply_time &lt;= #{endDate}
</if>
</where>
</select>
<select id="getSerialCodes" resultType="java.lang.String">
SELECT serial_num
FROM tb_open_copyright_apply
WHERE register_state IN (2, 6, 7)
</select>
</mapper>
\ No newline at end of file
package com.fzm.portal.controller.open;
import com.fzm.common.constant.SystemConstant;
import com.fzm.common.entity.vo.CopyrightStateVo;
import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException;
import com.fzm.common.model.ResponseModel;
import com.fzm.common.open.entity.dataobject.CopyrightApiDO;
import com.fzm.common.open.entity.dataobject.OpenKeyDO;
import com.fzm.common.open.entity.openobject.BaseOO;
import com.fzm.common.open.entity.openobject.CopyrightAuthorOO;
import com.fzm.common.open.entity.openobject.CopyrightOO;
import com.fzm.common.open.entity.openobject.CopyrightOwnerOO;
import com.fzm.common.open.service.CopyrightApiService;
import com.fzm.common.open.service.OpenKeyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* @author wt
* @date 2022/4/24
*/
@RestController
@Api(tags = "Api版权服务")
@RequestMapping("/api/copyright")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApiController {
private final OpenKeyService openKeyService;
private final CopyrightApiService copyrightApiService;
@PostMapping("/apply")
@ApiOperation("/申请版权")
public ResponseModel<Integer> apply(@Validated @RequestBody BaseOO<CopyrightOO> baseOO) {
String appKey = baseOO.getAppKey();
OpenKeyDO openKeyDO = openKeyService.getByAppKey(appKey);
if (openKeyDO == null) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
String bizId = baseOO.getBizId();
CopyrightApiDO apiDO = copyrightApiService.getByAppKeyAndBizId(appKey, bizId);
if (apiDO != null) {
return ResponseModel.success(apiDO.getId());
}
CopyrightOO copyrightOO = baseOO.getData();
Integer publishState = copyrightOO.getPublishState();
if (publishState == null || publishState != 0 && publishState != 1) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
// 如果发表状态是已发表的话,需要传入首次发表日期和省市
if (SystemConstant.BOOLEAN_DATA_TRUE.equals(publishState) &&
(copyrightOO.getFirstPublishDate() == null ||
StringUtils.isAnyBlank(copyrightOO.getFirstPublishCity(), copyrightOO.getFirstPublishProvince()))) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
List<CopyrightAuthorOO> authors = copyrightOO.getAuthors();
for (CopyrightAuthorOO author : authors) {
String signType = author.getSignType();
if (!"本名".equals(signType) && !"别名".equals(signType) && !"匿名".equals(signType)) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
}
List<CopyrightOwnerOO> owners = copyrightOO.getOwners();
for (CopyrightOwnerOO owner : owners) {
Integer type = owner.getType();
if (type != 0 && type != 1) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
Integer isEffective = owner.getIsEffective();
if (isEffective != 0 && isEffective != 1) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
if (isEffective == 0) {
Date endDate = owner.getEffectiveEndDate();
if (endDate == null) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
}
Integer idType = owner.getIdType();
if (idType < 0 || idType > 7) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
if (idType == 0) {
String positivePhoto = owner.getPositivePhoto();
String backPhoto = owner.getBackPhoto();
String personalPhoto = owner.getPersonalPhoto();
if (StringUtils.isAnyBlank(positivePhoto, backPhoto, personalPhoto)) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
} else {
String certificatesPhoto = owner.getCertificatesPhoto();
if (StringUtils.isBlank(certificatesPhoto)) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
}
}
}
Integer apply = copyrightApiService.apply(baseOO, openKeyDO);
return ResponseModel.success(apply);
}
@GetMapping(value = "/state")
@ApiOperation(value = "获取状态")
public ResponseModel<CopyrightStateVo> getCopyrightState(@RequestParam(required = false) Integer id,
@RequestParam(required = false) String appKey,
@RequestParam(required = false) String bizId) {
CopyrightApiDO apiDO = null;
if (id != null) {
apiDO = copyrightApiService.getById(id);
}
if (StringUtils.isNoneBlank(appKey, bizId)) {
apiDO = copyrightApiService.getByAppKeyAndBizId(appKey, bizId);
}
if (apiDO == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "请核对后再重试");
}
CopyrightStateVo copyrightStateVo = new CopyrightStateVo(CopyrightApplyState.getByState(apiDO.getRegisterState()), apiDO.getRejectReason());
return ResponseModel.success(copyrightStateVo);
}
}
This diff is collapsed.
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