|
|
|
@ -140,4 +140,48 @@ public class InterfaceCallLogServiceImpl extends ServiceImpl<InterfaceCallLogMap |
|
|
|
|
|
|
|
return new PageUtils(pageResult); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 一次性记录完整的接口调用日志(调用后只保存1次,不需要先存再修改)- rqrq |
|
|
|
* @param interfaceName 接口名称 |
|
|
|
* @param methodName 方法名称 |
|
|
|
* @param requestData 请求数据 |
|
|
|
* @param responseData 响应数据 |
|
|
|
* @param status 状态(SUCCESS/ERROR/TIMEOUT) |
|
|
|
* @param errorMessage 错误信息 |
|
|
|
* @param executionTime 执行时间(毫秒) |
|
|
|
* @param site 站点 |
|
|
|
* @param businessKey 业务主键 |
|
|
|
* @param remark 备注 |
|
|
|
* @author rqrq |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW) |
|
|
|
public void logCompleteCall(String interfaceName, String methodName, String requestData, |
|
|
|
String responseData, String status, String errorMessage, |
|
|
|
Long executionTime, String site, String businessKey, String remark) { |
|
|
|
try { |
|
|
|
InterfaceCallLog callLog = new InterfaceCallLog(); |
|
|
|
callLog.setInterfaceName(interfaceName); |
|
|
|
callLog.setMethodName(methodName); |
|
|
|
callLog.setRequestData(requestData); |
|
|
|
callLog.setResponseData(responseData); |
|
|
|
callLog.setStatus(status); |
|
|
|
callLog.setErrorMessage(errorMessage); |
|
|
|
callLog.setExecutionTime(executionTime); |
|
|
|
callLog.setSite(site); |
|
|
|
callLog.setBusinessKey(businessKey); |
|
|
|
callLog.setRemark(remark); |
|
|
|
callLog.setCreatedTime(new Date()); |
|
|
|
callLog.setCreatedBy("SYSTEM"); |
|
|
|
|
|
|
|
this.save(callLog); |
|
|
|
|
|
|
|
log.info("接口调用日志一次性记录成功 - rqrq,接口: {}, 方法: {}, 状态: {}", |
|
|
|
interfaceName, methodName, status); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
log.error("一次性记录接口调用日志失败 - rqrq: {}", e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |