Merge branch 'dev-z' into 'main'
修复缺失的service文件 See merge request itc/ma/2024/ms-back!1
This commit is contained in:
@ -26,19 +26,18 @@ import com.xjrsoft.common.core.exception.ValidationException;
|
|||||||
import com.xjrsoft.common.redis.service.RedisUtil;
|
import com.xjrsoft.common.redis.service.RedisUtil;
|
||||||
import com.xjrsoft.organization.client.*;
|
import com.xjrsoft.organization.client.*;
|
||||||
import com.xjrsoft.organization.entity.*;
|
import com.xjrsoft.organization.entity.*;
|
||||||
import com.xjrsoft.organization.service.*;
|
|
||||||
import com.xjrsoft.system.client.ILoginConfigClient;
|
import com.xjrsoft.system.client.ILoginConfigClient;
|
||||||
import com.xjrsoft.system.client.ITenantClient;
|
import com.xjrsoft.system.client.ITenantClient;
|
||||||
import com.xjrsoft.system.dto.CreateTokenDto;
|
import com.xjrsoft.system.dto.CreateTokenDto;
|
||||||
import com.xjrsoft.system.entity.LoginConfig;
|
import com.xjrsoft.system.entity.LoginConfig;
|
||||||
import com.xjrsoft.system.entity.Tenant;
|
import com.xjrsoft.system.entity.Tenant;
|
||||||
import com.xjrsoft.system.service.ILoginConfigService;
|
|
||||||
import com.xjrsoft.system.vo.CreateTokenVo;
|
import com.xjrsoft.system.vo.CreateTokenVo;
|
||||||
import com.xjrsoft.system.vo.LoginVo;
|
import com.xjrsoft.system.vo.LoginVo;
|
||||||
import com.xjrsoft.tenant.config.TenantConfig;
|
import com.xjrsoft.tenant.config.TenantConfig;
|
||||||
import com.xjrsoft.tenant.util.SecureUtil;
|
import com.xjrsoft.tenant.util.SecureUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -79,9 +78,7 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getUserInfoByName(String userName) {
|
public User getUserInfoByName(String userName) {
|
||||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
User loginUser = userClient.getUserByUserNameFeign(userName);
|
||||||
queryWrapper.eq(User::getUserName, userName);
|
|
||||||
User loginUser = userService.getOne(queryWrapper);
|
|
||||||
return loginUser;
|
return loginUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,12 +95,9 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
throw new MyException("登录人数超过授权人数,无法登录,请联系管理员!");
|
throw new MyException("登录人数超过授权人数,无法登录,请联系管理员!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
User loginUser = getUserInfoByName(dto.getUserName());
|
||||||
|
|
||||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
List<LoginConfig> list = loginConfigClient.getAllListFeign();
|
||||||
queryWrapper.eq(User::getUserName, dto.getUserName());
|
|
||||||
User loginUser = userService.getOne(queryWrapper);
|
|
||||||
|
|
||||||
List<LoginConfig> list = loginConfigService.list();
|
|
||||||
if (list.size() == 0){//如果没有,则设置为默认配置,并进行保存
|
if (list.size() == 0){//如果没有,则设置为默认配置,并进行保存
|
||||||
LoginConfig loginConfig = new LoginConfig();
|
LoginConfig loginConfig = new LoginConfig();
|
||||||
loginConfig.setId(1L);
|
loginConfig.setId(1L);
|
||||||
@ -113,7 +107,7 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
loginConfig.setPasswordStrategy(YesOrNoEnum.YES.getCode());
|
loginConfig.setPasswordStrategy(YesOrNoEnum.YES.getCode());
|
||||||
loginConfig.setStrategyMaxNumber(7);
|
loginConfig.setStrategyMaxNumber(7);
|
||||||
list.add(loginConfig);
|
list.add(loginConfig);
|
||||||
loginConfigService.save(loginConfig);
|
loginConfigClient.addLoginConfigFeign(loginConfig);
|
||||||
}
|
}
|
||||||
LoginConfig loginConfig = list.get(0);
|
LoginConfig loginConfig = list.get(0);
|
||||||
|
|
||||||
@ -140,13 +134,13 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
redisUtil.set(GlobalConstant.LOGIN_ERROR_NUMBER + loginUser.getId() , Integer.valueOf(value) + 1);
|
redisUtil.set(GlobalConstant.LOGIN_ERROR_NUMBER + loginUser.getId() , Integer.valueOf(value) + 1);
|
||||||
}else {
|
}else {
|
||||||
loginUser.setEnabledMark(EnabledMark.DISABLED.getCode());
|
loginUser.setEnabledMark(EnabledMark.DISABLED.getCode());
|
||||||
userService.updateById(loginUser);
|
userClient.updateUserInfoFeign(loginUser);
|
||||||
throw new MyException("当前账号已被锁定,请联系管理员");
|
throw new MyException("当前账号已被锁定,请联系管理员");
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if (loginConfig.getStrategyMaxNumber() == 1){
|
if (loginConfig.getStrategyMaxNumber() == 1){
|
||||||
loginUser.setEnabledMark(EnabledMark.DISABLED.getCode());
|
loginUser.setEnabledMark(EnabledMark.DISABLED.getCode());
|
||||||
userService.updateById(loginUser);
|
userClient.updateUserInfoFeign(loginUser);
|
||||||
throw new MyException("当前账号已被锁定,请联系管理员");
|
throw new MyException("当前账号已被锁定,请联系管理员");
|
||||||
}else {
|
}else {
|
||||||
redisUtil.set(GlobalConstant.LOGIN_ERROR_NUMBER + loginUser.getId() , number);
|
redisUtil.set(GlobalConstant.LOGIN_ERROR_NUMBER + loginUser.getId() , number);
|
||||||
@ -189,24 +183,22 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
|
|
||||||
SaSession tokenSession = StpUtil.getTokenSession();
|
SaSession tokenSession = StpUtil.getTokenSession();
|
||||||
|
|
||||||
List<UserDeptRelation> userDeptRelations = userDeptRelationService.list(Wrappers.lambdaQuery(UserDeptRelation.class)
|
List<UserDeptRelation> userDeptRelations = userDeptRelationClient.getUserDeptRelationListFeign(StpUtil.getLoginIdAsLong());
|
||||||
.eq(UserDeptRelation::getUserId, StpUtil.getLoginIdAsLong()));
|
|
||||||
|
|
||||||
List<UserPostRelation> userPostRelations = userPostRelationService.list(Wrappers.lambdaQuery(UserPostRelation.class)
|
List<UserPostRelation> userPostRelations = userPostRelationClient.getUserPostRelationListFeign(StpUtil.getLoginIdAsLong());
|
||||||
.eq(UserPostRelation::getUserId, StpUtil.getLoginIdAsLong()));
|
|
||||||
|
|
||||||
//获取登陆人所选择的身份缓存
|
//获取登陆人所选择的身份缓存
|
||||||
String postId = redisUtil.get(GlobalConstant.LOGIN_IDENTITY_CACHE_PREFIX + loginUser.getId());
|
String postId = redisUtil.get(GlobalConstant.LOGIN_IDENTITY_CACHE_PREFIX + loginUser.getId());
|
||||||
|
|
||||||
Post post = new Post();
|
Post post = new Post();
|
||||||
if (StrUtil.isNotBlank(postId) && !postId.equals("null")) {
|
if (StrUtil.isNotBlank(postId) && !postId.equals("null")) {
|
||||||
post = postService.getById(Long.valueOf(postId));
|
post = postClient.getPostByIdFeign(Long.valueOf(postId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userPostRelations.size() > 0) {
|
if (userPostRelations.size() > 0) {
|
||||||
List<Long> postIds = userPostRelations.stream().map(UserPostRelation::getPostId).collect(Collectors.toList());
|
List<Long> postIds = userPostRelations.stream().map(UserPostRelation::getPostId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<Post> postList = postService.listByIds(postIds);
|
List<Post> postList = postClient.getPostListByIdsFeign(postIds);
|
||||||
if ((post == null || StrUtil.isBlank(postId)) && com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(postList)) {
|
if ((post == null || StrUtil.isBlank(postId)) && com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(postList)) {
|
||||||
post = postList.get(0);
|
post = postList.get(0);
|
||||||
}
|
}
|
||||||
@ -222,8 +214,8 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
if (userDeptRelations.size() > 0) {
|
if (userDeptRelations.size() > 0) {
|
||||||
// 存当前用户所有部门到缓存
|
// 存当前用户所有部门到缓存
|
||||||
List<Long> departmentIds = userDeptRelations.stream().map(UserDeptRelation::getDeptId).collect(Collectors.toList());
|
List<Long> departmentIds = userDeptRelations.stream().map(UserDeptRelation::getDeptId).collect(Collectors.toList());
|
||||||
List<Department> departmentList = departmentService.listByIds(departmentIds);
|
List<Department> departmentList = departmentClient.getDepartmentListByIdsFeign(departmentIds);
|
||||||
departmentService.queryPathFromRoot(departmentList);
|
departmentClient.queryPathFromRoot(departmentList);
|
||||||
tokenSession.set(GlobalConstant.LOGIN_USER_DEPT_LIST_KEY, departmentList);
|
tokenSession.set(GlobalConstant.LOGIN_USER_DEPT_LIST_KEY, departmentList);
|
||||||
|
|
||||||
//主部门
|
//主部门
|
||||||
@ -234,7 +226,7 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
Department department = departmentList.get(0);
|
Department department = departmentList.get(0);
|
||||||
//如果此人有岗位 使用岗位的deptId 找到当前组织机构
|
//如果此人有岗位 使用岗位的deptId 找到当前组织机构
|
||||||
if (ObjectUtil.isNotNull(post.getId())) {
|
if (ObjectUtil.isNotNull(post.getId())) {
|
||||||
department = departmentService.getById(post.getDeptId());
|
department = departmentClient.getDepartmentByIdFeign(post.getDeptId());
|
||||||
}else if(ObjectUtil.isNotEmpty(mainDepartmentIds)){
|
}else if(ObjectUtil.isNotEmpty(mainDepartmentIds)){
|
||||||
//找一个主部门
|
//找一个主部门
|
||||||
department=departmentList.stream().filter(x->mainDepartmentIds.contains(x.getId())).findFirst().get();
|
department=departmentList.stream().filter(x->mainDepartmentIds.contains(x.getId())).findFirst().get();
|
||||||
@ -251,10 +243,10 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断用户名和密码是否正确,有2中情况,1:账号密码登录,2:互信token登录,
|
* 判断用户名和密码是否正确,有2中情况,1:账号密码登录,2:互信token登录,
|
||||||
* 方式1是传入的未加密的密码,方式2传入的是通过md5已加密的密码,所以通过判断密码的长度来判断是否已加密
|
* 方式1是传入的未加密的密码,方式2传入的是通过md5已加密的密码,所以通过判断密码的长度来判断是否已加密
|
||||||
* */
|
* */
|
||||||
public boolean checkPassword(User loginUser,LoginDto dto)
|
public boolean checkPassword(User loginUser,LoginDto dto)
|
||||||
{
|
{
|
||||||
//如果长度是32,即传入的是密文
|
//如果长度是32,即传入的是密文
|
||||||
@ -262,7 +254,7 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
return (loginUser == null || !StrUtil.equals(loginUser.getPassword(), dto.getPassword()));
|
return (loginUser == null || !StrUtil.equals(loginUser.getPassword(), dto.getPassword()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (loginUser == null || !StrUtil.equals(loginUser.getPassword(), SaSecureUtil.md5BySalt(dto.getPassword(), GlobalConstant.SECRET_KEY)));
|
return (loginUser == null || !StrUtil.equals(loginUser.getPassword(), SaSecureUtil.md5BySalt(dto.getPassword(), GlobalConstant.SECRET_KEY)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +280,7 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
* @param deviceType
|
* @param deviceType
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
/*@Override
|
||||||
public LoginConfig validateLoginConfig(Integer deviceType) {
|
public LoginConfig validateLoginConfig(Integer deviceType) {
|
||||||
if (licenseConfig.getEnabled()) {
|
if (licenseConfig.getEnabled()) {
|
||||||
//查出所有在线用户
|
//查出所有在线用户
|
||||||
@ -335,6 +327,6 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
SaManager.setConfig(oldConfig);
|
SaManager.setConfig(oldConfig);
|
||||||
|
|
||||||
return loginConfig;
|
return loginConfig;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,6 +73,9 @@ public class SsoServiceImpl implements SsoService {
|
|||||||
@Value("${xjrsoft.dist.url:}")
|
@Value("${xjrsoft.dist.url:}")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
|
@Value("${xjrsoft.openLoginLog: false}")
|
||||||
|
private boolean openLoginLog;
|
||||||
|
|
||||||
private String pcPath = "/flow/%s/%s/approveFlow?taskId=%s";
|
private String pcPath = "/flow/%s/%s/approveFlow?taskId=%s";
|
||||||
|
|
||||||
private String mobilePath = "/pages/workflow/approval?taskId=%s&processId=%s&type=todo";
|
private String mobilePath = "/pages/workflow/approval?taskId=%s&processId=%s&type=todo";
|
||||||
|
|||||||
@ -20,6 +20,7 @@ public class R extends HashMap<String, Object> {
|
|||||||
|
|
||||||
public R() {
|
public R() {
|
||||||
put("code", 0);
|
put("code", 0);
|
||||||
|
put("retcode", 1);
|
||||||
put("success", true);
|
put("success", true);
|
||||||
put("msg", "");
|
put("msg", "");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import com.xjrsoft.common.core.exception.MyException;
|
|||||||
import com.xjrsoft.common.satoken.config.MagicApiConfig;
|
import com.xjrsoft.common.satoken.config.MagicApiConfig;
|
||||||
import com.xjrsoft.common.satoken.interceptor.MagicApiWebLoginInterceptor;
|
import com.xjrsoft.common.satoken.interceptor.MagicApiWebLoginInterceptor;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
@ -29,6 +30,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class SaTokenAutoConfiguration implements WebMvcConfigurer {
|
public class SaTokenAutoConfiguration implements WebMvcConfigurer {
|
||||||
|
|
||||||
private final MagicApiConfig magicApiConfig;
|
private final MagicApiConfig magicApiConfig;
|
||||||
|
|||||||
@ -44,20 +44,16 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xjrsoft</groupId>
|
<groupId>com.xjrsoft</groupId>
|
||||||
<artifactId>xjrsoft-common-generate</artifactId>
|
<artifactId>xjrsoft-common-generate</artifactId>
|
||||||
<version>${xjrsoft.framework.version}</version>
|
<version>${xjrsoft.framework.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xjrsoft</groupId>
|
<groupId>com.xjrsoft</groupId>
|
||||||
<artifactId>xjrsoft-common-mybatis</artifactId>
|
<artifactId>xjrsoft-common-mybatis</artifactId>
|
||||||
<version>${xjrsoft.framework.version}</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@ -14,36 +14,37 @@ import java.util.List;
|
|||||||
* @Author: tzx
|
* @Author: tzx
|
||||||
* @Date: 2023/10/11 16:20
|
* @Date: 2023/10/11 16:20
|
||||||
*/
|
*/
|
||||||
@FeignClient(value = GlobalConstant.CLIENT_ORGANIZATION_NAME,fallback = DepartmentClientFallBack.class)
|
@FeignClient(value = GlobalConstant.CLIENT_ORGANIZATION_NAME, fallback = DepartmentClientFallBack.class)
|
||||||
public interface IDepartmentClient {
|
public interface IDepartmentClient {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id获取部门
|
* 根据id获取部门
|
||||||
|
*
|
||||||
* @param depId
|
* @param depId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(GlobalConstant.CLIENT_API_PRE+ GlobalConstant.MODULE_ORGANIZATION_NAME + "/getDepartmentByIdFeign")
|
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_ORGANIZATION_NAME + "/getDepartmentByIdFeign")
|
||||||
Department getDepartmentByIdFeign(@RequestParam("depId") Long depId);
|
Department getDepartmentByIdFeign(@RequestParam("depId") Long depId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id获取部门
|
* 根据id获取部门
|
||||||
|
*
|
||||||
* @param depIds
|
* @param depIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(GlobalConstant.CLIENT_API_PRE+ GlobalConstant.MODULE_ORGANIZATION_NAME + "/getDepartmentListByIdsFeign")
|
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_ORGANIZATION_NAME + "/getDepartmentListByIdsFeign")
|
||||||
List<Department> getDepartmentListByIdsFeign(@RequestParam("depIds") List<Long> depIds);
|
List<Department> getDepartmentListByIdsFeign(@RequestParam("depIds") List<Long> depIds);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增部门
|
* 新增部门
|
||||||
|
*
|
||||||
* @param department
|
* @param department
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(GlobalConstant.CLIENT_API_PRE+ GlobalConstant.MODULE_ORGANIZATION_NAME + "/addDepartmentFeign")
|
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_ORGANIZATION_NAME + "/addDepartmentFeign")
|
||||||
boolean addDepartmentFeign(Department department);
|
boolean addDepartmentFeign(Department department);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,4 +52,10 @@ public interface IDepartmentClient {
|
|||||||
*/
|
*/
|
||||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_ORGANIZATION_NAME + "/departmentCacheFeign")
|
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_ORGANIZATION_NAME + "/departmentCacheFeign")
|
||||||
void departmentCacheFeign();
|
void departmentCacheFeign();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取root部门
|
||||||
|
*/
|
||||||
|
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_ORGANIZATION_NAME + "/queryPathFromRootFeign")
|
||||||
|
List<Department> queryPathFromRoot(List<Department> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public interface IUserRoleRelationClient {
|
|||||||
* @param userRoleRelation
|
* @param userRoleRelation
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(GlobalConstant.CLIENT_API_PRE+ GlobalConstant.MODULE_ORGANIZATION_NAME + "/addUserRoleRelationFeign")
|
@GetMapping(GlobalConstant.CLIENT_API_PRE+ GlobalConstant.MODULE_ORGANIZATION_NAME + "/list")
|
||||||
List<UserRoleRelation> list(UserRoleRelation userRoleRelation);
|
List<UserRoleRelation> list(UserRoleRelation userRoleRelation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,4 +31,10 @@ public class DepartmentClientFallBack implements IDepartmentClient {
|
|||||||
public void departmentCacheFeign() {
|
public void departmentCacheFeign() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Department> queryPathFromRoot(List<Department> list) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,11 @@
|
|||||||
<artifactId>xjrsoft-service-magicapi-api</artifactId>
|
<artifactId>xjrsoft-service-magicapi-api</artifactId>
|
||||||
<version>${xjrsoft.framework.version}</version>
|
<version>${xjrsoft.framework.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xjrsoft</groupId>
|
||||||
|
<artifactId>xjrsoft-service-generate-api</artifactId>
|
||||||
|
<version>${xjrsoft.framework.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xjrsoft</groupId>
|
<groupId>com.xjrsoft</groupId>
|
||||||
|
|||||||
@ -1501,17 +1501,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|||||||
queryExpression = new AndExpression(queryExpression, dataAuthExpression);
|
queryExpression = new AndExpression(queryExpression, dataAuthExpression);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 添加租户过滤条件
|
|
||||||
if (BooleanUtils.isTrue(tenantConfig.getEnabled())) {
|
|
||||||
EqualsTo tenantExp = new EqualsTo();
|
|
||||||
tenantExp.setLeftExpression(new net.sf.jsqlparser.schema.Column(tenantConfig.getTenantField()));
|
|
||||||
tenantExp.setRightExpression(new LongValue(SecureUtil.getTenantId()));
|
|
||||||
if(queryExpression == null) {
|
|
||||||
queryExpression = tenantExp;
|
|
||||||
} else {
|
|
||||||
queryExpression = new AndExpression(new Parenthesis(queryExpression), tenantExp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plainSelect.setWhere(queryExpression);
|
plainSelect.setWhere(queryExpression);
|
||||||
|
|
||||||
//将所有查询的数据id 转string
|
//将所有查询的数据id 转string
|
||||||
@ -1824,17 +1814,6 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|||||||
queryExpression = new AndExpression(queryExpression, dataAuthExpression);
|
queryExpression = new AndExpression(queryExpression, dataAuthExpression);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 添加租户过滤条件
|
|
||||||
if (BooleanUtils.isTrue(tenantConfig.getEnabled())) {
|
|
||||||
EqualsTo tenantExp = new EqualsTo();
|
|
||||||
tenantExp.setLeftExpression(new net.sf.jsqlparser.schema.Column(tenantConfig.getTenantField()));
|
|
||||||
tenantExp.setRightExpression(new LongValue(SecureUtil.getTenantId()));
|
|
||||||
if (queryExpression != null){
|
|
||||||
queryExpression = new AndExpression(new Parenthesis(queryExpression), tenantExp);
|
|
||||||
} else {
|
|
||||||
queryExpression = tenantExp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plainSelect.setWhere(queryExpression);
|
plainSelect.setWhere(queryExpression);
|
||||||
Db use = Db.use(datasource);
|
Db use = Db.use(datasource);
|
||||||
use.setRunner(new XjrSqlConnRunner(DialectFactory.getDialect(datasource)));
|
use.setRunner(new XjrSqlConnRunner(DialectFactory.getDialect(datasource)));
|
||||||
@ -2279,10 +2258,6 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 添加租户id数据
|
|
||||||
if (BooleanUtils.isTrue(tenantConfig.getEnabled())) {
|
|
||||||
resultData.put(tenantConfig.getTenantField(), SecureUtil.getTenantId());
|
|
||||||
}
|
|
||||||
return resultData;
|
return resultData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,11 @@
|
|||||||
<groupId>com.cloud.govern</groupId>
|
<groupId>com.cloud.govern</groupId>
|
||||||
<artifactId>service-invoke-sdk</artifactId>
|
<artifactId>service-invoke-sdk</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xjrsoft</groupId>
|
||||||
|
<artifactId>xjrsoft-service-system-api</artifactId>
|
||||||
|
<version>${xjrsoft.framework.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -63,4 +63,10 @@ public class DepartmentClient implements IDepartmentClient {
|
|||||||
public void departmentCacheFeign() {
|
public void departmentCacheFeign() {
|
||||||
departmentService.departmentCache();
|
departmentService.departmentCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Department> queryPathFromRoot(List<Department> list) {
|
||||||
|
return departmentService.queryPathFromRoot(list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -123,9 +123,9 @@ public class UserController {
|
|||||||
SaSession tokenSession = StpUtil.getTokenSession();
|
SaSession tokenSession = StpUtil.getTokenSession();
|
||||||
User user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new User());
|
User user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new User());
|
||||||
UserInfoVo currentInfo = userService.getCurrentInfo(user);
|
UserInfoVo currentInfo = userService.getCurrentInfo(user);
|
||||||
currentInfo.setTenantId(SecureUtil.getCurrentTenantId());
|
// currentInfo.setTenantId(SecureUtil.getCurrentTenantId());
|
||||||
currentInfo.setTenantCode(SecureUtil.getCurrentTenantCode());
|
// currentInfo.setTenantCode(SecureUtil.getCurrentTenantCode());
|
||||||
currentInfo.setTenantName(SecureUtil.getCurrentTenantName());
|
// currentInfo.setTenantName(SecureUtil.getCurrentTenantName());
|
||||||
return R.ok(currentInfo);
|
return R.ok(currentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,17 +65,8 @@ public class MenuController {
|
|||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获取所有菜单(不分页)")
|
@Operation(summary = "获取所有菜单(不分页)")
|
||||||
public R list() {
|
public R list() {
|
||||||
List<Long> tenantAuthMenuIds = null;
|
|
||||||
boolean isAdminTenant = SecureUtil.isAdminTenant();
|
|
||||||
if (!isAdminTenant) {
|
|
||||||
tenantAuthMenuIds = menuService.getTenantAuthMenuIds(Long.parseLong(SecureUtil.getTenantId()));
|
|
||||||
if (CollectionUtils.isEmpty(tenantAuthMenuIds)) {
|
|
||||||
return R.ok(new ArrayList<>(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<Menu> list = menuService.list(Wrappers.lambdaQuery(Menu.class)
|
List<Menu> list = menuService.list(Wrappers.lambdaQuery(Menu.class)
|
||||||
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuListVo.class).contains(x.getProperty()))
|
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuListVo.class).contains(x.getProperty())));
|
||||||
.in(CollectionUtils.isNotEmpty(tenantAuthMenuIds), Menu::getId, tenantAuthMenuIds));
|
|
||||||
List<MenuListVo> menuListVos = BeanUtil.copyToList(list, MenuListVo.class);
|
List<MenuListVo> menuListVos = BeanUtil.copyToList(list, MenuListVo.class);
|
||||||
return R.ok(TreeUtil.build(menuListVos));
|
return R.ok(TreeUtil.build(menuListVos));
|
||||||
}
|
}
|
||||||
@ -93,14 +84,6 @@ public class MenuController {
|
|||||||
@GetMapping("/all-tree")
|
@GetMapping("/all-tree")
|
||||||
@Operation(summary = "获取所有菜单(树结构)")
|
@Operation(summary = "获取所有菜单(树结构)")
|
||||||
public R allMenuTree(@Valid MenuTreeDto dto) {
|
public R allMenuTree(@Valid MenuTreeDto dto) {
|
||||||
List<Long> tenantAuthMenuIds = null;
|
|
||||||
boolean isAdminTenant = SecureUtil.isAdminTenant();
|
|
||||||
if (!isAdminTenant&&tenantConfig.getEnabled()) {
|
|
||||||
tenantAuthMenuIds = menuService.getTenantAuthMenuIds(Long.parseLong(SecureUtil.getTenantId()));
|
|
||||||
if (CollectionUtils.isEmpty(tenantAuthMenuIds)) {
|
|
||||||
return R.ok(new ArrayList<>(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<MenuTreeVo> list = menuService.selectJoinList(MenuTreeVo.class,
|
List<MenuTreeVo> list = menuService.selectJoinList(MenuTreeVo.class,
|
||||||
MPJWrappers.<Menu>lambdaJoin()
|
MPJWrappers.<Menu>lambdaJoin()
|
||||||
.disableSubLogicDel()
|
.disableSubLogicDel()
|
||||||
@ -110,7 +93,6 @@ public class MenuController {
|
|||||||
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuTreeVo.class).contains(x.getProperty()))
|
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuTreeVo.class).contains(x.getProperty()))
|
||||||
.selectAs(Subsystem::getName, MenuTreeVo::getSystemName)
|
.selectAs(Subsystem::getName, MenuTreeVo::getSystemName)
|
||||||
.eq(ObjectUtils.isNotEmpty(dto.getEnabledMark()), Menu::getEnabledMark, dto.getEnabledMark())
|
.eq(ObjectUtils.isNotEmpty(dto.getEnabledMark()), Menu::getEnabledMark, dto.getEnabledMark())
|
||||||
.in(CollectionUtils.isNotEmpty(tenantAuthMenuIds), Menu::getId, tenantAuthMenuIds)
|
|
||||||
.leftJoin(Subsystem.class, Subsystem::getId, Menu::getSystemId)
|
.leftJoin(Subsystem.class, Subsystem::getId, Menu::getSystemId)
|
||||||
.orderByAsc(Menu::getSortCode));
|
.orderByAsc(Menu::getSortCode));
|
||||||
List<MenuTreeVo> treeVoList = TreeUtil.build(list);
|
List<MenuTreeVo> treeVoList = TreeUtil.build(list);
|
||||||
|
|||||||
@ -61,14 +61,6 @@ public class MenuServiceImpl extends MPJBaseServiceImpl<MenuMapper, Menu> implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MenuVo> getAuthMenuList(MenuTreeDto dto) {
|
public List<MenuVo> getAuthMenuList(MenuTreeDto dto) {
|
||||||
// 租户授权菜单
|
|
||||||
List<Long> tenantAuthMenuIds = null;
|
|
||||||
if (BooleanUtils.isTrue(tenantConfig.getEnabled())&&!SecureUtil.isAdminTenant()) {
|
|
||||||
tenantAuthMenuIds = getTenantAuthMenuIds(Long.parseLong(SecureUtil.getTenantId()));
|
|
||||||
if (CollectionUtils.isEmpty(tenantAuthMenuIds)) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<UserRoleRelation> relations = userRoleRelationClient.getUserRoleRelationListByUserIdFeign(StpUtil.getLoginIdAsLong());
|
List<UserRoleRelation> relations = userRoleRelationClient.getUserRoleRelationListByUserIdFeign(StpUtil.getLoginIdAsLong());
|
||||||
if (CollectionUtils.isEmpty(relations)) {
|
if (CollectionUtils.isEmpty(relations)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
@ -88,22 +80,21 @@ public class MenuServiceImpl extends MPJBaseServiceImpl<MenuMapper, Menu> implem
|
|||||||
|
|
||||||
return this.selectJoinList(MenuVo.class,
|
return this.selectJoinList(MenuVo.class,
|
||||||
MPJWrappers.<Menu>lambdaJoin()
|
MPJWrappers.<Menu>lambdaJoin()
|
||||||
.disableSubLogicDel()
|
.disableSubLogicDel()
|
||||||
.like(StrUtil.isNotBlank(dto.getTitle()), Menu::getTitle, dto.getTitle())
|
.like(StrUtil.isNotBlank(dto.getTitle()), Menu::getTitle, dto.getTitle())
|
||||||
.like(StrUtil.isNotBlank(dto.getCode()), Menu::getCode, dto.getCode())
|
.like(StrUtil.isNotBlank(dto.getCode()), Menu::getCode, dto.getCode())
|
||||||
.like(StrUtil.isNotBlank(dto.getName()), Menu::getName, dto.getName())
|
.like(StrUtil.isNotBlank(dto.getName()), Menu::getName, dto.getName())
|
||||||
// .like(ObjectUtil.isNotEmpty(dto.getEnabledMark()), Menu::getEnabledMark, dto.getEnabledMark())
|
// .like(ObjectUtil.isNotEmpty(dto.getEnabledMark()), Menu::getEnabledMark, dto.getEnabledMark())
|
||||||
.in(CollectionUtils.isNotEmpty(authMenuIdList), Menu::getId, authMenuIdList)
|
.in(CollectionUtils.isNotEmpty(authMenuIdList), Menu::getId, authMenuIdList)
|
||||||
.select(Menu::getId)
|
.select(Menu::getId)
|
||||||
.selectAs(Subsystem::getName, MenuVo::getSystemName)
|
.selectAs(Subsystem::getName, MenuVo::getSystemName)
|
||||||
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuTreeVo.class).contains(x.getProperty()))
|
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuTreeVo.class).contains(x.getProperty()))
|
||||||
.leftJoin(Subsystem.class, Subsystem::getId, Menu::getSystemId)
|
.leftJoin(Subsystem.class, Subsystem::getId, Menu::getSystemId)
|
||||||
.leftJoin(WorkflowSchema.class,WorkflowSchema::getFormId, Menu::getFormId)
|
.leftJoin(WorkflowSchema.class,WorkflowSchema::getFormId, Menu::getFormId)
|
||||||
.selectAs(WorkflowSchema::getId,MenuVo::getSchemaId)
|
.selectAs(WorkflowSchema::getId,MenuVo::getSchemaId)
|
||||||
.in(CollectionUtils.isNotEmpty(tenantAuthMenuIds), Menu::getId, tenantAuthMenuIds)
|
.eq(Menu::getEnabledMark, EnabledMark.ENABLED.getCode())
|
||||||
.eq(Menu::getEnabledMark, EnabledMark.ENABLED.getCode())
|
.orderByAsc(Subsystem::getSortCode)
|
||||||
.orderByAsc(Subsystem::getSortCode)
|
.orderByAsc(Menu::getSortCode));
|
||||||
.orderByAsc(Menu::getSortCode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Long> getTenantAuthMenuIds(Long tenantId) {
|
public List<Long> getTenantAuthMenuIds(Long tenantId) {
|
||||||
|
|||||||
@ -4679,27 +4679,27 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
|
|||||||
.superProcessInstanceId(dto.getProcessId()).list();
|
.superProcessInstanceId(dto.getProcessId()).list();
|
||||||
|
|
||||||
//当前流程是否有父级流程,就是外部流程或者子流程。外部流程或者子流程不能撤回到开始节点,不新增开始节点
|
//当前流程是否有父级流程,就是外部流程或者子流程。外部流程或者子流程不能撤回到开始节点,不新增开始节点
|
||||||
if (subProcess.size() < 1) {
|
// if (subProcess.size() < 1) {
|
||||||
//获取到当前流程发起人 如果操作人 是发起人 默认新增开始节点
|
// //获取到当前流程发起人 如果操作人 是发起人 默认新增开始节点
|
||||||
Object startUserId = runtimeService.getVariable(dto.getProcessId(), WorkflowConstant.PROCESS_START_USER_ID_KEY);
|
// Object startUserId = runtimeService.getVariable(dto.getProcessId(), WorkflowConstant.PROCESS_START_USER_ID_KEY);
|
||||||
if (StpUtil.getLoginIdAsLong() == Convert.toLong(startUserId)) {
|
// if (StpUtil.getLoginIdAsLong() == Convert.toLong(startUserId)) {
|
||||||
|
//
|
||||||
List<HistoricActivityInstance> startList = historyService.createHistoricActivityInstanceQuery()
|
// List<HistoricActivityInstance> startList = historyService.createHistoricActivityInstanceQuery()
|
||||||
.processInstanceId(dto.getProcessId())
|
// .processInstanceId(dto.getProcessId())
|
||||||
.activityType(WorkflowConstant.BPMN_START_EVENT_TYPE_NAME)
|
// .activityType(WorkflowConstant.BPMN_START_EVENT_TYPE_NAME)
|
||||||
.finished()
|
// .finished()
|
||||||
.orderByHistoricActivityInstanceEndTime()
|
// .orderByHistoricActivityInstanceEndTime()
|
||||||
.desc()
|
// .desc()
|
||||||
.list();
|
// .list();
|
||||||
|
//
|
||||||
HistoricActivityInstance historicActivityInstance = startList.get(0);
|
// HistoricActivityInstance historicActivityInstance = startList.get(0);
|
||||||
|
//
|
||||||
RejectNodeVo vo = new RejectNodeVo();
|
// RejectNodeVo vo = new RejectNodeVo();
|
||||||
vo.setActivityId(historicActivityInstance.getActivityId());
|
// vo.setActivityId(historicActivityInstance.getActivityId());
|
||||||
vo.setActivityName(historicActivityInstance.getActivityName());
|
// vo.setActivityName(historicActivityInstance.getActivityName());
|
||||||
voList.add(vo);
|
// voList.add(vo);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (list == null || list.size() == 0) {
|
if (list == null || list.size() == 0) {
|
||||||
return voList;
|
return voList;
|
||||||
|
|||||||
Reference in New Issue
Block a user