feat(push): 添加推送服务功能支持
- 实现了 ConversationViewModel 来管理对话列表的刷新和状态 - 集成了 FCM 推送服务支持并实现了自动令牌获取机制 - 构建了完整的 PushSDK 推送系统,支持华为、小米、OPPO、VIVO、荣耀等厂商推送 - 添加了推送配置管理和设备注册/注销功能 - 实现了跨平台推送令牌管理和服务绑定逻辑 - 扩展了服务器端功能服务管理器以支持推送服务激活请求流程
这个提交包含在:
父节点
af4492e3aa
当前提交
249da309a3
@ -8,6 +8,7 @@ import com.xuqm.common.exception.BusinessException;
|
|||||||
import com.xuqm.tenant.entity.FeatureServiceEntity;
|
import com.xuqm.tenant.entity.FeatureServiceEntity;
|
||||||
import com.xuqm.tenant.entity.ServiceActivationRequestEntity;
|
import com.xuqm.tenant.entity.ServiceActivationRequestEntity;
|
||||||
import com.xuqm.tenant.entity.ServiceActivationRequestEntity.Status;
|
import com.xuqm.tenant.entity.ServiceActivationRequestEntity.Status;
|
||||||
|
import com.xuqm.tenant.repository.AppRepository;
|
||||||
import com.xuqm.tenant.repository.FeatureServiceRepository;
|
import com.xuqm.tenant.repository.FeatureServiceRepository;
|
||||||
import com.xuqm.tenant.repository.ServiceActivationRequestRepository;
|
import com.xuqm.tenant.repository.ServiceActivationRequestRepository;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -23,13 +24,16 @@ public class FeatureServiceManager {
|
|||||||
|
|
||||||
private final FeatureServiceRepository repository;
|
private final FeatureServiceRepository repository;
|
||||||
private final ServiceActivationRequestRepository requestRepository;
|
private final ServiceActivationRequestRepository requestRepository;
|
||||||
|
private final AppRepository appRepository;
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
public FeatureServiceManager(FeatureServiceRepository repository,
|
public FeatureServiceManager(FeatureServiceRepository repository,
|
||||||
ServiceActivationRequestRepository requestRepository,
|
ServiceActivationRequestRepository requestRepository,
|
||||||
|
AppRepository appRepository,
|
||||||
ObjectMapper objectMapper) {
|
ObjectMapper objectMapper) {
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
this.requestRepository = requestRepository;
|
this.requestRepository = requestRepository;
|
||||||
|
this.appRepository = appRepository;
|
||||||
this.objectMapper = objectMapper;
|
this.objectMapper = objectMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,13 +125,18 @@ public class FeatureServiceManager {
|
|||||||
req.setReviewedAt(LocalDateTime.now());
|
req.setReviewedAt(LocalDateTime.now());
|
||||||
requestRepository.save(req);
|
requestRepository.save(req);
|
||||||
|
|
||||||
|
// Normalize to appKey so SdkConfigController queries are consistent
|
||||||
|
String normalizedAppId = appRepository.findById(req.getAppId())
|
||||||
|
.map(app -> app.getAppKey())
|
||||||
|
.orElse(req.getAppId());
|
||||||
|
|
||||||
if (isAppWideService(req.getServiceType())) {
|
if (isAppWideService(req.getServiceType())) {
|
||||||
List<FeatureServiceEntity> services = repository.findByAppIdAndServiceType(req.getAppId(), req.getServiceType());
|
List<FeatureServiceEntity> services = repository.findByAppIdAndServiceType(normalizedAppId, req.getServiceType());
|
||||||
if (services.isEmpty()) {
|
if (services.isEmpty()) {
|
||||||
for (FeatureServiceEntity.Platform platform : FeatureServiceEntity.Platform.values()) {
|
for (FeatureServiceEntity.Platform platform : FeatureServiceEntity.Platform.values()) {
|
||||||
FeatureServiceEntity created = new FeatureServiceEntity();
|
FeatureServiceEntity created = new FeatureServiceEntity();
|
||||||
created.setId(UUID.randomUUID().toString());
|
created.setId(UUID.randomUUID().toString());
|
||||||
created.setAppId(req.getAppId());
|
created.setAppId(normalizedAppId);
|
||||||
created.setPlatform(platform);
|
created.setPlatform(platform);
|
||||||
created.setServiceType(req.getServiceType());
|
created.setServiceType(req.getServiceType());
|
||||||
created.setEnabled(true);
|
created.setEnabled(true);
|
||||||
@ -142,11 +151,11 @@ public class FeatureServiceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FeatureServiceEntity entity = repository
|
FeatureServiceEntity entity = repository
|
||||||
.findByAppIdAndPlatformAndServiceType(req.getAppId(), req.getPlatform(), req.getServiceType())
|
.findByAppIdAndPlatformAndServiceType(normalizedAppId, req.getPlatform(), req.getServiceType())
|
||||||
.orElseGet(() -> {
|
.orElseGet(() -> {
|
||||||
FeatureServiceEntity e = new FeatureServiceEntity();
|
FeatureServiceEntity e = new FeatureServiceEntity();
|
||||||
e.setId(UUID.randomUUID().toString());
|
e.setId(UUID.randomUUID().toString());
|
||||||
e.setAppId(req.getAppId());
|
e.setAppId(normalizedAppId);
|
||||||
e.setPlatform(req.getPlatform());
|
e.setPlatform(req.getPlatform());
|
||||||
e.setServiceType(req.getServiceType());
|
e.setServiceType(req.getServiceType());
|
||||||
e.setCreatedAt(LocalDateTime.now());
|
e.setCreatedAt(LocalDateTime.now());
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户