From a438c5735834c26c584abfcc7221a06c1ccadcdc Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 29 五月 2019 17:28:50 +0800 Subject: [PATCH] 资金到账明细优化 --- fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java | 148 ++++++++++++++++++++++++------------------------- 1 files changed, 73 insertions(+), 75 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java index b992908..f02503e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java @@ -11,6 +11,7 @@ import com.taobao.api.ApiException; import com.yeshi.fanli.dto.taobao.TaoBaoShopInfoDTO; +import com.yeshi.fanli.dto.taobao.TaoLiJinDTO; import com.yeshi.fanli.entity.taobao.RelateGoods; import com.yeshi.fanli.entity.taobao.SearchFilter; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; @@ -1238,7 +1239,6 @@ return list; } - /** * 搴楅摵鎼滅储 * @@ -1252,7 +1252,7 @@ TaoBaoShopInfoDTO dto = new TaoBaoShopInfoDTO(); if (StringUtil.isNullOrEmpty(key)) return dto; - + PageEntity pageEntity = new PageEntity(); List<TaoBaoShopInfo> list = new ArrayList<>(); Map<String, String> map = new HashMap<>(); @@ -1280,7 +1280,7 @@ list.add(info); } } - + JSONObject optJSONObject = resultDate.optJSONObject("tbk_shop_get_response"); int totalResults = optJSONObject.getInt("total_results"); int totalPage = totalResults % pageSize == 0 ? totalResults / pageSize : totalResults / pageSize + 1; @@ -1289,12 +1289,12 @@ } pageEntity.setPageIndex(page); pageEntity.setPageSize(pageSize); - + dto.setListInfo(list); dto.setPage(pageEntity); return dto; } - + /** * TODO 鎸夎澶囩寽浣犲枩娆� * @@ -1758,50 +1758,45 @@ } } - + public static void taoKeContent() { Map<String, String> map = new HashMap<>(); map.put("method", "taobao.tbk.content.get"); - map.put("adzone_id",TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]); + map.put("adzone_id", TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]); map.put("type", "1"); map.put("count", "100"); - + TaoKeAppInfo app = new TaoKeAppInfo(); app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); try { - JSONObject json = TaoKeBaseUtil.baseRequest(map,app); + JSONObject json = TaoKeBaseUtil.baseRequest(map, app); System.out.println(json); } catch (TaoKeApiException e) { e.printStackTrace(); } } - - - public static void taoKeContentSource(String contentId,String source) { + + public static void taoKeContentSource(String contentId, String source) { Map<String, String> map = new HashMap<>(); map.put("method", "taobao.tbk.dg.optimus.material"); - map.put("adzone_id",TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]); + map.put("adzone_id", TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]); map.put("page_size", "10"); map.put("page_no", "1"); - map.put("content_id",contentId); + map.put("content_id", contentId); map.put("content_source", source); map.put("material_id", "1"); - - + TaoKeAppInfo app = new TaoKeAppInfo(); app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); try { - JSONObject json = TaoKeBaseUtil.baseRequest(map,app); + JSONObject json = TaoKeBaseUtil.baseRequest(map, app); System.out.println(json); } catch (TaoKeApiException e) { e.printStackTrace(); } } - - - // AA5ISJ @@ -1896,112 +1891,115 @@ goods.setPictUrlWhite(item.optString("white_image")); return goods; } - - public static void getShopGoodsList(Long shopId) - { + + public static void getShopGoodsList(Long shopId) { Map<String, String> map = new HashMap<>(); map.put("method", "tmall.omni.pc.iteminfo.getbyshopid"); - map.put("shop_id",shopId+""); + map.put("shop_id", shopId + ""); TaoKeAppInfo app = new TaoKeAppInfo(); app.setAppKey("24838852"); app.setAppSecret("bc8265e2bf8d8115329d652f9d3d4cd8"); try { - JSONObject json = TaoKeBaseUtil.baseRequest(map,app); + JSONObject json = TaoKeBaseUtil.baseRequest(map, app); System.out.println(json); } catch (TaoKeApiException e) { e.printStackTrace(); } } - - public static void getTaoKeContentEffective() - { + + public static void getTaoKeContentEffective() { Map<String, String> map = new HashMap<>(); map.put("method", "taobao.tbk.dg.optimus.material"); map.put("adzone_id", TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID.split("_")[3]); map.put("page_no", "1"); map.put("page_size", "20"); map.put("content_id", "8872035"); - + TaoKeAppInfo app = new TaoKeAppInfo(); - app.setAppKey( TaoBaoConstant.TAOBAO_AUTH_APPKEY); - app.setAppSecret( TaoBaoConstant.TAOBAO_AUTH_APPSECRET); + app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); + app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); try { - JSONObject json = TaoKeBaseUtil.baseRequest(map,app); + JSONObject json = TaoKeBaseUtil.baseRequest(map, app); System.out.println(json); } catch (TaoKeApiException e) { e.printStackTrace(); } - + } - - - public static void getTaoKeContent() - { + + public static void getTaoKeContent() { Map<String, String> map = new HashMap<>(); map.put("method", "taobao.tbk.content.get"); map.put("adzone_id", TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID.split("_")[3]); map.put("type", "1"); - + TaoKeAppInfo app = new TaoKeAppInfo(); - app.setAppKey( TaoBaoConstant.TAOBAO_AUTH_APPKEY); - app.setAppSecret( TaoBaoConstant.TAOBAO_AUTH_APPSECRET); + app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); + app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); try { - JSONObject json = TaoKeBaseUtil.baseRequest(map,app); + JSONObject json = TaoKeBaseUtil.baseRequest(map, app); System.out.println(json); } catch (TaoKeApiException e) { e.printStackTrace(); } - + } - - //娣樼ぜ閲戝垱寤� - - public static void getLiJin() - { + + // 娣樼ぜ閲戝垱寤� + + public static TaoLiJinDTO createTaoLiJin(Long auctionId, String name, BigDecimal perface, int totalNum, + int useDayLimit, Date sendStartTime, Date sendEndTime, Date useStartTime) { Map<String, String> map = new HashMap<>(); map.put("method", "taobao.tbk.dg.vegas.tlj.create"); map.put("adzone_id", TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT.split("_")[3]); - map.put("item_id", "538982295340"); - map.put("total_num", "1"); - map.put("name", "杩斿埄鍒告柊浜烘窐绀奸噾绾㈠寘"); + map.put("item_id", auctionId + ""); + map.put("total_num", totalNum + ""); + map.put("name", name); map.put("user_total_win_num_limit", "1"); map.put("security_switch", "false"); - map.put("per_face", "1.00"); - map.put("send_start_time", "2019-05-27 00:00:00"); - map.put("send_end_time", "2019-06-01 00:00:00"); - map.put("use_end_time", "1"); + map.put("per_face", perface.toString()); + map.put("send_start_time", TimeUtil.getGernalTime(sendStartTime.getTime(), "yyyy-MM-dd HH:mm:ss")); + map.put("send_end_time", TimeUtil.getGernalTime(sendEndTime.getTime(), "yyyy-MM-dd HH:mm:ss")); + map.put("use_end_time", useDayLimit + ""); map.put("use_end_time_mode", "1"); - map.put("use_start_time", "2019-05-27 00:00:00"); - + map.put("use_start_time", TimeUtil.getGernalTime(useStartTime.getTime(), "yyyy-MM-dd HH:mm:ss")); + TaoKeAppInfo app = new TaoKeAppInfo(); - app.setAppKey( TaoBaoConstant.TAOBAO_AUTH_APPKEY); - app.setAppSecret( TaoBaoConstant.TAOBAO_AUTH_APPSECRET); + app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); + app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); try { - JSONObject json = TaoKeBaseUtil.baseRequest(map,app); + JSONObject json = TaoKeBaseUtil.baseRequest(map, app); System.out.println(json); + JSONObject root = json.optJSONObject("tbk_dg_vegas_tlj_create_response"); + if (root != null && root.optJSONObject("result") != null) { + if (root.optJSONObject("result").optBoolean("success")) { + JSONObject modelJson = root.optJSONObject("result").optJSONObject("model"); + TaoLiJinDTO dto = new TaoLiJinDTO(); + dto.setRightsId(modelJson.optString("rights_id")); + dto.setSendUrl(modelJson.optString("send_url")); + return dto; + } + } } catch (TaoKeApiException e) { e.printStackTrace(); } + + return null; } - - //lCj1Alo8b9L4Ed6yJLq6iqJ7%2BkHL3AEW - - - public static void getLiJinXG() - { + + // lCj1Alo8b9L4Ed6yJLq6iqJ7%2BkHL3AEW + + public static void getTaoLiJinEffective() { Map<String, String> map = new HashMap<>(); map.put("method", "taobao.tbk.dg.vegas.tlj.instance.report"); - map.put("rights_id", "ZrIIvF%2Fnd7SlL5Bg59eTK6J7%2BkHL3AEW"); - + map.put("rights_id", "ZrIIvF/nd7SlL5Bg59eTK6J7+kHL3AEW"); + TaoKeAppInfo app = new TaoKeAppInfo(); - app.setAppKey( TaoBaoConstant.TAOBAO_AUTH_APPKEY); - app.setAppSecret( TaoBaoConstant.TAOBAO_AUTH_APPSECRET); - try { - JSONObject json = TaoKeBaseUtil.baseRequest(map,app); - System.out.println(json); - } catch (TaoKeApiException e) { - e.printStackTrace(); - } + app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); + app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET); + + String json = TaoKeBaseUtil.baseRequestForThreeTimes(map, app); + System.out.println(json); } } -- Gitblit v1.8.0