| | |
| | | out.print("success");
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "vip")
|
| | | public void VIP(PrintWriter out) {
|
| | | out.print("success");
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "不存在该系统"));
|
| | | return;
|
| | | }
|
| | | try {
|
| | |
|
| | | List<ScanHistoryV2> list = scanHistoryV2Service.getScanHistoryByDeviceOrUid( |
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(), page, 20, Constant.SOURCE_TYPE_TAOBAO); |
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(), page, 20,
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | long count = scanHistoryV2Service.getCountByDeviceOrUid( |
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(), Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | |
|
| | | StringUtil.isNullOrEmpty(uid) ? null : Long.parseLong(uid), acceptData.getDevice(),
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | |
| | | data.put("data", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("data", new JSONArray());
|
| | | data.put("count", 0);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "deletescanhistory", method = RequestMethod.POST)
|
| | |
| | | HttpServletRequest request, PrintWriter out) {
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | JSONArray array = new JSONArray();
|
| | |
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | | if (VersionUtil.greaterThan_1_5_70(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | List<TaoBaoGoodsBrief> goodsList = homeRecommendGoodsService.listGoodsByPage(null, acceptData.getDevice(),
|
| | |
| | | }
|
| | |
|
| | | if (page == 1) {
|
| | | List<TLJBuyGoods> list = homeRecommendGoodsService.getZiGouLiJianHotGoods(acceptData.getDevice());
|
| | | List<TLJBuyGoods> list = null;
|
| | | try {
|
| | | list = homeRecommendGoodsService.getZiGouLiJianHotGoods(acceptData.getDevice());
|
| | | } catch (Exception e) {
|
| | | }
|
| | | if (list != null && list.size() > 0)
|
| | | for (int i = list.size() - 1; i >= 0; i--) {
|
| | | TLJBuyGoods goods = list.get(i);
|
| | |
| | | if (uid == null) {
|
| | | data.put("collected", false);
|
| | | } else {
|
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id, Constant.SOURCE_TYPE_TAOBAO);
|
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id,
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | data.put("collected", collectionGoods != null ? true : false);
|
| | | }
|
| | |
|
| | |
| | | @RequestMapping(value = "getgoodsderivation", method = RequestMethod.POST)
|
| | | public void getRecommendGoods(AcceptData acceptData, long id, PrintWriter out) {
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | try {
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10);
|
| | | // 初始化
|
| | |
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | listExtra.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), ""));
|
| | | listExtra.add(
|
| | | TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), ""));
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listExtra));
|
| | | data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listQuality));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listQuality", new JSONArray());
|
| | | data.put("listGuess", new JSONArray());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.json.simple.JSONArray;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | |
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO;
|
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | // 京东
|
| | | if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | }
|
| | |
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate));
|
| | | listExtra.add(
|
| | | GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate));
|
| | | }
|
| | | }
|
| | | });
|
| | |
| | | data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listExtra));
|
| | | data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listQuality));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("listQuality", new JSONArray());
|
| | | data.put("listGuess", new JSONArray());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @Resource
|
| | | private PDDGoodsService pddGoodsService;
|
| | |
|
| | | |
| | | /**
|
| | | * 新版推荐专题管理(1.5.3)
|
| | | *
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 限时秒杀 1.5.3
|
| | | *
|
| | |
| | | JSONObject root = getSpikeGoodsContent(acceptData);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | private JSONObject getSpikeGoodsContent(AcceptData acceptData) {
|
| | | // 下一次倒计时的时间
|
| | |
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate,
|
| | | shareRate);
|
| | |
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", configService.get("spike_goods_link") + "?id=" + taoBaoGoodsBrief.getAuctionId());
|
| | |
| | | return root;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 首页底部商品推荐
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getGoodList")
|
| | | public void getGoodList(AcceptData acceptData, Integer goodsType, Integer page, HttpServletRequest request, PrintWriter out) {
|
| | | public void getGoodList(AcceptData acceptData, Integer goodsType, Integer page, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (goodsType == null || page == null) {
|
| | | out.print(JsonUtil.loadFalseResult("参数信息不正常"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | taoBaoGuessUserLikeByDevice(acceptData, page, request, out);
|
| | | return;
|
| | |
| | | return;
|
| | | }
|
| | | out.print(JsonUtil.loadFalseResult("商品类型错误"));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("list", new JSONArray());
|
| | | data.put("count", 0);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
|
| | | /**
|
| | | * 根据设备信息获取猜你喜欢的内容
|
| | |
| | | * @param idfa
|
| | | * -IOS的idfa广告标识信息
|
| | | */
|
| | | public void taoBaoGuessUserLikeByDevice(AcceptData acceptData, int page, HttpServletRequest request, PrintWriter out) {
|
| | | public void taoBaoGuessUserLikeByDevice(AcceptData acceptData, int page, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | |
| | | for (int i = list.size() - 1; i >= 0; i--) {
|
| | | TLJBuyGoods goods = list.get(i);
|
| | | BigDecimal rateBuy = TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE;
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(goods.getGoods(), null, rateBuy, rateBuy);
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(goods.getGoods(), null, rateBuy,
|
| | | rateBuy);
|
| | |
|
| | | String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(goods.getGoods(),TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
|
| | | String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(goods.getGoods(),
|
| | | TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
|
| | |
|
| | | ReduceHongBao reduceHongBao = new ReduceHongBao();
|
| | | reduceHongBao.setLeft(goods.getLeftHongBaoCount());
|
| | |
| | | && goods.getBiz30day() > 1000
|
| | | && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate);
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate,
|
| | | shareRate);
|
| | | detailVO.setRecommend(true);
|
| | | goodsList.add(detailVO);
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 京东首页商品
|
| | | * |
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param out
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 爆款排行商品-实时热销榜
|
| | | * |
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param out
|
| | |
| | | import javax.persistence.Transient;
|
| | |
|
| | | import org.hibernate.annotations.Type;
|
| | | import org.springframework.data.mongodb.core.index.Indexed;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | |
| | | */
|
| | | @Entity
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_taobao_goods")
|
| | | @Document(collection="taoBaoGoodsCache")
|
| | | public class TaoBaoGoodsBrief implements Serializable {
|
| | |
|
| | |
|
| | |
| | | @Expose
|
| | | private Long id;
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "rootCatId")
|
| | | private Integer rootCatId;// 0, 一级类目ID
|
| | |
|
| | | @org.yeshi.utils.mybatis.Column(name = "eventCreatorId")
|
| | | private Integer eventCreatorId;// 0,
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "leafCatId")
|
| | | private Integer leafCatId;// 50011277, 子类目id
|
| | |
|
| | |
| | | @org.yeshi.utils.mybatis.Column(name = "rootCatScore")
|
| | | private Integer rootCatScore;// 0,
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "sellerId")
|
| | | private Long sellerId;// 卖家Id
|
| | |
|
| | | @Field
|
| | | @Expose
|
| | | @org.yeshi.utils.mybatis.Column(name = "userType")
|
| | | private Integer userType;// 0,
|
| | |
|
| | | @Field
|
| | | @Expose
|
| | | @org.yeshi.utils.mybatis.Column(name = "shopTitle")
|
| | | private String shopTitle;// 店铺名称
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "pictUrl")
|
| | | @Expose
|
| | | private String pictUrl;// 主图链接
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "pictUrlWhite")
|
| | | @Expose
|
| | | private String pictUrlWhite;// 白底色图片链接
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "title")
|
| | | @Expose
|
| | | private String title;// 商品标题
|
| | |
|
| | | |
| | | @Field
|
| | | @Indexed
|
| | | @org.yeshi.utils.mybatis.Column(name = "auctionId")
|
| | | @Expose
|
| | | private Long auctionId;// 商品ID
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponLink")
|
| | | @Expose
|
| | | private String couponLink;// 优惠券链�?
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponLinkTaoToken")
|
| | | @Expose
|
| | | private String couponLinkTaoToken;//
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponActivityId")
|
| | | @Expose
|
| | | private String couponActivityId;//
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "biz30day")
|
| | | @Expose
|
| | | private Integer biz30day;// 月销量
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "tkRate")
|
| | | @Expose
|
| | | private BigDecimal tkRate;// 佣金比例 �?��100
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "nick")
|
| | | @Expose
|
| | | private String nick;// "yoyo_808611", 店铺名称
|
| | |
| | | @Expose
|
| | | private Integer includeDxjh;// 1:定向计划
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "reservePrice")
|
| | | @Expose
|
| | | private BigDecimal reservePrice;// 588,
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "tkCommFee")
|
| | | @Expose
|
| | | private BigDecimal tkCommFee;// 32.04,
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "totalFee")
|
| | | @Expose
|
| | | private BigDecimal totalFee;// 4814.43,
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "totalNum")
|
| | | @Expose
|
| | | private Integer totalNum;// 229, 库存数量
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "zkPrice")
|
| | | @Expose
|
| | | private BigDecimal zkPrice;// 无线价格,在售价
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "dayLeft")
|
| | | @Expose
|
| | | private Integer dayLeft;// -17228,
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "tk3rdRate")
|
| | | @Expose
|
| | | private String tk3rdRate;// null,
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "auctionUrl")
|
| | | @Expose
|
| | | private String auctionUrl;// 商品链接
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "rlRate")
|
| | | @Expose
|
| | | private Double rlRate;// 69.72,
|
| | |
| | | @Expose
|
| | | private Long sameItemPid;// "-232381821",
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponTotalCount")
|
| | | @Expose
|
| | | private Integer couponTotalCount;// 优惠券�?�?
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponLeftCount")
|
| | | @Expose
|
| | | private Integer couponLeftCount;// 优惠券剩余数�?
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponAmount")
|
| | | @Expose
|
| | | private BigDecimal couponAmount;// 优惠金额
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "eventRate")
|
| | | @Expose
|
| | | private String eventRate;// null,
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponShortLink")
|
| | | @Expose
|
| | | private String couponShortLink;// 优惠券短�?
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponInfo")
|
| | | @Expose
|
| | | private String couponInfo;// 优惠券信�?
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponStartFee")
|
| | | @Expose
|
| | | private BigDecimal couponStartFee;// 优惠券起始优�?
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponEffectiveStartTime")
|
| | | @Expose
|
| | | private String couponEffectiveStartTime;// "2017-02-04",优惠券开始时�?
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponEffectiveEndTime")
|
| | | @Expose
|
| | | private String couponEffectiveEndTime;// 优惠券结束时�?
|
| | |
| | | @Expose
|
| | | private String umpBonus;// null,
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "rootCategoryName")
|
| | | @Expose
|
| | | private String rootCategoryName;// 一级分类名称
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "couponOriLink")
|
| | | @Expose
|
| | | private String couponOriLink;// 优惠券原始链�?
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "userTypeName")
|
| | | @Expose
|
| | | private String userTypeName;// 用户类型
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "tkMktStatus")
|
| | | @Expose
|
| | | private String tkMktStatus; // 1:营销返利
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "totalSales")
|
| | | @Expose
|
| | | private Integer totalSales;// 229, 淘客30天月推广量
|
| | |
| | | private Date createtime;
|
| | | // 更新时间
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "updatetime")
|
| | | @Expose
|
| | | @Type(type = "date")
|
| | |
| | | @Expose
|
| | | private Integer state;// 0-正常 1-商品下架
|
| | |
|
| | | @Field
|
| | | @org.yeshi.utils.mybatis.Column(name = "material_lib_type")
|
| | | @Transient
|
| | | private Integer materialLibType;//物料库类型
|
| | |
| | | return list;
|
| | |
|
| | | // 爆款商品库
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(16432, page, Constant.PAGE_SIZE);
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(14624, page, Constant.PAGE_SIZE);
|
| | | if (result != null) {
|
| | | list = daTaoKeGoodsDetailService.filterTaoBaoGoods(result.getTaoBaoGoodsBriefs());
|
| | | saveObjList(list, name, key);
|
| | |
| | | Map<Long, TLJBuyGoods> map = new ConcurrentHashMap<>();
|
| | | if (list != null)
|
| | | for (TLJBuyGoods goods : list) {
|
| | | try {
|
| | | if (goods.getGoods().getAuctionId() == null) {
|
| | | goods.getGoods().setAuctionId(goods.getGoods().getId());
|
| | | }
|
| | | map.put(goods.getGoods().getAuctionId(), goods);
|
| | | finalList.add(goods.getGoods());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | finalList = recommendGoodsDeleteHistoryService.filterGoods(device, finalList);
|
| | |
| | | TLJBuyGoods.getGoods().setCouponTotalCount(goods.getCouponTotalCount());
|
| | | TLJBuyGoods.getGoods().setBiz30day(goods.getBiz30day());
|
| | | TLJBuyGoods.getGoods().setTkRate(goods.getTkRate());
|
| | | TLJBuyGoods.getGoods().setId(goods.getId());
|
| | | TLJBuyGoods.getGoods().setAuctionId(goods.getAuctionId());
|
| | | tljBuyGoodsDao.save(TLJBuyGoods);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper;
|
| | | import com.yeshi.fanli.dao.taobao.TaoBaoGoodsUpdateDao;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.goods.CommonGoodsException;
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsCacheUtil taoBaoGoodsCacheUtil;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateDao taoBaoGoodsUpdateDao;
|
| | |
|
| | | @Override
|
| | | public void startUpdate() {
|
| | |
| | |
|
| | | // 分享爆款数据删除
|
| | | shareHotGoodsService.deleteByGoodsId(auctionId);
|
| | |
|
| | | }
|
| | |
|
| | | @Transactional
|
| | |
| | |
|
| | | // 更新自购立减库商品
|
| | | tljBuyGoodsService.updateGoods(goods);
|
| | |
|
| | | // 总要商品更新
|
| | | // updateImplTBGoods(goods);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 更新重要的淘宝数据
|
| | | * |
| | | * @param goods
|
| | | */
|
| | | public void updateImplTBGoods(TaoBaoGoodsBrief goods) {
|
| | | if (goods == null)
|
| | | return;
|
| | | if (!taoBaoGoodsCacheUtil.needUpdate(goods.getAuctionId())) {
|
| | | return;
|
| | | }
|
| | | goods.setUpdatetime(new Date());
|
| | | taoBaoGoodsUpdateDao.save(goods);
|
| | | taoBaoGoodsCacheUtil.addUpdateHistory(goods.getAuctionId());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addUpdateQueue(Long auctionId) {
|
| | | if (taoBaoGoodsCacheUtil.canAddToUpdateQueue(auctionId)) {
|
| | | // 添加到更新队列
|
| | | CMQManager.getInstance().addTBImpGoodsUpdate(auctionId);
|
| | | taoBaoGoodsCacheUtil.addAddToQueueHistory(auctionId);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | /**
|
| | | * 队列更新商品
|
| | | * |
| | | * @param start
|
| | | * @param count
|
| | | * @param hour
|
| | |
| | |
|
| | | /**
|
| | | * 根据taoke更新商品信息
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void updateByTaoKeGoodsDetail(Long id);
|
| | |
|
| | | /**
|
| | | * 添加到更新队列
|
| | | * |
| | | * @param auctionId
|
| | | */
|
| | | public void addUpdateQueue(Long auctionId);
|
| | | |
| | | /**
|
| | | * 更新淘宝重要的商品
|
| | | * @param goods
|
| | | */
|
| | | public void updateImplTBGoods(TaoBaoGoodsBrief goods);
|
| | |
|
| | | }
|
| | |
| | | public static String ORDER_WEIQUAN = "weiquan-order";
|
| | |
|
| | | public static String GOODS_UPDATE = "goods_update_queue";
|
| | | // 重要数据更新
|
| | | public static String IMPORTANT_GOODS_UPDATE = "imp_goods_update_queue";
|
| | |
|
| | | static {
|
| | |
|
| | |
| | | FANLI_ORDER_NEW = "test-" + FANLI_ORDER_NEW;
|
| | | FANLI_TICHENG_ORDER = "test-" + FANLI_TICHENG_ORDER;
|
| | | ORDER_WEIQUAN = "test-" + ORDER_WEIQUAN;
|
| | | IMPORTANT_GOODS_UPDATE = "test-" + IMPORTANT_GOODS_UPDATE;
|
| | | }
|
| | |
|
| | | QUEUENAME_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
|
| | |
| | | FANLI_ORDER_NEW += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | FANLI_TICHENG_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | ORDER_WEIQUAN += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | IMPORTANT_GOODS_UPDATE += "-" + Constant.systemCommonConfig.getProjectName();
|
| | |
|
| | | cmqUtil = CMQUtil.getInstance(secretId, secretKey);
|
| | | // 最大消息为1M
|
| | |
| | | cmqUtil.createQueue(FANLI_TICHENG_ORDER);
|
| | | cmqUtil.createQueue(ORDER_WEIQUAN);
|
| | | cmqUtil.createQueue(GOODS_UPDATE);
|
| | | cmqUtil.createQueue(IMPORTANT_GOODS_UPDATE);
|
| | | }
|
| | |
|
| | | public static CMQManager getInstance() {
|
| | |
| | | cmqUtil.deleteMsg(GOODS_UPDATE, receiptHandle);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加淘宝重要商品更新
|
| | | * |
| | | * @param actionId
|
| | | */
|
| | | public void addTBImpGoodsUpdate(Long actionId) {
|
| | | cmqUtil.sendMsg(IMPORTANT_GOODS_UPDATE, actionId + "");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 读取重要商品更新队列
|
| | | * |
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public Map<String, Long> consumeTBImpGoodsUpdateMsg(int count) {
|
| | | List<Message> list = cmqUtil.recieveMsg(count, IMPORTANT_GOODS_UPDATE);
|
| | | if (list == null) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | Map<String, Long> map = new HashMap<>();
|
| | | for (Message msg : list) {
|
| | | String result = msg.msgBody;
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | map.put(msg.receiptHandle, Long.parseLong(result));
|
| | | }
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除队列消息
|
| | | * |
| | | * @param receiptHandle
|
| | | */
|
| | | public void deleteTBImpGoodsUpdateMsg(String receiptHandle) {
|
| | | cmqUtil.deleteMsg(IMPORTANT_GOODS_UPDATE, receiptHandle);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | //淘宝客API接口
|
| | | public class TaoKeApiUtil {
|
| | |
|
| | | |
| | |
|
| | | // 解析券的内容
|
| | | private static TaoBaoSearchResult parseCoupleContent(String content) {
|
| | | TaoBaoSearchResult result = new TaoBaoSearchResult();
|
| | |
| | | System.out.println(goods.getAuctionId() + ":" + g.getAuctionId());
|
| | | if (goods.getAuctionId().longValue() == g.getAuctionId()) {
|
| | | g.setId(goods.getAuctionId());
|
| | | // 判断是否有优惠券
|
| | | if (!StringUtil.isNullOrEmpty(g.getCouponActivityId())) {
|
| | | // 获取优惠券详情
|
| | | QuanInfo quanInfo = getQuanInfo(g.getAuctionId(), g.getCouponActivityId());
|
| | | if (quanInfo != null) {
|
| | | g.setCouponAmount(quanInfo.coupon_amount);
|
| | | g.setCouponEffectiveEndTime(quanInfo.coupon_end_time);
|
| | | g.setCouponEffectiveStartTime(quanInfo.coupon_start_time);
|
| | | g.setCouponLeftCount(quanInfo.coupon_remain_count);
|
| | | g.setCouponStartFee(quanInfo.coupon_start_fee);
|
| | | g.setCouponTotalCount(quanInfo.coupon_total_count);
|
| | | }
|
| | | } else {
|
| | | g.setCouponAmount(new BigDecimal(0));
|
| | | g.setCouponStartFee(new BigDecimal(0));
|
| | | }
|
| | | g.setCreatetime(new Date());
|
| | | g.setMaterialLibType(goods.getMaterialLibType());
|
| | | return g;
|
| | |
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo())) {
|
| | | List<BigDecimal> quanInfo = TaoBaoCouponUtil.getCouponInfo(goods.getCouponInfo());
|
| | | goods.setCouponAmount(quanInfo.get(1));
|
| | | goods.setCouponEffectiveEndTime(
|
| | | TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24, "yyyy-MM-dd"));
|
| | | goods.setCouponEffectiveStartTime(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
|
| | | goods.setCouponStartFee(quanInfo.get(0));
|
| | | goods.setCouponEffectiveEndTime(item.optString("coupon_end_time"));
|
| | | goods.setCouponEffectiveStartTime(item.optString("coupon_start_time"));
|
| | | goods.setCouponStartFee(new BigDecimal(item.optString("coupon_start_fee")));
|
| | | goods.setCouponLeftCount(item.optInt("coupon_remain_count"));
|
| | | goods.setCouponLink("https:" + item.optString("coupon_share_url"));
|
| | | goods.setCouponTotalCount(item.optInt("coupon_total_count"));
|