Commit db60d826 authored by wp's avatar wp

商品发布

parent c171d927
...@@ -97,39 +97,20 @@ public class NftEvm { ...@@ -97,39 +97,20 @@ public class NftEvm {
// System.out.println(ra.evmEstimateGasNew(rawDeployTxHex, tokenManager)); // System.out.println(ra.evmEstimateGasNew(rawDeployTxHex, tokenManager));
System.out.println(hash);*/ System.out.println(hash);*/
//"1KzrvBBeVUavMjqnTVzzCygUVmPNk9vkra"; tes111111
//"1JpdprGVHukafixsncEFCvQ6uhSvwA6DWP"; tes111112
//部署NFT合约,无需再次部署,已经部署
// String hash = ra.evmDeploy(code, abi, "LyNFT", RpcConfig.TX_EVM_DEPLOY_FEE, "LyNFT", null, tokenManager, tokenManagerKey, false);
// System.err.println(hash);
//1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW //1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW
// long[] tokenIds = {1, 2, 3};
long[] tokenIds = {1, 2, 3}; // long[] amounts = {1, 1, 1};
long[] amounts = {1, 1, 1};
//发行NFT,本次发行的是ERC1155 //发行NFT,本次发行的是ERC1155
String hash = ra.evmPublishToken(abi, cAddr, EvmTokenEnum.ERC1155, 0L, "1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW", "1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW",null, 1L, 1L, "publish", true); // String hash = ra.evmPublishToken(abi, cAddr, EvmTokenEnum.ERC1155, 0L, "1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW", "1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW",null, 1L, 1L, "publish", true);
// String hash = ra.evmPublishTokenBatch(abi, cAddr, 0L, "1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW", "1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW", null, tokenIds, amounts, "publish", true); // String hash = ra.evmPublishTokenBatch(abi, cAddr, 0L, "1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW", "1HBT7zyMYz7n9jz3JuYhEgFWuEtvpqxQaW", null, tokenIds, amounts, "publish", true);
System.err.println(hash);
System.err.println(ra.cycleConfirmTxWithHash(hash, true, 1000).getStatus());
//NFT转账
// String hash = ra.evmTransfer(abi, cAddr, EvmTokenEnum.ERC1155, 0L, to, tokenId, 100L, "transfer", publisher, null, false);
// System.err.println(hash); // System.err.println(hash);
// System.err.println(ra.cycleConfirmTxWithHash(hash, true, 1000).getStatus());
//NFT转账
/*TxResult result = ra.confirmTxWithGrpTxHash(hash);
if (result.getStatus() != TxStatusEnum.SUCCESS) {
System.err.println("TRUE");
}*/
// String hash = ra.evmDeploy(code, abi, "MallNFT", RpcConfig.TX_EVM_DEPLOY_FEE, "MallNFT", null, tokenManager, tokenManagerKey, false);
// System.err.println(ra.walletCreateAccount("rressfe"));
} }
} }
...@@ -58,14 +58,6 @@ public class GoodsNftServiceImpl extends ServiceImpl<GoodsNftMapper, GoodsNft> i ...@@ -58,14 +58,6 @@ public class GoodsNftServiceImpl extends ServiceImpl<GoodsNftMapper, GoodsNft> i
//发行NFT //发行NFT
hash = chainUtil.evmPublishTokenSplit(nftAddr, timestamp, nftdto.getNumber()); hash = chainUtil.evmPublishTokenSplit(nftAddr, timestamp, nftdto.getNumber());
System.err.println("nftdto");
System.err.println(nftdto);
System.err.println(goodsId);
System.err.println(name);
System.err.println(nftAddr);
System.err.println(merchantId);
System.err.println(hash);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("goodsId", goodsId); map.put("goodsId", goodsId);
map.put("hash", hash); map.put("hash", hash);
......
...@@ -124,13 +124,15 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS ...@@ -124,13 +124,15 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
if (kDTO.getNftSalesType().equals(2)) { if (kDTO.getNftSalesType().equals(2)) {
//发行NFT //发行NFT
System.err.println(kDTO.getCoinName());
ExternalToken externalToken = externalTokenService.queryByLabelNameAndMerchantId(kDTO.getCoinName(), merchantId); ExternalToken externalToken = externalTokenService.queryByLabelNameAndMerchantId(kDTO.getCoinName(), merchantId);
String tokenId = externalToken.getTokenId().toString(); String tokenId = externalToken.getTokenId().toString();
long[] nos = new long[Math.toIntExact(kDTO.getStock() + 1)]; long[] nos = new long[Math.toIntExact(kDTO.getStock() + 1)];
String[] hashs = new String[Math.toIntExact(kDTO.getStock())]; String[] hashs = new String[Math.toIntExact(kDTO.getStock())];
nos[0] = 0; nos[0] = 0;
for (int i = 0; i < kDTO.getStock(); i++) { for (int i = 0; i < kDTO.getStock(); i++) {
String hash = chainUtil.evmPublishTokenSplit(merchant.getNftAddr(), Long.parseLong(tokenId + (i + 1)), 1L); String hash = chainUtil.evmPublishTokenSplit(merchant.getTokenIssueAddr(), Long.parseLong(tokenId + (i + 1)), 1L);
nos[i + 1] = i + 1; nos[i + 1] = i + 1;
hashs[i] = hash; hashs[i] = hash;
} }
...@@ -281,10 +283,10 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS ...@@ -281,10 +283,10 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
}*/ }*/
if (commodityPass.equals(1) && pDTOType.equals(6)) { if (commodityPass.equals(1) && pDTOType.equals(6)) {
String tokenId = one.getCoinName().substring(4); String tokenId = one.getCoinName().substring(4);
long balance = chainUtil.evmBalance(merchant.getNftAddr(), Long.parseLong(tokenId)); long balance = chainUtil.evmBalance(merchant.getTokenIssueAddr(), Long.parseLong(tokenId));
String hash = ""; String hash = "";
if (balance != 0) { if (balance != 0) {
hash = chainUtil.evmPublishTokenSplit(merchant.getNftAddr(), Long.parseLong(tokenId), one.getStock()); hash = chainUtil.evmPublishTokenSplit(merchant.getTokenIssueAddr(), Long.parseLong(tokenId), one.getStock());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("goodsId", goodsId); map.put("goodsId", goodsId);
map.put("hash", hash); map.put("hash", hash);
...@@ -301,17 +303,14 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS ...@@ -301,17 +303,14 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
String[] hashs = new String[Math.toIntExact(kDTO.getStock())]; String[] hashs = new String[Math.toIntExact(kDTO.getStock())];
nos[0] = 0; nos[0] = 0;
for (int i = 0; i < kDTO.getStock(); i++) { for (int i = 0; i < kDTO.getStock(); i++) {
long balance = chainUtil.evmBalance(merchant.getNftAddr(), Long.parseLong(tokenId + (i + 1))); long balance = chainUtil.evmBalance(merchant.getTokenIssueAddr(), Long.parseLong(tokenId + (i + 1)));
if (balance != 0) { if (balance != 0) {
String hash = chainUtil.evmPublishTokenSplit(merchant.getNftAddr(), Long.parseLong(tokenId + (i + 1)), 1L); String hash = chainUtil.evmPublishTokenSplit(merchant.getTokenIssueAddr(), Long.parseLong(tokenId + (i + 1)), 1L);
hashs[i] = hash; hashs[i] = hash;
} }
nos[i + 1] = i + 1; nos[i + 1] = i + 1;
} }
System.err.println("nos:" + Arrays.toString(nos));
System.err.println("hashs:" + hashs);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("goodsId", goodsId); map.put("goodsId", goodsId);
map.put("hashs", hashs); map.put("hashs", hashs);
......
...@@ -96,7 +96,7 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS ...@@ -96,7 +96,7 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS
} else if (pDTOType.equals(NFT.getType())) { } else if (pDTOType.equals(NFT.getType())) {
if (pDTO.getCommodityPass() != 3) { if (pDTO.getCommodityPass() != 3) {
nftService.add(pDTO.getNftdto(), goodsId, pDTO.getName(), nftService.add(pDTO.getNftdto(), goodsId, pDTO.getName(),
merchantService.getByMerchantId(merchantId).getNftAddr(), merchantService.getByMerchantId(merchantId).getTokenIssueAddr(),
merchantId, timestamp); merchantId, timestamp);
if (pDTO.getNftdto().getTzType().equals(1)) { if (pDTO.getNftdto().getTzType().equals(1)) {
List<GoodsSkuDTO> objects = pDTO.getSkuList().stream().peek(v -> v.setCoinName(MALLGlobalConfig.NFT_PREFIX + timestamp)) List<GoodsSkuDTO> objects = pDTO.getSkuList().stream().peek(v -> v.setCoinName(MALLGlobalConfig.NFT_PREFIX + timestamp))
...@@ -134,6 +134,10 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS ...@@ -134,6 +134,10 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS
BigDecimal price = pDTO.getNftdto().getPrice(); BigDecimal price = pDTO.getNftdto().getPrice();
spu.setMaxPrice(price); spu.setMaxPrice(price);
spu.setDefaultPrice(price); spu.setDefaultPrice(price);
if (pDTO.getCommodityPass() == 3) {
spu.setMaxPrice(pDTO.getSkuList().get(0).getOriginalPrice());
spu.setDefaultPrice(pDTO.getSkuList().get(0).getOriginalPrice());
}
} else { } else {
Map<String, Object> price = skuService.getMaxAndMinPrice(goodsId); Map<String, Object> price = skuService.getMaxAndMinPrice(goodsId);
spu.setMaxPrice((BigDecimal) (price.get("maxPrice"))); spu.setMaxPrice((BigDecimal) (price.get("maxPrice")));
...@@ -183,6 +187,10 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS ...@@ -183,6 +187,10 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS
BigDecimal price = pDTO.getNftdto().getPrice(); BigDecimal price = pDTO.getNftdto().getPrice();
spu.setMaxPrice(price); spu.setMaxPrice(price);
spu.setDefaultPrice(price); spu.setDefaultPrice(price);
if (one.getCommodityPass() == 3){
spu.setMaxPrice(pDTO.getSkuList().get(0).getOriginalPrice());
spu.setDefaultPrice(pDTO.getSkuList().get(0).getOriginalPrice());
}
} else { } else {
Map<String, Object> price = skuService.getMaxAndMinPrice(goodsId); Map<String, Object> price = skuService.getMaxAndMinPrice(goodsId);
spu.setMaxPrice((BigDecimal) (price.get("maxPrice"))); spu.setMaxPrice((BigDecimal) (price.get("maxPrice")));
...@@ -242,6 +250,10 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS ...@@ -242,6 +250,10 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS
BigDecimal price = eDTO.getNftdto().getPrice(); BigDecimal price = eDTO.getNftdto().getPrice();
spu.setMaxPrice(price); spu.setMaxPrice(price);
spu.setDefaultPrice(price); spu.setDefaultPrice(price);
if (one.getCommodityPass() == 3){
spu.setMaxPrice(eDTO.getSkuList().get(0).getOriginalPrice());
spu.setDefaultPrice(eDTO.getSkuList().get(0).getOriginalPrice());
}
} else { } else {
Map<String, Object> price = skuService.getMaxAndMinPrice(goodsId); Map<String, Object> price = skuService.getMaxAndMinPrice(goodsId);
spu.setMaxPrice((BigDecimal) (price.get("maxPrice"))); spu.setMaxPrice((BigDecimal) (price.get("maxPrice")));
......
...@@ -50,6 +50,3 @@ pay: ...@@ -50,6 +50,3 @@ pay:
we-chat-pay-url: we-chat-pay-url:
pay-in-chain: true pay-in-chain: true
#唐拓服务ip端口
ly:
url: http://146.56.218.121:8081/open/nft/hash
\ No newline at end of file
...@@ -54,7 +54,7 @@ chain: ...@@ -54,7 +54,7 @@ chain:
para: para:
rpc-url: http://172.22.20.100:8901 rpc-url: http://172.22.20.100:8901
withhold: 1417K9fd5vt4zYW86xinWiCbAkNP794aNy withhold: 1417K9fd5vt4zYW86xinWiCbAkNP794aNy
withhold-key: 0x19d78691584930407e63cd35ac6e67fae6113894b41812e65847d4a365a802a0 withhold-key: 19d78691584930407e63cd35ac6e67fae6113894b41812e65847d4a365a802a0
token-manager: 1N2ABERwHgxGhebVw6fVSwaQ5uLAysmGEu token-manager: 1N2ABERwHgxGhebVw6fVSwaQ5uLAysmGEu
token-manager-key: 4e92bda2477ded0e7c07a9e3acd2370de8d7401c68cc83ee8376806db3121e77 token-manager-key: 4e92bda2477ded0e7c07a9e3acd2370de8d7401c68cc83ee8376806db3121e77
title: user.p.nftChain. title: user.p.nftChain.
...@@ -97,3 +97,6 @@ wxpay: ...@@ -97,3 +97,6 @@ wxpay:
ufdorder-url: https://api.mch.weixin.qq.com/pay/unifiedorder ufdorder-url: https://api.mch.weixin.qq.com/pay/unifiedorder
order-query-url: https://api.mch.weixin.qq.com/pay/orderquery order-query-url: https://api.mch.weixin.qq.com/pay/orderquery
#唐拓服务ip端口
ly:
url: http://146.56.218.121:8081/open/nft/hash
\ No newline at end of file
...@@ -2,4 +2,4 @@ spring: ...@@ -2,4 +2,4 @@ spring:
profiles: profiles:
active: active:
- common - common
- test - dev
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