admin
2019-07-30 573c491b4a1ba60e12a5678a01c1546c0077c1ee
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeOrderApiUtil.java
@@ -204,13 +204,14 @@
      for (int i = 0; i < count; i++) {
         int totalSpanOrderCount = 0;
         List<TaoBaoPunishOrder> spanOrderList = new ArrayList<>();
         long startT = startTime + i * span*1000;
         long startT = startTime + i * span * 1000;
         data.put("start_time", TimeUtil.getGernalTime(startT, "yyyy-MM-dd HH:mm:ss"));
         data.put("span", 1800 + "");
         map.put("af_order_option", data.toString());
         try {
            JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
            JSONObject dataJson = json.optJSONObject("tbk_dg_punish_order_get_response").optJSONObject("result").optJSONObject("data");
            JSONObject dataJson = json.optJSONObject("tbk_dg_punish_order_get_response").optJSONObject("result")
                  .optJSONObject("data");
            JSONArray array = dataJson.optJSONObject("results").optJSONArray("result");
            if (array != null)
               for (int n = 0; n < array.size(); n++) {
@@ -638,7 +639,7 @@
      map.put("method", "taobao.tbk.relation.refund");
      JSONObject option = new JSONObject();
      option.put("search_type", 1);
      option.put("search_type", 2);
      option.put("refund_type", third ? 2 : 1);
      option.put("start_time", TimeUtil.getGernalTime(startTime.getTime(), "yyyy-MM-dd HH:mm:ss"));
      option.put("page_no", page);
@@ -659,49 +660,50 @@
         int count = results.optInt("total_count");
         finalResult.totalCount = count;
         JSONArray array = results.optJSONArray("result");
         for (int i = 0; i < array.size(); i++) {
            JSONObject item = array.optJSONObject(i);
            TaoBaoWeiQuanOrder order = new TaoBaoWeiQuanOrder();
            order.setGoodsName(item.optString("tb_auction_title"));
            BigDecimal fanMoney = new BigDecimal(0);
            if (!StringUtil.isNullOrEmpty(item.optString("tk_subsidy_fee_refund3rd_pub"))) {
               fanMoney.add(new BigDecimal(item.optString("tk_subsidy_fee_refund3rd_pub")));
            }
            if (!StringUtil.isNullOrEmpty(item.optString("tk_commission_fee_refund3rd_pub"))) {
               fanMoney.add(new BigDecimal(item.optString("tk_commission_fee_refund3rd_pub")));
            }
            if (!StringUtil.isNullOrEmpty(item.optString("tk_subsidy_fee_refund_pub"))) {
               fanMoney.add(new BigDecimal(item.optString("tk_subsidy_fee_refund_pub")));
            }
            if (!StringUtil.isNullOrEmpty(item.optString("tk_commission_fee_refund_pub"))) {
               fanMoney.add(new BigDecimal(item.optString("tk_commission_fee_refund_pub")));
            }
         if (array != null)
            for (int i = 0; i < array.size(); i++) {
               JSONObject item = array.optJSONObject(i);
               TaoBaoWeiQuanOrder order = new TaoBaoWeiQuanOrder();
               order.setGoodsName(item.optString("tb_auction_title"));
               BigDecimal fanMoney = new BigDecimal(0);
               if (!StringUtil.isNullOrEmpty(item.optString("tk_subsidy_fee_refund3rd_pub"))) {
                  fanMoney=   fanMoney.add(new BigDecimal(item.optString("tk_subsidy_fee_refund3rd_pub")));
               }
               if (!StringUtil.isNullOrEmpty(item.optString("tk_commission_fee_refund3rd_pub"))) {
                  fanMoney=      fanMoney.add(new BigDecimal(item.optString("tk_commission_fee_refund3rd_pub")));
               }
               if (!StringUtil.isNullOrEmpty(item.optString("tk_subsidy_fee_refund_pub"))) {
                  fanMoney=   fanMoney.add(new BigDecimal(item.optString("tk_subsidy_fee_refund_pub")));
               }
               if (!StringUtil.isNullOrEmpty(item.optString("tk_commission_fee_refund_pub"))) {
                  fanMoney=   fanMoney.add(new BigDecimal(item.optString("tk_commission_fee_refund_pub")));
               }
            if (fanMoney.compareTo(new BigDecimal(0)) == 0)
               fanMoney = null;
               if (fanMoney.compareTo(new BigDecimal(0)) == 0)
                  fanMoney = null;
            order.setFanMoney(fanMoney);
            order.setJieSuanTime(
                  new Date(TimeUtil.convertToTimeTemp(item.optString("earning_time"), "yyyy-MM-dd HH:mm:ss")));
            if (!StringUtil.isNullOrEmpty(item.optString("refund_fee")))
               order.setMoney(new BigDecimal(item.optString("refund_fee")));
            order.setOrderId(item.optString("tb_trade_parent_id"));
            order.setOrderItemId(item.optString("tb_trade_id"));
            int state = item.optInt("refund_status");
            if (state == 4)
               order.setState("维权创建");
            else if (state == 2)
               order.setState("维权成功");
            else if (state == 3)
               order.setState("维权失败");
               order.setFanMoney(fanMoney);
               order.setJieSuanTime(new Date(
                     TimeUtil.convertToTimeTemp(item.optString("earning_time"), "yyyy-MM-dd HH:mm:ss")));
               if (!StringUtil.isNullOrEmpty(item.optString("refund_fee")))
                  order.setMoney(new BigDecimal(item.optString("refund_fee")));
               order.setOrderId(item.optString("tb_trade_parent_id"));
               order.setOrderItemId(item.optString("tb_trade_id"));
               int state = item.optInt("refund_status");
               if (state == 4)
                  order.setState("维权创建");
               else if (state == 2)
                  order.setState("维权成功");
               else if (state == 3)
                  order.setState("维权失败");
            if (!StringUtil.isNullOrEmpty(item.optString("tk_refund_suit_time")))
               order.setWeiQuanFinishTime(new Date(
                     TimeUtil.convertToTimeTemp(item.optString("tk_refund_suit_time"), "yyyy-MM-dd HH:mm:ss")));
            order.setWeiQuanTime(
                  new Date(TimeUtil.convertToTimeTemp(item.optString("tk_refund_time"), "yyyy-MM-dd HH:mm:ss")));
            list.add(order);
         }
               if (!StringUtil.isNullOrEmpty(item.optString("tk_refund_suit_time")))
                  order.setWeiQuanFinishTime(new Date(TimeUtil
                        .convertToTimeTemp(item.optString("tk_refund_suit_time"), "yyyy-MM-dd HH:mm:ss")));
               order.setWeiQuanTime(new Date(
                     TimeUtil.convertToTimeTemp(item.optString("tk_refund_time"), "yyyy-MM-dd HH:mm:ss")));
               list.add(order);
            }
      } catch (Exception e) {
         e.printStackTrace();