|
@@ -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);
|