From e257a2834bf7b62af5c5c96f9b0b21fac92f2196 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 24 七月 2021 18:31:02 +0800
Subject: [PATCH] jumpdetail分system

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java |  468 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 330 insertions(+), 138 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 60ed236..914af74 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,10 @@
 package com.yeshi.fanli.service.impl.push;
 
+import com.ks.push.exception.BPushTaskException;
+import com.ks.push.pojo.DO.BPushFilter;
+import com.ks.push.pojo.DO.BPushMessage;
+import com.ks.push.pojo.DO.BPushTask;
+import com.ks.push.service.BPushTaskService;
 import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
 import com.yeshi.fanli.dao.mybatis.push.PushRecordMapper;
 import com.yeshi.fanli.dto.push.PushBaseContent;
@@ -8,28 +13,39 @@
 import com.yeshi.fanli.entity.SystemEnum;
 import com.yeshi.fanli.entity.bus.user.AccountMessage;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
+import com.yeshi.fanli.entity.common.JumpDetailV2;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
 import com.yeshi.fanli.entity.system.SystemZnx;
 import com.yeshi.fanli.entity.xinge.PushRecord;
 import com.yeshi.fanli.exception.push.PushException;
+import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
 import com.yeshi.fanli.service.inter.config.AppVersionService;
+import com.yeshi.fanli.service.inter.config.ConfigService;
 import com.yeshi.fanli.service.inter.config.SystemConfigService;
 import com.yeshi.fanli.service.inter.push.*;
 import com.yeshi.fanli.service.inter.user.SystemZnxService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
+import net.sf.json.JSONObject;
+import org.apache.dubbo.config.annotation.Reference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.List;
+import java.util.*;
 
 @Service
 public class PushServiceImpl implements PushService {
+    Logger logger = LoggerFactory.getLogger(PushService.class);
 
     static String PROJECT_NAME = "";
 
     static {
         PROJECT_NAME = Constant.systemCommonConfig.getProjectChineseName();
     }
+
     @Resource
     private SystemZnxService systemZnxService;
 
@@ -57,9 +73,14 @@
     @Resource
     private AppVersionService appVersionService;
 
+    @Reference(version = "1.0", check = false)
+    private BPushTaskService bPushTaskService;
 
     @Resource
-    private SystemConfigService systemConfigService;
+    private ConfigService configService;
+
+    @Resource
+    private JumpDetailV2Service jumpDetailV2Service;
 
     @Override
     public void pushGoods(Long uid, String title, String content, String url, List<String> listIOS,
@@ -73,45 +94,62 @@
         if (StringUtil.isNullOrEmpty(content))
             throw new PushException(1, "璇峰~鍐欐帹閫佸唴瀹�");
 
-        /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
-        if (listIOS == null || listIOS.size() > 0) {
-            // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
-            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
-            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
-                iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, codes,  system);
+        if (system.isNewPush()) {
+            List<Long> uidList = null;
+            if (uid != null) {
+                uidList = new ArrayList<>();
+                uidList.add(uid);
             }
-        }
-
-        /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
-        if (listAndroid == null || listAndroid.size() > 0) {
-            // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
-            String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
-            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
-                xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, versions,  system);
-            }
-            // 鍗庝负鎺ㄩ��
+            List<Integer> versionCodeList = null;
             if (listAndroid == null || listAndroid.size() > 0) {
-                List<Integer> versionCodeList = null;
                 if (listAndroid != null)
                     versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-                hwPushService.pushGoods(uid, Long.parseLong(gid), new PushBaseContent(title, content, versionCodeList, system));
+            }
+            try {
+                newPush(system, uidList, versionCodeList, null, title, content, NewPushExtraParamsFactory.createGoods(jumpDetailV2Service.getByTypeCache("goodsdetail", system), gid, Constant.SOURCE_TYPE_TAOBAO));
+            } catch (BPushTaskException e) {
+                logger.error("鎺ㄩ��-鍟嗗搧锛歿}", gid, e);
+            }
+        } else {
+            /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+            if (listIOS == null || listIOS.size() > 0) {
+                // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
+                String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
+                if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
+                    iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, codes, system);
+                }
             }
 
