From 762420ec47768018ed4dbf93394826f343626aa2 Mon Sep 17 00:00:00 2001 From: kylin L <452061493@qq.com> Date: Fri, 26 Jul 2024 15:03:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=99=BB=E5=BD=95=E5=8A=A0?= =?UTF-8?q?=E4=B8=AA=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AppThirdLoginController.java | 21 ++++++++++++++++--- .../mapper/EnterpriseInformationMapper.xml | 1 - 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppThirdLoginController.java b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppThirdLoginController.java index 46ec6eca..a51813f7 100644 --- a/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppThirdLoginController.java +++ b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppThirdLoginController.java @@ -5,7 +5,10 @@ import com.alibaba.fastjson.JSONObject; import com.auth0.jwt.JWTVerifier; import com.zdxt.auth.feign.UserApi; import com.zdxt.auth.framework.shiro.jwt.JWTUtils; +import com.zdxt.auth.framework.shiro.nopaddword.LoginType; +import com.zdxt.auth.framework.shiro.nopaddword.UserToken; import com.zdxt.auth.project.system.user.service.IUserService; +import com.zdxt.auth.project.system.user.util.AesHelper; import com.zdxt.code.domain.MssqAddOrder; import com.zdxt.code.domain.SiqLogin; import com.zdxt.code.service.MssqApiService; @@ -19,6 +22,8 @@ import com.zdxt.common.util.RedisCache; import com.zdxt.domain.auth.User; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Hex; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.subject.Subject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -73,17 +78,27 @@ public class AppThirdLoginController { private ZwSmsClient zwSmsClient; @Autowired private MssqApiService mssqApiService; + @Autowired + private IUserService userService; /** * 深圳易平台登录 */ - @GetMapping("/testLogin/{userName}") + @PostMapping("/testLogin") @ResponseBody - public ZDResponse testLogin(@PathVariable String userName){ + public ZDResponse testLogin(@RequestBody Map params){ try { - User user = iUserService.selectUserByLoginName(userName); + String secretName = params.get("secretName"); + String secretKey = params.get("secretKey"); + //解密 + secretKey = AesHelper.desEncrypt(secretKey); +// UsernamePasswordToken token = new UsernamePasswordToken(username, password, false); + UserToken token = new UserToken(secretName, secretKey, LoginType.PASSWORD); + Subject subject = SecurityUtils.getSubject(); + subject.login(token); + User user = userService.selectUserByLoginName(secretName); redisCache.setCacheObject("shiro:app:"+user.getUserId(), user); // todo:这里需要将转换出来的User存redis用于做权限 return thirdLoginService.szyLogin(user.getLoginName()); } catch (Exception e) { diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml index 534f105a..b9763479 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml @@ -47,7 +47,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and business_scope = #{businessScope} and is_unsubscribe = #{isUnsubscribe} and industry = #{industry} - and enterprise_number in (select enterprise_number from enterprise_law_enforcement WHERE curdate() <= DATE_ADD(check_time, INTERVAL 5 DAY))