| | |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>lib-common</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <version>0.0.1</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.springframework.data</groupId> |
| | |
| | | } |
| | | |
| | | if (goods.getTkRate() == null || new BigDecimal(0).compareTo(goods.getTkRate()) == 0) { |
| | | TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app, null, null); |
| | | TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCouponV2(goods.getAuctionId(), app, null, null); |
| | | if (linkInfo != null) { |
| | | goods.setAuctionUrl(linkInfo.getAuctionUrl()); |
| | | goods.setCouponLink(linkInfo.getCouponLink()); |
| | |
| | | } |
| | | |
| | | if (taoBaoGoodsBrief == null) { |
| | | TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app, null, null); |
| | | TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCouponV2(goods.getAuctionId(), app, null, null); |
| | | goods.setCouponInfo(newGoods.getCouponInfo()); |
| | | goods.setCouponLink(newGoods.getCouponLink()); |
| | | goods.setTkRate(newGoods.getTkRate()); |
| | |
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); |
| | | app.setPid(pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.share)); |
| | | app.setAdzoneId(app.getPid().split("_")[3]); |
| | | TaoBaoGoodsBrief goodsLink = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app, null, null); |
| | | TaoBaoGoodsBrief goodsLink = TaoKeApiUtil.specialConvertCouponV2(goods.getAuctionId(), app, null, null); |
| | | if (goodsLink != null) |
| | | token = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), |
| | | StringUtil.isNullOrEmpty(goodsLink.getCouponLink()) ? goodsLink.getAuctionUrl() |
| | |
| | | try { |
| | | goods = TaoKeApiUtil.searchGoodsDetail(id, app); |
| | | if (goods.getTkRate() == null || new BigDecimal(0).compareTo(goods.getTkRate()) == 0) { |
| | | TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app, null, null); |
| | | TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCouponV2(goods.getAuctionId(), app, null, null); |
| | | if (linkInfo != null) { |
| | | goods.setAuctionUrl(linkInfo.getAuctionUrl()); |
| | | goods.setCouponLink(linkInfo.getCouponLink()); |
| | |
| | | if (uid != null && uid > 0) { |
| | | String specialId = userExtraTaoBaoInfoService.getSpecialIdByUid(uid); |
| | | //获取最新的比例 |
| | | TaoBaoGoodsBrief rateGoods = TaoKeApiUtil.specialConvertCoupon(tb.getAuctionId(), TaoBaoConstant.getSpecialAuthAppInfo(pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanli)), specialId, null); |
| | | TaoBaoGoodsBrief rateGoods = TaoKeApiUtil.specialConvertCouponV2(tb.getAuctionId(), TaoBaoConstant.getSpecialAuthAppInfo(pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.fanli)), specialId, null); |
| | | if (rateGoods != null) |
| | | tb.setMinTkRate(rateGoods.getTkRate()); |
| | | } |
| | |
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); |
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); |
| | | app.setPid(pid); |
| | | TaoBaoGoodsBrief goodsLink = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app, null, null); |
| | | TaoBaoGoodsBrief goodsLink = TaoKeApiUtil.specialConvertCouponV2(goods.getAuctionId(), app, null, null); |
| | | if (goodsLink != null) |
| | | token = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), |
| | | StringUtil.isNullOrEmpty(goodsLink.getCouponLink()) ? goodsLink.getAuctionUrl() |
| | |
| | | try { |
| | | goods = TaoKeApiUtil.searchGoodsDetail(id, info); |
| | | if (goods.getTkRate() == null || new BigDecimal(0).compareTo(goods.getTkRate()) == 0) { |
| | | TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), info, null, null); |
| | | TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCouponV2(goods.getAuctionId(), info, null, null); |
| | | if (linkInfo != null) { |
| | | goods.setAuctionUrl(linkInfo.getAuctionUrl()); |
| | | goods.setCouponLink(linkInfo.getCouponLink()); |
| | |
| | | url = goods.getCouponLink(); |
| | | } |
| | | if (!url.contains("uland.taobao.com") && !url.contains("s.click.taobao.com")) { |
| | | TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCoupon(id, app, null, null); |
| | | TaoBaoGoodsBrief linkInfo = TaoKeApiUtil.specialConvertCouponV2(id, app, null, null); |
| | | url = linkInfo.getCouponLink(); |
| | | if (StringUtil.isNullOrEmpty(url)) |
| | | url = linkInfo.getAuctionUrl(); |
| | |
| | | package com.yeshi.fanli.dao.mybatis.jd; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | */ |
| | | List<JDOrderItem> listByOrderId(Long orderId); |
| | | |
| | | |
| | | |
| | | List<JDOrderItem> list(@Param("minCreateTime") Date minCreateTime,@Param("start") int start,@Param("count") int count); |
| | | |
| | | /** |
| | | * 统计所有订单 |
| | | * |
| | |
| | | @Column(name = "joi_sku_id") |
| | | private Long skuId;// 商品ID |
| | | |
| | | @Column(name = "joi_item_id") |
| | | private String itemId;// 商品ID |
| | | |
| | | @Column(name = "joi_sku_name") |
| | | private String skuName;// 商品名称 |
| | | |
| | |
| | | this.orderBy = orderBy; |
| | | } |
| | | |
| | | |
| | | public String getItemId() { |
| | | return itemId; |
| | | } |
| | | |
| | | public void setItemId(String itemId) { |
| | | this.itemId = itemId; |
| | | } |
| | | } |
| | |
| | | |
| | | // 没有获取到转过链的商品详情 |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && !goods.getAuctionUrl().contains("s.click.taobao.com")) { |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info, null, null); // TaoBaoUtil.getTbLinkForShare(auctionId, |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCouponV2(auctionId, info, null, null); // TaoBaoUtil.getTbLinkForShare(auctionId, |
| | | // tbPid.getPid(), |
| | | // taoBaoUnionConfig); |
| | | if (taoBaoLink == null) { |
| | |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && !goods.getAuctionUrl().contains("s.click.taobao.com")) { |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info, null, null); |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCouponV2(auctionId, info, null, null); |
| | | if (taoBaoLink == null) { |
| | | throw new ShareGoodsException(201, "商品转链失败"); |
| | | } |
| | |
| | | cog.getGoodsType()); |
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品 |
| | | { |
| | | JDGoods goods = JDApiUtil.getGoodsDetail(itemOrder.getSkuId()+""); |
| | | if (goods == null) { |
| | | goods = JDUtil.getGoodsFromWeb(itemOrder.getSkuId()); |
| | | } |
| | | |
| | | JDGoods goods = null; |
| | | if (goods == null) { |
| | | goods = new JDGoods(); |
| | | goods.setSkuName(itemOrder.getSkuName()); |
| | | goods.setPrice(itemOrder.getPrice()); |
| | | goods.setSkuId(itemOrder.getSkuId()); |
| | | goods.setItemId(itemOrder.getItemId()); |
| | | } |
| | | |
| | | if (goods != null) { |
| | |
| | | cog.setUpdateTime(new Date()); |
| | | commonOrderGoodsMapper.insertSelective(cog); |
| | | } else { |
| | | |
| | | for (CommonOrderGoods orderGoods : commonGoodsList) { |
| | | if (StringUtil.isNullOrEmpty(orderGoods.getGoodsId())) { |
| | | JDGoods goods = new JDGoods(); |
| | | goods.setSkuName(itemOrder.getSkuName()); |
| | | goods.setPrice(itemOrder.getPrice()); |
| | | goods.setSkuId(itemOrder.getSkuId()); |
| | | goods.setItemId(itemOrder.getItemId()); |
| | | if (goods != null) { |
| | | cog = CommonOrderGoodsFactory.create(goods); |
| | | cog.setId(orderGoods.getId()); |
| | | commonOrderGoodsMapper.updateByPrimaryKeySelective(cog); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | |
| | | public List<CommonOrderAddResultDTO> addDYOrder(DYOrder order, Long uid) throws CommonOrderException { |
| | | List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>(); |
| | | |
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(order); |
| | | CommonOrderGoods cog = new CommonOrderGoods(); |
| | | cog.setGoodsId(order.getProduct_id()); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_DY); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | newCommonOrder.setStateWholeOrder(newCommonOrder.getState()); |
| | | // 订单商品插入 |
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(), |
| | | cog.getGoodsType()); |
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品 |
| | | { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(order.getProduct_id())); |
| | | if (goods == null) { |
| | | goods = new DYGoodsDetail(); |
| | | goods.setTitle(order.getProduct_name()); |
| | | goods.setPrice(0); |
| | | goods.setProduct_id(Long.parseLong(order.getProduct_id())); |
| | | goods.setCover(order.getProduct_img()); |
| | | } |
| | | |
| | | if (goods != null) { |
| | | cog = CommonOrderGoodsFactory.create(goods); |
| | | } |
| | | |
| | | cog.setCreateTime(new Date()); |
| | | cog.setUpdateTime(new Date()); |
| | | commonOrderGoodsMapper.insertSelective(cog); |
| | | } else { |
| | | |
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(order); |
| | | CommonOrderGoods cog = new CommonOrderGoods(); |
| | | cog.setGoodsId(order.getProduct_id()); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_DY); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | newCommonOrder.setStateWholeOrder(newCommonOrder.getState()); |
| | | // 订单商品插入 |
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(), |
| | | cog.getGoodsType()); |
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品 |
| | | { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(order.getProduct_id())); |
| | | if (goods == null) { |
| | | goods = new DYGoodsDetail(); |
| | | goods.setTitle(order.getProduct_name()); |
| | | goods.setPrice(0); |
| | | goods.setProduct_id(Long.parseLong(order.getProduct_id())); |
| | | goods.setCover(order.getProduct_img()); |
| | | } |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | |
| | | if (goods != null) { |
| | | cog = CommonOrderGoodsFactory.create(goods); |
| | | } |
| | | |
| | | cog.setCreateTime(new Date()); |
| | | cog.setUpdateTime(new Date()); |
| | | commonOrderGoodsMapper.insertSelective(cog); |
| | | } else { |
| | | |
| | | } |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | |
| | | addConfirmMQMsg(commonOrderList); |
| | | return commonOrderList; |
| | |
| | | |
| | | @Override |
| | | public List<CommonOrder> getByOrderNo(Long uid, String orderNO) { |
| | | if(uid!=null) { |
| | | if (uid != null) { |
| | | return commonOrderMapper.getByOrderNo(uid, orderNO); |
| | | }else{ |
| | | CommonOrderMapper.DaoQuery daoQuery=new CommonOrderMapper.DaoQuery(); |
| | | } else { |
| | | CommonOrderMapper.DaoQuery daoQuery = new CommonOrderMapper.DaoQuery(); |
| | | daoQuery.orderId = orderNO; |
| | | return commonOrderMapper.list(daoQuery,0,100); |
| | | return commonOrderMapper.list(daoQuery, 0, 100); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonOrder> listPayStateOrder(Integer sourceType, Date minThirdCreateTime, Date maxThirdCreateTime,int page,int pageSize) { |
| | | public List<CommonOrder> listPayStateOrder(Integer sourceType, Date minThirdCreateTime, Date maxThirdCreateTime, int page, int pageSize) { |
| | | CommonOrderMapper.DaoQuery daoQuery = new CommonOrderMapper.DaoQuery(); |
| | | daoQuery.minThirdCreateTime = minThirdCreateTime; |
| | | daoQuery.maxThirdCreateTime = maxThirdCreateTime; |
| | | daoQuery.state = CommonOrder.STATE_FK; |
| | | daoQuery.sourceType = sourceType; |
| | | daoQuery.sortList = Arrays.asList(new String[]{"co_third_create_time ASC"}); |
| | | return commonOrderMapper.list(daoQuery, (page-1)*pageSize, pageSize); |
| | | return commonOrderMapper.list(daoQuery, (page - 1) * pageSize, pageSize); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | if (simpleGoods.getMaterialLibType() != null && simpleGoods.getMaterialLibType() == 1) { |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCouponV2(auctionId, |
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, |
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET, |
| | | specialPid), specialId, null); |
| | |
| | | } else { |
| | | String sRelationId = taoBaoBuyRelationMapService.getRelationId(uid); |
| | | |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCouponV2(auctionId, |
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, |
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET, |
| | | specialRelationPid), specialId, null); |
| | |
| | | return taoBaoLink; |
| | | } |
| | | |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app, specialId, null); |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCouponV2(auctionId, app, specialId, null); |
| | | if (goods == null) { |
| | | throw new TaoBaoConvertLinkException(1, ""); |
| | | } |
| | |
| | | |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && !goods.getAuctionUrl().contains("s.click.taobao.com")) { |
| | | |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info, null, relationId); |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCouponV2(auctionId, info, null, relationId); |
| | | if (taoBaoLink == null) { |
| | | throw new TaoBaoConvertLinkException(201, "商品转链失败"); |
| | | } |
| | |
| | | //保存券链接 |
| | | cacheCouponInfo(goods, info.getPid()); |
| | | } else { |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info, null, relationId); |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCouponV2(auctionId, info, null, relationId); |
| | | if (taoBaoLink == null) { |
| | | throw new TaoBaoConvertLinkException(201, "商品转链失败"); |
| | | } |
| | |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && !goods.getAuctionUrl().contains("s.click.taobao.com")) { |
| | | TaoBaoUnionConfig taoBaoUnionConfig = taoBaoUnionConfigService |
| | | .getConfigByAppIdCache(info.getPid().split("_")[2]); |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info, null, relationId); |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCouponV2(auctionId, info, null, relationId); |
| | | if (taoBaoLink == null) { |
| | | throw new TaoBaoConvertLinkException(201, "商品转链失败"); |
| | | } |
| | |
| | | return taoBaoLink; |
| | | } |
| | | |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app, specialId, relationId); |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCouponV2(auctionId, app, specialId, relationId); |
| | | if (goods == null) { |
| | | throw new TaoBaoConvertLinkException(1, ""); |
| | | } |
| | |
| | | public class Constant { |
| | | public static boolean IS_TASK = true; |
| | | // 外网环境 |
| | | public static boolean IS_OUTNET = false; |
| | | public static boolean IS_OUTNET = true; |
| | | |
| | | public static boolean IS_TEST = true; |
| | | public static boolean IS_TEST = false; |
| | | |
| | | public static boolean ENABLE_MQ = true; |
| | | |
| | |
| | | List<JDOrder> orderList = new Gson().fromJson(data.toString(), typeToken); |
| | | if (orderList != null) |
| | | for (JDOrder order : orderList) { |
| | | Map<Long, List<JDOrderItem>> map = new HashMap<>(); |
| | | Map<String, List<JDOrderItem>> map = new HashMap<>(); |
| | | for (int i = 0; i < order.getOrderItemList().size(); i++) { |
| | | JDOrderItem orderItem = order.getOrderItemList().get(i); |
| | | if (map.get(orderItem.getSkuId()) == null) |
| | | map.put(orderItem.getSkuId(), new ArrayList<>()); |
| | | map.get(orderItem.getSkuId()).add(orderItem); |
| | | String goodsId = getGoodsId(orderItem, order.getOrderItemList().size()); |
| | | if (map.get(goodsId) == null) |
| | | map.put(goodsId, new ArrayList<>()); |
| | | map.get(goodsId).add(orderItem); |
| | | |
| | | order.getOrderItemList().get(i) |
| | | .setTradeId(order.getOrderId() + "-" + order.getOrderItemList().get(i).getSkuId()); |
| | | .setTradeId(order.getOrderId() + "-" + getGoodsId(order.getOrderItemList().get(i),order.getOrderItemList().size())); |
| | | order.getOrderItemList().get(i).setOrderId(order.getOrderId()); |
| | | order.getOrderItemList().get(i).setOrderBy(i + 1); |
| | | } |
| | | // 查询商品ID相同的子订单 |
| | | for (Iterator<Long> its = map.keySet().iterator(); its.hasNext(); ) { |
| | | Long skuId = its.next(); |
| | | if (map.get(skuId).size() > 1) { |
| | | for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) { |
| | | String goodsId = its.next(); |
| | | if (map.get(goodsId).size() > 1) { |
| | | int skuOrderBy = 1; |
| | | for (int i = 0; i < order.getOrderItemList().size(); i++) { |
| | | JDOrderItem orderItem = order.getOrderItemList().get(i); |
| | | if (orderItem.getSkuId().longValue() == skuId) { |
| | | if (getGoodsId(orderItem,order.getOrderItemList().size()).equalsIgnoreCase(goodsId)) { |
| | | order.getOrderItemList().get(i).setTradeId(order.getOrderId() + "-" |
| | | + order.getOrderItemList().get(i).getSkuId() + "-" + skuOrderBy++); |
| | | + getGoodsId(order.getOrderItemList().get(i), order.getOrderItemList().size()) + "-" + skuOrderBy++); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static String getGoodsId(JDOrderItem item, int itemCount) { |
| | | if (itemCount <= 1) { |
| | | return item.getSkuId() + ""; |
| | | } |
| | | if (item.getSkuId() != null) { |
| | | return item.getSkuId() + ""; |
| | | } |
| | | return item.getItemId().split("_")[1]; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | JDGoods goods = queryGoodsDetail("KXexrdv7wvWFvE1JNpVMEjdo_3KLpG8mAYwxxKXwFw0"); |
| | | System.out.println(goods.toString()); |
| | | Date startTime = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L); |
| | | // 一个小时为一个步长 |
| | | List<JDOrder> tempOrderList = new ArrayList<>(); |
| | | for (int i = 0; i < 24; i++) { |
| | | Date da = new Date(startTime.getTime() + 1000 * 60 * 60L * i); |
| | | if (da.getTime() >System.currentTimeMillis()) |
| | | break; |
| | | |
| | | |
| | | |
| | | // long now = System.currentTimeMillis(); |
| | | // |
| | | // JDOrderResult result = JDApiUtil.getOrderList(1, 200, new Date(now), JDApiUtil.ORDER_TYPE_CREATETIME); |
| | | // System.out.printf(result.toString()); |
| | | int pageSize = 200; |
| | | int page = 1; |
| | | JDOrderResult result = JDApiUtil.getOrderList(page++, pageSize, da, JDApiUtil.ORDER_TYPE_UPDATETIME); |
| | | if (result != null) { |
| | | tempOrderList.addAll(result.getOrderList()); |
| | | while (result != null && result.isHasMore()) { |
| | | result = JDApiUtil.getOrderList(page++, pageSize, da, JDApiUtil.ORDER_TYPE_UPDATETIME); |
| | | if (result != null) |
| | | tempOrderList.addAll(result.getOrderList()); |
| | | } |
| | | } |
| | | } |
| | | System.out.println(tempOrderList.size()); |
| | | } |
| | | |
| | | } |
| | |
| | | }else{ |
| | | return String.format("https://jingfen.jd.com/detail/%s.html", id); |
| | | } |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | System.out.printf(getJDGoodsIdByUJD("https://3.cn/1-U6tjhC")); |
| | | System.out.printf(getJDGoodsIdByUJD("https://3.cn/297ndx-c")); |
| | | } |
| | | |
| | | } |
| | |
| | | if (StringUtil.isNullOrEmpty(relationId)) |
| | | return url; |
| | | if (!url.contains("&relationId=")) |
| | | return url + "&relationId=" + relationId; |
| | | if(url.contains("?")) { |
| | | return url + "&relationId=" + relationId; |
| | | }else{ |
| | | return url + "?relationId=" + relationId; |
| | | } |
| | | else |
| | | return url; |
| | | } |
| | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | String reg = "「.*」"; |
| | | Pattern p = Pattern.compile(reg); |
| | | Matcher matcher = p.matcher("【淘宝】https://m.tb.cn/h.Ub3d7Kb?tk=g2Az2EmdcIX CZ3457 「造梦【蔷薇少女】复古碎花牛奶绒羊羔绒毛毯秋冬保暖休闲毯沙发毯」\n" + |
| | | "点击链接直接打开"); |
| | | if (matcher.find()) { |
| | | String title = matcher.group(); |
| | | System.out.println(title); |
| | | // String reg = "「.*」"; |
| | | // Pattern p = Pattern.compile(reg); |
| | | // Matcher matcher = p.matcher("【淘宝】https://m.tb.cn/h.Ub3d7Kb?tk=g2Az2EmdcIX CZ3457 「造梦【蔷薇少女】复古碎花牛奶绒羊羔绒毛毯秋冬保暖休闲毯沙发毯」\n" + |
| | | // "点击链接直接打开"); |
| | | // if (matcher.find()) { |
| | | // String title = matcher.group(); |
| | | // System.out.println(title); |
| | | // } |
| | | String relationId = "1222"; |
| | | String url="http://123id=123"; |
| | | if(url.contains("?")) { |
| | | System.out.println(url + "&relationId=" + relationId); |
| | | }else{ |
| | | System.out.println(url + "?relationId=" + relationId); |
| | | } |
| | | } |
| | | |
| | |
| | | map.put("method", "taobao.tbk.item.info.get"); |
| | | |
| | | map.put("num_iids", id + ""); |
| | | String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | System.out.println(resultStr); |
| | | JSONObject data = JSONObject.fromObject(resultStr); |
| | | // 商品下架 |
| | |
| | | if (array != null && array.size() > 0) { |
| | | JSONObject item = array.optJSONObject(0); |
| | | TaoBaoGoodsBrief goods = parseSimpleGoodsInfo(item); |
| | | if(goods!=null&&!NumberUtil.isNumeric(id)){ |
| | | if (goods != null && !NumberUtil.isNumeric(id)) { |
| | | goods.setAuctionId(id); |
| | | } |
| | | return goods; |
| | |
| | | |
| | | map.put("num_iids", id + ""); |
| | | String resultStr = null; |
| | | if(!NumberUtil.isNumeric(id)){ |
| | | resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | }else{ |
| | | if (!NumberUtil.isNumeric(id)) { |
| | | resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | } else { |
| | | map.put("biz_scene_id", "2"); |
| | | resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, TaoBaoConstant.getSpecialAuthAppInfo(TaoBaoConstant.TAOBAO_PID_DEFAULT)); |
| | | resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, TaoBaoConstant.getSpecialAuthAppInfo(TaoBaoConstant.TAOBAO_PID_DEFAULT)); |
| | | } |
| | | System.out.println(resultStr); |
| | | JSONObject data = JSONObject.fromObject(resultStr); |
| | |
| | | if (array != null && array.size() > 0) { |
| | | JSONObject item = array.optJSONObject(0); |
| | | TaoBaoGoodsBrief goods = parseSimpleGoodsInfo(item); |
| | | if(goods!=null&&!NumberUtil.isNumeric(id)){ |
| | | if (goods != null && !NumberUtil.isNumeric(id)) { |
| | | goods.setAuctionId(id); |
| | | } |
| | | return goods; |
| | |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | | goods.setAuctionId(item.optString("num_iid")); |
| | | goods.setAuctionUrl(item.optString("item_url")); |
| | | if(item.containsKey("annual_vol")){ |
| | | goods.setBiz30day(item.optInt("annual_vol")/12); |
| | | }else { |
| | | if (item.containsKey("annual_vol")) { |
| | | goods.setBiz30day(item.optInt("annual_vol") / 12); |
| | | } else { |
| | | goods.setBiz30day(item.optInt("volume")); |
| | | } |
| | | if (item.optJSONObject("small_images") != null) { |
| | |
| | | } |
| | | |
| | | // 从转链搜索 |
| | | TaoBaoGoodsBrief newGoods = specialConvertCoupon(goods.getAuctionId(), |
| | | TaoBaoGoodsBrief newGoods = specialConvertCouponV2(goods.getAuctionId(), |
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET, |
| | | TaoBaoConstant.TAOBAO_PID_DEFAULT), specialId, relationId); |
| | | |
| | |
| | | } |
| | | |
| | | // 从转链搜索 |
| | | TaoBaoGoodsBrief newGoods = specialConvertCoupon(goods.getAuctionId(), |
| | | TaoBaoGoodsBrief newGoods = specialConvertCouponV2(goods.getAuctionId(), |
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET, |
| | | TaoBaoConstant.TAOBAO_PID_DEFAULT), null, null); |
| | | |
| | |
| | | System.out.println("resultStr" + resultStr); |
| | | JSONObject data = JSONObject.fromObject(resultStr); |
| | | JSONObject rootData = data.optJSONObject("tbk_dg_material_optional_upgrade_response"); |
| | | if ( rootData!= null |
| | | &&rootData.optJSONObject("result_list") != null) { |
| | | if (rootData != null |
| | | && rootData.optJSONObject("result_list") != null) { |
| | | JSONArray array = rootData.optJSONObject("result_list") |
| | | .optJSONArray("map_data"); |
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); |
| | |
| | | |
| | | goods.setAuctionId(item.optString("num_iid")); |
| | | goods.setAuctionUrl("https:" + item.optString("url")); |
| | | if(item.containsKey("annual_vol")){ |
| | | goods.setBiz30day(item.optInt("annual_vol")/100); |
| | | }else { |
| | | if (item.containsKey("annual_vol")) { |
| | | goods.setBiz30day(item.optInt("annual_vol") / 100); |
| | | } else { |
| | | goods.setBiz30day(item.optInt("volume")); |
| | | } |
| | | goods.setCouponInfo(item.optString("coupon_info")); |
| | |
| | | JSONObject mgcInfo = item.optJSONObject("mgc_info"); |
| | | |
| | | |
| | | |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | | goods.setPictUrl(basicInfo.optString("pict_url")); |
| | | |
| | |
| | | goods.setAuctionId(item.optString("item_id")); |
| | | goods.setAuctionUrl("https:" + item.optString("url")); |
| | | |
| | | if(basicInfo.containsKey("annual_vol")){ |
| | | goods.setBiz30day(basicInfo.optInt("annual_vol")/12); |
| | | }else { |
| | | if (basicInfo.containsKey("annual_vol")) { |
| | | goods.setBiz30day(basicInfo.optInt("annual_vol") / 12); |
| | | } else { |
| | | goods.setBiz30day(basicInfo.optInt("volume")); |
| | | } |
| | | if(pricePromotionInfo.optJSONObject("final_promotion_path_list")!=null&&pricePromotionInfo.optJSONObject("final_promotion_path_list").optJSONArray("final_promotion_path_map_data").size()>0) { |
| | | if (pricePromotionInfo.optJSONObject("final_promotion_path_list") != null && pricePromotionInfo.optJSONObject("final_promotion_path_list").optJSONArray("final_promotion_path_map_data").size() > 0) { |
| | | JSONArray array = pricePromotionInfo.optJSONObject("final_promotion_path_list").optJSONArray("final_promotion_path_map_data"); |
| | | JSONObject couponInfo = array.optJSONObject(0); |
| | | goods.setCouponInfo(couponInfo.optString("promotion_desc").replace(".00", "")); |
| | |
| | | goods.setCouponLink(publishInfo.optString("coupon_share_url")); |
| | | goods.setCouponTotalCount(100); |
| | | goods.setCouponActivityId(couponInfo.optString("promotion_id")); |
| | | }else{ |
| | | } else { |
| | | goods.setCouponAmount(new BigDecimal(0)); |
| | | } |
| | | |
| | |
| | | goods.setUserTypeName(""); |
| | | goods.setZkPrice(new BigDecimal(pricePromotionInfo.optString("zk_final_price"))); |
| | | |
| | | if (publishInfo.optJSONArray("sp_campaign_list")!=null&&publishInfo.optJSONArray("sp_campaign_list").size()>0) { |
| | | if (publishInfo.optJSONArray("sp_campaign_list") != null && publishInfo.optJSONArray("sp_campaign_list").size() > 0) { |
| | | goods.setDxjhInfo(publishInfo.optJSONArray("sp_campaign_list").optJSONObject(0).optString("sp_name")); |
| | | } |
| | | |
| | |
| | | goods.setTotalFee(new BigDecimal("0")); |
| | | // 推荐语 |
| | | |
| | | if(mgcInfo!=null) { |
| | | if (mgcInfo != null) { |
| | | goods.setDescription(mgcInfo.optString("item_description")); |
| | | } |
| | | goods = loadYuShouInfo(goods, item); |
| | |
| | | } |
| | | |
| | | |
| | | public static TaoBaoGoodsBrief specialConvertCouponV2(String auctionId, TaoKeAppInfo app, String specialId, String relationId) { |
| | | String pid = app.getPid(); |
| | | String[] sts = pid.split("_"); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tbk.dg.general.link.convert"); |
| | | map.put("item_id_list", auctionId + ""); |
| | | map.put("adzone_id", sts[3]); |
| | | if (!StringUtil.isNullOrEmpty(specialId) && !StringUtil.isNullOrEmpty(relationId)) { |
| | | map.put("special_id", specialId); |
| | | } else if (!StringUtil.isNullOrEmpty(specialId)) { |
| | | map.put("special_id", specialId); |
| | | } else if (!StringUtil.isNullOrEmpty(relationId)) { |
| | | map.put("relation_id", relationId); |
| | | } |
| | | try { |
| | | String result = TaoKeBaseUtil.baseRequestForThreeTimes(map, app); |
| | | System.out.println(result); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | JSONObject resultJSON = json.optJSONObject("tbk_dg_general_link_convert_response").optJSONObject("data") |
| | | .optJSONObject("item_url_list").optJSONArray("item_url_list").optJSONObject(0); |
| | | JSONObject goodsInfo=resultJSON.optJSONObject("link_info_dto"); |
| | | String couponLink = goodsInfo.optString("coupon_short_url"); |
| | | String itemLink = goodsInfo.optString("cps_short_url"); |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | | goods.setAuctionUrl(itemLink); |
| | | goods.setCouponLink(couponLink); |
| | | if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_info"))) { |
| | | goods.setCouponLink(couponLink); |
| | | goods.setCouponInfo(resultJSON.optString("coupon_info")); |
| | | if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_total_count"))) { |
| | | goods.setCouponTotalCount(Integer.parseInt(resultJSON.optString("coupon_total_count"))); |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_remain_count"))) { |
| | | goods.setCouponLeftCount(Integer.parseInt(resultJSON.optString("coupon_remain_count"))); |
| | | } |
| | | |
| | | goods.setCouponEffectiveStartTime(resultJSON.optString("coupon_start_time")); |
| | | goods.setCouponEffectiveEndTime(resultJSON.optString("coupon_end_time")); |
| | | |
| | | } |
| | | |
| | | JSONObject rateInfo=resultJSON.optJSONObject("promotion_info_dto"); |
| | | String tkRate = rateInfo.optString("commission_rate"); |
| | | if (!StringUtil.isNullOrEmpty(tkRate)) { |
| | | goods.setTkRate(new BigDecimal(tkRate)); |
| | | } |
| | | goods = loadYuShouInfo(goods, resultJSON); |
| | | return goods; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | // AA5ISJ |
| | | |
| | | private static TaoBaoGoodsBrief parseWuLiaoItemFromMaterialId(JSONObject item) { |
| | |
| | | goods.setPictUrl(TbImgUtil.getTBSize320Img("https:" + item.optString("pict_url"))); |
| | | goods.setAuctionId(item.optString("item_id")); |
| | | goods.setAuctionUrl("https://item.taobao.com/item.htm?id=" + goods.getAuctionId()); |
| | | if(item.containsKey("annual_vol")){ |
| | | goods.setBiz30day(item.optInt("annual_vol")/12); |
| | | }else { |
| | | if (item.containsKey("annual_vol")) { |
| | | goods.setBiz30day(item.optInt("annual_vol") / 12); |
| | | } else { |
| | | goods.setBiz30day(item.optInt("volume")); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(item.optString("coupon_amount"))) { |
| | |
| | | // map.put("num_iids", "708395859317"); |
| | | // String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | // System.out.println(resultStr); |
| | | SearchFilter sf=new SearchFilter(); |
| | | sf.setKey("鞋"); |
| | | sf.setPage(1); |
| | | sf.setPageSize(20); |
| | | TaoBaoSearchResult result = searchWuLiaoNew(sf,null,null); |
| | | System.out.printf(result.toString()); |
| | | // SearchFilter sf=new SearchFilter(); |
| | | // sf.setKey("鞋"); |
| | | // sf.setPage(1); |
| | | // sf.setPageSize(20); |
| | | // TaoBaoSearchResult result = searchWuLiaoNew(sf,null,null); |
| | | // System.out.printf(result.toString()); |
| | | // public static final String TAOBAO_AUTH_APPKEY = "24980167"; |
| | | // public static final String TAOBAO_AUTH_APPSECRET = "e0a2e05deabf5ce039b52e5b492d5382"; |
| | | // public static final String TAOBAO_PID_DEFAULT="mm_124933865_56750082_89555600043"; |
| | | |
| | | |
| | | TaoKeAppInfo app = new TaoKeAppInfo("24980167", "e0a2e05deabf5ce039b52e5b492d5382", "mm_124933865_56750082_89555600043"); |
| | | |
| | | specialConvertCouponV2("ZMxBywvT6tPr0wabjaFBQPiVt6-g4DYZPC2OoJaaRXIoq", app, "511379263", null); |
| | | } |
| | | |
| | | } |
| | |
| | | <dubbo:annotation package="com.yeshi.fanli"></dubbo:annotation> |
| | | |
| | | <dubbo:registry address="zookeeper://172.16.16.46:2181"/> |
| | | <!--<dubbo:registry address="zookeeper://193.112.35.168:2182"/>--> |
| | | <!-- <dubbo:registry address="zookeeper://193.112.35.168:2182"/>--> |
| | | |
| | | <!-- url=dubbo://192.168.3.122:20882/com.yeshi.goods.facade.service.TaoBaoCouponCacheService --> |
| | | |
| | |
| | | <result column="joi_cid2" property="cid2" jdbcType="BIGINT" /> |
| | | <result column="joi_site_id" property="siteId" jdbcType="BIGINT" /> |
| | | <result column="joi_sku_id" property="skuId" jdbcType="BIGINT" /> |
| | | <result column="joi_item_id" property="itemId" jdbcType="VARCHAR" /> |
| | | <result column="joi_sku_name" property="skuName" jdbcType="VARCHAR" /> |
| | | <result column="joi_sku_num" property="skuNum" jdbcType="BIGINT" /> |
| | | <result column="joi_sku_return_num" property="skuReturnNum" |
| | |
| | | <result column="showValue" property="showValue" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">joi_id,joi_order_id,joi_actual_cos_price,joi_actual_fee,joi_commission_rate,joi_estimate_cos_price,joi_estimate_fee,joi_final_rate,joi_cid1,joi_frozen_sku_num,joi_pid,joi_position_id,joi_price,joi_cid2,joi_site_id,joi_sku_id,joi_sku_name,joi_sku_num,joi_sku_return_num,joi_sub_side_rate,joi_sub_sidy_rate,joi_cid3,joi_union_alias,joi_union_tag,joi_union_traffic_group,joi_valid_code,joi_sub_union_id,joi_trace_type,joi_pay_month,joi_pop_id,joi_ext1,joi_trade_id,joi_create_time,joi_update_time,joi_order_by |
| | | <sql id="Base_Column_List">joi_id,joi_order_id,joi_actual_cos_price,joi_actual_fee,joi_commission_rate,joi_estimate_cos_price,joi_estimate_fee,joi_final_rate,joi_cid1,joi_frozen_sku_num,joi_pid,joi_position_id,joi_price,joi_cid2,joi_site_id,joi_sku_id,joi_item_id,joi_sku_name,joi_sku_num,joi_sku_return_num,joi_sub_side_rate,joi_sub_sidy_rate,joi_cid3,joi_union_alias,joi_union_tag,joi_union_traffic_group,joi_valid_code,joi_sub_union_id,joi_trace_type,joi_pay_month,joi_pop_id,joi_ext1,joi_trade_id,joi_create_time,joi_update_time,joi_order_by |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order_item where joi_order_id = #{0} |
| | | </select> |
| | | |
| | | <select id="list" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order_item where joi_create_time > #{minCreateTime} order by joi_create_time asc limit #{start}, #{count} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | |
| | | <if test="cid2 != null">joi_cid2,</if> |
| | | <if test="siteId != null">joi_site_id,</if> |
| | | <if test="skuId != null">joi_sku_id,</if> |
| | | <if test="itemId != null">joi_item_id,</if> |
| | | <if test="skuName != null">joi_sku_name,</if> |
| | | <if test="skuNum != null">joi_sku_num,</if> |
| | | <if test="skuReturnNum != null">joi_sku_return_num,</if> |
| | |
| | | <if test="cid2 != null">#{cid2,jdbcType=BIGINT},</if> |
| | | <if test="siteId != null">#{siteId,jdbcType=BIGINT},</if> |
| | | <if test="skuId != null">#{skuId,jdbcType=BIGINT},</if> |
| | | <if test="itemId != null">#{itemId,jdbcType=VARCHAR},</if> |
| | | <if test="skuName != null">#{skuName,jdbcType=VARCHAR},</if> |
| | | <if test="skuNum != null">#{skuNum,jdbcType=BIGINT},</if> |
| | | <if test="skuReturnNum != null">#{skuReturnNum,jdbcType=BIGINT},</if> |
| | |
| | | #{price,jdbcType=DECIMAL},joi_cid2 = |
| | | #{cid2,jdbcType=BIGINT},joi_site_id = |
| | | #{siteId,jdbcType=BIGINT},joi_sku_id = |
| | | #{skuId,jdbcType=BIGINT},joi_sku_name = |
| | | #{skuId,jdbcType=BIGINT},joi_item_id = |
| | | #{itemId,jdbcType=VARCHAR},joi_sku_name = |
| | | #{skuName,jdbcType=VARCHAR},joi_sku_num = |
| | | #{skuNum,jdbcType=BIGINT},joi_sku_return_num = |
| | | #{skuReturnNum,jdbcType=BIGINT},joi_sub_side_rate = |
| | |
| | | <if test="cid2 != null">joi_cid2=#{cid2,jdbcType=BIGINT},</if> |
| | | <if test="siteId != null">joi_site_id=#{siteId,jdbcType=BIGINT},</if> |
| | | <if test="skuId != null">joi_sku_id=#{skuId,jdbcType=BIGINT},</if> |
| | | <if test="itemId != null">joi_item_id=#{itemId,jdbcType=VARCHAR},</if> |
| | | <if test="skuName != null">joi_sku_name=#{skuName,jdbcType=VARCHAR},</if> |
| | | <if test="skuNum != null">joi_sku_num=#{skuNum,jdbcType=BIGINT},</if> |
| | | <if test="skuReturnNum != null">joi_sku_return_num=#{skuReturnNum,jdbcType=BIGINT},</if> |
| | |
| | | #短信验证码模板 |
| | | |
| | | #登录验证码 |
| | | sms_login=【[签名]】验证码:[验证码],2分钟内有效。为了保护您的账号安全,验证短信请勿转发他人。 |
| | | sms_login=【[签名]】验证码:[验证码],2分钟内有效。 |
| | | #绑定验证码 |
| | | sms_bind=【[签名]】验证码:[验证码],2分钟内有效。为了保护您的账号安全,验证短信请勿转发他人。 |
| | | sms_bind=【[签名]】验证码:[验证码],2分钟内有效。 |
| | | #提现验证码 |
| | | sms_extract=【[签名]】[验证码](返利券验证码),有效期为2分钟。为了保护您的账号安全,验证短信请勿转发他人。 |
| | | sms_extract=【[签名]】[验证码](返利券验证码),有效期为2分钟。 |
| | | #提现成功验证码 |
| | | sms_extract_success=【[签名]】恭喜您!成功提现[金额]元,请前往您绑定的提现支付宝账单中确认查收(来自于重庆椰视科技有限公司的转账),如有疑问请联系本APP人工客服。 |
| | | #提现失败验证码 |