Browse Source

companyId

xiongzhu 3 years ago
parent
commit
75cd7d32cf
1 changed files with 7 additions and 3 deletions
  1. 7 3
      src/main/java/com/izouma/nineth/service/MintOrderService.java

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

@@ -126,7 +126,8 @@ public class MintOrderService {
     @RedisLock(value = "'mintOrderLock'+#{userId}", expire = 30)
     public void create(Long userId, List<Long> assetIds) {
         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) {
             throw new BusinessException("数量不正确,请重新选择");
         }
@@ -266,7 +267,8 @@ public class MintOrderService {
                     if (a.getPrivileges().stream().noneMatch(p ->
                             "铸造".equals(p.getName())
                                     && (!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 -> {
@@ -547,6 +549,7 @@ public class MintOrderService {
                             .collectionId(mintActivity.getAirDropCollectionId())
                             .targets(Collections.singletonList(new DropTarget(user.getId(), user.getPhone(), user.getNickname(), 1)))
                             .auto(true)
+                            .companyId(1L)
                             .build());
                     mintOrder.setStatus(MintOrderStatus.FINISH);
                     mintOrderRepo.save(mintOrder);
@@ -556,7 +559,8 @@ public class MintOrderService {
             }
 
             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));
             }
             mintOrderRepo.save(mintOrder);