From 553e4585a5ec8e2c22b50e33a27d14ead6fd034d Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期五, 26 四月 2019 15:16:07 +0800
Subject: [PATCH] 店铺足迹删除+ 假删除

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java |   38 +++++++++++++++++++++++++++++---------
 1 files changed, 29 insertions(+), 9 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..e8a7e10 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,14 +1,15 @@
 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;
 
 import javax.annotation.Resource;
-import javax.transaction.Transactional;
 
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import com.yeshi.fanli.dao.mybatis.push.PushCouponMapper;
 import com.yeshi.fanli.entity.push.PushCoupon;
@@ -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