admin
2019-08-26 81187837de78e62a5e3a38afda8b8553dcd2203c
推送修改
1个文件已添加
2个文件已修改
85 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/job/IntegralTaskJob.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/IntegralTaskJob.java
New file
@@ -0,0 +1,39 @@
package com.yeshi.fanli.job;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.util.Constant;
/**
 * 金币任务
 *
 * @author Administrator
 *
 */
@Component
public class IntegralTaskJob {
    @Resource
    private PushService pushService;
    /**
     * 推送签到提醒(每天15点半查询)
     */
    @Scheduled(cron="0 30 15 * * ? ")
    public void pushSignInNotify() {
        if (!Constant.IS_TASK)
            return;
        // 获取昨天签到过的
        // 查询今天是否已经签到
        // 如果未签到,需要推送信息
        // pushService.pushUserSignInNotification(uid, title, content, null,
        // null);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java
@@ -142,10 +142,16 @@
     * @param webUrl
     * @param versionCodeList
     */
    private void push(PushTypeEnum type, Long uid, String title, String content, String url, String webUrl, Long goodsId,
            List<Integer> versionCodeList) throws PushException {
    private void push(PushTypeEnum type, Long uid, String title, String content, String url, String webUrl,
            Long goodsId, List<Integer> versionCodeList) throws PushException {
        int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
        List<Integer> newVersionList = getVersionCodeList(versionCodeList);
        // 1.6.5后开始推送
        for (int i = 0; i < newVersionList.size(); i++) {
            if (newVersionList.get(i) < 47)
                newVersionList.remove(i--);
        }
        if (uid == null || uid == 0) {
            long deviceCount = deviceTokenHWService.countDeviceToken(newVersionList);
            int page = (int) (deviceCount % 100 == 0 ? deviceCount / 100 : deviceCount / 100 + 1);
@@ -157,27 +163,27 @@
                for (DeviceTokenHW token : hwDeviceList)
                    tokenList.add(token.getDeviceToken());
                try {
                    if (type==PushTypeEnum.goodsdetail) {// 商品详情
                    if (type == PushTypeEnum.goodsdetail) {// 商品详情
                        if (goodsId == null)
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
                    } else if (type==PushTypeEnum.url) {// 链接
                    } else if (type == PushTypeEnum.url) {// 链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushUrl(tokenList, title, content, webUrl);
                    } else if (type==PushTypeEnum.ZNX) {// 站内信
                    } else if (type == PushTypeEnum.ZNX) {// 站内信
                        HWPushUtil.pushZNX(tokenList, title, content);
                    } else if (type==PushTypeEnum.weex) {// weex
                    } else if (type == PushTypeEnum.weex) {// weex
                        if (StringUtil.isNullOrEmpty(url))
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushWEEX(tokenList, title, content, url);
                    } else if (type==PushTypeEnum.baichuan) {// 百川链接
                    } else if (type == PushTypeEnum.baichuan) {// 百川链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
                    } else if (type==PushTypeEnum.welfare) {// 福利中心
                    } else if (type == PushTypeEnum.welfare) {// 福利中心
                        HWPushUtil.pushWelfareCenter(tokenList, title, content);
                    }else if (type==PushTypeEnum.signin) {// 签到
                    } else if (type == PushTypeEnum.signin) {// 签到
                        HWPushUtil.pushUserSignInNotification(tokenList, title, content);
                    }
                } catch (Exception e) {
@@ -198,27 +204,27 @@
                return;
            try {
                if (type==PushTypeEnum.goodsdetail) {// 商品详情
                if (type == PushTypeEnum.goodsdetail) {// 商品详情
                    if (goodsId == null)
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
                } else if (type==PushTypeEnum.url) {// 链接
                } else if (type == PushTypeEnum.url) {// 链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushUrl(tokenList, title, content, webUrl);
                } else if (type==PushTypeEnum.ZNX) {// 站内信
                } else if (type == PushTypeEnum.ZNX) {// 站内信
                    HWPushUtil.pushZNX(tokenList, title, content);
                } else if (type==PushTypeEnum.weex) {// weex
                } else if (type == PushTypeEnum.weex) {// weex
                    if (StringUtil.isNullOrEmpty(url))
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushWEEX(tokenList, title, content, url);
                } else if (type==PushTypeEnum.baichuan) {// 百川链接
                } else if (type == PushTypeEnum.baichuan) {// 百川链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
                } else if (type==PushTypeEnum.welfare) {// 福利中心
                } else if (type == PushTypeEnum.welfare) {// 福利中心
                    HWPushUtil.pushWelfareCenter(tokenList, title, content);
                } else if (type==PushTypeEnum.signin) {// 签到
                } else if (type == PushTypeEnum.signin) {// 签到
                    HWPushUtil.pushUserSignInNotification(tokenList, title, content);
                }
            } catch (Exception e) {
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -460,8 +460,8 @@
        /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
        if (listIOS == null || listIOS.size() > 0) {
            // 限制推送版本号:0
            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
            // 限制推送版本号:1.6.5以后
            String codes = getEffectiveVersionCodes(60, AppVersionInfo.PLATFORM_IOS, listIOS);
            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
                iosPushService.pushUserSignInNotification(uid, title, content, codes);
            }
@@ -469,8 +469,8 @@
        /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
        if (listAndroid == null || listAndroid.size() > 0) {
            // 限制推送版本号:36
            String versions = getEffectiveVersions(36, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
            // 限制推送版本号:1.6.5以后
            String versions = getEffectiveVersions(47, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
                xmPushService.pushUserSignInNotification(uid, title, content, versions);
            }