-            // OPPO鎺ㄩ��
+            /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
             if (listAndroid == null || listAndroid.size() > 0) {
-                List<Integer> versionCodeList = null;
-                if (listAndroid != null)
-                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-                oPPOPushService.pushGoods(uid, Long.parseLong(gid), new PushBaseContent(title, content, versionCodeList, system));
-            }
-            // VIVO鎺ㄩ��
-            if (listAndroid == null || listAndroid.size() > 0) {
-                List<Integer> versionCodeList = null;
-                if (listAndroid != null)
-                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-                vIVOPushService.pushGoods(uid, Long.parseLong(gid), new PushBaseContent(title, content, versionCodeList, system));
-            }
+                // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
+                String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
+                if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
+                    xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, versions, system);
+                }
+                // 鍗庝负鎺ㄩ��
+                if (listAndroid == null || listAndroid.size() > 0) {
+                    List<Integer> versionCodeList = null;
+                    if (listAndroid != null)
+                        versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                    hwPushService.pushGoods(uid, Long.parseLong(gid), new PushBaseContent(title, content, versionCodeList, system));
+                }
 
+                // OPPO鎺ㄩ��
+                if (listAndroid == null || listAndroid.size() > 0) {
+                    List<Integer> versionCodeList = null;
+                    if (listAndroid != null)
+                        versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                    oPPOPushService.pushGoods(uid, Long.parseLong(gid), new PushBaseContent(title, content, versionCodeList, system));
+                }
+                // VIVO鎺ㄩ��
+                if (listAndroid == null || listAndroid.size() > 0) {
+                    List<Integer> versionCodeList = null;
+                    if (listAndroid != null)
+                        versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                    vIVOPushService.pushGoods(uid, Long.parseLong(gid), new PushBaseContent(title, content, versionCodeList, system));
+                }
+            }
         }
 
         PushRecord pushRecord = new PushRecord();
@@ -137,47 +175,66 @@
         if (StringUtil.isNullOrEmpty(content))
             throw new PushException(1, "鏃犳帹閫佸唴瀹�");
 
-        /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
-        if (listIOS == null || listIOS.size() > 0) {
-            // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
-            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
-            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
-                iosPushService.pushUrl(uid, url, title, content, codes,system);
-            }
-        }
 
-        /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
-        if (listAndroid == null || listAndroid.size() > 0) {
-            // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
-            String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
-            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
-                xmPushService.pushUrl(uid, url, title, content, versions,system);
+        if (system.isNewPush()) {
+            List<Long> uidList = null;
+            if (uid != null) {
+                uidList = new ArrayList<>();
+                uidList.add(uid);
             }
-
-            // 鍗庝负鎺ㄩ��
+            List<Integer> versionCodeList = null;
             if (listAndroid == null || listAndroid.size() > 0) {
-                List<Integer> versionCodeList = null;
                 if (listAndroid != null)
                     versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-                hwPushService.pushUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
+            }
+            try {
+                newPush(system, uidList, versionCodeList, null, title, content, NewPushExtraParamsFactory.createUrl(jumpDetailV2Service.getByTypeCache("web", system), url));
+            } catch (BPushTaskException e) {
+                logger.error("鎺ㄩ��-閾炬帴锛歿}", url, e);
+            }
+        } else {
+
+            /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+            if (listIOS == null || listIOS.size() > 0) {
+                // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
+                String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
+                if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
+                    iosPushService.pushUrl(uid, url, title, content, codes, system);
+                }
             }
 
-            // OPPO鎺ㄩ��
+            /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
             if (listAndroid == null || listAndroid.size() > 0) {
-                List<Integer> versionCodeList = null;
-                if (listAndroid != null)
-                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-                oPPOPushService.pushUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
-            }
+                // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
+                String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
+                if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
+                    xmPushService.pushUrl(uid, url, title, content, versions, system);
+                }
 
-            // VIVO鎺ㄩ��
-            if (listAndroid == null || listAndroid.size() > 0) {
-                List<Integer> versionCodeList = null;
-                if (listAndroid != null)
-                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-                vIVOPushService.pushUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
-            }
+                // 鍗庝负鎺ㄩ��
+                if (listAndroid == null || listAndroid.size() > 0) {
+                    List<Integer> versionCodeList = null;
+                    if (listAndroid != null)
+                        versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                    hwPushService.pushUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
+                }
 
+                // OPPO鎺ㄩ��
+                if (listAndroid == null || listAndroid.size() > 0) {
+                    List<Integer> versionCodeList = null;
+                    if (listAndroid != null)
+                        versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                    oPPOPushService.pushUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
+                }
+
+                // VIVO鎺ㄩ��
+                if (listAndroid == null || listAndroid.size() > 0) {
+                    List<Integer> versionCodeList = null;
+                    if (listAndroid != null)
+                        versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                    vIVOPushService.pushUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
+                }
+            }
         }
 
         PushRecord pushRecord = new PushRecord();
@@ -220,45 +277,64 @@
             accountMessageMapper.insertSelective(accountMessage);
         }
 
