wangqifan 4 yıl önce
ebeveyn
işleme
b72db4c42b

+ 4 - 0
src/main/java/com/izouma/nineth/domain/ShowCollection.java

@@ -1,5 +1,7 @@
 package com.izouma.nineth.domain;
 
+import com.izouma.nineth.enums.AssetStatus;
+import com.izouma.nineth.enums.CollectionStatus;
 import io.swagger.annotations.ApiModel;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -34,5 +36,7 @@ public class ShowCollection extends BaseEntity {
 
     private String name;
 
+    private AssetStatus assetStatus;
+
     private int sort;
 }

+ 2 - 0
src/main/java/com/izouma/nineth/domain/Showroom.java

@@ -34,6 +34,8 @@ public class Showroom extends BaseEntity {
 
     private Long assetId;
 
+    private String name;
+
     @ApiModelProperty("头像")
     private String pic;
 

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

@@ -33,7 +33,8 @@ public class ShowroomService {
     private SysConfigService        sysConfigService;
 
     public Page<Showroom> all(PageQuery pageQuery) {
-        return showroomRepo.findAll(JpaUtils.toSpecification(pageQuery, Showroom.class), JpaUtils.toPageRequest(pageQuery));
+        return showroomRepo
+                .findAll(JpaUtils.toSpecification(pageQuery, Showroom.class), JpaUtils.toPageRequest(pageQuery));
     }
 
     /*
@@ -94,6 +95,8 @@ public class ShowroomService {
                 if ("video/mp4".equals(pic.getType())) {
                     showCollection.setPic(pic.getThumb());
                 }
+                showCollection.setAssetStatus(assetRepo.findById(collection.getAssetId())
+                        .orElse(Asset.builder().status(AssetStatus.NORMAL).build()).getStatus());
                 showCollection.setShowroomId(show.getId());
                 showCollection.setAssetId(collection.getAssetId());
                 showCollectionRepo.save(showCollection);
@@ -177,7 +180,7 @@ public class ShowroomService {
         Set<Long> removeRecord = new HashSet<>(showCollectionMap.keySet());
 
         if (CollUtil.isNotEmpty(showCollections)) {
-             showCollections = showCollections.stream().distinct().collect(Collectors.toList());
+            showCollections = showCollections.stream().distinct().collect(Collectors.toList());
 
             if (recordRoom.getMaxCollection() < showCollections.size()) {
                 throw new BusinessException("选择的藏品数量大于最多可放置数量");
@@ -221,6 +224,8 @@ public class ShowroomService {
                                 coll.setPic(pic.getThumb());
                             }
                             coll.setShowroomId(recordRoom.getId());
+                            showCollection.setAssetStatus(assetRepo.findById(collection.getAssetId())
+                                    .orElse(Asset.builder().status(AssetStatus.NORMAL).build()).getStatus());
                             // 可能没有
                             coll.setAssetId(collection.getAssetId());