增加参数日志

This commit is contained in:
黎润豪 2026-03-24 09:52:55 +08:00
parent 21408a02d8
commit 8beb64e310
1 changed files with 26 additions and 5 deletions

View File

@ -8,10 +8,16 @@ import com.chinaweal.aiccs.org.service.IImsUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import java.io.ByteArrayOutputStream;
/**
* IMS统一身份管理系统数据同步接口
@ -41,8 +47,15 @@ public class ImsSyncController {
*/
@PostMapping("/org/orgSynchronous")
@ApiOperation(value = "机构同步接口", notes = "接收IMS推送的机构数据支持新增、修改、删除操作")
public ImsResultVO orgSynchronous(@RequestBody ImsOrgDTO dto) {
public ImsResultVO orgSynchronous(@RequestBody ImsOrgDTO dto, HttpServletRequest request) {
log.info("IMS机构同步请求: type={}, orgCode={}", dto.getType(), dto.getCode());
try (ServletInputStream inputStream = request.getInputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream()) {
IOUtils.copy(inputStream, os);
log.info("IMS机构同步请求body{}", os);
} catch (Exception e) {
log.error("IMS机构同步请求参数读取失败", e);
}
try {
boolean result = imsOrgService.syncOrg(dto);
@ -66,9 +79,17 @@ public class ImsSyncController {
*/
@PostMapping("/user/userSynchronous")
@ApiOperation(value = "用户同步接口", notes = "接收IMS推送的用户数据支持新增、修改、删除操作")
public ImsResultVO userSynchronous(@RequestBody ImsUserDTO dto) {
public ImsResultVO userSynchronous(@RequestBody ImsUserDTO dto, HttpServletRequest request) {
log.info("IMS用户同步请求: type={}, userCode={}", dto.getType(), dto.getUsercode());
try (ServletInputStream inputStream = request.getInputStream();
ByteArrayOutputStream os = new ByteArrayOutputStream()) {
IOUtils.copy(inputStream, os);
log.info("IMS用户同步请求body{}", os);
} catch (Exception e) {
log.error("IMS用户同步请求参数读取失败", e);
}
try {
boolean result = imsUserService.syncUser(dto);
if (result) {