From dc5be7d38446f70e6ff86df311119c32b41fe7f8 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 28 十一月 2020 16:37:05 +0800
Subject: [PATCH] 大淘客搜索接口升级

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java |   44 +++++++++++++++++++++++---------------------
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java
index b7c6cbb..a491a89 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java
@@ -8,6 +8,7 @@
 
 import javax.annotation.Resource;
 
+import com.yeshi.fanli.entity.SystemEnum;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -20,7 +21,7 @@
 import com.yeshi.fanli.entity.push.PushGoods;
 import com.yeshi.fanli.entity.push.PushGoodsGroup;
 import com.yeshi.fanli.entity.system.ConfigKeyEnum;
-import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
+import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.exception.push.PushException;
 import com.yeshi.fanli.exception.push.PushGoodsException;
 import com.yeshi.fanli.service.inter.config.ConfigService;
@@ -74,7 +75,7 @@
 	}
 
 	@Override
-	public PushGoods selectByPrimaryKey(Long id) throws PushGoodsException {
+	public PushGoods selectByPrimaryKey(Long id) {
 		return pushGoodsMapper.selectByPrimaryKey(id);
 	}
 
@@ -233,8 +234,10 @@
 			List<ImgInfo> imgList = goodsEvaluate.getImgList();
 			if (imgList != null && imgList.size() > 0) {
 				for (ImgInfo imgInfo: imgList) {
-					if (imgInfo.getType() == ImgEnum.img && !StringUtil.isNullOrEmpty(imgInfo.getUrl())) {
+					if (!StringUtil.isNullOrEmpty(imgInfo.getUrl())  && StringUtil.isNullOrEmpty(picUrl)
+							&& (imgInfo.getType() == ImgEnum.img || imgInfo.getType() == ImgEnum.activity)) {
 						picUrl = imgInfo.getUrl();
+						break;
 					}
 				}
 			}
@@ -246,7 +249,7 @@
 		 
 		
 		// 瀹氭椂鏃堕棿
-		if (StringUtil.isNullOrEmpty(record.getControlTime_str())) {
+		if (!StringUtil.isNullOrEmpty(record.getControlTime_str())) {
 			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 			record.setControlTime(format.parse(record.getControlTime_str().replaceAll("T", " ")));
 		}
@@ -295,29 +298,29 @@
 	}
 
 	@Override
-	public List<PushGoods> listQuery(long start, int count, String key, Integer state) {
-		return pushGoodsMapper.listQuery(start, count, key, state);
+	public List<PushGoods> listQuery(long start, int count, String key, Integer state, SystemEnum system) {
+		return pushGoodsMapper.listQuery(start, count, key, state,system);
 	}
 
 	@Override
-	public long countQuery(String key, Integer state) {
-		return pushGoodsMapper.countQuery(key, state);
+	public long countQuery(String key, Integer state, SystemEnum system) {
+		return pushGoodsMapper.countQuery(key, state,system);
 	}
 
 	@Override
-	public List<PushGoods> listHistoryByPushTime(long start, int count, Long uid, Date pushTime) {
-		return pushGoodsMapper.listHistoryByPushTime(start, count, uid, pushTime);
+	public List<PushGoods> listHistoryByPushTime(long start, int count, Long uid, Date pushTime, SystemEnum system) {
+		return pushGoodsMapper.listHistoryByPushTime(start, count, uid, pushTime,system);
 	}
 
 	@Override
-	public long countHistoryByPushTime(Long uid, Date pushTime) {
-		return pushGoodsMapper.countHistoryByPushTime(uid, pushTime);
+	public long countHistoryByPushTime(Long uid, Date pushTime, SystemEnum system) {
+		return pushGoodsMapper.countHistoryByPushTime(uid, pushTime,system);
 	}
 
 	
 	@Override
-	public List<PushGoods> listTask() {
-		return pushGoodsMapper.listTask();
+	public List<PushGoods> listTask( SystemEnum system) {
+		return pushGoodsMapper.listTask(system);
 	}
 	
 	
@@ -439,14 +442,13 @@
 			}
 		}
 		
-		String url = configService.get(ConfigKeyEnum.pushActivityLink.getKey());
+		String url = configService.getValue(ConfigKeyEnum.pushActivityLink.getKey(),pushGoods.getSystem());
 		if (StringUtil.isNullOrEmpty(url)) {
 			throw new PushGoodsException(1, "鎺ㄩ�侀〉闈㈤摼鎺ヤ笉瀛樺湪");
 		}
-		url = url + "?id=" + pushGoods.getId() + "&otherId=" + pushGoods.getOtherId();
-		
+		url = url + "?id=" + pushGoods.getId();
 		// h娲诲姩鍏ㄦ帹
-		pushService.pushUrl(pushGoods.getUid(), pushGoods.getTitle(), pushGoods.getContent(), url, listIOS, listAndroid);
+		pushService.pushUrl(pushGoods.getUid(), pushGoods.getTitle(), pushGoods.getContent(), url, listIOS, listAndroid,pushGoods.getSystem());
 	}
 	
 	
@@ -500,16 +502,16 @@
 
 			Long goodsId = commonGoods.getGoodsId();
 			String url = "https://item.taobao.com/item.htm?id=" + goodsId;
-			pushService.pushGoods(pushGoods.getUid(), pushGoods.getTitle(), pushGoods.getContent(), url,listIOS, listAndroid);
+			pushService.pushGoods(pushGoods.getUid(), pushGoods.getTitle(), pushGoods.getContent(), url,listIOS, listAndroid,pushGoods.getSystem());
 		} else {
 			/*   澶氫釜鍟嗗搧鎺ㄩ��    */
-			String url = configService.get(ConfigKeyEnum.pushGoodsDetails.getKey());
+			String url = configService.getValue(ConfigKeyEnum.pushGoodsDetails.getKey(),pushGoods.getSystem());
 			if (StringUtil.isNullOrEmpty(url)) {
 				throw new PushGoodsException(1, "鎺ㄩ�侀〉闈㈤摼鎺ヤ笉瀛樺湪");
 			}
 			// 鐢熸垚閾炬帴
 			url = url + "?id=" + id;
-			pushService.pushUrl(pushGoods.getUid(), pushGoods.getTitle(), pushGoods.getContent(), url, listIOS, listAndroid);
+			pushService.pushUrl(pushGoods.getUid(), pushGoods.getTitle(), pushGoods.getContent(), url, listIOS, listAndroid,pushGoods.getSystem());
 		}
 	}
 	

--
Gitblit v1.8.0