Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | | data.put("baichuan", false);// 不需要采用阿里百川的方式加载webview
|
| | | data.put("goodsDetail", false);// 不需要拦截商品详情
|
| | | }
|
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | JSONObject js = new JSONObject();
|
| | | String jsStr = configService.get("url_extract_id");
|
| | | String md5 = StringUtil.Md5(jsStr);
|
| | | js.put("md5", md5);
|
| | | data.put("js", js);
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getWebJS", method = RequestMethod.POST)
|
| | | public void getWebJS(AcceptData acceptData, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | String urlIdJS = configService.get("url_extract_id");
|
| | | data.put("urlIdJSMD5", StringUtil.Md5(urlIdJS));
|
| | | data.put("urlIdJS", AESUtil.encrypt(urlIdJS, Constant.UIDAESKEY));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取账号绑定中的配置信息
|
| | | *
|
New file |
| | |
| | | package com.yeshi.fanli.controller.client.v2;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Controller("s11Controller3")
|
| | | @RequestMapping("api/v2/s11")
|
| | | public class S11Controller {
|
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | /**
|
| | | * 获取超级红包分享口令
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSuperHongBaoToken")
|
| | | public void getSuperHongBaoToken(AcceptData acceptData, Long uid, String callback, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录")));
|
| | | else
|
| | | out.print(JsonUtil.loadFalseResult(1, "请登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号")));
|
| | | else
|
| | | out.print(JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往\"我的->个人信息\"绑定淘宝账号"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String key = "s11-superhongbao-" + info.getRelationId();
|
| | | String token = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | try {
|
| | | String link = TaoKeApiUtil.officialActivityConvert("19507100253", "1539329391766",
|
| | | info.getRelationId());
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "【天猫双11】上亿红包等你来拆!---板栗快省", link);
|
| | | if (!StringUtil.isNullOrEmpty(token))
|
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试")));
|
| | | else
|
| | | out.print(JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String desc = configService.get("super-hongbao-share-desc");
|
| | | desc = desc.replace("[淘口令]", token);
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(desc)));
|
| | | else
|
| | | out.print(JsonUtil.loadTrueResult(desc));
|
| | | return;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (analysisTaoToken(acceptData, text, out)) {
|
| | | return;
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(TaoBaoUtil.parseSystemTaoToken(text)))
|
| | | return;
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("type", 2);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | if (tb == null)// 淘宝是空值
|
| | | {
|
| | | String jdId = JDUtil.getJDGoodsId(text);
|
| | |
| | | commonGoods.setPicture(tb.getPictUrl());
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(commonGoods.getTitle()) || StringUtil.isNullOrEmpty(commonGoods.getPicture())) {
|
| | | if (StringUtil.isNullOrEmpty(commonGoods.getTitle())
|
| | | || StringUtil.isNullOrEmpty(commonGoods.getPicture())) {
|
| | | out.println(JsonUtil.loadFalseResult("暂未找到该商品,请稍后再试!"));
|
| | | return;
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | |
| | |
|
| | | /**
|
| | | * 解析抖音链接
|
| | | * |
| | | * @param acceptData
|
| | | * @param text
|
| | | * @param out
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 解析淘口令
|
| | | * |
| | | * @param acceptData
|
| | | * @param text
|
| | | * @param out
|
| | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("type", 3);
|
| | | data.put("goods", gson.toJson(GoodsDetailVOFactory.convertTaoBao(goodsBrief, null, fanLiRate, shareRate)));
|
| | | data.put("goods", gson
|
| | | .toJson(GoodsDetailVOFactory.convertTaoBao(goodsBrief, null, fanLiRate, shareRate)));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return true;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | JSONObject taoBaoGoodsJSON = new JSONObject();
|
| | |
| | | * @param endprice
|
| | | * @return
|
| | | */
|
| | | private void searchTaoBaoGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, PrintWriter out) {
|
| | | private void searchTaoBaoGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order,
|
| | | PrintWriter out) {
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setKey(SearchFilterUtil.filterSearchContent(key));
|
| | | sf.setPage(page);
|
| | |
| | | String platform = acceptData.getPlatform();
|
| | | TaoBaoShopVO taoBaoShop = listShop.get(0);
|
| | | if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0(platform, acceptData.getVersion()))
|
| | | || ("android".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0_1(platform, acceptData.getVersion()))) {
|
| | | || ("android".equalsIgnoreCase(platform)
|
| | | && VersionUtil.greaterThan_2_0_1(platform, acceptData.getVersion()))) {
|
| | | BrandInfoVO brandInfoVO = new BrandInfoVO();
|
| | | brandInfoVO.setId(taoBaoShop.getId());
|
| | | brandInfoVO.setName(taoBaoShop.getShopName());
|
| | |
| | | * @param endprice
|
| | | * @return
|
| | | */
|
| | | private void searchJDGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, PrintWriter out) {
|
| | | private void searchJDGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order,
|
| | | PrintWriter out) {
|
| | |
|
| | | JDSearchResult result = null;
|
| | | boolean hasCoupon = false;
|
| | |
| | | * @param endprice
|
| | | * @return
|
| | | */
|
| | | private void searchPDDGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order, PrintWriter out) {
|
| | | private void searchPDDGoods(AcceptData acceptData, String key, Integer page, String filter, Integer order,
|
| | | PrintWriter out) {
|
| | | PDDSearchFilter pddfilter = new PDDSearchFilter();
|
| | | pddfilter.setKw(SearchFilterUtil.filterSearchContent(key));
|
| | | pddfilter.setPage(page);
|
New file |
| | |
| | | package com.yeshi.fanli.controller.h5;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/apph5/v1/s11")
|
| | | public class H5S11Controller {
|
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | /**
|
| | | * 获取超级红包分享口令
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSuperHongBaoToken")
|
| | | public void getSuperHongBaoToken(String sign, Long uid, String callback, PrintWriter out) {
|
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误")));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录")));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号")));
|
| | | return;
|
| | | }
|
| | |
|
| | | String key = "s11-superhongbao-" + info.getRelationId();
|
| | | String token = null;
|
| | | token = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | try {
|
| | | String link = TaoKeApiUtil.officialActivityConvert("19507100253", "1539329391766",
|
| | | info.getRelationId());
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg",
|
| | | "【天猫双11】上亿红包等你来拆!", link);
|
| | | if (!StringUtil.isNullOrEmpty(token))
|
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试")));
|
| | | return;
|
| | | }
|
| | |
|
| | | String desc = configService.get("super-hongbao-share-desc");
|
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token));
|
| | | try {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc))));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误")));
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getYuShouToken")
|
| | | public void getYuShouToken(String sign, Long uid, String callback, PrintWriter out) {
|
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误")));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录")));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号")));
|
| | | return;
|
| | | }
|
| | |
|
| | | String key = "s11-yushou-" + info.getRelationId();
|
| | | String token = null;
|
| | | if (Constant.IS_OUTNET)
|
| | | token = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | try {
|
| | | String link = TaoKeApiUtil.officialActivityConvert("19507100253", "1539329391766",
|
| | | info.getRelationId());
|
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg",
|
| | | "预售商品付定金,得奖金!", link);
|
| | | if (Constant.IS_OUTNET)
|
| | | if (!StringUtil.isNullOrEmpty(token))
|
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试")));
|
| | | return;
|
| | | }
|
| | |
|
| | | String desc = configService.get("super-yushou-share-desc");
|
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token));
|
| | | try {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc))));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误")));
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_taobao_goods")
|
| | | @Document(collection="taoBaoGoodsCache")
|
| | | public class TaoBaoGoodsBrief implements Serializable {
|
| | | public class TaoBaoGoodsBrief extends TaoBaoGoodsYuShouInfo implements Serializable {
|
| | |
|
| | |
|
| | | /**
|
New file |
| | |
| | | package com.yeshi.fanli.entity.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | /**
|
| | | * 淘宝预售信息
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class TaoBaoGoodsYuShouInfo {
|
| | | private String ysylClickUrl;// 预售有礼-推广链接
|
| | | private String ysylTljFace;// 预售有礼-预估淘礼金(元)
|
| | | private String ysylTljSendTime;// 预售有礼-淘礼金发放时间
|
| | | private String ysylTljUseEndTime;// 淘礼金使用结束时间
|
| | | private String ysylTljUseStartTime;// 淘礼金使用开始时间
|
| | | private BigDecimal ysylCommissionRate;// 预售有礼-佣金比例(%)
|
| | |
|
| | | private String presaleDiscountFeeText;// 预售商品-优惠信息
|
| | | private String presaleTailEndTime;// 预售商品-付尾款结束时间(毫秒)
|
| | | private String presaleTailStartTime;// 预售商品-付尾款开始时间(毫秒)
|
| | | private String presaleEndTime;// 预售商品-付定金结束时间(毫秒)
|
| | | private String presaleStartTime;// 预售商品-付定金开始时间(毫秒)
|
| | | private String presaleDeposit;// 预售商品-定金(元)
|
| | |
|
| | | public String getPresaleTailEndTime() {
|
| | | return presaleTailEndTime;
|
| | | }
|
| | |
|
| | | public void setPresaleTailEndTime(String presaleTailEndTime) {
|
| | | this.presaleTailEndTime = presaleTailEndTime;
|
| | | }
|
| | |
|
| | | public String getPresaleTailStartTime() {
|
| | | return presaleTailStartTime;
|
| | | }
|
| | |
|
| | | public void setPresaleTailStartTime(String presaleTailStartTime) {
|
| | | this.presaleTailStartTime = presaleTailStartTime;
|
| | | }
|
| | |
|
| | | public String getPresaleEndTime() {
|
| | | return presaleEndTime;
|
| | | }
|
| | |
|
| | | public void setPresaleEndTime(String presaleEndTime) {
|
| | | this.presaleEndTime = presaleEndTime;
|
| | | }
|
| | |
|
| | | public String getPresaleStartTime() {
|
| | | return presaleStartTime;
|
| | | }
|
| | |
|
| | | public void setPresaleStartTime(String presaleStartTime) {
|
| | | this.presaleStartTime = presaleStartTime;
|
| | | }
|
| | |
|
| | | public String getPresaleDeposit() {
|
| | | return presaleDeposit;
|
| | | }
|
| | |
|
| | | public void setPresaleDeposit(String presaleDeposit) {
|
| | | this.presaleDeposit = presaleDeposit;
|
| | | }
|
| | |
|
| | | public String getYsylClickUrl() {
|
| | | return ysylClickUrl;
|
| | | }
|
| | |
|
| | | public void setYsylClickUrl(String ysylClickUrl) {
|
| | | this.ysylClickUrl = ysylClickUrl;
|
| | | }
|
| | |
|
| | | public String getYsylTljFace() {
|
| | | return ysylTljFace;
|
| | | }
|
| | |
|
| | | public void setYsylTljFace(String ysylTljFace) {
|
| | | this.ysylTljFace = ysylTljFace;
|
| | | }
|
| | |
|
| | | public String getYsylTljSendTime() {
|
| | | return ysylTljSendTime;
|
| | | }
|
| | |
|
| | | public void setYsylTljSendTime(String ysylTljSendTime) {
|
| | | this.ysylTljSendTime = ysylTljSendTime;
|
| | | }
|
| | |
|
| | | public String getYsylTljUseEndTime() {
|
| | | return ysylTljUseEndTime;
|
| | | }
|
| | |
|
| | | public void setYsylTljUseEndTime(String ysylTljUseEndTime) {
|
| | | this.ysylTljUseEndTime = ysylTljUseEndTime;
|
| | | }
|
| | |
|
| | | public String getYsylTljUseStartTime() {
|
| | | return ysylTljUseStartTime;
|
| | | }
|
| | |
|
| | | public void setYsylTljUseStartTime(String ysylTljUseStartTime) {
|
| | | this.ysylTljUseStartTime = ysylTljUseStartTime;
|
| | | }
|
| | |
|
| | | public BigDecimal getYsylCommissionRate() {
|
| | | return ysylCommissionRate;
|
| | | }
|
| | |
|
| | | public void setYsylCommissionRate(BigDecimal ysylCommissionRate) {
|
| | | this.ysylCommissionRate = ysylCommissionRate;
|
| | | }
|
| | |
|
| | | public String getPresaleDiscountFeeText() {
|
| | | return presaleDiscountFeeText;
|
| | | }
|
| | |
|
| | | public void setPresaleDiscountFeeText(String presaleDiscountFeeText) {
|
| | | this.presaleDiscountFeeText = presaleDiscountFeeText;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | |
|
| | | LogHelper.orderInfo("开始爬取京东订单");
|
| | | LogHelper.job("开始爬取京东订单");
|
| | | long now = System.currentTimeMillis();
|
| | |
|
| | | JDOrderResult result = JDApiUtil.getOrderList(1, 200, new Date(now), JDApiUtil.ORDER_TYPE_CREATETIME);
|
| | |
| | | taoBaoLink.setAuctionId(auctionId);
|
| | | taoBaoLink.setClickUrl(goods.getAuctionUrl());
|
| | | taoBaoLink.setCouponLink(goods.getCouponLink());
|
| | | if (!StringUtil.isNullOrEmpty(goods.getYsylClickUrl()))
|
| | | taoBaoLink.setCouponLink(goods.getYsylClickUrl());
|
| | | taoBaoLink.setGoods(goods);
|
| | |
|
| | | return taoBaoLink;
|
| | | }
|
| | |
|
| | |
| | | tbLink.setAuctionId(goods.getAuctionId());
|
| | | tbLink.setClickUrl(goods.getAuctionUrl());
|
| | | tbLink.setCouponLink(goods.getCouponLink());
|
| | | if (!StringUtil.isNullOrEmpty(goods.getYsylClickUrl()))
|
| | | tbLink.setCouponLink(goods.getYsylClickUrl());
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tbLink.getCouponLink())) {// 通过立即推广方式获取淘口令成功
|
| | | String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getCouponLink());
|
| | |
| | | else
|
| | | return false;
|
| | | }
|
| | | |
| | | public static boolean greaterThan_2_0_2(String platform, String versionCode) {
|
| | | if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 51))
|
| | | || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 68)))
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | | }
|
| | |
|
| | |
|
| | | public static boolean smallerThan_1_5_1(String platform, String versionCode) {
|
| | |
| | | /**
|
| | | * 淘宝商品组织
|
| | | *
|
| | | * @param goods 淘宝商品
|
| | | * @param goods
|
| | | * 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertCommonGoods(CommonGoods goods, String pid, BigDecimal fanLiRate,
|
| | |
| | | /**
|
| | | * 淘宝商品组织
|
| | | *
|
| | | * @param goods 淘宝商品
|
| | | * @param goods
|
| | | * 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertTaoBaoGoodsBriefExtra(TaoBaoGoodsBriefExtra goods, BigDecimal fanLiRate,
|
| | |
| | | /**
|
| | | * 淘宝商品组织
|
| | | *
|
| | | * @param goods 淘宝商品
|
| | | * @param goods
|
| | | * 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertTaoBao(TaoBaoGoodsBrief goods, String pid, BigDecimal fanLiRate,
|
| | |
| | |
|
| | | goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getBiz30day()));
|
| | |
|
| | | //白底图可能有错误 https://img.alicdn.com/bao/uploaded/TB1LVqmVZbpK1RjSZFyXXX_qFXa.png
|
| | | // 白底图可能有错误
|
| | | // https://img.alicdn.com/bao/uploaded/TB1LVqmVZbpK1RjSZFyXXX_qFXa.png
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | | goodsInfo.setPicUrl(TbImgUtil.getTBSize320Img(goods.getPictUrlWhite()));
|
| | | } else {
|
| | |
| | | goodsInfo.setShopInfo(shop);
|
| | | }
|
| | |
|
| | | if (TaoBaoUtil.isYUShou(goods)) {// 预售商品
|
| | | goodsInfo = loadYuShouInfo(goodsInfo, goods, pid, fanLiRate, shareRate);
|
| | | }
|
| | |
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | private static GoodsDetailVO loadYuShouInfo(GoodsDetailVO goodsInfo, TaoBaoGoodsBrief goods, String pid,
|
| | | BigDecimal fanLiRate, BigDecimal shareRate) {
|
| | |
|
| | | if (goodsInfo != null && goods != null) {
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | | moneyInfoVO.setMoneyType(1); // 默认显示:返 ¥6.6
|
| | | moneyInfoVO.setFanliMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, fanLiRate));
|
| | | moneyInfoVO.setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, shareRate));
|
| | | goodsInfo.setMoneyInfo(moneyInfoVO);
|
| | | // 设置券后价为定金价格
|
| | | if (goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) {
|
| | | goodsInfo.setCouponPrice(new BigDecimal(goods.getPresaleDeposit()));
|
| | | }
|
| | | goodsInfo.setZkPrice(new BigDecimal(goods.getPresaleDeposit()));
|
| | |
|
| | | // 添加标签
|
| | | if (goodsInfo.getLabels() == null)
|
| | | goodsInfo.setLabels(new ArrayList<>());
|
| | | goodsInfo.getLabels().add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | // 在标题添加优惠信息
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) {
|
| | | goodsInfo.setTitle(String.format("【%s】", goods.getPresaleDiscountFeeText()) + goodsInfo.getTitle());
|
| | | }
|
| | | }
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 淘宝商品组织
|
| | | *
|
| | | * @param goods 淘宝商品
|
| | | * @param goods
|
| | | * 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertJDGoods(JDGoods goods, BigDecimal fanLiRate, BigDecimal shareRate) {
|
| | |
| | | salesCountMidea = salesCountMidea + "万";
|
| | | }
|
| | | goodsInfo.setSalesCount(salesCountMidea);
|
| | |
|
| | |
|
| | | // 资金信息
|
| | | MoneyInfoVO moneyInfoVO = new MoneyInfoVO();
|
| | |
| | | coupon.setEndTime(sdf.format(new Date(couponInfo.getGetEndTime())));
|
| | | }
|
| | |
|
| | | |
| | | goodsInfo.setHasCoupon(true);
|
| | | goodsInfo.setCouponInfo(coupon);
|
| | | }
|
| | |
| | | } else {
|
| | | goodsInfo.setShopType(20); // 京东
|
| | | }
|
| | |
|
| | |
|
| | | JDPingouInfo pinGouInfo = goods.getPinGouInfo();
|
| | | if (pinGouInfo != null) {
|
| | |
| | | /**
|
| | | * 拼多多商品
|
| | | *
|
| | | * @param goods 拼多多商品
|
| | | * @param goods
|
| | | * 拼多多商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @param fanLiRate
|
| | | * 返利比例
|
| | | * @return
|
| | | */
|
| | | public static GoodsDetailVO convertPDDGoods(PDDGoodsDetail goods, BigDecimal fanLiRate, BigDecimal shareRate) {
|
| | |
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TaoBaoHttpUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | // labels.add(new ClientTextStyleVO("标签内容", "#00FF00"));
|
| | | // tg.setLabels(labels);
|
| | | // }
|
| | | return tg;
|
| | | return loadYuShouInfo(tg, tb);
|
| | | }
|
| | |
|
| | | private static TaoBaoGoodsBriefExtra loadYuShouInfo(TaoBaoGoodsBriefExtra extra, TaoBaoGoodsBrief goods) {
|
| | | if (goods != null && extra != null) {
|
| | | if (isYUShou(goods)) {// 预售商品
|
| | | extra.setZkPrice(new BigDecimal(goods.getPresaleDeposit()));
|
| | | // 预售
|
| | | if (extra.getLabels() == null)
|
| | | extra.setLabels(new ArrayList<>());
|
| | | extra.getLabels().add(new ClientTextStyleVO("预售", "#FF2B4E"));
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) {// 在标题添加优惠信息
|
| | | extra.setTitle(String.format("【%s】", goods.getPresaleDiscountFeeText()) + extra.getTitle());
|
| | | }
|
| | | }
|
| | | }
|
| | | return extra;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 是否为预售商品
|
| | | * |
| | | * @param goods
|
| | | * @return
|
| | | */
|
| | | public static boolean isYUShou(TaoBaoGoodsBrief goods) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPresaleDeposit())
|
| | | && !StringUtil.isNullOrEmpty(goods.getPresaleStartTime())
|
| | | && !StringUtil.isNullOrEmpty(goods.getPresaleEndTime())) {
|
| | | long startTime = Long.parseLong(goods.getPresaleStartTime());
|
| | | long endTime = Long.parseLong(goods.getPresaleEndTime());
|
| | | long now = System.currentTimeMillis();
|
| | | if (now >= startTime && now < endTime) {
|
| | | return true;
|
| | | }
|
| | | }
|
| | |
|
| | | return false;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | public static BigDecimal getGoodsHongBaoMoney(TaoBaoGoodsBrief goodsBrief, BigDecimal rate) {
|
| | | BigDecimal money = null;
|
| | |
|
| | | // 预售商品
|
| | | if (isYUShou(goodsBrief)) {
|
| | | if (goodsBrief.getYsylCommissionRate() != null)
|
| | | money = MoneyBigDecimalUtil.mul(
|
| | | MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(new BigDecimal(goodsBrief.getPresaleDeposit()),
|
| | | goodsBrief.getYsylCommissionRate()), new BigDecimal("0.0001")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | else
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(
|
| | | MoneyBigDecimalUtil.mul(goodsBrief.getZkPrice(), goodsBrief.getTkRate()),
|
| | | new BigDecimal("0.01")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | |
|
| | | return money;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(goodsBrief.getCouponInfo())
|
| | | || goodsBrief.getCouponInfo().trim().equalsIgnoreCase("无")) {
|
| | |
| | | return token;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 提取自有格式的淘口令
|
| | | * @param str
|
| | | * @return
|
| | | */
|
| | | public static String parseSystemTaoToken(String str) {
|
| | | String pattern = "(\\({1}[A-Za-z0-9]+\\){1})";
|
| | | Pattern r = Pattern.compile(pattern);
|
| | | Matcher m = r.matcher(str);
|
| | | while (m.find()) {
|
| | | String group = m.group(0);
|
| | | if (!StringUtil.isNullOrEmpty(group))
|
| | | return group;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static boolean isSpecialGoods(Integer materialLibType) {
|
| | | if (materialLibType != null && materialLibType == 1)
|
| | | return true;
|
| | |
| | | .optJSONArray("n_tbk_item");
|
| | | if (array != null && array.size() > 0) {
|
| | | JSONObject item = array.optJSONObject(0);
|
| | | return parseSimpleGoodsInfo(item);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | private static TaoBaoGoodsBrief parseSimpleGoodsInfo(JSONObject item) {
|
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
|
| | | goods.setAuctionId(item.optLong("num_iid"));
|
| | | goods.setAuctionUrl(item.optString("item_url"));
|
| | |
| | | } else
|
| | | goods.setMaterialLibType(0);
|
| | |
|
| | | goods = loadYuShouInfo(goods, item);
|
| | | return goods;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public String convertSpecialGoodsLink(Long auctionId, TaoKeAppInfo app) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.coupon.convert");
|
| | | map.put("item_id", auctionId + "");
|
| | | String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, app);
|
| | | return resultStr;
|
| | | 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"));
|
| | |
|
| | | 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;
|
| | | }
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public static List<TaoBaoGoodsBrief> getBatchGoodsInfo(List<Long> listId)
|
| | |
| | | if (array != null && array.size() > 0) {
|
| | |
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | |
|
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
|
| | |
|
| | | JSONObject item = array.optJSONObject(i);
|
| | |
|
| | | goods.setAuctionId(item.optLong("num_iid"));
|
| | | goods.setAuctionUrl(item.optString("item_url"));
|
| | | goods.setBiz30day(item.optInt("volume"));
|
| | | if (item.optJSONObject("small_images") != null) {
|
| | | JSONArray imgArray = item.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);
|
| | | goodsList.add(parseSimpleGoodsInfo(item));
|
| | | }
|
| | | }
|
| | | goods.setTitle(item.optString("title"));
|
| | | goods.setUserType(item.optInt("user_type"));
|
| | | goods.setZkPrice(new BigDecimal(item.optString("zk_final_price")));
|
| | | goods.setReservePrice(new BigDecimal(item.optString("zk_final_price")));
|
| | | goods.setAuctionUrl(item.optString("item_url"));
|
| | | goods.setProvcity(item.optString("provcity"));
|
| | | goods.setPictUrl(item.optString("pict_url"));
|
| | | goods.setShopTitle(item.optString("nick"));
|
| | |
|
| | | String optString = item.optString("shop_dsr");
|
| | | if (!StringUtil.isNullOrEmpty(optString)) {
|
| | | goods.setShopDsr(new Integer(optString));
|
| | | }
|
| | |
|
| | | String ratesum = item.optString("ratesum");
|
| | | if (!StringUtil.isNullOrEmpty(ratesum)) {
|
| | | goods.setRatesum(new Integer(ratesum));
|
| | | }
|
| | |
|
| | | if (item.optBoolean("is_prepay"))
|
| | | goods.setIsPrepay(1);
|
| | |
|
| | | if (item.optBoolean("i_rfd_rate"))
|
| | | goods.setRfdRate(1);
|
| | |
|
| | | if (item.optBoolean("h_good_rate"))
|
| | | goods.setGoodRate(1);
|
| | |
|
| | | if (item.optBoolean("h_pay_rate30"))
|
| | | goods.setPayRate30(1);
|
| | |
|
| | | if (item.optBoolean("free_shipment"))
|
| | | goods.setFreeShipment(1);
|
| | |
|
| | | if ("1".equalsIgnoreCase(item.optString("material_lib_type")))
|
| | | goods.setMaterialLibType(1);
|
| | | else
|
| | | goods.setMaterialLibType(0);
|
| | |
|
| | | goodsList.add(goods);
|
| | | }
|
| | | }
|
| | |
|
| | | return goodsList;
|
| | | }
|
| | |
|
| | |
| | | if (!StringUtil.isNullOrEmpty(item.optString("reserve_price")))
|
| | | goods.setReservePrice(new BigDecimal(item.optString("reserve_price")));
|
| | | goods.setTotalFee(new BigDecimal("0"));
|
| | | goods = loadYuShouInfo(goods, item);
|
| | | return goods;
|
| | | }
|
| | |
|
| | |
| | | if (!StringUtil.isNullOrEmpty(tkRate)) {
|
| | | goods.setTkRate(new BigDecimal(tkRate));
|
| | | }
|
| | | goods = loadYuShouInfo(goods, resultJSON);
|
| | | return goods;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | |
| | | goods.setReservePrice(new BigDecimal(0));
|
| | | goods.setTotalFee(new BigDecimal("0"));
|
| | | goods.setPictUrlWhite(item.optString("white_image"));
|
| | | goods = loadYuShouInfo(goods, item);
|
| | | return goods;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 官方活动推广
|
| | | * |
| | | * @param adZoneId
|
| | | * -广告位
|
| | | * @param promotionSceneId-活动ID
|
| | | * @param relationId
|
| | | * -渠道ID
|
| | | * @return
|
| | | */
|
| | | public static String officialActivityConvert(String adZoneId, String promotionSceneId, String relationId) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.activitylink.get");
|
| | | map.put("adzone_id", adZoneId);
|
| | | map.put("promotion_scene_id", promotionSceneId);
|
| | | if (relationId != null)
|
| | | map.put("relation_id", relationId);
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | try {
|
| | | String result = TaoKeBaseUtil.baseRequestForThreeTimes(map, app);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | if (json != null) {
|
| | | json = json.optJSONObject("tbk_activitylink_get_response");
|
| | | if (json.optInt("result_code") == 200) {
|
| | | return json.optString("data");
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | class QuanInfo {
|