Просмотр исходного кода

Merge branch 'master' of http://git.izouma.com/xiongzhu/raex_back into dev-meta

sunkean 3 лет назад
Родитель
Сommit
4033be520b

+ 7 - 3
src/main/java/com/izouma/nineth/service/MintOrderService.java

@@ -126,7 +126,8 @@ public class MintOrderService {
     @RedisLock(value = "'mintOrderLock'+#{userId}", expire = 30)
     @RedisLock(value = "'mintOrderLock'+#{userId}", expire = 30)
     public void create(Long userId, List<Long> assetIds) {
     public void create(Long userId, List<Long> assetIds) {
         User user = userRepo.findByIdAndDelFalse(userId).orElseThrow(new BusinessException("用户不存在"));
         User user = userRepo.findByIdAndDelFalse(userId).orElseThrow(new BusinessException("用户不存在"));
-        User blackHole = userRepo.findByIdAndDelFalse(Constants.BLACK_HOLE_USER_ID).orElseThrow(new BusinessException("无法铸造"));
+        User blackHole = userRepo.findByIdAndDelFalse(Constants.BLACK_HOLE_USER_ID)
+                .orElseThrow(new BusinessException("无法铸造"));
         if (assetIds.size() != 3) {
         if (assetIds.size() != 3) {
             throw new BusinessException("数量不正确,请重新选择");
             throw new BusinessException("数量不正确,请重新选择");
         }
         }
@@ -266,7 +267,8 @@ public class MintOrderService {
                     if (a.getPrivileges().stream().noneMatch(p ->
                     if (a.getPrivileges().stream().noneMatch(p ->
                             "铸造".equals(p.getName())
                             "铸造".equals(p.getName())
                                     && (!p.isOnce() || !p.isOpened()))) {
                                     && (!p.isOnce() || !p.isOpened()))) {
-                        throw new BusinessException(a.getName() + (a.getNumber() == null ? "" : (" #" + a.getNumber().toString())) + " 无铸造特权或特权已使用");
+                        throw new BusinessException(a.getName() + (a.getNumber() == null ? "" : (" #" + a.getNumber()
+                                .toString())) + " 无铸造特权或特权已使用");
                     }
                     }
                 });
                 });
                 assets.forEach(asset -> {
                 assets.forEach(asset -> {
@@ -547,6 +549,7 @@ public class MintOrderService {
                             .collectionId(mintActivity.getAirDropCollectionId())
                             .collectionId(mintActivity.getAirDropCollectionId())
                             .targets(Collections.singletonList(new DropTarget(user.getId(), user.getPhone(), user.getNickname(), 1)))
                             .targets(Collections.singletonList(new DropTarget(user.getId(), user.getPhone(), user.getNickname(), 1)))
                             .auto(true)
                             .auto(true)
+                            .companyId(1L)
                             .build());
                             .build());
                     mintOrder.setStatus(MintOrderStatus.FINISH);
                     mintOrder.setStatus(MintOrderStatus.FINISH);
                     mintOrderRepo.save(mintOrder);
                     mintOrderRepo.save(mintOrder);
@@ -556,7 +559,8 @@ public class MintOrderService {
             }
             }
 
 
             if (mintOrder.isConsume()) {
             if (mintOrder.isConsume()) {
-                User newOwner = userRepo.findByIdAndDelFalse(Constants.BLACK_HOLE_USER_ID).orElseThrow(new BusinessException("无法铸造"));
+                User newOwner = userRepo.findByIdAndDelFalse(Constants.BLACK_HOLE_USER_ID)
+                        .orElseThrow(new BusinessException("无法铸造"));
                 assets.forEach(asset -> assetService.transfer(asset, asset.getPrice(), newOwner, TransferReason.GIFT, null));
                 assets.forEach(asset -> assetService.transfer(asset, asset.getPrice(), newOwner, TransferReason.GIFT, null));
             }
             }
             mintOrderRepo.save(mintOrder);
             mintOrderRepo.save(mintOrder);

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

@@ -50,9 +50,10 @@ public class PhotoAssetService {
         //销毁原来的藏品
         //销毁原来的藏品
         assetService.destroyWithoutTradecode(photoAsset.getDestroyAssetId(), photoAsset.getUserId());
         assetService.destroyWithoutTradecode(photoAsset.getDestroyAssetId(), photoAsset.getUserId());
         //生成新的藏品
         //生成新的藏品
-        assetService.createAsset(photoAsset, userRepo.findById(photoAsset.getUserId())
-                .orElseThrow(new BusinessException("无用户记录")), null, BigDecimal.ZERO, "星图", 1, true);
+        Long createId = assetService.createAsset(photoAsset, userRepo.findById(photoAsset.getUserId())
+                .orElseThrow(new BusinessException("无用户记录")), null, BigDecimal.ZERO, "星图", 1, true).getId();
         photoAsset.setStatus(CollectionStatus.SUCCESS);
         photoAsset.setStatus(CollectionStatus.SUCCESS);
+        photoAsset.setCreateAssetId(createId);
         photoAssetRepo.save(photoAsset);
         photoAssetRepo.save(photoAsset);
     }
     }
 
 
@@ -62,8 +63,7 @@ public class PhotoAssetService {
 
 
         Asset asset = assetRepo.findById(photoAsset.getId()).orElseThrow(new BusinessException("无藏品记录"));
         Asset asset = assetRepo.findById(photoAsset.getId()).orElseThrow(new BusinessException("无藏品记录"));
         asset.setStatus(AssetStatus.NORMAL);
         asset.setStatus(AssetStatus.NORMAL);
-        Long createId = assetRepo.saveAndFlush(asset).getId();
-        photoAsset.setCreateAssetId(createId);
+        assetRepo.saveAndFlush(asset);
         photoAssetRepo.save(photoAsset);
         photoAssetRepo.save(photoAsset);
     }
     }
 }
 }