yujian
2019-08-12 e068c9acf06cff7673fadfca686128f6d6d66e20
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -64,7 +64,6 @@
   @Resource
   private AppVersionService appVersionService;
   
   @Override
   public void pushGoods(Long uid,  String title, String content, String url, List<String> listIOS,
         List<String> listAndroid) throws PushException {
@@ -76,7 +75,6 @@
         throw new PushException(1, "请填写推送标题");
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "请填写推送内容"); 
      
      /* IOS端推送   (注明:list等于 'null' 时全推, size等于0 不做推送) */
      if (listIOS == null || listIOS.size() > 0) {
@@ -94,8 +92,14 @@
         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);
      }
      }
      
      PushRecord pushRecord = new PushRecord();
      pushRecord.setUid(uid);
@@ -109,7 +113,6 @@
      pushRecordMapper.insertSelective(pushRecord);
   }
   @Override
   public void pushUrl(Long uid, String title, String content, String url, List<String> listIOS,
         List<String> listAndroid) throws PushException {
@@ -120,7 +123,6 @@
         throw new PushException(1, "无推送标题");
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "无推送内容");
      
      /* IOS端推送   (注明:list等于 'null' 时全推, size等于0 不做推送) */
      if (listIOS == null || listIOS.size() > 0) {
@@ -138,8 +140,15 @@
         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);
         }
      }
      
      PushRecord pushRecord = new PushRecord();
      pushRecord.setUid(uid);
@@ -152,10 +161,9 @@
      pushRecordMapper.insertSelective(pushRecord);
   }
   @Override
   public void pushZNX(Long uId, String title, String content, List<String> listIOS,
         List<String> listAndroid) 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))
@@ -182,7 +190,6 @@
         accountMessageMapper.insertSelective(accountMessage);
      }
      
      /* IOS端推送   (注明:list等于 'null' 时全推, size等于0 不做推送) */
      if (listIOS == null || listIOS.size() > 0) {
         // 限制推送版本号:0
@@ -199,8 +206,15 @@
         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);
         }
      }
      
      // 插入推送记录
      PushRecord pushRecord = new PushRecord();
@@ -212,7 +226,6 @@
      pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
      pushRecordMapper.insertSelective(pushRecord);
   }
   
   @Override
   public void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listIOS,
@@ -242,6 +255,13 @@
         }
      }
      
      // 华为推送
      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);
      }
      
      // 插入推送记录
      PushRecord pushRecord = new PushRecord();
@@ -253,7 +273,6 @@
      pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
      pushRecordMapper.insertSelective(pushRecord);
   }
   
   @Override
   public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listIOS,
@@ -284,6 +303,13 @@
         }
      }
      
      // 华为推送
      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);
      }
      
      // 插入推送记录
      PushRecord pushRecord = new PushRecord();
@@ -297,7 +323,6 @@
      pushRecordMapper.insertSelective(pushRecord);
   }
   @Override
   public void pushWelfareCenter(Long uid, String title, String content, List<String> listIOS,
         List<String> listAndroid) throws PushException {
@@ -306,7 +331,6 @@
         throw new PushException(1, "无推送标题");
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "无推送内容");
      
      /* IOS端推送   (注明:list等于 'null' 时全推, size等于0 不做推送) */
      if (listIOS == null || listIOS.size() > 0) {
@@ -326,6 +350,13 @@
         }
      }
      
      // 华为推送
      if (listAndroid == null || listAndroid.size() > 0) {
         List<Integer> versionCodeList = null;
         if (listAndroid != null)
            versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
         hwPushService.pushWelfareCenter(uid, title, content, versionCodeList);
      }
      
      // 插入推送记录
      PushRecord pushRecord = new PushRecord();
@@ -338,10 +369,9 @@
      pushRecordMapper.insertSelective(pushRecord);
   }
   /**
    * 查询能推送版本号
    *
    * @param versionCode
    * @param listVersion
    * @return
@@ -379,9 +409,9 @@
      return versions;
   }
   
   /**
    * 查询能推送版本号code
    *
    * @param versionCode
    * @param listVersion
    * @return