From c9cbad5f5d18c6b2ac5a063e41007933d7028329 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 07 七月 2020 15:24:17 +0800
Subject: [PATCH] 返利配置文件加入系统区分
---
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java | 945 +++++++++++++++++++++++++++++++++--------------------------
1 files changed, 528 insertions(+), 417 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 fa34d15..6aba1ce 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,498 +1,609 @@
package com.yeshi.fanli.service.impl.push;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
-
-import com.yeshi.fanli.controller.admin.PushController;
import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
import com.yeshi.fanli.dao.mybatis.push.PushRecordMapper;
+import com.yeshi.fanli.dto.push.PushBaseContent;
import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.entity.AppVersionInfo;
+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.system.SystemZnx;
import com.yeshi.fanli.entity.xinge.PushRecord;
-import com.yeshi.fanli.exception.PushException;
+import com.yeshi.fanli.exception.push.PushException;
import com.yeshi.fanli.service.inter.config.AppVersionService;
-import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
-import com.yeshi.fanli.service.inter.push.HWPushService;
-import com.yeshi.fanli.service.inter.push.IOSPushService;
-import com.yeshi.fanli.service.inter.push.PushRecordService;
-import com.yeshi.fanli.service.inter.push.PushService;
-import com.yeshi.fanli.service.inter.push.XMPushService;
+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 org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
@Service
public class PushServiceImpl implements PushService {
- static String IOSBundleId = "";
- static String PROJECT_NAME = "";
+ static String IOSBundleId = "";
+ static String PROJECT_NAME = "";
- static {
- IOSBundleId = Constant.systemCommonConfig.getIosBundleId();
- PROJECT_NAME = Constant.systemCommonConfig.getProjectChineseName();
- }
+ static {
+ IOSBundleId = Constant.systemCommonConfig.getIosBundleId();
+ PROJECT_NAME = Constant.systemCommonConfig.getProjectChineseName();
+ }
- @Resource
- private PushRecordService pushRecordService;
+ @Resource
+ private PushRecordService pushRecordService;
- @Resource
- private SystemZnxService systemZnxService;
+ @Resource
+ private SystemZnxService systemZnxService;
- @Resource
- private DeviceTokenHWService deviceTokenHWService;
+ @Resource
+ private DeviceTokenHWService deviceTokenHWService;
- @Resource
- private IOSPushService iosPushService;
+ @Resource
+ private IOSPushService iosPushService;
- @Resource
- private HWPushService hwPushService;
+ @Resource
+ private HWPushService hwPushService;
- @Resource
- private XMPushService xmPushService;
+ @Resource
+ private XMPushService xmPushService;
- @Resource
- private PushRecordMapper pushRecordMapper;
+ @Resource
+ private OPPOPushService oPPOPushService;
- @Resource
- private AccountMessageMapper accountMessageMapper;
+ @Resource
+ private VIVOPushService vIVOPushService;
- @Resource
- private AppVersionService appVersionService;
+ @Resource
+ private PushRecordMapper pushRecordMapper;
- @Override
- public void pushGoods(Long uid, String title, String content, String url, List<String> listIOS,
- List<String> listAndroid) 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, "璇峰~鍐欐帹閫佸唴瀹�");
+ @Resource
+ private AccountMessageMapper accountMessageMapper;
- /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listIOS == null || listIOS.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
- String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
- if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
- iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, codes);
- }
- }
+ @Resource
+ private AppVersionService appVersionService;
- /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listAndroid == null || listAndroid.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
- String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
- if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
- xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, versions);
- }
- // 鍗庝负鎺ㄩ��
- if (listAndroid == null || listAndroid.size() > 0) {
- List<Integer> versionCodeList = null;
- if (listAndroid != null)
- versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
- hwPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
- }
- }
+ @Override
+ public void pushGoods(Long uid, String title, String content, String url, List<String> listIOS,
+ List<String> listAndroid, SystemEnum system) 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.setUid(uid);
- pushRecord.setState(1);
- pushRecord.setType(PushTypeEnum.goodsdetail.getCode()); // 閮芥垚鍔�
- pushRecord.setUrl(url);
- pushRecord.setTitle(title);
- pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
- pushRecord.setAccount(1);
- pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
- pushRecordMapper.insertSelective(pushRecord);
- }
+ /* 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);
+ }
+ }
- @Override
- public void pushUrl(Long uid, String title, String content, String url, List<String> listIOS,
- List<String> listAndroid) throws PushException {
+ /* 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);
+ }
+ // 鍗庝负鎺ㄩ��
+ 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));
+ }
- if (StringUtil.isNullOrEmpty(url))
- throw new PushException(1, "鏃犳帹閫侀摼鎺�");
- if (StringUtil.isNullOrEmpty(title))
- throw new PushException(1, "鏃犳帹閫佹爣棰�");
- if (StringUtil.isNullOrEmpty(content))
- throw new PushException(1, "鏃犳帹閫佸唴瀹�");
+ // 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));
+ }
- /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listIOS == null || listIOS.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
- String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
- if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
- iosPushService.pushUrl(uid, url, title, content, codes);
- }
- }
+ }
- /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listAndroid == null || listAndroid.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
- String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
- if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
- xmPushService.pushUrl(uid, url, title, content, versions);
- }
+ PushRecord pushRecord = new PushRecord();
+ pushRecord.setUid(uid);
+ pushRecord.setState(1);
+ pushRecord.setType(PushTypeEnum.goodsdetail.getCode()); // 閮芥垚鍔�
+ pushRecord.setUrl(url);
+ pushRecord.setTitle(title);
+ pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
+ pushRecord.setAccount(1);
+ pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
+ pushRecordMapper.insertSelective(pushRecord);
+ }
- // 鍗庝负鎺ㄩ��
- if (listAndroid == null || listAndroid.size() > 0) {
- List<Integer> versionCodeList = null;
- if (listAndroid != null)
- versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
- hwPushService.pushUrl(uid, url, title, content, versionCodeList);
- }
- }
+ @Override
+ public void pushUrl(Long uid, String title, String content, String url, List<String> listIOS,
+ List<String> listAndroid, SystemEnum system) throws PushException {
- PushRecord pushRecord = new PushRecord();
- pushRecord.setUid(uid);
- pushRecord.setState(1);
- pushRecord.setType(PushTypeEnum.url.getCode());
- pushRecord.setUrl(url);
- pushRecord.setTitle(title);
- pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
- pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
- pushRecordMapper.insertSelective(pushRecord);
- }
+ if (StringUtil.isNullOrEmpty(url))
+ throw new PushException(1, "鏃犳帹閫侀摼鎺�");
+ if (StringUtil.isNullOrEmpty(title))
+ throw new PushException(1, "鏃犳帹閫佹爣棰�");
+ if (StringUtil.isNullOrEmpty(content))
+ throw new PushException(1, "鏃犳帹閫佸唴瀹�");
- @Override
- public void pushZNX(Long uId, String title, String content, List<String> listIOS, List<String> listAndroid)
- throws PushException {
- if (StringUtil.isNullOrEmpty(title))
- throw new PushException(1, "鏃犳帹閫佹爣棰�");
- 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);
+ }
+ }
- SystemZnx systemZnx = null;
- AccountMessage accountMessage = null;
+ /* 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);
+ }
- /* 鏃爑id , 骞挎挱 鏁版嵁鎻掑叆绯荤粺琛� */
- if (uId == null || uId == 0) {
- // 鎻掑叆鏁版嵁搴擄紙绯荤粺绔欏唴淇℃暟鎹級
- systemZnx = new SystemZnx();
- systemZnx.setTitle(title);
- systemZnx.setContent(content);
- systemZnx.setCreateTime(System.currentTimeMillis());
- systemZnxService.save(systemZnx);
- } else {
- accountMessage = new AccountMessage();
- accountMessage.setCreateTime(System.currentTimeMillis());
- accountMessage.setIsOpen(false);
- accountMessage.setUserInfo(new UserInfo(uId));
- accountMessage.setTitle(title);
- accountMessage.setContent(content);
- accountMessageMapper.insertSelective(accountMessage);
- }
+ // 鍗庝负鎺ㄩ��
+ 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));
+ }
- /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listIOS == null || listIOS.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
- String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
- if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
- iosPushService.pushZNX(uId, accountMessage, systemZnx, codes);
- }
- }
+ // 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));
+ }
- /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listAndroid == null || listAndroid.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
- String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
- if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
- xmPushService.pushZNX(uId, accountMessage, systemZnx, versions);
- }
+ // 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);
- hwPushService.pushZNX(uId, title, content, versionCodeList);
- }
- }
+ }
- // 鎻掑叆鎺ㄩ�佽褰�
- PushRecord pushRecord = new PushRecord();
- pushRecord.setUid(uId);
- pushRecord.setTitle(title);
- pushRecord.setState(1); // 鎴愬姛
- pushRecord.setType(PushTypeEnum.ZNX.getCode()); // 绫诲瀷锛氱珯鍐呬俊
- pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
- pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
- pushRecordMapper.insertSelective(pushRecord);
- }
+ PushRecord pushRecord = new PushRecord();
+ pushRecord.setUid(uid);
+ pushRecord.setState(1);
+ pushRecord.setType(PushTypeEnum.url.getCode());
+ pushRecord.setUrl(url);
+ pushRecord.setTitle(title);
+ 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> listIOS,
- List<String> listAndroid) throws PushException {
- if (StringUtil.isNullOrEmpty(title))
- throw new PushException(1, "鏃犳帹閫佹爣棰�");
- if (StringUtil.isNullOrEmpty(content))
- throw new PushException(1, "鏃犳帹閫佸唴瀹�");
+ @Override
+ public void pushZNX(Long uId, String title, String content, List<String> listIOS, List<String> listAndroid, SystemEnum system)
+ throws PushException {
+ if (StringUtil.isNullOrEmpty(title))
+ throw new PushException(1, "鏃犳帹閫佹爣棰�");
+ if (StringUtil.isNullOrEmpty(content))
+ throw new PushException(1, "鏃犳帹閫佸唴瀹�");
- // 閫傜敤鐗堟湰 1.4.8鍙婁互鍚� 鎺ㄩ�亀eex椤甸潰
+ SystemZnx systemZnx = null;
+ AccountMessage accountMessage = null;
- /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listIOS == null || listIOS.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
- String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
- if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
- iosPushService.pushWEEX(uid, title, content, weexUrl, codes);
- }
- }
+ /* 鏃爑id , 骞挎挱 鏁版嵁鎻掑叆绯荤粺琛� */
+ if (uId == null || uId == 0) {
+ // 鎻掑叆鏁版嵁搴擄紙绯荤粺绔欏唴淇℃暟鎹級
+ systemZnx = new SystemZnx();
+ systemZnx.setTitle(title);
+ systemZnx.setContent(content);
+ systemZnx.setCreateTime(System.currentTimeMillis());
+ systemZnxService.save(systemZnx);
+ } else {
+ accountMessage = new AccountMessage();
+ accountMessage.setCreateTime(System.currentTimeMillis());
+ accountMessage.setIsOpen(false);
+ accountMessage.setUserInfo(new UserInfo(uId));
+ accountMessage.setTitle(title);
+ accountMessage.setContent(content);
+ accountMessageMapper.insertSelective(accountMessage);
+ }
- /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listAndroid == null || listAndroid.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�31
- String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
- if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
- xmPushService.pushWEEX(uid, title, content, weexUrl, versions);
- }
- }
+ /* 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);
+ }
+ }
- // 鍗庝负鎺ㄩ��
- if (listAndroid == null || listAndroid.size() > 0) {
- List<Integer> versionCodeList = null;
- if (listAndroid != null)
- versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
- hwPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
- }
+ /* 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);
+ }
- // 鎻掑叆鎺ㄩ�佽褰�
- PushRecord pushRecord = new PushRecord();
- pushRecord.setTitle(title);
- pushRecord.setUid(uid);
- pushRecord.setState(1); // 鎴愬姛
- pushRecord.setType(PushTypeEnum.weex.getCode()); // 绫诲瀷锛歐EEX
- pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
- pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
- pushRecordMapper.insertSelective(pushRecord);
- }
+ // 鍗庝负鎺ㄩ��
+ 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));
+ }
- @Override
- public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listIOS,
- List<String> listAndroid) throws PushException {
+ // 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));
+ }
- if (StringUtil.isNullOrEmpty(title))
- throw new PushException(1, "鏃犳帹閫佹爣棰�");
- if (StringUtil.isNullOrEmpty(content))
- throw new PushException(1, "鏃犳帹閫佸唴瀹�");
+ // 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));
+ }
+ }
- // 閫傜敤鐗堟湰 1.4.8鍙婁互鍚� 鎺ㄩ�佺櫨宸濈綉椤�
+ // 鎻掑叆鎺ㄩ�佽褰�
+ PushRecord pushRecord = new PushRecord();
+ pushRecord.setUid(uId);
+ pushRecord.setTitle(title);
+ pushRecord.setState(1); // 鎴愬姛
+ pushRecord.setType(PushTypeEnum.ZNX.getCode()); // 绫诲瀷锛氱珯鍐呬俊
+ pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
+ pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
+ pushRecordMapper.insertSelective(pushRecord);
+ }
- /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listIOS == null || listIOS.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�0
- String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
- if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
- iosPushService.pushBaiChuanUrl(uid, title, content, url, codes);
- }
- }
+ @Override
+ public void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listIOS,
+ List<String> listAndroid, SystemEnum system) throws PushException {
+ if (StringUtil.isNullOrEmpty(title))
+ throw new PushException(1, "鏃犳帹閫佹爣棰�");
+ if (StringUtil.isNullOrEmpty(content))
+ throw new PushException(1, "鏃犳帹閫佸唴瀹�");
- /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listAndroid == null || listAndroid.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�31
- String versions = getEffectiveVersions(31, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
- if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
- xmPushService.pushBaiChuanUrl(uid, title, content, url, versions);
- }
- }
+ // 閫傜敤鐗堟湰 1.4.8鍙婁互鍚� 鎺ㄩ�亀eex椤甸潰
- // 鍗庝负鎺ㄩ��
- if (listAndroid == null || listAndroid.size() > 0) {
- List<Integer> versionCodeList = null;
- if (listAndroid != null)
- versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
- hwPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
- }
+ /* 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.pushWEEX(uid, title, content, weexUrl, codes);
+ }
+ }
- // 鎻掑叆鎺ㄩ�佽褰�
- PushRecord pushRecord = new PushRecord();
- pushRecord.setUrl(url);
- pushRecord.setTitle(title);
- pushRecord.setUid(uid);
- pushRecord.setState(1); // 鎴愬姛
- pushRecord.setType(PushTypeEnum.baichuan.getCode()); // 绫诲瀷锛氱櫨宸�
- pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
- pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
- pushRecordMapper.insertSelective(pushRecord);
- }
+ /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+ if (listAndroid == null || listAndroid.size() > 0) {
+ // 闄愬埗鎺ㄩ�佺増鏈彿锛�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);
+ }
+ }
- @Override
- public void pushWelfareCenter(Long uid, String title, String content, List<String> listIOS,
- List<String> listAndroid) throws PushException {
+ // 鍗庝负鎺ㄩ��
+ if (listAndroid == null || listAndroid.size() > 0) {
+ List<Integer> versionCodeList = null;
+ if (listAndroid != null)
+ versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+ hwPushService.pushWEEX(uid, weexUrl, new PushBaseContent(title, content, versionCodeList, system));
+ }
- if (StringUtil.isNullOrEmpty(title))
- throw new PushException(1, "鏃犳帹閫佹爣棰�");
- if (StringUtil.isNullOrEmpty(content))
- throw new PushException(1, "鏃犳帹閫佸唴瀹�");
+ // OPPO鎺ㄩ��
+ if (listAndroid == null || listAndroid.size() > 0) {
+ List<Integer> versionCodeList = null;
+ if (listAndroid != null)
+ versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+ oPPOPushService.pushWEEX(uid, weexUrl, 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);
- if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
- iosPushService.pushWelfareCenter(uid, title, content, codes);
- }
- }
+ // VIVO鎺ㄩ��
+ if (listAndroid == null || listAndroid.size() > 0) {
+ List<Integer> versionCodeList = null;
+ if (listAndroid != null)
+ versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+ vIVOPushService.pushWEEX(uid, weexUrl, new PushBaseContent(title, content, versionCodeList, system));
+ }
- /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listAndroid == null || listAndroid.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�36
- String versions = getEffectiveVersions(36, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
- if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
- xmPushService.pushWelfareCenter(uid, title, content, versions);
- }
- }
+ // 鎻掑叆鎺ㄩ�佽褰�
+ PushRecord pushRecord = new PushRecord();
+ pushRecord.setTitle(title);
+ pushRecord.setUid(uid);
+ pushRecord.setState(1); // 鎴愬姛
+ pushRecord.setType(PushTypeEnum.weex.getCode()); // 绫诲瀷锛歐EEX
+ pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
+ pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
+ pushRecordMapper.insertSelective(pushRecord);
+ }
- // 鍗庝负鎺ㄩ��
- if (listAndroid == null || listAndroid.size() > 0) {
- List<Integer> versionCodeList = null;
- if (listAndroid != null)
- versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
- hwPushService.pushWelfareCenter(uid, title, content, versionCodeList);
- }
+ @Override
+ public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listIOS,
+ List<String> listAndroid, SystemEnum system) throws PushException {
- // 鎻掑叆鎺ㄩ�佽褰�
- PushRecord pushRecord = new PushRecord();
- pushRecord.setTitle(title);
- pushRecord.setUid(uid);
- pushRecord.setState(1); // 鎴愬姛
- pushRecord.setType(PushTypeEnum.welfare.getCode()); // 绫诲瀷锛氱櫨宸�
- pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
- pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
- pushRecordMapper.insertSelective(pushRecord);
- }
+ if (StringUtil.isNullOrEmpty(title))
+ throw new PushException(1, "鏃犳帹閫佹爣棰�");
+ if (StringUtil.isNullOrEmpty(content))
+ throw new PushException(1, "鏃犳帹閫佸唴瀹�");
- /**
- * 鏌ヨ鑳芥帹閫佺増鏈彿
- *
- * @param versionCode
- * @param listVersion
- * @return
- */
- private String getEffectiveVersions(int minCode, String type, List<String> listVersion) throws PushException {
+ // 閫傜敤鐗堟湰 1.4.8鍙婁互鍚� 鎺ㄩ�佺櫨宸濈綉椤�
- if (minCode == 0 && listVersion == null) {
- return null;
- }
+ /* 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);
+ }
+ }
- String versions = "";
- if (listVersion == null) {
- List<AppVersionInfo> list = appVersionService.listByPlatformAndMinVersionCode(type, minCode);
- if (list != null) {
- for (AppVersionInfo appVersion : list) {
- versions += appVersion.getVersion() + ",";
- }
- }
- } else {
- List<AppVersionInfo> list = appVersionService.listByVersions(type, listVersion);
- if (list != null) {
- for (AppVersionInfo appVersion : list) {
- Integer code = appVersion.getVersionCode();
- if (code != null && code >= minCode) {
- versions += appVersion.getVersion() + ",";
- }
- }
- }
- }
+ /* 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);
+ }
+ }
- if (versions.endsWith(",")) {
- versions = versions.substring(0, versions.length() - 1);
- }
+ // 鍗庝负鎺ㄩ��
+ 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));
+ }
- return versions;
- }
+ // 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));
+ }
- /**
- * 鏌ヨ鑳芥帹閫佺増鏈彿code
- *
- * @param versionCode
- * @param listVersion
- * @return
- */
- private String getEffectiveVersionCodes(int minCode, String type, List<String> listVersion) throws PushException {
+ // 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));
+ }
- if (minCode == 0 && listVersion == null) {
- return null;
- }
+ // 鎻掑叆鎺ㄩ�佽褰�
+ PushRecord pushRecord = new PushRecord();
+ pushRecord.setUrl(url);
+ pushRecord.setTitle(title);
+ pushRecord.setUid(uid);
+ pushRecord.setState(1); // 鎴愬姛
+ pushRecord.setType(PushTypeEnum.baichuan.getCode()); // 绫诲瀷锛氱櫨宸�
+ pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
+ pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
+ pushRecordMapper.insertSelective(pushRecord);
+ }
- String versionCodes = "";
- if (listVersion == null) {
- List<AppVersionInfo> list = appVersionService.listByPlatformAndMinVersionCode(type, minCode);
- if (list != null) {
- for (AppVersionInfo appVersion : list) {
- versionCodes += appVersion.getVersionCode() + ",";
- }
- }
- } else {
- List<AppVersionInfo> list = appVersionService.listByVersions(type, listVersion);
- if (list != null) {
- for (AppVersionInfo appVersion : list) {
- Integer code = appVersion.getVersionCode();
- if (code != null && code >= minCode) {
- versionCodes += appVersion.getVersionCode() + ",";
- }
- }
- }
- }
+ @Override
+ public void pushWelfareCenter(Long uid, String title, String content, List<String> listIOS,
+ List<String> listAndroid, SystemEnum system) throws PushException {
- if (versionCodes.endsWith(",")) {
- versionCodes = versionCodes.substring(0, versionCodes.length() - 1);
- }
+ if (StringUtil.isNullOrEmpty(title))
+ throw new PushException(1, "鏃犳帹閫佹爣棰�");
+ if (StringUtil.isNullOrEmpty(content))
+ throw new PushException(1, "鏃犳帹閫佸唴瀹�");
- return versionCodes;
- }
+ /* 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.pushWelfareCenter(uid, title, content, codes);
+ }
+ }
- @Override
- public void pushUserSignInNotification(Long uid, String title, String content, List<String> listIOS,
- List<String> listAndroid) throws PushException {
- if (StringUtil.isNullOrEmpty(title))
- throw new PushException(1, "鏃犳帹閫佹爣棰�");
- if (StringUtil.isNullOrEmpty(content))
- throw new PushException(1, "鏃犳帹閫佸唴瀹�");
+ /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+ if (listAndroid == null || listAndroid.size() > 0) {
+ // 闄愬埗鎺ㄩ�佺増鏈彿锛�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);
+ }
+ }
- /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listIOS == null || listIOS.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�1.6.5浠ュ悗
- String codes = getEffectiveVersionCodes(60, AppVersionInfo.PLATFORM_IOS, listIOS);
- if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
- iosPushService.pushUserSignInNotification(uid, title, content, codes);
- }
- }
+ // 鍗庝负鎺ㄩ��
+ if (listAndroid == null || listAndroid.size() > 0) {
+ List<Integer> versionCodeList = null;
+ if (listAndroid != null)
+ versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+ hwPushService.pushWelfareCenter(uid, new PushBaseContent(title, content, versionCodeList, system));
+ }
- /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
- if (listAndroid == null || listAndroid.size() > 0) {
- // 闄愬埗鎺ㄩ�佺増鏈彿锛�1.6.5浠ュ悗
- String versions = getEffectiveVersions(47, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
- if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
- xmPushService.pushUserSignInNotification(uid, title, content, versions);
- }
- }
+ // OPPO鎺ㄩ��
+ if (listAndroid == null || listAndroid.size() > 0) {
+ List<Integer> versionCodeList = null;
+ if (listAndroid != null)
+ versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+ oPPOPushService.pushWelfareCenter(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);
- hwPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
- }
+ // VIVO鎺ㄩ��
+ if (listAndroid == null || listAndroid.size() > 0) {
+ List<Integer> versionCodeList = null;
+ if (listAndroid != null)
+ versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+ vIVOPushService.pushWelfareCenter(uid, new PushBaseContent(title, content, versionCodeList, system));
+ }
- // 鎻掑叆鎺ㄩ�佽褰�
- PushRecord pushRecord = new PushRecord();
- pushRecord.setTitle(title);
- pushRecord.setUid(uid);
- pushRecord.setState(1); // 鎴愬姛
- pushRecord.setType(PushTypeEnum.signin.getCode()); // 绫诲瀷锛氱櫨宸�
- pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
- pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
- pushRecordMapper.insertSelective(pushRecord);
- }
+ // 鎻掑叆鎺ㄩ�佽褰�
+ PushRecord pushRecord = new PushRecord();
+ pushRecord.setTitle(title);
+ pushRecord.setUid(uid);
+ pushRecord.setState(1); // 鎴愬姛
+ pushRecord.setType(PushTypeEnum.welfare.getCode()); // 绫诲瀷锛氱櫨宸�
+ pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
+ pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
+ pushRecordMapper.insertSelective(pushRecord);
+ }
+
+ /**
+ * 鏌ヨ鑳芥帹閫佺増鏈彿
+ *
+ * @param listVersion
+ * @return
+ */
+ private String getEffectiveVersions(int minCode, String type, List<String> listVersion, SystemEnum system) throws PushException {
+
+ if (minCode == 0 && listVersion == null) {
+ return null;
+ }
+
+ String versions = "";
+ if (listVersion == null) {
+ List<AppVersionInfo> list = appVersionService.listByPlatformAndMinVersionCode(type, minCode, system);
+ if (list != null) {
+ for (AppVersionInfo appVersion : list) {
+ versions += appVersion.getVersion() + ",";
+ }
+ }
+ } else {
+ List<AppVersionInfo> list = appVersionService.listByVersions(type, listVersion, system);
+ if (list != null) {
+ for (AppVersionInfo appVersion : list) {
+ Integer code = appVersion.getVersionCode();
+ if (code != null && code >= minCode) {
+ versions += appVersion.getVersion() + ",";
+ }
+ }
+ }
+ }
+
+ if (versions.endsWith(",")) {
+ versions = versions.substring(0, versions.length() - 1);
+ }
+
+ return versions;
+ }
+
+ /**
+ * 鏌ヨ鑳芥帹閫佺増鏈彿code
+ *
+ * @param listVersion
+ * @return
+ */
+ private String getEffectiveVersionCodes(int minCode, String type, List<String> listVersion, SystemEnum system) throws PushException {
+
+ if (minCode == 0 && listVersion == null) {
+ return null;
+ }
+
+ String versionCodes = "";
+ if (listVersion == null) {
+ List<AppVersionInfo> list = appVersionService.listByPlatformAndMinVersionCode(type, minCode, system);
+ if (list != null) {
+ for (AppVersionInfo appVersion : list) {
+ versionCodes += appVersion.getVersionCode() + ",";
+ }
+ }
+ } else {
+ List<AppVersionInfo> list = appVersionService.listByVersions(type, listVersion, system);
+ if (list != null) {
+ for (AppVersionInfo appVersion : list) {
+ Integer code = appVersion.getVersionCode();
+ if (code != null && code >= minCode) {
+ versionCodes += appVersion.getVersionCode() + ",";
+ }
+ }
+ }
+ }
+
+ if (versionCodes.endsWith(",")) {
+ versionCodes = versionCodes.substring(0, versionCodes.length() - 1);
+ }
+
+ return versionCodes;
+ }
+
+ @Override
+ public void pushUserSignInNotification(Long uid, String title, String content, List<String> listIOS,
+ List<String> listAndroid, SystemEnum system) throws PushException {
+ if (StringUtil.isNullOrEmpty(title))
+ throw new PushException(1, "鏃犳帹閫佹爣棰�");
+ if (StringUtil.isNullOrEmpty(content))
+ throw new PushException(1, "鏃犳帹閫佸唴瀹�");
+
+ /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+ if (listIOS == null || listIOS.size() > 0) {
+ // 闄愬埗鎺ㄩ�佺増鏈彿锛�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);
+ }
+ }
+
+ /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+ if (listAndroid == null || listAndroid.size() > 0) {
+ // 闄愬埗鎺ㄩ�佺増鏈彿锛�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);
+ }
+ }
+
+ // 鍗庝负鎺ㄩ��
+ if (listAndroid == null || listAndroid.size() > 0) {
+ List<Integer> versionCodeList = null;
+ if (listAndroid != null)
+ versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid, system);
+ hwPushService.pushUserSignInNotification(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.pushUserSignInNotification(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.pushUserSignInNotification(uid, new PushBaseContent(title, content, versionCodeList, system));
+ }
+
+ // 鎻掑叆鎺ㄩ�佽褰�
+ PushRecord pushRecord = new PushRecord();
+ pushRecord.setTitle(title);
+ pushRecord.setUid(uid);
+ pushRecord.setState(1); // 鎴愬姛
+ pushRecord.setType(PushTypeEnum.signin.getCode()); // 绫诲瀷锛氱櫨宸�
+ pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
+ pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
+ pushRecordMapper.insertSelective(pushRecord);
+ }
}
--
Gitblit v1.8.0