spdm日志模块

This commit is contained in:
2025-12-04 20:20:10 +08:00
parent b55f0c2c44
commit 8ff5396b3f
6 changed files with 191 additions and 2 deletions

View File

@@ -94,6 +94,11 @@ public interface ServiceNameConstants {
*/
String MSG_SERVICE = "honeycom-msg-biz";
/**
* 日志模块
*/
String LOG_SERVICE = "honeycom-log-biz";
/**
* spdm中转模块
*/

View File

@@ -396,7 +396,7 @@ public class RemoteServiceImpl implements IRemoteService {
// 审批消息通知
Process process = processService.getByFlowId(processNodeRecordAssignUserParamDto.getFlowId());
MessageOpenApiDTO messageOpenApiDTO = new MessageOpenApiDTO();
messageOpenApiDTO.setTitle("审批消息通知");
messageOpenApiDTO.setTitle("审批通知");
messageOpenApiDTO.setContent("收到一条" + process.getName() + "审批任务代办,请前往任务中心-代办任务-流程任务审批");
messageOpenApiDTO.setStaffCode(String.valueOf(processNodeRecordAssignUserParamDto.getUserId()));
messageOpenApiDTO.setTenantCode(String.valueOf(TenantContextHolder.getTenantId()));

View File

@@ -0,0 +1,58 @@
/*
*
* Copyright (c) 2018-2025, honeycom All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: honeycom
*
*/
package com.honeycombis.honeycom.spdm.controller;
import com.honeycombis.honeycom.common.core.constant.SecurityConstants;
import com.honeycombis.honeycom.common.core.util.R;
import com.honeycombis.honeycom.msg.api.dto.MessageOpenApiDTO;
import com.honeycombis.honeycom.spdm.dto.MessageDto;
import com.honeycombis.honeycom.spdm.dto.SysLogDto;
import com.honeycombis.honeycom.spdm.feign.RemoteLogServiceFeign;
import com.honeycombis.honeycom.spdm.feign.RemoteMsgServiceFeign;
import com.honeycombis.honeycom.spdm.util.ResponseR;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@AllArgsConstructor
@RequestMapping("/spdm-log")
@Tag(description = "spdm", name = "提供给SPDM的流程模块")
@Slf4j
public class SpdmLogController {
@Resource
private RemoteLogServiceFeign remoteLogServiceFeign;
@Operation(summary = "记录日志")
@PostMapping(value = "/saveLog")
public ResponseR saveLog(@RequestBody SysLogDto messageDto) {
R<Boolean> r = remoteLogServiceFeign.saveLog(messageDto, SecurityConstants.FROM_IN);
return ResponseR.ok(r.getData());
}
}

View File

@@ -43,7 +43,7 @@ public class SpdmMsgController {
@Resource
private RemoteMsgServiceFeign remoteMsgServiceFeign;
@Operation(summary = "起流程")
@Operation(summary = "送消息通知")
@PostMapping(value = "/sendMessage")
public ResponseR sendMessage(@RequestBody MessageDto messageDto) {
MessageOpenApiDTO messageOpenApiDTO = new MessageOpenApiDTO();

View File

@@ -0,0 +1,101 @@
package com.honeycombis.honeycom.spdm.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author honeycom
* @date 2020/10/9
* <p>
* 日志查询传输对象
*/
@Data
@Schema(description = "日志查询对象")
public class SysLogDto {
/**
* 编号
*/
private Long id;
/**
* 日志类型
*/
@NotBlank(message = "日志类型不能为空")
private String logType;
/**
* 日志标题
*/
@NotBlank(message = "日志标题不能为空")
private String title;
/**
* 创建者
*/
private String createBy;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 操作IP地址
*/
private String remoteAddr;
/**
* 用户代理
*/
private String userAgent;
/**
* 请求URI
*/
private String requestUri;
/**
* 操作方式
*/
private String method;
/**
* 操作提交的数据
*/
private String params;
/**
* 参数重写成object
*/
private Object body;
/**
* 执行时间
*/
private Long time;
/**
* 异常信息
*/
private String exception;
/**
* 服务ID
*/
private String serviceId;
/**
* 创建时间区间 [开始时间,结束时间]
*/
private LocalDateTime[] createTime;
/**
* 租户编号
*/
private Long tenantId;
}

View File

@@ -0,0 +1,25 @@
package com.honeycombis.honeycom.spdm.feign;
import com.honeycombis.honeycom.common.core.constant.SecurityConstants;
import com.honeycombis.honeycom.common.core.constant.ServiceNameConstants;
import com.honeycombis.honeycom.common.core.util.R;
import com.honeycombis.honeycom.common.feign.config.FeignConfig;
import com.honeycombis.honeycom.spdm.dto.SysLogDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.LOG_SERVICE, configuration = FeignConfig.class)
public interface RemoteLogServiceFeign {
/**
* 新增日志
* @param sysLog 新增日志
* @return R
*/
@PostMapping("/log/save")
R<Boolean> saveLog(@RequestBody SysLogDto sysLog, @RequestHeader(SecurityConstants.FROM) String from);
}