|
|
@@ -571,6 +571,15 @@ public class AssetService {
|
|
|
assetIds.forEach(this::cancelConsignmentBySystem);
|
|
|
}
|
|
|
|
|
|
+ @Scheduled(cron = "0 0 0/1 * * ?")
|
|
|
+ public void offTheShelfAll() {
|
|
|
+ LocalDateTime lastTime = LocalDateTime.now().minusHours(240);
|
|
|
+ Set<Long> assetIds = collectionRepo
|
|
|
+ .findResaleCollectionPriceOver20K(BigDecimal
|
|
|
+ .valueOf(0L), CollectionSource.TRANSFER, lastTime, true);
|
|
|
+ assetIds.forEach(this::cancelConsignmentBySystem);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void cancelConsignmentBySystem(Long id) {
|
|
|
Asset asset = assetRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
@@ -603,8 +612,8 @@ public class AssetService {
|
|
|
if (tags.isEmpty()) return new PageImpl<>(Collections.emptyList());
|
|
|
return assetRepo.findAll((Specification<Asset>) (root, query, criteriaBuilder) ->
|
|
|
query.distinct(true).where(criteriaBuilder.equal(root.get("userId"), userId),
|
|
|
- criteriaBuilder.equal(root.get("status"), AssetStatus.NORMAL),
|
|
|
- root.join("tags").get("id").in(tags.stream().map(Tag::getId).toArray()))
|
|
|
+ criteriaBuilder.equal(root.get("status"), AssetStatus.NORMAL),
|
|
|
+ root.join("tags").get("id").in(tags.stream().map(Tag::getId).toArray()))
|
|
|
.getRestriction(), pageable);
|
|
|
} else {
|
|
|
return assetRepo.findByUserIdAndStatusAndNameLike(userId, AssetStatus.NORMAL,
|