|
|
@@ -135,16 +135,19 @@ public class ShowroomService {
|
|
|
return showroom;
|
|
|
}
|
|
|
|
|
|
- public Showroom save(Long userId) {
|
|
|
+ public Showroom save(Long userId, String type) {
|
|
|
User user = userRepo.findByIdAndDelFalse(userId).orElseThrow(new BusinessException("无用户"));
|
|
|
if (!user.isCompany()) {
|
|
|
throw new BusinessException("无用户权限");
|
|
|
}
|
|
|
-
|
|
|
- if (showroomRepo.findByUserIdAndType(user.getId(), "COMPANY").isPresent()) {
|
|
|
- throw new BusinessException("已创建过展厅");
|
|
|
+ int maxCollection = 1;
|
|
|
+ if ("COMPANY".equals(type)) {
|
|
|
+ if (showroomRepo.findByUserIdAndType(user.getId(), "COMPANY").isPresent()) {
|
|
|
+ throw new BusinessException("已创建过展厅");
|
|
|
+ }
|
|
|
+ maxCollection = sysConfigService.getInt("max_collection");
|
|
|
}
|
|
|
- int maxCollection = sysConfigService.getInt("max_collection");
|
|
|
+
|
|
|
|
|
|
Showroom showroom = Showroom.builder()
|
|
|
.headBg("")
|
|
|
@@ -153,7 +156,7 @@ public class ShowroomService {
|
|
|
.publish(false)
|
|
|
.userId(user.getId())
|
|
|
.nickname(user.getNickname())
|
|
|
- .type("COMPANY")
|
|
|
+ .type(type)
|
|
|
.status(AuthStatus.NOT_AUTH)
|
|
|
.build();
|
|
|
showroom = showroomRepo.save(showroom);
|
|
|
@@ -177,6 +180,7 @@ public class ShowroomService {
|
|
|
|
|
|
Set<Long> removeRecord = new HashSet<>(showCollectionMap.keySet());
|
|
|
|
|
|
+
|
|
|
if (CollUtil.isNotEmpty(showCollections)) {
|
|
|
showCollections = showCollections.stream().distinct().collect(Collectors.toList());
|
|
|
|
|
|
@@ -192,12 +196,13 @@ public class ShowroomService {
|
|
|
List<Collection> collections = collectionRepo.findAllByIdIn(collectionIds);
|
|
|
Map<Long, Collection> collectionMap = new HashMap<>();
|
|
|
collections.forEach(collection -> {
|
|
|
- if (!userId.equals(collection.getOwnerId())) {
|
|
|
- throw new BusinessException("该藏品不属于你");
|
|
|
- }
|
|
|
+// if (!userId.equals(collection.getOwnerId())) {
|
|
|
+// throw new BusinessException("该藏品不属于你");
|
|
|
+// }
|
|
|
collectionMap.put(collection.getId(), collection);
|
|
|
});
|
|
|
|
|
|
+
|
|
|
showCollections.forEach(coll -> {
|
|
|
if (coll.getId() != null) {
|
|
|
ShowCollection showCollection = showCollectionMap.get(coll.getId());
|
|
|
@@ -216,6 +221,11 @@ public class ShowroomService {
|
|
|
} else {
|
|
|
Collection collection = collectionMap.get(coll.getCollectionId());
|
|
|
if (ObjectUtils.isNotEmpty(collection)) {
|
|
|
+ if ("COMPANY_BOX".equals(recordRoom.getType())) {
|
|
|
+ if (!CollectionType.BLIND_BOX.equals(collection.getType())) {
|
|
|
+ throw new BusinessException("盲盒展厅,只能添加盲盒");
|
|
|
+ }
|
|
|
+ }
|
|
|
FileObject pic = collection.getPic().get(0);
|
|
|
coll.setPic(pic.getUrl());
|
|
|
if ("video/mp4".equals(pic.getType())) {
|