| | |
| | | |
| | | 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; |
| | |
| | | @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); |
| | |
| | | |
| | | @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); |
| | | } |
| | |
| | | * @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后开始推送 |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | private String getAndroidBaseActivity(SystemEnum system) { |
| | | |
| | | return systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName, system); |
| | | |
| | | } |
| | | } |