fix 企业端短信登录接口

This commit is contained in:
lijiarao
2021-09-24 16:07:38 +08:00
parent fc28d2e7c8
commit 70d4e9d690
@@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -48,6 +49,8 @@ public class CompanyLoginController {
private ISysDictService sysDictService;
@Resource
private BaseCommonService baseCommonService;
@Value("${defaultPassword}")
private String defaultPassword;
/**
* 密码登录错误的次数前缀
*/
@@ -231,13 +234,15 @@ public class CompanyLoginController {
private void userInfo(PayContactsManagement contactsManagement, Result<JSONObject> result) {
String syspassword = contactsManagement.getPassword();
String username = contactsManagement.getPhone();
if (Objects.isNull(syspassword)) {
syspassword = defaultPassword;
}
// 生成token
String token = JwtUtil.sign(username, syspassword);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
// 获取用户部门信息
JSONObject obj = new JSONObject();
obj.put("token", token);