Browse Source

测试登录加个密码

v2
蟑螂恶霸 2 years ago
parent
commit
762420ec47
  1. 21
      lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppThirdLoginController.java
  2. 1
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml

21
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.auth0.jwt.JWTVerifier;
import com.zdxt.auth.feign.UserApi; import com.zdxt.auth.feign.UserApi;
import com.zdxt.auth.framework.shiro.jwt.JWTUtils; 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.service.IUserService;
import com.zdxt.auth.project.system.user.util.AesHelper;
import com.zdxt.code.domain.MssqAddOrder; import com.zdxt.code.domain.MssqAddOrder;
import com.zdxt.code.domain.SiqLogin; import com.zdxt.code.domain.SiqLogin;
import com.zdxt.code.service.MssqApiService; import com.zdxt.code.service.MssqApiService;
@ -19,6 +22,8 @@ import com.zdxt.common.util.RedisCache;
import com.zdxt.domain.auth.User; import com.zdxt.domain.auth.User;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Hex; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -73,17 +78,27 @@ public class AppThirdLoginController {
private ZwSmsClient zwSmsClient; private ZwSmsClient zwSmsClient;
@Autowired @Autowired
private MssqApiService mssqApiService; private MssqApiService mssqApiService;
@Autowired
private IUserService userService;
/** /**
* 深圳易平台登录 * 深圳易平台登录
*/ */
@GetMapping("/testLogin/{userName}") @PostMapping("/testLogin")
@ResponseBody @ResponseBody
public ZDResponse testLogin(@PathVariable String userName){ public ZDResponse testLogin(@RequestBody Map<String, String> params){
try { 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用于做权限 redisCache.setCacheObject("shiro:app:"+user.getUserId(), user); // todo:这里需要将转换出来的User存redis用于做权限
return thirdLoginService.szyLogin(user.getLoginName()); return thirdLoginService.szyLogin(user.getLoginName());
} catch (Exception e) { } catch (Exception e) {

1
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml

@ -47,7 +47,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessScope != null and businessScope != ''"> and business_scope = #{businessScope}</if> <if test="businessScope != null and businessScope != ''"> and business_scope = #{businessScope}</if>
<if test="isUnsubscribe != null"> and is_unsubscribe = #{isUnsubscribe}</if> <if test="isUnsubscribe != null"> and is_unsubscribe = #{isUnsubscribe}</if>
<if test="industry != null"> and industry = #{industry}</if> <if test="industry != null"> and industry = #{industry}</if>
<if test="enterpriseNumbers != null and enterpriseNumbers.size > 0 ">
<if test="params.reason != null and params.reason == 3"> <if test="params.reason != null and params.reason == 3">
and enterprise_number in (select enterprise_number from enterprise_law_enforcement WHERE curdate() &lt;= DATE_ADD(check_time, INTERVAL 5 DAY)) and enterprise_number in (select enterprise_number from enterprise_law_enforcement WHERE curdate() &lt;= DATE_ADD(check_time, INTERVAL 5 DAY))
</if> </if>

Loading…
Cancel
Save