- 新增 .env.production.example 配置文件,包含所有微服务的数据库和Redis配置 - 添加 compose.production.yaml Docker Compose部署文件,定义web和各服务容器 - 实现Android SDK环境切换功能,支持外部服务和本地联调模式切换 - 添加推送注册状态管理和接收开关设置界面 - 集成演示服务的应用密钥客户端和认证服务实现 - 完善文档说明各SDK模块的集成和使用方法
51 行
1.9 KiB
Java
51 行
1.9 KiB
Java
package com.xuqm.tenant.service;
|
|
|
|
import com.xuqm.tenant.entity.AppEntity;
|
|
import com.xuqm.tenant.entity.FeatureServiceEntity;
|
|
import com.xuqm.tenant.repository.AppRepository;
|
|
import com.xuqm.tenant.repository.FeatureServiceRepository;
|
|
import com.xuqm.tenant.repository.TenantRepository;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
@Service
|
|
public class DashboardService {
|
|
|
|
private final AppRepository appRepository;
|
|
private final FeatureServiceRepository featureServiceRepository;
|
|
private final TenantRepository tenantRepository;
|
|
private final OperationLogService operationLogService;
|
|
|
|
public DashboardService(AppRepository appRepository,
|
|
FeatureServiceRepository featureServiceRepository,
|
|
TenantRepository tenantRepository,
|
|
OperationLogService operationLogService) {
|
|
this.appRepository = appRepository;
|
|
this.featureServiceRepository = featureServiceRepository;
|
|
this.tenantRepository = tenantRepository;
|
|
this.operationLogService = operationLogService;
|
|
}
|
|
|
|
public Map<String, Object> stats(String tenantId) {
|
|
List<AppEntity> apps = appRepository.findByTenantId(tenantId);
|
|
long serviceCount = 0;
|
|
for (AppEntity app : apps) {
|
|
serviceCount += featureServiceRepository.findByAppId(app.getId()).stream()
|
|
.filter(FeatureServiceEntity::isEnabled)
|
|
.count();
|
|
}
|
|
long subAccountCount = tenantRepository.countByParentId(tenantId);
|
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|
|
result.put("appCount", apps.size());
|
|
result.put("serviceCount", serviceCount);
|
|
result.put("subAccountCount", subAccountCount);
|
|
|
|
operationLogService.record(tenantId, "CONSOLE", "DASHBOARD", tenantId, "VIEW_DASHBOARD", result);
|
|
return result;
|
|
}
|
|
}
|