From b867f4c6b69b0b945512bca1cd88c55f771f580c Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 12 十月 2022 15:13:16 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/controller/all/SignController.java | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/lf/server/controller/all/SignController.java b/src/main/java/com/lf/server/controller/all/SignController.java index c950e57..60106ae 100644 --- a/src/main/java/com/lf/server/controller/all/SignController.java +++ b/src/main/java/com/lf/server/controller/all/SignController.java @@ -1,21 +1,24 @@ package com.lf.server.controller.all; +import com.lf.server.aspect.LogAspect; import com.lf.server.aspect.SysLog; import com.lf.server.config.PropertiesConfig; import com.lf.server.entity.all.ResponseMsg; import com.lf.server.entity.all.StaticData; import com.lf.server.entity.sys.LoginEntity; import com.lf.server.entity.sys.TokenEntity; -import com.lf.server.entity.sys.UsersEntity; +import com.lf.server.entity.sys.UserEntity; import com.lf.server.helper.*; import com.lf.server.service.sys.LoginService; import com.lf.server.service.sys.TokenService; -import com.lf.server.service.sys.UsersService; +import com.lf.server.service.sys.UserService; import com.lf.server.service.all.SignService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -33,7 +36,7 @@ @RequestMapping("/sign") public class SignController extends BaseController { @Autowired - UsersService userService; + UserService userService; @Autowired LoginService loginService; @@ -53,7 +56,7 @@ public ModelAndView toIndex(ModelAndView mv, HttpServletRequest req) { mv.setViewName("index"); - UsersEntity ue = tokenService.getCurrentUser(req); + UserEntity ue = tokenService.getCurrentUser(req); if (ue != null) { mv.addObject("msg", "Hello " + ue.getUname() + " !"); } @@ -78,7 +81,7 @@ mv.setViewName("druid"); try { - UsersEntity ue = tokenService.getCurrentUser(req); + UserEntity ue = tokenService.getCurrentUser(req); if (ue != null) { String sessionId = WebHelper.getCookieByKey(StaticData.DRUID_COOKIE_KEY, req); if (StringHelper.isNull(sessionId)) { @@ -86,7 +89,7 @@ } } } catch (Exception ex) { - // + log.error(ex.getMessage() + ex.getStackTrace() + "\n"); } return mv; @@ -99,12 +102,12 @@ try { mv.setViewName("redirect:/toLogin"); - UsersEntity ue = tokenService.getCurrentUser(req); + UserEntity ue = tokenService.getCurrentUser(req); if (ue != null) { mv.setViewName("monitor"); } } catch (Exception ex) { - // + log.error(ex.getMessage() + ex.getStackTrace() + "\n"); } return mv; @@ -116,7 +119,7 @@ @ApiImplicitParam(name = "user", value = "鐢ㄦ埗鍚�", dataType = "UsersEntity", paramType = "body", example = "") }) @PostMapping(value = "/login", produces = "application/json; charset=UTF-8") - public ResponseMsg<TokenEntity> login(@RequestBody UsersEntity user, HttpServletRequest req, HttpServletResponse res) { + public ResponseMsg<TokenEntity> login(@RequestBody UserEntity user, HttpServletRequest req, HttpServletResponse res) { try { if (user == null) { return fail("璇疯緭鍏ョ敤鎴峰悕鍜屽瘑鐮侊紒", null); @@ -132,7 +135,7 @@ String uid = RsaHelper.decrypt(user.getUid()); String pwd = RsaHelper.decrypt(user.getPwd()); - UsersEntity ue = userService.selectByUid(uid); + UserEntity ue = userService.selectByUid(uid); if (ue == null) { return fail("鐢ㄦ埛鍚嶄笉瀛樺湪锛�", null); } @@ -190,7 +193,7 @@ Boolean flag = tokenService.isLogin(req, res); if (flag) { // 鍐欐棩蹇� - UsersEntity ue = tokenService.getCurrentUser(req); + UserEntity ue = tokenService.getCurrentUser(req); LoginEntity le = loginService.getNewLogin(ue.getId(), 2, req); Integer rows = loginService.insertLogin(le); } @@ -204,9 +207,9 @@ @SysLog() @ApiOperation(value = "鑾峰彇褰撳墠鐢ㄦ埛") @GetMapping("/getCurrentUser") - public ResponseMsg<UsersEntity> getCurrentUser(HttpServletRequest req) { + public ResponseMsg<UserEntity> getCurrentUser(HttpServletRequest req) { try { - UsersEntity ue = tokenService.getCurrentUser(req); + UserEntity ue = tokenService.getCurrentUser(req); if (ue == null) { return fail("娌℃湁鎵惧埌", null); } -- Gitblit v1.9.3