-        /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
-        if (listIOS == null || listIOS.size() > 0) {
-            // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
-            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
-            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
-                iosPushService.pushZNX(uId, accountMessage, systemZnx, codes,system);
+        if (system.isNewPush()) {
+            logger.debug("鏂扮増绔欏唴淇℃帹閫佸紑濮嬶細uid-{} title-{} content-{}", new Object[]{uId, title, content});
+            List<Long> uidList = null;
+            if (uId != null) {
+                uidList = new ArrayList<>();
+                uidList.add(uId);
             }
-        }
-
-        /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
-        if (listAndroid == null || listAndroid.size() > 0) {
-            // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
-            String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
-            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
-                xmPushService.pushZNX(uId, accountMessage, systemZnx, versions,system);
-            }
-
-            // 鍗庝负鎺ㄩ��
+            List<Integer> versionCodeList = null;
             if (listAndroid == null || listAndroid.size() > 0) {
-                List<Integer> versionCodeList = null;
                 if (listAndroid != null)
                     versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-                hwPushService.pushZNX(uId, new PushBaseContent(title, content, versionCodeList, system));
+            }
+            try {
+                newPush(system, uidList, versionCodeList, null, title, content, NewPushExtraParamsFactory.createZNX(jumpDetailV2Service.getByTypeCache("system_msg", system)));
+            } catch (BPushTaskException e) {
+                logger.error("鎺ㄩ��-绔欏唴淇★細{}", uId + "", e);
+            }
+        } else {
+            /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+            if (listIOS == null || listIOS.size() > 0) {
+                // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
+                String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
+                if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
+                    iosPushService.pushZNX(uId, accountMessage, systemZnx, codes, system);
+                }
             }
 
-            // OPPO鎺ㄩ��
+            /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
             if (listAndroid == null || listAndroid.size() > 0) {
-                List<Integer> versionCodeList = null;
-                if (listAndroid != null)
-                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-                oPPOPushService.pushZNX(uId, new PushBaseContent(title, content, versionCodeList, system));
-            }
+                // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
+                String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
+                if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
+                    xmPushService.pushZNX(uId, accountMessage, systemZnx, versions, system);
+                }
 
-            // VIVO鎺ㄩ��
-            if (listAndroid == null || listAndroid.size() > 0) {
-                List<Integer> versionCodeList = null;
-                if (listAndroid != null)
-                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-                vIVOPushService.pushZNX(uId, new PushBaseContent(title, content, versionCodeList, system));
+                // 鍗庝负鎺ㄩ��
+                if (listAndroid == null || listAndroid.size() > 0) {
+                    List<Integer> versionCodeList = null;
+                    if (listAndroid != null)
+                        versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                    hwPushService.pushZNX(uId, new PushBaseContent(title, content, versionCodeList, system));
+                }
+
+                // OPPO鎺ㄩ��
+                if (listAndroid == null || listAndroid.size() > 0) {
+                    List<Integer> versionCodeList = null;
+                    if (listAndroid != null)
+                        versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                    oPPOPushService.pushZNX(uId, new PushBaseContent(title, content, versionCodeList, system));
+                }
+
+                // VIVO鎺ㄩ��
+                if (listAndroid == null || listAndroid.size() > 0) {
+                    List<Integer> versionCodeList = null;
+                    if (listAndroid != null)
+                        versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                    vIVOPushService.pushZNX(uId, new PushBaseContent(title, content, versionCodeList, system));
+                }
             }
         }
 
@@ -288,7 +364,7 @@
             // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
             String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
             if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
-                iosPushService.pushWEEX(uid, title, content, weexUrl, codes,system);
+                iosPushService.pushWEEX(uid, title, content, weexUrl, codes, system);
             }
         }
 
@@ -297,7 +373,7 @@
             // 闄愬埗鎺ㄩ�佺増鏈彿锛�31
             String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
             if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
-                xmPushService.pushWEEX(uid, title, content, weexUrl, versions,system);
+                xmPushService.pushWEEX(uid, title, content, weexUrl, versions, system);
             }
         }
 
@@ -345,48 +421,67 @@
         if (StringUtil.isNullOrEmpty(content))
             throw new PushException(1, "鏃犳帹閫佸唴瀹�");
 
