| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | |
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService;
|
| | | import com.yeshi.fanli.service.inter.goods.JDCommonTemplateContentService;
|
| | | import com.yeshi.fanli.service.inter.goods.PDDCommonTemplateContentService;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | | }
|
| | |
|
| | | private void getListTB(AcceptData acceptData, String key, Integer page, String cid, PrintWriter out) {
|
| | | CommonContentResult result = commonTemplateContentService.getContentList(CommonContentTypeEnum.valueOf(key),
|
| | | cid, page, Constant.PAGE_SIZE);
|
| | |
|
| | | // 保留暂时不开启,待后续开启
|
| | | List<SwiperPicture> bannerList = new ArrayList<>();
|
| | | CommonContentResult result = null;
|
| | | CommonContentTypeEnum type = CommonContentTypeEnum.valueOf(key);
|
| | | if (type == CommonContentTypeEnum.guessLikeDevice) {
|
| | | // 猜你喜欢
|
| | | String idfa = acceptData.getIdfa();
|
| | | String imei = acceptData.getImei();
|
| | | result = guessLikeDeviceTB(idfa, imei, page);
|
| | | } else {
|
| | | result = commonTemplateContentService.getContentList(type, cid, page, Constant.PAGE_SIZE);
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | if (page == 1)
|
| | | if (page == 1) {
|
| | | // 保留暂时不开启,待后续开启
|
| | | List<SwiperPicture> bannerList = new ArrayList<>();
|
| | | root.put("bannerList", new Gson().toJson(bannerList));
|
| | |
|
| | | }
|
| | | |
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | | List<TaoBaoGoodsBrief> goodsList = result.getGoodsList();
|
| | |
| | |
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) {
|
| | | GoodsDetailVO vo = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
|
| | | if (CommonContentTypeEnum.valueOf(key) == CommonContentTypeEnum.mianDan)// 免单商品
|
| | | if (type == CommonContentTypeEnum.mianDan)// 免单商品
|
| | | {
|
| | | vo.getMoneyInfo().setFanliMoney("¥" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief));
|
| | | vo.getMoneyInfo().setShareMoney("¥" + TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief));
|
| | |
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 猜你喜欢-淘宝设备推荐
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @return
|
| | | */
|
| | | @Cacheable(value = "commonContentCache", key = "#idfa+'-'+#imei+'-'+#page")
|
| | | private CommonContentResult guessLikeDeviceTB(String idfa, String imei, Integer page) {
|
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.guessDeviceLike(page, Constant.PAGE_SIZE, imei, idfa);
|
| | | if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null |
| | | && searchResult.getTaoBaoGoodsBriefs().size() > 0) {
|
| | | CommonContentResult result = new CommonContentResult();
|
| | | result.setCount(searchResult.getPageEntity().getTotalCount());
|
| | | result.setGoodsList(searchResult.getTaoBaoGoodsBriefs());
|
| | | return result;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|