From ca20ce6afc5abe164767c87b5332df223c3b8063 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 05 三月 2019 15:31:31 +0800
Subject: [PATCH] 增加福利中心推送 二维码识别邀请关系修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java |   72 ++++++++++++++++++++++++-----------
 1 files changed, 49 insertions(+), 23 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java
index 16a4676..9576a6e 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java
@@ -41,7 +41,7 @@
 
 	@Resource
 	private UserCustomSettingsService userCustomSettingsService;
-	
+
 	@Override
 	public void pushGoods(Long uid, Long auctionId, String title, String content) throws PushException {
 
@@ -85,9 +85,9 @@
 			 */
 		} else {
 			if (!validateNotDisturbSingle(uid)) {
-				return; //閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00) 
+				return; // 閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00)
 			}
-			
+
 			// IOS 鍗曟帹
 			List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid);
 			List<String> deviceTokenList = new ArrayList<>();
@@ -143,9 +143,9 @@
 			 */
 		} else {
 			if (!validateNotDisturbSingle(uid)) {
-				return; //閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00) 
+				return; // 閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00)
 			}
-			
+
 			List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid);
 			List<String> deviceTokenList = new ArrayList<>();
 			if (deviceTokenIosList != null)
@@ -206,13 +206,13 @@
 			 * } });
 			 */
 		} else if (msg != null) {
-			
-			if (uId !=null) {
+
+			if (uId != null) {
 				if (!validateNotDisturbSingle(uId)) {
-					return; //閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00) 
+					return; // 閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00)
 				}
 			}
-			
+
 			// 鎻掑叆鎺ㄩ�佽褰�
 			PushRecord pushRecord = new PushRecord();
 			info.setTitle(msg.getTitle());
@@ -462,27 +462,27 @@
 
 		String jsonContent = pushQueueRecord.getJsonContent();
 		JSONObject json = JSONObject.fromObject(jsonContent);
-		
+
 		List<String> tokenList = new ArrayList<>();
-		
+
 		boolean ispush = false;
 		List<Long> listNotPushId = null;
-		
+
 		Calendar now = Calendar.getInstance();
 		int hour = now.get(Calendar.HOUR_OF_DAY);
 		if (hour >= 8 && hour < 20) {
 			ispush = true; // 鍙帹閫�
-		}  else {
+		} else {
 			listNotPushId = validateNotDisturb();
 		}
-		
+
 		for (DeviceTokenIOS ios : list) {
-			
+
 			if (!StringUtil.isNullOrEmpty(ios.getDeviceToken())) {
 				if (!ispush && listNotPushId != null && listNotPushId.size() > 0) {
 					Long uid = ios.getUid();
 					if (uid != null && listNotPushId.contains(uid)) {
-						continue;  // 閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00) 
+						continue; // 閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00)
 					}
 				}
 				tokenList.add(ios.getDeviceToken());
@@ -564,16 +564,16 @@
 			}
 		}
 	}
-	
+
 	/**
-	 *  閫氱煡鍏嶆墦鎵�(20:00-8:00) 
+	 * 閫氱煡鍏嶆墦鎵�(20:00-8:00)
 	 */
 	public List<Long> validateNotDisturb() {
 		return userCustomSettingsService.getCancelNoticeUsers();
 	}
-	
+
 	/**
-	 *  閫氱煡鍏嶆墦鎵�(20:00-8:00) 
+	 * 閫氱煡鍏嶆墦鎵�(20:00-8:00)
 	 */
 	public boolean validateNotDisturbSingle(Long uid) {
 		Calendar now = Calendar.getInstance();
@@ -582,12 +582,38 @@
 		if (hour >= 8 && hour < 20) {
 			ispush = true; // 鍙帹閫�
 		} else {
-			// 鑷畾涔夎缃�  閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00) 
+			// 鑷畾涔夎缃� 閫氱煡鍏嶆墦鎵�(20:00-24:00 / 00:00 -08:00)
 			ispush = userCustomSettingsService.validateCancelNoticeByUid(uid);
 		}
-		
+
 		return ispush;
 	}
-	
+
+	@Override
+	public void pushWelfareCenter(Long uid, String title, String content) throws PushException {
+		MessageInfo info = new MessageInfo();
+		info.setTitle(title);
+		info.setContent(content);
+		info.setDescription(content);
+		// IOS 鍏ㄦ帹
+		if (uid == null || uid == 0) {
+			addPushIOSQueue(info, "", PushController.WELFARE_CENTER);
+		} else {
+			if (!validateNotDisturbSingle(uid)) {
+				return;
+			}
+			List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid);
+			List<String> deviceTokenList = new ArrayList<>();
+			if (deviceTokenIosList != null)
+				for (DeviceTokenIOS ios : deviceTokenIosList) {
+					deviceTokenList.add(ios.getDeviceToken());
+				}
+			try {
+				IOSPushUtil.allPushIOS(deviceTokenList, info, "", PushController.WELFARE_CENTER);
+			} catch (Exception e) {
+				PushLogHelper.iosError(e);
+			}
+		}
+	}
 
 }

--
Gitblit v1.8.0