admin
2019-01-28 127ab9cfe99f1f655219c7511842408c078e9445
增加接口爬订单
9个文件已修改
525 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java 285 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserAuthController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoGoodsBrief.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoOrder.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java
@@ -68,20 +68,6 @@
        if (uid == null || uid.longValue() == 0L)
            errCode = 3;
        if (uid == 911382L) {
            try {
                if ("share".equalsIgnoreCase(source))
                    response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_bonusState.html?code=1");
                else
                    response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_rebateState.html?code=1");
            } catch (IOException e) {
            }
            return;
        }
        // 计入记录
        try {
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
@@ -1,7 +1,9 @@
package com.yeshi.fanli.controller.admin;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -72,10 +74,10 @@
    @Resource
    private ExtractService extractService;
    @Resource
    private ConfigService configService;
    @Resource
    private UserInfoCountService userInfoCountService;
@@ -96,7 +98,7 @@
    @Resource
    private HongBaoService hongBaoService;
    @Resource
    private HongBaoV2CountService hongBaoV2CountService;
@@ -307,6 +309,12 @@
        /* 拒绝提现 操作 */
        try {
            reason = URLDecoder.decode(reason, "UTF-8");
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        try {
            Extract extract = extractService.getExtractById(id);
            long extractTime = extract.getExtractTime();
            extractService.rejectExtract(id, reason, extractTime, admin);// 提现失败
@@ -366,31 +374,30 @@
        // 今日提现成功金额
        BigDecimal todayextractMoney = extractCountService.getTodayTotalSuccessMoney();
        // 当前用户余额总计:所有用户总余额
        BigDecimal amountMoney = userInfoCountService.countAllMoney(null);
        // 可提现金额限制
        String minMoney = configService.get(Constant.EXTRACT_MIN_MONEY);
        if (minMoney == null){
        if (minMoney == null) {
            minMoney = "0";
        }
        // 当前可提现金额总计: 超过最低提现金额---计入统计
        BigDecimal extractApply = userInfoCountService.countAllMoney(Double.parseDouble(minMoney));
        // 累计已提现金额总计:已提现成功的总额/ 次数
        Map<String, Object> resultData = extractCountService.countTotalSuccess();
        JSONObject data = new JSONObject();
        data.put("todayCount", totalcount);
        data.put("todayextractMoney", todayextractMoney);
        data.put("amountMoney", amountMoney); // 所有用户总余额
        data.put("extractApply", extractApply); // 可提现金额总计
        data.put("extractNumber", resultData.get("totalamount")); // 提现成功次数
        data.put("extractMoney", resultData.get("totalmoney")); // 提现成功金额
        out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
    }
@@ -541,7 +548,7 @@
                if (adminUser == null) {
                    record.setAdminUser(new AdminUser());
                }
                int warnLevel = 0;
                Extract extract = record.getExtract();
                if (extract != null) {
@@ -555,7 +562,7 @@
                            }
                        }
                    }
                }
                record.setWarnLevel(warnLevel);
            }
@@ -830,7 +837,7 @@
            if (receiveMoneys == null) {
                receiveMoneys = new BigDecimal(0);
            }
            // 历史提现成功金额
            double successMoneys = extractCountService.countSuccessMoneysByUid(uid);
@@ -1065,7 +1072,7 @@
                    goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                }
            }
            List<Map<String, Object>> listResult = new ArrayList<Map<String, Object>>();