-        // 閫傜敤鐗堟湰 1.4.8鍙婁互鍚� 鎺ㄩ�佺櫨宸濈綉椤�
-
-        /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
-        if (listIOS == null || listIOS.size() > 0) {
-            // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
-            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
-            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
-                iosPushService.pushBaiChuanUrl(uid, title, content, url, codes,system);
+        if (system.isNewPush()) {
+            List<Long> uidList = null;
+            if (uid != null) {
+                uidList = new ArrayList<>();
+                uidList.add(uid);
             }
-        }
-
-        /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
-        if (listAndroid == null || listAndroid.size() > 0) {
-            // 闄愬埗鎺ㄩ�佺増鏈彿锛�31
-            String versions = getEffectiveVersions(31, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
-            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
-                xmPushService.pushBaiChuanUrl(uid, title, content, url, versions,system);
+            List<Integer> versionCodeList = null;
+            if (listAndroid == null || listAndroid.size() > 0) {
+                if (listAndroid != null)
+                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
             }
-        }
+            try {
+                newPush(system, uidList, versionCodeList, null, title, content, NewPushExtraParamsFactory.createBaichuan(jumpDetailV2Service.getByTypeCache("system_msg", system), url));
+            } catch (BPushTaskException e) {
+                logger.error("鎺ㄩ��-鐧惧窛锛歿}", url, e);
+            }
+        } else {
 
-        // 鍗庝负鎺ㄩ��
-        if (listAndroid == null || listAndroid.size() > 0) {
-            List<Integer> versionCodeList = null;
-            if (listAndroid != null)
-                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-            hwPushService.pushBaiChuanUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
-        }
+            // 閫傜敤鐗堟湰 1.4.8鍙婁互鍚� 鎺ㄩ�佺櫨宸濈綉椤�
 
-        // OPPO鎺ㄩ��
-        if (listAndroid == null || listAndroid.size() > 0) {
-            List<Integer> versionCodeList = null;
-            if (listAndroid != null)
-                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-            oPPOPushService.pushBaiChuanUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
-        }
+            /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+            if (listIOS == null || listIOS.size() > 0) {
+                // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
+                String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
+                if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
+                    iosPushService.pushBaiChuanUrl(uid, title, content, url, codes, system);
+                }
+            }
 
-        // VIVO鎺ㄩ��
-        if (listAndroid == null || listAndroid.size() > 0) {
-            List<Integer> versionCodeList = null;
-            if (listAndroid != null)
-                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
-            vIVOPushService.pushBaiChuanUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
+            /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+            if (listAndroid == null || listAndroid.size() > 0) {
+                // 闄愬埗鎺ㄩ�佺増鏈彿锛�31
+                String versions = getEffectiveVersions(31, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
+                if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
+                    xmPushService.pushBaiChuanUrl(uid, title, content, url, versions, system);
+                }
+            }
+
+            // 鍗庝负鎺ㄩ��
+            if (listAndroid == null || listAndroid.size() > 0) {
+                List<Integer> versionCodeList = null;
+                if (listAndroid != null)
+                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                hwPushService.pushBaiChuanUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
+            }
+
+            // OPPO鎺ㄩ��
+            if (listAndroid == null || listAndroid.size() > 0) {
+                List<Integer> versionCodeList = null;
+                if (listAndroid != null)
+                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                oPPOPushService.pushBaiChuanUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
+            }
+
+            // VIVO鎺ㄩ��
+            if (listAndroid == null || listAndroid.size() > 0) {
+                List<Integer> versionCodeList = null;
+                if (listAndroid != null)
+                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+                vIVOPushService.pushBaiChuanUrl(uid, url, new PushBaseContent(title, content, versionCodeList, system));
+            }
         }
 
         // 鎻掑叆鎺ㄩ�佽褰�
@@ -415,7 +510,7 @@
             // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
             String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
             if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
-                iosPushService.pushWelfareCenter(uid, title, content, codes,system);
+                iosPushService.pushWelfareCenter(uid, title, content, codes, system);
             }
         }
 
@@ -424,7 +519,7 @@
             // 闄愬埗鎺ㄩ�佺増鏈彿锛�36
             String versions = getEffectiveVersions(36, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
             if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
-                xmPushService.pushWelfareCenter(uid, title, content, versions,system);
+                xmPushService.pushWelfareCenter(uid, title, content, versions, system);
             }
         }
 
@@ -554,7 +649,7 @@
             // 闄愬埗鎺ㄩ�佺増鏈彿锛�1.6.5浠ュ悗
             String codes = getEffectiveVersionCodes(60, AppVersionInfo.PLATFORM_IOS, listIOS, system);
             if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
-                iosPushService.pushUserSignInNotification(uid, title, content, codes,system);
+                iosPushService.pushUserSignInNotification(uid, title, content, codes, system);
             }
         }
 
