REQ-3284: 推送声音

This commit is contained in:
yanglin 2024-12-03 09:30:23 +08:00
parent 59418d89c2
commit 12a09c2649

View File

@ -49,13 +49,13 @@ public class PushDeviceService {
boolean shouldPush(PushTerminalEnum pushTerminal,
PushChannel pushChannel,
List<ApkDeviceMaxCodeResp> devices) {
Supplier<Boolean> ambiguityPush = () -> {
Supplier<Boolean> ambiguity = () -> {
Set<PushChannel> channels = cfg
.getPushChannels().getAmbiguityPushChannels();
return channels.contains(pushChannel);
};
if (CollectionUtils.isEmpty(devices))
return ambiguityPush.get();
return ambiguity.get();
if (devices.size() > 2)
log.warn("Person has more than 2 latest login devices. personId={}, devices={}",
devices.get(0).getPersonId(), JSON.toJSONString(devices));
@ -65,7 +65,7 @@ public class PushDeviceService {
else if (pushTerminal == PushTerminalEnum.C_WORKER_APP)
terminalType = AppTerminalTypeEnum.CM;
if (terminalType == null)
return ambiguityPush.get();
return ambiguity.get();
Integer configuredVersion = null;
int deviceVersion = 0;
for (ApkDeviceMaxCodeResp device : devices) {
@ -73,10 +73,10 @@ public class PushDeviceService {
continue;
SystemTypeEnum systemType = convertEpicSystemType(device.getSystemType());
if (systemType == null)
return ambiguityPush.get();
return ambiguity.get();
PushDeviceVersion nimPushVersion = cfg.getPushChannels().getNimPushVersion(systemType);
if (nimPushVersion == null)
return ambiguityPush.get();
return ambiguity.get();
if (terminalType == AppTerminalTypeEnum.CM)
configuredVersion = nimPushVersion.getWorkerAppVersion();
if (terminalType == AppTerminalTypeEnum.CMP)
@ -84,14 +84,14 @@ public class PushDeviceService {
deviceVersion = device.getCode();
}
if (configuredVersion == null || configuredVersion <= 0 || deviceVersion <= 0)
return ambiguityPush.get();
return ambiguity.get();
if (pushChannel == PushChannel.NIM)
return deviceVersion > configuredVersion;
if (pushChannel == PushChannel.YOU_MENG)
return deviceVersion <= configuredVersion;
// should never happen
return ambiguityPush.get();
return ambiguity.get();
}
private static SystemTypeEnum convertEpicSystemType(