diff --git a/pmapi/pom.xml b/pmapi/pom.xml
index 7d52647..4cac2ab 100644
--- a/pmapi/pom.xml
+++ b/pmapi/pom.xml
@@ -232,11 +232,11 @@
com.ningdatech
nd-flowable-starter
-
-
-
-
-
+
+
+
+
+
com.alibaba.xxpt
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
index 3766d8a..10f9825 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
@@ -12,11 +12,11 @@ import org.springframework.stereotype.Component;
public interface UserInfoHelper {
/**
- * 根据用户id 获取 用户所属公司id
+ * 根据用户id 获取 用户所属公司 organizationCode
*
* @param userId
* @return
*/
- Long getCompanyId(Long userId);
+ String getOrganizationCode(Long userId);
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
index ffabb63..210478f 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
@@ -1,6 +1,9 @@
package com.ningdatech.pmapi.common.helper.impl;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
+import com.ningdatech.pmapi.user.manage.UserAuthLoginManage;
+import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
+import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
/**
@@ -8,11 +11,17 @@ import org.springframework.stereotype.Component;
* @date 2023/2/10 下午4:40
*/
@Component
+@RequiredArgsConstructor
public class UserInfoHelperImpl implements UserInfoHelper {
+ private final UserAuthLoginManage userAuthLoginManage;
+
+
@Override
- public Long getCompanyId(Long userId) {
- return null;
+ public String getOrganizationCode(Long userId) {
+ UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);
+
+ return userFullInfo.getOrganizationCode();
}
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/entity/CompanyFiscalCode.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/entity/CompanyFiscalCode.java
index 2a5fcc6..0767cf1 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/entity/CompanyFiscalCode.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/entity/CompanyFiscalCode.java
@@ -26,7 +26,7 @@ public class CompanyFiscalCode implements Serializable {
private String fiscalCode;
- private Long companyId;
+ private String organizationCode;
private LocalDateTime createOn;
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java
index a3de1db..b6fe709 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java
@@ -28,14 +28,14 @@ public class CompanyFiscalCodeManage {
public void fiscalCodeConfigure(ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) {
Long userId = LoginUserUtil.getUserId();
- Long companyId = userInfoHelper.getCompanyId(userId);
+ String organizationCode = userInfoHelper.getOrganizationCode(userId);
// TODO 校验用户权限
// 保存财政编码配置
String fiscalCode = reqCompanyFiscalCodeAndSealSnPO.getFiscalCode();
CompanyFiscalCode companyFiscalCodeSaveRecord = new CompanyFiscalCode();
companyFiscalCodeSaveRecord.setFiscalCode(fiscalCode);
- companyFiscalCodeSaveRecord.setCompanyId(companyId);
+ companyFiscalCodeSaveRecord.setOrganizationCode(organizationCode);
companyFiscalCodeSaveRecord.setCreateOn(LocalDateTime.now());
companyFiscalCodeSaveRecord.setUpdateOn(LocalDateTime.now());
companyFiscalCodeSaveRecord.setCreateBy(userId);
@@ -46,7 +46,7 @@ public class CompanyFiscalCodeManage {
String sealSn = reqCompanyFiscalCodeAndSealSnPO.getSealSn();
CompanySignature companySignatureSaveRecord = new CompanySignature();
companySignatureSaveRecord.setSealSn(sealSn);
- companySignatureSaveRecord.setCompanyId(companyId);
+ companySignatureSaveRecord.setOrganizationCode(organizationCode);
companySignatureSaveRecord.setCreateOn(LocalDateTime.now());
companySignatureSaveRecord.setUpdateOn(LocalDateTime.now());
companySignatureSaveRecord.setCreateBy(userId);
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/signature/entity/CompanySignature.java b/pmapi/src/main/java/com/ningdatech/pmapi/signature/entity/CompanySignature.java
index 96be058..bc7f756 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/signature/entity/CompanySignature.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/signature/entity/CompanySignature.java
@@ -26,7 +26,7 @@ public class CompanySignature implements Serializable {
private String sealSn;
- private Long companyId;
+ private String organizationCode;
private LocalDateTime createOn;
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java
index 4f4aa12..d9fc07b 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java
@@ -43,9 +43,9 @@ public class UserAuthController {
@ApiImplicitParam(name = "credential", value = "凭证", required = true, paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "loginType", value = "DING_QR_LOGIN 浙政钉扫码登陆,PHONE_VERIFICATION_CODE_LOGIN 手机号验证码登陆"
, required = true, paramType = "form", dataType = "String")})
- public void loginByUsernameAndPassword(@RequestParam(value = "identifier",required = false) String identifier,
- @RequestParam(value = "credential",required = false) String credential,
- @RequestParam("loginType") String loginType) {
+ public void credentialLogin(@RequestParam(value = "identifier", required = false) String identifier,
+ @RequestParam(value = "credential", required = false) String credential,
+ @RequestParam("loginType") String loginType) {
// 不实现任何内容,只是为了出api文档
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java
index dd36c1c..a9d039a 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java
@@ -1,6 +1,16 @@
package com.ningdatech.pmapi.user.manage;
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
+import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
+import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
+import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
+import com.ningdatech.pmapi.sys.model.entity.Role;
+import com.ningdatech.pmapi.sys.model.entity.UserRole;
+import com.ningdatech.pmapi.sys.service.IRoleService;
+import com.ningdatech.pmapi.sys.service.IUserRoleService;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.service.IUserAuthService;
@@ -8,7 +18,10 @@ import com.ningdatech.pmapi.user.service.IUserInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Objects;
+import java.util.stream.Collectors;
/**
* @author liuxinxin
@@ -21,6 +34,28 @@ public class UserAuthLoginManage {
private final IUserAuthService iUserAuthService;
private final IUserInfoService iUserInfoService;
+ private final IRoleService iRoleService;
+ private final IDingOrganizationService iDingOrganizationService;
+ private final IDingEmployeeInfoService iDingEmployeeInfoService;
+ private final IUserRoleService iUserRoleService;
+
+
+ /**
+ * 根据用户id 获取用户全量信息
+ *
+ * @param userId
+ * @return
+ */
+ public UserFullInfoDTO getUserFullInfo(Long userId) {
+ UserInfo userInfo = iUserInfoService.getById(userId);
+ if (Objects.isNull(userInfo)) {
+ return null;
+ }
+ // 返回用户全量信息
+ UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
+ userFullInfoDTOAssembler(userInfo, userFullInfoDTO);
+ return userFullInfoDTO;
+ }
/**
* 根据用户名获取
@@ -29,12 +64,14 @@ public class UserAuthLoginManage {
* @return
*/
public UserFullInfoDTO queryUserInfoInPasswordAuth(String username) {
+ // TODO 目前账号密码登陆测试使用 强制用户登录 userId 1L
+ UserInfo userInfo = iUserInfoService.getById(1L);
+ if (Objects.isNull(userInfo)) {
+ return null;
+ }
+ // 返回用户全量信息
UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
- userFullInfoDTO.setCompanyId(1L);
- userFullInfoDTO.setUserId(1L);
- userFullInfoDTO.setIdentifier("123456");
- userFullInfoDTO.setRealName("测试账号");
- userFullInfoDTO.setUsername("测试账号");
+ userFullInfoDTOAssembler(userInfo, userFullInfoDTO);
return userFullInfoDTO;
}
@@ -45,55 +82,76 @@ public class UserAuthLoginManage {
* @return
*/
public UserFullInfoDTO queryUserInfoInPhoneNoAuth(String phoneNo) {
-// UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
-// .eq(UserInfo::getMobile, phoneNo));
-// if (Objects.isNull(userInfo)) {
-// return null;
-// }
-//
-// UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
-// userFullInfoDTO.setCompanyId(1L);
-// userFullInfoDTO.setUserId(userInfo.getId());
-// userFullInfoDTO.setIdentifier(userInfo.getRealName());
-// userFullInfoDTO.setRealName(userInfo.getRealName());
-// userFullInfoDTO.setUsername(userInfo.getRealName());
-// return userFullInfoDTO;
-
+ UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
+ .eq(UserInfo::getMobile, phoneNo));
+ if (Objects.isNull(userInfo)) {
+ return null;
+ }
+ // 返回用户全量信息
UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
- userFullInfoDTO.setCompanyId(1L);
- userFullInfoDTO.setUserId(1L);
- userFullInfoDTO.setIdentifier("123456");
- userFullInfoDTO.setRealName("测试账号");
- userFullInfoDTO.setUsername("测试账号");
+ userFullInfoDTOAssembler(userInfo, userFullInfoDTO);
return userFullInfoDTO;
}
/**
- * 根据accountId
+ * 根据accountId(浙政钉扫码登陆)
*
* @param accountId
* @return
*/
public UserFullInfoDTO queryUserInfoInAccountIdAuth(String accountId) {
-// UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
-// .eq(UserInfo::getAccountId, accountId));
-// if (Objects.isNull(userInfo)) {
-// return null;
-// }
-// UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
-// userFullInfoDTO.setCompanyId(1L);
-// userFullInfoDTO.setUserId(userInfo.getId());
-// userFullInfoDTO.setIdentifier(userInfo.getRealName());
-// userFullInfoDTO.setRealName(userInfo.getRealName());
-// userFullInfoDTO.setUsername(userInfo.getRealName());
-// return userFullInfoDTO;
+ // 获取用户信息
+ UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
+ .eq(UserInfo::getAccountId, accountId));
+ if (Objects.isNull(userInfo)) {
+ return null;
+ }
+ // 返回用户全量信息
UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
- userFullInfoDTO.setCompanyId(1L);
- userFullInfoDTO.setUserId(1L);
- userFullInfoDTO.setIdentifier("123456");
- userFullInfoDTO.setRealName("测试账号");
- userFullInfoDTO.setUsername("测试账号");
+ userFullInfoDTOAssembler(userInfo, userFullInfoDTO);
return userFullInfoDTO;
}
+
+
+ private void userFullInfoDTOAssembler(UserInfo userInfo, UserFullInfoDTO userFullInfoDTO) {
+ // 获取浙政钉雇员信息 组织信息
+ String employeeCode = userInfo.getEmployeeCode();
+ if (StringUtils.isNotBlank(employeeCode)) {
+ List dingEmployeeInfoList = iDingEmployeeInfoService
+ .list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
+ .eq(DingEmployeeInfo::getEmployeeCode, employeeCode)
+ .eq(DingEmployeeInfo::getMainJob, "true"));
+ DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0);
+
+ String organizationCode = dingEmployeeInfo.getOrganizationCode();
+ List dingOrganizationList = iDingOrganizationService
+ .list(Wrappers.lambdaQuery(DingOrganization.class)
+ .eq(DingOrganization::getOrganizationCode, organizationCode));
+ DingOrganization dingOrganization = dingOrganizationList.get(0);
+
+ userFullInfoDTO.setOrganizationCode(dingOrganization.getOrganizationCode());
+ userFullInfoDTO.setOrganizationName(dingOrganization.getOrganizationName());
+ userFullInfoDTO.setRegionCode(dingOrganization.getDivisionCode());
+ }
+
+ List roleList = new ArrayList<>();
+ // 获取用户角色列表信息
+ List userRoleList = iUserRoleService
+ .list(Wrappers.lambdaQuery(UserRole.class)
+ .eq(UserRole::getUserId, userInfo.getId()));
+ if (CollectionUtil.isNotEmpty(userRoleList)) {
+ List roleIdList = userRoleList.stream()
+ .map(UserRole::getRoleId).distinct()
+ .collect(Collectors.toList());
+ roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList));
+ }
+ userFullInfoDTO.setUserRoleList(roleList);
+
+ // 装配返回
+ userFullInfoDTO.setUserId(userInfo.getId());
+ userFullInfoDTO.setIdentifier(userInfo.getRealName());
+ userFullInfoDTO.setRealName(userInfo.getRealName());
+ userFullInfoDTO.setUsername(userInfo.getRealName());
+ }
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/RoleInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/RoleInfoMapper.java
deleted file mode 100644
index 42697b2..0000000
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/RoleInfoMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.ningdatech.pmapi.user.mapper;
-
-import com.ningdatech.pmapi.user.entity.RoleInfo;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- *
- * 角色表 Mapper 接口
- *
- *
- * @author Liuxinxin
- * @since 2023-01-05
- */
-public interface RoleInfoMapper extends BaseMapper {
-
-}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/RoleInfoMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/RoleInfoMapper.xml
deleted file mode 100644
index 8261f10..0000000
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/mapper/RoleInfoMapper.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java
index a79030f..ddc42a1 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java
@@ -57,11 +57,13 @@ public class CredentialLoginUserDetailService implements UserDetailsService {
userInfoDetails.setUserId(userFullInfoDTO.getUserId());
userInfoDetails.setUsername(userFullInfoDTO.getUsername());
userInfoDetails.setRealName(userFullInfoDTO.getRealName());
- userInfoDetails.setRole(userFullInfoDTO.getRole());
+ userInfoDetails.setUserRoleList(userFullInfoDTO.getUserRoleList());
userInfoDetails.setRegionCode(userFullInfoDTO.getRegionCode());
- userInfoDetails.setCompanyId(userFullInfoDTO.getCompanyId());
userInfoDetails.setIdentifier(userFullInfoDTO.getIdentifier());
userInfoDetails.setPassword(userFullInfoDTO.getCredential());
+
+ userInfoDetails.setOrganizationCode(userFullInfoDTO.getOrganizationCode());
+ userInfoDetails.setOrganizationName(userFullInfoDTO.getOrganizationName());
return userInfoDetails;
}
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java
index f558f9c..d16dbba 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java
@@ -1,7 +1,10 @@
package com.ningdatech.pmapi.user.security.auth.model;
+import com.ningdatech.pmapi.sys.model.entity.Role;
import lombok.Data;
+import java.util.List;
+
/**
* @author liuxinxin
* @date 2023/1/4 下午5:07
@@ -20,9 +23,29 @@ public class UserFullInfoDTO {
private String credential;
- private String role;
+ /**
+ * 所属区域编码
+ */
+ private String regionCode;
+
+ /**
+ * 浙政钉扫码 员工code
+ */
+ private String employeeCode;
+
+ /**
+ * 浙政钉组织code
+ */
+ private String organizationCode;
+
+ /**
+ * 浙政钉组织名称
+ */
+ private String organizationName;
- private Long regionCode;
+ /**
+ * 用户角色
+ */
+ private List userRoleList;
- private Long companyId;
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java
index 53b8efc..2dcabca 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java
@@ -2,9 +2,9 @@ package com.ningdatech.pmapi.user.security.auth.model;
import cn.hutool.core.collection.CollectionUtil;
import com.ningdatech.basic.auth.AbstractLoginUser;
+import com.ningdatech.pmapi.sys.model.entity.Role;
import lombok.Data;
import lombok.EqualsAndHashCode;
-import org.apache.commons.lang3.StringUtils;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
@@ -25,16 +25,31 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
private String password;
- private String role;
+ /**
+ * 所属区域编码
+ */
+ private String regionCode;
+
+ /**
+ * 浙政钉扫码 员工code
+ */
+ private String employeeCode;
- private List roleIdList;
+ /**
+ * 浙政钉组织code
+ */
+ private String organizationCode;
+
+ /**
+ * 浙政钉组织名称
+ */
+ private String organizationName;
/**
- * 区域code
+ * 用户角色
*/
- private Long regionCode;
+ private List userRoleList;
- private Long companyId;
/**
* 获取用户权限
@@ -43,9 +58,12 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
*/
@Override
public Collection extends GrantedAuthority> getAuthorities() {
- if (StringUtils.isNotBlank(role)) {
- SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority(this.role);
- return CollectionUtil.toList(simpleGrantedAuthority);
+ if (CollectionUtil.isNotEmpty(this.userRoleList)) {
+ List authorities = new ArrayList<>();
+ for (Role role : this.userRoleList) {
+ authorities.add(new SimpleGrantedAuthority(role.getCode()));
+ }
+ return authorities;
}
return new ArrayList<>();
}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IRoleInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IRoleInfoService.java
deleted file mode 100644
index 7377fcc..0000000
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IRoleInfoService.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.ningdatech.pmapi.user.service;
-
-import com.ningdatech.pmapi.user.entity.RoleInfo;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- *
- * 角色表 服务类
- *
- *
- * @author Liuxinxin
- * @since 2023-01-05
- */
-public interface IRoleInfoService extends IService {
-
-}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserRoleService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserRoleService.java
deleted file mode 100644
index c77bbe8..0000000
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserRoleService.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.ningdatech.pmapi.user.service;
-
-import com.ningdatech.pmapi.user.entity.UserRole;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- *
- * 用户角色表 服务类
- *
- *
- * @author Liuxinxin
- * @since 2023-01-05
- */
-public interface IUserRoleService extends IService {
-
-}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/RoleInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/RoleInfoServiceImpl.java
deleted file mode 100644
index e62f7f7..0000000
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/RoleInfoServiceImpl.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.ningdatech.pmapi.user.service.impl;
-
-import com.ningdatech.pmapi.user.entity.RoleInfo;
-import com.ningdatech.pmapi.user.mapper.RoleInfoMapper;
-import com.ningdatech.pmapi.user.service.IRoleInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- *
- * 角色表 服务实现类
- *
- *
- * @author Liuxinxin
- * @since 2023-01-05
- */
-@Service
-public class RoleInfoServiceImpl extends ServiceImpl implements IRoleInfoService {
-
-}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserAuthServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserAuthServiceImpl.java
index 9d49fca..c71f49b 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserAuthServiceImpl.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserAuthServiceImpl.java
@@ -3,8 +3,8 @@ package com.ningdatech.pmapi.user.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.user.entity.UserAuth;
import com.ningdatech.pmapi.user.entity.UserInfo;
-import com.ningdatech.pmapi.user.mapper.UserAuthMapper;
import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper;
+import com.ningdatech.pmapi.user.mapper.UserAuthMapper;
import com.ningdatech.pmapi.user.service.IUserAuthService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java
index ffc78b0..c5563e8 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java
@@ -1,6 +1,7 @@
package com.ningdatech.pmapi.user.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
@@ -9,11 +10,14 @@ import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper;
import com.ningdatech.pmapi.user.service.IUserInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
-import java.util.*;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
import java.util.stream.Collectors;
/**
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/util/LoginUserUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/util/LoginUserUtil.java
index 05d8870..f686cb7 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/user/util/LoginUserUtil.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/util/LoginUserUtil.java
@@ -1,10 +1,11 @@
package com.ningdatech.pmapi.user.util;
import com.ningdatech.basic.auth.AbstractLoginUserUtil;
+import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
-import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
/**
@@ -19,9 +20,9 @@ public class LoginUserUtil extends AbstractLoginUserUtil {
}
public static List getRoleIdList() {
- List roleIdList = new ArrayList<>();
- roleIdList.add(1L);
- return roleIdList;
+ UserInfoDetails userInfoDetails = loginUserDetail();
+ List userRoleList = userInfoDetails.getUserRoleList();
+ return userRoleList.stream().map(Role::getId).collect(Collectors.toList());
}
}