bug修复
This commit is contained in:
parent
e5a3c4b4cc
commit
fd13b8974a
34
pom.xml
34
pom.xml
@ -873,6 +873,13 @@
|
|||||||
<artifactId>fastjson2</artifactId>
|
<artifactId>fastjson2</artifactId>
|
||||||
<version>2.0.40</version>
|
<version>2.0.40</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--TTL-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>transmittable-thread-local</artifactId>
|
||||||
|
<version>2.11.4</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -970,11 +977,36 @@
|
|||||||
<!–<excludeClass>CustomClassLoader;WisdomSiteApplication;LicenseUtil;MyBootJarLauncher;MyJarClassLoader</excludeClass>–>
|
<!–<excludeClass>CustomClassLoader;WisdomSiteApplication;LicenseUtil;MyBootJarLauncher;MyJarClassLoader</excludeClass>–>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>-->
|
</plugin>-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>net.roseboy</groupId>
|
||||||
|
<artifactId>classfinal-maven-plugin</artifactId>
|
||||||
|
<version>1.2.1</version>
|
||||||
|
<configuration>
|
||||||
|
<password>#</password>
|
||||||
|
<packages>com.zhgd,com.license,com.zhwl,com.wflow</packages>
|
||||||
|
<cfgfiles>application.properties,application-dev.properties,application-gsx-other-env-show.properties</cfgfiles>
|
||||||
|
<excludes>org.spring</excludes>
|
||||||
|
<libjars>wflow-server-1.0-SNAPSHOT.jar</libjars>
|
||||||
|
<code>C406DC319C9AF811C5DC9A84CE0DBF2CD41D8CD98F00B204E9800998ECF8427ED41D8CD98F00B204E9800998ECF8427E</code>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>classFinal</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<filtering>false</filtering>
|
<includes>
|
||||||
|
<include>**/*.properties</include>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
</includes>
|
||||||
|
<!--<filtering>true</filtering>-->
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/java</directory>
|
<directory>src/main/java</directory>
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
package com.zhgd.config;
|
package com.zhgd.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||||
import com.wflow.config.MyBatisPlusConfig;
|
import com.wflow.config.MyBatisPlusConfig;
|
||||||
import org.apache.ibatis.logging.stdout.StdOutImpl;
|
import org.apache.ibatis.logging.stdout.StdOutImpl;
|
||||||
@ -23,8 +26,6 @@ import javax.sql.DataSource;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@MapperScan(basePackages = {"com.zhgd.*.*.*.*.mapper", "com.zhgd.*.*.*.mapper"}, sqlSessionTemplateRef = "db1SqlSessionTemplate")
|
@MapperScan(basePackages = {"com.zhgd.*.*.*.*.mapper", "com.zhgd.*.*.*.mapper"}, sqlSessionTemplateRef = "db1SqlSessionTemplate")
|
||||||
public class DataSourceOneConfig {
|
public class DataSourceOneConfig {
|
||||||
@Resource
|
|
||||||
private MybatisPlusConfig mybatisPlusConfig;
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.db1")
|
@ConfigurationProperties(prefix = "spring.datasource.db1")
|
||||||
@ -43,7 +44,9 @@ public class DataSourceOneConfig {
|
|||||||
configuration.setLogImpl(StdOutImpl.class);
|
configuration.setLogImpl(StdOutImpl.class);
|
||||||
bean.setConfiguration(configuration);
|
bean.setConfiguration(configuration);
|
||||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:com/zhgd/xmgl/**/*.xml"));
|
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:com/zhgd/xmgl/**/*.xml"));
|
||||||
bean.setPlugins(mybatisPlusConfig.mybatisPlusInterceptor());
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||||
|
bean.setPlugins(interceptor);
|
||||||
return bean.getObject();
|
return bean.getObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,18 @@
|
|||||||
package com.zhgd.config;
|
package com.zhgd.config;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||||
|
import com.zhgd.xmgl.tenant.TenantHandler;
|
||||||
import org.apache.ibatis.logging.stdout.StdOutImpl;
|
import org.apache.ibatis.logging.stdout.StdOutImpl;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@ -21,8 +27,6 @@ import javax.sql.DataSource;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@MapperScan(basePackages = "com.wflow.mapper", sqlSessionTemplateRef = "sqlSessionTemplate2")
|
@MapperScan(basePackages = "com.wflow.mapper", sqlSessionTemplateRef = "sqlSessionTemplate2")
|
||||||
public class DataSourceTwoConfig {
|
public class DataSourceTwoConfig {
|
||||||
@Resource
|
|
||||||
private MybatisPlusConfig mybatisPlusConfig;
|
|
||||||
|
|
||||||
@Primary
|
@Primary
|
||||||
@Bean(name = "dataSource2")
|
@Bean(name = "dataSource2")
|
||||||
@ -41,8 +45,13 @@ public class DataSourceTwoConfig {
|
|||||||
configuration.setMapUnderscoreToCamelCase(true);
|
configuration.setMapUnderscoreToCamelCase(true);
|
||||||
configuration.setLogImpl(StdOutImpl.class);
|
configuration.setLogImpl(StdOutImpl.class);
|
||||||
bean.setConfiguration(configuration);
|
bean.setConfiguration(configuration);
|
||||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/*.xml"));
|
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:com/wflow/**/*.xml"));
|
||||||
bean.setPlugins(mybatisPlusConfig.mybatisPlusInterceptor());
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
TenantLineInnerInterceptor tenantLineInnerInterceptor = new TenantLineInnerInterceptor();
|
||||||
|
tenantLineInnerInterceptor.setTenantLineHandler(tenantHandler());
|
||||||
|
interceptor.addInnerInterceptor(tenantLineInnerInterceptor);
|
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||||
|
bean.setPlugins(interceptor);
|
||||||
return bean.getObject();
|
return bean.getObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,4 +64,10 @@ public class DataSourceTwoConfig {
|
|||||||
public SqlSessionTemplate sqlSessionTemplate(@Qualifier("sqlSessionFactory2") SqlSessionFactory sqlSessionFactory) throws Exception {
|
public SqlSessionTemplate sqlSessionTemplate(@Qualifier("sqlSessionFactory2") SqlSessionFactory sqlSessionFactory) throws Exception {
|
||||||
return new SqlSessionTemplate(sqlSessionFactory);
|
return new SqlSessionTemplate(sqlSessionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public TenantHandler tenantHandler() {
|
||||||
|
return new TenantHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,59 +1,64 @@
|
|||||||
package com.zhgd.config;
|
//package com.zhgd.config;
|
||||||
|
//
|
||||||
|
//
|
||||||
import com.baomidou.mybatisplus.annotation.DbType;
|
//import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
//import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
|
//import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
|
||||||
|
//import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
/**
|
//import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
* Mybatis-Plus进行分页
|
//import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
||||||
* 返回的数据中total总是为0问题
|
//import com.zhgd.xmgl.tenant.TenantHandler;
|
||||||
*/
|
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
@Configuration
|
//import org.springframework.context.annotation.Bean;
|
||||||
public class MybatisPlusConfig {
|
//import org.springframework.context.annotation.Configuration;
|
||||||
/**
|
//
|
||||||
* mybatis-plus分页插件
|
////import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
|
||||||
*/
|
//
|
||||||
/*@Bean
|
///**
|
||||||
public PaginationInterceptor paginationInterceptor() {
|
// * Mybatis-Plus进行分页
|
||||||
PaginationInterceptor page = new PaginationInterceptor();
|
// * 返回的数据中total总是为0问题
|
||||||
return page;
|
// */
|
||||||
}*/
|
//@Configuration
|
||||||
|
//public class MybatisPlusConfig {
|
||||||
/**
|
// /**
|
||||||
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题
|
// * mybatis-plus分页插件
|
||||||
*/
|
// */
|
||||||
@Bean
|
// /*@Bean
|
||||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
// public PaginationInterceptor paginationInterceptor() {
|
||||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
// PaginationInterceptor page = new PaginationInterceptor();
|
||||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
// return page;
|
||||||
return interceptor;
|
// }*/
|
||||||
}
|
//
|
||||||
|
// /**
|
||||||
@Bean
|
// * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题
|
||||||
public ConfigurationCustomizer configurationCustomizer() {
|
// */
|
||||||
return configuration -> configuration.setUseDeprecatedExecutor(false);
|
// @Bean
|
||||||
|
// public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
}
|
// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
// interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||||
|
// return interceptor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Bean
|
||||||
|
// public ConfigurationCustomizer configurationCustomizer() {
|
||||||
|
// return configuration -> configuration.setUseDeprecatedExecutor(false);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
||||||
@ -67,9 +67,9 @@ public interface SystemUserMapper extends BaseMapper<SystemUser> {
|
|||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 用户列表 type为固定值user
|
* @return 用户列表 type为固定值user
|
||||||
*/
|
*/
|
||||||
@Select("SELECT user_id id, real_name `name`, 'user' AS 'type', avatar " +
|
@Select("SELECT u.user_id id, w.worker_name `name`, 'user' AS 'type', u.avatar " +
|
||||||
"FROM system_user" +
|
"FROM system_user u left join worker_info w on u.worker_id = w.id " +
|
||||||
" WHERE xz_project_org_id = #{deptId} AND account_type = 6")
|
"WHERE u.xz_project_org_id = #{deptId} AND u.account_type = 6")
|
||||||
List<OrgTreeVo> selectUsersByDept(@Param("deptId") String deptId);
|
List<OrgTreeVo> selectUsersByDept(@Param("deptId") String deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,6 +95,16 @@ public interface SystemUserMapper extends BaseMapper<SystemUser> {
|
|||||||
"</script>"})
|
"</script>"})
|
||||||
List<UserDeptDo> getUserDepInfosBatch(@Param("list") Collection<String> udIds);
|
List<UserDeptDo> getUserDepInfosBatch(@Param("list") Collection<String> udIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过拼音搜索用户,全拼和拼音首字母模糊搜索
|
||||||
|
* @param py 拼音
|
||||||
|
* @return 搜索的用户列表 type为固定值user
|
||||||
|
*/
|
||||||
|
@Select("SELECT u.user_id id, w.worker_name `name`, 'user' AS 'type', u.avatar FROM system_user u " +
|
||||||
|
"left join worker_info w on u.worker_id = w.id " +
|
||||||
|
" WHERE w.worker_name LIKE '%${py}%'")
|
||||||
|
List<OrgTreeVo> selectUsersByPy(@Param("py") String py);
|
||||||
|
|
||||||
Page<SystemUser> getSystemUserBySn(@Param("p") Map<String, Object> map, Page<SystemUser> page);
|
Page<SystemUser> getSystemUserBySn(@Param("p") Map<String, Object> map, Page<SystemUser> page);
|
||||||
|
|
||||||
Page<SystemUser> getTenantListBySn(@Param("map") Map<String, Object> map, Page page);
|
Page<SystemUser> getTenantListBySn(@Param("map") Map<String, Object> map, Page page);
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import com.wflow.bean.vo.UserVo;
|
|||||||
import com.wflow.mapper.WflowModelPermsMapper;
|
import com.wflow.mapper.WflowModelPermsMapper;
|
||||||
import com.wflow.mapper.WflowModelsMapper;
|
import com.wflow.mapper.WflowModelsMapper;
|
||||||
import com.wflow.service.OrgRepositoryService;
|
import com.wflow.service.OrgRepositoryService;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.entity.BaseRole;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseRoleUser;
|
import com.zhgd.xmgl.modules.basicdata.entity.BaseRoleUser;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.Company;
|
import com.zhgd.xmgl.modules.basicdata.entity.Company;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||||
@ -24,6 +25,11 @@ import com.zhgd.xmgl.modules.basicdata.mapper.BaseRoleMapper;
|
|||||||
import com.zhgd.xmgl.modules.basicdata.mapper.BaseRoleUserMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.BaseRoleUserMapper;
|
||||||
import com.zhgd.xmgl.modules.basicdata.mapper.CompanyMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.CompanyMapper;
|
||||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||||
|
import com.zhgd.xmgl.modules.project.entity.ProjectEnterprise;
|
||||||
|
import com.zhgd.xmgl.modules.project.mapper.ProjectEnterpriseMapper;
|
||||||
|
import com.zhgd.xmgl.modules.worker.mapper.DepartmentInfoMapper;
|
||||||
|
import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper;
|
||||||
|
import com.zhgd.xmgl.modules.worker.mapper.TeamInfoMapper;
|
||||||
import com.zhgd.xmgl.modules.xz.entity.XzProjectOrg;
|
import com.zhgd.xmgl.modules.xz.entity.XzProjectOrg;
|
||||||
import com.zhgd.xmgl.modules.xz.mapper.XzProjectOrgMapper;
|
import com.zhgd.xmgl.modules.xz.mapper.XzProjectOrgMapper;
|
||||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||||
@ -56,6 +62,15 @@ public class FlowOrgRepositoryServiceImpl implements OrgRepositoryService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WflowModelsMapper wflowModelsMapper;
|
private WflowModelsMapper wflowModelsMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TeamInfoMapper teamInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DepartmentInfoMapper departmentInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EnterpriseInfoMapper enterpriseInfoMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ModelGroupVo.Form> getModelsByPerm(String userId) {
|
public List<ModelGroupVo.Form> getModelsByPerm(String userId) {
|
||||||
List<ModelGroupVo.Form> list = new ArrayList<>();
|
List<ModelGroupVo.Form> list = new ArrayList<>();
|
||||||
@ -112,7 +127,7 @@ public class FlowOrgRepositoryServiceImpl implements OrgRepositoryService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrgTreeVo> selectUsersByPy(String py) {
|
public List<OrgTreeVo> selectUsersByPy(String py) {
|
||||||
return null;
|
return systemUserMapper.selectUsersByPy(py);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -214,9 +229,9 @@ public class FlowOrgRepositoryServiceImpl implements OrgRepositoryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RoleDo> getSysAllRoles() {
|
public List<RoleDo> getSysAllRoles(String projectSn) {
|
||||||
try {
|
try {
|
||||||
return systemRoleMapper.selectList(null).stream()
|
return systemRoleMapper.selectList(Wrappers.<BaseRole>lambdaQuery().eq(BaseRole::getProjectSn, projectSn)).stream()
|
||||||
.map(r -> new RoleDo(r.getRoleId().toString(), r.getRoleName()))
|
.map(r -> new RoleDo(r.getRoleId().toString(), r.getRoleName()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -225,11 +240,12 @@ public class FlowOrgRepositoryServiceImpl implements OrgRepositoryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getUsersByRoles(List<String> roles) {
|
public Set<String> getUsersByRoles(List<String> roles, String projectSn) {
|
||||||
return baseRoleUserMapper.selectList(new LambdaQueryWrapper<BaseRoleUser>()
|
Set<Long> userIds = baseRoleUserMapper.selectList(new LambdaQueryWrapper<BaseRoleUser>()
|
||||||
.select(BaseRoleUser::getUserId)
|
|
||||||
.in(BaseRoleUser::getRoleId, roles)).stream()
|
.in(BaseRoleUser::getRoleId, roles)).stream()
|
||||||
.map(Object::toString).collect(Collectors.toSet());
|
.map(u -> u.getUserId()).collect(Collectors.toSet());
|
||||||
|
return systemUserMapper.selectList(Wrappers.<SystemUser>lambdaQuery().in(SystemUser::getUserId, userIds).eq(SystemUser::getSn, projectSn))
|
||||||
|
.stream().map(u -> u.getUserId().toString()).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -252,4 +268,19 @@ public class FlowOrgRepositoryServiceImpl implements OrgRepositoryService {
|
|||||||
return systemUserMapper.getUserDepInfosBatch(userDeptIds)
|
return systemUserMapper.getUserDepInfosBatch(userDeptIds)
|
||||||
.stream().collect(Collectors.toMap(UserDeptDo::getUserId, v -> v));
|
.stream().collect(Collectors.toMap(UserDeptDo::getUserId, v -> v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrgTreeVo> getEnterpriseById(String parentId) {
|
||||||
|
int p = parentId.indexOf("P");
|
||||||
|
String id = parentId.substring(0, p);
|
||||||
|
String projectSn = parentId.substring(p + 1);
|
||||||
|
List<OrgTreeVo> orgTreeVos = new ArrayList<>();
|
||||||
|
if (id.equals("0")) {
|
||||||
|
orgTreeVos = enterpriseInfoMapper.selectByProject(projectSn);
|
||||||
|
} else {
|
||||||
|
orgTreeVos = teamInfoMapper.selectByEnterprise(id, projectSn);
|
||||||
|
orgTreeVos.addAll(departmentInfoMapper.selectByEnterprise(id, projectSn));
|
||||||
|
}
|
||||||
|
return orgTreeVos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.worker.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.wflow.bean.vo.OrgTreeVo;
|
||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||||
@ -10,6 +11,7 @@ import org.apache.ibatis.annotations.MapKey;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,4 +40,11 @@ public interface DepartmentInfoMapper extends BaseMapper<DepartmentInfo> {
|
|||||||
EntityMap getDepartmentInfo(@Param("departmentId") Long departmentId);
|
EntityMap getDepartmentInfo(@Param("departmentId") Long departmentId);
|
||||||
|
|
||||||
List<GtMaterialInOutWarehouse> queryDepartmentAndTeamList(Map<String, Object> map);
|
List<GtMaterialInOutWarehouse> queryDepartmentAndTeamList(Map<String, Object> map);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业下的部门信息
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Select("SELECT id id, department_name `name`, 'enterprise' AS 'type' FROM department_info WHERE enterprise_id = #{enterpriseId} AND project_sn = #{projectSn}")
|
||||||
|
List<OrgTreeVo> selectByEnterprise(@Param("enterpriseId") String enterpriseId, @Param("projectSn") String projectSn);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,12 @@ package com.zhgd.xmgl.modules.worker.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.wflow.bean.vo.OrgTreeVo;
|
||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -43,4 +45,12 @@ public interface EnterpriseInfoMapper extends BaseMapper<EnterpriseInfo> {
|
|||||||
EnterpriseInfo getXzSupplierBySocialCode(Map<String, Object> map);
|
EnterpriseInfo getXzSupplierBySocialCode(Map<String, Object> map);
|
||||||
|
|
||||||
List<EnterpriseInfo> getAllXzSupplierList(Map<String, Object> map);
|
List<EnterpriseInfo> getAllXzSupplierList(Map<String, Object> map);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目下的企业信息
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Select("SELECT e.id id, e.enterprise_name `name`, 'enterprise' AS 'type' FROM enterprise_info e " +
|
||||||
|
"LEFT JOIN project_enterprise p ON e.id = p.enterprise_id WHERE p.project_sn = #{projectSn}")
|
||||||
|
List<OrgTreeVo> selectByProject(@Param("projectSn") String projectSn);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.wflow.bean.vo.OrgTreeVo;
|
||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord;
|
import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
|
import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
|
||||||
@ -13,6 +14,7 @@ import org.apache.ibatis.annotations.MapKey;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 人员班组
|
* @Description: 人员班组
|
||||||
@ -41,4 +43,11 @@ public interface TeamInfoMapper extends BaseMapper<TeamInfo> {
|
|||||||
List<EntityMap> selectTeamDetailsList(Map<String, Object> map);
|
List<EntityMap> selectTeamDetailsList(Map<String, Object> map);
|
||||||
|
|
||||||
IPage<GroupVo> getGroup(Page<GroupVo> page,@Param("q") Map<String, Object> map);
|
IPage<GroupVo> getGroup(Page<GroupVo> page,@Param("q") Map<String, Object> map);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业下的班组信息
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Select("SELECT id id, team_name `name`, 'enterprise' AS 'type' FROM team_info WHERE enterprise_id = #{enterpriseId} AND project_sn = #{projectSn}")
|
||||||
|
List<OrgTreeVo> selectByEnterprise(@Param("enterpriseId") String enterpriseId, @Param("projectSn") String projectSn);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.zhgd.xmgl.entity.sj.JwtPayloadUserInfo;
|
|||||||
import com.zhgd.xmgl.entity.sj.TokenResponse;
|
import com.zhgd.xmgl.entity.sj.TokenResponse;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||||
|
import com.zhgd.xmgl.tenant.TenantContextHolder;
|
||||||
import com.zhgd.xmgl.util.EnvironmentUtil;
|
import com.zhgd.xmgl.util.EnvironmentUtil;
|
||||||
import com.zhgd.xmgl.util.sj.JwtRsaUtils;
|
import com.zhgd.xmgl.util.sj.JwtRsaUtils;
|
||||||
import com.zhgd.xmgl.util.sj.SjUnifiedAuthenticationHttpUtil;
|
import com.zhgd.xmgl.util.sj.SjUnifiedAuthenticationHttpUtil;
|
||||||
@ -77,6 +78,7 @@ public class JwtTokenFilter extends OncePerRequestFilter {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
validateOtherProfile(request);
|
validateOtherProfile(request);
|
||||||
|
TenantContextHolder.setTenantId(request.getHeader("TenantId"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filterChain.doFilter(request, response);
|
filterChain.doFilter(request, response);
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.zhgd.xmgl.tenant;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目配置
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "tenant")
|
||||||
|
public class TenantConfigProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维护项目列名称
|
||||||
|
*/
|
||||||
|
private String column = "tenant_id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略项目权限的数据表集合
|
||||||
|
*/
|
||||||
|
private List<String> tables = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
40
src/main/java/com/zhgd/xmgl/tenant/TenantContextHolder.java
Normal file
40
src/main/java/com/zhgd/xmgl/tenant/TenantContextHolder.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2025, clinical All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from
|
||||||
|
* this software without specific prior written permission.
|
||||||
|
* Author: clinical
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.zhgd.xmgl.tenant;
|
||||||
|
|
||||||
|
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
|
@UtilityClass
|
||||||
|
public class TenantContextHolder {
|
||||||
|
|
||||||
|
private final ThreadLocal<String> THREAD_LOCAL_TENANT = new TransmittableThreadLocal<>();
|
||||||
|
|
||||||
|
public void setTenantId(String tenantId) {
|
||||||
|
THREAD_LOCAL_TENANT.set(tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantId() {
|
||||||
|
return THREAD_LOCAL_TENANT.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
THREAD_LOCAL_TENANT.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
61
src/main/java/com/zhgd/xmgl/tenant/TenantHandler.java
Normal file
61
src/main/java/com/zhgd/xmgl/tenant/TenantHandler.java
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2025, clinical All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from
|
||||||
|
* this software without specific prior written permission.
|
||||||
|
* Author: clinical
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.zhgd.xmgl.tenant;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.sf.jsqlparser.expression.Expression;
|
||||||
|
import net.sf.jsqlparser.expression.LongValue;
|
||||||
|
import net.sf.jsqlparser.expression.NullValue;
|
||||||
|
import net.sf.jsqlparser.expression.StringValue;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TenantHandler implements TenantLineHandler {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TenantConfigProperties properties;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Expression getTenantId() {
|
||||||
|
String tenantId = TenantContextHolder.getTenantId();
|
||||||
|
log.debug("当前项目为 >> {}", tenantId);
|
||||||
|
|
||||||
|
if (tenantId == null) {
|
||||||
|
return new NullValue();
|
||||||
|
}
|
||||||
|
return new StringValue(tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTenantIdColumn() {
|
||||||
|
return properties.getColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean ignoreTable(String tableName) {
|
||||||
|
String tenantId = TenantContextHolder.getTenantId();
|
||||||
|
// 项目中ID 为空,查询全部,不进行过滤
|
||||||
|
if (tenantId == null) {
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return properties.getTables().contains(tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user