|
|
@@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
@@ -46,6 +47,7 @@ public class AssetService {
|
|
|
private OrderRepo orderRepo;
|
|
|
private TokenHistoryRepo tokenHistoryRepo;
|
|
|
private AssetMintService assetMintService;
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
|
|
public Page<Asset> all(PageQuery pageQuery) {
|
|
|
return assetRepo.findAll(JpaUtils.toSpecification(pageQuery, Asset.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
@@ -147,6 +149,10 @@ public class AssetService {
|
|
|
if (!asset.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())) {
|
|
|
throw new BusinessException("此藏品不属于你");
|
|
|
}
|
|
|
+ int holdDays = sysConfigService.getInt("hold_days");
|
|
|
+ if (ChronoUnit.DAYS.between(asset.getCreatedAt(), LocalDateTime.now()) < holdDays) {
|
|
|
+ throw new BusinessException("需持有满" + holdDays + "天才能寄售上架");
|
|
|
+ }
|
|
|
User owner = userRepo.findById(asset.getUserId()).orElseThrow(new BusinessException("用户不存在"));
|
|
|
if (StringUtils.isBlank(owner.getSettleAccountId())) {
|
|
|
throw new BusinessException("请先绑定银行卡");
|
|
|
@@ -243,7 +249,7 @@ public class AssetService {
|
|
|
collectionRepo.delete(collection);
|
|
|
|
|
|
asset.setPublicShow(false);
|
|
|
- asset.setCollectionId(null);
|
|
|
+ asset.setPublicCollectionId(null);
|
|
|
assetRepo.save(asset);
|
|
|
}
|
|
|
|