| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.dto.common.CommonContentNav;
|
| | | import com.yeshi.fanli.dto.common.CommonContentResult;
|
| | | import com.yeshi.fanli.dto.common.CommonContentTypeEnum;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.banner.SwiperPictureException;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private CommonTemplateContentService commonTemplateContentService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | /**
|
| | | * 通用模板导航
|
| | | *
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "请传入Key"));
|
| | | return;
|
| | | }
|
| | | List<CommonContentNav> list = new ArrayList<>();
|
| | | for (int i = 0; i < 20; i++) {
|
| | | CommonContentNav gc = new CommonContentNav();
|
| | | gc.setCid((i + 1L) + "");
|
| | | if (i == 1) {
|
| | | gc.setName("测试" + i);
|
| | | gc.setPicture(
|
| | | "http://e.hiphotos.baidu.com/zhidao/pic/item/37d3d539b6003af3be51388a322ac65c1138b675.jpg");
|
| | | } else if (i == 2) {
|
| | | gc.setName("");
|
| | | gc.setPicture(
|
| | | "http://e.hiphotos.baidu.com/zhidao/pic/item/37d3d539b6003af3be51388a322ac65c1138b675.jpg");
|
| | | } else {
|
| | | gc.setName("测试" + i);
|
| | | }
|
| | | list.add(gc);
|
| | | }
|
| | | List<CommonContentNav> list = commonTemplateContentService.getNavList(CommonContentTypeEnum.valueOf(key));
|
| | | out.print(JsonUtil.loadTrueResult(new Gson().toJson(list)));
|
| | | }
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | CommonContentResult result = commonTemplateContentService.getContentList(CommonContentTypeEnum.valueOf(key),
|
| | | cid, page, 10);
|
| | |
|
| | | // 保留暂时不开启,待后续开启
|
| | | List<SwiperPicture> bannerList = new ArrayList<>();
|
| | | try {
|
| | | bannerList = swiperPictureService.getByBannerCard("index_top");
|
| | | } catch (SwiperPictureException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | if (page == 1)
|
| | | root.put("bannerList", new Gson().toJson(bannerList));
|
| | | |
| | | root.put("goodsCount", 200);
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setKey("鞋");
|
| | | sf.setPage(page);
|
| | | sf.setPageSize(20);
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | | BigDecimal pro = hongBaoManageService.getFanLiRate();
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.searchWuLiao(sf).getTaoBaoGoodsBriefs();
|
| | | if (CommonContentTypeEnum.valueOf(key) == CommonContentTypeEnum.mianDan)// 免单商品
|
| | | pro = new BigDecimal(100);
|
| | | List<TaoBaoGoodsBrief> goodsList = result.getGoodsList();
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, pro.toString(), "")));
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, pro.toString(), "");
|
| | | if (CommonContentTypeEnum.valueOf(key) == CommonContentTypeEnum.mianDan)// 免单商品
|
| | | {
|
| | | extra.getTaoBaoHongBaoInfo().setRate("¥" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief));
|
| | | extra.getTaoBaoHongBaoInfo().setHongbao(TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief));
|
| | | }
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | |
|
| | | root.put("goodsList", array);
|
| | | |
| | |
|
| | | root.put("goodsCount", result.getCount());
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
|
| | | // 更新前5页数据
|
| | | if (page <= 5)
|
| | | try {
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | }
|