admin
2019-01-29 a6b1160da8cbb78a664a6dd7496bee648c7c148c
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -1689,6 +1689,40 @@
      return null;
   }
   /**
    * 获取所有的订单(不带渠道信息与会员信息)
    *
    * @param startTime
    * @param appKey
    * @param appSecret
    * @return
    */
   public static List<TaoBaoOrder> getTaoBaoAllOrder(String startTime, String appKey, String appSecret) {
      Map<String, String> map = new HashMap<>();
      map.put("method", "taobao.tbk.order.get");
      map.put("fields",
            "tb_trade_parent_id,tb_trade_id,num_iid,item_title,item_num,price,pay_price,seller_nick,seller_shop_title,commission,commission_rate,unid,create_time,earning_time,tk_status,tk3rd_pub_id,tk3rd_site_id,tk3rd_adzone_id,relation_id,tb_trade_parent_id,tb_trade_id,num_iid,item_title,item_num,price,pay_price,seller_nick,seller_shop_title,commission,commission_rate,unid,create_time,earning_time,tk3rd_pub_id,tk3rd_site_id,tk3rd_adzone_id,special_id,click_time,relation_id,special_id");
      map.put("start_time", startTime);
      map.put("span", "1200");
      map.put("tk_status", "1");
      map.put("order_query_type", "create_time");
      map.put("order_scene", "1");// 所有订单
      map.put("page_no", 1 + "");
      map.put("page_size", 100 + "");
      TaoKeAppInfo app = new TaoKeAppInfo();
      app.setAppKey(appKey);
      app.setAppSecret(appSecret);
      try {
         JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
         return parseTaoBaoOrder(json.toString());
      } catch (TaoKeApiException e) {
         e.printStackTrace();
      }
      return null;
   }
   private static List<TaoBaoOrder> parseTaoBaoOrder(String response) {
      List<TaoBaoOrder> orderList = new ArrayList<>();
@@ -1707,14 +1741,14 @@
         JSONObject item = array.optJSONObject(i);
         TaoBaoOrder taoBaoOrder = new TaoBaoOrder();
         taoBaoOrder.setAdPositionId(item.optString("adzone_id"));
         taoBaoOrder.setAdPositionName("");
         taoBaoOrder.setAdPositionName(item.optString("adzone_name"));
         taoBaoOrder.setAuctionId(item.optLong("num_iid"));
         taoBaoOrder.setClassName(item.optString("auction_category"));
         taoBaoOrder.setClickTime(item.optString("click_time"));
         taoBaoOrder.setCount(item.optInt("item_num"));
         taoBaoOrder.setCreateTime(item.optString("create_time"));
         if (!StringUtil.isNullOrEmpty(item.optString("commission")))
            taoBaoOrder.seteIncome(new BigDecimal(item.optString("commission")));
         if (!StringUtil.isNullOrEmpty(item.optString("total_commission_fee")))
            taoBaoOrder.seteIncome(new BigDecimal(item.optString("total_commission_fee")));
         else
            taoBaoOrder.seteIncome(new BigDecimal(0));