|
|
@@ -23,32 +23,22 @@ public class VipAsyncService {
|
|
|
private final DelegationService delegationService;
|
|
|
private final UserVipRepo userVipRepo;
|
|
|
|
|
|
- @Async
|
|
|
@Transactional
|
|
|
- public Future<Void> autoTrade(UserVip userVip, Product product) {
|
|
|
+ public void autoTrade(UserVip userVip, Product product) {
|
|
|
Long userId = userVip.getUserId();
|
|
|
- try {
|
|
|
- log.info("🚚 start, userId: {}, productId: {}", userId, product.getId());
|
|
|
- Order order = orderService.createOrder(userId, product.getId(), null, true);
|
|
|
- log.info("🚚 create order success, userId: {}, productId: {}, orderId: {}", userId, product.getId(), order.getId());
|
|
|
+ log.info("🚚 start, userId: {}, productId: {}", userId, product.getId());
|
|
|
+ Order order = orderService.createOrder(userId, product.getId(), null, true);
|
|
|
+ log.info("🚚 create order success, userId: {}, productId: {}, orderId: {}", userId, product.getId(), order.getId());
|
|
|
|
|
|
- log.info("🚚 pay start, userId: {}, productId: {}", userId, product.getId());
|
|
|
- orderService.balancePay(userId, order.getId());
|
|
|
- log.info("🚚 pay success, userId: {}, productId: {}", userId, product.getId());
|
|
|
+ log.info("🚚 pay start, userId: {}, productId: {}", userId, product.getId());
|
|
|
+ orderService.balancePay(userId, order.getId());
|
|
|
+ log.info("🚚 pay success, userId: {}, productId: {}", userId, product.getId());
|
|
|
|
|
|
- userVipRepo.increaseUsed(userId);
|
|
|
- log.info("🚚 increase used limit, userId: {}, left: {}", userId, userVip.getDailyLimit() - userVip.getTodayUsed() - 1);
|
|
|
+ userVipRepo.increaseUsed(userId);
|
|
|
+ log.info("🚚 increase used limit, userId: {}, left: {}", userId, userVip.getDailyLimit() - userVip.getTodayUsed() - 1);
|
|
|
|
|
|
- log.info("🚚 pay delegation start, userId: {}, productId: {}", userId, product.getId());
|
|
|
- delegationService.payDelegationBalance(userId, order.getId());
|
|
|
- log.info("🚚 pay delegation success, userId: {}, productId: {}", userId, product.getId());
|
|
|
- } catch (Exception e) {
|
|
|
- if (e instanceof BusinessException) {
|
|
|
- log.error("🚚 error, message: {}", e.getMessage());
|
|
|
- } else {
|
|
|
- log.error("🚚 error", e);
|
|
|
- }
|
|
|
- }
|
|
|
- return new AsyncResult<>(null);
|
|
|
+ log.info("🚚 pay delegation start, userId: {}, productId: {}", userId, product.getId());
|
|
|
+ delegationService.payDelegationBalance(userId, order.getId());
|
|
|
+ log.info("🚚 pay delegation success, userId: {}, productId: {}", userId, product.getId());
|
|
|
}
|
|
|
}
|