|
@@ -1,28 +1,19 @@
|
|
|
package com.sckw.auth.service.impl;
|
|
package com.sckw.auth.service.impl;
|
|
|
|
|
|
|
|
-import cn.hutool.core.lang.UUID;
|
|
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
-import com.sckw.core.utils.PasswordUtils;
|
|
|
|
|
import com.sckw.core.utils.UUIDUtils;
|
|
import com.sckw.core.utils.UUIDUtils;
|
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
|
import com.sckw.system.api.model.dto.req.LoginReqDto;
|
|
import com.sckw.system.api.model.dto.req.LoginReqDto;
|
|
|
import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
|
-import com.sckw.system.api.model.dto.res.LoginResDto;
|
|
|
|
|
|
|
+import com.sckw.system.api.model.dto.res.*;
|
|
|
import com.sckw.auth.service.IIndexService;
|
|
import com.sckw.auth.service.IIndexService;
|
|
|
import com.sckw.system.api.RemoteUserService;
|
|
import com.sckw.system.api.RemoteUserService;
|
|
|
-import com.sckw.system.model.KwsDept;
|
|
|
|
|
-import com.sckw.system.model.KwsEnterprise;
|
|
|
|
|
-import com.sckw.system.model.KwsUser;
|
|
|
|
|
-import com.sckw.system.model.KwsUserDept;
|
|
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@Service
|
|
@Service
|
|
@@ -36,39 +27,38 @@ public class IndexServiceImpl implements IIndexService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public LoginResDto login(LoginReqDto reqDto) {
|
|
public LoginResDto login(LoginReqDto reqDto) {
|
|
|
- /**1、根据账号密码或者手机号校验码登录,密码加密处理后面做*/
|
|
|
|
|
- KwsUser kwsUser = remoteUserService.checkUserBase(reqDto.getUsername());
|
|
|
|
|
|
|
+ /*1、根据账号密码或者手机号校验码登录,密码加密处理后面做*/
|
|
|
|
|
+ KwsUserResDto kwsUser = remoteUserService.checkUserBase(reqDto.getUsername());
|
|
|
|
|
|
|
|
//密码校验
|
|
//密码校验
|
|
|
remoteUserService.checkPassword(reqDto.getPassword(), kwsUser.getPassword());
|
|
remoteUserService.checkPassword(reqDto.getPassword(), kwsUser.getPassword());
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**2、登录成功,查询用户机构*/
|
|
|
|
|
- List<KwsUserDept> kwsUserDepts = remoteUserService.queryUserDeptByUserId(kwsUser.getId());
|
|
|
|
|
|
|
+ /*2、登录成功,查询用户机构*/
|
|
|
|
|
+ List<KwsUserDeptResDto> kwsUserDepts = remoteUserService.queryUserDeptByUserId(kwsUser.getId());
|
|
|
if (CollectionUtils.isEmpty(kwsUserDepts)) {
|
|
if (CollectionUtils.isEmpty(kwsUserDepts)) {
|
|
|
//不用抛异常,可能没有认证
|
|
//不用抛异常,可能没有认证
|
|
|
|
|
+ log.info("");
|
|
|
}
|
|
}
|
|
|
- List<Long> deptIds = kwsUserDepts.stream().map(KwsUserDept::getDeptId).toList();
|
|
|
|
|
- List<KwsDept> kwsDepts = remoteUserService.queryDeptByIds(deptIds);
|
|
|
|
|
|
|
+ List<Long> deptIds = kwsUserDepts.stream().map(KwsUserDeptResDto::getDeptId).toList();
|
|
|
|
|
+ List<KwsDeptResDto> kwsDepts = remoteUserService.queryDeptByIds(deptIds);
|
|
|
|
|
|
|
|
- /**3、查企业*/
|
|
|
|
|
- List<Long> entIds = kwsDepts.stream().map(KwsDept::getEntId).toList();
|
|
|
|
|
- List<KwsEnterprise> kwsEnterprises = remoteUserService.queryEnterpriseByIds(entIds);
|
|
|
|
|
|
|
+ /*3、查企业*/
|
|
|
|
|
+ List<Long> entIds = kwsDepts.stream().map(KwsDeptResDto::getEntId).toList();
|
|
|
|
|
+ List<KwsEnterpriseResDto> kwsEnterprises = remoteUserService.queryEnterpriseByIds(entIds);
|
|
|
|
|
|
|
|
- /**4、以uuid作为主键存redis,也是会话token*/
|
|
|
|
|
|
|
+ /*4、以uuid作为主键存redis,也是会话token*/
|
|
|
String key = UUIDUtils.get32UUID();
|
|
String key = UUIDUtils.get32UUID();
|
|
|
redissonUtils.add(key, "");
|
|
redissonUtils.add(key, "");
|
|
|
|
|
|
|
|
- /**5、组装返参*/
|
|
|
|
|
|
|
+ /*5、组装返参*/
|
|
|
//todo
|
|
//todo
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void register(RegisterReqDto reqDto) {
|
|
public void register(RegisterReqDto reqDto) {
|
|
|
- KwsUser kwsUser = new KwsUser();
|
|
|
|
|
- BeanUtils.copyProperties(reqDto, kwsUser);
|
|
|
|
|
- remoteUserService.register(kwsUser);
|
|
|
|
|
|
|
+ remoteUserService.register(reqDto);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|