From 86df207c37502cce1b2043e1c7c0486459eef1d6 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期四, 13 三月 2025 19:58:45 +0800 Subject: [PATCH] 党员、诉求评论基础代码 --- springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/impl/LoginServiceImpl.java | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 40 insertions(+), 2 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/impl/LoginServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/impl/LoginServiceImpl.java index 99e41dd..d2bb502 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/impl/LoginServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/impl/LoginServiceImpl.java @@ -144,6 +144,8 @@ operlog.setRequestMethod(request.getMethod()); operlog.setOperLocation(IPUtil.getIpBelongAddress(request)); operlog.setOperTime(new Date()); // 创建时间 + operlog.setCommunityId(loginUser.getCommunityId()); + userService.addOperLog(operlog); return loginReturnVO; } @@ -157,16 +159,37 @@ * @return 登录结果 */ @Override - public LoginReturnVO loginShopBackStage(String account, String password,String appid) { + public LoginReturnVO loginShopBackStage(String account, String password,String appId) { Authentication authentication = null; authentication = - authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(account + "_5"+"_"+appid, password)); + authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(account + "_5"+"_"+appId, password)); LoginUserInfoVO loginUser = (LoginUserInfoVO)authentication.getPrincipal(); String token = JWTTokenUtil.generateToken(loginUser); String refeshToken = JWTTokenUtil.generateRefeshToken(loginUser); + ComActVO comActVO = loginUser.getComActVO(); LoginReturnVO loginReturnVO = new LoginReturnVO(); loginReturnVO.setToken(token); loginReturnVO.setRefreshToken(refeshToken); + loginReturnVO.setCommunityId(loginUser.getCommunityId()); + if (nonNull(comActVO)) { + loginReturnVO.setLat(comActVO.getLat()); + loginReturnVO.setLng(comActVO.getLng()); + } + //保存登录日志 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + SysOperLogVO operlog = new SysOperLogVO(); + operlog.setTitle("登录操作"); // 操作模块 + operlog.setBusinessType(1); // 操作类型 + operlog.setMethod("com.panzhihua.community_backstage.api.LoginApi.loginShopBackStage"); // 请求方法 + operlog.setAccount(loginUser.getAccount()); + operlog.setOperName(loginUser.getName()); // 请求用户名称 + operlog.setOperIp(IPUtil.getIpAddress(request)); // 请求IP + operlog.setOperUrl(request.getRequestURI()); // 请求URI + operlog.setRequestMethod(request.getMethod()); + operlog.setOperLocation(IPUtil.getIpBelongAddress(request)); + operlog.setOperTime(new Date()); // 创建时间 + operlog.setCommunityId(loginUser.getCommunityId()); + userService.addOperLog(operlog); return loginReturnVO; } @@ -357,4 +380,19 @@ loginReturnVO.setRefreshToken(refeshToken); return loginReturnVO; } + /** + * 三个身边后台用户登录 + */ + @Override + public LoginReturnVO loginThreeAround(Integer userId) { + LoginUserInfoVO loginUser = new LoginUserInfoVO(); + loginUser.setUserId(userId.longValue()); + loginUser.setType(21); + String token = JWTTokenUtil.generateToken(loginUser); + String refeshToken = JWTTokenUtil.generateRefeshToken(loginUser); + LoginReturnVO loginReturnVO = new LoginReturnVO(); + loginReturnVO.setToken(token); + loginReturnVO.setRefreshToken(refeshToken); + return loginReturnVO; + } } -- Gitblit v1.7.1