| | |
| | | import com.yeshi.fanli.entity.bus.user.UserCustomSettings.UserSettingTypeEnum;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenHW;
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.log.LogManager;
|
| | | import com.yeshi.fanli.log.PushLogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | |
| | | * @throws PushException
|
| | | */
|
| | | public void push(PushContentDetailDTO dto) throws PushException {
|
| | | LogHelper.pushHW("开始推送");
|
| | | int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
|
| | | List<Integer> newVersionList = getVersionCodeList(dto.getContent().getVersionCodeList(), dto.getContent().getSystem());
|
| | | // 1.6.5后开始推送
|
| | |
| | | }
|
| | |
|
| | | if (dto.getUid() == null || dto.getUid() == 0) {
|
| | | LogHelper.pushHW("全推");
|
| | | //只推送近30天的活跃
|
| | | Date minUpdateTime = new Date(System.currentTimeMillis() - Constant.PUSH_MIN_TIME);
|
| | | long deviceCount = deviceTokenHWService.countDeviceToken(newVersionList, minUpdateTime);
|
| | |
| | | for (int p = 1; p <= page; p++) {
|
| | | List<DeviceTokenHW> hwDeviceList = deviceTokenHWService.getDeviceTokenList(p, 100, newVersionList, minUpdateTime);
|
| | | hwDeviceList = filterDeviceToken(hwDeviceList, hour);
|
| | |
|
| | | LogHelper.pushHW(String.format("全推:设备数%s",hwDeviceList.size()));
|
| | | List<String> tokenList = new ArrayList<>();
|
| | | for (DeviceTokenHW token : hwDeviceList)
|
| | | tokenList.add(token.getDeviceToken());
|
| | |
| | |
|
| | | }
|
| | | } else {
|
| | | LogHelper.pushHW("单推");
|
| | | // 华为单推
|
| | | List<DeviceTokenHW> hwDeviceList = deviceTokenHWService.getDeviceTokenByUid(dto.getUid(), newVersionList);
|
| | | List<String> tokenList = new ArrayList<>();
|
| | |
| | | for (DeviceTokenHW token : hwDeviceList)
|
| | | tokenList.add(token.getDeviceToken());
|
| | | }
|
| | |
|
| | | LogHelper.pushHW(String.format("单推:设备数%s 用户:%s",hwDeviceList.size(),dto.getUid()+""));
|
| | |
|
| | | if (tokenList.size() == 0)
|
| | | return;
|
| | |
|