| | |
| | | |
| | | if (!islink) { |
| | | /* 淘宝物料搜索 */ |
| | | result = TaoKeApiUtil.searchWuLiao(filter,null,null); |
| | | result = TaoKeApiUtil.searchWuLiaoNew(filter,null,null); |
| | | } else { |
| | | /* 商品链接搜索 */ |
| | | TaoBaoGoodsBrief searchGoodsDetail = TaoKeApiUtil.searchGoodsDetail(auctionId); |
| | |
| | | searchfilter.setMaterialId("6707"); |
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter, |
| | | totalSales); |
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(searchfilter,null,null); |
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiaoNew(searchfilter,null,null); |
| | | long count = searchResult.getPageEntity().getTotalCount(); |
| | | |
| | | JSONObject result = new JSONObject(); |
| | |
| | | searchfilter.setPage((int) (count % 20 == 0 ? count / 20 - 1 : count / 20)); |
| | | searchfilter.setPageSize(20); |
| | | searchfilter.setKey(goodsSubClass.getKey()); |
| | | TaoBaoSearchResult searchResult2 = TaoKeApiUtil.searchWuLiao(searchfilter,null,null); |
| | | TaoBaoSearchResult searchResult2 = TaoKeApiUtil.searchWuLiaoNew(searchfilter,null,null); |
| | | if (searchResult2 != null) { |
| | | List<TaoBaoGoodsBrief> resultListTemp = searchResult2.getTaoBaoGoodsBriefs(); |
| | | if (resultListTemp != null) |
| | |
| | | sf.setQuan(1); |
| | | sf.setKey(goodsClassService.getKeysById(id)); |
| | | |
| | | result = TaoKeApiUtil.searchWuLiao(sf,null,null); |
| | | result = TaoKeApiUtil.searchWuLiaoNew(sf,null,null); |
| | | |
| | | } |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "useFreeCoupon", method = RequestMethod.POST) |
| | | public void useFreeCoupon(AcceptData acceptData, Long uid, Long cid, Long goodId, Integer goodsType, PrintWriter out) { |
| | | public void useFreeCoupon(AcceptData acceptData, Long uid, Long cid, String goodId, Integer goodsType, PrintWriter out) { |
| | | if (uid == null) { |
| | | out.print(JsonUtil.loadFalseResult("用户未登录")); |
| | | return; |
| | |
| | | searchfilter.setMaterialId("6707"); |
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter, |
| | | totalSales); |
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(searchfilter, null, null); |
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiaoNew(searchfilter, null, null); |
| | | long count = searchResult.getPageEntity().getTotalCount(); |
| | | |
| | | List<TaoBaoGoodsBrief> resultGoodsList = searchResult.getTaoBaoGoodsBriefs(); |
| | |
| | | searchfilter.setPage((int) (count % 20 == 0 ? count / 20 - 1 : count / 20)); |
| | | searchfilter.setPageSize(20); |
| | | searchfilter.setKey(goodsSubClass.getKey()); |
| | | TaoBaoSearchResult searchResult2 = TaoKeApiUtil.searchWuLiao(searchfilter, null, null); |
| | | TaoBaoSearchResult searchResult2 = TaoKeApiUtil.searchWuLiaoNew(searchfilter, null, null); |
| | | if (searchResult2 != null) { |
| | | List<TaoBaoGoodsBrief> resultListTemp = searchResult2.getTaoBaoGoodsBriefs(); |
| | | if (resultListTemp != null) |
| | |
| | | List<GoodsDetailVO> goodsList = new ArrayList<>(); |
| | | TaoBaoSearchResult result = taoBaoGoodsCacheUtil.getSearchResult(sf); |
| | | if (result == null) { |
| | | result = TaoKeApiUtil.searchWuLiao(sf, null, null); |
| | | result = TaoKeApiUtil.searchWuLiaoNew(sf, null, null); |
| | | taoBaoGoodsCacheUtil.saveSearchResult(sf, result); |
| | | } |
| | | if (result != null) { |
| | |
| | | |
| | | // 商品id |
| | | @Column(name = "ucr_good_id") |
| | | private Long goodId; |
| | | private String goodId; |
| | | |
| | | // 商品来源 |
| | | @Column(name = "ucr_good_source") |
| | |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getGoodId() { |
| | | public String getGoodId() { |
| | | return goodId; |
| | | } |
| | | |
| | | public void setGoodId(Long goodId) { |
| | | public void setGoodId(String goodId) { |
| | | this.goodId = goodId; |
| | | } |
| | | |
| | |
| | | |
| | | for (int page = 1; page <= pageMax; page++) { |
| | | filter.setPage(page); |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(filter,null,null); |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(filter,null,null); |
| | | |
| | | // 结果为空 结束请求 |
| | | if (result == null) { |
| | |
| | | sf.setKey(shop.getShop().getShopName().replace("官方旗舰店", "").replace("旗舰店", "")); |
| | | sf.setPage(1); |
| | | sf.setPageSize(100); |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null); |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf,null,null); |
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) { |
| | |
| | | filter.setPageSize(100); |
| | | filter.setTmall(true); |
| | | filter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW); |
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(filter,null,null); |
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiaoNew(filter,null,null); |
| | | |
| | | // 删除店铺 |
| | | brandShopCaheService.removeByDateAndType(brandInfo.getId(), 11, date); |
| | |
| | | public JSONObject searchWuLiao(SearchFilter sf, SystemEnum system) { |
| | | |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf, null, null); |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf, null, null); |
| | | |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | | if (result.getNavList() != null) |
| | |
| | | public JSONObject searchWuLiaoV2(SearchFilter sf, String platform, String version, SystemEnum system) { |
| | | |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf, null, null); |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf, null, null); |
| | | |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | | if (result.getNavList() != null) |
| | |
| | | @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoList-'+#sf+'-'+system") |
| | | public List<TaoBaoGoodsBrief> searchWuLiaoList(SearchFilter sf, SystemEnum system) { |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf, null, null); |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf, null, null); |
| | | if (result == null) |
| | | return null; |
| | | |
| | |
| | | } |
| | | |
| | | // 淘宝物料接口查询 |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf, null, null); |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf, null, null); |
| | | |
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); |
| | | if (result.getNavList() != null) |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private PushInfoMapper pushInfoMapper; |
| | | |
| | | private Logger logger = LoggerFactory.getLogger("debugLog"); |
| | | |
| | | @Override |
| | | public void save(PushInfo record) throws PushInfoException, Exception { |
| | |
| | | msg = e.getMsg(); |
| | | } catch (Exception e) { |
| | | msg = "系统推送失败"; |
| | | logger.error("系统推送失败",e); |
| | | } |
| | | record.setState(state); |
| | | record.setPushTime(new Date()); |
| | |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null); |
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiaoNew(sf,null,null); |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null && result.getTaoBaoGoodsBriefs().size() > 0) { |
| | | try { |
| | | redisManager.cacheCommonString(key, new Gson().toJson(result.getTaoBaoGoodsBriefs()), 60 * 60);// 缓存1小时 |
| | |
| | | * @throws UserSystemCouponException |
| | | * @throws Exception |
| | | */ |
| | | public void useGoodsCoupon(Long uid, Long id, Long goodId, Integer sourceType) throws UserSystemCouponException, Exception; |
| | | public void useGoodsCoupon(Long uid, Long id, String goodId, Integer sourceType) throws UserSystemCouponException, Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | } else { |
| | | SearchFilter sf=new SearchFilter(); |
| | | sf.setKey("https://item.taobao.com/item.htm?id="+simpleGoods.getGoodsId()); |
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(sf,null,null); |
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiaoNew(sf,null,null); |
| | | if(searchResult!=null&&searchResult.getTaoBaoGoodsBriefs()!=null&&searchResult.getTaoBaoGoodsBriefs().size()>0){ |
| | | TaoBaoGoodsBrief tempGoods = searchResult.getTaoBaoGoodsBriefs().get(0); |
| | | commonGoods = new CommonGoods(); |
| | |
| | | } |
| | | |
| | | // 领券短连接 |
| | | if (StringUtil.isNullOrEmpty(jdId) && link.contains("u.jd.com")) { |
| | | if (StringUtil.isNullOrEmpty(jdId) && (link.contains("u.jd.com")||link.contains("//3.cn/"))) { |
| | | jdId = jdGoodsLinkParseManager.parseGoodsIdByJDShortUrl(link); |
| | | } |
| | | |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | //String originText, String platform, String version |
| | | Set<ClipboardContentType> sets = parseContentType("【淘宝】https://m.tb.cn/h.5bfPu3j?tk=r6fUdGRXH5y CZ0001 「宜恩斯指纹锁家用入户防盗门电子密码锁人脸识别可视智能门锁智选」\n" + |
| | | "点击链接直接打开 或者 淘宝搜索直接打开", "android", "100"); |
| | | System.out.println(sets); |
| | | |
| | | new ClipboardAnalysisManager(). parseJDSkuIdFromLink("https://3.cn/1-U6tjhC"); |
| | | |
| | | } |
| | | } |
| | |
| | | return dto; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args){ |
| | | |
| | | String newText = "【天猫】双11-预售玩法会场!做任务,赢最高16元红包!\n" + |
| | | "復製本条{淘宝活动:20150318020016625},进入【Ta0宝】立即抢购!"; |
| | | // 解析淘宝官方活动ID |
| | | List<String> list = new ConvertLinkManager(). getTaoBaoOfficialActivityId(newText); |
| | | if (list.size() > 0) { |
| | | String relationId = null; |
| | | for (String st : list) { |
| | | String activityid = st.replace("{淘宝活动:", "").replace("}", ""); |
| | | if (!StringUtil.isNullOrEmpty(activityid)) { |
| | | String adzoneId = "mm_124933865_56750082_89555600043".split("_")[3]; |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert(adzoneId, |
| | | activityid, relationId); |
| | | String link = dto.getShort_click_url(); |
| | | if (StringUtil.isNullOrEmpty(link)) { |
| | | link = dto.getClick_url(); |
| | | } |
| | | |
| | | String token = TaoKeApiUtil.getTKToken("http://", "淘宝官方活动", link, true); |
| | | newText = newText.replace(st, TaoBaoUtil.filterTaoToken(token)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | File dir = new File("F:/verifies"); |
| | | int w = 200, h = 80; |
| | | for (int i = 0; i < 50; i++) { |
| | | String verifyCode = generateVerifyCode(4); |
| | | File file = new File(dir, verifyCode + ".jpg"); |
| | | outputImage(w, h, file, verifyCode); |
| | | } |
| | | } |
| | | for(int i=0;i<100;i++) { |
| | | File f = new File("F:/verifies/"+i+".png"); |
| | | outputImage(300, 150, f, "long"); |
| | | } } |
| | | } |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | vo.setJumpLink(link.getZlink()); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | //转链类型:1、抖⾳ deep link;2、抖 |
| | | //⾳⼆维码;3、抖⾳⼝令。 |
| | | //默认返回抖⾳deeplink |
| | | data.put("share_type", "[1,2,3]"); |
| | | data.put("share_type", "[1,3,4]"); |
| | | String result = baseRequest("/product/link", data); |
| | | System.out.println(result); |
| | | JSONObject resultJson = JSONObject.fromObject(result); |
| | |
| | | DYConvertResult bean = new DYConvertResult(); |
| | | bean.setDeeplink(dataJson.optString("dy_deeplink")); |
| | | bean.setPassword(dataJson.optString("dy_password")); |
| | | bean.setZlink(dataJson.optString("dy_zlink")); |
| | | |
| | | if (dataJson.optJSONObject("dy_qr_code") != null) { |
| | | bean.setQrCode(dataJson.optJSONObject("dy_qr_code").optString("url")); |
| | |
| | | } |
| | | |
| | | |
| | | public static JSONObject parseCommand(String command) { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("command", command); |
| | | String result = baseRequest("/command_parse", data); |
| | | System.out.println(result); |
| | | JSONObject resultJson = JSONObject.fromObject(result); |
| | | if (resultJson.optInt("code") != 0) { |
| | | return null; |
| | | } |
| | | JSONObject dataJson = resultJson.optJSONObject("data"); |
| | | return dataJson; |
| | | } |
| | | |
| | | public static String parseProductId(String command) { |
| | | JSONObject result = parseCommand(command); |
| | | if (result != null) { |
| | | if (result.optInt("command_type") == 1) { |
| | | return result.optJSONObject("product_info").optString("product_id"); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong("3629012100619309031")); |
| | | DYConvertResult link = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createFanLiExtraInfo(437032L), |
| | | ""); |
| | | System.out.println(link); |
| | | String id = parseProductId("https://v.douyin.com/iLQybbqP/"); |
| | | System.out.printf(id); |
| | | } |
| | | |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | HttpClient client = new HttpClient(); |
| | | client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); |
| | | PostMethod pm = new PostMethod(url); |
| | | try { |
| | | client.executeMethod(pm); |
| | | Header header = pm.getResponseHeader("location"); |
| | | if (header == null) { |
| | | return null; |
| | | } |
| | | if (header.getValue() == null) { |
| | | return null; |
| | | } |
| | | if (!header.getValue().contains("detail/index.html")) { |
| | | return null; |
| | | } |
| | | String value = URLDecoder.decode(header.getValue(), "UTF-8"); |
| | | |
| | | String[] results = value.split("&"); |
| | | for (String r : results) { |
| | | if (!r.contains("product_id=")) { |
| | | continue; |
| | | } |
| | | return r.split("=")[1].trim(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | String id = CSJCPSApiUtil.parseProductId(url); |
| | | return id; |
| | | // |
| | | // HttpClient client = new HttpClient(); |
| | | // client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); |
| | | // PostMethod pm = new PostMethod(url); |
| | | // try { |
| | | // client.executeMethod(pm); |
| | | // Header header = pm.getResponseHeader("location"); |
| | | // if (header == null) { |
| | | // return null; |
| | | // } |
| | | // if (header.getValue() == null) { |
| | | // return null; |
| | | // } |
| | | // if (!header.getValue().contains("detail/index.html")) { |
| | | // return null; |
| | | // } |
| | | // String value = URLDecoder.decode(header.getValue(), "UTF-8"); |
| | | // value = value.split("\\?")[1]; |
| | | // String[] results = value.split("&"); |
| | | // for (String r : results) { |
| | | // String key = r.split("=")[0].trim(); |
| | | // String val = r.split("=")[1]; |
| | | // if (!key.equalsIgnoreCase("product_id") && !key.equalsIgnoreCase("id")) { |
| | | // continue; |
| | | // } |
| | | // return val.trim(); |
| | | // } |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // |
| | | // return null; |
| | | } |
| | | |
| | | public static BigDecimal getPrice(int money) { |
| | |
| | | * @date 2022/9/26 16:56 |
| | | */ |
| | | public class DYConvertResult { |
| | | |
| | | private String password; |
| | | private String qrCode; |
| | | private String deeplink; |
| | | private String zlink; |
| | | |
| | | public String getPassword() { |
| | | return password; |
| | |
| | | public void setDeeplink(String deeplink) { |
| | | this.deeplink = deeplink; |
| | | } |
| | | |
| | | |
| | | public String getZlink() { |
| | | return zlink; |
| | | } |
| | | |
| | | public void setZlink(String zlink) { |
| | | this.zlink = zlink; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 搜索网页 |
| | | * |
| | | * @param searchFilter |
| | | * @param skuId |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | |
| | | /** |
| | | * 计算商品券后价,没有券则返回原价 |
| | | * |
| | | * @param goodsBrief |
| | | * @param jdGoods |
| | | * @return |
| | | */ |
| | | public static BigDecimal getCouponPrice(JDGoods jdGoods) { |
| | |
| | | |
| | | public static boolean isJDLink(String url) { |
| | | return url.startsWith("https://item.m.jd.com/product/") || url.startsWith("http://item.m.jd.com/product/") |
| | | || url.startsWith("https://item.jd.com/") || url.startsWith("http://item.jd.com/")||url.startsWith("https://u.jd.com/"); |
| | | || url.startsWith("https://item.jd.com/") || url.startsWith("http://item.jd.com/")||url.startsWith("https://u.jd.com/")||url.startsWith("https://3.cn/"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public static String getJDGoodsIdByUJD(String url) { |
| | | if(url.startsWith("https://3.cn/")){ |
| | | try { |
| | | Document doc = Jsoup.connect(url).get(); |
| | | String location = doc.location(); |
| | | if (location.startsWith("https://cfe.m.jd.com/privatedomain/")) { |
| | | Map<String, String> params = HttpUtil.getPramsFromUrl(location); |
| | | String returnurl = params.get("returnurl"); |
| | | returnurl = URLDecoder.decode(returnurl, "UTF-8"); |
| | | return parseJDSkuIdByUrl(returnurl); |
| | | } else { |
| | | return parseJDSkuIdByUrl(location); |
| | | } |
| | | }catch(Exception e){ |
| | | |
| | | } |
| | | } |
| | | |
| | | try { |
| | | String body = HttpUtil.get(url); |
| | | Document doc = Jsoup.parse(body); |
| | |
| | | /** |
| | | * 查询天猫商品图片、标题 |
| | | * |
| | | * @param auctionId |
| | | * @param goodsId |
| | | * @return |
| | | */ |
| | | public static JDGoods getSimpleGoodsInfo(String goodsId) { |
| | |
| | | return urlList; |
| | | } |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | System.out.printf(getJDGoodsIdByUJD("https://3.cn/1-U6tjhC")); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public static void executePushIOS(List<String> tokenList, JSONObject json, String pwd) throws Exception { |
| | | InputStream certificate = IOSPushUtil.class.getClassLoader() |
| | | .getResourceAsStream("certificate/pushCertificate.p12"); // 读取.p12文件 |
| | | .getResourceAsStream("certificate/push_certification_2025216.p12"); // 读取.p12文件 |
| | | String certificatePassword = pwd; |
| | | pushIOS(tokenList, json, certificate, certificatePassword); |
| | | } |
| | |
| | | for (String c : filter.getCateIds().split(",")) |
| | | cateList.add(Long.parseLong(c)); |
| | | } |
| | | return TaoKeApiUtil.searchWuLiao(filter, specialId, relationId); |
| | | return TaoKeApiUtil.searchWuLiaoNew(filter, specialId, relationId); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | if (1 > 0) |
| | | return TaoKeApiUtil.searchWuLiao(filter, null, null); |
| | | return TaoKeApiUtil.searchWuLiaoNew(filter, null, null); |
| | | |
| | | Map<String, String> params = new HashMap<String, String>(); |
| | | String key = filter.getKey(); |
| | |
| | | } |
| | | |
| | | private static TaoBaoGoodsBrief loadYuShouInfo(TaoBaoGoodsBrief goods, JSONObject item) { |
| | | |
| | | if (goods != null && item != null) { |
| | | // 预售相关解析 |
| | | goods.setYsylClickUrl(item.optString("ysyl_click_url")); |
| | | if (!StringUtil.isNullOrEmpty(item.optString("ysyl_commission_rate"))) |
| | | goods.setYsylCommissionRate(new BigDecimal(item.optString("ysyl_commission_rate"))); |
| | | goods.setYsylTljFace(item.optString("ysyl_tlj_face")); |
| | | goods.setYsylTljSendTime(item.optString("ysyl_tlj_send_time")); |
| | | goods.setYsylTljUseEndTime(item.optString("ysyl_tlj_use_end_time")); |
| | | goods.setYsylTljUseStartTime(item.optString("ysyl_tlj_use_start_time")); |
| | | JSONObject preSaleInfo = item.optJSONObject("presale_info"); |
| | | if (preSaleInfo != null) { |
| | | // 预售相关解析 |
| | | goods.setYsylClickUrl(item.optString("ysyl_click_url")); |
| | | if (!StringUtil.isNullOrEmpty(item.optString("ysyl_commission_rate"))) |
| | | goods.setYsylCommissionRate(new BigDecimal(item.optString("ysyl_commission_rate"))); |
| | | goods.setYsylTljFace(item.optString("ysyl_tlj_face")); |
| | | goods.setYsylTljSendTime(item.optString("ysyl_tlj_send_time")); |
| | | goods.setYsylTljUseEndTime(item.optString("ysyl_tlj_use_end_time")); |
| | | goods.setYsylTljUseStartTime(item.optString("ysyl_tlj_use_start_time")); |
| | | |
| | | goods.setPresaleDeposit(item.optString("presale_deposit")); |
| | | goods.setPresaleDiscountFeeText(item.optString("presale_discount_fee_text")); |
| | | goods.setPresaleEndTime(item.optString("presale_end_time")); |
| | | goods.setPresaleStartTime(item.optString("presale_start_time")); |
| | | goods.setPresaleTailEndTime(item.optString("presale_tail_end_time")); |
| | | goods.setPresaleTailStartTime(item.optString("presale_tail_start_time")); |
| | | |
| | | return goods; |
| | | goods.setPresaleDeposit(preSaleInfo.optString("presale_deposit")); |
| | | goods.setPresaleDiscountFeeText(preSaleInfo.optString("presale_discount_fee_text")); |
| | | goods.setPresaleEndTime(preSaleInfo.optString("presale_end_time")); |
| | | goods.setPresaleStartTime(preSaleInfo.optString("presale_start_time")); |
| | | goods.setPresaleTailEndTime(preSaleInfo.optString("presale_tail_end_time")); |
| | | goods.setPresaleTailStartTime(preSaleInfo.optString("presale_tail_start_time")); |
| | | return goods; |
| | | } |
| | | } |
| | | return goods; |
| | | } |
| | |
| | | return taoBaoSearchResult; |
| | | } |
| | | |
| | | |
| | | public static TaoBaoSearchResult searchWuLiaoNew(SearchFilter filter, String specialId, String relationId) { |
| | | |
| | | if (filter.getKey() != null && filter.getKey().trim().equalsIgnoreCase("")) |
| | | return null; |
| | | |
| | | PageEntity pageEntity = new PageEntity(); |
| | | TaoBaoSearchResult taoBaoSearchResult = new TaoBaoSearchResult(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tbk.dg.material.optional.upgrade"); |
| | | map.put("page_size", filter.getPageSize() == 0 ? "20" : filter.getPageSize() + ""); |
| | | map.put("page_no", (filter.getPage() <= 0 ? 1 : filter.getPage()) + ""); |
| | | //1-动态ID转链场景,2-消费者比价场景(不填默认为1) |
| | | // map.put("biz_scene_id","2"); |
| | | // map.put("promotion_type","1"); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(specialId) && !StringUtil.isNullOrEmpty(relationId)) { |
| | | map.put("special_id", specialId); |
| | | } else if (!StringUtil.isNullOrEmpty(specialId)) { |
| | | map.put("special_id", specialId); |
| | | } else if (!StringUtil.isNullOrEmpty(relationId)) { |
| | | map.put("relation_id", relationId); |
| | | } |
| | | |
| | | // map.put("material_id", "3756"); |
| | | |
| | | pageEntity.setPageIndex(filter.getPage()); |
| | | pageEntity.setPageSize(filter.getPageSize() == 0 ? 20 : filter.getPageSize()); |
| | | |
| | | // 包含了地区筛选 |
| | | if (filter.getProvinceId() > 0) { |
| | | List<TaoBaoProvince> provinceList = TaoBaoUtil.getTaoBaoProvinceList(); |
| | | |
| | | for (TaoBaoProvince province : provinceList) { |
| | | if (Integer.parseInt(province.getId()) == filter.getProvinceId()) { |
| | | map.put("itemloc", province.getName()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (filter.getMaterialId() != null) |
| | | map.put("material_id", filter.getMaterialId()); |
| | | |
| | | if (filter.getStartPrice() != null) |
| | | map.put("start_price", filter.getStartPrice() + ""); |
| | | |
| | | if (filter.getEndPrice() != null) |
| | | map.put("end_price", filter.getEndPrice() + ""); |
| | | |
| | | if (filter.getStartTkRate() > 0) |
| | | map.put("start_tk_rate", filter.getStartTkRate() + ""); |
| | | |
| | | if (filter.getEndTkRate() > 0) |
| | | map.put("end_tk_rate", filter.getEndTkRate() + ""); |
| | | |
| | | if (filter.getStartKaTkRate() > 0) |
| | | map.put("start_ka_tk_rate", filter.getStartKaTkRate() + ""); |
| | | |
| | | if (filter.getEndKaTkRate() > 0) |
| | | map.put("end_ka_tk_rate", filter.getEndKaTkRate() + ""); |
| | | |
| | | if (filter.isTmall()) |
| | | map.put("is_tmall", filter.isTmall() + ""); |
| | | |
| | | if (filter.isOverseas()) |
| | | map.put("is_overseas", filter.isOverseas() + ""); |
| | | |
| | | if (filter.isBaoYou()) |
| | | map.put("need_free_shipment", filter.isBaoYou() + ""); |
| | | |
| | | if (filter.isNeedPrepay()) |
| | | map.put("need_prepay", filter.isNeedPrepay() + ""); |
| | | |
| | | if (filter.isIncludePayRate30()) |
| | | map.put("include_pay_rate_30", filter.isIncludePayRate30() + ""); |
| | | |
| | | if (filter.isIncludeGoodRate()) |
| | | map.put("include_good_rate", filter.isIncludeGoodRate() + ""); |
| | | |
| | | if (filter.isIncludeRfdRate()) |
| | | map.put("include_rfd_rate", filter.isIncludeRfdRate() + ""); |
| | | |
| | | if (filter.getStartDsr() > 0) |
| | | map.put("start_dsr", filter.getStartDsr() + ""); |
| | | |
| | | if (filter.getNpxLevel() > 0) |
| | | map.put("npx_level", filter.getNpxLevel() + ""); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(filter.getCateIds())) |
| | | map.put("cat", filter.getCateIds()); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(filter.getKey())) |
| | | map.put("q", filter.getKey()); |
| | | |
| | | if (filter.getQuan() > 0) |
| | | map.put("has_coupon", true + ""); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(filter.getIp())) |
| | | map.put("ip", filter.getIp()); |
| | | |
| | | if (filter.getSort() > 0) { |
| | | if (filter.getSort() == TaoBaoUtil.SORT_SALE_HIGH_TO_LOW) { |
| | | map.put("sort", "total_sales_des"); // 销量从高到低 |
| | | } else if (filter.getSort() == TaoBaoUtil.SORT_SALE_LOW_TO_HIGH) { |
| | | map.put("sort", "total_sales_asc"); // 销量从低到高 |
| | | } else if (filter.getSort() == TaoBaoUtil.SORT_PRICE_HIGH_TO_LOW) { |
| | | map.put("sort", "price_des"); // 价格从高到低 |
| | | } else if (filter.getSort() == TaoBaoUtil.SORT_PRICE_LOW_TO_HIGH) { |
| | | map.put("sort", "price_asc"); // 价格从低到高 |
| | | } else if (filter.getSort() == TaoBaoUtil.SORT_TKRATE_HIGH_TO_LOW) { |
| | | map.put("sort", "tk_rate_des"); // 淘客佣金比率高到低 |
| | | } else if (filter.getSort() == TaoBaoUtil.SORT_TKRATE_LOW_TO_HIGH) { |
| | | map.put("sort", "tk_rate_asc"); // 淘客佣金比率低到高 |
| | | } else if (filter.getSort() == TaoBaoUtil.SORT_TOTAL_COMMI_HIGH_TO_LOW) { |
| | | map.put("sort", "tk_total_commi_des"); // 总支出佣金高到低 |
| | | } else if (filter.getSort() == TaoBaoUtil.SORT_TOTAL_COMMI_LOW_TO_HIGH) { |
| | | map.put("sort", "tk_total_commi_asc"); // 总支出佣金低到高 |
| | | } else if (filter.getSort() == TaoBaoUtil.SORT_TOTAL_SALES_HIGH_TO_LOW) { |
| | | map.put("sort", "tk_total_sales_des"); // 累计推广量高到低 |
| | | } else if (filter.getSort() == TaoBaoUtil.SORT_TOTAL_SALES_LOW_TO_HIGH) { |
| | | map.put("sort", "tk_total_sales_asc"); // 累计推广量低到高 |
| | | } |
| | | |
| | | } |
| | | |
| | | String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | System.out.println("resultStr" + resultStr); |
| | | JSONObject data = JSONObject.fromObject(resultStr); |
| | | JSONObject rootData = data.optJSONObject("tbk_dg_material_optional_upgrade_response"); |
| | | if ( rootData!= null |
| | | &&rootData.optJSONObject("result_list") != null) { |
| | | JSONArray array = rootData.optJSONObject("result_list") |
| | | .optJSONArray("map_data"); |
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); |
| | | if (array != null) { |
| | | for (int i = 0; i < array.size(); i++) { |
| | | TaoBaoGoodsBrief goods = parseWuLiaoItemNew(array.optJSONObject(i)); |
| | | if (goods != null) |
| | | goodsList.add(goods); |
| | | } |
| | | } |
| | | taoBaoSearchResult.setTaoBaoGoodsBriefs(goodsList); |
| | | int totalResults = rootData.getInt("total_results"); |
| | | int totalPage = totalResults % pageEntity.getPageSize() == 0 ? totalResults / pageEntity.getPageSize() |
| | | : totalResults / pageEntity.getPageSize() + 1; |
| | | pageEntity.setTotalCount(totalResults); |
| | | pageEntity.setTotalPage(totalPage); |
| | | |
| | | } |
| | | |
| | | List<TaoBaoSearchNav> navList = new ArrayList<>(); |
| | | |
| | | TaoBaoHead taoBaoHead = new TaoBaoHead(); |
| | | taoBaoHead.setDocsfound((int) pageEntity.getTotalCount()); |
| | | taoBaoSearchResult.setTaoBaoHead(taoBaoHead); |
| | | |
| | | taoBaoSearchResult.setPageEntity(pageEntity); |
| | | |
| | | // filter.get |
| | | |
| | | // 设置发货地址 |
| | | TaoBaoSearchNav nav = new TaoBaoSearchNav(); |
| | | nav.setName("发货地选择"); |
| | | nav.setFlag("address"); |
| | | nav.setId(11110); |
| | | nav.setType("fahuodi"); |
| | | |
| | | List<TaoBaoSearchNav> childNavList = new ArrayList<>(); |
| | | List<TaoBaoProvince> provinceList = TaoBaoUtil.getTaoBaoProvinceList(); |
| | | for (TaoBaoProvince province : provinceList) { |
| | | TaoBaoSearchNav childNav = new TaoBaoSearchNav(); |
| | | childNav.setName(province.getName()); |
| | | childNav.setId(Integer.parseInt(province.getId())); |
| | | childNav.setType("fahuodi-child"); |
| | | if (Integer.parseInt(province.getId()) == filter.getProvinceId()) |
| | | childNav.setSelector(1); |
| | | childNavList.add(childNav); |
| | | } |
| | | |
| | | nav.setSubIds(childNavList); |
| | | navList.add(nav); |
| | | |
| | | // 测试 |
| | | taoBaoSearchResult.setNavList(navList); |
| | | |
| | | return taoBaoSearchResult; |
| | | } |
| | | |
| | | /** |
| | | * 商品物料搜索 |
| | | * |
| | |
| | | goods = loadYuShouInfo(goods, item); |
| | | return goods; |
| | | } |
| | | |
| | | public static TaoBaoGoodsBrief parseWuLiaoItemNew(JSONObject item) { |
| | | JSONObject basicInfo = item.optJSONObject("item_basic_info"); |
| | | JSONObject pricePromotionInfo = item.optJSONObject("price_promotion_info"); |
| | | JSONObject publishInfo = item.optJSONObject("publish_info"); |
| | | // 线报内容 |
| | | JSONObject mgcInfo = item.optJSONObject("mgc_info"); |
| | | |
| | | |
| | | |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | | goods.setPictUrl(basicInfo.optString("pict_url")); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(basicInfo.optString("white_image"))) { |
| | | goods.setPictUrlWhite(basicInfo.optString("white_image")); |
| | | } |
| | | |
| | | goods.setAuctionId(item.optString("item_id")); |
| | | goods.setAuctionUrl("https:" + item.optString("url")); |
| | | goods.setBiz30day(basicInfo.optInt("volume")); |
| | | if(pricePromotionInfo.optJSONObject("final_promotion_path_list")!=null&&pricePromotionInfo.optJSONObject("final_promotion_path_list").optJSONArray("final_promotion_path_map_data").size()>0) { |
| | | JSONArray array = pricePromotionInfo.optJSONObject("final_promotion_path_list").optJSONArray("final_promotion_path_map_data"); |
| | | JSONObject couponInfo = array.optJSONObject(0); |
| | | goods.setCouponInfo(couponInfo.optString("promotion_desc").replace(".00", "")); |
| | | List<BigDecimal> quanInfo = TaoBaoCouponUtil.getCouponInfo(goods.getCouponInfo()); |
| | | goods.setCouponAmount(new BigDecimal(couponInfo.optString("promotion_fee"))); |
| | | goods.setCouponEffectiveEndTime(couponInfo.optString("promotion_end_time")); |
| | | goods.setCouponEffectiveStartTime(couponInfo.optString("promotion_start_time")); |
| | | goods.setCouponStartFee(quanInfo.get(0)); |
| | | goods.setCouponLeftCount(100); |
| | | goods.setCouponLink(publishInfo.optString("coupon_share_url")); |
| | | goods.setCouponTotalCount(100); |
| | | goods.setCouponActivityId(couponInfo.optString("promotion_id")); |
| | | }else{ |
| | | goods.setCouponAmount(new BigDecimal(0)); |
| | | } |
| | | |
| | | goods.setDayLeft(-1); |
| | | if (basicInfo.optJSONObject("small_images") != null) { |
| | | JSONArray imgArray = basicInfo.optJSONObject("small_images").optJSONArray("string"); |
| | | if (imgArray != null) { |
| | | List<String> imgList = new ArrayList<>(); |
| | | for (int n = 0; n < imgArray.size(); n++) { |
| | | imgList.add(imgArray.optString(n)); |
| | | } |
| | | goods.setImgList(imgList); |
| | | } |
| | | } |
| | | |
| | | if (publishInfo.optString("commission_type").contains("MKT")) |
| | | goods.setTkMktStatus("1"); |
| | | else |
| | | goods.setTkMktStatus("0"); |
| | | |
| | | if (publishInfo.optString("commission_type").contains("SP")) |
| | | goods.setIncludeDxjh(1); |
| | | |
| | | goods.setSellerId(basicInfo.optLong("seller_id")); |
| | | goods.setShopTitle(basicInfo.optString("shop_title")); |
| | | goods.setTitle(basicInfo.optString("title")); |
| | | goods.setProvcity(basicInfo.optString("provcity")); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(basicInfo.optString("level_one_category_id"))) { |
| | | goods.setRootCatId(basicInfo.optInt("level_one_category_id")); |
| | | } |
| | | goods.setRootCategoryName(basicInfo.optString("level_one_category_name")); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(basicInfo.optString("category_id"))) { |
| | | goods.setLeafCatId(basicInfo.optInt("category_id")); |
| | | } |
| | | goods.setLeafName(basicInfo.optString("category_name")); |
| | | |
| | | goods.setTkRate(new BigDecimal(publishInfo.optString("income_rate"))); |
| | | goods.setTotalNum(1000); |
| | | goods.setUserType(basicInfo.optInt("user_type")); |
| | | goods.setUserTypeName(""); |
| | | goods.setZkPrice(new BigDecimal(pricePromotionInfo.optString("zk_final_price"))); |
| | | |
| | | if (publishInfo.optJSONArray("sp_campaign_list")!=null&&publishInfo.optJSONArray("sp_campaign_list").size()>0) { |
| | | goods.setDxjhInfo(publishInfo.optJSONArray("sp_campaign_list").optJSONObject(0).optString("sp_name")); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo())) {// 无券 |
| | | goods.setTkCommFee(goods.getZkPrice().multiply(goods.getTkRate()).divide(new BigDecimal(100))); |
| | | } else if (goods.getZkPrice().compareTo(goods.getCouponStartFee()) >= 0// 有券 |
| | | && goods.getZkPrice().compareTo(goods.getCouponAmount()) >= 0) { |
| | | BigDecimal finalPrice = goods.getZkPrice().subtract(goods.getCouponAmount()); |
| | | goods.setTkCommFee(finalPrice.multiply(goods.getTkRate()).divide(new BigDecimal(100))); |
| | | } else { |
| | | goods.setTkCommFee(new BigDecimal(0)); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(pricePromotionInfo.optString("reserve_price"))) |
| | | goods.setReservePrice(new BigDecimal(pricePromotionInfo.optString("reserve_price"))); |
| | | goods.setTotalFee(new BigDecimal("0")); |
| | | // 推荐语 |
| | | |
| | | if(mgcInfo!=null) { |
| | | goods.setDescription(mgcInfo.optString("item_description")); |
| | | } |
| | | goods = loadYuShouInfo(goods, item); |
| | | return goods; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取淘口令 |
| | |
| | | // searchWuLiao(sf,null,null); |
| | | // tokenConvert("【淘宝】https://m.tb.cn/h.5YFsc7F?tk=A8wSdGRxsjm CZ0001 「俄罗斯风味迷你提拉米苏蜂蜜奶油千层甜品蛋糕早餐整箱3000克零食」\n" + |
| | | // "点击链接直接打开 或者 淘宝搜索直接打开"); |
| | | |
| | | TaoBaoGoodsBrief goods = getSimpleGoodsInfo("kNWkWZuYt28BaNcG9ycPtJ-aRG5QXwIdOXvv5bNcNq"); |
| | | System.out.println(goods); |
| | | // |
| | | // TaoBaoGoodsBrief goods = getSimpleGoodsInfo("kNWkWZuYt28BaNcG9ycPtJ-aRG5QXwIdOXvv5bNcNq"); |
| | | // System.out.println(goods); |
| | | // System.out.println(goods.getAuctionId()); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("method", "taobao.tbk.item.info.get"); |
| | |
| | | // map.put("num_iids", "708395859317"); |
| | | // String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | // System.out.println(resultStr); |
| | | SearchFilter sf=new SearchFilter(); |
| | | sf.setKey("鞋"); |
| | | sf.setPage(1); |
| | | sf.setPageSize(20); |
| | | TaoBaoSearchResult result = searchWuLiaoNew(sf,null,null); |
| | | System.out.printf(result.toString()); |
| | | } |
| | | |
| | | } |
| | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserSystemCouponRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord"> |
| | | <id column="ucr_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="ucr_good_id" property="goodId" jdbcType="BIGINT"/> |
| | | <result column="ucr_good_id" property="goodId" jdbcType="VARCHAR"/> |
| | | <result column="ucr_good_source" property="goodSource" jdbcType="VARCHAR"/> |
| | | <result column="ucr_coupon_type" property="couponType" jdbcType="VARCHAR"/> |
| | | <result column="ucr_order_no" property="orderNo" jdbcType="VARCHAR"/> |
| | |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_system_coupon_record where ucr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_system_coupon_record where ucr_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_record (ucr_id,ucr_good_id,ucr_good_source,ucr_user_coupon_id,ucr_coupon_type,ucr_order_no,ucr_state,ucr_create_time,ucr_update_time) values (#{id,jdbcType=BIGINT},#{goodId,jdbcType=BIGINT},#{goodSource,jdbcType=VARCHAR},#{userSystemCoupon.id,jdbcType=BIGINT},#{couponType,jdbcType=VARCHAR},#{orderNo,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_record (ucr_id,ucr_good_id,ucr_good_source,ucr_user_coupon_id,ucr_coupon_type,ucr_order_no,ucr_state,ucr_create_time,ucr_update_time) values (#{id,jdbcType=BIGINT},#{goodId,jdbcType=VARCHAR},#{goodSource,jdbcType=VARCHAR},#{userSystemCoupon.id,jdbcType=BIGINT},#{couponType,jdbcType=VARCHAR},#{orderNo,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ucr_id,</if> |
| | |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="goodId != null">#{goodId,jdbcType=BIGINT},</if> |
| | | <if test="goodId != null">#{goodId,jdbcType=VARCHAR},</if> |
| | | <if test="goodSource != null">#{goodSource,jdbcType=VARCHAR},</if> |
| | | <if test="userSystemCoupon != null">#{userSystemCoupon.id,jdbcType=BIGINT},</if> |
| | | <if test="couponType != null">#{couponType,jdbcType=VARCHAR},</if> |
| | |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord">update yeshi_ec_user_system_coupon_record set ucr_good_id = #{goodId,jdbcType=BIGINT},ucr_good_source = #{goodSource,jdbcType=VARCHAR},ucr_user_coupon_id = #{userSystemCoupon.id,jdbcType=BIGINT},ucr_coupon_type = #{couponType,jdbcType=VARCHAR},ucr_order_no = #{orderNo,jdbcType=VARCHAR},ucr_state = #{state,jdbcType=INTEGER},ucr_create_time = #{createTime,jdbcType=TIMESTAMP},ucr_update_time = #{updateTime,jdbcType=TIMESTAMP} where ucr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord">update yeshi_ec_user_system_coupon_record set ucr_good_id = #{goodId,jdbcType=VARCHAR},ucr_good_source = #{goodSource,jdbcType=VARCHAR},ucr_user_coupon_id = #{userSystemCoupon.id,jdbcType=BIGINT},ucr_coupon_type = #{couponType,jdbcType=VARCHAR},ucr_order_no = #{orderNo,jdbcType=VARCHAR},ucr_state = #{state,jdbcType=INTEGER},ucr_create_time = #{createTime,jdbcType=TIMESTAMP},ucr_update_time = #{updateTime,jdbcType=TIMESTAMP} where ucr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord">update yeshi_ec_user_system_coupon_record |
| | | <set> |
| | | <if test="goodId != null">ucr_good_id=#{goodId,jdbcType=BIGINT},</if> |
| | | <if test="goodId != null">ucr_good_id=#{goodId,jdbcType=VARCHAR},</if> |
| | | <if test="goodSource != null">ucr_good_source=#{goodSource,jdbcType=VARCHAR},</if> |
| | | <if test="userSystemCoupon != null">ucr_user_coupon_id=#{userSystemCoupon.id,jdbcType=BIGINT},</if> |
| | | <if test="couponType != null">ucr_coupon_type=#{couponType,jdbcType=VARCHAR},</if> |
| | |
| | | import org.yeshi.utils.entity.ProxyIP; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | import java.net.HttpURLConnection; |
| | | public class HttpUtil { |
| | | |
| | | public static List<String> getUrlListFromText(String text) { |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static String getLocation(String url,Map<String,String> headers, String method) { |
| | | HttpClient client = new HttpClient(); |
| | | if ("GET".equalsIgnoreCase(method)) { |
| | | try { |
| | | URL uri = new URL(url); |
| | | // 打开连接 |
| | | HttpURLConnection connection = (HttpURLConnection) uri.openConnection(); |
| | | // 设置HTTP请求方法为GET |
| | | connection.setRequestMethod("GET"); |
| | | |
| | | // 获取响应码 |
| | | int responseCode = connection.getResponseCode(); |
| | | |
| | | if (responseCode == HttpURLConnection.HTTP_OK) { |
| | | // 获取Location字段 |
| | | String location = connection.getHeaderField("Location"); |
| | | System.out.println("Location: " + location); |
| | | } else { |
| | | System.out.println("Request failed with response code: " + responseCode); |
| | | } |
| | | // 关闭连接 |
| | | connection.disconnect(); |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } else { |
| | | PostMethod md = new PostMethod(url); |
| | | if (headers != null) { |
| | | Iterator<String> keys = headers.keySet().iterator(); |
| | | while (keys.hasNext()) { |
| | | String key = keys.next(); |
| | | md.addRequestHeader(key, headers.get(key)); |
| | | } |
| | | } |
| | | try { |
| | | client.executeMethod(md); |
| | | Header[] responseHeaders = md.getResponseHeaders(); |
| | | return md.getResponseHeader("location").getValue(); |
| | | } catch (HttpException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // } |
| | | return null; |
| | | } |
| | | } |
| | | } |