licailing 3 ani în urmă
părinte
comite
652a892adf

+ 2 - 2
src/main/java/com/izouma/nineth/service/AssetPostService.java

@@ -39,7 +39,7 @@ public class AssetPostService {
     */
     public AssetPost assetPost(Long userId, Long assetId, Long addressId) {
         Asset asset = assetRepo.findById(assetId).orElseThrow(new BusinessException("无此衍生品"));
-        if (userId.equals(asset.getUserId())) {
+        if (!userId.equals(asset.getUserId())) {
             throw new BusinessException("此衍生品不属于你");
         }
         if (asset.isPublicShow()) {
@@ -48,7 +48,7 @@ public class AssetPostService {
             }
             throw new BusinessException("请先取消公开展示");
         }
-        if (AssetStatus.POSTED.equals(asset.getStatus())) {
+        if (AssetStatus.POSTED.equals(asset.getStatus()) || AssetStatus.POSTING.equals(asset.getStatus())) {
             throw new BusinessException("已邮寄,无需再邮寄");
         }
         if (!AssetStatus.NORMAL.equals(asset.getStatus())) {

+ 21 - 0
src/test/java/com/izouma/nineth/service/AssetPostServiceTest.java

@@ -0,0 +1,21 @@
+package com.izouma.nineth.service;
+
+import com.izouma.nineth.ApplicationTests;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class AssetPostServiceTest extends ApplicationTests {
+
+    @Autowired
+    private AssetPostService assetPostService;
+
+    @Test
+    public void assetPost() {
+        assetPostService.assetPost(7834L, 8270L, 8272L);
+    }
+
+    @Test
+    public void updateStatus() {
+    }
+}