admin
2020-08-26 26f7accb815f55f18f8eedfca4324700a96884ec
fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java
@@ -9,6 +9,8 @@
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;
@@ -139,6 +141,7 @@
     * @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后开始推送
@@ -148,6 +151,7 @@
        }
        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);
@@ -155,7 +159,7 @@
            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());
@@ -189,6 +193,7 @@
            }
        } else {
            LogHelper.pushHW("单推");
            // 华为单推
            List<DeviceTokenHW> hwDeviceList = deviceTokenHWService.getDeviceTokenByUid(dto.getUid(), newVersionList);
            List<String> tokenList = new ArrayList<>();
@@ -197,6 +202,9 @@
                for (DeviceTokenHW token : hwDeviceList)
                    tokenList.add(token.getDeviceToken());
            }
            LogHelper.pushHW(String.format("单推:设备数%s 用户:%s",hwDeviceList.size(),dto.getUid()+""));
            if (tokenList.size() == 0)
                return;