Commit 1744e9c6 authored by tangtuo's avatar tangtuo

debug

parent 2d5a7bd9
...@@ -17,7 +17,7 @@ public class CopyrightStateVo { ...@@ -17,7 +17,7 @@ public class CopyrightStateVo {
public CopyrightStateVo(CopyrightApplyState 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(CopyrightApplyState.REJECTED)) { if (stateEnum.equals(CopyrightApplyState.REJECTED) || stateEnum.equals(CopyrightApplyState.FAILED)) {
this.msg = rejectReason; this.msg = rejectReason;
} else { } else {
this.msg = stateEnum.getMsg(); this.msg = stateEnum.getMsg();
......
...@@ -122,8 +122,17 @@ public interface CopyrightApplyService extends IService<CopyrightApply> { ...@@ -122,8 +122,17 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
/** /**
* 查看证书 * 查看证书
*
* @param id * @param id
* @return * @return
*/ */
CopyrightCertificateVo getCertificate(Integer id); CopyrightCertificateVo getCertificate(Integer id);
/**
* 判断当前nft是否申请过版权
*
* @param nftHash
* @return
*/
Boolean existsByNftHash(String nftHash);
} }
...@@ -390,6 +390,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -390,6 +390,7 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
public CopyrightVo getByNftHash(String nftHash) throws ExecutionException, InterruptedException { public CopyrightVo getByNftHash(String nftHash) throws ExecutionException, InterruptedException {
QueryWrapper<CopyrightApply> wrapper = new QueryWrapper<>(); QueryWrapper<CopyrightApply> wrapper = new QueryWrapper<>();
wrapper.eq("nft_hash", nftHash); wrapper.eq("nft_hash", nftHash);
wrapper.eq("register_state", CopyrightApplyState.SUCCEEDED.getCode());
CopyrightApply copyrightApply = this.getOne(wrapper); CopyrightApply copyrightApply = this.getOne(wrapper);
if (copyrightApply == null) { if (copyrightApply == null) {
return null; return null;
...@@ -411,4 +412,11 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -411,4 +412,11 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
return new CopyrightCertificateVo(copyrightApply, user.getNickname(), category.getValue()); return new CopyrightCertificateVo(copyrightApply, user.getNickname(), category.getValue());
} }
@Override
public Boolean existsByNftHash(String nftHash) {
QueryWrapper<CopyrightApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("nft_hash", nftHash);
return count(queryWrapper) > 0;
}
} }
...@@ -206,6 +206,10 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe ...@@ -206,6 +206,10 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
} }
// 校验接收人的个人信息 // 校验接收人的个人信息
User receiveUser = userService.getUserByWallet(param.getReceiveWallet()); User receiveUser = userService.getUserByWallet(param.getReceiveWallet());
// 如果此nft已经申请版权的话,那么就不允许在一幕影链平台内部转让
if (receiveUser != null && copyrightApplyService.existsByNftHash(nft.getNftHash())) {
throw GlobalException.newException(ResultCode.TRANSFER_ERROR, "此nft已申请版权,不支持在一幕影链平台内部流转");
}
// 修改nft的拥有者用户id // 修改nft的拥有者用户id
Nft transferNft = new Nft(). Nft transferNft = new Nft().
setUserId(receiveUser != null ? receiveUser.getId() : 0). setUserId(receiveUser != null ? receiveUser.getId() : 0).
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
FROM tb_nft a FROM tb_nft a
WHERE a.user_id = #{userId} WHERE a.user_id = #{userId}
AND a.nft_hash != '' AND a.nft_hash != ''
AND nft_hash NOT IN ( SELECT nft_hash FROM tb_copyright_apply WHERE user_id = #{userId} ) AND nft_hash NOT IN ( SELECT nft_hash FROM tb_copyright_apply)
</select> </select>
</mapper> </mapper>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
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