fix:退出登录日志记录

This commit is contained in:
2026-04-14 16:55:04 +08:00
parent 1bb95ca0f8
commit a7be490dda
6 changed files with 54 additions and 5 deletions

View File

@@ -0,0 +1,18 @@
package com.honeycombis.honeycom.log.api.feign;
import com.honeycombis.honeycom.admin.api.dto.SysLogDTO;
import com.honeycombis.honeycom.common.core.constant.ServiceNameConstants;
import com.honeycombis.honeycom.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(contextId = "remoteSpdmLogService", value = ServiceNameConstants.SPDM_SERVICE)
public interface RemoteSpdmLogService {
@PostMapping("/honeycom-spdm/spdm-log/saveLog")
R saveLog(@RequestBody SysLogDTO sysLogDto);
}

View File

@@ -12,9 +12,11 @@ import com.honeycombis.honeycom.common.data.tenant.TenantBroker;
import com.honeycombis.honeycom.common.data.tenant.TenantContextHolder;
import com.honeycombis.honeycom.common.log.util.LogTypeEnum;
import com.honeycombis.honeycom.log.api.entity.SysLog;
import com.honeycombis.honeycom.log.api.feign.RemoteSpdmLogService;
import com.honeycombis.honeycom.log.api.vo.PreLogVO;
import com.honeycombis.honeycom.log.mapper.SysLogMapper;
import com.honeycombis.honeycom.log.service.SysLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -33,8 +35,11 @@ import java.util.stream.Collectors;
* @since 2017-11-20
*/
@Service
@RequiredArgsConstructor
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
private final RemoteSpdmLogService remoteSpdmLogService;
/**
* 批量插入前端错误日志
* @param preLogVoList 日志信息
@@ -86,6 +91,12 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
BeanUtils.copyProperties(sysLog, log, "createTime");
return baseMapper.insert(log);
});
// 退出登录记录到spdm日志中去
if ("退出登录".equals(sysLog.getTitle())) {
remoteSpdmLogService.saveLog(sysLog);
}
return Boolean.TRUE;
}