yujian
2019-12-16 6dfb4599cee5c19f4d1c5cc344a4f84de1c1633c
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeOrderApiUtil.java
@@ -31,7 +31,6 @@
   public static int TK_STATUS_SUCCESS = 14;
   public static int TK_STATUS_INVALID = 13;
   private static TaoBaoPunishOrder parsePunishOrder(JSONObject data) {
      TaoBaoPunishOrder order = new TaoBaoPunishOrder();
      order.setPunishStatus(data.optString("punish_status"));
@@ -209,8 +208,7 @@
      JSONObject data = JSONObject.fromObject(response);
      try {
         JSONObject rootData=data.optJSONObject("tbk_order_details_get_response").optJSONObject("data");
         array =rootData .optJSONObject("results")
               .optJSONArray("publisher_order_dto");
         array = rootData.optJSONObject("results").optJSONArray("publisher_order_dto");
         dto.setHasPre(   rootData.optBoolean("has_pre"));
         dto.setPositionIndex(rootData.optString("position_index"));
         dto.setHasNext(rootData.optBoolean("has_next"));
@@ -260,11 +258,14 @@
                  taoBaoOrder.setPayment(new BigDecimal(item.optString("alipay_total_price")));
               else
                  taoBaoOrder.setPayment(new BigDecimal(0));
               if (StringUtil.isNullOrEmpty(item.optString("item_price")))
                  taoBaoOrder.setPrice(new BigDecimal(0));
               else
               taoBaoOrder.setPrice(new BigDecimal(item.optString("item_price")));
               if (!StringUtil.isNullOrEmpty(item.optString("pay_price")))
                  taoBaoOrder.setSettlement(new BigDecimal(item.optString("pay_price")));
               else
                  taoBaoOrder.setSettlement(new BigDecimal(0));
                  taoBaoOrder.setSettlement(taoBaoOrder.getPayment());
               taoBaoOrder.setSettlementTime(item.optString("tk_earning_time"));
               taoBaoOrder.setShop(item.optString("seller_shop_title"));
               taoBaoOrder.setSourceMediaId(item.optString("site_id"));
@@ -412,6 +413,14 @@
      return getTaoBaoOrderList(startTime, endTime, queryType, 3);
   }
   /**
    * 淘宝渠道订单
    *
    * @param startTime
    * @param endTime
    * @param queryType
    * @return
    */
   public static List<TaoBaoOrder> getTaoBaoRelationOrderList(long startTime, long endTime, int queryType) {
      return getTaoBaoOrderList(startTime, endTime, queryType, 2);
   }
@@ -419,7 +428,6 @@
   public static List<TaoBaoOrder> getTaoBaoCommonOrderList(long startTime, long endTime, int queryType) {
      return getTaoBaoOrderList(startTime, endTime, queryType, 1);
   }
   
   public static List<TaoBaoOrder> getTaoBaoOrderList(long startTime, long endTime, int queryType,int orderScene) {
      List<TaoBaoOrder> orderList = new ArrayList<>();
@@ -438,10 +446,10 @@
               TimeUtil.getGernalTime(end, "yyyy-MM-dd HH:mm:ss"),null, queryType, orderScene);
         if (dto != null)
            orderList.addAll(dto.getOrderList());
         while(dto.isHasNext())
         {
         while (dto.isHasNext()) {
            dto=queryNewOrder(TimeUtil.getGernalTime(start, "yyyy-MM-dd HH:mm:ss"),
                  TimeUtil.getGernalTime(end, "yyyy-MM-dd HH:mm:ss"),dto.getPositionIndex(), queryType, orderScene);
                  TimeUtil.getGernalTime(end, "yyyy-MM-dd HH:mm:ss"), dto.getPositionIndex(), queryType,
                  orderScene);
            if (dto != null)
               orderList.addAll(dto.getOrderList());
         }
@@ -449,8 +457,19 @@
      return orderList;
   }
   
   private static TaoBaoOrderResultDTO queryNewOrder(String startTime, String endTime,String positionIndex, int queryType, int orderScene) {
   /**
    * 淘宝订单查询
    *
    * @param startTime
    * @param endTime
    * @param positionIndex
    * @param queryType
    *            1:按照订单淘客创建时间查询,2:按照订单淘客付款时间查询,3:按照订单淘客结算时间查询
    * @param orderScene
    * @return
    */
   private static TaoBaoOrderResultDTO queryNewOrder(String startTime, String endTime, String positionIndex,
         int queryType, int orderScene) {
      Map<String, String> params = new HashMap<>();
      params.put("query_type", queryType + "");
      params.put("page_size", "100");