New file |
| | |
| | | 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);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @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);
|
| | |
| | |
|
| | | /* 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);
|
| | | }
|
| | |
| | |
|
| | | /* 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);
|
| | | }
|