Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.sdm.system.controller;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.feign.inter.system.ISysLogFeignClient;
|
||||
import com.sdm.common.log.dto.SysLogDTO;
|
||||
import com.sdm.system.service.ISimulationLogService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 消息通知
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/systemLog")
|
||||
@Tag(name = "系统评审")
|
||||
public class SystemLogController implements ISysLogFeignClient {
|
||||
|
||||
@Autowired
|
||||
private ISimulationLogService logService;
|
||||
|
||||
@PostMapping("/saveLog")
|
||||
public SdmResponse saveLog(@RequestBody SysLogDTO req)
|
||||
{
|
||||
return logService.saveLog(req);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.sdm.system.service;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.log.dto.SysLogDTO;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
public interface ISimulationLogService {
|
||||
|
||||
SdmResponse saveLog(@RequestBody SysLogDTO req);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.sdm.system.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.log.dto.SysLogDTO;
|
||||
import com.sdm.common.utils.HttpClientUtil;
|
||||
import com.sdm.system.service.ISimulationLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SimulationLogServiceImpl implements ISimulationLogService {
|
||||
|
||||
@Value("${cid.url}")
|
||||
private String cidUrl;
|
||||
|
||||
@Value("${cid.log.saveLog}")
|
||||
private String saveLogPath;
|
||||
|
||||
@Autowired
|
||||
private HttpClientUtil httpClientUtil;
|
||||
|
||||
@Override
|
||||
public SdmResponse saveLog(SysLogDTO req) {
|
||||
String url = cidUrl + saveLogPath;
|
||||
try {
|
||||
log.info("[saveLog] url:{}, param:{}", url, JSONUtil.toJsonStr(req));
|
||||
String resultString = httpClientUtil.doPostJson(url, JSON.toJSONString(req));
|
||||
SdmResponse response = JSON.parseObject(resultString, SdmResponse.class);
|
||||
if (response.isSuccess()) {
|
||||
return response;
|
||||
}
|
||||
return SdmResponse.failed("保存日志失败:");
|
||||
} catch (Exception e) {
|
||||
log.error("保存日志失败", e);
|
||||
return SdmResponse.failed("保存日志失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -168,4 +168,6 @@ cid:
|
||||
# 批量查询的cid 接口,配合上面url使用
|
||||
batchInterfacePath: /spdm-flow/listFlowNodeDetail
|
||||
msg:
|
||||
sendMessage: /spdm-msg/sendMessage
|
||||
sendMessage: /spdm-msg/sendMessage
|
||||
log:
|
||||
saveLog: /spdm-log/saveLog
|
||||
@@ -169,6 +169,8 @@ cid:
|
||||
batchInterfacePath: /spdm-flow/listFlowNodeDetail
|
||||
msg:
|
||||
sendMessage: /spdm-msg/sendMessage
|
||||
log:
|
||||
saveLog: /spdm-log/saveLog
|
||||
|
||||
# 0单机处理,可以指向本地,1负载均衡轮询
|
||||
serverType: 0
|
||||
|
||||
@@ -180,4 +180,6 @@ cid:
|
||||
# 批量查询的cid 接口,配合上面url使用
|
||||
batchInterfacePath: /spdm-flow/listFlowNodeDetail
|
||||
msg:
|
||||
sendMessage: /spdm-msg/sendMessage
|
||||
sendMessage: /spdm-msg/sendMessage
|
||||
log:
|
||||
saveLog: /spdm-log/saveLog
|
||||
Reference in New Issue
Block a user