|
@@ -1,38 +1,35 @@
|
|
|
package com.zhongzheng.framework.web.service;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
-
|
|
|
-
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.zhongzheng.common.constant.Constants;
|
|
|
import com.zhongzheng.common.core.domain.entity.SysUser;
|
|
|
-import com.zhongzheng.common.core.domain.model.LoginBody;
|
|
|
+import com.zhongzheng.common.core.domain.model.LoginUser;
|
|
|
+import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
+import com.zhongzheng.common.exception.user.CaptchaException;
|
|
|
+import com.zhongzheng.common.exception.user.CaptchaExpireException;
|
|
|
+import com.zhongzheng.common.exception.user.UserPasswordNotMatchException;
|
|
|
+import com.zhongzheng.common.utils.AES;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
+import com.zhongzheng.common.utils.MessageUtils;
|
|
|
+import com.zhongzheng.common.utils.ServletUtils;
|
|
|
+import com.zhongzheng.framework.manager.AsyncManager;
|
|
|
import com.zhongzheng.framework.manager.factory.AsyncFactory;
|
|
|
+import com.zhongzheng.modules.goods.bo.OldTenantLoginBo;
|
|
|
import com.zhongzheng.modules.system.service.ISysConfigService;
|
|
|
import com.zhongzheng.modules.system.service.ISysUserService;
|
|
|
-import com.zhongzheng.common.utils.AES;
|
|
|
-import com.zhongzheng.framework.manager.factory.AsyncFactory;
|
|
|
import com.zhongzheng.modules.user.bo.UserBusinessLoginBo;
|
|
|
import com.zhongzheng.modules.user.service.IUserLoginErrorService;
|
|
|
-import org.apache.commons.compress.utils.IOUtils;
|
|
|
-import org.bouncycastle.jcajce.provider.asymmetric.rsa.RSAUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.security.authentication.AuthenticationManager;
|
|
|
import org.springframework.security.authentication.BadCredentialsException;
|
|
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-import com.zhongzheng.common.constant.Constants;
|
|
|
-import com.zhongzheng.common.core.domain.model.LoginUser;
|
|
|
-import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
-import com.zhongzheng.common.exception.CustomException;
|
|
|
-import com.zhongzheng.common.exception.user.CaptchaException;
|
|
|
-import com.zhongzheng.common.exception.user.CaptchaExpireException;
|
|
|
-import com.zhongzheng.common.exception.user.UserPasswordNotMatchException;
|
|
|
-import com.zhongzheng.common.utils.MessageUtils;
|
|
|
-import com.zhongzheng.framework.manager.AsyncManager;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
/**
|
|
@@ -188,6 +185,36 @@ public class SysLoginService
|
|
|
return tokenService.createToken(loginUser);
|
|
|
}
|
|
|
|
|
|
+ public String oldTenantLogin(OldTenantLoginBo bo) {
|
|
|
+ // 用户验证
|
|
|
+ SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>()
|
|
|
+ .eq(SysUser::getUserName, bo.getAccount())
|
|
|
+ .eq(SysUser::getTenantId, bo.getTenantId()));
|
|
|
+ if (ObjectUtils.isNull(sysUser)){
|
|
|
+ //新增账号
|
|
|
+ sysUser = new SysUser();
|
|
|
+ sysUser.setTenantId(Long.valueOf(bo.getTenantId()));
|
|
|
+ sysUser.setUserName(bo.getAccount());
|
|
|
+ //查询老系统密码
|
|
|
+ sysUser.setPassword("");
|
|
|
+ sysUser.setNickName(bo.getAccount());
|
|
|
+ sysUser.setSex("0");
|
|
|
+ sysUser.setStatus(1L);
|
|
|
+ sysUser.setDelFlag("0");
|
|
|
+ sysUser.setCode(ServletUtils.getEncoded("ZH"));
|
|
|
+ sysUser.setCreateTime(DateUtils.getNowDate());
|
|
|
+ sysUser.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ sysUser.setCreateBy("admin");
|
|
|
+ sysUser.setUpdateBy("admin");
|
|
|
+ sysUser.setRemark("系统增加(老系统业务员跳转)");
|
|
|
+ iSysUserService.save(sysUser);
|
|
|
+ }
|
|
|
+ LoginUser loginUser = new LoginUser();
|
|
|
+ loginUser.setUser(sysUser);
|
|
|
+ // 生成token
|
|
|
+ return tokenService.createToken(loginUser);
|
|
|
+ }
|
|
|
+
|
|
|
/* public String wx_login(String username)
|
|
|
{
|
|
|
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|