admin
2024-01-23 81da61b828e29b7745e1382dfbbaeb685dc083ef
fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java
@@ -6,6 +6,8 @@
import com.yeshi.fanli.dto.push.PushBaseContent;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.util.Constant;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -36,7 +38,10 @@
   @Resource
   private UserCustomSettingsService userCustomSettingsService;
   private List<Integer> getVersionCodeList(List<Integer> versionCodeList, SystemEnum system) {
   @Resource
   private SystemConfigService systemConfigService;
   private List<Integer> getVersionCodeList(List<Integer> versionCodeList,SystemEnum system) {
      List<Integer> versionList = new ArrayList<>();
      if (versionCodeList == null) {// 全推
         List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51,system);
@@ -57,7 +62,7 @@
   @Async("pushExecutor")
   @Override
   public void pushGoods(Long uid, Long auctionId, PushBaseContent content)
   public void pushGoods(Long uid, String auctionId, PushBaseContent content)
         throws PushException {
      push(PushTypeEnum.goodsdetail, uid,  null, null, auctionId, content);
   }
@@ -142,7 +147,9 @@
    * @param webUrl
    */
   private void push(PushTypeEnum type, Long uid, String url, String webUrl,
         Long goodsId, PushBaseContent content) throws PushException {
         String goodsId, PushBaseContent content) throws PushException {
      String androidBaseActivity=getAndroidBaseActivity(content.getSystem());
      int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
      List<Integer> newVersionList = getVersionCodeList(content.getVersionCodeList(),content.getSystem());
      // 2.0.1后开始推送
@@ -167,25 +174,25 @@
               if (type == PushTypeEnum.goodsdetail) {// 商品详情
                  if (goodsId == null)
                     throw new PushException(2, "参数不完整");
                  VIVOPushUtil.pushGoods(tokenList, content.getTitle(),content.getContent(), 1, goodsId);
                  VIVOPushUtil.pushGoods(tokenList, content.getTitle(),content.getContent(), 1, goodsId,androidBaseActivity);
               } else if (type == PushTypeEnum.url) {// 链接
                  if (StringUtil.isNullOrEmpty(webUrl))
                     throw new PushException(2, "参数不完整");
                  VIVOPushUtil.pushUrl(tokenList,  content.getTitle(),content.getContent(),  webUrl);
                  VIVOPushUtil.pushUrl(tokenList,  content.getTitle(),content.getContent(),  webUrl,androidBaseActivity);
               } else if (type == PushTypeEnum.ZNX) {// 站内信
                  VIVOPushUtil.pushZNX(tokenList,  content.getTitle(),content.getContent());
               } else if (type == PushTypeEnum.weex) {// weex
                  if (StringUtil.isNullOrEmpty(url))
                     throw new PushException(2, "参数不完整");
                  VIVOPushUtil.pushWEEX(tokenList,  content.getTitle(),content.getContent(),  url);
                  VIVOPushUtil.pushWEEX(tokenList,  content.getTitle(),content.getContent(),  url,androidBaseActivity);
               } else if (type == PushTypeEnum.baichuan) {// 百川链接
                  if (StringUtil.isNullOrEmpty(webUrl))
                     throw new PushException(2, "参数不完整");
                  VIVOPushUtil.pushBaiChuanUrl(tokenList,  content.getTitle(),content.getContent(),  webUrl);
               } else if (type == PushTypeEnum.welfare) {// 福利中心
                  VIVOPushUtil.pushWelfareCenter(tokenList,  content.getTitle(),content.getContent());
                  VIVOPushUtil.pushWelfareCenter(tokenList,  content.getTitle(),content.getContent(),androidBaseActivity);
               } else if (type == PushTypeEnum.signin) {// 签到
                  VIVOPushUtil.pushUserSignInNotification(tokenList,  content.getTitle(),content.getContent());
                  VIVOPushUtil.pushUserSignInNotification(tokenList,  content.getTitle(),content.getContent(),androidBaseActivity);
               }
            } catch (Exception e) {
               PushLogHelper.hwError(e);
@@ -208,25 +215,25 @@
            if (type == PushTypeEnum.goodsdetail) {// 商品详情
               if (goodsId == null)
                  throw new PushException(2, "参数不完整");
               VIVOPushUtil.pushGoods(tokenList, content.getTitle(), content.getContent(), 1, goodsId);
               VIVOPushUtil.pushGoods(tokenList, content.getTitle(), content.getContent(), 1, goodsId,androidBaseActivity);
            } else if (type == PushTypeEnum.url) {// 链接
               if (StringUtil.isNullOrEmpty(webUrl))
                  throw new PushException(2, "参数不完整");
               VIVOPushUtil.pushUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
               VIVOPushUtil.pushUrl(tokenList, content.getTitle(), content.getContent(), webUrl,androidBaseActivity);
            } else if (type == PushTypeEnum.ZNX) {// 站内信
               VIVOPushUtil.pushZNX(tokenList, content.getTitle(), content.getContent());
            } else if (type == PushTypeEnum.weex) {// weex
               if (StringUtil.isNullOrEmpty(url))
                  throw new PushException(2, "参数不完整");
               VIVOPushUtil.pushWEEX(tokenList, content.getTitle(), content.getContent(), url);
               VIVOPushUtil.pushWEEX(tokenList, content.getTitle(), content.getContent(), url,androidBaseActivity);
            } else if (type == PushTypeEnum.baichuan) {// 百川链接
               if (StringUtil.isNullOrEmpty(webUrl))
                  throw new PushException(2, "参数不完整");
               VIVOPushUtil.pushBaiChuanUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
            } else if (type == PushTypeEnum.welfare) {// 福利中心
               VIVOPushUtil.pushWelfareCenter(tokenList, content.getTitle(), content.getContent());
               VIVOPushUtil.pushWelfareCenter(tokenList, content.getTitle(), content.getContent(),androidBaseActivity);
            } else if (type == PushTypeEnum.signin) {// 签到
               VIVOPushUtil.pushUserSignInNotification(tokenList,content.getTitle(), content.getContent());
               VIVOPushUtil.pushUserSignInNotification(tokenList,content.getTitle(), content.getContent(),androidBaseActivity);
            }
         } catch (Exception e) {
            PushLogHelper.vivoError(e);
@@ -234,4 +241,10 @@
      }
   }
   private String getAndroidBaseActivity(SystemEnum system) {
      return systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName, system);
   }
}