From 207ae7df18d601d839d945d32c5519f95b959a92 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 28 十二月 2019 11:28:49 +0800
Subject: [PATCH] 文章
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java | 114 +++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 74 insertions(+), 40 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
index 917b096..f8e76c2 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -41,6 +41,7 @@
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.exception.user.TokenRecordException;
import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.service.inter.brand.BrandInfoService;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
@@ -53,6 +54,7 @@
import com.yeshi.fanli.service.inter.user.HistorySearchService;
import com.yeshi.fanli.service.inter.user.TokenRecordService;
import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
+import com.yeshi.fanli.service.manger.goods.jd.JDGoodsLinkParseManager;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.DouYinUtil;
@@ -129,6 +131,12 @@
@Resource
private IntegralGetCacheManager integralGetCacheManager;
+ @Resource
+ private BrandInfoService brandInfoService;
+
+ @Resource
+ private JDGoodsLinkParseManager jdGoodsLinkParseManager;
+
/**
* 绮樿创鏉夸俊鎭帹鑽�
*
@@ -145,6 +153,7 @@
}
// 鍘婚櫎鍓嶅悗绌烘牸
text = text.trim();
+ String originalText=text;
try {
TokenVO tokenVO = tokenRecordService.discernToken(text, uid, acceptData);
@@ -223,7 +232,7 @@
tb = TaoBaoUtil.isAlimama(id);
if (tb == null) {
type = 4;
- tb = getTaoBaoGoodsBriefFromGoodsId(id);
+ tb = getTaoBaoGoodsBriefFromGoodsId(id,originalText);
}
} else if (text.contains("http://zmnxbc.com")) { // 鎵嬫満绔ぉ鐚獳PP鍒嗕韩
tb = TaoBaoUtil.parsePhoneShareUrlByTM(text);
@@ -235,7 +244,7 @@
tb = TaoBaoUtil.isAlimama(id);
if (tb == null) {
type = 4;
- tb = getTaoBaoGoodsBriefFromGoodsId(id);
+ tb = getTaoBaoGoodsBriefFromGoodsId(id,originalText);
}
} else if (text.contains("v.douyin.com")) { // 鎶栭煶
analysisDouYin(acceptData, text, out);
@@ -246,7 +255,7 @@
if (tb == null) {
String goodsId = TaoBaoUtil.getGoodsIdByPhoneShareUrl(text);
if (!StringUtil.isNullOrEmpty(goodsId)) {
- tb = getTaoBaoGoodsBriefFromGoodsId(goodsId);
+ tb = getTaoBaoGoodsBriefFromGoodsId(goodsId,originalText);
if (tb != null)
type = 4;
}
@@ -255,10 +264,17 @@
if (tb == null)// 娣樺疂鏄┖鍊�
{
String jdId = JDUtil.getJDGoodsId(text);
+
+ // 寰俊閾炬帴
if (StringUtil.isNullOrEmpty(jdId)) {
jdId = JDUtil.getJDGoodsIdByWeiXin(text);
}
-
+
+ // 棰嗗埜鐭繛鎺�
+ if (StringUtil.isNullOrEmpty(jdId) && text.contains("u.jd.com")) {
+ jdId = jdGoodsLinkParseManager.parseGoodsIdByJDShortUrl(text);
+ }
+
if (!StringUtil.isNullOrEmpty(jdId)) {
JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(jdId));
if (goods != null) {
@@ -349,13 +365,11 @@
commonGoods = CommonGoodsFactory.create(goodsBrief);
}
- BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
- BigDecimal shareRate = hongBaoManageService.getShareRate();
Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
data.put("type", type);
data.put("goods", gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods,
- new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate()))));
+ hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()))));
out.print(JsonUtil.loadTrueResult(data));
return;
}
@@ -391,12 +405,22 @@
out.print(JsonUtil.loadTrueResult(root));
}
- private TaoBaoGoodsBrief getTaoBaoGoodsBriefFromGoodsId(String goodsId) {
+ private TaoBaoGoodsBrief getTaoBaoGoodsBriefFromGoodsId(String goodsId, String text) {
TaoBaoGoodsBrief tb = TaoBaoUtil.getTmallGoodsInfo(goodsId);
if (tb == null && NumberUtil.isNumeric(goodsId)) {// 鏄暟瀛�
- tb = TaoBaoUtil.getSimpleGoodsBrief(Long.parseLong(goodsId));
- if (tb != null) {
- tb.setPictUrl(TbImgUtil.getTBSize220Img(tb.getPictUrl()));
+// tb = TaoBaoUtil.getSimpleGoodsBrief(Long.parseLong(goodsId));
+// if (tb != null) {
+// tb.setPictUrl(TbImgUtil.getTBSize220Img(tb.getPictUrl()));
+// }
+ if (tb == null) {
+ tb = new TaoBaoGoodsBrief();
+ if (text.trim().indexOf("銆�") == 0 && text.trim().indexOf("銆�") > 0) {
+ // 鎴彇鏍囬
+ String title = text.trim().substring(1, text.trim().lastIndexOf("銆�"));
+ tb.setAuctionId(Long.parseLong(goodsId));
+ tb.setTitle(title);
+ tb.setPictUrl("http://");
+ }
}
}
return tb;
@@ -471,15 +495,14 @@
return false;
}
- BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
- BigDecimal shareRate = hongBaoManageService.getShareRate();
Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
JSONObject data = new JSONObject();
data.put("type", 3);
- data.put("goods", gson.toJson(GoodsDetailVOFactory.convertTaoBao(goodsBrief,
- new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate()))));
+ data.put("goods",
+ gson.toJson(GoodsDetailVOFactory.convertTaoBao(goodsBrief, hongBaoManageService
+ .getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()))));
out.print(JsonUtil.loadTrueResult(data));
return true;
}
@@ -749,9 +772,8 @@
}
List<GoodsDetailVO> list = new ArrayList<GoodsDetailVO>();
- BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
- BigDecimal shareRate = hongBaoManageService.getShareRate();
- ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate());
+ ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+ acceptData.getVersion());
for (TaoBaoGoodsBrief goods : taoBaoGoodsBriefs) {
list.add(GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO));
@@ -765,25 +787,40 @@
data.put("count", result.getTaoBaoHead().getDocsfound());
if (page == 1) { // 绗竴椤佃繑鍥炲簵閾轰俊鎭�
- List<TaoBaoShopVO> listShop = taoBaoShopService.getShopByKeyV2(key);
- if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoodsVO() != null
- && listShop.get(0).getListGoodsVO().size() > 2) {
- 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()))) {
- BrandInfoVO brandInfoVO = new BrandInfoVO();
- brandInfoVO.setId(taoBaoShop.getId());
- brandInfoVO.setName(taoBaoShop.getShopName());
- brandInfoVO.setIcon(taoBaoShop.getShopIcon());
- brandInfoVO.setListGoods(taoBaoShop.getListGoodsVO());
+ String platform = acceptData.getPlatform();
+ String version = acceptData.getVersion();
+ if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0_5(platform, version))
+ || ("android".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0_2(platform, version))) {
+ BrandInfoVO brandInfoVO = null;
+ try {
+ brandInfoVO = brandInfoService.listByAlikeName(key, acceptData.getPlatform(),
+ acceptData.getVersion());
+ } catch (Exception e) {
+ }
+ if (brandInfoVO != null)
data.put("shop", JsonUtil.getApiCommonGson().toJson(brandInfoVO));
- } else {
- data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop));
+ } else {
+ List<TaoBaoShopVO> listShop = taoBaoShopService.getShopByKeyV2(key, acceptData.getPlatform(),
+ acceptData.getVersion());
+ if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoodsVO() != null
+ && listShop.get(0).getListGoodsVO().size() > 2) {
+ TaoBaoShopVO taoBaoShop = listShop.get(0);
+ if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0(platform, version))
+ || ("android".equalsIgnoreCase(platform)
+ && VersionUtil.greaterThan_2_0_1(platform, version))) {
+ BrandInfoVO brandInfoVO = new BrandInfoVO();
+ brandInfoVO.setId(taoBaoShop.getId());
+ brandInfoVO.setName(taoBaoShop.getShopName());
+ brandInfoVO.setIcon(taoBaoShop.getShopIcon());
+ brandInfoVO.setListGoods(taoBaoShop.getListGoodsVO());
+ data.put("shop", JsonUtil.getApiCommonGson().toJson(brandInfoVO));
+ } else {
+ data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop));
+ }
}
}
}
+
out.print(JsonUtil.loadTrueResult(data));
}
@@ -941,12 +978,10 @@
List<JDGoods> goodsList = result.getGoodsList();
if (goodsList != null && goodsList.size() > 0) {
- BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
- BigDecimal shareRate = hongBaoManageService.getShareRate();
Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
- ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate());
-
+ ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+ acceptData.getVersion());
for (JDGoods goods : goodsList) {
GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
if (hasCoupon) {
@@ -1027,9 +1062,8 @@
Gson gson = JsonUtil.getApiCommonGson();
List<PDDGoodsDetail> goodsList = result.getGoodsList();
if (goodsList != null && goodsList.size() > 0) {
- BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
- BigDecimal shareRate = hongBaoManageService.getShareRate();
- ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate());
+ ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+ acceptData.getVersion());
for (PDDGoodsDetail goods : goodsList) {
GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO);
--
Gitblit v1.8.0