买家端联调bug

This commit is contained in:
litianxiang
2026-05-22 13:02:11 +08:00
parent 28f2d7678c
commit ab552fc414
3 changed files with 27 additions and 2 deletions

View File

@@ -166,7 +166,7 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
vo.setImages(imageMap); vo.setImages(imageMap);
vo.setDesignFor(entity.getDesignFor()); vo.setDesignFor(entity.getDesignFor());
vo.setProductCategory(entity.getProductCategory()); vo.setProductCategory(entity.getProductCategory());
vo.setAvatar(designer != null ? designer.getAvatar() : null); vo.setAvatar(minioUtil.processMinioResource(designer != null ? designer.getAvatar() : null, CommonConstants.MINIO_PATH_TIMEOUT));
return vo; return vo;
} }
@@ -179,12 +179,33 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
new LambdaQueryWrapper<ListingEntity>() new LambdaQueryWrapper<ListingEntity>()
.in(ListingEntity::getId, listingIds) .in(ListingEntity::getId, listingIds)
.eq(ListingEntity::getDeleted, 0)); .eq(ListingEntity::getDeleted, 0));
Map<Long, ListingEntity> entityMap = entities.stream() Map<Long, ListingEntity> entityMap = entities.stream()
.collect(Collectors.toMap(ListingEntity::getId, e -> e)); .collect(Collectors.toMap(ListingEntity::getId, e -> e));
List<Long> sellerIds = entities.stream()
.map(ListingEntity::getSellerId)
.distinct()
.toList();
Map<Long, DesignerEntity> designerMap = designerMapper.selectList(
new LambdaQueryWrapper<DesignerEntity>()
.select(DesignerEntity::getUserId, DesignerEntity::getShopName)
.in(DesignerEntity::getUserId, sellerIds)
.eq(DesignerEntity::getDeleted, 0))
.stream()
.collect(Collectors.toMap(
DesignerEntity::getUserId,
designer -> designer,
// 如果 sellerIds 中有重复的 userId保留第一个
(existing, replacement) -> existing
));
List<ListingMallVO> listingMallVOS = listingIds.stream() List<ListingMallVO> listingMallVOS = listingIds.stream()
.filter(entityMap::containsKey) .filter(entityMap::containsKey)
.map(id -> { .map(id -> {
ListingEntity entity = entityMap.get(id); ListingEntity entity = entityMap.get(id);
DesignerEntity designer = designerMap.get(entity.getSellerId());
ListingMallVO vo = new ListingMallVO(); ListingMallVO vo = new ListingMallVO();
vo.setId(entity.getId()); vo.setId(entity.getId());
vo.setCover(minioUtil.processMinioResource(entity.getCover(), CommonConstants.MINIO_PATH_TIMEOUT)); vo.setCover(minioUtil.processMinioResource(entity.getCover(), CommonConstants.MINIO_PATH_TIMEOUT));
@@ -192,6 +213,7 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
vo.setPrice(entity.getPrice()); vo.setPrice(entity.getPrice());
vo.setStatus(entity.getStatus()); vo.setStatus(entity.getStatus());
vo.setProductCategory(entity.getProductCategory()); vo.setProductCategory(entity.getProductCategory());
vo.setShopName(designer != null ? designer.getShopName() : null);
return vo; return vo;
}) })
.toList(); .toList();

View File

@@ -30,4 +30,7 @@ public class ListingMallVO implements Serializable {
/** 商品分类列表 */ /** 商品分类列表 */
private List<String> productCategory; private List<String> productCategory;
/** 店铺名称 */
private String shopName;
} }

View File

@@ -37,7 +37,7 @@ CREATE TABLE seller_designer (
id BIGINT PRIMARY KEY COMMENT '设计师ID', id BIGINT PRIMARY KEY COMMENT '设计师ID',
user_id BIGINT NOT NULL COMMENT '用户ID', user_id BIGINT NOT NULL COMMENT '用户ID',
shop_name VARCHAR(100) NOT NULL COMMENT '店铺名称', shop_name VARCHAR(100) NOT NULL COMMENT '店铺名称',
avatar VARCHAR(200) COMMENT '店铺头像URL', avatar VARCHAR(200) NOT NULL DEFAULT 'aida-users/87/avatar/default.png' COMMENT '店铺头像URL',
brand_banner VARCHAR(200) COMMENT '品牌Banner URL', brand_banner VARCHAR(200) COMMENT '品牌Banner URL',
owner_name VARCHAR(100) COMMENT '所有者全名', owner_name VARCHAR(100) COMMENT '所有者全名',
email VARCHAR(100) COMMENT '邮箱', email VARCHAR(100) COMMENT '邮箱',