admin
2019-03-15 cbc53d3765e0ec38b4195a5157b82cc6f32e7aa5
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.impl.push;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -124,7 +125,6 @@
         // 更新数据
         updateByPrimaryKey(current);
      }
   }
   @Override
@@ -135,6 +135,11 @@
      if (pushCoupon == null) {
         throw new PushCouponException(1, "推送信息已不存在");
      }
      if(pushCoupon.isPushed()) {
         throw new PushCouponException(1, "该信息不能重复推送");
      }
      String title = pushCoupon.getTitle();
      String content = pushCoupon.getContent();
@@ -143,27 +148,35 @@
      }
      
      
      // TODO 推送跳转
      List<String> listuid = null;
      String uids = pushCoupon.getUids();
      if (uids == null || uids.trim().length() == 0) {
      if (uids != null && uids.trim().length() > 0) {
         listuid = Arrays.asList(uids.split(","));
         if (listuid == null || listuid.size() == 0) {
            throw new PushCouponException(1, "用户id格式不正确");
         }
      }
      List<String> listVersion = null;
      String versions = pushCoupon.getVersions();
      if (versions != null && versions.trim().length() > 0) {
         listVersion  = Arrays.asList(versions.split(","));
         if (listVersion == null || listVersion.size() == 0) {
            throw new PushCouponException(1, "版本号格式不正确\"");
         }
      }
      if (listuid == null) {
         // 全推
         //pushService.pushZNX(null, title, content);
         pushService.pushWelfareCenter(null, title, content, listVersion);
         
      } else {
         // 指定用户推送
         String[] uidArray = uids.split(",");
         if (uidArray != null) {
            for (int i = 0; i < uidArray.length; i++) {
               String str_uid = uidArray[i];
               if (str_uid != null && str_uid.trim().length() > 0) {
                  //pushService.pushZNX(Long.parseLong(str_uid), title, content);
               }
         for (String str_uid: listuid) {
            if (str_uid != null && str_uid.trim().length() > 0) {
               pushService.pushWelfareCenter(Long.parseLong(str_uid), title, content, listVersion);
            }
         }
      }
      
      // 已推送