Browse Source

修改展厅藏品默认公开展示

ouyang 3 years ago
parent
commit
4f2934d053

+ 4 - 5
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -96,7 +96,7 @@ public class AssetService {
                 .price(price)
                 .build());
         rocketMQTemplate.syncSend(generalProperties.getMintTopic(), asset.getId());
-        return publicShow(asset.getId());
+        return asset;
     }
 
     public Asset createAsset(BlindBoxItem winItem, User user, Long orderId, BigDecimal price, String type,
@@ -120,17 +120,17 @@ public class AssetService {
                 .price(price)
                 .build());
         rocketMQTemplate.syncSend(generalProperties.getMintTopic(), asset.getId());
-        return publicShow(asset.getId());
+        return asset;
     }
 
 
-    public Asset publicShow(Long id) {
+    public void publicShow(Long id) {
         Asset asset = assetRepo.findById(id).orElseThrow(new BusinessException("无记录"));
         if (!asset.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())) {
             throw new BusinessException("此藏品不属于你");
         }
         if (asset.isPublicShow()) {
-            return asset;
+            return;
         }
         if (asset.getStatus() != AssetStatus.NORMAL) {
             throw new BusinessException("当前状态不可展示");
@@ -165,7 +165,6 @@ public class AssetService {
         asset.setPublicShow(true);
         asset.setPublicCollectionId(collection.getId());
         assetRepo.save(asset);
-        return asset;
     }
 
     public synchronized void consignment(Long id, BigDecimal price) {

+ 2 - 0
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -618,6 +618,7 @@ public class OrderService {
                             collection.getHoldDays());
                     order.setTokenId(asset.getTokenId());
                     orderRepo.save(order);
+                    assetService.publicShow(asset.getId());
                 } else {
                     if (collection.getSource() == CollectionSource.TRANSFER) {
 
@@ -642,6 +643,7 @@ public class OrderService {
                         }
                         order.setTokenId(asset.getTokenId());
                         orderRepo.save(order);
+                        assetService.publicShow(asset.getId());
                     }
                 }
                 commission(order);