wangqifan 2 жил өмнө
parent
commit
ed7cdbb73e

+ 6 - 0
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -435,6 +435,12 @@ public class AssetService {
 
     public void publicShow(Long id) {
         Asset asset = assetRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+        Set<DomainAskStatus> statuses = new HashSet<>();
+        statuses.add(DomainAskStatus.ASKING);
+        if (domainAskRepo
+                .countByAssetIdAndOwnerIdAndStatusInAndDelFalse(asset.getId(), asset.getOwnerId(), statuses) > 0) {
+            throw new BusinessException("已有叫价,不可上架");
+        }
         if (!asset.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())) {
             throw new BusinessException("此藏品不属于你");
         }