From e3732fa01883aa7a93f7398e39b01b0009155b06 Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期四, 14 三月 2019 09:46:36 +0800
Subject: [PATCH] 等级代码调整

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java |   85 ++++++++++++++++++++++++++++++++----------
 1 files changed, 65 insertions(+), 20 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
index 458d1ac..bf8608f 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -1,5 +1,7 @@
 package com.yeshi.fanli.service.impl.push;
 
+import java.util.List;
+
 import javax.annotation.Resource;
 
 import org.springframework.scheduling.annotation.Async;
@@ -22,6 +24,7 @@
 import com.yeshi.fanli.service.inter.user.AccountMessageService;
 import com.yeshi.fanli.service.inter.user.SystemZnxService;
 import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.StringUtil;
 
 @Service
 public class PushServiceImpl implements PushService {
@@ -54,20 +57,24 @@
 
 	@Resource
 	private XMPushService xmPushService;
-	
 
 	@Resource
 	private PushRecordMapper pushRecordMapper;
-	
+
 	@Resource
 	private AccountMessageMapper accountMessageMapper;
-	
-	
+
 	@Async("pushExecutor")
 	@Override
-	public void pushGoods(Long uid, String url, String title, String content) throws PushException {
+	public void pushGoods(Long uid, String url, String title, String content, List<String> listVersion) throws PushException {
 		String gids = url.split("id=")[1];
 		String gid = gids.split("&")[0];
+		if (StringUtil.isNullOrEmpty(gid))
+			throw new PushException(1, "鍟嗗搧瑙f瀽澶辫触");
+		if (StringUtil.isNullOrEmpty(title))
+			throw new PushException(1, "璇峰~鍐欐帹閫佹爣棰�");
+		if (StringUtil.isNullOrEmpty(content))
+			throw new PushException(1, "璇峰~鍐欐帹閫佸唴瀹�"); 
 
 		PushRecord pushRecord = new PushRecord();
 		pushRecord.setState(1);
@@ -76,36 +83,50 @@
 		pushRecord.setTitle(title);
 		pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
 		pushRecord.setAccount(1);
+		pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
 
-		xmPushService.pushGoods(uid, Long.parseLong(gid), title, content);
-		iosPushService.pushGoods(uid, Long.parseLong(gid), title, content);
-		//hwPushService.pushGoods(uid, Long.parseLong(gid), title, content);
+		xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, listVersion);
+		iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, listVersion);
+		// hwPushService.pushGoods(uid, Long.parseLong(gid), title, content);
 
 		pushRecordMapper.insertSelective(pushRecord);
 	}
 
 	@Async("pushExecutor")
 	@Override
-	public void pushUrl(Long uid, String url, String title, String content) throws PushException {
+	public void pushUrl(Long uid, String url, String title, String content, List<String> listVersion) throws PushException {
+
+		if (StringUtil.isNullOrEmpty(url))
+			throw new PushException(1, "鏃犳帹閫侀摼鎺�");
+		if (StringUtil.isNullOrEmpty(title))
+			throw new PushException(1, "鏃犳帹閫佹爣棰�");
+		if (StringUtil.isNullOrEmpty(content))
+			throw new PushException(1, "鏃犳帹閫佸唴瀹�");
+
 		PushRecord pushRecord = new PushRecord();
 		pushRecord.setState(1);
 		pushRecord.setType(PushController.URL);
 		pushRecord.setUrl(url);
 		pushRecord.setTitle(title);
 		pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
+		pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
 
-		xmPushService.pushUrl(uid, url, title, content);
-		iosPushService.pushUrl(uid, url, title, content);
-		hwPushService.pushUrl(uid, url, title, content);
+		xmPushService.pushUrl(uid, url, title, content, listVersion);
+		iosPushService.pushUrl(uid, url, title, content, listVersion);
+		hwPushService.pushUrl(uid, url, title, content, listVersion);
 		pushRecordMapper.insertSelective(pushRecord);
 	}
 
 	@Async("pushExecutor")
 	@Override
-	public void pushZNX(Long uId, String title, String content) throws PushException {
+	public void pushZNX(Long uId, String title, String content, List<String> listVersion) throws PushException {
+		if (StringUtil.isNullOrEmpty(title))
+			throw new PushException(1, "鏃犳帹閫佹爣棰�");
+		if (StringUtil.isNullOrEmpty(content))
+			throw new PushException(1, "鏃犳帹閫佸唴瀹�");
 
 		/* 鏃爑id , 骞挎挱 鏁版嵁鎻掑叆绯荤粺琛� */
-		if (uId == null||uId==0) {
+		if (uId == null || uId == 0) {
 			// 鎻掑叆鏁版嵁搴擄紙绯荤粺绔欏唴淇℃暟鎹級
 			SystemZnx systemZnx = new SystemZnx();
 			systemZnx.setTitle(title);
@@ -118,9 +139,11 @@
 			pushRecord.setState(1); // 鎴愬姛
 			pushRecord.setType(4); // 绫诲瀷锛氱珯鍐呬俊
 			pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
-			xmPushService.pushZNX(uId, null, systemZnx);
-			iosPushService.pushZNX(uId, null, systemZnx);
-			hwPushService.pushZNX(uId, null, systemZnx);
+			pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
+			
+			xmPushService.pushZNX(uId, null, systemZnx, listVersion);
+			iosPushService.pushZNX(uId, null, systemZnx, listVersion);
+			hwPushService.pushZNX(uId, null, systemZnx, listVersion);
 			// 鎻掑叆鎺ㄩ�佽褰�
 			pushRecordMapper.insertSelective(pushRecord);
 		} else {
@@ -132,9 +155,9 @@
 			accountMessage.setContent(content);
 			accountMessageMapper.insertSelective(accountMessage);
 
-			xmPushService.pushZNX(uId, accountMessage, null);
-			iosPushService.pushZNX(uId, accountMessage, null);
-			hwPushService.pushZNX(uId, accountMessage, null);
+			xmPushService.pushZNX(uId, accountMessage, null, listVersion);
+			iosPushService.pushZNX(uId, accountMessage, null, listVersion);
+			hwPushService.pushZNX(uId, accountMessage, null, listVersion);
 
 			// 鎻掑叆鎺ㄩ�佽褰�
 			PushRecord pushRecord = new PushRecord();
@@ -143,9 +166,31 @@
 			pushRecord.setState(1); // 鎴愬姛
 			pushRecord.setType(PushController.ZNX); // 绫诲瀷锛氱珯鍐呬俊
 			pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
+			pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
+			
 			pushRecordMapper.insertSelective(pushRecord);
 		}
 	}
 
+	@Override
+	public void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listVersion) throws PushException {
+		if (StringUtil.isNullOrEmpty(title))
+			throw new PushException(1, "鏃犳帹閫佹爣棰�");
+		if (StringUtil.isNullOrEmpty(content))
+			throw new PushException(1, "鏃犳帹閫佸唴瀹�");
+		iosPushService.pushWEEX(uid, title, content, weexUrl, listVersion);
+	}
+
+	@Override
+	public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listVersion) throws PushException {
+		iosPushService.pushBaiChuanUrl(uid, title, content, url, listVersion);
+		xmPushService.pushBaiChuanUrl(uid, title, content, url, listVersion);
+	}
+
+	@Override
+	public void pushWelfareCenter(Long uid, String title, String content, List<String> listVersion) throws PushException {
+		iosPushService.pushWelfareCenter(uid, title, content, listVersion);
+		xmPushService.pushWelfareCenter(uid, title, content, listVersion);
+	}
 
 }

--
Gitblit v1.8.0