Commit 14afe01e authored by tangtuo's avatar tangtuo

v1.0.0功能开发

parent 54c5ff50
...@@ -43,7 +43,7 @@ public class CopyrightApplyController { ...@@ -43,7 +43,7 @@ public class CopyrightApplyController {
@PostMapping(value = "/pass") @PostMapping(value = "/pass")
@ApiOperation(value = "通过") @ApiOperation(value = "通过")
public ResponseModel<Boolean> pass(@RequestParam Integer id) { public ResponseModel<Boolean> pass(@RequestParam Integer id) throws ExecutionException, InterruptedException {
boolean result = copyrightApplyService.pass(id); boolean result = copyrightApplyService.pass(id);
return ResponseModel.success(result); return ResponseModel.success(result);
} }
......
...@@ -82,3 +82,8 @@ aliyun: ...@@ -82,3 +82,8 @@ aliyun:
simple-bucket: test-nft simple-bucket: test-nft
encrypt-bucket: test-nft-2 encrypt-bucket: test-nft-2
copyright:
url: https://p.yareiot.com/ccct/api/copyright/create
app-id: 289391457858
app-secret: xExjKUCYH1nrze6Hpxf8s1dYWdxEggo2FiwKlZKygCItOV7E8bFhkyr4C192uhK
...@@ -61,10 +61,16 @@ public class CopyrightApplyOwnerRelation { ...@@ -61,10 +61,16 @@ public class CopyrightApplyOwnerRelation {
@ApiModelProperty(value = "用户所在省份") @ApiModelProperty(value = "用户所在省份")
private String province; private String province;
@ApiModelProperty(value = "用户所在省份code")
private String provinceCode;
@NotBlank(message = "用户所在城市不能为空") @NotBlank(message = "用户所在城市不能为空")
@ApiModelProperty(value = "用户所在城市") @ApiModelProperty(value = "用户所在城市")
private String city; private String city;
@ApiModelProperty(value = "用户所在城市code")
private String cityCode;
@ApiModelProperty(value = "证件类型 0-身份证 1-营业执照 2-企业法人营业执照 3-组织机构代码证书 4-事业单位法人证书 5-社团法人证书 6-统一社会信用代码 7其他有效证件") @ApiModelProperty(value = "证件类型 0-身份证 1-营业执照 2-企业法人营业执照 3-组织机构代码证书 4-事业单位法人证书 5-社团法人证书 6-统一社会信用代码 7其他有效证件")
private Integer idType; private Integer idType;
......
...@@ -38,6 +38,9 @@ public class CopyrightFile { ...@@ -38,6 +38,9 @@ public class CopyrightFile {
@ApiModelProperty("文件扩展名") @ApiModelProperty("文件扩展名")
private String fileSuffix; private String fileSuffix;
@ApiModelProperty("文件大小")
private long fileSize;
private Date createDate; private Date createDate;
private Date updateDate; private Date updateDate;
......
...@@ -60,10 +60,18 @@ public class CopyrightOwner { ...@@ -60,10 +60,18 @@ public class CopyrightOwner {
@ApiModelProperty(value = "用户所在省份") @ApiModelProperty(value = "用户所在省份")
private String province; private String province;
@NotBlank(message = "用户所在省份code不能为空")
@ApiModelProperty(value = "用户所在省份code")
private String provinceCode;
@NotBlank(message = "用户所在城市不能为空") @NotBlank(message = "用户所在城市不能为空")
@ApiModelProperty(value = "用户所在城市") @ApiModelProperty(value = "用户所在城市")
private String city; private String city;
@NotBlank(message = "用户所在城市code不能为空")
@ApiModelProperty(value = "用户所在城市code")
private String cityCode;
@ApiModelProperty(value = "证件类型 0-身份证 1-营业执照 2-企业法人营业执照 3-组织机构代码证书 4-事业单位法人证书 5-社团法人证书 6-统一社会信用代码 7其他有效证件") @ApiModelProperty(value = "证件类型 0-身份证 1-营业执照 2-企业法人营业执照 3-组织机构代码证书 4-事业单位法人证书 5-社团法人证书 6-统一社会信用代码 7其他有效证件")
private Integer idType; private Integer idType;
......
...@@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; 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.Date;
import java.util.List; import java.util.List;
...@@ -18,39 +21,49 @@ public class CopyrightDTO { ...@@ -18,39 +21,49 @@ public class CopyrightDTO {
@ApiModelProperty("主键") @ApiModelProperty("主键")
private Integer id; private Integer id;
@NotBlank(message = "nft哈希不能为空")
@ApiModelProperty(value = "nft哈希") @ApiModelProperty(value = "nft哈希")
private String nftHash; private String nftHash;
@NotBlank(message = "nft名称不能为空")
@ApiModelProperty(value = "nft名称") @ApiModelProperty(value = "nft名称")
private String nftName; private String nftName;
@NotBlank(message = "作品名称不能为空")
@ApiModelProperty(value = "作品名称") @ApiModelProperty(value = "作品名称")
private String opusName; private String opusName;
@NotNull(message = "作品类别id不能为空")
@ApiModelProperty(value = "作品类别id") @ApiModelProperty(value = "作品类别id")
private Integer opusCategoryId; private Integer opusCategoryId;
@NotBlank(message = "作品性质不能为空")
@ApiModelProperty(value = "作品性质") @ApiModelProperty(value = "作品性质")
private String opusProperty; private String opusProperty;
@NotBlank(message = "内容简介不能为空")
@ApiModelProperty(value = "内容简介") @ApiModelProperty(value = "内容简介")
private String contentSynopsis; private String contentSynopsis;
@NotBlank(message = "创作过程不能为空")
@ApiModelProperty(value = "创作过程") @ApiModelProperty(value = "创作过程")
private String createProcess; private String createProcess;
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "作品完成日期 格式:yyyy-MM-dd") @NotNull(message = "作品完成日期不能为空")
@ApiModelProperty(value = "作品完成日期")
private Date opusCompleteDate; private Date opusCompleteDate;
@NotBlank(message = "作品完成省份不能为空")
@ApiModelProperty(value = "作品完成省份") @ApiModelProperty(value = "作品完成省份")
private String opusCompleteProvince; private String opusCompleteProvince;
@NotBlank(message = "作品完成城市不能为空")
@ApiModelProperty(value = "作品完成城市") @ApiModelProperty(value = "作品完成城市")
private String opusCompleteCity; private String opusCompleteCity;
@NotNull(message = "发表状态不能为空")
@ApiModelProperty(value = "'发表状态 0-未发表 1-已发表") @ApiModelProperty(value = "'发表状态 0-未发表 1-已发表")
private Integer publishState; private Integer publishState;
...@@ -65,62 +78,81 @@ public class CopyrightDTO { ...@@ -65,62 +78,81 @@ public class CopyrightDTO {
@ApiModelProperty(value = "首次发表城市") @ApiModelProperty(value = "首次发表城市")
private String firstPublishCity; private String firstPublishCity;
@NotBlank(message = "权力取得方式不能为空")
@ApiModelProperty(value = "权力取得方式") @ApiModelProperty(value = "权力取得方式")
private String authorityAcquireMode; private String authorityAcquireMode;
@NotBlank(message = "权力取得证明材料不能为空")
@ApiModelProperty(value = "权力取得证明材料的文件地址") @ApiModelProperty(value = "权力取得证明材料的文件地址")
private String authorityAcquireProve; private String authorityAcquireProve;
@NotBlank(message = "权力归属方式不能为空")
@ApiModelProperty(value = "权力归属方式") @ApiModelProperty(value = "权力归属方式")
private String authorityAscriptionMode; private String authorityAscriptionMode;
@NotBlank(message = "权力归属证明材料不能为空")
@ApiModelProperty(value = "权力归属证明材料的文件地址") @ApiModelProperty(value = "权力归属证明材料的文件地址")
private String authorityAscriptionProve; private String authorityAscriptionProve;
@NotEmpty(message = "作者列表不能为空")
@ApiModelProperty(value = "作者列表") @ApiModelProperty(value = "作者列表")
private List<Author> authors; private List<Author> authors;
@NotEmpty(message = "您还未选择任何著作权人")
@ApiModelProperty(value = "著作权人id列表") @ApiModelProperty(value = "著作权人id列表")
private List<Integer> ownerIds; private List<Integer> ownerIds;
@ApiModelProperty("文件列表") @NotEmpty(message = "您还未勾选任何权力拥有情况")
private List<File> files;
@ApiModelProperty("权力id集合") @ApiModelProperty("权力id集合")
private List<Integer> authorityIds; private List<Integer> authorityIds;
@ApiModelProperty("json串") @ApiModelProperty("json串")
private String content; private String content;
@Data @NotEmpty(message = "您还没有上传任何文件作品")
public static class Author { @ApiModelProperty("文件列表")
private List<File> files;
@ApiModelProperty(value = "作者姓名或名称")
private String name;
@ApiModelProperty(value = "署名类型 (本名 | 别名 | 匿名)")
private String signType;
@ApiModelProperty(value = "签名")
private String sign;
}
@Data @Data
public static class File { public static class File {
@NotBlank(message = "附件名不能为空")
@ApiModelProperty("附件名") @ApiModelProperty("附件名")
private String fileName; private String fileName;
@NotBlank(message = "附件路径不能为空")
@ApiModelProperty("附件路径") @ApiModelProperty("附件路径")
private String fileUrl; private String fileUrl;
@NotBlank(message = "文件hash不能为空")
@ApiModelProperty("文件hash") @ApiModelProperty("文件hash")
private String fileHash; private String fileHash;
@NotBlank(message = "文件扩展名不能为空")
@ApiModelProperty("文件扩展名") @ApiModelProperty("文件扩展名")
private String fileSuffix; private String fileSuffix;
@NotBlank(message = "文件大小不能为空")
@ApiModelProperty("文件大小")
private long fileSize;
}
@Data
public static class Author {
@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.entity.dto;
import lombok.Data;
/**
* @author tangtuo
* @date 2021/12/21 15:35
*/
@Data
public class CopyrightResponse {
private int code;
private String message;
private String serial_code;
private String sign;
private boolean success;
private String timestamp;
}
package com.fzm.common.entity.vo; package com.fzm.common.entity.vo;
import com.fzm.common.enums.CopyrightApplyStateEnum; import com.fzm.common.enums.CopyrightApplyState;
import lombok.Data; import lombok.Data;
/** /**
...@@ -14,10 +14,10 @@ public class CopyrightStateVo { ...@@ -14,10 +14,10 @@ public class CopyrightStateVo {
private String value; private String value;
private String msg; private String msg;
public CopyrightStateVo(CopyrightApplyStateEnum stateEnum, String rejectReason) { public CopyrightStateVo(CopyrightApplyState stateEnum, String rejectReason) {
this.code = stateEnum.getCode(); this.code = stateEnum.getCode();
this.value = stateEnum.getValue(); this.value = stateEnum.getValue();
if (stateEnum.equals(CopyrightApplyStateEnum.REJECTED)) { if (stateEnum.equals(CopyrightApplyState.REJECTED)) {
this.msg = rejectReason; this.msg = rejectReason;
} else { } else {
this.msg = stateEnum.getMsg(); this.msg = stateEnum.getMsg();
......
...@@ -9,7 +9,7 @@ import lombok.Getter; ...@@ -9,7 +9,7 @@ import lombok.Getter;
*/ */
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum AuthStatusEnum { public enum AuthStatus {
NOT(0, "未认证"), NOT(0, "未认证"),
SUCCESS(1, "认证成功"), SUCCESS(1, "认证成功"),
......
...@@ -7,7 +7,7 @@ import lombok.Getter; ...@@ -7,7 +7,7 @@ import lombok.Getter;
* @date 2021/6/28 11:47 * @date 2021/6/28 11:47
*/ */
@Getter @Getter
public enum AuthTypeEnum { public enum AuthType {
PERSON(0,"个人认证"), PERSON(0,"个人认证"),
ENTERPRISE(1,"企业认证") ENTERPRISE(1,"企业认证")
...@@ -16,7 +16,7 @@ public enum AuthTypeEnum { ...@@ -16,7 +16,7 @@ public enum AuthTypeEnum {
private String desc; private String desc;
AuthTypeEnum(Integer type, String desc) { AuthType(Integer type, String desc) {
this.type = type; this.type = type;
this.desc = desc; this.desc = desc;
} }
......
...@@ -9,21 +9,20 @@ import lombok.Getter; ...@@ -9,21 +9,20 @@ import lombok.Getter;
*/ */
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum AuthorityTypeEnum { public enum AuthorityAcquire {
PERSONAL(0, "个人作品"), ORIGINAL(1, "原始"),
COOPERATION(1, "合作作品"), EXTEND(2, "继承"),
LEGAL(2, "法人作品"), BEAR(3, "承受"),
POST(3, "职务作品"), OTHER(4, "其他"),
ENTRUST(4, "委托作品"),
; ;
private int code; private int code;
private String val; private String val;
public static int getByType(String type) { public static int getByType(String type) {
for (AuthorityTypeEnum value : AuthorityTypeEnum.values()) { for (AuthorityAcquire value : AuthorityAcquire.values()) {
if (value.getVal().equals(type)) { if (value.getVal().equals(type)) {
return value.getCode(); return value.getCode();
} }
......
package com.fzm.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author tangtuo
* @date 2021/12/9 17:42
*/
@Getter
@AllArgsConstructor
public enum AuthorityType {
PERSONAL(1, "个人作品"),
COOPERATION(2, "合作作品"),
LEGAL(3, "法人作品"),
POST(4, "职务作品"),
ENTRUST(5, "委托作品"),
;
private int code;
private String val;
public static int getByType(String type) {
for (AuthorityType value : AuthorityType.values()) {
if (value.getVal().equals(type)) {
return value.getCode();
}
}
return 0;
}
}
package com.fzm.common.enums;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author tangtuo
* @date 2021/12/20 17:35
*/
@AllArgsConstructor
@Getter
public enum CertificatesType {
ID(1, "省内身份证", 0),
BUSINESS_LICENSE(2, "营业执照", 1),
ENTERPRISE_LEGAL(3, "企业法人营业执照", 2),
ORGANIZATION(4, "组织机构代码证书", 3),
GOVERNMENT_AFFILIATED_INSTITUTIONS(5, "事业单位法人证书", 4),
ASSOCIATION(6, "社团法人证书", 5),
OTHER_VALID(7, "其他有效证件", 7),
OTHER_CERTIFICATES(8, "组织机构代码证书/其他证书", -1),
OTHERS(9, "其他证件", -1),
OFFICERS(10, "军官证", -1),
STUDENTS(11, "学生证", -1),
USCC(12, "统一社会信用代码", 6),
;
@ApiModelProperty(value = "证件类型编码(湖北版权局)")
private int code;
private String value;
//0-身份证 1-营业执照 2-企业法人营业执照 3-组织机构代码证书 4-事业单位法人证书 5-社团法人证书 6-统一社会信用代码 7其他有效证件
@ApiModelProperty(value = "数据库对应的每种证件类型的type")
private int type;
public static CertificatesType getByType(int type) {
for (CertificatesType value : CertificatesType.values()) {
if (value.getType() == type) {
return value;
}
}
return ID;
}
}
package com.fzm.common.enums; package com.fzm.common.enums;
import cn.hutool.json.JSONUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
...@@ -12,7 +11,7 @@ import lombok.ToString; ...@@ -12,7 +11,7 @@ import lombok.ToString;
@ToString @ToString
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum CopyrightApplyStateEnum { public enum CopyrightApplyState {
WITHDRAW(-1, "已撤回", ""), WITHDRAW(-1, "已撤回", ""),
TO_BE_REVIEWED(0, "待审核", ""), TO_BE_REVIEWED(0, "待审核", ""),
...@@ -26,13 +25,13 @@ public enum CopyrightApplyStateEnum { ...@@ -26,13 +25,13 @@ public enum CopyrightApplyStateEnum {
private String value; private String value;
private String msg; private String msg;
public static CopyrightApplyStateEnum getByState(int state) { public static CopyrightApplyState getByState(int state) {
for (CopyrightApplyStateEnum stateEnum : CopyrightApplyStateEnum.values()) { for (CopyrightApplyState stateEnum : CopyrightApplyState.values()) {
if (stateEnum.getCode() == state) { if (stateEnum.getCode() == state) {
return stateEnum; return stateEnum;
} }
} }
return CopyrightApplyStateEnum.TO_BE_REVIEWED; return CopyrightApplyState.TO_BE_REVIEWED;
} }
} }
...@@ -16,20 +16,30 @@ import java.util.stream.Collectors; ...@@ -16,20 +16,30 @@ import java.util.stream.Collectors;
@AllArgsConstructor @AllArgsConstructor
public enum OpusProperty { public enum OpusProperty {
ORIGINAL("原创"), ORIGINAL(1, "原创"),
ADAPTATION("改编"), ADAPTATION(2, "改编"),
TRANSLATE("翻译"), TRANSLATE(3, "翻译"),
ASSEMBLY("汇编"), ASSEMBLY(4, "汇编"),
NOTES("注释"), NOTES(5, "注释"),
ARRANGEMENT("整理"), ARRANGEMENT(6, "整理"),
OTHER("其他"), OTHER(7, "其他"),
; ;
private int code;
private String value; private String value;
public static List<String> queryAll(){ public static List<String> queryAll() {
return Arrays.stream(OpusProperty.values()).map(OpusProperty::getValue).collect(Collectors.toList()); return Arrays.stream(OpusProperty.values()).map(OpusProperty::getValue).collect(Collectors.toList());
} }
public static int getCode(String value) {
for (OpusProperty opusProperty : OpusProperty.values()) {
if (opusProperty.getValue().equals(value)) {
return opusProperty.getCode();
}
}
return 1;
}
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(queryAll()); System.out.println(queryAll());
} }
......
...@@ -9,7 +9,7 @@ import lombok.Getter; ...@@ -9,7 +9,7 @@ import lombok.Getter;
*/ */
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum OwnerTypeEnum { public enum OwnerType {
PERSON(0, "个人"), PERSON(0, "个人"),
LEGAL(1, "法人"), LEGAL(1, "法人"),
...@@ -17,4 +17,8 @@ public enum OwnerTypeEnum { ...@@ -17,4 +17,8 @@ public enum OwnerTypeEnum {
; ;
private int type; private int type;
private String desc; private String desc;
public static String getByType(int type) {
return type == PERSON.getType() ? PERSON.getDesc() : LEGAL.getDesc();
}
} }
...@@ -18,6 +18,7 @@ public enum ResultCode implements IErrorCode { ...@@ -18,6 +18,7 @@ public enum ResultCode implements IErrorCode {
TRANSFER_ERROR(416, "nft转让失败"), TRANSFER_ERROR(416, "nft转让失败"),
ID_CARD_VERIFICATION_ERROR(417, "身份证验证失败"), ID_CARD_VERIFICATION_ERROR(417, "身份证验证失败"),
OPERATION_FAILED(418, "操作失败"), OPERATION_FAILED(418, "操作失败"),
COPYRIGHT_FAILED(420, "版权申请失败"),
; ;
......
package com.fzm.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author tangtuo
* @date 2021/12/21 14:15
*/
@Getter
@AllArgsConstructor
public enum SignatureType {
REAL_NAME(1, "本名"),
ALIAS(2, "别名"),
ANONYMOUS(3, "匿名"),
;
private int code;
private String value;
public static int getCode(String value) {
for (SignatureType signatureType : SignatureType.values()) {
if (signatureType.getValue().equals(value)) {
return signatureType.getCode();
}
}
return REAL_NAME.getCode();
}
}
package com.fzm.common.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @author tangtuo
* @date 2021/12/21 15:48
*/
@Data
@Component
@ConfigurationProperties(prefix = "copyright")
public class CopyrightProperties {
private String url;
private String appId;
private String appSecret;
}
...@@ -94,7 +94,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> { ...@@ -94,7 +94,7 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
* @param id * @param id
* @return * @return
*/ */
boolean pass(Integer id); boolean pass(Integer id) throws ExecutionException, InterruptedException;
/** /**
* 获取存证成功的总数量 * 获取存证成功的总数量
......
...@@ -13,4 +13,6 @@ import java.util.List; ...@@ -13,4 +13,6 @@ import java.util.List;
public interface OpusCategoryService extends IService<OpusCategory> { public interface OpusCategoryService extends IService<OpusCategory> {
List<OpusCategory> queryAll(); List<OpusCategory> queryAll();
OpusCategory getByName(String name);
} }
...@@ -3,14 +3,18 @@ package com.fzm.common.service.impl; ...@@ -3,14 +3,18 @@ package com.fzm.common.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.constant.SystemConstant; import com.fzm.common.constant.SystemConstant;
import com.fzm.common.entity.*; import com.fzm.common.entity.*;
import com.fzm.common.entity.dto.CopyrightDTO; import com.fzm.common.entity.dto.CopyrightDTO;
import com.fzm.common.entity.dto.CopyrightRequest;
import com.fzm.common.entity.dto.CopyrightResponse;
import com.fzm.common.entity.vo.CopyrightApplyVo; import com.fzm.common.entity.vo.CopyrightApplyVo;
import com.fzm.common.entity.vo.CopyrightVo; import com.fzm.common.entity.vo.CopyrightVo;
import com.fzm.common.enums.CopyrightApplyStateEnum; import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.mapper.CopyrightApplyMapper; import com.fzm.common.mapper.CopyrightApplyMapper;
...@@ -70,6 +74,9 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -70,6 +74,9 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
@Resource @Resource
private ThreadPoolTaskExecutor threadPoolTaskExecutor; private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Resource
private OpusCategoryService opusCategoryService;
@Override @Override
public Integer submit(CopyrightDTO copyrightDTO) { public Integer submit(CopyrightDTO copyrightDTO) {
// 判断此nft是否属于当前登录用户所有 // 判断此nft是否属于当前登录用户所有
...@@ -86,7 +93,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -86,7 +93,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
} }
CopyrightApply copyrightApply = new CopyrightApply(copyrightDTO); CopyrightApply copyrightApply = new CopyrightApply(copyrightDTO);
// 首次提交,登记状态为待提交 // 首次提交,登记状态为待提交
copyrightApply.setRegisterState(CopyrightApplyStateEnum.TO_BE_REVIEWED.getCode()); copyrightApply.setRegisterState(CopyrightApplyState.TO_BE_REVIEWED.getCode());
copyrightApply.setUserId(user.getId()); copyrightApply.setUserId(user.getId());
save(copyrightApply); save(copyrightApply);
// 保存附件 // 保存附件
...@@ -133,10 +140,10 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -133,10 +140,10 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
if (copyright == null) { if (copyright == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试"); throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试");
} }
if (CopyrightApplyStateEnum.TO_BE_REVIEWED.getCode() != copyright.getRegisterState()) { if (CopyrightApplyState.TO_BE_REVIEWED.getCode() != copyright.getRegisterState()) {
throw GlobalException.newException(ResultCode.OPERATION_FAILED, "此版权申请记录已提交,无法撤回"); throw GlobalException.newException(ResultCode.OPERATION_FAILED, "此版权申请记录已提交,无法撤回");
} }
copyright.setRegisterState(CopyrightApplyStateEnum.WITHDRAW.getCode()); copyright.setRegisterState(CopyrightApplyState.WITHDRAW.getCode());
return updateById(copyright); return updateById(copyright);
} }
...@@ -148,9 +155,9 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -148,9 +155,9 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试"); throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试");
} }
// 只有撤回、驳回和登记失败的才能删除 // 只有撤回、驳回和登记失败的才能删除
if (CopyrightApplyStateEnum.WITHDRAW.getCode() != copyright.getRegisterState() && if (CopyrightApplyState.WITHDRAW.getCode() != copyright.getRegisterState() &&
CopyrightApplyStateEnum.REJECTED.getCode() != copyright.getRegisterState() && CopyrightApplyState.REJECTED.getCode() != copyright.getRegisterState() &&
CopyrightApplyStateEnum.FAILED.getCode() != copyright.getRegisterState()) { CopyrightApplyState.FAILED.getCode() != copyright.getRegisterState()) {
throw GlobalException.newException(ResultCode.OPERATION_FAILED, "当前版权记录不能被删除"); throw GlobalException.newException(ResultCode.OPERATION_FAILED, "当前版权记录不能被删除");
} }
// 删除权力取得方式的附件 // 删除权力取得方式的附件
...@@ -208,8 +215,8 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -208,8 +215,8 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
public Boolean update(CopyrightDTO copyrightDTO) { public Boolean update(CopyrightDTO copyrightDTO) {
// 只有驳回和登记失败的才能编辑 // 只有驳回和登记失败的才能编辑
CopyrightApply copyright = this.getById(copyrightDTO.getId()); CopyrightApply copyright = this.getById(copyrightDTO.getId());
if (CopyrightApplyStateEnum.REJECTED.getCode() != copyright.getRegisterState() && if (CopyrightApplyState.REJECTED.getCode() != copyright.getRegisterState() &&
CopyrightApplyStateEnum.FAILED.getCode() != copyright.getRegisterState()) { CopyrightApplyState.FAILED.getCode() != copyright.getRegisterState()) {
throw GlobalException.newException(ResultCode.OPERATION_FAILED, "只有驳回或登记失败的版权记录才能编辑"); throw GlobalException.newException(ResultCode.OPERATION_FAILED, "只有驳回或登记失败的版权记录才能编辑");
} }
CopyrightApply copyrightApply = new CopyrightApply(copyrightDTO); CopyrightApply copyrightApply = new CopyrightApply(copyrightDTO);
...@@ -281,25 +288,40 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -281,25 +288,40 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
if (copyright == null) { if (copyright == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试"); throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试");
} }
if (CopyrightApplyStateEnum.TO_BE_REVIEWED.getCode() != copyright.getRegisterState()) { if (CopyrightApplyState.TO_BE_REVIEWED.getCode() != copyright.getRegisterState()) {
throw GlobalException.newException(ResultCode.OPERATION_FAILED, "此版权申请记录无法驳回"); throw GlobalException.newException(ResultCode.OPERATION_FAILED, "此版权申请记录无法驳回");
} }
copyright.setRegisterState(CopyrightApplyStateEnum.REJECTED.getCode()); copyright.setRegisterState(CopyrightApplyState.REJECTED.getCode());
copyright.setRejectReason(rejectReason); copyright.setRejectReason(rejectReason);
return updateById(copyright); return updateById(copyright);
} }
@Override @Override
public boolean pass(Integer id) { public boolean pass(Integer id) throws ExecutionException, InterruptedException {
CopyrightApply copyright = getById(id); CopyrightApply copyright = getById(id);
if (copyright == null) { if (copyright == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试"); throw GlobalException.newException(ResultCode.DATA_ERROR, "此版权登记记录不存在,请核对后重试");
} }
if (CopyrightApplyStateEnum.TO_BE_REVIEWED.getCode() != copyright.getRegisterState()) { if (CopyrightApplyState.TO_BE_REVIEWED.getCode() != copyright.getRegisterState()) {
throw GlobalException.newException(ResultCode.OPERATION_FAILED, "此版权申请记录的状态不是待提交,无法审核通过"); throw GlobalException.newException(ResultCode.OPERATION_FAILED, "此版权申请记录的状态不是待提交,无法审核通过");
} }
// todo 版权申请 // todo 版权申请
copyright.setRegisterState(CopyrightApplyStateEnum.SUCCEEDED.getCode()); CopyrightVo detail = this.getDetail(id);
OpusCategory category = opusCategoryService.getById(detail.getOpusCategoryId());
CopyrightRequest copyrightRequest = new CopyrightRequest(detail, category);
String response = HttpUtil.post("https://p.yareiot.com/ccct/api/copyright/create", JSONUtil.toJsonStr(copyrightRequest), 10000);
if (StringUtils.isBlank(response)) {
throw GlobalException.newException(ResultCode.COPYRIGHT_FAILED, "版权局接口无响应,请稍后重试");
}
CopyrightResponse copyrightResponse = JSONUtil.toBean(response, CopyrightResponse.class);
if (copyrightResponse == null) {
throw GlobalException.newException(ResultCode.COPYRIGHT_FAILED, "版权局接口无响应,请稍后重试");
}
if (!copyrightResponse.isSuccess()) {
throw GlobalException.newException(ResultCode.COPYRIGHT_FAILED, copyrightResponse.getMessage());
}
copyright.setSerialNum(copyrightResponse.getSerial_code());
copyright.setRegisterState(CopyrightApplyState.SUCCEEDED.getCode());
copyright.setRejectReason(""); copyright.setRejectReason("");
return updateById(copyright); return updateById(copyright);
} }
...@@ -307,7 +329,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -307,7 +329,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
@Override @Override
public int getSuccessCount() { public int getSuccessCount() {
QueryWrapper<CopyrightApply> wrapper = new QueryWrapper<>(); QueryWrapper<CopyrightApply> wrapper = new QueryWrapper<>();
wrapper.eq("register_state", CopyrightApplyStateEnum.SUCCEEDED.getCode()); wrapper.eq("register_state", CopyrightApplyState.SUCCEEDED.getCode());
return this.count(wrapper); return this.count(wrapper);
} }
......
...@@ -9,7 +9,7 @@ import com.fzm.common.entity.CopyrightApply; ...@@ -9,7 +9,7 @@ import com.fzm.common.entity.CopyrightApply;
import com.fzm.common.entity.Draft; import com.fzm.common.entity.Draft;
import com.fzm.common.entity.dto.CopyrightDTO; import com.fzm.common.entity.dto.CopyrightDTO;
import com.fzm.common.entity.dto.DraftDTO; import com.fzm.common.entity.dto.DraftDTO;
import com.fzm.common.enums.CopyrightApplyStateEnum; import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.mapper.DraftMapper; import com.fzm.common.mapper.DraftMapper;
...@@ -105,7 +105,7 @@ public class DraftServiceImpl extends ServiceImpl<DraftMapper, Draft> implements ...@@ -105,7 +105,7 @@ public class DraftServiceImpl extends ServiceImpl<DraftMapper, Draft> implements
public Integer saveDraft(DraftDTO draft) { public Integer saveDraft(DraftDTO draft) {
if (draft.getCopyrightId() != null) { if (draft.getCopyrightId() != null) {
CopyrightApply copyright = copyrightApplyService.getById(draft.getCopyrightId()); CopyrightApply copyright = copyrightApplyService.getById(draft.getCopyrightId());
if (copyright != null && copyright.getRegisterState().equals(CopyrightApplyStateEnum.WITHDRAW.getCode())) { if (copyright != null && copyright.getRegisterState().equals(CopyrightApplyState.WITHDRAW.getCode())) {
copyrightApplyService.removeById(draft.getCopyrightId()); copyrightApplyService.removeById(draft.getCopyrightId());
copyrightAuthorService.delByCopyrightId(draft.getCopyrightId()); copyrightAuthorService.delByCopyrightId(draft.getCopyrightId());
copyrightAuthorityRelationService.delByCopyrightId(draft.getCopyrightId()); copyrightAuthorityRelationService.delByCopyrightId(draft.getCopyrightId());
......
...@@ -20,7 +20,7 @@ import com.fzm.common.constant.SystemConstant; ...@@ -20,7 +20,7 @@ import com.fzm.common.constant.SystemConstant;
import com.fzm.common.entity.*; import com.fzm.common.entity.*;
import com.fzm.common.entity.vo.CollectionNftVo; import com.fzm.common.entity.vo.CollectionNftVo;
import com.fzm.common.entity.vo.NftListVo; import com.fzm.common.entity.vo.NftListVo;
import com.fzm.common.enums.AuthStatusEnum; import com.fzm.common.enums.AuthStatus;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.mapper.NftMapper; import com.fzm.common.mapper.NftMapper;
...@@ -112,7 +112,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe ...@@ -112,7 +112,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
@Override @Override
public Integer publish(NftDto nftDto) { public Integer publish(NftDto nftDto) {
User user = userService.getUserByToken(); User user = userService.getUserByToken();
if (!AuthStatusEnum.SUCCESS.getStatus().equals(user.getAuthStatus())) { if (!AuthStatus.SUCCESS.getStatus().equals(user.getAuthStatus())) {
throw GlobalException.newException(ResultCode.PUBLISH_ERROR, "您还未实名认证,请先实名认证"); throw GlobalException.newException(ResultCode.PUBLISH_ERROR, "您还未实名认证,请先实名认证");
} }
String wallet = user.getWallet(); String wallet = user.getWallet();
......
package com.fzm.common.service.impl; package com.fzm.common.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.OpusCategory; import com.fzm.common.entity.OpusCategory;
import com.fzm.common.mapper.OpusCategoryMapper; import com.fzm.common.mapper.OpusCategoryMapper;
...@@ -21,4 +22,11 @@ public class OpusCategoryServiceImpl extends ServiceImpl<OpusCategoryMapper, Opu ...@@ -21,4 +22,11 @@ public class OpusCategoryServiceImpl extends ServiceImpl<OpusCategoryMapper, Opu
public List<OpusCategory> queryAll() { public List<OpusCategory> queryAll() {
return list(); return list();
} }
@Override
public OpusCategory getByName(String name) {
QueryWrapper<OpusCategory> wrapper = new QueryWrapper<>();
wrapper.eq("value", name);
return getOne(wrapper);
}
} }
...@@ -7,7 +7,6 @@ import cn.hutool.core.date.DateUtil; ...@@ -7,7 +7,6 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -16,8 +15,8 @@ import com.fzm.common.entity.AuthPerson; ...@@ -16,8 +15,8 @@ import com.fzm.common.entity.AuthPerson;
import com.fzm.common.entity.User; import com.fzm.common.entity.User;
import com.fzm.common.entity.vo.UserListVo; import com.fzm.common.entity.vo.UserListVo;
import com.fzm.common.entity.vo.UserStatisticVo; import com.fzm.common.entity.vo.UserStatisticVo;
import com.fzm.common.enums.AuthStatusEnum; import com.fzm.common.enums.AuthStatus;
import com.fzm.common.enums.AuthTypeEnum; import com.fzm.common.enums.AuthType;
import com.fzm.common.enums.IdCardVerificationResponse; import com.fzm.common.enums.IdCardVerificationResponse;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
...@@ -142,9 +141,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -142,9 +141,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
} }
} }
// 认证成功的用户需要返回实名认证信息 // 认证成功的用户需要返回实名认证信息
if (AuthStatusEnum.SUCCESS.getStatus().equals(user.getAuthStatus())) { if (AuthStatus.SUCCESS.getStatus().equals(user.getAuthStatus())) {
// 个人认证 // 个人认证
if (AuthTypeEnum.PERSON.getType().equals(user.getAuthType())) { if (AuthType.PERSON.getType().equals(user.getAuthType())) {
AuthPerson authPerson = authPersonService.getByUserId(user.getId()); AuthPerson authPerson = authPersonService.getByUserId(user.getId());
user.setAuthPerson(authPerson); user.setAuthPerson(authPerson);
} }
...@@ -203,16 +202,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -203,16 +202,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
long publishUserCount = list.stream().filter(user -> SystemConstant.BOOLEAN_DATA_TRUE.equals(user.getIsPublish())).count(); long publishUserCount = list.stream().filter(user -> SystemConstant.BOOLEAN_DATA_TRUE.equals(user.getIsPublish())).count();
statisticVo.setPublishUserCount((int) publishUserCount); statisticVo.setPublishUserCount((int) publishUserCount);
// 已实名用户数 // 已实名用户数
long authUserCount = list.stream().filter(user -> AuthStatusEnum.SUCCESS.getStatus().equals(user.getAuthStatus())).count(); long authUserCount = list.stream().filter(user -> AuthStatus.SUCCESS.getStatus().equals(user.getAuthStatus())).count();
statisticVo.setAuthUserCount((int) authUserCount); statisticVo.setAuthUserCount((int) authUserCount);
// 个人实名用户数 // 个人实名用户数
long personAuthCount = list.stream(). long personAuthCount = list.stream().
filter(user -> AuthTypeEnum.PERSON.getType().equals(user.getAuthType()) && AuthStatusEnum.SUCCESS.getStatus().equals(user.getAuthStatus())). filter(user -> AuthType.PERSON.getType().equals(user.getAuthType()) && AuthStatus.SUCCESS.getStatus().equals(user.getAuthStatus())).
count(); count();
statisticVo.setPersonAuthCount((int) personAuthCount); statisticVo.setPersonAuthCount((int) personAuthCount);
// 企业实名用户数 // 企业实名用户数
long enterpriseAuthCount = list.stream(). long enterpriseAuthCount = list.stream().
filter(user -> AuthTypeEnum.ENTERPRISE.getType().equals(user.getAuthType()) && AuthStatusEnum.SUCCESS.getStatus().equals(user.getAuthStatus())). filter(user -> AuthType.ENTERPRISE.getType().equals(user.getAuthType()) && AuthStatus.SUCCESS.getStatus().equals(user.getAuthStatus())).
count(); count();
statisticVo.setEnterpriseAuthCount((int) enterpriseAuthCount); statisticVo.setEnterpriseAuthCount((int) enterpriseAuthCount);
return statisticVo; return statisticVo;
...@@ -228,7 +227,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -228,7 +227,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
@Override @Override
public IdCardOCRVerificationResponse personAuth(MultipartFile cardPictureFront, MultipartFile cardPictureBack) throws IOException { public IdCardOCRVerificationResponse personAuth(MultipartFile cardPictureFront, MultipartFile cardPictureBack) throws IOException {
User user = getUserByToken(); User user = getUserByToken();
if (AuthStatusEnum.SUCCESS.getStatus().equals(user.getAuthStatus())) { if (AuthStatus.SUCCESS.getStatus().equals(user.getAuthStatus())) {
throw GlobalException.newException(ResultCode.ID_CARD_VERIFICATION_ERROR, "您已认证成功,无法再次认证"); throw GlobalException.newException(ResultCode.ID_CARD_VERIFICATION_ERROR, "您已认证成功,无法再次认证");
} }
Integer userId = user.getId(); Integer userId = user.getId();
...@@ -248,16 +247,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -248,16 +247,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
.setCardPictureBack(backUrl) .setCardPictureBack(backUrl)
.setCardPictureFront(frontUrl); .setCardPictureFront(frontUrl);
authPersonService.save(authPerson); authPersonService.save(authPerson);
status = AuthStatusEnum.SUCCESS.getStatus(); status = AuthStatus.SUCCESS.getStatus();
} else { } else {
status = AuthStatusEnum.FAIL.getStatus(); status = AuthStatus.FAIL.getStatus();
} }
UpdateWrapper<User> userUpdateWrapper = new UpdateWrapper<>(); UpdateWrapper<User> userUpdateWrapper = new UpdateWrapper<>();
userUpdateWrapper.set("auth_type", AuthTypeEnum.PERSON.getType()) userUpdateWrapper.set("auth_type", AuthType.PERSON.getType())
.set("auth_status", status) .set("auth_status", status)
.eq("id", userId); .eq("id", userId);
update(userUpdateWrapper); update(userUpdateWrapper);
if (AuthStatusEnum.SUCCESS.getStatus().equals(status)) { if (AuthStatus.SUCCESS.getStatus().equals(status)) {
redisUtil.delete("user::statistic"); redisUtil.delete("user::statistic");
} }
return response; return response;
...@@ -266,11 +265,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -266,11 +265,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
@Override @Override
public AuthPerson getAuthDetail(Integer userId) { public AuthPerson getAuthDetail(Integer userId) {
User user = getById(userId); User user = getById(userId);
if (!AuthStatusEnum.SUCCESS.getStatus().equals(user.getAuthStatus())) { if (!AuthStatus.SUCCESS.getStatus().equals(user.getAuthStatus())) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "此用户实名认证未成功,无法查看其具体实名信息"); throw GlobalException.newException(ResultCode.DATA_ERROR, "此用户实名认证未成功,无法查看其具体实名信息");
} }
// 个人认证 // 个人认证
if (AuthTypeEnum.PERSON.getType().equals(user.getAuthType())) { if (AuthType.PERSON.getType().equals(user.getAuthType())) {
QueryWrapper<AuthPerson> queryWrapper = new QueryWrapper<>(); QueryWrapper<AuthPerson> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId); queryWrapper.eq("user_id", userId);
return authPersonService.getOne(queryWrapper); return authPersonService.getOne(queryWrapper);
......
This diff is collapsed.
package com.fzm.portal.controller; package com.fzm.portal.controller;
import com.fzm.common.entity.Authority; import com.fzm.common.entity.Authority;
import com.fzm.common.enums.AuthorityTypeEnum; import com.fzm.common.enums.AuthorityType;
import com.fzm.common.model.ResponseModel; import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.AuthorityService; import com.fzm.common.service.AuthorityService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -30,7 +30,7 @@ public class AuthorityController { ...@@ -30,7 +30,7 @@ public class AuthorityController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询权力列表") @ApiOperation(value = "查询权力列表")
public ResponseModel<List<Authority>> list(@RequestParam String authorityAscriptionMode) { public ResponseModel<List<Authority>> list(@RequestParam String authorityAscriptionMode) {
List<Authority> list = authorityService.getByType(AuthorityTypeEnum.getByType(authorityAscriptionMode)); List<Authority> list = authorityService.getByType(AuthorityType.getByType(authorityAscriptionMode));
return ResponseModel.success(list); return ResponseModel.success(list);
} }
......
...@@ -5,7 +5,7 @@ import com.fzm.common.entity.CopyrightApply; ...@@ -5,7 +5,7 @@ import com.fzm.common.entity.CopyrightApply;
import com.fzm.common.entity.dto.CopyrightDTO; import com.fzm.common.entity.dto.CopyrightDTO;
import com.fzm.common.entity.vo.CopyrightStateVo; import com.fzm.common.entity.vo.CopyrightStateVo;
import com.fzm.common.entity.vo.CopyrightVo; import com.fzm.common.entity.vo.CopyrightVo;
import com.fzm.common.enums.CopyrightApplyStateEnum; import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.model.ResponseModel; import com.fzm.common.model.ResponseModel;
...@@ -14,6 +14,7 @@ import com.fzm.common.utils.JwtUtil; ...@@ -14,6 +14,7 @@ import com.fzm.common.utils.JwtUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
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;
...@@ -35,7 +36,7 @@ public class CopyrightApplyController { ...@@ -35,7 +36,7 @@ public class CopyrightApplyController {
@PostMapping("/submit") @PostMapping("/submit")
@ApiOperation("/提交申请") @ApiOperation("/提交申请")
public ResponseModel<Integer> submit(@RequestBody CopyrightDTO copyrightDTO) { public ResponseModel<Integer> submit(@Validated @RequestBody CopyrightDTO copyrightDTO) {
Integer copyrightId = copyrightApplyService.submit(copyrightDTO); Integer copyrightId = copyrightApplyService.submit(copyrightDTO);
return ResponseModel.success(copyrightId); return ResponseModel.success(copyrightId);
} }
...@@ -98,7 +99,7 @@ public class CopyrightApplyController { ...@@ -98,7 +99,7 @@ public class CopyrightApplyController {
if (copyright == null) { if (copyright == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "请核对后再重试"); throw GlobalException.newException(ResultCode.DATA_ERROR, "请核对后再重试");
} }
CopyrightStateVo copyrightStateVo = new CopyrightStateVo(CopyrightApplyStateEnum.getByState(copyright.getRegisterState()), copyright.getRejectReason()); CopyrightStateVo copyrightStateVo = new CopyrightStateVo(CopyrightApplyState.getByState(copyright.getRegisterState()), copyright.getRejectReason());
return ResponseModel.success(copyrightStateVo); return ResponseModel.success(copyrightStateVo);
} }
......
...@@ -2,7 +2,7 @@ package com.fzm.portal.controller; ...@@ -2,7 +2,7 @@ package com.fzm.portal.controller;
import com.fzm.common.annotation.Authentication; import com.fzm.common.annotation.Authentication;
import com.fzm.common.entity.CopyrightOwner; import com.fzm.common.entity.CopyrightOwner;
import com.fzm.common.enums.OwnerTypeEnum; import com.fzm.common.enums.OwnerType;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.model.ResponseModel; import com.fzm.common.model.ResponseModel;
...@@ -34,7 +34,7 @@ public class CopyrightOwnerController { ...@@ -34,7 +34,7 @@ public class CopyrightOwnerController {
@ApiOperation(value = "新增著作权人") @ApiOperation(value = "新增著作权人")
public ResponseModel<Integer> add(@RequestHeader String Authorization, @Validated @RequestBody CopyrightOwner owner) { public ResponseModel<Integer> add(@RequestHeader String Authorization, @Validated @RequestBody CopyrightOwner owner) {
// 如果著作权人是个人的话,身份证正反面照片 著作权人手持身份证照片等信息必传 // 如果著作权人是个人的话,身份证正反面照片 著作权人手持身份证照片等信息必传
if (owner.getType().equals(OwnerTypeEnum.PERSON.getType())) { if (owner.getType().equals(OwnerType.PERSON.getType())) {
if (StringUtils.isAnyBlank(owner.getBackPhoto(), owner.getPositivePhoto(), owner.getPersonalPhoto())) { if (StringUtils.isAnyBlank(owner.getBackPhoto(), owner.getPositivePhoto(), owner.getPersonalPhoto())) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED); throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
} }
......
package com.fzm.portal; package com.fzm.portal;
import cn.fzm.chain.simplesdk.client.ParaChainClient; import cn.fzm.chain.simplesdk.client.ParaChainClient;
import cn.hutool.json.JSONUtil;
import com.fzm.common.constant.RedisConstant; import com.fzm.common.constant.RedisConstant;
import com.fzm.common.entity.CopyrightAuthorityRelation; import com.fzm.common.entity.CopyrightAuthorityRelation;
import com.fzm.common.entity.OpusCategory;
import com.fzm.common.entity.dto.CopyrightRequest;
import com.fzm.common.entity.vo.CopyrightVo;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.service.CopyrightApplyService;
import com.fzm.common.service.CopyrightAuthorityRelationService; import com.fzm.common.service.CopyrightAuthorityRelationService;
import com.fzm.common.service.OpusCategoryService;
import com.fzm.common.service.impl.CopyrightAuthorityRelationServiceImpl; import com.fzm.common.service.impl.CopyrightAuthorityRelationServiceImpl;
import com.fzm.common.utils.JsonUtil; import com.fzm.common.utils.JsonUtil;
import com.fzm.common.utils.RedisUtil; import com.fzm.common.utils.RedisUtil;
...@@ -20,6 +26,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; ...@@ -20,6 +26,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ExecutionException;
@SpringBootTest @SpringBootTest
class LyPortalApplicationTests { class LyPortalApplicationTests {
...@@ -40,9 +47,19 @@ class LyPortalApplicationTests { ...@@ -40,9 +47,19 @@ class LyPortalApplicationTests {
RedissonClient redisson; RedissonClient redisson;
@Resource @Resource
private CopyrightAuthorityRelationServiceImpl copyrightAuthorityRelationService; private CopyrightApplyService copyrightApplyService;
@Resource
private OpusCategoryService opusCategoryService;
@Test
void test1() throws ExecutionException, InterruptedException {
CopyrightVo detail = copyrightApplyService.getDetail(48);
OpusCategory opusCategory = opusCategoryService.getById(1);
CopyrightRequest.CopyrightDetail copyrightDetail = new CopyrightRequest.CopyrightDetail(detail, opusCategory);
// CopyrightRequest copyrightRequest = new CopyrightRequest(copyrightDetail);
// System.out.println(JSONUtil.toJsonStr(copyrightRequest));
}
@Test @Test
void contextLoads() { void contextLoads() {
......
2021-12-21 15:54:25.212 [main] INFO com.fzm.portal.JoyingPortalApplication-Starting JoyingPortalApplication on LAPTOP-AT8CNAMK with PID 1860 (D:\workspace\fzm-joying\joying-portal\target\classes started by tangtuo in D:\workspace\fzm-joying)
2021-12-21 15:54:25.214 [main] INFO com.fzm.portal.JoyingPortalApplication-The following profiles are active: dev
2021-12-21 15:54:26.286 [main] INFO o.s.d.r.config.RepositoryConfigurationDelegate-Multiple Spring Data modules found, entering strict repository configuration mode!
2021-12-21 15:54:26.288 [main] INFO o.s.d.r.config.RepositoryConfigurationDelegate-Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2021-12-21 15:54:26.310 [main] INFO o.s.d.r.config.RepositoryConfigurationDelegate-Finished Spring Data repository scanning in 10ms. Found 0 Redis repository interfaces.
2021-12-21 15:54:27.037 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer-Tomcat initialized with port(s): 8001 (http)
2021-12-21 15:54:27.044 [main] INFO org.apache.coyote.http11.Http11NioProtocol-Initializing ProtocolHandler ["http-nio-8001"]
2021-12-21 15:54:27.045 [main] INFO org.apache.catalina.core.StandardService-Starting service [Tomcat]
2021-12-21 15:54:27.045 [main] INFO org.apache.catalina.core.StandardEngine-Starting Servlet engine: [Apache Tomcat/9.0.35]
2021-12-21 15:54:27.169 [main] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/]-Initializing Spring embedded WebApplicationContext
2021-12-21 15:54:27.169 [main] INFO org.springframework.web.context.ContextLoader-Root WebApplicationContext: initialization completed in 1915 ms
2021-12-21 15:54:27.313 [main] INFO c.a.d.s.b.a.DruidDataSourceAutoConfigure-Init DruidDataSource
2021-12-21 15:54:28.552 [main] INFO com.alibaba.druid.pool.DruidDataSource-{dataSource-1} inited
2021-12-21 15:54:30.063 [main] INFO org.redisson.Version-Redisson 3.16.0
2021-12-21 15:54:30.958 [redisson-netty-4-23] INFO o.r.connection.pool.MasterPubSubConnectionPool-1 connections initialized for 172.16.101.135/172.16.101.135:6379
2021-12-21 15:54:31.034 [redisson-netty-4-19] INFO org.redisson.connection.pool.MasterConnectionPool-24 connections initialized for 172.16.101.135/172.16.101.135:6379
2021-12-21 15:54:31.212 [main] WARN c.b.mybatisplus.core.metadata.TableInfoHelper-Warn: Could not find @TableId in Class: com.fzm.common.entity.CopyrightApplyOwnerRelation.
2021-12-21 15:54:31.300 [main] WARN c.b.mybatisplus.core.metadata.TableInfoHelper-Warn: Could not find @TableId in Class: com.fzm.common.entity.CopyrightAuthorityRelation.
2021-12-21 15:54:31.380 [main] INFO o.s.scheduling.concurrent.ThreadPoolTaskExecutor-Initializing ExecutorService 'threadPoolTaskExecutor'
2021-12-21 15:54:32.062 [main] INFO s.d.s.w.PropertySourcedRequestMappingHandlerMapping-Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)]
2021-12-21 15:54:32.627 [main] INFO org.apache.coyote.http11.Http11NioProtocol-Starting ProtocolHandler ["http-nio-8001"]
2021-12-21 15:54:32.639 [main] INFO o.s.boot.web.embedded.tomcat.TomcatWebServer-Tomcat started on port(s): 8001 (http) with context path ''
2021-12-21 15:54:32.640 [main] INFO s.d.s.web.plugins.DocumentationPluginsBootstrapper-Context refreshed
2021-12-21 15:54:32.653 [main] INFO s.d.s.web.plugins.DocumentationPluginsBootstrapper-Found 1 custom documentation plugin(s)
2021-12-21 15:54:32.680 [main] INFO s.d.spring.web.scanners.ApiListingReferenceScanner-Scanning for api listing references
2021-12-21 15:54:32.787 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: listUsingGET_1
2021-12-21 15:54:32.799 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: listUsingGET_2
2021-12-21 15:54:32.817 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: listUsingGET_3
2021-12-21 15:54:32.845 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: getByIdUsingGET_1
2021-12-21 15:54:32.860 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: listUsingGET_4
2021-12-21 15:54:32.881 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: addUsingPOST_1
2021-12-21 15:54:32.882 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: deleteUsingPOST_1
2021-12-21 15:54:32.888 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: listUsingGET_5
2021-12-21 15:54:32.889 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: updateUsingPOST_1
2021-12-21 15:54:32.891 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: deleteUsingPOST_2
2021-12-21 15:54:32.896 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: listUsingGET_6
2021-12-21 15:54:32.915 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: getByIdUsingGET_2
2021-12-21 15:54:32.926 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: listUsingGET_7
2021-12-21 15:54:32.931 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: publishUsingPOST_1
2021-12-21 15:54:32.946 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: saveUsingPOST_1
2021-12-21 15:54:32.955 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: getDetailUsingGET_1
2021-12-21 15:54:32.958 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: listUsingGET_8
2021-12-21 15:54:32.960 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: listUsingGET_9
2021-12-21 15:54:32.961 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: deleteUsingPOST_3
2021-12-21 15:54:32.962 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: downloadUsingPOST_1
2021-12-21 15:54:32.967 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: uploadUsingPOST_1
2021-12-21 15:54:32.990 [main] INFO s.d.s.w.r.operation.CachingOperationNameGenerator-Generating unique operation named: updateUsingPOST_2
2021-12-21 15:54:33.010 [main] INFO com.fzm.portal.JoyingPortalApplication-Started JoyingPortalApplication in 8.27 seconds (JVM running for 10.009)
2021-12-21 15:54:37.577 [SpringContextShutdownHook] INFO o.s.scheduling.concurrent.ThreadPoolTaskExecutor-Shutting down ExecutorService 'threadPoolTaskExecutor'
2021-12-21 15:54:37.622 [SpringContextShutdownHook] INFO com.alibaba.druid.pool.DruidDataSource-{dataSource-1} closing ...
2021-12-21 15:54:37.626 [SpringContextShutdownHook] INFO com.alibaba.druid.pool.DruidDataSource-{dataSource-1} closed
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