| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | private static List<CommonContentNav> getCommonNav() {
|
| | | List<CommonContentNav> navList = new ArrayList<>();
|
| | | navList.add(new CommonContentNav("1", "综合"));
|
| | | navList.add(new CommonContentNav("2", "最新"));
|
| | | navList.add(new CommonContentNav("3", "热卖"));
|
| | | navList.add(new CommonContentNav("4", "销量"));
|
| | | navList.add(new CommonContentNav("5", "返利比"));
|
| | | return navList;
|
| | | }
|
| | |
|
| | | private static int getCommonSort(String cid) {
|
| | | int sort = DaTaoKeApiUtil.SORT_DEFAULT;
|
| | | if ("1".equalsIgnoreCase(cid))
|
| | | sort = DaTaoKeApiUtil.SORT_DEFAULT;
|
| | | else if ("2".equalsIgnoreCase(cid))
|
| | | sort = DaTaoKeApiUtil.SORT_CREATETIME;
|
| | | else if ("3".equalsIgnoreCase(cid))
|
| | | sort = DaTaoKeApiUtil.SORT_COUPON_NUM;
|
| | | else if ("4".equalsIgnoreCase(cid))
|
| | | sort = DaTaoKeApiUtil.SORT_SALES;
|
| | | else if ("5".equalsIgnoreCase(cid))
|
| | | sort = DaTaoKeApiUtil.SORT_COMMISSION;
|
| | |
|
| | | return sort;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CommonContentNav> getNavList(CommonContentTypeEnum type) {
|
| | | List<CommonContentNav> navList = new ArrayList<>();
|
| | |
| | | navList.add(new CommonContentNav("3", "30~50元券"));
|
| | | navList.add(new CommonContentNav("4", "50元以上券"));
|
| | | } else if (type == CommonContentTypeEnum.juJia) {
|
| | | navList.add(new CommonContentNav("1", "综合"));
|
| | | navList.add(new CommonContentNav("2", "最新"));
|
| | | navList.add(new CommonContentNav("3", "热卖"));
|
| | | navList.add(new CommonContentNav("4", "销量"));
|
| | | navList.add(new CommonContentNav("5", "返利比"));
|
| | | navList = getCommonNav();
|
| | | } else if (type == CommonContentTypeEnum.meiShi) {
|
| | | navList.add(new CommonContentNav("1", "综合"));
|
| | | navList.add(new CommonContentNav("2", "最新"));
|
| | | navList.add(new CommonContentNav("3", "热卖"));
|
| | | navList.add(new CommonContentNav("4", "销量"));
|
| | | navList.add(new CommonContentNav("5", "返利比"));
|
| | | navList = getCommonNav();
|
| | | } else if (type == CommonContentTypeEnum.muYin) {
|
| | | navList.add(new CommonContentNav("1", "精选"));
|
| | | navList.add(new CommonContentNav("2", "备孕"));
|
| | |
| | | navList.add(new CommonContentNav("6", "4~6岁"));
|
| | | navList.add(new CommonContentNav("7", "7~12岁"));
|
| | | } else if (type == CommonContentTypeEnum.reMai) {
|
| | | navList.add(new CommonContentNav("1", "综合"));
|
| | | navList.add(new CommonContentNav("2", "最新"));
|
| | | navList.add(new CommonContentNav("3", "热卖"));
|
| | | navList.add(new CommonContentNav("4", "销量"));
|
| | | navList.add(new CommonContentNav("5", "返利比"));
|
| | | navList = getCommonNav();
|
| | | } else if (type == CommonContentTypeEnum.chuanYiDaPei) {
|
| | | navList = getCommonNav();
|
| | | } else if (type == CommonContentTypeEnum.meiZhuangGehu) {
|
| | | navList = getCommonNav();
|
| | | } else if (type == CommonContentTypeEnum.jingPinXieBao) {
|
| | | navList = getCommonNav();
|
| | | } else if (type == CommonContentTypeEnum.chaoNanReMai) {
|
| | | navList = getCommonNav();
|
| | | } else if (type == CommonContentTypeEnum.shuMaShouJi) {
|
| | | navList = getCommonNav();
|
| | | } else if (type == CommonContentTypeEnum.yunDongKuXie) {
|
| | | navList = getCommonNav();
|
| | | }
|
| | |
|
| | | return navList;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Cacheable(value = "commonContentCache", key = "#type+'-'+#cid+'-'+#page+'-'+#pageSize")
|
| | | @Override
|
| | | public CommonContentResult getContentList(CommonContentTypeEnum type, String cid, int page, int pageSize) {
|
| | | if (type == CommonContentTypeEnum._9k9)
|
| | | if (type == CommonContentTypeEnum._9k9) {
|
| | | return get9K9Content(cid, page, pageSize);
|
| | |
|
| | | } else if (type == CommonContentTypeEnum.chuanYiDaPei) {
|
| | | return getChuanYiDaPeiContent(cid, page, pageSize);
|
| | | } else if (type == CommonContentTypeEnum.meiZhuangGehu) {
|
| | | return getMeiZhuangGeHuContent(cid, page, pageSize);
|
| | | } else if (type == CommonContentTypeEnum.jingPinXieBao) {
|
| | | return getJingPinXieBaoContent(cid, page, pageSize);
|
| | | } else if (type == CommonContentTypeEnum.chaoNanReMai) {
|
| | | return getJingPinXieBaoContent(cid, page, pageSize);
|
| | | } else if (type == CommonContentTypeEnum.shuMaShouJi) {
|
| | | return getJingPinXieBaoContent(cid, page, pageSize);
|
| | | } else if (type == CommonContentTypeEnum.yunDongKuXie) {
|
| | | return getJingPinXieBaoContent(cid, page, pageSize);
|
| | | } else if (type == CommonContentTypeEnum.chaoNanReMai) {
|
| | | return getChaoNanReMaiContent(cid, page, pageSize);
|
| | | } else if (type == CommonContentTypeEnum.shuMaShouJi) {
|
| | | return getShuMaShouJiContent(cid, page, pageSize);
|
| | | } else if (type == CommonContentTypeEnum.yunDongKuXie) {
|
| | | return getYunDongKuXieContent(cid, page, pageSize);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | |
| | | return new CommonContentResult(goodsList, count);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 穿衣搭配
|
| | | * |
| | | * @param cid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | private CommonContentResult getChuanYiDaPeiContent(String cid, int page, int pageSize) {
|
| | | DaTaoKeGoodsResult result = null;
|
| | | List<Integer> cidList = new ArrayList<>();
|
| | | cidList.add(1);// 女装
|
| | | int sort = getCommonSort(cid);
|
| | | result = DaTaoKeApiUtil.search("内衣 女", cidList, null, null, page, pageSize, sort);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | long count = 0;
|
| | | if (result != null) {
|
| | | count = result.getTotalCount();
|
| | | if (result.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | }
|
| | | return new CommonContentResult(goodsList, count);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 美妆个护
|
| | | * |
| | | * @param cid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | private CommonContentResult getMeiZhuangGeHuContent(String cid, int page, int pageSize) {
|
| | | DaTaoKeGoodsResult result = null;
|
| | | List<Integer> cidList = new ArrayList<>();
|
| | | cidList.add(3);// 美妆
|
| | | int sort = getCommonSort(cid);
|
| | | result = DaTaoKeApiUtil.search("洗护", cidList, null, null, page, pageSize, sort);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | long count = 0;
|
| | | if (result != null) {
|
| | | count = result.getTotalCount();
|
| | | if (result.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | }
|
| | | return new CommonContentResult(goodsList, count);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 精品鞋包
|
| | | * |
| | | * @param cid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | |
|
| | | private CommonContentResult getJingPinXieBaoContent(String cid, int page, int pageSize) {
|
| | | DaTaoKeGoodsResult result = null;
|
| | | int sort = getCommonSort(cid);
|
| | | result = DaTaoKeApiUtil.search("鞋 女", null, null, null, page, pageSize, sort);
|
| | | DaTaoKeGoodsResult result1 = DaTaoKeApiUtil.search("包 女", null, null, null, page, pageSize, sort);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | long count = 0;
|
| | | if (result != null) {
|
| | | count = result.getTotalCount() + result1.getTotalCount();
|
| | | if (result.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | if (result1.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result1.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | }
|
| | | Collections.shuffle(goodsList);
|
| | | return new CommonContentResult(goodsList, count);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 潮男热卖
|
| | | * |
| | | * @param cid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | private CommonContentResult getChaoNanReMaiContent(String cid, int page, int pageSize) {
|
| | | DaTaoKeGoodsResult result = null;
|
| | | int sort = getCommonSort(cid);
|
| | | result = DaTaoKeApiUtil.search("潮 男", null, null, null, page, pageSize, sort);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | long count = 0;
|
| | | if (result != null) {
|
| | | count = result.getTotalCount();
|
| | | if (result.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | }
|
| | | Collections.shuffle(goodsList);
|
| | | return new CommonContentResult(goodsList, count);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 数码手机
|
| | | * |
| | | * @param cid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | private CommonContentResult getShuMaShouJiContent(String cid, int page, int pageSize) {
|
| | | DaTaoKeGoodsResult result = null;
|
| | | int sort = getCommonSort(cid);
|
| | | result = DaTaoKeApiUtil.search("电", null, null, null, page, pageSize, sort);
|
| | | DaTaoKeGoodsResult result1 = DaTaoKeApiUtil.search("手机", null, null, null, page, pageSize, sort);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | long count = 0;
|
| | | if (result != null) {
|
| | | count = result.getTotalCount() + result1.getTotalCount();
|
| | | if (result.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | if (result1.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result1.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | }
|
| | | Collections.shuffle(goodsList);
|
| | | return new CommonContentResult(goodsList, count);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 运动酷鞋
|
| | | * |
| | | * @param cid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | private CommonContentResult getYunDongKuXieContent(String cid, int page, int pageSize) {
|
| | | DaTaoKeGoodsResult result = null;
|
| | | int sort = getCommonSort(cid);
|
| | | result = DaTaoKeApiUtil.search("鞋 男", null, null, null, page, pageSize, sort);
|
| | | DaTaoKeGoodsResult result1 = DaTaoKeApiUtil.search("运动 男", null, null, null, page, pageSize, sort);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | long count = 0;
|
| | | if (result != null) {
|
| | | count = result.getTotalCount() + result1.getTotalCount();
|
| | | if (result.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | if (result1.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result1.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | }
|
| | | Collections.shuffle(goodsList);
|
| | | return new CommonContentResult(goodsList, count);
|
| | | }
|
| | |
|
| | | }
|