licailing преди 3 години
родител
ревизия
388ff3ffa2

+ 3 - 1
src/main/java/com/izouma/nineth/domain/Showroom.java

@@ -2,6 +2,7 @@ package com.izouma.nineth.domain;
 
 import com.izouma.nineth.annotations.Searchable;
 import com.izouma.nineth.enums.AuthStatus;
+import com.izouma.nineth.enums.ShowroomType;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -56,7 +57,8 @@ public class Showroom extends BaseEntity {
     @ApiModelProperty("展厅背景")
     private String showroomBg;
 
-    private String type;
+    @Enumerated(EnumType.STRING)
+    private ShowroomType type;
 
     @Enumerated(EnumType.STRING)
     private AuthStatus status;

+ 7 - 0
src/main/java/com/izouma/nineth/enums/ShowroomType.java

@@ -0,0 +1,7 @@
+package com.izouma.nineth.enums;
+
+public enum ShowroomType {
+    COMPANY_BOX,
+    COMPANY,
+    USER
+}

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

@@ -7,6 +7,7 @@ import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.enums.AssetStatus;
 import com.izouma.nineth.enums.AuthStatus;
 import com.izouma.nineth.enums.CollectionType;
+import com.izouma.nineth.enums.ShowroomType;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.*;
 import com.izouma.nineth.utils.JpaUtils;
@@ -127,7 +128,7 @@ public class ShowroomService {
                 .userId(asset.getUserId())
                 .assetId(asset.getId())
                 .nickname(asset.getOwner())
-                .type("USER")
+                .type(ShowroomType.USER)
                 .status(AuthStatus.SUCCESS)
                 .build();
         showroom = showroomRepo.save(showroom);
@@ -156,7 +157,7 @@ public class ShowroomService {
                 .publish(false)
                 .userId(user.getId())
                 .nickname(user.getNickname())
-                .type(type)
+                .type(ShowroomType.valueOf(type))
                 .status(AuthStatus.NOT_AUTH)
                 .build();
         showroom = showroomRepo.save(showroom);
@@ -221,7 +222,7 @@ public class ShowroomService {
                     } else {
                         Collection collection = collectionMap.get(coll.getCollectionId());
                         if (ObjectUtils.isNotEmpty(collection)) {
-                            if ("COMPANY_BOX".equals(recordRoom.getType())) {
+                            if (ShowroomType.COMPANY_BOX.equals(recordRoom.getType())) {
                                 if (!CollectionType.BLIND_BOX.equals(collection.getType())) {
                                     throw new BusinessException("盲盒展厅,只能添加盲盒");
                                 }
@@ -259,7 +260,7 @@ public class ShowroomService {
 
     public void audit(Long id, AuthStatus status, String reason) {
         Showroom showroom = showroomRepo.findById(id).orElseThrow(new BusinessException("无展厅"));
-        if (!"COMPANY".equals(showroom.getType())) {
+        if (ShowroomType.USER.equals(showroom.getType())) {
             // 非企业类型不需要审核
             showroom.setStatus(null);
             showroomRepo.save(showroom);

+ 14 - 2
src/main/vue/src/views/ShowroomList.vue

@@ -67,6 +67,7 @@
             <el-table-column prop="heats" label="热力值"></el-table-column>
             <!-- <el-table-column prop="sort" label="排序"></el-table-column> -->
             <!-- <el-table-column prop="maxCollection" label="最多可放藏品数量"> </el-table-column> -->
+            <el-table-column prop="type" label="类型" :formatter="typeFormatter"></el-table-column>
             <el-table-column prop="status" label="状态" :formatter="statusFormatter"> </el-table-column>
             <el-table-column label="操作" align="center" fixed="right" width="280">
                 <template slot-scope="{ row, $index }">
@@ -164,7 +165,11 @@ export default {
             status: 'PENDING',
             saving: false,
             showCodeDialog: false,
-            codeValue: 'Hello, World!'
+            codeValue: 'Hello, World!',
+            typeOptions: [
+                { label: '普通展厅', value: 'COMPANY' },
+                { label: '盲盒展厅', value: 'COMPANY_BOX' }
+            ]
         };
     },
     computed: {
@@ -188,11 +193,18 @@ export default {
             }
             return '';
         },
+        typeFormatter(row, column, cellValue, index) {
+            let selectedOption = this.typeOptions.find(i => i.value === cellValue);
+            if (selectedOption) {
+                return selectedOption.label;
+            }
+            return '';
+        },
         beforeGetData() {
             return {
                 sort: 'heats,desc;id,desc',
                 search: this.search,
-                query: { del: false, type: 'COMPANY', status: this.status }
+                query: { del: false, type: ['COMPANY', 'COMPANY_BOX'], status: this.status }
             };
         },
         toggleMultipleMode(multipleMode) {

+ 13 - 1
src/main/vue/src/views/company/CompanyRoomList.vue

@@ -46,6 +46,7 @@
             <el-table-column prop="likes" label="点赞"> </el-table-column>
             <el-table-column prop="registers" label="邀请数"> </el-table-column>
             <el-table-column prop="heats" label="热力值"></el-table-column>
+            <el-table-column prop="type" label="类型" :formatter="typeFormatter"></el-table-column>
             <el-table-column prop="status" label="状态" :formatter="statusFormatter"> </el-table-column>
             <el-table-column label="操作" align="center" fixed="right" width="150">
                 <template slot-scope="{ row }">
@@ -103,7 +104,11 @@ export default {
                 { label: '失败', value: 'FAIL' }
             ],
             showCodeDialog: false,
-            codeValue: 'Hello, World!'
+            codeValue: 'Hello, World!',
+            typeOptions: [
+                { label: '普通展厅', value: 'COMPANY' },
+                { label: '盲盒展厅', value: 'COMPANY_BOX' }
+            ],
         };
     },
     computed: {
@@ -120,6 +125,13 @@ export default {
             }
             return '';
         },
+        typeFormatter(row, column, cellValue, index) {
+            let selectedOption = this.typeOptions.find(i => i.value === cellValue);
+            if (selectedOption) {
+                return selectedOption.label;
+            }
+            return '';
+        },
         beforeGetData() {
             return { search: this.search, query: { del: false, userId: this.userInfo.id } };
         },