admin
2019-03-13 33b4ed2bbf28ec16b66e552680f56a691a4e908d
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.service.impl.push;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Async;
@@ -64,7 +66,7 @@
   @Async("pushExecutor")
   @Override
   public void pushGoods(Long uid, String url, String title, String content) throws PushException {
   public void pushGoods(Long uid, String url, String title, String content, List<String> listVersion) throws PushException {
      String gids = url.split("id=")[1];
      String gid = gids.split("&")[0];
      if (StringUtil.isNullOrEmpty(gid))
@@ -72,7 +74,7 @@
      if (StringUtil.isNullOrEmpty(title))
         throw new PushException(1, "请填写推送标题");
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "请填写推送内容");
         throw new PushException(1, "请填写推送内容");
      PushRecord pushRecord = new PushRecord();
      pushRecord.setState(1);
@@ -81,9 +83,10 @@
      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);
      xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, listVersion);
      iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, listVersion);
      // hwPushService.pushGoods(uid, Long.parseLong(gid), title, content);
      pushRecordMapper.insertSelective(pushRecord);
@@ -91,7 +94,7 @@
   @Async("pushExecutor")
   @Override
   public void pushUrl(Long uid, String url, String title, String content) throws PushException {
   public void pushUrl(Long uid, String url, String title, String content, List<String> listVersion) throws PushException {
      if (StringUtil.isNullOrEmpty(url))
         throw new PushException(1, "无推送链接");
@@ -106,16 +109,17 @@
      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);
      xmPushService.pushUrl(uid, url, title, content, listVersion);
      iosPushService.pushUrl(uid, url, title, content, listVersion);
      hwPushService.pushUrl(uid, url, title, content, listVersion);
      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> listVersion) throws PushException {
      if (StringUtil.isNullOrEmpty(title))
         throw new PushException(1, "无推送标题");
      if (StringUtil.isNullOrEmpty(content))
@@ -135,9 +139,11 @@
         pushRecord.setState(1); // 成功
         pushRecord.setType(4); // 类型:站内信
         pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
         xmPushService.pushZNX(uId, null, systemZnx);
         iosPushService.pushZNX(uId, null, systemZnx);
         hwPushService.pushZNX(uId, null, systemZnx);
         pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
         xmPushService.pushZNX(uId, null, systemZnx, listVersion);
         iosPushService.pushZNX(uId, null, systemZnx, listVersion);
         hwPushService.pushZNX(uId, null, systemZnx, listVersion);
         // 插入推送记录
         pushRecordMapper.insertSelective(pushRecord);
      } else {
@@ -149,9 +155,9 @@
         accountMessage.setContent(content);
         accountMessageMapper.insertSelective(accountMessage);
         xmPushService.pushZNX(uId, accountMessage, null);
         iosPushService.pushZNX(uId, accountMessage, null);
         hwPushService.pushZNX(uId, accountMessage, null);
         xmPushService.pushZNX(uId, accountMessage, null, listVersion);
         iosPushService.pushZNX(uId, accountMessage, null, listVersion);
         hwPushService.pushZNX(uId, accountMessage, null, listVersion);
         // 插入推送记录
         PushRecord pushRecord = new PushRecord();
@@ -160,22 +166,31 @@
         pushRecord.setState(1); // 成功
         pushRecord.setType(PushController.ZNX); // 类型:站内信
         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> listVersion) throws PushException {
      if (StringUtil.isNullOrEmpty(title))
         throw new PushException(1, "无推送标题");
      if (StringUtil.isNullOrEmpty(content))
         throw new PushException(1, "无推送内容");
      iosPushService.pushWEEX(uid, title, content, weexUrl);
      iosPushService.pushWEEX(uid, title, content, weexUrl, listVersion);
   }
   @Override
   public void pushBaiChuanUrl(Long uid, String title, String content, String url) throws PushException {
      iosPushService.pushBaiChuanUrl(uid, title, content, url);
   public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listVersion) throws PushException {
      iosPushService.pushBaiChuanUrl(uid, title, content, url, listVersion);
      xmPushService.pushBaiChuanUrl(uid, title, content, url, listVersion);
   }
   @Override
   public void pushWelfareCenter(Long uid, String title, String content, List<String> listVersion) throws PushException {
      iosPushService.pushWelfareCenter(uid, title, content, listVersion);
      xmPushService.pushWelfareCenter(uid, title, content, listVersion);
   }
}