记得上下班打卡 | git大法好,push需谨慎

Commit 2508891b authored by 姜秀龙's avatar 姜秀龙

c端完善

parent 8d996bc9
......@@ -161,6 +161,8 @@ global-auth:
- ${liquidnet.info.context}/health
# 演出阵容
- ${liquidnet.info.context}/performance/artists/**
# 艺人详情 C 端(无需登录)
- ${liquidnet.info.context}/artist/**
oncheck-url-pattern:
- ${liquidnet.info.context}/order/details
- ${liquidnet.info.context}/order/transfer*
......
......@@ -19,6 +19,7 @@ import com.liquidnet.service.kylin.service.IKylinArtistFrontService;
import com.liquidnet.service.kylin.utils.DataUtils;
import com.liquidnet.service.kylin.utils.GoblinRedisUtils;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -28,6 +29,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.util.stream.Collectors;
@Slf4j
......@@ -73,9 +75,6 @@ public class KylinArtistFrontServiceImpl implements IKylinArtistFrontService {
@Override
public List<String> getArtistAlbum(String artistId) {
if (loadArtistForFront(artistId) == null) {
return new ArrayList<>();
}
String cacheKey = KylinRedisConst.ARTIST_ALBUM + artistId;
List<String> cached = dataUtils.getArtistFrontCache(cacheKey);
if (cached != null) {
......@@ -92,9 +91,6 @@ public class KylinArtistFrontServiceImpl implements IKylinArtistFrontService {
@Override
public List<KylinArtistPerformanceFrontVo> getArtistPerformances(String artistId) {
if (loadArtistForFront(artistId) == null) {
return new ArrayList<>();
}
String cacheKey = KylinRedisConst.ARTIST_PERFORMANCES + artistId;
List<KylinArtistPerformanceDao> baseList = dataUtils.getArtistFrontCache(cacheKey);
if (baseList == null) {
......@@ -106,17 +102,21 @@ public class KylinArtistFrontServiceImpl implements IKylinArtistFrontService {
@Override
public List<KylinArtistProductFrontVo> getArtistProducts(String artistId) {
if (loadArtistForFront(artistId) == null) {
return new ArrayList<>();
}
String cacheKey = KylinRedisConst.ARTIST_PRODUCTS + artistId;
List<KylinArtistProductFrontVo> cached = dataUtils.getArtistFrontCache(cacheKey);
if (cached != null) {
return cached;
List<KylinArtistProduct> baseList = dataUtils.getArtistFrontCache(cacheKey);
if (baseList == null) {
baseList = loadProductRelationBaseList(artistId);
dataUtils.setArtistFrontCache(cacheKey, baseList);
}
List<KylinArtistProductFrontVo> list = loadProductFrontList(artistId);
dataUtils.setArtistFrontCache(cacheKey, list);
return list;
return buildProductFrontList(baseList);
}
private List<KylinArtistProduct> loadProductRelationBaseList(String artistId) {
List<KylinArtistProduct> relations = kylinArtistProductMapper.selectByArtistId(artistId);
if (CollectionUtils.isEmpty(relations)) {
return new ArrayList<>();
}
return relations;
}
private List<KylinArtistPerformanceDao> loadPerformanceBaseList(String artistId) {
......@@ -161,8 +161,7 @@ public class KylinArtistFrontServiceImpl implements IKylinArtistFrontService {
return result;
}
private List<KylinArtistProductFrontVo> loadProductFrontList(String artistId) {
List<KylinArtistProduct> relations = kylinArtistProductMapper.selectByArtistId(artistId);
private List<KylinArtistProductFrontVo> buildProductFrontList(List<KylinArtistProduct> relations) {
List<KylinArtistProductFrontVo> result = new ArrayList<>();
if (CollectionUtils.isEmpty(relations)) {
return result;
......@@ -176,7 +175,7 @@ public class KylinArtistFrontServiceImpl implements IKylinArtistFrontService {
vo.setSpuId(goods.getSpuId());
vo.setName(goods.getName());
vo.setCoverPic(goods.getCoverPic());
vo.setSellPrice(goods.getSellPrice());
vo.setSellPrice(resolveGoodsSellPrice(goods));
vo.setSort(relation.getSort());
result.add(vo);
}
......@@ -184,7 +183,43 @@ public class KylinArtistFrontServiceImpl implements IKylinArtistFrontService {
}
/**
* 按 ID 取艺人(不按 status 过滤;列表/选艺人场景在各自入口筛 status=1)
* SPU sellPrice 常为空,与 goblin 前台一致:SKU 最低价 → priceGe → priceLe
*/
private BigDecimal resolveGoodsSellPrice(GoblinGoodsInfoVo goodsInfoVo) {
if (goodsInfoVo == null) {
return null;
}
if (goodsInfoVo.getSellPrice() != null) {
return goodsInfoVo.getSellPrice();
}
BigDecimal minSkuPrice = null;
if (!CollectionUtils.isEmpty(goodsInfoVo.getSkuIdList())) {
for (String skuId : goodsInfoVo.getSkuIdList()) {
GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
if (skuInfoVo == null) {
continue;
}
BigDecimal skuShowPrice = skuInfoVo.getSellPrice() != null
? skuInfoVo.getSellPrice() : skuInfoVo.getPrice();
if (skuShowPrice == null) {
continue;
}
if (minSkuPrice == null || skuShowPrice.compareTo(minSkuPrice) < 0) {
minSkuPrice = skuShowPrice;
}
}
}
if (minSkuPrice != null) {
return minSkuPrice;
}
if (goodsInfoVo.getPriceGe() != null) {
return goodsInfoVo.getPriceGe();
}
return goodsInfoVo.getPriceLe();
}
/**
* 简介详情用:按 artist_id 查 kylin_artist(不按 status 过滤)
*/
private KylinArtist loadArtistForFront(String artistId) {
if (artistId == null || artistId.isEmpty()) {
......
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