|
|
@@ -1,8 +1,12 @@
|
|
|
package com.izouma.nineth.service;
|
|
|
|
|
|
+import com.izouma.nineth.domain.Asset;
|
|
|
import com.izouma.nineth.domain.AssetPost;
|
|
|
import com.izouma.nineth.dto.PageQuery;
|
|
|
+import com.izouma.nineth.enums.AssetStatus;
|
|
|
+import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.AssetPostRepo;
|
|
|
+import com.izouma.nineth.repo.AssetRepo;
|
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
@@ -13,8 +17,29 @@ import org.springframework.stereotype.Service;
|
|
|
public class AssetPostService {
|
|
|
|
|
|
private AssetPostRepo assetPostRepo;
|
|
|
+ private AssetRepo assetRepo;
|
|
|
|
|
|
public Page<AssetPost> all(PageQuery pageQuery) {
|
|
|
return assetPostRepo.findAll(JpaUtils.toSpecification(pageQuery, AssetPost.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
}
|
|
|
+
|
|
|
+ /*
|
|
|
+ 衍生品上链
|
|
|
+ 衍生品有盲盒类型
|
|
|
+ 衍生品邮寄不支付快递费
|
|
|
+ 衍生品暂不可以取消邮寄
|
|
|
+ */
|
|
|
+ public void post(Long assetId) {
|
|
|
+ Asset asset = assetRepo.findById(assetId).orElseThrow(new BusinessException("无此衍生品"));
|
|
|
+ if (asset.isPublicShow()) {
|
|
|
+ if (asset.isConsignment()) {
|
|
|
+ throw new BusinessException("请先取消寄售");
|
|
|
+ }
|
|
|
+ throw new BusinessException("请先取消公开展示");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!AssetStatus.NORMAL.equals(asset.getStatus())) {
|
|
|
+ throw new BusinessException("当前状态不可邮寄");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|