From 51a4ff5d777028d52a19c314a99f796334cb7b51 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 23 十一月 2019 18:30:01 +0800 Subject: [PATCH] 配置文件修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/goods/PDDCommonTemplateContentServiceImpl.java | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/PDDCommonTemplateContentServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/PDDCommonTemplateContentServiceImpl.java index f2ddaeb..be88257 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/PDDCommonTemplateContentServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/PDDCommonTemplateContentServiceImpl.java @@ -1,23 +1,65 @@ package com.yeshi.fanli.service.impl.goods; +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; + import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; +import com.yeshi.fanli.dto.common.CommonContentNav; import com.yeshi.fanli.dto.common.PDDCommonContentTypeEnum; +import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; import com.yeshi.fanli.dto.pdd.PDDGoodsResult; import com.yeshi.fanli.service.inter.goods.PDDCommonTemplateContentService; +import com.yeshi.fanli.service.inter.pdd.PDDGoodsService; import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; @Service public class PDDCommonTemplateContentServiceImpl implements PDDCommonTemplateContentService { + @Resource + private PDDGoodsService pddGoodsService; + + @Cacheable(value = "pddCommonContentCache", key = "#type+'-'+#cid+'-'+#page+'-'+#pageSize") @Override public PDDGoodsResult getContentList(PDDCommonContentTypeEnum type, String cid, int page, int pageSize) { if (type == PDDCommonContentTypeEnum._1k9 || type == PDDCommonContentTypeEnum.todayTop || type == PDDCommonContentTypeEnum.brandClear) { return PinDuoDuoApiUtil.searchByChannelType(page - 1, pageSize, type.getContent()); - } + } else if (type == PDDCommonContentTypeEnum.hotSaleGoods) { + return pddGoodsService.getTopGoodsList(page, 2); // 鐑崠濂借揣 + } else if (type == PDDCommonContentTypeEnum.todaySaleGoods) { // 鐑攢姒滃崟 + int count = 0; + List<PDDGoodsDetail> list = new ArrayList<PDDGoodsDetail>(); + PDDGoodsResult pddGoodsResult = pddGoodsService.getTodaySaleGoodsList(); + if (pddGoodsResult != null) { + List<PDDGoodsDetail> goodsList = pddGoodsResult.getGoodsList(); + if (goodsList != null) { + if (goodsList.size() >= (page * pageSize)) { + list.addAll(goodsList.subList((page-1)* pageSize, page * pageSize)); + } + count = goodsList.size(); + } + } + PDDGoodsResult pddResult = new PDDGoodsResult(); + pddResult.setGoodsList(list); + pddResult.setTotalCount(count); + + return pddResult; + } return null; } + + + @Override + public List<CommonContentNav> getNavList(PDDCommonContentTypeEnum type) { + List<CommonContentNav> navList = new ArrayList<>(); + if (type == PDDCommonContentTypeEnum.hotSaleGoods) { + + } + return navList; + } } -- Gitblit v1.8.0