|
|
@@ -114,7 +114,7 @@ public class AssetService {
|
|
|
.minterAvatar(winItem.getMinterAvatar())
|
|
|
.name(winItem.getName())
|
|
|
.detail(winItem.getDetail())
|
|
|
- .pic(winItem.getPics())
|
|
|
+ .pic(winItem.getPic())
|
|
|
.properties(winItem.getProperties())
|
|
|
.canResale(winItem.isCanResale())
|
|
|
.royalties(winItem.getRoyalties())
|
|
|
@@ -125,7 +125,7 @@ public class AssetService {
|
|
|
.gasUsed(nft.getGasUsed())
|
|
|
.price(order.getPrice())
|
|
|
.status(AssetStatus.NORMAL)
|
|
|
- .ipfsUrl(ipfsUpload(winItem.getPics().get(0).getUrl()))
|
|
|
+ .ipfsUrl(ipfsUpload(winItem.getPic().get(0).getUrl()))
|
|
|
.build();
|
|
|
assetRepo.save(asset);
|
|
|
applicationContext.publishEvent(new CreateAssetEvent(this, true, order, asset));
|
|
|
@@ -161,7 +161,7 @@ public class AssetService {
|
|
|
User owner = userRepo.findById(asset.getUserId()).orElseThrow(new BusinessException("用户不存在"));
|
|
|
Collection collection = Collection.builder()
|
|
|
.name(asset.getName())
|
|
|
- .pics(asset.getPic())
|
|
|
+ .pic(asset.getPic())
|
|
|
.minter(asset.getMinter())
|
|
|
.minterId(asset.getMinterId())
|
|
|
.minterAvatar(asset.getMinterAvatar())
|
|
|
@@ -181,10 +181,53 @@ public class AssetService {
|
|
|
.canResale(asset.isCanResale())
|
|
|
.royalties(asset.getRoyalties())
|
|
|
.serviceCharge(asset.getServiceCharge())
|
|
|
+ .assetId(id)
|
|
|
.build();
|
|
|
collectionRepo.save(collection);
|
|
|
asset.setPublicShow(true);
|
|
|
asset.setPublicCollectionId(collection.getId());
|
|
|
+ assetRepo.save(asset);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Consignment(Long id, BigDecimal price) {
|
|
|
+ Asset asset = assetRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
+ Collection collection = null;
|
|
|
+ if (asset.isPublicShow() && asset.getCollectionId() != null) {
|
|
|
+ collection = collectionRepo.findById(asset.getCollectionId()).orElse(null);
|
|
|
+ }
|
|
|
+ User owner = userRepo.findById(asset.getUserId()).orElseThrow(new BusinessException("用户不存在"));
|
|
|
+ if (collection == null) {
|
|
|
+ collection = Collection.builder()
|
|
|
+ .name(asset.getName())
|
|
|
+ .pic(asset.getPic())
|
|
|
+ .minter(asset.getMinter())
|
|
|
+ .minterId(asset.getMinterId())
|
|
|
+ .minterAvatar(asset.getMinterAvatar())
|
|
|
+ .owner(owner.getNickname())
|
|
|
+ .ownerId(owner.getId())
|
|
|
+ .ownerAvatar(owner.getAvatar())
|
|
|
+ .detail(asset.getDetail())
|
|
|
+ .type(CollectionType.DEFAULT)
|
|
|
+ .source(CollectionSource.TRANSFER)
|
|
|
+ .sale(0)
|
|
|
+ .stock(1)
|
|
|
+ .total(1)
|
|
|
+ .onShelf(true)
|
|
|
+ .salable(false)
|
|
|
+ .price(BigDecimal.valueOf(0))
|
|
|
+ .properties(asset.getProperties())
|
|
|
+ .canResale(asset.isCanResale())
|
|
|
+ .royalties(asset.getRoyalties())
|
|
|
+ .serviceCharge(asset.getServiceCharge())
|
|
|
+ .assetId(id)
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+ collection.setSalable(true);
|
|
|
+ collection.setPrice(price);
|
|
|
+ collectionRepo.save(collection);
|
|
|
+ asset.setPublicShow(true);
|
|
|
+ asset.setPublicCollectionId(collection.getId());
|
|
|
+ assetRepo.save(asset);
|
|
|
}
|
|
|
|
|
|
public void cancelPublic(Long id) {
|