From 3cf41feae65a864fc00d72fdd09a676372fc3b27 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 15 三月 2019 12:22:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java | 49 +++++++++++++++++++++++--------------------------
1 files changed, 23 insertions(+), 26 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 c7a4781..c66766e 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
@@ -1,24 +1,23 @@
package com.yeshi.fanli.service.impl.push;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.transaction.Transactional;
-import net.sf.json.JSONObject;
-
import org.springframework.stereotype.Service;
-import org.yeshi.utils.HttpUtil;
import com.yeshi.fanli.dao.mybatis.push.PushGoodsMapper;
+import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.push.PushGoods;
import com.yeshi.fanli.entity.push.PushGoodsGroup;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.PushException;
+import com.yeshi.fanli.exception.push.PushCouponException;
import com.yeshi.fanli.exception.push.PushGoodsException;
-import com.yeshi.fanli.goods.CommonGoods;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
import com.yeshi.fanli.service.inter.push.PushGoodsGroupService;
@@ -26,7 +25,6 @@
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
-import com.yeshi.fanli.util.factory.IOSPushFactory;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
@Service
@@ -97,7 +95,7 @@
} else {
// 淇敼
record.setUpdateTime(new Date());
- pushGoodsMapper.insertSelective(record);
+ pushGoodsMapper.updateByPrimaryKeySelective(record);
}
// 澶勭悊鍟嗗搧淇℃伅
@@ -181,13 +179,13 @@
@Transactional
public int deleteBatchByPrimaryKey(List<Long> list) throws Exception {
- List<PushGoods> lisState = pushGoodsMapper.listByPushState(list);
+ /*List<PushGoods> lisState = pushGoodsMapper.listByPushState(list);
if (lisState != null && lisState.size() > 0) {
for (PushGoods pushGoods : lisState) {
// 宸叉帹閫佺殑娑堟伅涓嶈兘鍒犻櫎
list.remove(pushGoods.getId());
}
- }
+ }*/
// 鍒犻櫎瀵瑰簲鍟嗗搧
pushGoodsGroupService.deleteBatchByPushId(list);
@@ -206,13 +204,13 @@
}
@Override
- public List<PushGoods> listHistoryByPushTime(long start, int count, Date pushTime) {
- return pushGoodsMapper.listHistoryByPushTime(start, count, pushTime);
+ public List<PushGoods> listHistoryByPushTime(long start, int count, Long uid, Date pushTime) {
+ return pushGoodsMapper.listHistoryByPushTime(start, count, uid, pushTime);
}
@Override
- public long countHistoryByPushTime(Date pushTime) {
- return pushGoodsMapper.countHistoryByPushTime(pushTime);
+ public long countHistoryByPushTime(Long uid, Date pushTime) {
+ return pushGoodsMapper.countHistoryByPushTime(uid, pushTime);
}
@Override
@@ -233,7 +231,16 @@
if (goodsList == null || goodsList.size() == 0) {
throw new PushException(1, "鎺ㄩ�佹棤鍟嗗搧,璇峰畬鍠勬暟鎹�");
}
-
+
+ List<String> listVersion = null;
+ String versions = pushGoods.getVersions();
+ if (versions != null && versions.trim().length() > 0) {
+ listVersion = Arrays.asList(versions.split(","));
+ if (listVersion == null || listVersion.size() == 0) {
+ throw new PushCouponException(1, "鐗堟湰鍙锋牸寮忎笉姝g‘\"");
+ }
+ }
+
if (goodsList.size() == 1) {
/* 鍗曚釜鍟嗗搧鎺ㄩ�侊細 鐩存帴澶勭悊涓哄晢鍝佷俊鎭� */
PushGoodsGroup pushGoodsGroup = goodsList.get(0);
@@ -243,15 +250,10 @@
}
Long goodsId = commonGoods.getGoodsId();
- JSONObject json = IOSPushFactory.createGoodsPush(goodsId, alertTitle, alertContent);
- if (json.toString().getBytes().length > 256) {
- throw new PushException(1, "鏍囬鎴栧唴瀹硅繃闀�,璇峰垹鍑忓悗鍐嶈瘯");
- }
-
String url = "https://item.taobao.com/item.htm?id=" + goodsId;
+
+ pushService.pushGoods(pushGoods.getUid(), url, alertTitle, alertContent, listVersion);
- pushService.pushGoods(pushGoods.getUid(), url, alertTitle, alertContent);
-
} else {
/* 澶氫釜鍟嗗搧鎺ㄩ�� */
String url = configService.get("push_goods_details");
@@ -261,12 +263,7 @@
// 鐢熸垚閾炬帴
url = url + "?id=" + id;
- JSONObject json = IOSPushFactory.createURLPush(HttpUtil.getShortLink(url), alertTitle, alertContent);
- if (json.toString().getBytes().length > 256) {
- throw new PushException(1, "鏍囬鎴栧唴瀹硅繃闀�,璇峰垹鍑忓悗鍐嶈瘯");
- }
-
- pushService.pushUrl(pushGoods.getUid(), url, alertTitle, alertContent);
+ pushService.pushUrl(pushGoods.getUid(), url, alertTitle, alertContent, listVersion);
}
// 宸叉帹閫�
--
Gitblit v1.8.0