@@ -563,7 +658,7 @@
             // 闄愬埗鎺ㄩ�佺増鏈彿锛�1.6.5浠ュ悗
             String versions = getEffectiveVersions(47, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
             if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
-                xmPushService.pushUserSignInNotification(uid, title, content, versions,system);
+                xmPushService.pushUserSignInNotification(uid, title, content, versions, system);
             }
         }
 
@@ -602,4 +697,101 @@
         pushRecordMapper.insertSelective(pushRecord);
     }
 
+    private void newPush(SystemEnum system, List<Long> uidList, List<Integer> versionCodeList, Date startPushTime, String title, String content, Map<String, String> params) throws BPushTaskException {
+
+        logger.debug("鏂扮増鎺ㄩ�佸紑濮嬶細title-{} content-{}", new Object[]{title, content});
+        //鐏板害娴嬭瘯
+        if (uidList == null || uidList.size() == 0 || uidList.size() > 1)
+            return;
+        Set<Long> uidSet = new HashSet<>();
+        uidSet.add(6857703L);
+        uidSet.add(6845887L);
+
+        if (!uidSet.contains(uidList.get(0))) {
+            return;
+        }
+
+        logger.debug("鏂扮増鎺ㄩ�佺伆搴︽祴璇曞紑濮嬶細title-{} content-{}", new Object[]{title, content});
+
+
+        BPushFilter filter = new BPushFilter();
+        //璁剧疆鐢ㄦ埛淇℃伅
+        List<String> uidStrList = null;
+        if (uidList != null && uidList.size() > 0) {
+            uidStrList = new ArrayList<>();
+            for (Long uid : uidList) {
+                uidStrList.add(uid + "");
+            }
+        }
+        filter.setUidList(uidStrList);
+        filter.setVersionCodeList(versionCodeList);
+        //榛樿鎺ㄩ�佹渶杩戜袱涓湀鐨勬椿璺冪敤鎴�
+        filter.setMinActiveTime(new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 60));
+        filter.setStartPushTime(startPushTime);
+
+        BPushMessage message = new BPushMessage();
+        message.setAndroidActivityScheme(configService.getValue(ConfigKeyEnum.pushAndroidActivityScheme, system));
+        message.setAndroidActivity(configService.getValue(ConfigKeyEnum.pushAndroidActivity, system));
+        message.setAndroidHostPath(configService.getValue(ConfigKeyEnum.pushAndroidHostPath, system));
+        message.setTitle(title);
+        message.setContent(content);
+
+        message.setExtras(params);
+        BPushTask pushTask = new BPushTask();
+        pushTask.setFilter(filter);
+        pushTask.setAppCode(system.name());
+        pushTask.setMessage(message);
+        String taskId = bPushTaskService.createTask(pushTask);
+        if (startPushTime == null) {
+            bPushTaskService.startPush(taskId);
+        }
+
+        logger.debug("鏂扮増鎺ㄩ�佺伆搴︽祴璇曠粨鏉燂細title-{} content-{}", new Object[]{title, content});
+    }
+
+    private static class NewPushExtraParamsFactory {
+
+        public static Map<String, String> createCommon(JumpDetailV2 jumpDetail, JSONObject cps) {
+            Map<String, String> params = new HashMap<>();
+            params.put("activity", jumpDetail.getActivity());
+            params.put("type", jumpDetail.getType());
+            params.put("controller", jumpDetail.getController());
+            if (cps != null)
+                params.put("params", cps.toString());
+            return params;
+        }
+
+        //鍗曞搧鎺ㄩ��
+        public static Map<String, String> createGoods(JumpDetailV2 jumpDetail, String goodsId, Integer goodsType) {
+            JSONObject cps = new JSONObject();
+            cps.put("goodsId", goodsId);
+            cps.put("goodsType", goodsType);
+            cps.put("from", "push");
+            return createCommon(jumpDetail, cps);
+        }
+
+        //绔欏唴淇�
+        public static Map<String, String> createZNX(JumpDetailV2 jumpDetail) {
+            return createCommon(jumpDetail, null);
+        }
+
+        //鎺ㄩ�侀摼鎺�
+        public static Map<String, String> createUrl(JumpDetailV2 jumpDetail, String url) {
+            JSONObject cps = new JSONObject();
+            cps.put("url", url);
+            cps.put("from", "push");
+            return createCommon(jumpDetail, cps);
+        }
+
+        //鎺ㄩ�佺櫨宸濋摼鎺�
+        public static Map<String, String> createBaichuan(JumpDetailV2 jumpDetail, String url) {
+            JSONObject cps = new JSONObject();
+            cps.put("url", url);
+            cps.put("from", "push");
+            return createCommon(jumpDetail, cps);
+        }
+
+
+    }
+
 }

--
Gitblit v1.8.0