瀏覽代碼

相关接口添加日志

yzc 1 年之前
父節點
當前提交
cb4630aa84

+ 7 - 0
hx-base/src/main/java/com/fjhx/base/system/SysLoginController.java

@@ -1,5 +1,7 @@
 package com.fjhx.base.system;
 
+import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.fjhx.tenant.entity.tenant.po.TenantInfo;
 import com.fjhx.tenant.service.tenant.TenantInfoService;
@@ -14,6 +16,7 @@ import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.framework.web.service.SysLoginService;
 import com.ruoyi.framework.web.service.SysPermissionService;
 import com.ruoyi.system.service.ISysMenuService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 import java.util.Set;
@@ -30,6 +34,7 @@ import java.util.Set;
  *
  * @author ruoyi
  */
+@Slf4j
 @DS(BaseSourceConstant.BASE)
 @RestController
 public class SysLoginController {
@@ -59,6 +64,8 @@ public class SysLoginController {
     @PostMapping("/login")
     public AjaxResult login(@RequestBody LoginBody loginBody) {
         String tenantId = request.getHeader("tenantId");
+        log.error("调用方法:login,tenantId:{},date:{},data;{}",
+                tenantId, DateUtil.formatDateTime(new Date()), JSONObject.toJSONString(loginBody));
 
         TenantInfo tenantInfo = tenantInfoService.getOne(q -> q.eq(TenantInfo::getTenantId, tenantId));
         if (tenantInfo == null) {

+ 9 - 0
hx-tenant/src/main/java/com/fjhx/tenant/controller/tenant/UserTenantController.java

@@ -1,7 +1,9 @@
 package com.fjhx.tenant.controller.tenant;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.ruoyi.common.annotation.RepeatSubmit;
 import com.ruoyi.common.annotation.TenantIgnore;
@@ -18,14 +20,17 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.service.ISysPostService;
 import com.ruoyi.system.service.ISysRoleService;
 import com.ruoyi.system.service.ISysUserService;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
+@Slf4j
 @TenantIgnore
 @DS(BaseSourceConstant.BASE)
 @RestController
@@ -123,6 +128,10 @@ public class UserTenantController extends BaseController {
      */
     @PutMapping("/resetPwd")
     public void resetPwd(@RequestBody SysUser user) {
+        String tenantId = SecurityUtils.getTenantId();
+        Long userId = SecurityUtils.getUserId();
+        log.error("调用方法:resetPwd,tenantId:{},userId:{},date:{},data;{}",
+                tenantId, userId, DateUtil.formatDateTime(new Date()), JSONObject.toJSONString(user));
         userService.checkUserAllowed(user);
         userService.checkUserDataScope(user.getUserId());
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));