Procházet zdrojové kódy

增加扫描服务端管理员登录接口日志

luoshi před 1 rokem
rodič
revize
223f42f0f6

+ 13 - 15
stmms-web/src/main/java/cn/com/qmth/stmms/api/controller/LoginController.java

@@ -1,20 +1,5 @@
 package cn.com.qmth.stmms.api.controller;
 
-import java.util.Date;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-
 import cn.com.qmth.stmms.api.exception.ApiException;
 import cn.com.qmth.stmms.biz.config.service.impl.SystemCache;
 import cn.com.qmth.stmms.biz.exam.service.SubjectUserService;
@@ -29,6 +14,18 @@ import cn.com.qmth.stmms.common.enums.Role;
 import cn.com.qmth.stmms.common.utils.EncryptUtils;
 import cn.com.qmth.stmms.common.utils.RequestIPUtil;
 import cn.com.qmth.stmms.common.utils.RequestUtils;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+import java.util.Set;
 
 @Controller("loginApiController")
 @RequestMapping("/api")
@@ -96,6 +93,7 @@ public class LoginController extends BaseApiController {
         user.setLastLoginIp(RequestIPUtil.getIpAddress(request));
         user.refreshScanToken();
         user = userService.save(user);
+        log.info("/api/admin/login success, loginName={}, scanToken={}", user.getLoginName(), user.getScanToken());
         JSONObject obj = new JSONObject();
         obj.accumulate("id", user.getId());
         obj.accumulate("name", user.getName());