|
@@ -80,7 +80,7 @@ public class AuctionOrderService {
|
|
|
AuctionActivity auction = auctionActivityRepo.findById(auctionId)
|
|
AuctionActivity auction = auctionActivityRepo.findById(auctionId)
|
|
|
.orElseThrow(new BusinessException("无拍卖信息"));
|
|
.orElseThrow(new BusinessException("无拍卖信息"));
|
|
|
|
|
|
|
|
- if (!auction.isOnShelf() || auction.getEndTime().isBefore(LocalDateTime.now())) {
|
|
|
|
|
|
|
+ if (!auction.isOnShelf()) {
|
|
|
throw new BusinessException("拍卖已结束");
|
|
throw new BusinessException("拍卖已结束");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -105,9 +105,7 @@ public class AuctionOrderService {
|
|
|
if (user.getId().equals(auction.getSellerId())) {
|
|
if (user.getId().equals(auction.getSellerId())) {
|
|
|
throw new BusinessException("不可自己出价自己");
|
|
throw new BusinessException("不可自己出价自己");
|
|
|
}
|
|
}
|
|
|
- if (AuctionPaymentType.DEPOSIT.equals(type)) {
|
|
|
|
|
- return this.createDeposit(user, auction);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
if (AuctionPaymentType.PURCHASE_PRICE.equals(type)) {
|
|
if (AuctionPaymentType.PURCHASE_PRICE.equals(type)) {
|
|
|
if (auction.getEndTime().isAfter(LocalDateTime.now())) {
|
|
if (auction.getEndTime().isAfter(LocalDateTime.now())) {
|
|
|
throw new BusinessException("拍卖还未结束");
|
|
throw new BusinessException("拍卖还未结束");
|
|
@@ -123,6 +121,13 @@ public class AuctionOrderService {
|
|
|
if (LocalDateTime.now().isAfter(auction.getEndTime().plusMinutes(time))) {
|
|
if (LocalDateTime.now().isAfter(auction.getEndTime().plusMinutes(time))) {
|
|
|
throw new BusinessException("超过支付时长");
|
|
throw new BusinessException("超过支付时长");
|
|
|
}
|
|
}
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (auction.getEndTime().isBefore(LocalDateTime.now())) {
|
|
|
|
|
+ throw new BusinessException("拍卖已结束");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (AuctionPaymentType.DEPOSIT.equals(type)) {
|
|
|
|
|
+ return this.createDeposit(user, auction);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
UserAddress userAddress = null;
|
|
UserAddress userAddress = null;
|
|
@@ -335,6 +340,7 @@ public class AuctionOrderService {
|
|
|
|
|
|
|
|
if (AuctionPaymentType.PURCHASE_PRICE.equals(order.getPaymentType())) {
|
|
if (AuctionPaymentType.PURCHASE_PRICE.equals(order.getPaymentType())) {
|
|
|
//如果是拍卖,需获取取消订单的时长
|
|
//如果是拍卖,需获取取消订单的时长
|
|
|
|
|
+ log.info("取消订单流拍:{}", auction.getId());
|
|
|
int time = sysConfigService.getInt("auction_cancel_time");
|
|
int time = sysConfigService.getInt("auction_cancel_time");
|
|
|
if (LocalDateTime.now().isAfter(auction.getEndTime().plusMinutes(time))) {
|
|
if (LocalDateTime.now().isAfter(auction.getEndTime().plusMinutes(time))) {
|
|
|
//超过支付时长
|
|
//超过支付时长
|
|
@@ -443,7 +449,7 @@ public class AuctionOrderService {
|
|
|
redisTemplate.delete(RedisKeys.AUCTION_ORDER_LOCK + orderId);
|
|
redisTemplate.delete(RedisKeys.AUCTION_ORDER_LOCK + orderId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Scheduled(cron = "0 0/30 * * * ?")
|
|
|
|
|
|
|
+ @Scheduled(cron = "0 0/10 * * * ?")
|
|
|
public void passOverTimeAuction() {
|
|
public void passOverTimeAuction() {
|
|
|
List<AuctionActivity> purchased = auctionActivityRepo.findAllByStatus(AuctionStatus.PURCHASED);
|
|
List<AuctionActivity> purchased = auctionActivityRepo.findAllByStatus(AuctionStatus.PURCHASED);
|
|
|
if (purchased != null) {
|
|
if (purchased != null) {
|
|
@@ -452,7 +458,10 @@ public class AuctionOrderService {
|
|
|
if (LocalDateTime.now().isAfter(act.getEndTime().plusMinutes(time))) {
|
|
if (LocalDateTime.now().isAfter(act.getEndTime().plusMinutes(time))) {
|
|
|
List<AuctionOrder> auctionOrders = auctionOrderRepo.findAllByAuctionIdAndPaymentTypeAndStatus(act
|
|
List<AuctionOrder> auctionOrders = auctionOrderRepo.findAllByAuctionIdAndPaymentTypeAndStatus(act
|
|
|
.getId(), AuctionPaymentType.PURCHASE_PRICE, AuctionOrderStatus.NOT_PAID);
|
|
.getId(), AuctionPaymentType.PURCHASE_PRICE, AuctionOrderStatus.NOT_PAID);
|
|
|
- auctionOrders.forEach(this::cancel);
|
|
|
|
|
|
|
+// if (CollUtil.isNotEmpty(auctionOrders)) {
|
|
|
|
|
+ auctionOrders.forEach(this::cancel);
|
|
|
|
|
+// return;
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
auctionActivityService.changeStatus(act.getId(), AuctionStatus.PASS);
|
|
auctionActivityService.changeStatus(act.getId(), AuctionStatus.PASS);
|
|
|
log.info("拍卖定时任务流拍{}", act.getId());
|
|
log.info("拍卖定时任务流拍{}", act.getId());
|