Commit 7324e0ab authored by shiyu's avatar shiyu

展示默认的标签

parent 69bef832
...@@ -70,4 +70,9 @@ public class CollectionBookRequestDto extends BaseRequestDto implements Entity ...@@ -70,4 +70,9 @@ public class CollectionBookRequestDto extends BaseRequestDto implements Entity
private String sortInfo; private String sortInfo;
private Boolean isMine; private Boolean isMine;
/**
* 1:展示默认的标签,为空不展示
*/
private Integer viewLabelType;
} }
...@@ -19,6 +19,9 @@ import org.slf4j.Logger; ...@@ -19,6 +19,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -154,8 +157,10 @@ public class CollectionBookServiceImpl implements CollectionBookService { ...@@ -154,8 +157,10 @@ public class CollectionBookServiceImpl implements CollectionBookService {
continue; continue;
} }
} else if (CollectionBookConstants.DefaultBookEnum.getNameByCode(sortNum) != null) { } else if (CollectionBookConstants.DefaultBookEnum.getNameByCode(sortNum) != null) {
if (dto.getViewLabelType() == null || (dto.getViewLabelType().intValue() != 1)) {
continue;
}
map.put("title", CollectionBookConstants.DefaultBookEnum.getNameByCode(sortNum)); map.put("title", CollectionBookConstants.DefaultBookEnum.getNameByCode(sortNum));
} else { } else {
map.put("title", bookMap.get(sortNum)); map.put("title", bookMap.get(sortNum));
} }
...@@ -171,6 +176,7 @@ public class CollectionBookServiceImpl implements CollectionBookService { ...@@ -171,6 +176,7 @@ public class CollectionBookServiceImpl implements CollectionBookService {
@Override @Override
@Transactional
public Result delete(CollectionBookRequestDto dto) { public Result delete(CollectionBookRequestDto dto) {
try { try {
collectionBookDao.delete(dto.getId()); collectionBookDao.delete(dto.getId());
...@@ -183,7 +189,8 @@ public class CollectionBookServiceImpl implements CollectionBookService { ...@@ -183,7 +189,8 @@ public class CollectionBookServiceImpl implements CollectionBookService {
CollectionBookSort collectionBookSort = collectionBookSortDao.find(dto.getUserId()); CollectionBookSort collectionBookSort = collectionBookSortDao.find(dto.getUserId());
if (collectionBookSort != null) { if (collectionBookSort != null) {
String sortInfo = collectionBookSort.getSortInfo(); String sortInfo = collectionBookSort.getSortInfo();
List<String> list = Arrays.asList(sortInfo.split(",")); List<String> arrayList = Arrays.asList(sortInfo.split(","));
List<String> list = new ArrayList<>(arrayList);
list.remove("" + dto.getId()); list.remove("" + dto.getId());
sortInfo = String.join("," , list); sortInfo = String.join("," , list);
collectionBookSortDao.update(dto.getUserId(), sortInfo); collectionBookSortDao.update(dto.getUserId(), sortInfo);
...@@ -191,6 +198,7 @@ public class CollectionBookServiceImpl implements CollectionBookService { ...@@ -191,6 +198,7 @@ public class CollectionBookServiceImpl implements CollectionBookService {
return Result.success(); return Result.success();
} catch (Exception e) { } catch (Exception e) {
logger.error("删除收藏册 error: {}", e); logger.error("删除收藏册 error: {}", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} }
return Result.failed(); return Result.failed();
} }
......
...@@ -680,7 +680,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -680,7 +680,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
if (supplierItem.getCreatorId().longValue() != targetUserId) { if (supplierItem.getCreatorId().longValue() != targetUserId) {
supplierItemVo.setIsMine(false); supplierItemVo.setIsMine(false);
targetUserId = supplierItem.getCreatorId(); targetUserId = supplierItem.getCreatorId();
boolean isCollected = itemCollectedRecordDao.isExisted(itemId, targetUserId); boolean isCollected = itemCollectedRecordDao.isExisted(itemId, dto.getUserId());
if (isCollected) { if (isCollected) {
supplierItemVo.setIsCollected(true); supplierItemVo.setIsCollected(true);
} else { } else {
...@@ -689,7 +689,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -689,7 +689,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
if (supplierItem.getIsDeleted()) { if (supplierItem.getIsDeleted()) {
//判断是否有相关收藏记录,有则删除 //判断是否有相关收藏记录,有则删除
if (isCollected) { if (isCollected) {
itemCollectedRecordDao.cancel(itemId, targetUserId); itemCollectedRecordDao.cancel(itemId, dto.getUserId());
} }
return Result.failed("该藏品已删除"); return Result.failed("该藏品已删除");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment