yujian
2020-05-09 7e7db2fa55a9a3af46d4fd8ede0dee147f101d64
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -1,25 +1,29 @@
package com.yeshi.fanli.service.impl.push;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Async;
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.PushTypeEnum;
import com.yeshi.fanli.entity.AppVersionInfo;
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.OPPOPushService;
import com.yeshi.fanli.service.inter.push.PushRecordService;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.service.inter.push.VIVOPushService;
import com.yeshi.fanli.service.inter.push.XMPushService;
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;
@@ -42,9 +46,6 @@
   private SystemZnxService systemZnxService;
   @Resource
   private AccountMessageService accountMessageService;
   @Resource
   private DeviceTokenHWService deviceTokenHWService;
   @Resource
@@ -57,14 +58,23 @@
   private XMPushService xmPushService;
   @Resource
   private OPPOPushService oPPOPushService;
   @Resource
   private VIVOPushService vIVOPushService;
   @Resource
   private PushRecordMapper pushRecordMapper;
   @Resource
   private AccountMessageMapper accountMessageMapper;
   @Async("pushExecutor")
   @Resource
   private AppVersionService appVersionService;
   @Override
   public void pushGoods(Long uid, String url, String title, String content) throws PushException {
   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))
@@ -74,25 +84,62 @@
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "请填写推送内容");
      /* IOS端推送 (注明:list等于 '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);
         }
      }
      /* Android端推送 (注明:list等于 '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);
         }
         // OPPO推送
         if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
               versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            oPPOPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
         }
         // VIVO推送
         if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
               versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            vIVOPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
         }
      }
      PushRecord pushRecord = new PushRecord();
      pushRecord.setUid(uid);
      pushRecord.setState(1);
      pushRecord.setType(PushController.GOODS); // 都成功
      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());
      xmPushService.pushGoods(uid, Long.parseLong(gid), title, content);
      iosPushService.pushGoods(uid, Long.parseLong(gid), title, content);
      // 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 title, String content, String url, List<String> listIOS,
         List<String> listAndroid) throws PushException {
      if (StringUtil.isNullOrEmpty(url))
         throw new PushException(1, "无推送链接");
@@ -101,88 +148,471 @@
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "无推送内容");
      /* IOS端推送 (注明:list等于 '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端推送 (注明:list等于 '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);
         }
         // 华为推送
         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);
         }
         // OPPO推送
         if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
               versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            oPPOPushService.pushUrl(uid, url, title, content, versionCodeList);
         }
         // VIVO推送
         if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
               versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            vIVOPushService.pushUrl(uid, url, title, content, versionCodeList);
         }
      }
      PushRecord pushRecord = new PushRecord();
      pushRecord.setUid(uid);
      pushRecord.setState(1);
      pushRecord.setType(PushController.URL);
      pushRecord.setType(PushTypeEnum.url.getCode());
      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);
      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> listIOS, List<String> listAndroid)
         throws PushException {
      if (StringUtil.isNullOrEmpty(title))
         throw new PushException(1, "无推送标题");
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "无推送内容");
      SystemZnx systemZnx = null;
      AccountMessage accountMessage = null;
      /* 无uid , 广播 数据插入系统表 */
      if (uId == null || uId == 0) {
         // 插入数据库(系统站内信数据)
         SystemZnx systemZnx = new SystemZnx();
         systemZnx = new SystemZnx();
         systemZnx.setTitle(title);
         systemZnx.setContent(content);
         systemZnx.setCreateTime(System.currentTimeMillis());
         systemZnxService.save(systemZnx);
         PushRecord pushRecord = new PushRecord();
         pushRecord.setTitle(title);
         pushRecord.setState(1); // 成功
         pushRecord.setType(4); // 类型:站内信
         pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
         pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
         xmPushService.pushZNX(uId, null, systemZnx);
         iosPushService.pushZNX(uId, null, systemZnx);
         hwPushService.pushZNX(uId, null, systemZnx);
         // 插入推送记录
         pushRecordMapper.insertSelective(pushRecord);
      } else {
         AccountMessage accountMessage = new AccountMessage();
         accountMessage = new AccountMessage();
         accountMessage.setCreateTime(System.currentTimeMillis());
         accountMessage.setIsOpen(false);
         accountMessage.setUserInfo(new UserInfo(uId));
         accountMessage.setTitle(title);
         accountMessage.setContent(content);
         accountMessageMapper.insertSelective(accountMessage);
         xmPushService.pushZNX(uId, accountMessage, null);
         iosPushService.pushZNX(uId, accountMessage, null);
         hwPushService.pushZNX(uId, accountMessage, null);
         // 插入推送记录
         PushRecord pushRecord = new PushRecord();
         pushRecord.setTitle(title);
         pushRecord.setUid(uId);
         pushRecord.setState(1); // 成功
         pushRecord.setType(PushController.ZNX); // 类型:站内信
         pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
         pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
         pushRecordMapper.insertSelective(pushRecord);
      }
      /* IOS端推送 (注明:list等于 '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);
         }
      }
      /* Android端推送 (注明:list等于 '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);
         }
         // 华为推送
         if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
               versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            hwPushService.pushZNX(uId, title, content, versionCodeList);
         }
         // OPPO推送
         if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
               versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            oPPOPushService.pushZNX(uId, title, content, versionCodeList);
         }
         // VIVO推送
         if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
               versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            vIVOPushService.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);
   }
   @Override
   public void pushWEEX(Long uid, String title, String content, String weexUrl) throws PushException {
   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, "无推送内容");
      iosPushService.pushWEEX(uid, title, content, weexUrl);
      // 适用版本 1.4.8及以后 推送weex页面
      /* IOS端推送 (注明:list等于 '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);
         }
      }
      /* Android端推送 (注明:list等于 '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);
         }
      }
      // 华为推送
      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);
      }
      // OPPO推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         oPPOPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
      }
      // VIVO推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         vIVOPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
      }
      // 插入推送记录
      PushRecord pushRecord = new PushRecord();
      pushRecord.setTitle(title);
      pushRecord.setUid(uid);
      pushRecord.setState(1); // 成功
      pushRecord.setType(PushTypeEnum.weex.getCode()); // 类型:WEEX
      pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
      pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
      pushRecordMapper.insertSelective(pushRecord);
   }
   @Override
   public void pushBaiChuanUrl(Long uid, String title, String content, String url) throws PushException {
      iosPushService.pushBaiChuanUrl(uid, title, content, url);
      xmPushService.pushBaiChuanUrl(uid, title, content, url);
   public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listIOS,
         List<String> listAndroid) throws PushException {
      if (StringUtil.isNullOrEmpty(title))
         throw new PushException(1, "无推送标题");
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "无推送内容");
      // 适用版本 1.4.8及以后 推送百川网页
      /* IOS端推送 (注明:list等于 '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);
         }
      }
      /* Android端推送 (注明:list等于 '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);
         }
      }
      // 华为推送
      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);
      }
      // OPPO推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         oPPOPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
      }
      // VIVO推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         vIVOPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
      }
      // 插入推送记录
      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);
   }
   @Override
   public void pushWelfareCenter(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端推送 (注明:list等于 '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);
         }
      }
      /* Android端推送 (注明:list等于 '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);
         }
      }
      // 华为推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         hwPushService.pushWelfareCenter(uid, title, content, versionCodeList);
      }
      // OPPO推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         oPPOPushService.pushWelfareCenter(uid, title, content, versionCodeList);
      }
      // VIVO推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         vIVOPushService.pushWelfareCenter(uid, title, content, versionCodeList);
      }
      // 插入推送记录
      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 versionCode
    * @param listVersion
    * @return
    */
   private String getEffectiveVersions(int minCode, String type, List<String> listVersion) throws PushException {
      if (minCode == 0 && listVersion == null) {
         return null;
      }
      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() + ",";
               }
            }
         }
      }
      if (versions.endsWith(",")) {
         versions = versions.substring(0, versions.length() - 1);
      }
      return versions;
   }
   /**
    * 查询能推送版本号code
    *
    * @param versionCode
    * @param listVersion
    * @return
    */
   private String getEffectiveVersionCodes(int minCode, String type, List<String> listVersion) throws PushException {
      if (minCode == 0 && listVersion == null) {
         return null;
      }
      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() + ",";
               }
            }
         }
      }
      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) throws PushException {
      if (StringUtil.isNullOrEmpty(title))
         throw new PushException(1, "无推送标题");
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "无推送内容");
      /* IOS端推送 (注明:list等于 '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);
         }
      }
      /* Android端推送 (注明:list等于 '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);
         }
      }
      // 华为推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         hwPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
      }
      // OPPO推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         oPPOPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
      }
      // VIVO推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         vIVOPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
      }
      // 插入推送记录
      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);
   }
}