Commit 62e4848f authored by tangtuo's avatar tangtuo

版权相关功能开发

parent 7968f009
......@@ -102,11 +102,4 @@ public class NftController {
List<NftTransferRecordVo> list = nftTransferRecordService.getTransferRecordList(nftHash, fromAddress, toAddress, startDate, endDate);
return ResponseModel.success(new PageInfo<>(list));
}
@GetMapping("/send")
public String send(@RequestParam String msg) {
rabbitTemplate.convertAndSend("copyright.direct", "copyright.apply", msg);
log.info("发送消息:{}", msg);
return "SUCCESS";
}
}
......@@ -97,7 +97,8 @@ aliyun:
encrypt-bucket: test-nft-2
copyright:
url: https://p.yareiot.com/ccct/api/copyright/create
apply-url: https://p.yareiot.com/ccct/api/copyright/create
query-url: https://p.yareiot.com/ccct/api/copyright/query
app-id: 289391457858
app-secret: xExjKUCYH1nrze6Hpxf8s1dYWdxEggo2FiwKlZKygCItOV7E8bFhkyr4C192uhK
......@@ -79,14 +79,15 @@ swagger:
chain:
para:
rpc-url: http://146.56.197.42:12021
withhold-addr: 1417K9fd5vt4zYW86xinWiCbAkNP794aNy
withhold-key: 19d78691584930407e63cd35ac6e67fae6113894b41812e65847d4a365a802a0
rpcUrl: http://146.56.197.42:12021
tokenManager: 133AfuMYQXRxc45JGUb1jLk1M1W4ka39L1
tokenManagerKey: 85c6c95bcb41779f1d197e686d26b228a523fa36b77cfed79edb59b8853b569b
withhold: 1417K9fd5vt4zYW86xinWiCbAkNP794aNy
withholdKey: 19d78691584930407e63cd35ac6e67fae6113894b41812e65847d4a365a802a0
title: user.p.mall.
admin: 133AfuMYQXRxc45JGUb1jLk1M1W4ka39L1
admin-key: 85c6c95bcb41779f1d197e686d26b228a523fa36b77cfed79edb59b8853b569b
contract-name: user.evm.0xb3ae98ac253679602d54d1513aa9cad7d1b10d5f5117d5ce999c1bf67906ba99
contract-address: 15DtbSyS4eVFxdF87jmrcAdXMSAwXEHVLW
cName: user.evm.0xb3ae98ac253679602d54d1513aa9cad7d1b10d5f5117d5ce999c1bf67906ba99
cAddr: 15DtbSyS4eVFxdF87jmrcAdXMSAwXEHVLW
aliyun:
oss:
......
spring:
profiles:
active: nj
active: local
application:
name: ly-admin
......
......@@ -68,7 +68,7 @@
<dependency>
<groupId>cn.fzm.chain</groupId>
<artifactId>simple-sdk</artifactId>
<version>2.6.1</version>
<version>2.9.6</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
......
......@@ -61,7 +61,7 @@ public class RabbitMQConfig {
@Bean
public Queue dlQueue() {
return QueueBuilder.durable(DEAD_LETTER_QUEUE)
.ttl(1000 * 60 * 60 * 2)
.ttl(1000 * 60 * 2)
.deadLetterExchange(DEAD_LETTER_DIRECT)
.deadLetterRoutingKey("copyright.notify")
.build();
......
......@@ -95,6 +95,12 @@ public class CopyrightApply {
@ApiModelProperty(value = "登记状态 0-待审核 1-登记成功 2-审核失败")
private Integer registerState;
@ApiModelProperty(value = "存证哈希")
private String evidenceHash;
@ApiModelProperty(value = "存证日期")
private Date evidenceDate;
@ApiModelProperty(value = "驳回理由")
private String rejectReason;
......@@ -102,6 +108,9 @@ public class CopyrightApply {
@ApiModelProperty("json串")
private String content;
@ApiModelProperty("登记证书编号,在版权登记审核通过后生成")
private String registerCode;
private Date createDate;
private Date updateDate;
......
package com.fzm.common.entity;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fzm.common.entity.dto.CopyrightDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
......@@ -87,7 +84,6 @@ public class CopyrightOwner {
@ApiModelProperty(value = "证件照片(营业执照等)")
private String certificatesPhoto;
@NotBlank(message = "委托证明不能为空")
@ApiModelProperty(value = "委托证明")
private String entrustProve;
......
......@@ -94,7 +94,6 @@ public class CopyrightDTO {
@ApiModelProperty(value = "权力归属方式")
private String authorityAscriptionMode;
@NotBlank(message = "权力归属材料不能为空")
@ApiModelProperty(value = "权力归属证明材料的文件地址")
private String authorityAscriptionProve;
......
package com.fzm.common.entity.dto;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -20,7 +21,7 @@ public class CopyrightQueryRequest {
private String sign_type = "md5";
private String timestamp = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
private String version = "1.0";
private BizContent biz_content;
private String biz_content;
@Data
@AllArgsConstructor
......@@ -30,6 +31,6 @@ public class CopyrightQueryRequest {
public CopyrightQueryRequest(String serial_code, String app_id) {
this.app_id = app_id;
this.biz_content = new BizContent(serial_code);
this.biz_content = JSONUtil.toJsonStr(new BizContent(serial_code));
}
}
......@@ -9,6 +9,8 @@ import lombok.Data;
@Data
public class CopyrightQueryResponse {
private String apply_time;
private Integer audit_status;
private CertificateInfo certificate;
......
......@@ -4,6 +4,7 @@
package com.fzm.common.entity.dto;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import com.fzm.common.entity.*;
import com.fzm.common.entity.vo.CopyrightVo;
import com.fzm.common.enums.*;
......@@ -31,7 +32,7 @@ public class CopyrightRequest {
private String sign_type = "md5";
private String timestamp = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
private String version = "1.0";
private CopyrightDetail biz_content;
private String biz_content;
@Data
public static class CopyrightDetail {
......@@ -353,7 +354,7 @@ public class CopyrightRequest {
public CopyrightRequest(CopyrightVo copyrightVo, OpusCategory category, String app_id, String sign) {
this.biz_content = new CopyrightDetail(copyrightVo, category);
this.biz_content = JSONUtil.toJsonStr(new CopyrightDetail(copyrightVo, category));
this.app_id = app_id;
this.sign = sign;
}
......
package com.fzm.common.entity.vo;
import com.fzm.common.entity.CopyrightApply;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author tangtuo
* @date 2021/7/1 10:35
*/
@Data
public class CopyrightCertificateVo {
@ApiModelProperty("主键")
private Integer id;
@ApiModelProperty("作品名称")
private String opusName;
@ApiModelProperty("证书哈希")
private String evidenceHash;
@ApiModelProperty("作品性质")
private String opusProperty;
@ApiModelProperty("存证人")
private String evidencer;
@ApiModelProperty("存证时间")
private Date evidenceDate;
@ApiModelProperty(value = "作品分类")
private String opusCategory;
public CopyrightCertificateVo(CopyrightApply copyrightApply, String evidencer, String opusCategory) {
this.id = copyrightApply.getId();
this.opusName = copyrightApply.getOpusName();
this.evidenceHash = copyrightApply.getEvidenceHash();
this.opusProperty = copyrightApply.getOpusProperty();
this.evidenceDate = copyrightApply.getEvidenceDate();
this.evidencer = evidencer;
this.opusCategory = opusCategory;
}
}
......@@ -87,6 +87,18 @@ public class CopyrightVo {
@ApiModelProperty(value = "登记状态 0-待审核 1-登记成功 2-审核失败")
private Integer registerState;
@ApiModelProperty(value = "存证哈希")
private String evidenceHash;
@ApiModelProperty(value = "存证日期")
private Date evidenceDate;
@ApiModelProperty("登记证书编号,在版权登记审核通过后生成")
private String registerCode;
@ApiModelProperty(value = "作品类别")
private OpusCategory opusCategory;
@ApiModelProperty(value = "文件列表")
private List<CopyrightFile> files;
......
......@@ -18,20 +18,13 @@ public class NftCertificateVo {
@ApiModelProperty("主键")
private Integer id;
@ApiModelProperty("名称")
@ApiModelProperty("存证名称")
private String name;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty("发行人")
@ApiModelProperty("存证人")
private String publisher;
@ApiModelProperty("发行人地址")
private String wallet;
@ApiModelProperty("剧本hash")
private String fileHash;
@ApiModelProperty("nft哈希")
private String nftHash;
......@@ -39,26 +32,13 @@ public class NftCertificateVo {
@ApiModelProperty("存证时间")
private Date publishTime;
@ApiModelProperty("二维码")
private String qrCode;
@ApiModelProperty("剧本审核状态 0-未审核 1-已审核")
private Integer examineStatus;
@ApiModelProperty("版权证明: 0-未认证 1-已认证")
private Integer copyrightStatus;
public NftCertificateVo(Nft nft, User user, String qrCode) {
public NftCertificateVo(Nft nft, User user) {
this.name = nft.getName();
this.fileHash = nft.getFileHash();
this.nftHash = nft.getNftHash();
this.id = nft.getId();
this.publisher = user.getNickname();
this.publishTime = nft.getPublishTime();
this.wallet=nft.getPublishAddress();
this.qrCode = qrCode;
this.examineStatus = 0;
this.copyrightStatus = 0;
this.cover=nft.getCover();
}
}
package com.fzm.common.entity.vo;
import cn.hutool.core.date.DateUtil;
import com.fzm.common.entity.CopyrightApplyOwnerRelation;
import com.fzm.common.entity.CopyrightAuthor;
import com.fzm.common.entity.Nft;
import com.fzm.common.entity.User;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import sun.management.counter.perf.PerfInstrumentation;
import java.util.Date;
import java.util.stream.Collectors;
/**
* @author tangtuo
* @date 2021/7/1 10:35
......@@ -17,82 +23,100 @@ public class NftVo {
@ApiModelProperty("主键")
private Integer id;
@ApiModelProperty("nft拥有者的用户id")
private Integer userId;
@ApiModelProperty("名称")
@ApiModelProperty("存证名称")
private String name;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty("nft编号")
private String nftId;
@ApiModelProperty("存证哈希")
private String nftHash;
@ApiModelProperty("发行个数")
private Integer count = 1;
@ApiModelProperty("类目")
private String category;
@ApiModelProperty("发行状态")
private String publishStatus = "已发行";
@ApiModelProperty("存证人")
private String evidencer;
@ApiModelProperty("发行人")
private String publisher;
@ApiModelProperty("头像")
private String avatar;
@ApiModelProperty("文件哈希")
private String fileHash;
@ApiModelProperty("钱包地址")
private String wallet;
@ApiModelProperty(value = "存证时间")
private Date evidenceTime;
@ApiModelProperty("个性签名")
private String signature;
@ApiModelProperty("版权详情")
private Copyright copyright;
@ApiModelProperty("nft编号")
private String nftId;
@ApiModelProperty("持有人用户id")
private Integer userId;
@ApiModelProperty("剧本hash")
private String fileHash;
@ApiModelProperty("文件名")
private String fileName;
@Data
@NoArgsConstructor
public static class Copyright {
@ApiModelProperty("存证哈希")
private String evidenceHash;
@ApiModelProperty("文件地址")
private String fileUrl;
@ApiModelProperty("存证人")
private String evidencer = "湖北版权局";
@ApiModelProperty("nft哈希")
private String nftHash;
@ApiModelProperty("登记号")
private String registerCode;
@ApiModelProperty("发行时间")
private String publishTime;
@ApiModelProperty("作品名称")
private String opusName;
@ApiModelProperty("作品类型")
private String opusType;
@ApiModelProperty("作者")
private String author;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("著作权人")
private String copyrightOwner;
@ApiModelProperty("作品完成时间")
private Date opusCompleteDate;
@ApiModelProperty("作品首次发表时间")
private Date firstPublishDate;
@ApiModelProperty("登记时间")
private Date registerDate;
@ApiModelProperty("是否收藏")
private Boolean collection;
@ApiModelProperty("存证时间")
private Date evidenceTime;
@ApiModelProperty("关于nft")
private String aboutNft;
@ApiModelProperty("是否是纪念版nft 0-否 1-是")
private Integer isCommemorate;
public NftVo(Nft nft, User user) {
public Copyright(CopyrightVo copyrightVo, Date evidenceTime) {
this.registerCode = copyrightVo.getRegisterCode();
this.opusName = copyrightVo.getOpusName();
this.opusType = copyrightVo.getOpusCategory().getValue();
this.author = copyrightVo.getAuthors().stream().map(CopyrightAuthor::getName).collect(Collectors.joining());
this.copyrightOwner = copyrightVo.getOwners().stream().map(CopyrightApplyOwnerRelation::getOwner).collect(Collectors.joining());
this.opusCompleteDate = copyrightVo.getOpusCompleteDate();
this.firstPublishDate = copyrightVo.getFirstPublishDate();
this.evidenceTime = evidenceTime;
this.evidenceHash = copyrightVo.getEvidenceHash();
}
}
public NftVo(Nft nft, CopyrightVo copyrightVo) {
this.id = nft.getId();
this.author = nft.getAuthor();
this.evidencer = nft.getAuthor();
this.userId = nft.getUserId();
this.name = nft.getName();
this.fileHash = nft.getFileHash();
this.nftId = nft.getNftId();
this.synopsis = nft.getSynopsis();
this.publisher = user.getNickname();
this.avatar = user.getAvatar();
this.wallet = nft.getPublishAddress();
this.publishTime = DateUtil.format(nft.getPublishTime(), "yyyy/MM/dd HH:mm:ss");
this.userId = nft.getUserId();
this.cover = nft.getCover();
this.collection = false;
this.fileName = nft.getFileName();
this.fileUrl = nft.getFileUrl();
this.isCommemorate = nft.getIsCommemorate();
this.nftHash = nft.getNftHash();
this.signature = user.getSignature();
this.fileHash = nft.getFileHash();
this.evidenceTime = nft.getPublishTime();
this.copyright = copyrightVo == null ? new Copyright() : new Copyright(copyrightVo, nft.getPublishTime());
}
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.entity.CopyrightApply;
import com.fzm.common.entity.dto.CopyrightDTO;
import com.fzm.common.entity.vo.CopyrightApplyVo;
import com.fzm.common.entity.vo.CopyrightCertificateVo;
import com.fzm.common.entity.vo.CopyrightVo;
import com.github.pagehelper.PageInfo;
......@@ -103,4 +104,26 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
*/
int getSuccessCount();
/**
* 根据流水号查询
*
* @param serial_code
* @return
*/
CopyrightApply getBySerialNum(String serial_code);
/**
* 根据nft查询详情
*
* @param nftHash
* @return
*/
CopyrightVo getByNftHash(String nftHash) throws ExecutionException, InterruptedException;
/**
* 查看证书
* @param id
* @return
*/
CopyrightCertificateVo getCertificate(Integer id);
}
......@@ -6,10 +6,12 @@ import com.fzm.common.entity.NftDto;
import com.fzm.common.entity.vo.CollectionNftVo;
import com.fzm.common.entity.vo.NftCertificateVo;
import com.fzm.common.entity.vo.NftListVo;
import com.fzm.common.entity.vo.NftVo;
import com.fzm.common.params.NftTransferParam;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.concurrent.ExecutionException;
/**
* @author tangtuo
......@@ -159,4 +161,12 @@ public interface NftService extends IService<Nft> {
* @return
*/
Nft getByTokenId(Long tokenId);
/**
* 获取nft详情
*
* @param nftHash
* @return
*/
NftVo getDetail(String nftHash) throws ExecutionException, InterruptedException;
}
......@@ -15,6 +15,7 @@ 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.CopyrightCertificateVo;
import com.fzm.common.entity.vo.CopyrightVo;
import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.enums.ResultCode;
......@@ -200,6 +201,11 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
CopyrightApply copyrightApply = getById(id);
return new CopyrightVo(copyrightApply);
}, threadPoolTaskExecutor);
CompletableFuture<Void> categoryFuture = applyFuture.thenAcceptAsync((result) -> {
// 查询类别
OpusCategory category = opusCategoryService.getById(result.getOpusCategoryId());
result.setOpusCategory(category);
}, threadPoolTaskExecutor);
CompletableFuture<Void> filesFuture = applyFuture.thenAcceptAsync((result) -> {
// 查询附件列表
List<CopyrightFile> files = copyrightFileService.getByCopyrightId(id);
......@@ -221,7 +227,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
result.setAuthorities(authorities);
}, threadPoolTaskExecutor);
// 等所有异步任务都完成以后返回结果
CompletableFuture.allOf(applyFuture, filesFuture, authorsFuture, ownerFuture, authoritiesFuture).get();
CompletableFuture.allOf(categoryFuture, filesFuture, authorsFuture, ownerFuture, authoritiesFuture).get();
return applyFuture.get();
}
......@@ -346,7 +352,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
String serial_code = copyrightResponse.getSerial_code();
rabbitTemplate.convertAndSend(RabbitMQConfig.COPYRIGHT_DIRECT, "copyright.apply", serial_code);
copyright.setSerialNum(serial_code);
copyright.setRegisterState(CopyrightApplyState.SUCCEEDED.getCode());
copyright.setRegisterState(CopyrightApplyState.SUBMITTED.getCode());
copyright.setRejectReason("");
return updateById(copyright);
}
......@@ -354,7 +360,6 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
private TreeMap<String, String> beanToMap(CopyrightRequest copyrightRequest, String app_secret) {
TreeMap<String, String> treeMap = JSONUtil.toBean(JSONUtil.toJsonStr(copyrightRequest), new TypeReference<TreeMap<String, String>>() {
}, true);
treeMap.put("biz_content", JSONUtil.toJsonStr(copyrightRequest.getBiz_content()));
treeMap.put("app_secret", app_secret);
return treeMap;
......@@ -367,4 +372,36 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
return this.count(wrapper);
}
@Override
public CopyrightApply getBySerialNum(String serial_code) {
QueryWrapper<CopyrightApply> wrapper = new QueryWrapper<>();
wrapper.eq("serial_num", serial_code);
return getOne(wrapper);
}
@Override
public CopyrightVo getByNftHash(String nftHash) throws ExecutionException, InterruptedException {
QueryWrapper<CopyrightApply> wrapper = new QueryWrapper<>();
wrapper.eq("nft_hash", nftHash);
CopyrightApply copyrightApply = this.getOne(wrapper);
if (copyrightApply == null) {
return null;
}
return this.getDetail(copyrightApply.getId());
}
@Override
public CopyrightCertificateVo getCertificate(Integer id) {
CopyrightApply copyrightApply = this.getById(id);
if (copyrightApply == null) {
throw GlobalException.newException(ResultCode.SELECT_FAILED, "没找到此证书");
}
if (!copyrightApply.getRegisterState().equals(CopyrightApplyState.SUCCEEDED.getCode())) {
throw GlobalException.newException(ResultCode.FAILED, "当前版权申请还未审批通过,暂不支持查看证书");
}
OpusCategory category = opusCategoryService.getById(copyrightApply.getOpusCategoryId());
User user = userService.getById(copyrightApply.getUserId());
return new CopyrightCertificateVo(copyrightApply, user.getNickname(), category.getValue());
}
}
......@@ -3,6 +3,7 @@ package com.fzm.portal.controller;
import com.fzm.common.annotation.Authentication;
import com.fzm.common.entity.CopyrightApply;
import com.fzm.common.entity.dto.CopyrightDTO;
import com.fzm.common.entity.vo.CopyrightCertificateVo;
import com.fzm.common.entity.vo.CopyrightStateVo;
import com.fzm.common.entity.vo.CopyrightVo;
import com.fzm.common.enums.CopyrightApplyState;
......@@ -25,7 +26,6 @@ import java.util.concurrent.ExecutionException;
* @author tangtuo
* @date 2021/12/9 14:31
*/
@Authentication
@RestController
@Api(tags = "版权申请")
@RequestMapping("/copyright/apply")
......@@ -34,6 +34,7 @@ public class CopyrightApplyController {
@Resource
private CopyrightApplyService copyrightApplyService;
@Authentication
@PostMapping("/submit")
@ApiOperation("/提交申请")
public ResponseModel<Integer> submit(@Validated @RequestBody CopyrightDTO copyrightDTO) {
......@@ -42,6 +43,7 @@ public class CopyrightApplyController {
}
@Authentication
@GetMapping("/list")
@ApiOperation(value = "查询版权登记列表")
public ResponseModel<List<CopyrightApply>> list(@RequestHeader(value = "Authorization") String token, @ApiParam("状态 0-全部 1-进行中 2-已完成") @RequestParam Integer state) {
......@@ -50,6 +52,7 @@ public class CopyrightApplyController {
return ResponseModel.success(list);
}
@Authentication
@PostMapping(value = "/withdraw")
@ApiOperation(value = "撤回")
public ResponseModel<Boolean> withdraw(@RequestParam Integer id) {
......@@ -57,6 +60,7 @@ public class CopyrightApplyController {
return ResponseModel.success(result);
}
@Authentication
@PostMapping(value = "/delete")
@ApiOperation(value = "删除")
public ResponseModel<Boolean> delete(@RequestParam Integer id) {
......@@ -71,6 +75,7 @@ public class CopyrightApplyController {
return ResponseModel.success(copyrightVo);
}
@Authentication
@PostMapping(value = "/update")
@ApiOperation(value = "编辑")
public ResponseModel<Boolean> update(@RequestBody CopyrightDTO copyrightDTO) {
......@@ -104,4 +109,11 @@ public class CopyrightApplyController {
}
@GetMapping("/certificate/{id}")
@ApiOperation(value = "查看版权存证证书")
public ResponseModel<CopyrightCertificateVo> getCertificate(@PathVariable Integer id){
CopyrightCertificateVo copyrightCertificateVo = copyrightApplyService.getCertificate(id);
return ResponseModel.success(copyrightCertificateVo);
}
}
......@@ -35,6 +35,7 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
......@@ -82,6 +83,7 @@ public class NftController {
@ApiOperation("发行nft")
public ResponseModel<Integer> publish(@Validated @RequestBody NftDto nftDto) {
Integer id = nftService.publish(nftDto);
return ResponseModel.success(id);
}
......@@ -96,27 +98,10 @@ public class NftController {
return ResponseModel.success(list);
}
@GetMapping("get/{id}")
@GetMapping("get/{nftHash}")
@ApiOperation(value = "获取nft详情")
public ResponseModel<NftVo> getById(@PathVariable Integer id, @RequestHeader(required = false) String Authorization) {
Nft nft = nftService.getById(id);
if (nft == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此nft的详情");
}
User user = userService.getUserByWallet(nft.getPublishAddress());
if (user == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此nft的发布人的信息");
}
NftVo nftVo = new NftVo(nft, user);
nftVo.setCategory(categoryService.getById(nft.getCategoryId()).getCategoryName());
if (StringUtils.isNotBlank(Authorization)) {
String realToken = Authorization.substring(TokenConstant.TOKEN_PREFIX.length());
if (StringUtils.isNotBlank(realToken) && !"null".equals(realToken)) {
Integer userId = JwtUtil.getUserIdFromToken(Authorization);
Boolean collection = redisUtil.sIsMember(RedisConstant.COLLECTION_USER_PREFIX + userId, id.toString());
nftVo.setCollection(collection);
}
}
public ResponseModel<NftVo> get(@PathVariable String nftHash) throws ExecutionException, InterruptedException {
NftVo nftVo = nftService.getDetail(nftHash);
return ResponseModel.success(nftVo);
}
......@@ -170,8 +155,7 @@ public class NftController {
throw GlobalException.newException(ResultCode.FORBIDDEN, "您无权查看别人的nft证书");
}
User user = userService.getUserByWallet(nft.getPublishAddress());
String qrCode = QRCodeUtil.encode(PATH, null, false);
NftCertificateVo vo = new NftCertificateVo(nft, user, qrCode);
NftCertificateVo vo = new NftCertificateVo(nft, user);
return ResponseModel.success(vo);
}
......@@ -205,7 +189,7 @@ public class NftController {
@Authentication
@ApiOperation(value = "查询用户还未成功申请版权的nft列表")
@GetMapping(value = "/list/copyright")
public ResponseModel<List<CollectionNftVo>> listCopyright(@RequestHeader(value = "Authorization") String token){
public ResponseModel<List<CollectionNftVo>> listCopyright(@RequestHeader(value = "Authorization") String token) {
Integer userId = JwtUtil.getUserIdFromToken(token);
List<CollectionNftVo> list = nftService.listCopyright(userId);
return ResponseModel.success(list);
......
......@@ -76,16 +76,29 @@ sms:
transfer-nft-email-codetype: notice_transfer
transfer-nft-voice-codetype: notice_transfer
#chain:
# para:
# rpc-url: http://146.56.197.42:12021
# withhold-addr: 1417K9fd5vt4zYW86xinWiCbAkNP794aNy
# withhold-key: 19d78691584930407e63cd35ac6e67fae6113894b41812e65847d4a365a802a0
# title: user.p.mall.
# admin: 133AfuMYQXRxc45JGUb1jLk1M1W4ka39L1
# admin-key: 85c6c95bcb41779f1d197e686d26b228a523fa36b77cfed79edb59b8853b569b
# contract-name: user.evm.0xb3ae98ac253679602d54d1513aa9cad7d1b10d5f5117d5ce999c1bf67906ba99
# contract-address: 15DtbSyS4eVFxdF87jmrcAdXMSAwXEHVLW
chain:
para:
rpc-url: http://146.56.197.42:12021
withhold-addr: 1417K9fd5vt4zYW86xinWiCbAkNP794aNy
withhold-key: 19d78691584930407e63cd35ac6e67fae6113894b41812e65847d4a365a802a0
rpcUrl: http://146.56.197.42:12021
tokenManager: 133AfuMYQXRxc45JGUb1jLk1M1W4ka39L1
tokenManagerKey: 85c6c95bcb41779f1d197e686d26b228a523fa36b77cfed79edb59b8853b569b
withhold: 1417K9fd5vt4zYW86xinWiCbAkNP794aNy
withholdKey: 19d78691584930407e63cd35ac6e67fae6113894b41812e65847d4a365a802a0
title: user.p.mall.
admin: 133AfuMYQXRxc45JGUb1jLk1M1W4ka39L1
admin-key: 85c6c95bcb41779f1d197e686d26b228a523fa36b77cfed79edb59b8853b569b
contract-name: user.evm.0xb3ae98ac253679602d54d1513aa9cad7d1b10d5f5117d5ce999c1bf67906ba99
contract-address: 15DtbSyS4eVFxdF87jmrcAdXMSAwXEHVLW
cName: user.evm.0xb3ae98ac253679602d54d1513aa9cad7d1b10d5f5117d5ce999c1bf67906ba99
cAddr: 15DtbSyS4eVFxdF87jmrcAdXMSAwXEHVLW
aliyun:
oss:
......
......@@ -101,4 +101,15 @@ class LyPortalApplicationTests {
}
@Test
void test2() {
String abi = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getTokenInfo\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"tokenInfo\",\"type\":\"string\"}],\"name\":\"setTokenInfo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]";
String contractAddr = "15DtbSyS4eVFxdF87jmrcAdXMSAwXEHVLW";
long tokenId = 1475397751335424000L;
String wallet = "143nwppTM4yyuc4KKQbi5RHiKmpHPAwnqm";
String tokenInfoStr = paraClient.evmGetTokenInfo(abi, contractAddr, tokenId, wallet);
System.out.println(tokenInfoStr);
}
}
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -35,6 +35,10 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
......@@ -104,7 +108,6 @@
<artifactId>redisson</artifactId>
<version>3.16.0</version>
</dependency>
</dependencies>
</dependencyManagement>
......
......@@ -397,13 +397,15 @@ CREATE TABLE `tb_file_template` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '版权附件模板表' ROW_FORMAT = Dynamic;
INSERT INTO `tb_file_template` VALUES (1, '权利取得方式证明材料附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/02aba8bb6ad14d828534d741ae6ff0c7/权利取得方式证明材料附件.docx', 0);
INSERT INTO `tb_file_template` VALUES (2, '代理委托书.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/1a3f7812993f4f8785b6d50536541f36/代理委托书.docx', 1);
INSERT INTO `tb_file_template` VALUES (3, '权利归属证明材料《合作作品权属协议书》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/a2a155f3d0c044b5955a3431fe0dcdab/权利归属证明材料《合作作品权属协议书》附件.docx', 2);
INSERT INTO `tb_file_template` VALUES (4, '权利归属证明材料《著作权权属申请》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/252cdb300d984427859b7b6c5daabfeb/权利归属证明材料《著作权权属申请》附件.docx', 3);
INSERT INTO `tb_file_template` VALUES (5, '权利归属证明材料《职务作品权属约定》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/ba81002e5d98484e94d141a17d5c47f6/权利归属证明材料《职务作品权属约定》附件.docx', 4);
INSERT INTO `tb_file_template` VALUES (6, '权利归属证明材料《委托创作协议书(甲方享有全部权利)》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/d42e75a9c31f49729758518f9f7fa323/权利归属证明材料《委托创作协议书(甲方享有全部权利)》附件.docx', 5);
INSERT INTO `tb_file_template` VALUES (7, '权利归属证明材料《委托创作协议书(作者保留署名权)》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/519f7ecab6cd4e7eb24847621249e416/权利归属证明材料《委托创作协议书(作者保留署名权)》附件.docx', 5);
INSERT INTO `tb_file_template`(`id`, `file_name`, `file_url`, `type`) VALUES (1, '权利取得方式证明材料附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/02aba8bb6ad14d828534d741ae6ff0c7/权利取得方式证明材料附件.docx', 0);
INSERT INTO `tb_file_template`(`id`, `file_name`, `file_url`, `type`) VALUES (2, '业务代理委托书.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211230/20b5468e37304616be66a11e273fba01/业务代理委托书.docx', 1);
INSERT INTO `tb_file_template`(`id`, `file_name`, `file_url`, `type`) VALUES (3, '权利归属证明材料《合作作品权属协议书》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/a2a155f3d0c044b5955a3431fe0dcdab/权利归属证明材料《合作作品权属协议书》附件.docx', 2);
INSERT INTO `tb_file_template`(`id`, `file_name`, `file_url`, `type`) VALUES (4, '权利归属证明材料《著作权权属申请》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/252cdb300d984427859b7b6c5daabfeb/权利归属证明材料《著作权权属申请》附件.docx', 3);
INSERT INTO `tb_file_template`(`id`, `file_name`, `file_url`, `type`) VALUES (5, '权利归属证明材料《职务作品权属约定》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/ba81002e5d98484e94d141a17d5c47f6/权利归属证明材料《职务作品权属约定》附件.docx', 4);
INSERT INTO `tb_file_template`(`id`, `file_name`, `file_url`, `type`) VALUES (6, '权利归属证明材料《委托创作协议书(甲方享有全部权利)》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/d42e75a9c31f49729758518f9f7fa323/权利归属证明材料《委托创作协议书(甲方享有全部权利)》附件.docx', 5);
INSERT INTO `tb_file_template`(`id`, `file_name`, `file_url`, `type`) VALUES (7, '权利归属证明材料《委托创作协议书(作者保留署名权)》附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211210/519f7ecab6cd4e7eb24847621249e416/权利归属证明材料《委托创作协议书(作者保留署名权)》附件.docx', 5);
INSERT INTO `tb_file_template`(`id`, `file_name`, `file_url`, `type`) VALUES (8, '作品登记委托书.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211230/9954992e8e6a440aa75d261bb9c3b6fe/作品登记委托书.docx', 6);
INSERT INTO `tb_file_template`(`id`, `file_name`, `file_url`, `type`) VALUES (9, '权利保证书(作品)附件.docx', 'https://test-nft.oss-cn-hangzhou.aliyuncs.com/20211230/4a0cc83384464750b86cbae409a47289/权利保证书(作品)附件.docx', 7);
-- ----------------------------
-- Table structure for tb_nft
......
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