Commit fe799ad1 authored by shiyu's avatar shiyu

藏品详情点击关注

parent 293c75ad
...@@ -646,7 +646,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -646,7 +646,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
public Result findCollectionItemDetail(SupplierItemRequestDto dto) { public Result findCollectionItemDetail(SupplierItemRequestDto dto) {
try { try {
SupplierItemVo supplierItemVo = new SupplierItemVo(); SupplierItemVo supplierItemVo = new SupplierItemVo();
long userId = dto.getUserId(); long targetUserId = dto.getUserId();
Long itemId = null; Long itemId = null;
CollectionShareRecord collectionShareRecord = new CollectionShareRecord(); CollectionShareRecord collectionShareRecord = new CollectionShareRecord();
if (StringUtils.isEmpty(dto.getShareRecordId())) { if (StringUtils.isEmpty(dto.getShareRecordId())) {
...@@ -654,13 +654,22 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -654,13 +654,22 @@ public class SupplierItemServiceImpl implements SupplierItemService {
} else { } else {
collectionShareRecord = collectionShareRecordDao.findById(dto.getShareRecordId()); collectionShareRecord = collectionShareRecordDao.findById(dto.getShareRecordId());
itemId = collectionShareRecord.getShareTargetId(); itemId = collectionShareRecord.getShareTargetId();
if (collectionShareRecord.getItemUserId().longValue() != dto.getUserId().longValue()) {
//客态进入别人的藏馆,自动关注
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(collectionShareRecord.getItemUserId());
followFansRecordRequestDto.setFansId(dto.getUserId());
followFansRecordRequestDto.setIntroducerId(collectionShareRecord.getSharerId());
followFansRecordService.follow(followFansRecordRequestDto);
logger.info("通过藏品详情分享点击,用户id:{} 关注了 用户id为 {}, 介绍人为", dto.getUserId(), collectionShareRecord.getItemUserId(), collectionShareRecord.getSharerId());
}
} }
supplierItemVo.setIsCollected(true); supplierItemVo.setIsCollected(true);
SupplierItem supplierItem = supplierItemDao.findById(itemId); SupplierItem supplierItem = supplierItemDao.findById(itemId);
if (supplierItem.getCreatorId().longValue() != userId) { if (supplierItem.getCreatorId().longValue() != targetUserId) {
supplierItemVo.setIsMine(false); supplierItemVo.setIsMine(false);
userId = supplierItem.getCreatorId(); targetUserId = supplierItem.getCreatorId();
boolean isCollected = itemCollectedRecordDao.isExisted(itemId, userId); boolean isCollected = itemCollectedRecordDao.isExisted(itemId, targetUserId);
if (isCollected) { if (isCollected) {
supplierItemVo.setIsCollected(true); supplierItemVo.setIsCollected(true);
} else { } else {
...@@ -669,7 +678,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -669,7 +678,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
if (supplierItem.getIsDeleted()) { if (supplierItem.getIsDeleted()) {
//判断是否有相关收藏记录,有则删除 //判断是否有相关收藏记录,有则删除
if (isCollected) { if (isCollected) {
itemCollectedRecordDao.cancel(itemId, userId); itemCollectedRecordDao.cancel(itemId, targetUserId);
} }
return Result.failed("该藏品已删除"); return Result.failed("该藏品已删除");
} }
...@@ -721,7 +730,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -721,7 +730,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
//用户自定义排序 //用户自定义排序
//查询标签排序记录 //查询标签排序记录
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
CollectionBookSort collectionBookSort = collectionBookSortDao.find(userId); CollectionBookSort collectionBookSort = collectionBookSortDao.find(targetUserId);
if (collectionBookSort == null) { if (collectionBookSort == null) {
supplierItemVo.setBookIdList(collectionBookList); supplierItemVo.setBookIdList(collectionBookList);
} else { } else {
......
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