From 39d967a45c6b9834e943e670e8d8ea15b505beb1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 19 三月 2019 18:29:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java |   36 ++++++++++++++++++++++++++++--------
 1 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java
index bb45644..201eb00 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java
@@ -1,6 +1,7 @@
 package com.yeshi.fanli.service.impl.push;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
@@ -18,6 +19,8 @@
 import com.yeshi.fanli.service.inter.push.PushCouponRecordService;
 import com.yeshi.fanli.service.inter.push.PushCouponService;
 import com.yeshi.fanli.service.inter.push.PushService;
+
+import net.sf.json.JSONObject;
 
 @Service
 public class PushCouponServiceImpl implements PushCouponService {
@@ -153,6 +156,10 @@
 		if(pushCoupon.isPushed()) {
 			throw new PushCouponException(1, "璇ヤ俊鎭笉鑳介噸澶嶆帹閫�");
 		}
+		String versions = pushCoupon.getVersions();
+		if (versions == null || versions.trim().length() == 0 ) {
+			throw new PushCouponException(1, "鎺ㄩ�佺増鏈笉鑳戒负绌�");
+		}
 		
 
 		String title = pushCoupon.getTitle();
@@ -171,24 +178,37 @@
 			}
 		}
 		
-		List<String> listVersion = null;
-		String versions = pushCoupon.getVersions();
-		if (versions != null && versions.trim().length() > 0) {
-			listVersion  = Arrays.asList(versions.split(","));
-			if (listVersion == null || listVersion.size() == 0) {
-				throw new PushCouponException(1, "鐗堟湰鍙锋牸寮忎笉姝g‘\"");
+		List<String> listIOS = new ArrayList<String>();
+		JSONObject json = JSONObject.fromObject(versions);
+		String versionsIOS = json.getString("IOS");
+		if (versionsIOS != null && versionsIOS.trim().length() > 0) {
+			if (versionsIOS.contains("鍏ㄦ帹")) {
+				listIOS = null;
+			} else {
+				listIOS = Arrays.asList(versionsIOS.split(","));
 			}
 		}
 		
+		List<String> listAndroid = new ArrayList<String>();
+		String versionsAndroid  = json.getString("Android");
+		if (versionsAndroid != null && versionsAndroid.trim().length() > 0) {
+			if (versionsAndroid.contains("鍏ㄦ帹")) {
+				listAndroid = null;
+			} else {
+				listAndroid = Arrays.asList(versionsAndroid.split(","));
+			}
+		}
+		
+		
 		if (listuid == null) {
 			// 鍏ㄦ帹
-			pushService.pushWelfareCenter(null, title, content, listVersion);
+			pushService.pushWelfareCenter(null, title, content, listIOS, listAndroid);
 			
 		} else {
 			// 鎸囧畾鐢ㄦ埛鎺ㄩ��
 			for (String str_uid: listuid) {
 				if (str_uid != null && str_uid.trim().length() > 0) {
-					pushService.pushWelfareCenter(Long.parseLong(str_uid), title, content, listVersion);
+					pushService.pushWelfareCenter(Long.parseLong(str_uid), title, content, listIOS, listAndroid);
 				}
 			}
 		}

--
Gitblit v1.8.0