@@ -1450,57 +1457,64 @@
        }
    }
    /**
     * 统计审核次数
     * 统计审核次数
     *
     * @param callback
     * @param state 审核状态:所有-3  通过-1  拒绝- 2
     * @param type 统计类型  1-24小时  2-所有3
     * @param dateType 类型  1日  2月  3年
     * @param year 2018
     * @param startTime 2018-12-01
     * @param endTime   2018-12-01
     * @param state
     *            审核状态:所有-3 通过-1 拒绝- 2
     * @param type
     *            统计类型 1-24小时 2-所有3
     * @param dateType
     *            类型 1日 2月 3年
     * @param year
     *            2018
     * @param startTime
     *            2018-12-01
     * @param endTime
     *            2018-12-01
     * @param out
     */
    @RequestMapping(value = "getAuditTotal")
    public void getAuditTotal(String callback, String stateArray, Integer dateType, String year,
            String startTime, String endTime, PrintWriter out) {
    public void getAuditTotal(String callback, String stateArray, Integer dateType, String year, String startTime,
            String endTime, PrintWriter out) {
        String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
        if (validateMsg != null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
            return;
        }
        if (dateType == 1 && year != null) {
            year = null; // 设置为空
        } else if (dateType == 2) {
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
        } else if (dateType == 3) {
            if (year != null)
                year = null;
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
                year = null;
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
        }
        try {
            Object objectDate = null;
            List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
            Gson gson = new Gson();
            List<Integer> stateList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {}.getType());
            List<Integer> stateList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {
            }.getType());
            JSONArray line_list = new JSONArray();
            for (Integer state: stateList) {
            for (Integer state : stateList) {
                JSONObject innerList = new JSONObject();
                if (state == null || state == 3) {
                    innerList.put("name", "总计");
@@ -1509,215 +1523,224 @@
                } else if (state == 2) {
                    innerList.put("name", "驳回数");
                }
                List<Map<String, Object>> list = extractAuditRecordService.countAuditTotal(state, dateType,
                        year, startTime, endTime);
                List<Map<String, Object>> list = extractAuditRecordService.countAuditTotal(state, dateType, year,
                        startTime, endTime);
                if (dateType != 3) {
                    innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType,dateList, list)));
                    innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
                } else {
                    // 年视图
                    Map<String, Object> map = AdminUtils.yearsDataFactory(list);
                    if (objectDate == null) {
                        objectDate = map.get("date");
                    }
                    innerList.put("data", gson.toJson(map.get("value")));
                }
                line_list.add(innerList);
            }
            JSONObject data = new JSONObject();
            if (objectDate != null) {
                data.put("xAxis_list", gson.toJson(objectDate));
            } else {
                data.put("xAxis_list", gson.toJson(dateList));
            }
            data.put("line_list", line_list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 统计提现申请总额
     *
     * @param callback
     * @param type 统计类型  1-24小时  2-所有
     * @param dateType 类型  1日  2月  3
     * @param year 2018
     * @param startTime 2018-12-01
     * @param endTime   2018-12-01
     * @param type
     *            统计类型 1-24小时 2-所有
     * @param dateType
     *            类型 1日 2月 3
     * @param year
     *            2018
     * @param startTime
     *            2018-12-01
     * @param endTime
     *            2018-12-01
     * @param out
     */
    @RequestMapping(value = "getExtractApplyMoney")
    public void getExtractApplyMoney(String callback, Integer dateType, String year,
            String startTime, String endTime, PrintWriter out) {
    public void getExtractApplyMoney(String callback, Integer dateType, String year, String startTime, String endTime,
            PrintWriter out) {
        String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
        if (validateMsg != null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
            return;
        }
        if (dateType == 1 && year != null) {
            year = null; // 设置为空
        } else if (dateType == 2) {
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
        } else if (dateType == 3) {
            if (year != null)
                year = null;
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
                year = null;
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
        }
        try {
            Object objectDate = null;
            List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
            Gson gson = new Gson();
            JSONArray line_list = new JSONArray();
            JSONObject innerList = new JSONObject();
            innerList.put("name", "总计");
            List<Map<String, Object>> list = extractAuditRecordService.countExtractApplyMoney(null, dateType,
                    year, startTime, endTime);
            List<Map<String, Object>> list = extractAuditRecordService.countExtractApplyMoney(null, dateType, year,
                    startTime, endTime);
            if (dateType != 3) {
                innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
            } else {
                // 年视图
                Map<String, Object> map = AdminUtils.yearsDataFactory(list);
                if (objectDate == null) {
                    objectDate = map.get("date");
                }
                innerList.put("data", gson.toJson(map.get("value")));
            }
            line_list.add(innerList);
            JSONObject data = new JSONObject();
            if (objectDate != null) {
                data.put("xAxis_list", gson.toJson(objectDate));
            } else {
                data.put("xAxis_list", gson.toJson(dateList));
            }
            data.put("line_list", line_list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 统计提现申请总次数
     *
     * @param callback
     * @param state 所有-空值或者不传   待审核-0 通过-1  拒绝- 2
     * @param type 统计类型  1-24小时  2-所有
     * @param dateType 类型  1日  2月  3年
     * @param year 2018
     * @param startTime 2018-12-01
     * @param endTime   2018-12-01
     * @param state
     *            所有-空值或者不传 待审核-0 通过-1 拒绝- 2
     * @param type
     *            统计类型 1-24小时 2-所有
     * @param dateType
     *            类型 1日 2月 3年
     * @param year
     *            2018
     * @param startTime
     *            2018-12-01
     * @param endTime
     *            2018-12-01
     * @param out
     */
    @RequestMapping(value = "getExtractApplyNumber")
    public void getExtractApplyNumber(String callback,Integer state, Integer dateType, String year,
            String startTime, String endTime, PrintWriter out) {
    public void getExtractApplyNumber(String callback, Integer state, Integer dateType, String year, String startTime,
            String endTime, PrintWriter out) {
        String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
        if (validateMsg != null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
            return;
        }
        if (dateType == 1 && year != null) {
            year = null; // 设置为空
        } else if (dateType == 2) {
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
        } else if (dateType == 3) {
            if (year != null)
                year = null;
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
                year = null;
            if (startTime != null)
                startTime = null;
            if (endTime != null)
                endTime = null;
        }
        try {
            Object objectDate = null;
            List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
            Gson gson = new Gson();
            JSONArray line_list = new JSONArray();
            JSONObject innerList = new JSONObject();
            innerList.put("name", "总计");
            List<Map<String, Object>> list = extractAuditRecordService.countExtractApplyNumber(null, dateType,
                    year, startTime, endTime);
            List<Map<String, Object>> list = extractAuditRecordService.countExtractApplyNumber(null, dateType, year,
                    startTime, endTime);
            if (dateType != 3) {
                innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
            } else {
                // 年视图
                Map<String, Object> map = AdminUtils.yearsDataFactory(list);
                if (objectDate == null) {
                    objectDate = map.get("date");
                }
                innerList.put("data", gson.toJson(map.get("value")));
            }
            line_list.add(innerList);
            JSONObject data = new JSONObject();
            if (objectDate != null) {
                data.put("xAxis_list", gson.toJson(objectDate));
            } else {
                data.put("xAxis_list", gson.toJson(dateList));
            }
            data.put("line_list", line_list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsController.java
@@ -99,6 +99,7 @@
            isNative = true;
        }
        data.put("native", isNative);
        try {
            int pidType = PidUser.TYPE_FANLI_ANDROID;
            if (acceptData.getPlatform().equalsIgnoreCase("ios"))
@@ -133,6 +134,8 @@
                tbPid = tbPidService.getTBPid(uid, PidUser.TYPE_FANLI_IOS);
            }
            data.put("native", isNative);
            if (tbPid != null) {
                String siteId = tbPid.getPid().split("_")[2];
                String adzoneId = tbPid.getPid().split("_")[3];
@@ -145,7 +148,6 @@
                out.print(JsonUtil.loadFalseResult(1, "请求失败"));
            }
        }
        data.put("native", isNative);
    }
fanli/src/main/java/com/yeshi/fanli/controller/client/UserAuthController.java
@@ -83,7 +83,7 @@
        }
        String link = TaoBaoUtil.getTaoBaoUnionAuthUrl(Constant.TAOBAO_AUTH_APPKEY,
                "http://test.flqapp.com/fanli/client/v1/auth/callback/tb", uid, source);
                "http://api.flqapp.com/fanli/client/v1/auth/callback/tb", uid, source);
        String orderJS = "var orderId= document.getElementById('tp-bought-root').getElementsByClassName('js-order-container')[0].getElementsByTagName('div')[0].getAttribute('data-id');";
        orderJS += "if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {window.location.href='yestv://taobaoorder#'+orderId;} else {window.handle.showOrder(orderId)}";
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -363,7 +363,7 @@
        List<UserHomeMsgVO> volist = new ArrayList<>();
        List<RecommendUserGoods> list = recommendUserGoodsService.listRecommend(uid, page, Constant.PAGE_SIZE);
        long count = recommendUserGoodsService.countRecommend(uid) + 1;// 计算欢迎语的数量
        long count = recommendUserGoodsService.countRecommend(uid);//
        Date now = new Date();
        for (RecommendUserGoods goods : list) {
@@ -406,14 +406,21 @@
            volist.add(vo);
        }
        Long time = userInfoService.getUserById(uid).getCreatetime();
        if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd"))
            count++;// 计算欢迎语的数量
        if (volist.size() > 0 && volist.size() < Constant.PAGE_SIZE) {
            // 添加欢迎语
            UserHomeMsgVO vo = new UserHomeMsgVO();
            vo.setContent("恭喜你,成为返利券的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让返利券成为你的省钱助手吧!");
            vo.setTitle("新人欢迎");
            vo.setCreateTime(getTimeDesc(now, new Date(userInfoService.getUserById(uid).getCreatetime())));
            vo.setType(UserHomeMsgVO.TYPE_WELCOME);
            volist.add(vo);
            // 创建时间在28号后的才有新人欢迎
            if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd")) {
                UserHomeMsgVO vo = new UserHomeMsgVO();
                vo.setContent("恭喜你,成为返利券的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让返利券成为你的省钱助手吧!");
                vo.setTitle("新人欢迎");
                vo.setCreateTime(getTimeDesc(now, new Date(time)));
                vo.setType(UserHomeMsgVO.TYPE_WELCOME);
                volist.add(vo);
            }
        }
        JSONObject root = new JSONObject();
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoGoodsBrief.java
@@ -268,6 +268,7 @@
    @Column
    private Integer state;// 0-正常 1-商品下架
    
    @Transient
    private Integer materialLibType;//物料库类型
    
    
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoOrder.java
@@ -77,6 +77,26 @@
    private Date latestUpdateTime;// 最近一次的更新时间
    @Column(name = "to_orderby")
    private Integer orderBy;// 排序值
    @Column(name = "to_special_id")
    private String specialId;
    @Column(name = "to_relation_id")
    private String relationId;
    public String getSpecialId() {
        return specialId;
    }
    public void setSpecialId(String specialId) {
        this.specialId = specialId;
    }
    public String getRelationId() {
        return relationId;
    }
    public void setRelationId(String relationId) {
        this.relationId = relationId;
    }
    public Integer getOrderBy() {
        return orderBy;
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java
@@ -490,6 +490,7 @@
        } catch (TaobaoGoodsDownException e) {
            throw new ShareGoodsException(4, "商品已下架");
        } finally {
        }
        if (goods == null) {
            throw new ShareGoodsException(5, "获取商品详情失败");
@@ -523,7 +524,34 @@
            throw new ShareGoodsException(2, "商品ID不能为空");
        }
        return getTaoBaoLink(uid, auctionId, Constant.TAOBAO_SPECIAL_PID_DEFAULT);
        TaoKeAppInfo app = new TaoKeAppInfo();
        app.setAppKey(Constant.TAOBAO_AUTH_APPKEY);
        app.setAppSecret(Constant.TAOBAO_AUTH_APPSECRET);
        app.setPid(Constant.TAOBAO_SPECIAL_PID_DEFAULT);
        TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app);
        if (goods == null) {
            throw new ShareGoodsException(1, "");
        }
        TaoBaoLink taoBaoLink = new TaoBaoLink();
        taoBaoLink.setAuctionId(auctionId);
        taoBaoLink.setClickUrl(goods.getAuctionUrl());
        taoBaoLink.setCouponLink(goods.getCouponLink());
        taoBaoLink.setGoods(goods);
        TaoBaoGoodsBrief taoBaoGoods = null;
        try {
            taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
        } catch (TaobaoGoodsDownException e) {
            throw new ShareGoodsException(2, "商品为空");
        }
        String url = goods.getAuctionUrl();
        if (!StringUtil.isNullOrEmpty(goods.getCouponLink()))
            url = goods.getCouponLink();
        String token = TaoKeApiUtil.getTKToken(taoBaoGoods.getPictUrl(), taoBaoGoods.getTitle(), url);
        taoBaoLink.setTaoToken(token);
        return taoBaoLink;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -14,6 +14,7 @@
import com.yeshi.fanli.entity.taobao.SearchFilter;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoHead;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoProvince;
import com.yeshi.fanli.entity.taobao.TaoBaoSearchNav;
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
@@ -1620,21 +1621,18 @@
        return null;
    }
    public static void getTaoBaoOrder(String appKey, String appSecret) {
    public static void getTaoBaoSpecialOrder(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", "2019-01-27 21:23:00");
        map.put("start_time", startTime);
        map.put("span", "1200");
        map.put("tk_status", "1");
        map.put("order_query_type","create_time");
        map.put("page_no", 1+"");
        map.put("page_size", 100+"");
        map.put("order_query_type", "create_time");
        map.put("order_scene", "3");
        map.put("page_no", 1 + "");
        map.put("page_size", 100 + "");
        TaoKeAppInfo app = new TaoKeAppInfo();
        app.setAppKey(appKey);
@@ -1645,7 +1643,139 @@
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        }
    }
    public static List<TaoBaoOrder> getTaoBaoRelationOrder(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", "2019-01-28 18:39:00");
        map.put("span", "1200");
        map.put("tk_status", "1");
        map.put("order_query_type", "create_time");
        map.put("order_scene", "3");
        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<>();
        JSONObject data = JSONObject.fromObject(response);
        JSONArray array = data.optJSONObject("tbk_order_get_response").optJSONObject("results")
                .optJSONArray("n_tbk_order");
        for (int i = 0; i < array.size(); i++) {
            JSONObject item = array.optJSONObject(i);
            TaoBaoOrder taoBaoOrder = new TaoBaoOrder();
            taoBaoOrder.setAdPositionId(item.optString("adzone_id"));
            taoBaoOrder.setAdPositionName("");
            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("pub_share_pre_fee")))
                taoBaoOrder.setEstimate(new BigDecimal(item.optString("pub_share_pre_fee")));
            taoBaoOrder.setiRatio(new BigDecimal(item.optString("income_rate")).multiply(new BigDecimal(100)));
            taoBaoOrder.setLatestUpdateTime(null);
            taoBaoOrder.setManagerWangWang(null);
            taoBaoOrder.setOrderBy(null);
            taoBaoOrder.setOrderId(item.optString("trade_id"));
            if (item.optInt("tk_status") == 12)
                taoBaoOrder.setOrderState("订单付款");
            else if (item.optInt("tk_status") == 3)
                taoBaoOrder.setOrderState("订单结算");
            else if (item.optInt("tk_status") == 13)
                taoBaoOrder.setOrderState("订单失效");
            else if (item.optInt("tk_status") == 14)
                taoBaoOrder.setOrderState("订单成功");
            taoBaoOrder.setOrderType(item.optString("order_type"));
            if (!StringUtil.isNullOrEmpty(item.optString("pay_price")))
                taoBaoOrder.setPayment(new BigDecimal(item.optString("pay_price")));
            taoBaoOrder.setPrice(new BigDecimal(item.optString("price")));
            if (!StringUtil.isNullOrEmpty(item.optString("alipay_total_price")))
                taoBaoOrder.setSettlement(new BigDecimal(item.optString("alipay_total_price")));
            taoBaoOrder.setSettlementTime(item.optString("earning_time"));
            taoBaoOrder.setShop(item.optString("seller_shop_title"));
            taoBaoOrder.setSourceMediaId(item.optString("site_id"));
            taoBaoOrder.setSourceMediaName(item.optString("site_name"));
            taoBaoOrder.setsRatio(null);
            taoBaoOrder.setSubsidy(null);
            if (!StringUtil.isNullOrEmpty(item.optString("subsidy_rate")))
                taoBaoOrder.setSubsidyRatio(new BigDecimal(item.optString("subsidy_rate")).multiply(new BigDecimal(100)));
            taoBaoOrder.setSubsidyType(item.optString("subsidy_type"));
            taoBaoOrder.setTechnologySupportPercent(null);
            taoBaoOrder.setThirdService(null);
            taoBaoOrder.setTitle(item.optString("item_title"));
            if (!StringUtil.isNullOrEmpty(item.optString("total_commission_fee")))
                taoBaoOrder.setTkMoney(new BigDecimal(item.optString("total_commission_fee")));
            taoBaoOrder.setTkRate(new BigDecimal(item.optString("commission_rate")));
            taoBaoOrder.setTransactionPlatform(item.optString("terminal_type"));
            taoBaoOrder.setRelationId(item.optString("relation_id"));
            taoBaoOrder.setSpecialId(item.optString("special_id"));
            orderList.add(taoBaoOrder);
        }
        return orderList;
    }
    public static void specialConvertItem(Long auctionId, TaoKeAppInfo app) {
        String pid = app.getPid();
        String[] sts = pid.split("_");
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.item.convert");
        map.put("num_iids", auctionId + "");
        map.put("fields", "num_iid,click_url");
        map.put("adzone_id", sts[3]);
        map.put("platform", "2");
        try {
            JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
            System.out.println(json.toString());
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        }
    }
    public static TaoBaoGoodsBrief specialConvertCoupon(Long auctionId, TaoKeAppInfo app) {
        String pid = app.getPid();
        String[] sts = pid.split("_");
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.coupon.convert");
        map.put("item_id", auctionId + "");
        map.put("adzone_id", sts[3]);
        try {
            JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
            JSONObject resultJSON = json.optJSONObject("tbk_coupon_convert_response").optJSONObject("result")
                    .optJSONObject("results");
            String couponLink = resultJSON.optString("coupon_click_url");
            String itemLink = resultJSON.optString("item_url");
            TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
            goods.setAuctionUrl(itemLink);
            goods.setCouponLink(couponLink);
            return goods;
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        }
        return null;
    }
    // AA5ISJ