licailing il y a 3 ans
Parent
commit
7692a9bbec

+ 1 - 2
src/main/java/com/izouma/nineth/domain/CollectionPrivilege.java

@@ -34,10 +34,9 @@ public class CollectionPrivilege extends BaseEntity {
     @ApiModelProperty("最多可放藏品数量")
     private Integer maxCollection;
 
-    @ApiModelProperty("vip特权藏品")
+    @ApiModelProperty("vip特权")
     private Boolean vip;
 
-
     public CollectionPrivilege(CollectionInfoDTO info, Long collectionId) {
         BeanUtils.copyProperties(info, this);
         this.collectionId = collectionId;

+ 5 - 0
src/main/java/com/izouma/nineth/repo/ShowroomRepo.java

@@ -1,11 +1,13 @@
 package com.izouma.nineth.repo;
 
 import com.izouma.nineth.domain.Showroom;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 
+import javax.annotation.Nonnull;
 import javax.transaction.Transactional;
 import java.util.Optional;
 
@@ -28,4 +30,7 @@ public interface ShowroomRepo extends JpaRepository<Showroom, Long>, JpaSpecific
     @Modifying
     @Transactional
     void addShare(Long id, int num);
+
+    @Cacheable("showroom")
+    Optional<Showroom> findById(@Nonnull Long id);
 }

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

@@ -282,7 +282,7 @@ public class AssetService {
                 .orElseThrow(new BusinessException("无展示记录"));
         collectionRepo.delete(collection);
         // 如果展厅有此藏品
-        showCollectionRepo.deleteAllByCollectionId(asset.getPublicCollectionId());
+        showCollectionRepo.softDeleteCollection(asset.getPublicCollectionId());
 
         asset.setPublicShow(false);
         asset.setPublicCollectionId(null);

+ 1 - 1
src/main/java/com/izouma/nineth/service/MintOrderService.java

@@ -255,7 +255,7 @@ public class MintOrderService {
                                 .orElseThrow(new BusinessException("无展示记录"));
                         collectionRepo.delete(collection);
                         // 如果展厅有此藏品
-                        showCollectionRepo.deleteAllByCollectionId(asset.getPublicCollectionId());
+                        showCollectionRepo.softDeleteCollection(asset.getPublicCollectionId());
 
                         asset.setPublicShow(false);
                         asset.setPublicCollectionId(null);

+ 1 - 1
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -614,7 +614,7 @@ public class OrderService {
                         assetService.transfer(asset, order.getPrice(), user, "转让", order.getId());
                         collectionRepo.delete(collection);
                         // 如果展厅有此藏品
-                        showCollectionRepo.deleteAllByCollectionId(order.getCollectionId());
+                        showCollectionRepo.softDeleteCollection(order.getCollectionId());
 
                         // 发送短信提醒用户转让成功
                         if (asset != null && asset.getUserId() != null) {

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

@@ -13,6 +13,7 @@ import com.izouma.nineth.utils.ObjUtils;
 import lombok.AllArgsConstructor;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Service;
 
@@ -37,6 +38,7 @@ public class ShowroomService {
     /*
     不做盲盒
      */
+    @CacheEvict(value = {"showroom"}, allEntries = true)
     public Showroom save(Long userId, Showroom showroom) {
         Asset asset = assetRepo.findById(showroom.getAssetId()).orElseThrow(new BusinessException("资产不存在"));
         if (!userId.equals(asset.getUserId())) {
@@ -126,6 +128,7 @@ public class ShowroomService {
         return showroomRepo.save(showroom);
     }
 
+    @CacheEvict(value = {"showroom"}, allEntries = true)
     public Showroom update(Long userId, Showroom showroom) {
         Showroom recordRoom = showroomRepo.findById(showroom.getId()).orElseThrow(new BusinessException("无展厅"));
         showroom.setMaxCollection(recordRoom.getMaxCollection());
@@ -193,10 +196,10 @@ public class ShowroomService {
             });
         } else {
             // 删掉本次没有的
-            showCollectionRepo.deleteAllByShowroomId(recordRoom.getId());
+            showCollectionRepo.softDeleteByRoom(recordRoom.getId());
         }
         if (CollUtil.isNotEmpty(removeRecord)) {
-            showCollectionRepo.deleteAllByIdIn(removeRecord);
+            showCollectionRepo.softDeleteByIdIn(removeRecord);
         }
 
         ObjUtils.merge(recordRoom, showroom);

+ 0 - 33
src/main/java/com/izouma/nineth/service/UserService.java

@@ -72,12 +72,10 @@ public class UserService {
     private SysConfigService              sysConfigService;
     private UserBankCardRepo              userBankCardRepo;
     private InviteRepo                    inviteRepo;
-    private NFTService                    nftService;
     private CacheService                  cacheService;
     private TokenHistoryRepo              tokenHistoryRepo;
     private CollectionRepo                collectionRepo;
     private AdapayMerchantService         adapayMerchantService;
-    private Environment                   env;
     private RocketMQTemplate              rocketMQTemplate;
     private GeneralProperties             generalProperties;
     private RedisTemplate<String, Object> redisTemplate;
@@ -204,36 +202,6 @@ public class UserService {
         if (invite != null) {
             inviteRepo.increaseNum(invite.getId());
         }
-
-        // 加积分
-//        if (collectionId != null && invitor != null) {
-//            // 额度或者额度为空, 库存不为空
-//            if (collection.getStock() > 0 && (collection.getVipQuota() > 0 || ObjectUtils.isEmpty(collection.getVipQuota()))) {
-//                int countUser = userRepo.countAllByCollectionIdAndCollectionInvitor(collectionId, invitor);
-//                // 邀请人数
-//                if (countUser >= collection.getAssignment()) {
-//                    int point = pointRecordRepo.countByUserIdAndCollectionId(invitor, collectionId);
-//                    // 是否已有积分
-//                    if (point <= 0) {
-//                        long count = userRepo.countAllByCollectionIdAndCollectionInvitor(collectionId, invitor);
-//                        if (count >= collection.getAssignment()) {
-//                            // 扣除藏品额度
-//                            if (ObjectUtils.isNotEmpty(collection.getVipQuota())) {
-//                                collectionService.decreaseQuota(collectionId, 1);
-//                            }
-//                            userRepo.updateVipPoint(invitor, 1);
-//                            pointRecordRepo.save(PointRecord.builder()
-//                                    .collectionId(collectionId)
-//                                    .userId(invitor)
-//                                    .type("VIP_POINT")
-//                                    .point(1)
-//                                    .build());
-//
-//                        }
-//                    }
-//                }
-//            }
-//        }
         return user;
     }
 
@@ -715,5 +683,4 @@ public class UserService {
         user.setTradeCode(null);
         return user;
     }
-
 }

+ 1 - 1
src/main/java/com/izouma/nineth/web/ShowroomController.java

@@ -87,7 +87,7 @@ public class ShowroomController extends BaseController {
 
     @PostMapping("/del/{id}")
     public void del(@PathVariable Long id) {
-        showCollectionRepo.deleteAllByShowroomId(id);
+        showCollectionRepo.softDeleteByRoom(id);
         showroomRepo.softDelete(id);
     }
 

+ 7 - 0
src/main/vue/src/views/ShowroomEdit.vue

@@ -224,6 +224,13 @@
                         </el-radio-group>
                     </el-form-item>
 
+                    <el-form-item prop="vip" label="享有特权">
+                        <el-radio-group v-model="formData.vip">
+                            <el-radio :label="true">白名单权利</el-radio>
+                            <el-radio :label="false">无特权</el-radio>
+                        </el-radio-group>
+                    </el-form-item>
+
                     <el-form-item prop="headBg" label="展厅头部背景">
                         <single-upload v-model="formData.headBg"></single-upload>
                     </el-form-item>