コード例 #1
0
 /**
  * 根据条件查询店铺信息、店铺授权信息
  *
  * @param shopBean
  * @return
  */
 @Transactional(readOnly = true)
 public List<ShopBean> findShopBean(ShopBean shopBean) {
   Shop shopQuery = new Shop();
   shopQuery.setPlatformType(shopBean.getPlatformType());
   shopQuery.setId(shopBean.getShopId());
   // 查询所有店铺及授权信息
   List<Shop> shopList = shopService.getShopAndAuth(shopQuery);
   return convertShopList2ShopBeanList(shopList);
 }
コード例 #2
0
 /**
  * 获取订单的最后抓取时间
  *
  * @param shopBean
  * @return
  */
 public Date getLastFetchReturnTime(ShopBean shopBean) {
   OrderFetch orderFetch =
       orderFetchService.findLastOrderFetch(
           shopBean.getPlatformType(),
           shopBean.getShopId(),
           FetchDataType.FETCH_RETURN,
           shopBean.getFetchOptType());
   return orderFetch == null ? null : orderFetch.getFetchTime();
 }
コード例 #3
0
 /**
  * 将店铺及授权信息转换为shopBean
  *
  * @param shop
  * @return
  */
 private ShopBean convertShop2ShopBean(Shop shop) {
   ShopBean shopBean = null;
   if (shop == null) {
     return shopBean;
   }
   shopBean = new ShopBean();
   shopBean.setShopId(shop.getId());
   shopBean.setOutShopId(shop.getOutShopId());
   shopBean.setTitle(shop.getTitle());
   shopBean.setSellerNick(shop.getNick());
   if (shop.getShopAuth() != null) {
     shopBean.setUserId(shop.getShopAuth().getUserId());
     shopBean.setSessionKey(shop.getShopAuth().getSessionKey());
     shopBean.setRefreshToken(shop.getShopAuth().getRefreshToken());
   }
   shopBean.setPlatformType(shop.getPlatformType());
   shopBean.setShopType(shop.getShopType());
   return shopBean;
 }
コード例 #4
0
  /**
   * 设置店铺的关键抓取参数
   *
   * @param startDate
   * @param endDate
   * @param shopBean
   */
  public void assignShopBean(
      Date startDate,
      Date endDate,
      FetchOptType fetchOptType,
      List<FetchDataType> fetchDataTypeList,
      ShopBean shopBean) {
    // 获取抓取数据类型并设置
    shopBean.setFetchDataTypeList(fetchDataTypeList);
    // 抓取操作类型设置 手动抓单为HAND 注意:这步操作必须在抓取日期设置的前面
    shopBean.setFetchOptType(fetchOptType);
    // 1.抓取日期类型设置 目前我们的api都同时会抓取创建日期以及更新时期的记录,所以这个没有必要
    // 2.根据抓取数据类型设定抓取日期
    for (FetchDataType fetchDataType : shopBean.getFetchDataTypeList()) {
      if (StringUtils.equalsIgnoreCase(
          fetchDataType.getName(), FetchDataType.FETCH_ORDER.getName())) {
        // 设置抓取订单开始时间
        shopBean.setFetchOrderStartDate(startDate);
        // 设置抓取订单结束时间
        shopBean.setFetchOrderEndDate(endDate);
      } else if (StringUtils.equalsIgnoreCase(
          fetchDataType.getName(), FetchDataType.FETCH_REFUND.getName())) {
        // 设置抓取退款单单开始时间
        shopBean.setFetchRefundStartDate(startDate);
        // 设置抓取退款单结束时间
        shopBean.setFetchRefundEndDate(endDate);
      } else if (StringUtils.equalsIgnoreCase(
          fetchDataType.getName(), FetchDataType.FETCH_RETURN.getName())) {
        // 设置抓取退货单开始时间
        shopBean.setFetchReturnStartDate(startDate);
        // 设置抓取退货单结束时间
        shopBean.setFetchReturnEndDate(endDate);
      }
    }

    // 根据店铺平台设置不同的抓取状态
    if (StringUtils.equalsIgnoreCase(
            shopBean.getPlatformType().getName(), PlatformType.TAO_BAO.getName())
        || StringUtils.equalsIgnoreCase(
            shopBean.getPlatformType().getName(), PlatformType.TAO_BAO_2.getName())) {
      // 设置淘宝订单状态
      shopBean.setOrderStatus(getTaoBaoOrderStatus());
      // 退款单:抓取所有状态
      // 退货单:抓取所有状态
    } else if (StringUtils.equalsIgnoreCase(
        shopBean.getPlatformType().getName(), PlatformType.JING_DONG.getName())) {
      // 设置京东订单状态
      shopBean.setOrderStatus(getJingDongOrderStatus());
      // 退款单:抓取所有状态
      // 退货单:抓取所有状态
    }
  }