- 新增 XuqmGroup 部署文档,包含部署方案、架构建议和部署步骤 - 添加安全设计规范,涵盖密码安全、AppSecret验证和服务端API认证 - 补充平台REST API规范,定义Server-to-Server调用接口和错误码 - 创建Java IM服务端SDK计划文档,规划Maven包发布和接口实现
44 行
1.4 KiB
Java
44 行
1.4 KiB
Java
package com.xuqm.im.service;
|
|
|
|
import com.xuqm.im.entity.ImOperationLogEntity;
|
|
import com.xuqm.im.repository.ImOperationLogRepository;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.util.UUID;
|
|
|
|
@Service
|
|
public class OperationLogService {
|
|
|
|
private final ImOperationLogRepository repository;
|
|
|
|
public OperationLogService(ImOperationLogRepository repository) {
|
|
this.repository = repository;
|
|
}
|
|
|
|
public ImOperationLogEntity record(
|
|
String appKey,
|
|
String operatorId,
|
|
String action,
|
|
String resourceType,
|
|
String resourceId,
|
|
String detail) {
|
|
ImOperationLogEntity entity = new ImOperationLogEntity();
|
|
entity.setId(UUID.randomUUID().toString());
|
|
entity.setAppKey(appKey);
|
|
entity.setOperatorId(operatorId == null || operatorId.isBlank() ? "system" : operatorId);
|
|
entity.setAction(action);
|
|
entity.setResourceType(resourceType);
|
|
entity.setResourceId(resourceId);
|
|
entity.setDetail(detail);
|
|
entity.setCreatedAt(LocalDateTime.now());
|
|
return repository.save(entity);
|
|
}
|
|
|
|
public Page<ImOperationLogEntity> list(String appKey, Pageable pageable) {
|
|
return repository.findByAppKeyOrderByCreatedAtDesc(appKey, pageable);
|
|
}
|
|
}
|