From 9d35ba657fa5e3add766405d76e3ff8c4dcd4ad4 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 04 七月 2020 15:38:00 +0800
Subject: [PATCH] 多系统兼容优化

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java |   70 +++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java
index 81ad8d3..43b3af9 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java
@@ -8,6 +8,8 @@
 
 import javax.annotation.Resource;
 
+import com.yeshi.fanli.dto.push.PushBaseContent;
+import com.yeshi.fanli.entity.SystemEnum;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
@@ -37,10 +39,10 @@
 	@Resource
 	private UserCustomSettingsService userCustomSettingsService;
 
-	private List<Integer> getVersionCodeList(List<Integer> versionCodeList) {
+	private List<Integer> getVersionCodeList(List<Integer> versionCodeList, SystemEnum system) {
 		List<Integer> versionList = new ArrayList<>();
 		if (versionCodeList == null) {// 鍏ㄦ帹
-			List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51);
+			List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51,system);
 			if (appInfoList != null)
 				for (AppVersionInfo version : appInfoList) {
 					versionList.add(version.getVersionCode());
@@ -58,50 +60,50 @@
 
 	@Async("pushExecutor")
 	@Override
-	public void pushGoods(Long uid, Long auctionId, String title, String content, List<Integer> versionCodeList)
+	public void pushGoods(Long uid, Long auctionId, PushBaseContent content)
 			throws PushException {
-		push(PushTypeEnum.goodsdetail, uid, title, content, null, null, auctionId, versionCodeList);
+		push(PushTypeEnum.goodsdetail, uid,  null, null, auctionId, content);
 	}
 
 	@Async("pushExecutor")
 	@Override
-	public void pushUrl(Long uid, String url, String title, String content, List<Integer> versionCodeList)
+	public void pushUrl(Long uid, String url, PushBaseContent content)
 			throws PushException {
-		push(PushTypeEnum.url, uid, title, content, null, url, null, versionCodeList);
+		push(PushTypeEnum.url, uid, null, url, null, content);
 	}
 
 	@Async("pushExecutor")
 	@Override
-	public void pushZNX(Long uid, String title, String content, List<Integer> versionCodeList) throws PushException {
-		push(PushTypeEnum.ZNX, uid, title, content, null, null, null, versionCodeList);
+	public void pushZNX(Long uid, PushBaseContent content) throws PushException {
+		push(PushTypeEnum.ZNX, uid,  null, null, null, content);
 	}
 
 	@Async("pushExecutor")
 	@Override
-	public void pushWEEX(Long uid, String title, String content, String weexUrl, List<Integer> versionCodeList)
+	public void pushWEEX(Long uid,  String weexUrl, PushBaseContent content)
 			throws PushException {
-		push(PushTypeEnum.weex, uid, title, content, weexUrl, null, null, versionCodeList);
+		push(PushTypeEnum.weex, uid,  weexUrl, null, null, content);
 	}
 
 	@Async("pushExecutor")
 	@Override
-	public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<Integer> versionCodeList)
+	public void pushBaiChuanUrl(Long uid, String url, PushBaseContent content)
 			throws PushException {
 
-		push(PushTypeEnum.baichuan, uid, title, content, null, url, null, versionCodeList);
+		push(PushTypeEnum.baichuan, uid,  null, url, null, content);
 	}
 
 	@Async("pushExecutor")
 	@Override
-	public void pushWelfareCenter(Long uid, String title, String content, List<Integer> versionCodeList)
+	public void pushWelfareCenter(Long uid, PushBaseContent content)
 			throws PushException {
-		push(PushTypeEnum.welfare, uid, title, content, null, null, null, versionCodeList);
+		push(PushTypeEnum.welfare, uid,  null, null, null, content);
 	}
 
 	@Override
-	public void pushUserSignInNotification(Long uid, String title, String content, List<Integer> versionCodeList)
+	public void pushUserSignInNotification(Long uid, PushBaseContent content)
 			throws PushException {
-		push(PushTypeEnum.signin, uid, title, content, null, null, null, versionCodeList);
+		push(PushTypeEnum.signin, uid, null, null, null, content);
 	}
 
 	private List<DeviceTokenVIVO> filterDeviceToken(List<DeviceTokenVIVO> deviceList, int hour) {
@@ -138,16 +140,14 @@
 	 * 
 	 * @param type
 	 * @param uid
-	 * @param title
 	 * @param content
 	 * @param url
 	 * @param webUrl
-	 * @param versionCodeList
 	 */
-	private void push(PushTypeEnum type, Long uid, String title, String content, String url, String webUrl,
-			Long goodsId, List<Integer> versionCodeList) throws PushException {
+	private void push(PushTypeEnum type, Long uid, String url, String webUrl,
+			Long goodsId, PushBaseContent content) throws PushException {
 		int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
-		List<Integer> newVersionList = getVersionCodeList(versionCodeList);
+		List<Integer> newVersionList = getVersionCodeList(content.getVersionCodeList(),content.getSystem());
 		// 2.0.1鍚庡紑濮嬫帹閫�
 		for (int i = 0; i < newVersionList.size(); i++) {
 			if (newVersionList.get(i) < 51)
@@ -169,25 +169,25 @@
 					if (type == PushTypeEnum.goodsdetail) {// 鍟嗗搧璇︽儏
 						if (goodsId == null)
 							throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
-						VIVOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
+						VIVOPushUtil.pushGoods(tokenList, content.getTitle(),content.getContent(), 1, goodsId);
 					} else if (type == PushTypeEnum.url) {// 閾炬帴
 						if (StringUtil.isNullOrEmpty(webUrl))
 							throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
-						VIVOPushUtil.pushUrl(tokenList, title, content, webUrl);
+						VIVOPushUtil.pushUrl(tokenList,  content.getTitle(),content.getContent(),  webUrl);
 					} else if (type == PushTypeEnum.ZNX) {// 绔欏唴淇�
-						VIVOPushUtil.pushZNX(tokenList, title, content);
+						VIVOPushUtil.pushZNX(tokenList,  content.getTitle(),content.getContent());
 					} else if (type == PushTypeEnum.weex) {// weex
 						if (StringUtil.isNullOrEmpty(url))
 							throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
-						VIVOPushUtil.pushWEEX(tokenList, title, content, url);
+						VIVOPushUtil.pushWEEX(tokenList,  content.getTitle(),content.getContent(),  url);
 					} else if (type == PushTypeEnum.baichuan) {// 鐧惧窛閾炬帴
 						if (StringUtil.isNullOrEmpty(webUrl))
 							throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
-						VIVOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
+						VIVOPushUtil.pushBaiChuanUrl(tokenList,  content.getTitle(),content.getContent(),  webUrl);
 					} else if (type == PushTypeEnum.welfare) {// 绂忓埄涓績
-						VIVOPushUtil.pushWelfareCenter(tokenList, title, content);
+						VIVOPushUtil.pushWelfareCenter(tokenList,  content.getTitle(),content.getContent());
 					} else if (type == PushTypeEnum.signin) {// 绛惧埌
-						VIVOPushUtil.pushUserSignInNotification(tokenList, title, content);
+						VIVOPushUtil.pushUserSignInNotification(tokenList,  content.getTitle(),content.getContent());
 					}
 				} catch (Exception e) {
 					PushLogHelper.hwError(e);
@@ -210,25 +210,25 @@
 				if (type == PushTypeEnum.goodsdetail) {// 鍟嗗搧璇︽儏
 					if (goodsId == null)
 						throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
-					VIVOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
+					VIVOPushUtil.pushGoods(tokenList, content.getTitle(), content.getContent(), 1, goodsId);
 				} else if (type == PushTypeEnum.url) {// 閾炬帴
 					if (StringUtil.isNullOrEmpty(webUrl))
 						throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
-					VIVOPushUtil.pushUrl(tokenList, title, content, webUrl);
+					VIVOPushUtil.pushUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
 				} else if (type == PushTypeEnum.ZNX) {// 绔欏唴淇�
-					VIVOPushUtil.pushZNX(tokenList, title, content);
+					VIVOPushUtil.pushZNX(tokenList, content.getTitle(), content.getContent());
 				} else if (type == PushTypeEnum.weex) {// weex
 					if (StringUtil.isNullOrEmpty(url))
 						throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
-					VIVOPushUtil.pushWEEX(tokenList, title, content, url);
+					VIVOPushUtil.pushWEEX(tokenList, content.getTitle(), content.getContent(), url);
 				} else if (type == PushTypeEnum.baichuan) {// 鐧惧窛閾炬帴
 					if (StringUtil.isNullOrEmpty(webUrl))
 						throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
-					VIVOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
+					VIVOPushUtil.pushBaiChuanUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
 				} else if (type == PushTypeEnum.welfare) {// 绂忓埄涓績
-					VIVOPushUtil.pushWelfareCenter(tokenList, title, content);
+					VIVOPushUtil.pushWelfareCenter(tokenList, content.getTitle(), content.getContent());
 				} else if (type == PushTypeEnum.signin) {// 绛惧埌
-					VIVOPushUtil.pushUserSignInNotification(tokenList, title, content);
+					VIVOPushUtil.pushUserSignInNotification(tokenList,content.getTitle(), content.getContent());
 				}
 			} catch (Exception e) {
 				PushLogHelper.vivoError(e);

--
Gitblit v1.8.0