From 588607eeb4168f6f5734fdc91bb3dfd101eeb4eb Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期一, 26 八月 2019 15:04:33 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java |   50 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java
index 3dab90e..596840d 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java
@@ -8,10 +8,10 @@
 
 import javax.annotation.Resource;
 
-import org.checkerframework.checker.units.qual.h;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
+import com.yeshi.fanli.dto.push.PushTypeEnum;
 import com.yeshi.fanli.entity.AppVersionInfo;
 import com.yeshi.fanli.entity.bus.user.UserCustomSettings;
 import com.yeshi.fanli.entity.bus.user.UserCustomSettings.UserSettingTypeEnum;
@@ -60,27 +60,27 @@
 	@Override
 	public void pushGoods(Long uid, Long auctionId, String title, String content, List<Integer> versionCodeList)
 			throws PushException {
-		push("goodsdetail", uid, title, content, null, null, auctionId, versionCodeList);
+		push(PushTypeEnum.goodsdetail, uid, title, content, null, null, auctionId, versionCodeList);
 	}
 
 	@Async("pushExecutor")
 	@Override
 	public void pushUrl(Long uid, String url, String title, String content, List<Integer> versionCodeList)
 			throws PushException {
-		push("url", uid, title, content, null, url, null, versionCodeList);
+		push(PushTypeEnum.url, uid, title, content, null, url, null, versionCodeList);
 	}
 
 	@Async("pushExecutor")
 	@Override
 	public void pushZNX(Long uid, String title, String content, List<Integer> versionCodeList) throws PushException {
-		push("ZNX", uid, title, content, null, null, null, versionCodeList);
+		push(PushTypeEnum.ZNX, uid, title, content, null, null, null, versionCodeList);
 	}
 
 	@Async("pushExecutor")
 	@Override
 	public void pushWEEX(Long uid, String title, String content, String weexUrl, List<Integer> versionCodeList)
 			throws PushException {
-		push("weex", uid, title, content, weexUrl, null, null, versionCodeList);
+		push(PushTypeEnum.weex, uid, title, content, weexUrl, null, null, versionCodeList);
 	}
 
 	@Async("pushExecutor")
@@ -88,14 +88,20 @@
 	public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<Integer> versionCodeList)
 			throws PushException {
 
-		push("baichuan", uid, title, content, null, url, null, versionCodeList);
+		push(PushTypeEnum.baichuan, uid, title, content, null, url, null, versionCodeList);
 	}
 
 	@Async("pushExecutor")
 	@Override
 	public void pushWelfareCenter(Long uid, String title, String content, List<Integer> versionCodeList)
 			throws PushException {
-		push("welfare", uid, title, content, null, null, null, versionCodeList);
+		push(PushTypeEnum.welfare, uid, title, content, null, null, null, versionCodeList);
+	}
+
+	@Override
+	public void pushUserSignInNotification(Long uid, String title, String content, List<Integer> versionCodeList)
+			throws PushException {
+		push(PushTypeEnum.signin, uid, title, content, null, null, null, versionCodeList);
 	}
 
 	private List<DeviceTokenHW> filterDeviceToken(List<DeviceTokenHW> hwDeviceList, int hour) {
@@ -136,7 +142,7 @@
 	 * @param webUrl
 	 * @param versionCodeList
 	 */
-	private void push(String type, Long uid, String title, String content, String url, String webUrl, Long goodsId,
+	private void push(PushTypeEnum type, Long uid, String title, String content, String url, String webUrl, Long goodsId,
 			List<Integer> versionCodeList) throws PushException {
 		int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
 		List<Integer> newVersionList = getVersionCodeList(versionCodeList);
@@ -151,26 +157,28 @@
 				for (DeviceTokenHW token : hwDeviceList)
 					tokenList.add(token.getDeviceToken());
 				try {
-					if (type.equalsIgnoreCase("goodsdetail")) {// 鍟嗗搧璇︽儏
+					if (type==PushTypeEnum.goodsdetail) {// 鍟嗗搧璇︽儏
 						if (goodsId == null)
 							throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
 						HWPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
-					} else if (type.equalsIgnoreCase("url")) {// 閾炬帴
+					} else if (type==PushTypeEnum.url) {// 閾炬帴
 						if (StringUtil.isNullOrEmpty(webUrl))
 							throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
 						HWPushUtil.pushUrl(tokenList, title, content, webUrl);
-					} else if (type.equalsIgnoreCase("ZNX")) {// 绔欏唴淇�
+					} else if (type==PushTypeEnum.ZNX) {// 绔欏唴淇�
 						HWPushUtil.pushZNX(tokenList, title, content);
-					} else if (type.equalsIgnoreCase("weex")) {// weex
+					} else if (type==PushTypeEnum.weex) {// weex
 						if (StringUtil.isNullOrEmpty(url))
 							throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
 						HWPushUtil.pushWEEX(tokenList, title, content, url);
-					} else if (type.equalsIgnoreCase("baichuan")) {// 鐧惧窛閾炬帴
+					} else if (type==PushTypeEnum.baichuan) {// 鐧惧窛閾炬帴
 						if (StringUtil.isNullOrEmpty(webUrl))
 							throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
 						HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
-					} else if (type.equalsIgnoreCase("welfare")) {// 绂忓埄涓績
+					} else if (type==PushTypeEnum.welfare) {// 绂忓埄涓績
 						HWPushUtil.pushWelfareCenter(tokenList, title, content);
+					}else if (type==PushTypeEnum.signin) {// 绛惧埌
+						HWPushUtil.pushUserSignInNotification(tokenList, title, content);
 					}
 				} catch (Exception e) {
 					PushLogHelper.hwError(e);
@@ -190,26 +198,28 @@
 				return;
 
 			try {
-				if (type.equalsIgnoreCase("goodsdetail")) {// 鍟嗗搧璇︽儏
+				if (type==PushTypeEnum.goodsdetail) {// 鍟嗗搧璇︽儏
 					if (goodsId == null)
 						throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
 					HWPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
-				} else if (type.equalsIgnoreCase("url")) {// 閾炬帴
+				} else if (type==PushTypeEnum.url) {// 閾炬帴
 					if (StringUtil.isNullOrEmpty(webUrl))
 						throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
 					HWPushUtil.pushUrl(tokenList, title, content, webUrl);
-				} else if (type.equalsIgnoreCase("ZNX")) {// 绔欏唴淇�
+				} else if (type==PushTypeEnum.ZNX) {// 绔欏唴淇�
 					HWPushUtil.pushZNX(tokenList, title, content);
-				} else if (type.equalsIgnoreCase("weex")) {// weex
+				} else if (type==PushTypeEnum.weex) {// weex
 					if (StringUtil.isNullOrEmpty(url))
 						throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
 					HWPushUtil.pushWEEX(tokenList, title, content, url);
-				} else if (type.equalsIgnoreCase("baichuan")) {// 鐧惧窛閾炬帴
+				} else if (type==PushTypeEnum.baichuan) {// 鐧惧窛閾炬帴
 					if (StringUtil.isNullOrEmpty(webUrl))
 						throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
 					HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
-				} else if (type.equalsIgnoreCase("welfare")) {// 绂忓埄涓績
+				} else if (type==PushTypeEnum.welfare) {// 绂忓埄涓績
 					HWPushUtil.pushWelfareCenter(tokenList, title, content);
+				} else if (type==PushTypeEnum.signin) {// 绛惧埌
+					HWPushUtil.pushUserSignInNotification(tokenList, title, content);
 				}
 			} catch (Exception e) {
 				PushLogHelper.hwError(e);

--
Gitblit v1.8.0