|
|
@@ -31,6 +31,7 @@ import javax.annotation.PostConstruct;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ScheduledFuture;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
@@ -131,6 +132,26 @@ public class AuctionActivityService {
|
|
|
if (!asset.getOwnerId().equals(SecurityUtils.getAuthenticatedUser().getId())) {
|
|
|
throw new BusinessException("非本人藏品,无法操作.");
|
|
|
}
|
|
|
+
|
|
|
+ int holdDays;
|
|
|
+ if (ObjectUtils.isEmpty(asset.getHoldDays())) {
|
|
|
+ holdDays = sysConfigService.getInt("hold_days");
|
|
|
+ } else {
|
|
|
+ holdDays = asset.getHoldDays();
|
|
|
+ }
|
|
|
+ if (holdDays == 0 && AssetSource.OFFICIAL.equals(asset.getSource())) {
|
|
|
+ BigDecimal officialConsignment = sysConfigService.getBigDecimal("OFFICIAL_CONSIGNMENT");
|
|
|
+ //天转小时
|
|
|
+ int hour = officialConsignment.multiply(new BigDecimal("24")).intValue();
|
|
|
+ if (ChronoUnit.HOURS.between(asset.getCreatedAt(), LocalDateTime.now()) < hour) {
|
|
|
+ throw new BusinessException("需持有满" + hour + "小时后才能进行拍卖");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ChronoUnit.DAYS.between(asset.getCreatedAt(), LocalDateTime.now()) < holdDays) {
|
|
|
+ throw new BusinessException("需持有满" + holdDays + "天才能进行拍卖");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if (!asset.getStatus().equals(AssetStatus.NORMAL)) {
|
|
|
throw new BusinessException("藏品状态异常,无法操作.");
|
|
|
}
|