浏览代码

增加接口日志

longhu 1 天之前
父节点
当前提交
f9210e499b

+ 7 - 1
src/main/java/com/hr/controller/AggregateController.java

@@ -1,5 +1,6 @@
 package com.hr.controller;
 
+import com.alibaba.fastjson2.JSON;
 import com.hr.dto.AggregateQueryDTO;
 import com.hr.externelSystem.BizHandlerFactory;
 import com.hr.param.AggregateRequest;
@@ -11,6 +12,7 @@ import com.hr.service.IpInterfaceService;
 import com.hr.vo.IpAccountVO;
 import com.hr.vo.IpInterfaceVO;
 import com.yy.basedevelop.common.data.BaseReturnDto;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +27,7 @@ import reactor.core.publisher.Mono;
  */
 @RestController
 @RequestMapping("/aggregate")
+@Slf4j
 public class AggregateController {
 
     @Autowired
@@ -41,6 +44,7 @@ public class AggregateController {
 
     @PostMapping("/openApi")
     public Mono<BaseReturnDto<Object>> aggregate(@RequestBody AggregateRequest req) {
+        log.info("openApi调用{}", req);
         String accountNo = req.getAccountNo();
         String interfaceCode = req.getInterfaceCode();
         IpAccountVO ipAccount = ipAccountService.queryByAccountNo(accountNo);
@@ -65,6 +69,8 @@ public class AggregateController {
         IpInterfacePO ipInterfacePO = new IpInterfacePO();
         BeanUtils.copyProperties(ipInterfaceVO, ipInterfacePO);
         dto.setIpInterfacePO(ipInterfacePO);
-        return Mono.just(bizHandlerFactory.dispatch(req,dto));
+        BaseReturnDto<Object> response = bizHandlerFactory.dispatch(req, dto);
+        log.info("openApi返回:{}", JSON.toJSONString(response));
+        return Mono.just(response);
     }
 }

+ 1 - 1
src/main/java/com/hr/externelSystem/BizHandlerFactory.java

@@ -56,7 +56,6 @@ public class BizHandlerFactory {
         String data = req.getData();
         try {
             ApiLogDto logDto = new ApiLogDto();
-            IpTokenInterfacePO ipTokenInterfacePO = dto.getIpTokenInterfacePO();
             IpTokenPO ipTokenPO = dto.getIpTokenPO();
             String decrypt = AesUtil.decrypt(data, ipTokenPO.getSecret());
             Class requestClass = handler.getRequestClass();
@@ -65,6 +64,7 @@ public class BizHandlerFactory {
             ipOrderPO.setStatus("handle");
             ipOrderRepository.save(ipOrderPO);
             ipLogRepository.save(ipLogPO);
+            log.info("openApiHandle:{}",handler.getRequestClass());
             Object handle = handler.handle(o, ipInterfacePO,logDto);
             ipLogPO.setSystemResponse(JSON.toJSONString(handle));
             String errorMessage = logDto.getErrorMessage();