eventRegistryEventConsumers = new HashMap<>();
-
- // MYBATIS SQL SESSION FACTORY /////////////////////////////////////
-
- protected boolean isDbHistoryUsed = true;
- protected DbSqlSessionFactory dbSqlSessionFactory;
- protected SqlSessionFactory sqlSessionFactory;
- protected TransactionFactory transactionFactory;
- protected TransactionContextFactory transactionContextFactory;
-
- /**
- * If set to true, enables bulk insert (grouping sql inserts together). Default true.
- * For some databases (eg DB2+z/OS) needs to be set to false.
- */
- protected boolean isBulkInsertEnabled = true;
-
- /**
- * Some databases have a limit of how many parameters one sql insert can have (eg SQL Server, 2000 params (!= insert statements) ). Tweak this parameter in case of exceptions indicating too much
- * is being put into one bulk insert, or make it higher if your database can cope with it and there are inserts with a huge amount of data.
- *
- * By default: 100 (55 for mssql server as it has a hard limit of 2000 parameters in a statement)
- */
- protected int maxNrOfStatementsInBulkInsert = 100;
-
- public int DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER = 55; // currently Execution has most params (35). 2000 / 35 = 57.
-
- protected String mybatisMappingFile;
- protected Set> customMybatisMappers;
- protected Set customMybatisXMLMappers;
- protected List customMybatisInterceptors;
-
- protected Set dependentEngineMyBatisXmlMappers;
- protected List dependentEngineMybatisTypeAliasConfigs;
- protected List dependentEngineMybatisTypeHandlerConfigs;
-
- // SESSION FACTORIES ///////////////////////////////////////////////
- protected List customSessionFactories;
- protected Map, SessionFactory> sessionFactories;
-
- protected boolean enableEventDispatcher = true;
- protected FlowableEventDispatcher eventDispatcher;
- protected List eventListeners;
- protected Map> typedEventListeners;
- protected List additionalEventDispatchActions;
-
- protected LoggingListener loggingListener;
-
- protected boolean transactionsExternallyManaged;
-
- /**
- * Flag that can be set to configure or not a relational database is used. This is useful for custom implementations that do not use relational databases at all.
- *
- * If true (default), the {@link AbstractEngineConfiguration#getDatabaseSchemaUpdate()} value will be used to determine what needs to happen wrt the database schema.
- *
- * If false, no validation or schema creation will be done. That means that the database schema must have been created 'manually' before but the engine does not validate whether the schema is
- * correct. The {@link AbstractEngineConfiguration#getDatabaseSchemaUpdate()} value will not be used.
- */
- protected boolean usingRelationalDatabase = true;
-
- /**
- * Flag that can be set to configure whether or not a schema is used. This is useful for custom implementations that do not use relational databases at all.
- * Setting {@link #usingRelationalDatabase} to true will automatically imply using a schema.
- */
- protected boolean usingSchemaMgmt = true;
-
- /**
- * Allows configuring a database table prefix which is used for all runtime operations of the process engine. For example, if you specify a prefix named 'PRE1.', Flowable will query for executions
- * in a table named 'PRE1.ACT_RU_EXECUTION_'.
- *
- *
- * NOTE: the prefix is not respected by automatic database schema management. If you use {@link AbstractEngineConfiguration#DB_SCHEMA_UPDATE_CREATE_DROP} or
- * {@link AbstractEngineConfiguration#DB_SCHEMA_UPDATE_TRUE}, Flowable will create the database tables using the default names, regardless of the prefix configured here.
- */
- protected String databaseTablePrefix = "";
-
- /**
- * Escape character for doing wildcard searches.
- *
- * This will be added at then end of queries that include for example a LIKE clause. For example: SELECT * FROM table WHERE column LIKE '%\%%' ESCAPE '\';
- */
- protected String databaseWildcardEscapeCharacter;
-
- /**
- * database catalog to use
- */
- protected String databaseCatalog = "";
-
- /**
- * In some situations you want to set the schema to use for table checks / generation if the database metadata doesn't return that correctly, see https://jira.codehaus.org/browse/ACT-1220,
- * https://jira.codehaus.org/browse/ACT-1062
- */
- protected String databaseSchema;
-
- /**
- * Set to true in case the defined databaseTablePrefix is a schema-name, instead of an actual table name prefix. This is relevant for checking if Flowable-tables exist, the databaseTablePrefix
- * will not be used here - since the schema is taken into account already, adding a prefix for the table-check will result in wrong table-names.
- */
- protected boolean tablePrefixIsSchema;
-
- /**
- * Set to true if the latest version of a definition should be retrieved, ignoring a possible parent deployment id value
- */
- protected boolean alwaysLookupLatestDefinitionVersion;
-
- /**
- * Set to true if by default lookups should fallback to the default tenant (an empty string by default or a defined tenant value)
- */
- protected boolean fallbackToDefaultTenant;
-
- /**
- * Default tenant provider that is executed when looking up definitions, in case the global or local fallback to default tenant value is true
- */
- protected DefaultTenantProvider defaultTenantProvider = (tenantId, scope, scopeKey) -> NO_TENANT_ID;
-
- /**
- * Enables the MyBatis plugin that logs the execution time of sql statements.
- */
- protected boolean enableLogSqlExecutionTime;
-
- protected Properties databaseTypeMappings = getDefaultDatabaseTypeMappings();
-
- /**
- * Duration between the checks when acquiring a lock.
- */
- protected Duration lockPollRate = Duration.ofSeconds(10);
-
- /**
- * Duration to wait for the DB Schema lock before giving up.
- */
- protected Duration schemaLockWaitTime = Duration.ofMinutes(5);
-
- // DATA MANAGERS //////////////////////////////////////////////////////////////////
-
- protected PropertyDataManager propertyDataManager;
- protected ByteArrayDataManager byteArrayDataManager;
- protected TableDataManager tableDataManager;
-
- // ENTITY MANAGERS ////////////////////////////////////////////////////////////////
-
- protected PropertyEntityManager propertyEntityManager;
- protected ByteArrayEntityManager byteArrayEntityManager;
-
- protected List customPreDeployers;
- protected List customPostDeployers;
- protected List deployers;
-
- // CONFIGURATORS ////////////////////////////////////////////////////////////
-
- protected boolean enableConfiguratorServiceLoader = true; // Enabled by default. In certain environments this should be set to false (eg osgi)
- protected List configurators; // The injected configurators
- protected List allConfigurators; // Including auto-discovered configurators
- protected EngineConfigurator idmEngineConfigurator;
- protected EngineConfigurator eventRegistryConfigurator;
-
- public static final String PRODUCT_NAME_POSTGRES = "PostgreSQL";
- public static final String PRODUCT_NAME_CRDB = "CockroachDB";
-
- public static final String DATABASE_TYPE_H2 = "h2";
- public static final String DATABASE_TYPE_HSQL = "hsql";
- public static final String DATABASE_TYPE_MYSQL = "mysql";
- public static final String DATABASE_TYPE_ORACLE = "oracle";
- public static final String DATABASE_TYPE_POSTGRES = "postgres";
- public static final String DATABASE_TYPE_MSSQL = "mssql";
- public static final String DATABASE_TYPE_DB2 = "db2";
- public static final String DATABASE_TYPE_COCKROACHDB = "cockroachdb";
-
- public static Properties getDefaultDatabaseTypeMappings() {
- Properties databaseTypeMappings = new Properties();
- databaseTypeMappings.setProperty("H2", DATABASE_TYPE_H2);
- databaseTypeMappings.setProperty("HSQL Database Engine", DATABASE_TYPE_HSQL);
- databaseTypeMappings.setProperty("MySQL", DATABASE_TYPE_MYSQL);
- databaseTypeMappings.setProperty("MariaDB", DATABASE_TYPE_MYSQL);
- databaseTypeMappings.setProperty("Oracle", DATABASE_TYPE_ORACLE);
- databaseTypeMappings.setProperty(PRODUCT_NAME_POSTGRES, DATABASE_TYPE_POSTGRES);
- databaseTypeMappings.setProperty("Microsoft SQL Server", DATABASE_TYPE_MSSQL);
- databaseTypeMappings.setProperty(DATABASE_TYPE_DB2, DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/NT", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/NT64", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2 UDP", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/LINUX", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/LINUX390", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/LINUXX8664", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/LINUXZ64", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/LINUXPPC64", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/LINUXPPC64LE", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/400 SQL", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/6000", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2 UDB iSeries", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/AIX64", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/HPUX", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/HP64", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/SUN", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/SUN64", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/PTX", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2/2", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty("DB2 UDB AS400", DATABASE_TYPE_DB2);
- databaseTypeMappings.setProperty(PRODUCT_NAME_CRDB, DATABASE_TYPE_COCKROACHDB);
- databaseTypeMappings.setProperty("DM DBMS", DATABASE_TYPE_ORACLE); // dhb52: DM support
- return databaseTypeMappings;
- }
-
- protected Map beans;
-
- protected IdGenerator idGenerator;
- protected boolean usePrefixId;
-
- protected Clock clock;
- protected ObjectMapper objectMapper;
-
- // Variables
-
- public static final int DEFAULT_GENERIC_MAX_LENGTH_STRING = 4000;
- public static final int DEFAULT_ORACLE_MAX_LENGTH_STRING = 2000;
-
- /**
- * Define a max length for storing String variable types in the database. Mainly used for the Oracle NVARCHAR2 limit of 2000 characters
- */
- protected int maxLengthStringVariableType = -1;
-
- protected void initEngineConfigurations() {
- addEngineConfiguration(getEngineCfgKey(), getEngineScopeType(), this);
- }
-
- // DataSource
- // ///////////////////////////////////////////////////////////////
-
- protected void initDataSource() {
- if (dataSource == null) {
- if (dataSourceJndiName != null) {
- try {
- dataSource = (DataSource) new InitialContext().lookup(dataSourceJndiName);
- } catch (Exception e) {
- throw new FlowableException("couldn't lookup datasource from " + dataSourceJndiName + ": " + e.getMessage(), e);
- }
-
- } else if (jdbcUrl != null) {
- if ((jdbcDriver == null) || (jdbcUsername == null)) {
- throw new FlowableException("DataSource or JDBC properties have to be specified in a process engine configuration");
- }
-
- logger.debug("initializing datasource to db: {}", jdbcUrl);
-
- if (logger.isInfoEnabled()) {
- logger.info("Configuring Datasource with following properties (omitted password for security)");
- logger.info("datasource driver : {}", jdbcDriver);
- logger.info("datasource url : {}", jdbcUrl);
- logger.info("datasource user name : {}", jdbcUsername);
- }
-
- PooledDataSource pooledDataSource = new PooledDataSource(this.getClass().getClassLoader(), jdbcDriver, jdbcUrl, jdbcUsername, jdbcPassword);
-
- if (jdbcMaxActiveConnections > 0) {
- pooledDataSource.setPoolMaximumActiveConnections(jdbcMaxActiveConnections);
- }
- if (jdbcMaxIdleConnections > 0) {
- pooledDataSource.setPoolMaximumIdleConnections(jdbcMaxIdleConnections);
- }
- if (jdbcMaxCheckoutTime > 0) {
- pooledDataSource.setPoolMaximumCheckoutTime(jdbcMaxCheckoutTime);
- }
- if (jdbcMaxWaitTime > 0) {
- pooledDataSource.setPoolTimeToWait(jdbcMaxWaitTime);
- }
- if (jdbcPingEnabled) {
- pooledDataSource.setPoolPingEnabled(true);
- if (jdbcPingQuery != null) {
- pooledDataSource.setPoolPingQuery(jdbcPingQuery);
- }
- pooledDataSource.setPoolPingConnectionsNotUsedFor(jdbcPingConnectionNotUsedFor);
- }
- if (jdbcDefaultTransactionIsolationLevel > 0) {
- pooledDataSource.setDefaultTransactionIsolationLevel(jdbcDefaultTransactionIsolationLevel);
- }
- dataSource = pooledDataSource;
- }
- }
-
- if (databaseType == null) {
- initDatabaseType();
- }
- }
-
- public void initDatabaseType() {
- Connection connection = null;
- try {
- connection = dataSource.getConnection();
- DatabaseMetaData databaseMetaData = connection.getMetaData();
- String databaseProductName = databaseMetaData.getDatabaseProductName();
- logger.debug("database product name: '{}'", databaseProductName);
-
- // CRDB does not expose the version through the jdbc driver, so we need to fetch it through version().
- if (PRODUCT_NAME_POSTGRES.equalsIgnoreCase(databaseProductName)) {
- try (PreparedStatement preparedStatement = connection.prepareStatement("select version() as version;");
- ResultSet resultSet = preparedStatement.executeQuery()) {
- String version = null;
- if (resultSet.next()) {
- version = resultSet.getString("version");
- }
-
- if (StringUtils.isNotEmpty(version) && version.toLowerCase().startsWith(PRODUCT_NAME_CRDB.toLowerCase())) {
- databaseProductName = PRODUCT_NAME_CRDB;
- logger.info("CockroachDB version '{}' detected", version);
- }
- }
- }
-
- databaseType = databaseTypeMappings.getProperty(databaseProductName);
- if (databaseType == null) {
- throw new FlowableException("couldn't deduct database type from database product name '" + databaseProductName + "'");
- }
- logger.debug("using database type: {}", databaseType);
-
- } catch (SQLException e) {
- throw new RuntimeException("Exception while initializing Database connection", e);
- } finally {
- try {
- if (connection != null) {
- connection.close();
- }
- } catch (SQLException e) {
- logger.error("Exception while closing the Database connection", e);
- }
- }
-
- // Special care for MSSQL, as it has a hard limit of 2000 params per statement (incl bulk statement).
- // Especially with executions, with 100 as default, this limit is passed.
- if (DATABASE_TYPE_MSSQL.equals(databaseType)) {
- maxNrOfStatementsInBulkInsert = DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER;
- }
- }
-
- public void initSchemaManager() {
- if (this.commonSchemaManager == null) {
- this.commonSchemaManager = new CommonDbSchemaManager();
- }
- }
-
- // session factories ////////////////////////////////////////////////////////
-
- public void addSessionFactory(SessionFactory sessionFactory) {
- sessionFactories.put(sessionFactory.getSessionType(), sessionFactory);
- }
-
- public void initCommandContextFactory() {
- if (commandContextFactory == null) {
- commandContextFactory = new CommandContextFactory();
- }
- }
-
- public void initTransactionContextFactory() {
- if (transactionContextFactory == null) {
- transactionContextFactory = new StandaloneMybatisTransactionContextFactory();
- }
- }
-
- public void initCommandExecutors() {
- initDefaultCommandConfig();
- initSchemaCommandConfig();
- initCommandInvoker();
- initCommandInterceptors();
- initCommandExecutor();
- }
-
-
- public void initDefaultCommandConfig() {
- if (defaultCommandConfig == null) {
- defaultCommandConfig = new CommandConfig();
- }
- }
-
- public void initSchemaCommandConfig() {
- if (schemaCommandConfig == null) {
- schemaCommandConfig = new CommandConfig();
- }
- }
-
- public void initCommandInvoker() {
- if (commandInvoker == null) {
- commandInvoker = new DefaultCommandInvoker();
- }
- }
-
- public void initCommandInterceptors() {
- if (commandInterceptors == null) {
- commandInterceptors = new ArrayList<>();
- if (customPreCommandInterceptors != null) {
- commandInterceptors.addAll(customPreCommandInterceptors);
- }
- commandInterceptors.addAll(getDefaultCommandInterceptors());
- if (customPostCommandInterceptors != null) {
- commandInterceptors.addAll(customPostCommandInterceptors);
- }
- commandInterceptors.add(commandInvoker);
- }
- }
-
- public Collection extends CommandInterceptor> getDefaultCommandInterceptors() {
- if (defaultCommandInterceptors == null) {
- List interceptors = new ArrayList<>();
- interceptors.add(new LogInterceptor());
-
- if (DATABASE_TYPE_COCKROACHDB.equals(databaseType)) {
- interceptors.add(new CrDbRetryInterceptor());
- }
-
- CommandInterceptor transactionInterceptor = createTransactionInterceptor();
- if (transactionInterceptor != null) {
- interceptors.add(transactionInterceptor);
- }
-
- if (commandContextFactory != null) {
- String engineCfgKey = getEngineCfgKey();
- CommandContextInterceptor commandContextInterceptor = new CommandContextInterceptor(commandContextFactory,
- classLoader, useClassForNameClassLoading, clock, objectMapper);
- engineConfigurations.put(engineCfgKey, this);
- commandContextInterceptor.setEngineCfgKey(engineCfgKey);
- commandContextInterceptor.setEngineConfigurations(engineConfigurations);
- interceptors.add(commandContextInterceptor);
- }
-
- if (transactionContextFactory != null) {
- interceptors.add(new TransactionContextInterceptor(transactionContextFactory));
- }
-
- List additionalCommandInterceptors = getAdditionalDefaultCommandInterceptors();
- if (additionalCommandInterceptors != null) {
- interceptors.addAll(additionalCommandInterceptors);
- }
-
- defaultCommandInterceptors = interceptors;
- }
- return defaultCommandInterceptors;
- }
-
- public abstract String getEngineCfgKey();
-
- public abstract String getEngineScopeType();
-
- public List getAdditionalDefaultCommandInterceptors() {
- return null;
- }
-
- public void initCommandExecutor() {
- if (commandExecutor == null) {
- CommandInterceptor first = initInterceptorChain(commandInterceptors);
- commandExecutor = new CommandExecutorImpl(getDefaultCommandConfig(), first);
- }
- }
-
- public CommandInterceptor initInterceptorChain(List chain) {
- if (chain == null || chain.isEmpty()) {
- throw new FlowableException("invalid command interceptor chain configuration: " + chain);
- }
- for (int i = 0; i < chain.size() - 1; i++) {
- chain.get(i).setNext(chain.get(i + 1));
- }
- return chain.get(0);
- }
-
- public abstract CommandInterceptor createTransactionInterceptor();
-
-
- public void initBeans() {
- if (beans == null) {
- beans = new HashMap<>();
- }
- }
-
- // id generator
- // /////////////////////////////////////////////////////////////
-
- public void initIdGenerator() {
- if (idGenerator == null) {
- idGenerator = new StrongUuidGenerator();
- }
- }
-
- public void initObjectMapper() {
- if (objectMapper == null) {
- objectMapper = new ObjectMapper();
- objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
- }
- }
-
- public void initClock() {
- if (clock == null) {
- clock = new DefaultClockImpl();
- }
- }
-
- // Data managers ///////////////////////////////////////////////////////////
-
- public void initDataManagers() {
- if (propertyDataManager == null) {
- propertyDataManager = new MybatisPropertyDataManager(idGenerator);
- }
-
- if (byteArrayDataManager == null) {
- byteArrayDataManager = new MybatisByteArrayDataManager(idGenerator);
- }
- }
-
- // Entity managers //////////////////////////////////////////////////////////
-
- public void initEntityManagers() {
- if (propertyEntityManager == null) {
- propertyEntityManager = new PropertyEntityManagerImpl(this, propertyDataManager);
- }
-
- if (byteArrayEntityManager == null) {
- byteArrayEntityManager = new ByteArrayEntityManagerImpl(byteArrayDataManager, getEngineCfgKey(), this::getEventDispatcher);
- }
-
- if (tableDataManager == null) {
- tableDataManager = new TableDataManagerImpl(this);
- }
- }
-
- // services
- // /////////////////////////////////////////////////////////////////
-
- protected void initService(Object service) {
- if (service instanceof CommonEngineServiceImpl) {
- ((CommonEngineServiceImpl) service).setCommandExecutor(commandExecutor);
- }
- }
-
- // myBatis SqlSessionFactory
- // ////////////////////////////////////////////////
-
- public void initSessionFactories() {
- if (sessionFactories == null) {
- sessionFactories = new HashMap<>();
-
- if (usingRelationalDatabase) {
- initDbSqlSessionFactory();
- }
-
- addSessionFactory(new GenericManagerFactory(EntityCache.class, EntityCacheImpl.class));
-
- if (isLoggingSessionEnabled()) {
- if (!sessionFactories.containsKey(LoggingSession.class)) {
- LoggingSessionFactory loggingSessionFactory = new LoggingSessionFactory();
- loggingSessionFactory.setLoggingListener(loggingListener);
- loggingSessionFactory.setObjectMapper(objectMapper);
- sessionFactories.put(LoggingSession.class, loggingSessionFactory);
- }
- }
-
- commandContextFactory.setSessionFactories(sessionFactories);
-
- } else {
- if (usingRelationalDatabase) {
- initDbSqlSessionFactoryEntitySettings();
- }
- }
-
- if (customSessionFactories != null) {
- for (SessionFactory sessionFactory : customSessionFactories) {
- addSessionFactory(sessionFactory);
- }
- }
- }
-
- public void initDbSqlSessionFactory() {
- if (dbSqlSessionFactory == null) {
- dbSqlSessionFactory = createDbSqlSessionFactory();
- }
- dbSqlSessionFactory.setDatabaseType(databaseType);
- dbSqlSessionFactory.setSqlSessionFactory(sqlSessionFactory);
- dbSqlSessionFactory.setDbHistoryUsed(isDbHistoryUsed);
- dbSqlSessionFactory.setDatabaseTablePrefix(databaseTablePrefix);
- dbSqlSessionFactory.setTablePrefixIsSchema(tablePrefixIsSchema);
- dbSqlSessionFactory.setDatabaseCatalog(databaseCatalog);
- dbSqlSessionFactory.setDatabaseSchema(databaseSchema);
- dbSqlSessionFactory.setMaxNrOfStatementsInBulkInsert(maxNrOfStatementsInBulkInsert);
-
- initDbSqlSessionFactoryEntitySettings();
-
- addSessionFactory(dbSqlSessionFactory);
- }
-
- public DbSqlSessionFactory createDbSqlSessionFactory() {
- return new DbSqlSessionFactory(usePrefixId);
- }
-
- protected abstract void initDbSqlSessionFactoryEntitySettings();
-
- protected void defaultInitDbSqlSessionFactoryEntitySettings(List> insertOrder, List> deleteOrder) {
- if (insertOrder != null) {
- for (Class extends Entity> clazz : insertOrder) {
- dbSqlSessionFactory.getInsertionOrder().add(clazz);
-
- if (isBulkInsertEnabled) {
- dbSqlSessionFactory.getBulkInserteableEntityClasses().add(clazz);
- }
- }
- }
-
- if (deleteOrder != null) {
- for (Class extends Entity> clazz : deleteOrder) {
- dbSqlSessionFactory.getDeletionOrder().add(clazz);
- }
- }
- }
-
- public void initTransactionFactory() {
- if (transactionFactory == null) {
- if (transactionsExternallyManaged) {
- transactionFactory = new ManagedTransactionFactory();
- Properties properties = new Properties();
- properties.put("closeConnection", "false");
- this.transactionFactory.setProperties(properties);
- } else {
- transactionFactory = new JdbcTransactionFactory();
- }
- }
- }
-
- public void initSqlSessionFactory() {
- if (sqlSessionFactory == null) {
- InputStream inputStream = null;
- try {
- inputStream = getMyBatisXmlConfigurationStream();
-
- Environment environment = new Environment("default", transactionFactory, dataSource);
- Reader reader = new InputStreamReader(inputStream);
- Properties properties = new Properties();
- properties.put("prefix", databaseTablePrefix);
-
- String wildcardEscapeClause = "";
- if ((databaseWildcardEscapeCharacter != null) && (databaseWildcardEscapeCharacter.length() != 0)) {
- wildcardEscapeClause = " escape '" + databaseWildcardEscapeCharacter + "'";
- }
- properties.put("wildcardEscapeClause", wildcardEscapeClause);
-
- // set default properties
- properties.put("limitBefore", "");
- properties.put("limitAfter", "");
- properties.put("limitBetween", "");
- properties.put("limitBeforeNativeQuery", "");
- properties.put("limitAfterNativeQuery", "");
- properties.put("blobType", "BLOB");
- properties.put("boolValue", "TRUE");
-
- if (databaseType != null) {
- properties.load(getResourceAsStream(pathToEngineDbProperties()));
- }
-
- Configuration configuration = initMybatisConfiguration(environment, reader, properties);
- sqlSessionFactory = new DefaultSqlSessionFactory(configuration);
-
- } catch (Exception e) {
- throw new FlowableException("Error while building ibatis SqlSessionFactory: " + e.getMessage(), e);
- } finally {
- IoUtil.closeSilently(inputStream);
- }
- } else {
- // This is needed when the SQL Session Factory is created by another engine.
- // When custom XML Mappers are registered with this engine they need to be loaded in the configuration as well
- applyCustomMybatisCustomizations(sqlSessionFactory.getConfiguration());
- }
- }
-
- public String pathToEngineDbProperties() {
- return "org/flowable/common/db/properties/" + databaseType + ".properties";
- }
-
- public Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) {
- XMLConfigBuilder parser = new XMLConfigBuilder(reader, "", properties);
- Configuration configuration = parser.getConfiguration();
-
- if (databaseType != null) {
- configuration.setDatabaseId(databaseType);
- }
-
- configuration.setEnvironment(environment);
-
- initMybatisTypeHandlers(configuration);
- initCustomMybatisInterceptors(configuration);
- if (isEnableLogSqlExecutionTime()) {
- initMyBatisLogSqlExecutionTimePlugin(configuration);
- }
-
- configuration = parseMybatisConfiguration(parser);
- return configuration;
- }
-
- public void initCustomMybatisMappers(Configuration configuration) {
- if (getCustomMybatisMappers() != null) {
- for (Class> clazz : getCustomMybatisMappers()) {
- if (!configuration.hasMapper(clazz)) {
- configuration.addMapper(clazz);
- }
- }
- }
- }
-
- public void initMybatisTypeHandlers(Configuration configuration) {
- // When mapping into Map there is currently a problem with MyBatis.
- // It will return objects which are driver specific.
- // Therefore we are registering the mappings between Object.class and the specific jdbc type here.
- // see https://github.com/mybatis/mybatis-3/issues/2216 for more info
- TypeHandlerRegistry handlerRegistry = configuration.getTypeHandlerRegistry();
-
- handlerRegistry.register(Object.class, JdbcType.BOOLEAN, new BooleanTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.BIT, new BooleanTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.TINYINT, new ByteTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.SMALLINT, new ShortTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.INTEGER, new IntegerTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.FLOAT, new FloatTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.DOUBLE, new DoubleTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.CHAR, new StringTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.CLOB, new ClobTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.VARCHAR, new StringTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.LONGVARCHAR, new StringTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.NVARCHAR, new NStringTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.NCHAR, new NStringTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.NCLOB, new NClobTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.ARRAY, new ArrayTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.BIGINT, new LongTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.REAL, new BigDecimalTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.DECIMAL, new BigDecimalTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.NUMERIC, new BigDecimalTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.BLOB, new BlobInputStreamTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.LONGVARBINARY, new BlobTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.DATE, new DateOnlyTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.TIME, new TimeOnlyTypeHandler());
- handlerRegistry.register(Object.class, JdbcType.TIMESTAMP, new DateTypeHandler());
-
- handlerRegistry.register(Object.class, JdbcType.SQLXML, new SqlxmlTypeHandler());
- }
-
- public void initCustomMybatisInterceptors(Configuration configuration) {
- if (customMybatisInterceptors!=null){
- for (Interceptor interceptor :customMybatisInterceptors){
- configuration.addInterceptor(interceptor);
- }
- }
- }
-
- public void initMyBatisLogSqlExecutionTimePlugin(Configuration configuration) {
- configuration.addInterceptor(new LogSqlExecutionTimePlugin());
- }
-
- public Configuration parseMybatisConfiguration(XMLConfigBuilder parser) {
- Configuration configuration = parser.parse();
-
- applyCustomMybatisCustomizations(configuration);
- return configuration;
- }
-
- protected void applyCustomMybatisCustomizations(Configuration configuration) {
- initCustomMybatisMappers(configuration);
-
- if (dependentEngineMybatisTypeAliasConfigs != null) {
- for (MybatisTypeAliasConfigurator typeAliasConfig : dependentEngineMybatisTypeAliasConfigs) {
- typeAliasConfig.configure(configuration.getTypeAliasRegistry());
- }
- }
- if (dependentEngineMybatisTypeHandlerConfigs != null) {
- for (MybatisTypeHandlerConfigurator typeHandlerConfig : dependentEngineMybatisTypeHandlerConfigs) {
- typeHandlerConfig.configure(configuration.getTypeHandlerRegistry());
- }
- }
-
- parseDependentEngineMybatisXMLMappers(configuration);
- parseCustomMybatisXMLMappers(configuration);
- }
-
- public void parseCustomMybatisXMLMappers(Configuration configuration) {
- if (getCustomMybatisXMLMappers() != null) {
- for (String resource : getCustomMybatisXMLMappers()) {
- parseMybatisXmlMapping(configuration, resource);
- }
- }
- }
-
- public void parseDependentEngineMybatisXMLMappers(Configuration configuration) {
- if (getDependentEngineMyBatisXmlMappers() != null) {
- for (String resource : getDependentEngineMyBatisXmlMappers()) {
- parseMybatisXmlMapping(configuration, resource);
- }
- }
- }
-
- protected void parseMybatisXmlMapping(Configuration configuration, String resource) {
- // see XMLConfigBuilder.mapperElement()
- XMLMapperBuilder mapperParser = new XMLMapperBuilder(getResourceAsStream(resource), configuration, resource, configuration.getSqlFragments());
- mapperParser.parse();
- }
-
- protected InputStream getResourceAsStream(String resource) {
- ClassLoader classLoader = getClassLoader();
- if (classLoader != null) {
- return getClassLoader().getResourceAsStream(resource);
- } else {
- return this.getClass().getClassLoader().getResourceAsStream(resource);
- }
- }
-
- public void setMybatisMappingFile(String file) {
- this.mybatisMappingFile = file;
- }
-
- public String getMybatisMappingFile() {
- return mybatisMappingFile;
- }
-
- public abstract InputStream getMyBatisXmlConfigurationStream();
-
- public void initConfigurators() {
-
- allConfigurators = new ArrayList<>();
- allConfigurators.addAll(getEngineSpecificEngineConfigurators());
-
- // Configurators that are explicitly added to the config
- if (configurators != null) {
- allConfigurators.addAll(configurators);
- }
-
- // Auto discovery through ServiceLoader
- if (enableConfiguratorServiceLoader) {
- ClassLoader classLoader = getClassLoader();
- if (classLoader == null) {
- classLoader = ReflectUtil.getClassLoader();
- }
-
- ServiceLoader configuratorServiceLoader = ServiceLoader.load(EngineConfigurator.class, classLoader);
- int nrOfServiceLoadedConfigurators = 0;
- for (EngineConfigurator configurator : configuratorServiceLoader) {
- allConfigurators.add(configurator);
- nrOfServiceLoadedConfigurators++;
- }
-
- if (nrOfServiceLoadedConfigurators > 0) {
- logger.info("Found {} auto-discoverable Process Engine Configurator{}", nrOfServiceLoadedConfigurators, nrOfServiceLoadedConfigurators > 1 ? "s" : "");
- }
-
- if (!allConfigurators.isEmpty()) {
-
- // Order them according to the priorities (useful for dependent
- // configurator)
- allConfigurators.sort(new Comparator() {
-
- @Override
- public int compare(EngineConfigurator configurator1, EngineConfigurator configurator2) {
- int priority1 = configurator1.getPriority();
- int priority2 = configurator2.getPriority();
-
- if (priority1 < priority2) {
- return -1;
- } else if (priority1 > priority2) {
- return 1;
- }
- return 0;
- }
- });
-
- // Execute the configurators
- logger.info("Found {} Engine Configurators in total:", allConfigurators.size());
- for (EngineConfigurator configurator : allConfigurators) {
- logger.info("{} (priority:{})", configurator.getClass(), configurator.getPriority());
- }
-
- }
-
- }
- }
-
- public void close() {
- if (forceCloseMybatisConnectionPool && dataSource instanceof PooledDataSource) {
- /*
- * When the datasource is created by a Flowable engine (i.e. it's an instance of PooledDataSource),
- * the connection pool needs to be closed when closing the engine.
- * Note that calling forceCloseAll() multiple times (as is the case when running with multiple engine) is ok.
- */
- ((PooledDataSource) dataSource).forceCloseAll();
- }
- }
-
- protected List getEngineSpecificEngineConfigurators() {
- // meant to be overridden if needed
- return Collections.emptyList();
- }
-
- public void configuratorsBeforeInit() {
- for (EngineConfigurator configurator : allConfigurators) {
- logger.info("Executing beforeInit() of {} (priority:{})", configurator.getClass(), configurator.getPriority());
- configurator.beforeInit(this);
- }
- }
-
- public void configuratorsAfterInit() {
- for (EngineConfigurator configurator : allConfigurators) {
- logger.info("Executing configure() of {} (priority:{})", configurator.getClass(), configurator.getPriority());
- configurator.configure(this);
- }
- }
-
- public LockManager getLockManager(String lockName) {
- return new LockManagerImpl(commandExecutor, lockName, getLockPollRate(), getEngineCfgKey());
- }
-
- // getters and setters
- // //////////////////////////////////////////////////////
-
- public abstract String getEngineName();
-
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- public AbstractEngineConfiguration setClassLoader(ClassLoader classLoader) {
- this.classLoader = classLoader;
- return this;
- }
-
- public boolean isUseClassForNameClassLoading() {
- return useClassForNameClassLoading;
- }
-
- public AbstractEngineConfiguration setUseClassForNameClassLoading(boolean useClassForNameClassLoading) {
- this.useClassForNameClassLoading = useClassForNameClassLoading;
- return this;
- }
-
- public void addEngineLifecycleListener(EngineLifecycleListener engineLifecycleListener) {
- if (this.engineLifecycleListeners == null) {
- this.engineLifecycleListeners = new ArrayList<>();
- }
- this.engineLifecycleListeners.add(engineLifecycleListener);
- }
-
- public List getEngineLifecycleListeners() {
- return engineLifecycleListeners;
- }
-
- public AbstractEngineConfiguration setEngineLifecycleListeners(List engineLifecycleListeners) {
- this.engineLifecycleListeners = engineLifecycleListeners;
- return this;
- }
-
- public String getDatabaseType() {
- return databaseType;
- }
-
- public AbstractEngineConfiguration setDatabaseType(String databaseType) {
- this.databaseType = databaseType;
- return this;
- }
-
- public DataSource getDataSource() {
- return dataSource;
- }
-
- public AbstractEngineConfiguration setDataSource(DataSource dataSource) {
- this.dataSource = dataSource;
- return this;
- }
-
- public SchemaManager getSchemaManager() {
- return schemaManager;
- }
-
- public AbstractEngineConfiguration setSchemaManager(SchemaManager schemaManager) {
- this.schemaManager = schemaManager;
- return this;
- }
-
- public SchemaManager getCommonSchemaManager() {
- return commonSchemaManager;
- }
-
- public AbstractEngineConfiguration setCommonSchemaManager(SchemaManager commonSchemaManager) {
- this.commonSchemaManager = commonSchemaManager;
- return this;
- }
-
- public Command getSchemaManagementCmd() {
- return schemaManagementCmd;
- }
-
- public AbstractEngineConfiguration setSchemaManagementCmd(Command schemaManagementCmd) {
- this.schemaManagementCmd = schemaManagementCmd;
- return this;
- }
-
- public String getJdbcDriver() {
- return jdbcDriver;
- }
-
- public AbstractEngineConfiguration setJdbcDriver(String jdbcDriver) {
- this.jdbcDriver = jdbcDriver;
- return this;
- }
-
- public String getJdbcUrl() {
- return jdbcUrl;
- }
-
- public AbstractEngineConfiguration setJdbcUrl(String jdbcUrl) {
- this.jdbcUrl = jdbcUrl;
- return this;
- }
-
- public String getJdbcUsername() {
- return jdbcUsername;
- }
-
- public AbstractEngineConfiguration setJdbcUsername(String jdbcUsername) {
- this.jdbcUsername = jdbcUsername;
- return this;
- }
-
- public String getJdbcPassword() {
- return jdbcPassword;
- }
-
- public AbstractEngineConfiguration setJdbcPassword(String jdbcPassword) {
- this.jdbcPassword = jdbcPassword;
- return this;
- }
-
- public int getJdbcMaxActiveConnections() {
- return jdbcMaxActiveConnections;
- }
-
- public AbstractEngineConfiguration setJdbcMaxActiveConnections(int jdbcMaxActiveConnections) {
- this.jdbcMaxActiveConnections = jdbcMaxActiveConnections;
- return this;
- }
-
- public int getJdbcMaxIdleConnections() {
- return jdbcMaxIdleConnections;
- }
-
- public AbstractEngineConfiguration setJdbcMaxIdleConnections(int jdbcMaxIdleConnections) {
- this.jdbcMaxIdleConnections = jdbcMaxIdleConnections;
- return this;
- }
-
- public int getJdbcMaxCheckoutTime() {
- return jdbcMaxCheckoutTime;
- }
-
- public AbstractEngineConfiguration setJdbcMaxCheckoutTime(int jdbcMaxCheckoutTime) {
- this.jdbcMaxCheckoutTime = jdbcMaxCheckoutTime;
- return this;
- }
-
- public int getJdbcMaxWaitTime() {
- return jdbcMaxWaitTime;
- }
-
- public AbstractEngineConfiguration setJdbcMaxWaitTime(int jdbcMaxWaitTime) {
- this.jdbcMaxWaitTime = jdbcMaxWaitTime;
- return this;
- }
-
- public boolean isJdbcPingEnabled() {
- return jdbcPingEnabled;
- }
-
- public AbstractEngineConfiguration setJdbcPingEnabled(boolean jdbcPingEnabled) {
- this.jdbcPingEnabled = jdbcPingEnabled;
- return this;
- }
-
- public int getJdbcPingConnectionNotUsedFor() {
- return jdbcPingConnectionNotUsedFor;
- }
-
- public AbstractEngineConfiguration setJdbcPingConnectionNotUsedFor(int jdbcPingConnectionNotUsedFor) {
- this.jdbcPingConnectionNotUsedFor = jdbcPingConnectionNotUsedFor;
- return this;
- }
-
- public int getJdbcDefaultTransactionIsolationLevel() {
- return jdbcDefaultTransactionIsolationLevel;
- }
-
- public AbstractEngineConfiguration setJdbcDefaultTransactionIsolationLevel(int jdbcDefaultTransactionIsolationLevel) {
- this.jdbcDefaultTransactionIsolationLevel = jdbcDefaultTransactionIsolationLevel;
- return this;
- }
-
- public String getJdbcPingQuery() {
- return jdbcPingQuery;
- }
-
- public AbstractEngineConfiguration setJdbcPingQuery(String jdbcPingQuery) {
- this.jdbcPingQuery = jdbcPingQuery;
- return this;
- }
-
- public String getDataSourceJndiName() {
- return dataSourceJndiName;
- }
-
- public AbstractEngineConfiguration setDataSourceJndiName(String dataSourceJndiName) {
- this.dataSourceJndiName = dataSourceJndiName;
- return this;
- }
-
- public CommandConfig getSchemaCommandConfig() {
- return schemaCommandConfig;
- }
-
- public AbstractEngineConfiguration setSchemaCommandConfig(CommandConfig schemaCommandConfig) {
- this.schemaCommandConfig = schemaCommandConfig;
- return this;
- }
-
- public boolean isTransactionsExternallyManaged() {
- return transactionsExternallyManaged;
- }
-
- public AbstractEngineConfiguration setTransactionsExternallyManaged(boolean transactionsExternallyManaged) {
- this.transactionsExternallyManaged = transactionsExternallyManaged;
- return this;
- }
-
- public Map getBeans() {
- return beans;
- }
-
- public AbstractEngineConfiguration setBeans(Map beans) {
- this.beans = beans;
- return this;
- }
-
- public IdGenerator getIdGenerator() {
- return idGenerator;
- }
-
- public AbstractEngineConfiguration setIdGenerator(IdGenerator idGenerator) {
- this.idGenerator = idGenerator;
- return this;
- }
-
- public boolean isUsePrefixId() {
- return usePrefixId;
- }
-
- public AbstractEngineConfiguration setUsePrefixId(boolean usePrefixId) {
- this.usePrefixId = usePrefixId;
- return this;
- }
-
- public String getXmlEncoding() {
- return xmlEncoding;
- }
-
- public AbstractEngineConfiguration setXmlEncoding(String xmlEncoding) {
- this.xmlEncoding = xmlEncoding;
- return this;
- }
-
- public CommandConfig getDefaultCommandConfig() {
- return defaultCommandConfig;
- }
-
- public AbstractEngineConfiguration setDefaultCommandConfig(CommandConfig defaultCommandConfig) {
- this.defaultCommandConfig = defaultCommandConfig;
- return this;
- }
-
- public CommandExecutor getCommandExecutor() {
- return commandExecutor;
- }
-
- public AbstractEngineConfiguration setCommandExecutor(CommandExecutor commandExecutor) {
- this.commandExecutor = commandExecutor;
- return this;
- }
-
- public CommandContextFactory getCommandContextFactory() {
- return commandContextFactory;
- }
-
- public AbstractEngineConfiguration setCommandContextFactory(CommandContextFactory commandContextFactory) {
- this.commandContextFactory = commandContextFactory;
- return this;
- }
-
- public CommandInterceptor getCommandInvoker() {
- return commandInvoker;
- }
-
- public AbstractEngineConfiguration setCommandInvoker(CommandInterceptor commandInvoker) {
- this.commandInvoker = commandInvoker;
- return this;
- }
-
- public AgendaOperationRunner getAgendaOperationRunner() {
- return agendaOperationRunner;
- }
-
- public AbstractEngineConfiguration setAgendaOperationRunner(AgendaOperationRunner agendaOperationRunner) {
- this.agendaOperationRunner = agendaOperationRunner;
- return this;
- }
-
- public List getCustomPreCommandInterceptors() {
- return customPreCommandInterceptors;
- }
-
- public AbstractEngineConfiguration setCustomPreCommandInterceptors(List customPreCommandInterceptors) {
- this.customPreCommandInterceptors = customPreCommandInterceptors;
- return this;
- }
-
- public List getCustomPostCommandInterceptors() {
- return customPostCommandInterceptors;
- }
-
- public AbstractEngineConfiguration setCustomPostCommandInterceptors(List customPostCommandInterceptors) {
- this.customPostCommandInterceptors = customPostCommandInterceptors;
- return this;
- }
-
- public List getCommandInterceptors() {
- return commandInterceptors;
- }
-
- public AbstractEngineConfiguration setCommandInterceptors(List commandInterceptors) {
- this.commandInterceptors = commandInterceptors;
- return this;
- }
-
- public Map getEngineConfigurations() {
- return engineConfigurations;
- }
-
- public AbstractEngineConfiguration setEngineConfigurations(Map engineConfigurations) {
- this.engineConfigurations = engineConfigurations;
- return this;
- }
-
- public void addEngineConfiguration(String key, String scopeType, AbstractEngineConfiguration engineConfiguration) {
- if (engineConfigurations == null) {
- engineConfigurations = new HashMap<>();
- }
- engineConfigurations.put(key, engineConfiguration);
- engineConfigurations.put(scopeType, engineConfiguration);
- }
-
- public Map getServiceConfigurations() {
- return serviceConfigurations;
- }
-
- public AbstractEngineConfiguration setServiceConfigurations(Map serviceConfigurations) {
- this.serviceConfigurations = serviceConfigurations;
- return this;
- }
-
- public void addServiceConfiguration(String key, AbstractServiceConfiguration serviceConfiguration) {
- if (serviceConfigurations == null) {
- serviceConfigurations = new HashMap<>();
- }
- serviceConfigurations.put(key, serviceConfiguration);
- }
-
- public Map getEventRegistryEventConsumers() {
- return eventRegistryEventConsumers;
- }
-
- public AbstractEngineConfiguration setEventRegistryEventConsumers(Map eventRegistryEventConsumers) {
- this.eventRegistryEventConsumers = eventRegistryEventConsumers;
- return this;
- }
-
- public void addEventRegistryEventConsumer(String key, EventRegistryEventConsumer eventRegistryEventConsumer) {
- if (eventRegistryEventConsumers == null) {
- eventRegistryEventConsumers = new HashMap<>();
- }
- eventRegistryEventConsumers.put(key, eventRegistryEventConsumer);
- }
-
- public AbstractEngineConfiguration setDefaultCommandInterceptors(Collection extends CommandInterceptor> defaultCommandInterceptors) {
- this.defaultCommandInterceptors = defaultCommandInterceptors;
- return this;
- }
-
- public SqlSessionFactory getSqlSessionFactory() {
- return sqlSessionFactory;
- }
-
- public AbstractEngineConfiguration setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
- this.sqlSessionFactory = sqlSessionFactory;
- return this;
- }
-
- public boolean isDbHistoryUsed() {
- return isDbHistoryUsed;
- }
-
- public AbstractEngineConfiguration setDbHistoryUsed(boolean isDbHistoryUsed) {
- this.isDbHistoryUsed = isDbHistoryUsed;
- return this;
- }
-
- public DbSqlSessionFactory getDbSqlSessionFactory() {
- return dbSqlSessionFactory;
- }
-
- public AbstractEngineConfiguration setDbSqlSessionFactory(DbSqlSessionFactory dbSqlSessionFactory) {
- this.dbSqlSessionFactory = dbSqlSessionFactory;
- return this;
- }
-
- public TransactionFactory getTransactionFactory() {
- return transactionFactory;
- }
-
- public AbstractEngineConfiguration setTransactionFactory(TransactionFactory transactionFactory) {
- this.transactionFactory = transactionFactory;
- return this;
- }
-
- public TransactionContextFactory getTransactionContextFactory() {
- return transactionContextFactory;
- }
-
- public AbstractEngineConfiguration setTransactionContextFactory(TransactionContextFactory transactionContextFactory) {
- this.transactionContextFactory = transactionContextFactory;
- return this;
- }
-
- public int getMaxNrOfStatementsInBulkInsert() {
- return maxNrOfStatementsInBulkInsert;
- }
-
- public AbstractEngineConfiguration setMaxNrOfStatementsInBulkInsert(int maxNrOfStatementsInBulkInsert) {
- this.maxNrOfStatementsInBulkInsert = maxNrOfStatementsInBulkInsert;
- return this;
- }
-
- public boolean isBulkInsertEnabled() {
- return isBulkInsertEnabled;
- }
-
- public AbstractEngineConfiguration setBulkInsertEnabled(boolean isBulkInsertEnabled) {
- this.isBulkInsertEnabled = isBulkInsertEnabled;
- return this;
- }
-
- public Set> getCustomMybatisMappers() {
- return customMybatisMappers;
- }
-
- public AbstractEngineConfiguration setCustomMybatisMappers(Set> customMybatisMappers) {
- this.customMybatisMappers = customMybatisMappers;
- return this;
- }
-
- public Set getCustomMybatisXMLMappers() {
- return customMybatisXMLMappers;
- }
-
- public AbstractEngineConfiguration setCustomMybatisXMLMappers(Set customMybatisXMLMappers) {
- this.customMybatisXMLMappers = customMybatisXMLMappers;
- return this;
- }
-
- public Set getDependentEngineMyBatisXmlMappers() {
- return dependentEngineMyBatisXmlMappers;
- }
-
- public AbstractEngineConfiguration setCustomMybatisInterceptors(List customMybatisInterceptors) {
- this.customMybatisInterceptors = customMybatisInterceptors;
- return this;
- }
-
- public List getCustomMybatisInterceptors() {
- return customMybatisInterceptors;
- }
-
- public AbstractEngineConfiguration setDependentEngineMyBatisXmlMappers(Set dependentEngineMyBatisXmlMappers) {
- this.dependentEngineMyBatisXmlMappers = dependentEngineMyBatisXmlMappers;
- return this;
- }
-
- public List getDependentEngineMybatisTypeAliasConfigs() {
- return dependentEngineMybatisTypeAliasConfigs;
- }
-
- public AbstractEngineConfiguration setDependentEngineMybatisTypeAliasConfigs(List dependentEngineMybatisTypeAliasConfigs) {
- this.dependentEngineMybatisTypeAliasConfigs = dependentEngineMybatisTypeAliasConfigs;
- return this;
- }
-
- public List getDependentEngineMybatisTypeHandlerConfigs() {
- return dependentEngineMybatisTypeHandlerConfigs;
- }
-
- public AbstractEngineConfiguration setDependentEngineMybatisTypeHandlerConfigs(List dependentEngineMybatisTypeHandlerConfigs) {
- this.dependentEngineMybatisTypeHandlerConfigs = dependentEngineMybatisTypeHandlerConfigs;
- return this;
- }
-
- public List getCustomSessionFactories() {
- return customSessionFactories;
- }
-
- public AbstractEngineConfiguration addCustomSessionFactory(SessionFactory sessionFactory) {
- if (customSessionFactories == null) {
- customSessionFactories = new ArrayList<>();
- }
- customSessionFactories.add(sessionFactory);
- return this;
- }
-
- public AbstractEngineConfiguration setCustomSessionFactories(List customSessionFactories) {
- this.customSessionFactories = customSessionFactories;
- return this;
- }
-
- public boolean isUsingRelationalDatabase() {
- return usingRelationalDatabase;
- }
-
- public AbstractEngineConfiguration setUsingRelationalDatabase(boolean usingRelationalDatabase) {
- this.usingRelationalDatabase = usingRelationalDatabase;
- return this;
- }
-
- public boolean isUsingSchemaMgmt() {
- return usingSchemaMgmt;
- }
-
- public AbstractEngineConfiguration setUsingSchemaMgmt(boolean usingSchema) {
- this.usingSchemaMgmt = usingSchema;
- return this;
- }
-
- public String getDatabaseTablePrefix() {
- return databaseTablePrefix;
- }
-
- public AbstractEngineConfiguration setDatabaseTablePrefix(String databaseTablePrefix) {
- this.databaseTablePrefix = databaseTablePrefix;
- return this;
- }
-
- public String getDatabaseWildcardEscapeCharacter() {
- return databaseWildcardEscapeCharacter;
- }
-
- public AbstractEngineConfiguration setDatabaseWildcardEscapeCharacter(String databaseWildcardEscapeCharacter) {
- this.databaseWildcardEscapeCharacter = databaseWildcardEscapeCharacter;
- return this;
- }
-
- public String getDatabaseCatalog() {
- return databaseCatalog;
- }
-
- public AbstractEngineConfiguration setDatabaseCatalog(String databaseCatalog) {
- this.databaseCatalog = databaseCatalog;
- return this;
- }
-
- public String getDatabaseSchema() {
- return databaseSchema;
- }
-
- public AbstractEngineConfiguration setDatabaseSchema(String databaseSchema) {
- this.databaseSchema = databaseSchema;
- return this;
- }
-
- public boolean isTablePrefixIsSchema() {
- return tablePrefixIsSchema;
- }
-
- public AbstractEngineConfiguration setTablePrefixIsSchema(boolean tablePrefixIsSchema) {
- this.tablePrefixIsSchema = tablePrefixIsSchema;
- return this;
- }
-
- public boolean isAlwaysLookupLatestDefinitionVersion() {
- return alwaysLookupLatestDefinitionVersion;
- }
-
- public AbstractEngineConfiguration setAlwaysLookupLatestDefinitionVersion(boolean alwaysLookupLatestDefinitionVersion) {
- this.alwaysLookupLatestDefinitionVersion = alwaysLookupLatestDefinitionVersion;
- return this;
- }
-
- public boolean isFallbackToDefaultTenant() {
- return fallbackToDefaultTenant;
- }
-
- public AbstractEngineConfiguration setFallbackToDefaultTenant(boolean fallbackToDefaultTenant) {
- this.fallbackToDefaultTenant = fallbackToDefaultTenant;
- return this;
- }
-
- /**
- * @return name of the default tenant
- * @deprecated use {@link AbstractEngineConfiguration#getDefaultTenantProvider()} instead
- */
- @Deprecated
- public String getDefaultTenantValue() {
- return getDefaultTenantProvider().getDefaultTenant(null, null, null);
- }
-
- public AbstractEngineConfiguration setDefaultTenantValue(String defaultTenantValue) {
- this.defaultTenantProvider = (tenantId, scope, scopeKey) -> defaultTenantValue;
- return this;
- }
-
- public DefaultTenantProvider getDefaultTenantProvider() {
- return defaultTenantProvider;
- }
-
- public AbstractEngineConfiguration setDefaultTenantProvider(DefaultTenantProvider defaultTenantProvider) {
- this.defaultTenantProvider = defaultTenantProvider;
- return this;
- }
-
- public boolean isEnableLogSqlExecutionTime() {
- return enableLogSqlExecutionTime;
- }
-
- public void setEnableLogSqlExecutionTime(boolean enableLogSqlExecutionTime) {
- this.enableLogSqlExecutionTime = enableLogSqlExecutionTime;
- }
-
- public Map, SessionFactory> getSessionFactories() {
- return sessionFactories;
- }
-
- public AbstractEngineConfiguration setSessionFactories(Map, SessionFactory> sessionFactories) {
- this.sessionFactories = sessionFactories;
- return this;
- }
-
- public String getDatabaseSchemaUpdate() {
- return databaseSchemaUpdate;
- }
-
- public AbstractEngineConfiguration setDatabaseSchemaUpdate(String databaseSchemaUpdate) {
- this.databaseSchemaUpdate = databaseSchemaUpdate;
- return this;
- }
-
- public boolean isUseLockForDatabaseSchemaUpdate() {
- return useLockForDatabaseSchemaUpdate;
- }
-
- public AbstractEngineConfiguration setUseLockForDatabaseSchemaUpdate(boolean useLockForDatabaseSchemaUpdate) {
- this.useLockForDatabaseSchemaUpdate = useLockForDatabaseSchemaUpdate;
- return this;
- }
-
- public boolean isEnableEventDispatcher() {
- return enableEventDispatcher;
- }
-
- public AbstractEngineConfiguration setEnableEventDispatcher(boolean enableEventDispatcher) {
- this.enableEventDispatcher = enableEventDispatcher;
- return this;
- }
-
- public FlowableEventDispatcher getEventDispatcher() {
- return eventDispatcher;
- }
-
- public AbstractEngineConfiguration setEventDispatcher(FlowableEventDispatcher eventDispatcher) {
- this.eventDispatcher = eventDispatcher;
- return this;
- }
-
- public List getEventListeners() {
- return eventListeners;
- }
-
- public AbstractEngineConfiguration setEventListeners(List eventListeners) {
- this.eventListeners = eventListeners;
- return this;
- }
-
- public Map> getTypedEventListeners() {
- return typedEventListeners;
- }
-
- public AbstractEngineConfiguration setTypedEventListeners(Map> typedEventListeners) {
- this.typedEventListeners = typedEventListeners;
- return this;
- }
-
- public List getAdditionalEventDispatchActions() {
- return additionalEventDispatchActions;
- }
-
- public AbstractEngineConfiguration setAdditionalEventDispatchActions(List additionalEventDispatchActions) {
- this.additionalEventDispatchActions = additionalEventDispatchActions;
- return this;
- }
-
- public void initEventDispatcher() {
- if (this.eventDispatcher == null) {
- this.eventDispatcher = new FlowableEventDispatcherImpl();
- }
-
- initAdditionalEventDispatchActions();
-
- this.eventDispatcher.setEnabled(enableEventDispatcher);
-
- initEventListeners();
- initTypedEventListeners();
- }
-
- protected void initEventListeners() {
- if (eventListeners != null) {
- for (FlowableEventListener listenerToAdd : eventListeners) {
- this.eventDispatcher.addEventListener(listenerToAdd);
- }
- }
- }
-
- protected void initAdditionalEventDispatchActions() {
- if (this.additionalEventDispatchActions == null) {
- this.additionalEventDispatchActions = new ArrayList<>();
- }
- }
-
- protected void initTypedEventListeners() {
- if (typedEventListeners != null) {
- for (Map.Entry> listenersToAdd : typedEventListeners.entrySet()) {
- // Extract types from the given string
- FlowableEngineEventType[] types = FlowableEngineEventType.getTypesFromString(listenersToAdd.getKey());
-
- for (FlowableEventListener listenerToAdd : listenersToAdd.getValue()) {
- this.eventDispatcher.addEventListener(listenerToAdd, types);
- }
- }
- }
- }
-
- public boolean isLoggingSessionEnabled() {
- return loggingListener != null;
- }
-
- public LoggingListener getLoggingListener() {
- return loggingListener;
- }
-
- public void setLoggingListener(LoggingListener loggingListener) {
- this.loggingListener = loggingListener;
- }
-
- public Clock getClock() {
- return clock;
- }
-
- public AbstractEngineConfiguration setClock(Clock clock) {
- this.clock = clock;
- return this;
- }
-
- public ObjectMapper getObjectMapper() {
- return objectMapper;
- }
-
- public AbstractEngineConfiguration setObjectMapper(ObjectMapper objectMapper) {
- this.objectMapper = objectMapper;
- return this;
- }
-
- public int getMaxLengthString() {
- if (maxLengthStringVariableType == -1) {
- if ("oracle".equalsIgnoreCase(databaseType)) {
- return DEFAULT_ORACLE_MAX_LENGTH_STRING;
- } else {
- return DEFAULT_GENERIC_MAX_LENGTH_STRING;
- }
- } else {
- return maxLengthStringVariableType;
- }
- }
-
- public int getMaxLengthStringVariableType() {
- return maxLengthStringVariableType;
- }
-
- public AbstractEngineConfiguration setMaxLengthStringVariableType(int maxLengthStringVariableType) {
- this.maxLengthStringVariableType = maxLengthStringVariableType;
- return this;
- }
-
- public PropertyDataManager getPropertyDataManager() {
- return propertyDataManager;
- }
-
- public Duration getLockPollRate() {
- return lockPollRate;
- }
-
- public AbstractEngineConfiguration setLockPollRate(Duration lockPollRate) {
- this.lockPollRate = lockPollRate;
- return this;
- }
-
- public Duration getSchemaLockWaitTime() {
- return schemaLockWaitTime;
- }
-
- public void setSchemaLockWaitTime(Duration schemaLockWaitTime) {
- this.schemaLockWaitTime = schemaLockWaitTime;
- }
-
- public AbstractEngineConfiguration setPropertyDataManager(PropertyDataManager propertyDataManager) {
- this.propertyDataManager = propertyDataManager;
- return this;
- }
-
- public PropertyEntityManager getPropertyEntityManager() {
- return propertyEntityManager;
- }
-
- public AbstractEngineConfiguration setPropertyEntityManager(PropertyEntityManager propertyEntityManager) {
- this.propertyEntityManager = propertyEntityManager;
- return this;
- }
-
- public ByteArrayDataManager getByteArrayDataManager() {
- return byteArrayDataManager;
- }
-
- public AbstractEngineConfiguration setByteArrayDataManager(ByteArrayDataManager byteArrayDataManager) {
- this.byteArrayDataManager = byteArrayDataManager;
- return this;
- }
-
- public ByteArrayEntityManager getByteArrayEntityManager() {
- return byteArrayEntityManager;
- }
-
- public AbstractEngineConfiguration setByteArrayEntityManager(ByteArrayEntityManager byteArrayEntityManager) {
- this.byteArrayEntityManager = byteArrayEntityManager;
- return this;
- }
-
- public TableDataManager getTableDataManager() {
- return tableDataManager;
- }
-
- public AbstractEngineConfiguration setTableDataManager(TableDataManager tableDataManager) {
- this.tableDataManager = tableDataManager;
- return this;
- }
-
- public List getDeployers() {
- return deployers;
- }
-
- public AbstractEngineConfiguration setDeployers(List deployers) {
- this.deployers = deployers;
- return this;
- }
-
- public List getCustomPreDeployers() {
- return customPreDeployers;
- }
-
- public AbstractEngineConfiguration setCustomPreDeployers(List customPreDeployers) {
- this.customPreDeployers = customPreDeployers;
- return this;
- }
-
- public List getCustomPostDeployers() {
- return customPostDeployers;
- }
-
- public AbstractEngineConfiguration setCustomPostDeployers(List customPostDeployers) {
- this.customPostDeployers = customPostDeployers;
- return this;
- }
-
- public boolean isEnableConfiguratorServiceLoader() {
- return enableConfiguratorServiceLoader;
- }
-
- public AbstractEngineConfiguration setEnableConfiguratorServiceLoader(boolean enableConfiguratorServiceLoader) {
- this.enableConfiguratorServiceLoader = enableConfiguratorServiceLoader;
- return this;
- }
-
- public List getConfigurators() {
- return configurators;
- }
-
- public AbstractEngineConfiguration addConfigurator(EngineConfigurator configurator) {
- if (configurators == null) {
- configurators = new ArrayList<>();
- }
- configurators.add(configurator);
- return this;
- }
-
- /**
- * @return All {@link EngineConfigurator} instances. Will only contain values after init of the engine.
- * Use the {@link #getConfigurators()} or {@link #addConfigurator(EngineConfigurator)} methods otherwise.
- */
- public List getAllConfigurators() {
- return allConfigurators;
- }
-
- public AbstractEngineConfiguration setConfigurators(List configurators) {
- this.configurators = configurators;
- return this;
- }
-
- public EngineConfigurator getIdmEngineConfigurator() {
- return idmEngineConfigurator;
- }
-
- public AbstractEngineConfiguration setIdmEngineConfigurator(EngineConfigurator idmEngineConfigurator) {
- this.idmEngineConfigurator = idmEngineConfigurator;
- return this;
- }
-
- public EngineConfigurator getEventRegistryConfigurator() {
- return eventRegistryConfigurator;
- }
-
- public AbstractEngineConfiguration setEventRegistryConfigurator(EngineConfigurator eventRegistryConfigurator) {
- this.eventRegistryConfigurator = eventRegistryConfigurator;
- return this;
- }
-
- public AbstractEngineConfiguration setForceCloseMybatisConnectionPool(boolean forceCloseMybatisConnectionPool) {
- this.forceCloseMybatisConnectionPool = forceCloseMybatisConnectionPool;
- return this;
- }
-
- public boolean isForceCloseMybatisConnectionPool() {
- return forceCloseMybatisConnectionPool;
- }
-}
diff --git a/sql/dm/flowable-patch/src/main/resources/META-INF/package-info.md b/sql/dm/flowable-patch/src/main/resources/META-INF/package-info.md
deleted file mode 100644
index 1932c7a3fc573f2c2f5c35b9797a6e11106cb34f..0000000000000000000000000000000000000000
--- a/sql/dm/flowable-patch/src/main/resources/META-INF/package-info.md
+++ /dev/null
@@ -1 +0,0 @@
-防止IDEA将`.`和`/`混为一谈
\ No newline at end of file
diff --git a/sql/dm/flowable-patch/src/main/resources/META-INF/services/liquibase.database.Database b/sql/dm/flowable-patch/src/main/resources/META-INF/services/liquibase.database.Database
deleted file mode 100644
index efbcfcca21102738a8dab638c90bbe234d552489..0000000000000000000000000000000000000000
--- a/sql/dm/flowable-patch/src/main/resources/META-INF/services/liquibase.database.Database
+++ /dev/null
@@ -1,21 +0,0 @@
-liquibase.database.core.CockroachDatabase
-liquibase.database.core.DB2Database
-liquibase.database.core.Db2zDatabase
-liquibase.database.core.DerbyDatabase
-liquibase.database.core.Firebird3Database
-liquibase.database.core.FirebirdDatabase
-liquibase.database.core.H2Database
-liquibase.database.core.HsqlDatabase
-liquibase.database.core.InformixDatabase
-liquibase.database.core.Ingres9Database
-liquibase.database.core.MSSQLDatabase
-liquibase.database.core.MariaDBDatabase
-liquibase.database.core.MockDatabase
-liquibase.database.core.MySQLDatabase
-liquibase.database.core.OracleDatabase
-liquibase.database.core.PostgresDatabase
-liquibase.database.core.SQLiteDatabase
-liquibase.database.core.SybaseASADatabase
-liquibase.database.core.SybaseDatabase
-liquibase.database.core.DmDatabase
-liquibase.database.core.UnsupportedDatabase
diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml
index 0b90ada758ee8fbdcfca0cb0ae31da3daf24cb05..82ba5b4bebb52b622c26ed961068c840fcdcacbe 100644
--- a/yudao-dependencies/pom.xml
+++ b/yudao-dependencies/pom.xml
@@ -14,13 +14,14 @@
https://github.com/YunaiV/ruoyi-vue-pro
- 2.1.0-snapshot
+ 2.1.0-jdk8-snapshot
1.5.0
- 3.2.2
+ 2.7.18
- 2.2.0
+ 1.6.15
4.3.0
+ 2.5
1.2.21
3.5.5
@@ -28,29 +29,28 @@
4.3.0
1.4.10
2.2.11
- 3.26.0
+ 3.18.0
8.1.3.62
- 2.3.0
+ 2.2.3
2.2.7
- 9.0.0
- 3.2.1
+ 8.12.0
+ 2.7.15
0.33.0
- 8.0.1.RELEASE
+ 7.2.11.RELEASE
1.0.13
- 5.2.0
+ 4.11.0
- 7.0.1
+ 6.8.0
- 2.0.3
+ 1.0.10
1.17.2
1.18.30
1.5.5.Final
- 5.8.25
- 6.0.0-M10
+ 5.8.25
3.3.3
2.3
1.0.5
@@ -71,8 +71,8 @@
4.6.4
2.2.1
3.1.880
- 2.0.5
- 1.6.6-beta2
+ 1.0.8
+ 1.6.6
2.12.2
4.6.0
@@ -145,14 +145,9 @@
com.github.xiaoymin
- knife4j-openapi3-jakarta-spring-boot-starter
+ knife4j-openapi3-spring-boot-starter
${knife4j.version}
-
- org.springdoc
- springdoc-openapi-starter-webmvc-api
- ${springdoc.version}
-
org.springdoc
springdoc-openapi-ui
@@ -168,12 +163,12 @@
com.alibaba
- druid-spring-boot-3-starter
+ druid-spring-boot-starter
${druid.version}
com.baomidou
- mybatis-plus-spring-boot3-starter
+ mybatis-plus-boot-starter
${mybatis-plus.version}
@@ -183,7 +178,7 @@
com.baomidou
- dynamic-datasource-spring-boot3-starter
+ dynamic-datasource-spring-boot-starter
${dynamic-datasource.version}
@@ -346,14 +341,6 @@
${spring-boot-admin.version}
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-test
- ${revision}
- test
-
-
org.mockito
mockito-inline
@@ -439,12 +426,7 @@
cn.hutool
hutool-all
- ${hutool-5.version}
-
-
- org.dromara.hutool
- hutool-extra
- ${hutool-6.version}
+ ${hutool.version}
@@ -599,7 +581,7 @@
org.jeecgframework.jimureport
- jimureport-spring-boot3-starter
+ jimureport-spring-boot-starter
${jimureport.version}
diff --git a/yudao-framework/pom.xml b/yudao-framework/pom.xml
index 76e674099b9d377a18508c013692cbdc703f9c24..d22b4638b724f550fe2f11783afaf4e58dfc0f75 100644
--- a/yudao-framework/pom.xml
+++ b/yudao-framework/pom.xml
@@ -23,7 +23,6 @@
yudao-spring-boot-starter-mq
yudao-spring-boot-starter-excel
- yudao-spring-boot-starter-test
yudao-spring-boot-starter-biz-tenant
yudao-spring-boot-starter-biz-data-permission
diff --git a/yudao-framework/yudao-common/pom.xml b/yudao-framework/yudao-common/pom.xml
index b28da08fe263fc780b29a0793dd34935318ffa3a..f364df7c3544d26151ecf6c85492ad6aca58d096 100644
--- a/yudao-framework/yudao-common/pom.xml
+++ b/yudao-framework/yudao-common/pom.xml
@@ -60,7 +60,7 @@
org.springdoc
- springdoc-openapi-starter-webmvc-api
+ springdoc-openapi-ui
provided
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java
index 268d117f95744785489a5c795e29e53f29f6f9f3..97819f993825ec23fefc5ba155f448870f91b3eb 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java
@@ -3,9 +3,9 @@ package cn.iocoder.yudao.framework.common.pojo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import jakarta.validation.constraints.Min;
-import jakarta.validation.constraints.Max;
-import jakarta.validation.constraints.NotNull;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Schema(description="分页参数")
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java
index 9a39a7a4e3414eee3d970edba9820d9d4c901f8b..d36b2c308973157ba3252a96825bc9ccc580fd6b 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java
@@ -9,7 +9,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
-import jakarta.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequest;
import java.net.URI;
import java.nio.charset.Charset;
import java.util.Map;
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/servlet/ServletUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/servlet/ServletUtils.java
index 12731edad66aa6faf9e7b0bbeaa570c2139ec916..8edbb506549032a0f74ebe064493a5b6b40d16bb 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/servlet/ServletUtils.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/servlet/ServletUtils.java
@@ -1,16 +1,19 @@
package cn.iocoder.yudao.framework.common.util.servlet;
+import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
-import cn.hutool.extra.servlet.JakartaServletUtil;
+import cn.hutool.extra.servlet.ServletUtil;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
-import jakarta.servlet.ServletRequest;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
import org.springframework.http.MediaType;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
import java.util.Map;
/**
@@ -29,7 +32,22 @@ public class ServletUtils {
@SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码
public static void writeJSON(HttpServletResponse response, Object object) {
String content = JsonUtils.toJsonString(object);
- JakartaServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE);
+ ServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE);
+ }
+
+ /**
+ * 返回附件
+ *
+ * @param response 响应
+ * @param filename 文件名
+ * @param content 附件内容
+ */
+ public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException {
+ // 设置 header 和 contentType
+ response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
+ response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
+ // 输出附件
+ IoUtil.write(response.getOutputStream(), false, content);
}
/**
@@ -67,7 +85,7 @@ public class ServletUtils {
if (request == null) {
return null;
}
- return JakartaServletUtil.getClientIP(request);
+ return ServletUtil.getClientIP(request);
}
public static boolean isJsonRequest(ServletRequest request) {
@@ -77,7 +95,7 @@ public class ServletUtils {
public static String getBody(HttpServletRequest request) {
// 只有在 json 请求在读取,因为只有 CacheRequestBodyFilter 才会进行缓存,支持重复读取
if (isJsonRequest(request)) {
- return JakartaServletUtil.getBody(request);
+ return ServletUtil.getBody(request);
}
return null;
}
@@ -85,17 +103,17 @@ public class ServletUtils {
public static byte[] getBodyBytes(HttpServletRequest request) {
// 只有在 json 请求在读取,因为只有 CacheRequestBodyFilter 才会进行缓存,支持重复读取
if (isJsonRequest(request)) {
- return JakartaServletUtil.getBodyBytes(request);
+ return ServletUtil.getBodyBytes(request);
}
return null;
}
public static String getClientIP(HttpServletRequest request) {
- return JakartaServletUtil.getClientIP(request);
+ return ServletUtil.getClientIP(request);
}
public static Map getParamMap(HttpServletRequest request) {
- return JakartaServletUtil.getParamMap(request);
+ return ServletUtil.getParamMap(request);
}
}
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java
index a71ebd30583654ab7240b2428160871409694cd9..436a9e6690732ad65d4ee01cc29afa8724036624 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java
@@ -4,10 +4,10 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import org.springframework.util.StringUtils;
-import jakarta.validation.ConstraintViolation;
-import jakarta.validation.ConstraintViolationException;
-import jakarta.validation.Validation;
-import jakarta.validation.Validator;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import javax.validation.Validation;
+import javax.validation.Validator;
import java.util.Set;
import java.util.regex.Pattern;
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnum.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnum.java
index f8a7fba534932950d5478cb757154f1d2b76b55c..139b08965ad03eb5a9c40233a9f9cb9dc0c37878 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnum.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnum.java
@@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.common.validation;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
-import jakarta.validation.Constraint;
-import jakarta.validation.Payload;
+import javax.validation.Constraint;
+import javax.validation.Payload;
import java.lang.annotation.*;
@Target({
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumCollectionValidator.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumCollectionValidator.java
index 8751905884afff9b7c029b7fd17187a92931ce33..d20a717033ef3ebaba6a5ad19fbf75defd77520c 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumCollectionValidator.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumCollectionValidator.java
@@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.common.validation;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
-import jakarta.validation.ConstraintValidator;
-import jakarta.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumValidator.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumValidator.java
index c8c4058129ee0a2185b97d0d07e76d4d2227f4a1..6cd08caa21df361d3c7db9975ab25c24db07da47 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumValidator.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumValidator.java
@@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.common.validation;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
-import jakarta.validation.ConstraintValidator;
-import jakarta.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Mobile.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Mobile.java
index bcb75f65ee784c081e3b93f5d1ba1424ea9d2e02..4c7cb10ba1a80255ee3c1a9346dd696049eb8ae2 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Mobile.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Mobile.java
@@ -1,7 +1,7 @@
package cn.iocoder.yudao.framework.common.validation;
-import jakarta.validation.Constraint;
-import jakarta.validation.Payload;
+import javax.validation.Constraint;
+import javax.validation.Payload;
import java.lang.annotation.*;
@Target({
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/MobileValidator.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/MobileValidator.java
index f2def564b1e131f0a6e42b738aea8103ae07886c..0bddfcb213f81dab2723066a842d8e0726e46451 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/MobileValidator.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/MobileValidator.java
@@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.common.validation;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
-import jakarta.validation.ConstraintValidator;
-import jakarta.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
public class MobileValidator implements ConstraintValidator {
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Telephone.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Telephone.java
index fa534e1c6bfe90a7957a20ef5ead3f1ee33698d3..910601fd0f12efce8e07d749d28d443d60fc9f34 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Telephone.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Telephone.java
@@ -1,7 +1,7 @@
package cn.iocoder.yudao.framework.common.validation;
-import jakarta.validation.Constraint;
-import jakarta.validation.Payload;
+import javax.validation.Constraint;
+import javax.validation.Payload;
import java.lang.annotation.*;
@Target({
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/TelephoneValidator.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/TelephoneValidator.java
index 1406e07067bd8ee4b0a93e3c40d734cb32c9a5c1..d214cfeef4574913612019b32c2b6d9a690ccb64 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/TelephoneValidator.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/TelephoneValidator.java
@@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.common.validation;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.PhoneUtil;
-import jakarta.validation.ConstraintValidator;
-import jakarta.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
public class TelephoneValidator implements ConstraintValidator {
diff --git a/yudao-framework/yudao-common/src/test/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtilsTest.java b/yudao-framework/yudao-common/src/test/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtilsTest.java
deleted file mode 100644
index 0e44645bc537be62d545e5b70400299c46decdbb..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-common/src/test/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtilsTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package cn.iocoder.yudao.framework.common.util.collection;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import org.junit.jupiter.api.Test;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.function.BiFunction;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/**
- * {@link CollectionUtils} 的单元测试
- */
-public class CollectionUtilsTest {
-
- @Data
- @AllArgsConstructor
- private static class Dog {
-
- private Integer id;
- private String name;
- private String code;
-
- }
-
- @Test
- public void testDiffList() {
- // 准备参数
- Collection oldList = Arrays.asList(
- new Dog(1, "花花", "hh"),
- new Dog(2, "旺财", "wc")
- );
- Collection newList = Arrays.asList(
- new Dog(null, "花花2", "hh"),
- new Dog(null, "小白", "xb")
- );
- BiFunction sameFunc = (oldObj, newObj) -> {
- boolean same = oldObj.getCode().equals(newObj.getCode());
- // 如果相等的情况下,需要设置下 id,后续好更新
- if (same) {
- newObj.setId(oldObj.getId());
- }
- return same;
- };
-
- // 调用
- List> result = CollectionUtils.diffList(oldList, newList, sameFunc);
- // 断言
- assertEquals(result.size(), 3);
- // 断言 create
- assertEquals(result.get(0).size(), 1);
- assertEquals(result.get(0).get(0), new Dog(null, "小白", "xb"));
- // 断言 update
- assertEquals(result.get(1).size(), 1);
- assertEquals(result.get(1).get(0), new Dog(1, "花花2", "hh"));
- // 断言 delete
- assertEquals(result.get(2).size(), 1);
- assertEquals(result.get(2).get(0), new Dog(2, "旺财", "wc"));
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/pom.xml b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/pom.xml
index 09e878688bbf9e1300ad2cb5a387fcb654ecb1cd..1dc0b085a87007ac680fd4c941b0cd8b13acb173 100644
--- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/pom.xml
+++ b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/pom.xml
@@ -41,12 +41,6 @@
${revision}
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-test
- test
-
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/aop/DataPermissionAnnotationInterceptorTest.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/aop/DataPermissionAnnotationInterceptorTest.java
deleted file mode 100644
index ba97ede2fcbd9f23662873238ed200dfeddba4e4..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/aop/DataPermissionAnnotationInterceptorTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package cn.iocoder.yudao.framework.datapermission.core.aop;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
-import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
-import org.aopalliance.intercept.MethodInvocation;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-
-import java.lang.reflect.Method;
-
-import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.Mockito.when;
-
-/**
- * {@link DataPermissionAnnotationInterceptor} 的单元测试
- *
- * @author 芋道源码
- */
-public class DataPermissionAnnotationInterceptorTest extends BaseMockitoUnitTest {
-
- @InjectMocks
- private DataPermissionAnnotationInterceptor interceptor;
-
- @Mock
- private MethodInvocation methodInvocation;
-
- @BeforeEach
- public void setUp() {
- interceptor.getDataPermissionCache().clear();
- }
-
- @Test // 无 @DataPermission 注解
- public void testInvoke_none() throws Throwable {
- // 参数
- mockMethodInvocation(TestNone.class);
-
- // 调用
- Object result = interceptor.invoke(methodInvocation);
- // 断言
- assertEquals("none", result);
- assertEquals(1, interceptor.getDataPermissionCache().size());
- assertTrue(CollUtil.getFirst(interceptor.getDataPermissionCache().values()).enable());
- }
-
- @Test // 在 Method 上有 @DataPermission 注解
- public void testInvoke_method() throws Throwable {
- // 参数
- mockMethodInvocation(TestMethod.class);
-
- // 调用
- Object result = interceptor.invoke(methodInvocation);
- // 断言
- assertEquals("method", result);
- assertEquals(1, interceptor.getDataPermissionCache().size());
- assertFalse(CollUtil.getFirst(interceptor.getDataPermissionCache().values()).enable());
- }
-
- @Test // 在 Class 上有 @DataPermission 注解
- public void testInvoke_class() throws Throwable {
- // 参数
- mockMethodInvocation(TestClass.class);
-
- // 调用
- Object result = interceptor.invoke(methodInvocation);
- // 断言
- assertEquals("class", result);
- assertEquals(1, interceptor.getDataPermissionCache().size());
- assertFalse(CollUtil.getFirst(interceptor.getDataPermissionCache().values()).enable());
- }
-
- private void mockMethodInvocation(Class> clazz) throws Throwable {
- Object targetObject = clazz.newInstance();
- Method method = targetObject.getClass().getMethod("echo");
- when(methodInvocation.getThis()).thenReturn(targetObject);
- when(methodInvocation.getMethod()).thenReturn(method);
- when(methodInvocation.proceed()).then(invocationOnMock -> method.invoke(targetObject));
- }
-
- static class TestMethod {
-
- @DataPermission(enable = false)
- public String echo() {
- return "method";
- }
-
- }
-
- @DataPermission(enable = false)
- static class TestClass {
-
- public String echo() {
- return "class";
- }
-
- }
-
- static class TestNone {
-
- public String echo() {
- return "none";
- }
-
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/aop/DataPermissionContextHolderTest.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/aop/DataPermissionContextHolderTest.java
deleted file mode 100644
index 688b92d9f24fa39fb85689bf1e1e719f9a84787e..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/aop/DataPermissionContextHolderTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package cn.iocoder.yudao.framework.datapermission.core.aop;
-
-import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertSame;
-import static org.mockito.Mockito.mock;
-
-/**
- * {@link DataPermissionContextHolder} 的单元测试
- *
- * @author 芋道源码
- */
-class DataPermissionContextHolderTest {
-
- @BeforeEach
- public void setUp() {
- DataPermissionContextHolder.clear();
- }
-
- @Test
- public void testGet() {
- // mock 方法
- DataPermission dataPermission01 = mock(DataPermission.class);
- DataPermissionContextHolder.add(dataPermission01);
- DataPermission dataPermission02 = mock(DataPermission.class);
- DataPermissionContextHolder.add(dataPermission02);
-
- // 调用
- DataPermission result = DataPermissionContextHolder.get();
- // 断言
- assertSame(result, dataPermission02);
- }
-
- @Test
- public void testPush() {
- // 调用
- DataPermission dataPermission01 = mock(DataPermission.class);
- DataPermissionContextHolder.add(dataPermission01);
- DataPermission dataPermission02 = mock(DataPermission.class);
- DataPermissionContextHolder.add(dataPermission02);
- // 断言
- DataPermission first = DataPermissionContextHolder.getAll().get(0);
- DataPermission second = DataPermissionContextHolder.getAll().get(1);
- assertSame(dataPermission01, first);
- assertSame(dataPermission02, second);
- }
-
- @Test
- public void testRemove() {
- // mock 方法
- DataPermission dataPermission01 = mock(DataPermission.class);
- DataPermissionContextHolder.add(dataPermission01);
- DataPermission dataPermission02 = mock(DataPermission.class);
- DataPermissionContextHolder.add(dataPermission02);
-
- // 调用
- DataPermission result = DataPermissionContextHolder.remove();
- // 断言
- assertSame(result, dataPermission02);
- assertEquals(1, DataPermissionContextHolder.getAll().size());
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptorTest.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptorTest.java
deleted file mode 100644
index 145360789cb5fc6abc86f83ab3b391a720748e4a..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptorTest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package cn.iocoder.yudao.framework.datapermission.core.db;
-
-import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
-import cn.iocoder.yudao.framework.datapermission.core.rule.DataPermissionRule;
-import cn.iocoder.yudao.framework.datapermission.core.rule.DataPermissionRuleFactory;
-import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
-import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
-import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
-import net.sf.jsqlparser.expression.Alias;
-import net.sf.jsqlparser.expression.Expression;
-import net.sf.jsqlparser.expression.LongValue;
-import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
-import net.sf.jsqlparser.schema.Column;
-import org.apache.ibatis.executor.Executor;
-import org.apache.ibatis.executor.statement.StatementHandler;
-import org.apache.ibatis.mapping.BoundSql;
-import org.apache.ibatis.mapping.MappedStatement;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockedStatic;
-
-import java.sql.Connection;
-import java.util.*;
-
-import static java.util.Collections.singletonList;
-import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.Mockito.*;
-
-/**
- * {@link DataPermissionDatabaseInterceptor} 的单元测试
- * 主要测试 {@link DataPermissionDatabaseInterceptor#beforePrepare(StatementHandler, Connection, Integer)}
- * 和 {@link DataPermissionDatabaseInterceptor#beforeUpdate(Executor, MappedStatement, Object)}
- * 以及在这个过程中,ContextHolder 和 MappedStatementCache
- *
- * @author 芋道源码
- */
-public class DataPermissionDatabaseInterceptorTest extends BaseMockitoUnitTest {
-
- @InjectMocks
- private DataPermissionDatabaseInterceptor interceptor;
-
- @Mock
- private DataPermissionRuleFactory ruleFactory;
-
- @BeforeEach
- public void setUp() {
- // 清理上下文
- DataPermissionDatabaseInterceptor.ContextHolder.clear();
- // 清空缓存
- interceptor.getMappedStatementCache().clear();
- }
-
- @Test // 不存在规则,且不匹配
- public void testBeforeQuery_withoutRule() {
- try (MockedStatic pluginUtilsMock = mockStatic(PluginUtils.class)) {
- // 准备参数
- MappedStatement mappedStatement = mock(MappedStatement.class);
- BoundSql boundSql = mock(BoundSql.class);
-
- // 调用
- interceptor.beforeQuery(null, mappedStatement, null, null, null, boundSql);
- // 断言
- pluginUtilsMock.verify(() -> PluginUtils.mpBoundSql(boundSql), never());
- }
- }
-
- @Test // 存在规则,且不匹配
- public void testBeforeQuery_withMatchRule() {
- try (MockedStatic pluginUtilsMock = mockStatic(PluginUtils.class)) {
- // 准备参数
- MappedStatement mappedStatement = mock(MappedStatement.class);
- BoundSql boundSql = mock(BoundSql.class);
- // mock 方法(数据权限)
- when(ruleFactory.getDataPermissionRule(same(mappedStatement.getId())))
- .thenReturn(singletonList(new DeptDataPermissionRule()));
- // mock 方法(MPBoundSql)
- PluginUtils.MPBoundSql mpBs = mock(PluginUtils.MPBoundSql.class);
- pluginUtilsMock.when(() -> PluginUtils.mpBoundSql(same(boundSql))).thenReturn(mpBs);
- // mock 方法(SQL)
- String sql = "select * from t_user where id = 1";
- when(mpBs.sql()).thenReturn(sql);
- // 针对 ContextHolder 和 MappedStatementCache 暂时不 mock,主要想校验过程中,数据是否正确
-
- // 调用
- interceptor.beforeQuery(null, mappedStatement, null, null, null, boundSql);
- // 断言
- verify(mpBs, times(1)).sql(
- eq("SELECT * FROM t_user WHERE id = 1 AND t_user.dept_id = 100"));
- // 断言缓存
- assertTrue(interceptor.getMappedStatementCache().getNoRewritableMappedStatements().isEmpty());
- }
- }
-
- @Test // 存在规则,但不匹配
- public void testBeforeQuery_withoutMatchRule() {
- try (MockedStatic pluginUtilsMock = mockStatic(PluginUtils.class)) {
- // 准备参数
- MappedStatement mappedStatement = mock(MappedStatement.class);
- BoundSql boundSql = mock(BoundSql.class);
- // mock 方法(数据权限)
- when(ruleFactory.getDataPermissionRule(same(mappedStatement.getId())))
- .thenReturn(singletonList(new DeptDataPermissionRule()));
- // mock 方法(MPBoundSql)
- PluginUtils.MPBoundSql mpBs = mock(PluginUtils.MPBoundSql.class);
- pluginUtilsMock.when(() -> PluginUtils.mpBoundSql(same(boundSql))).thenReturn(mpBs);
- // mock 方法(SQL)
- String sql = "select * from t_role where id = 1";
- when(mpBs.sql()).thenReturn(sql);
- // 针对 ContextHolder 和 MappedStatementCache 暂时不 mock,主要想校验过程中,数据是否正确
-
- // 调用
- interceptor.beforeQuery(null, mappedStatement, null, null, null, boundSql);
- // 断言
- verify(mpBs, times(1)).sql(
- eq("SELECT * FROM t_role WHERE id = 1"));
- // 断言缓存
- assertFalse(interceptor.getMappedStatementCache().getNoRewritableMappedStatements().isEmpty());
- }
- }
-
- @Test
- public void testAddNoRewritable() {
- // 准备参数
- MappedStatement ms = mock(MappedStatement.class);
- List rules = singletonList(new DeptDataPermissionRule());
- // mock 方法
- when(ms.getId()).thenReturn("selectById");
-
- // 调用
- interceptor.getMappedStatementCache().addNoRewritable(ms, rules);
- // 断言
- Map, Set> noRewritableMappedStatements =
- interceptor.getMappedStatementCache().getNoRewritableMappedStatements();
- assertEquals(1, noRewritableMappedStatements.size());
- assertEquals(SetUtils.asSet("selectById"), noRewritableMappedStatements.get(DeptDataPermissionRule.class));
- }
-
- @Test
- public void testNoRewritable() {
- // 准备参数
- MappedStatement ms = mock(MappedStatement.class);
- // mock 方法
- when(ms.getId()).thenReturn("selectById");
- // mock 数据
- List rules = singletonList(new DeptDataPermissionRule());
- interceptor.getMappedStatementCache().addNoRewritable(ms, rules);
-
- // 场景一,rules 为空
- assertTrue(interceptor.getMappedStatementCache().noRewritable(ms, null));
- // 场景二,rules 非空,可重写
- assertFalse(interceptor.getMappedStatementCache().noRewritable(ms, singletonList(new EmptyDataPermissionRule())));
- // 场景三,rule 非空,不可重写
- assertTrue(interceptor.getMappedStatementCache().noRewritable(ms, rules));
- }
-
- private static class DeptDataPermissionRule implements DataPermissionRule {
-
- private static final String COLUMN = "dept_id";
-
- @Override
- public Set getTableNames() {
- return SetUtils.asSet("t_user");
- }
-
- @Override
- public Expression getExpression(String tableName, Alias tableAlias) {
- Column column = MyBatisUtils.buildColumn(tableName, tableAlias, COLUMN);
- LongValue value = new LongValue(100L);
- return new EqualsTo(column, value);
- }
-
- }
-
- private static class EmptyDataPermissionRule implements DataPermissionRule {
-
- @Override
- public Set getTableNames() {
- return Collections.emptySet();
- }
-
- @Override
- public Expression getExpression(String tableName, Alias tableAlias) {
- return null;
- }
-
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptorTest2.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptorTest2.java
deleted file mode 100644
index b8cad13cf27415d52620a126779d1eaa34c677a0..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptorTest2.java
+++ /dev/null
@@ -1,533 +0,0 @@
-package cn.iocoder.yudao.framework.datapermission.core.db;
-
-import cn.iocoder.yudao.framework.datapermission.core.rule.DataPermissionRule;
-import cn.iocoder.yudao.framework.datapermission.core.rule.DataPermissionRuleFactory;
-import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
-import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
-import net.sf.jsqlparser.expression.Alias;
-import net.sf.jsqlparser.expression.Expression;
-import net.sf.jsqlparser.expression.LongValue;
-import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
-import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
-import net.sf.jsqlparser.expression.operators.relational.InExpression;
-import net.sf.jsqlparser.schema.Column;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-
-import java.util.Arrays;
-import java.util.Set;
-
-import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/**
- * {@link DataPermissionDatabaseInterceptor} 的单元测试
- * 主要复用了 MyBatis Plus 的 TenantLineInnerInterceptorTest 的单元测试
- * 不过它的单元测试不是很规范,考虑到是复用的,所以暂时不进行修改~
- *
- * @author 芋道源码
- */
-public class DataPermissionDatabaseInterceptorTest2 extends BaseMockitoUnitTest {
-
- @InjectMocks
- private DataPermissionDatabaseInterceptor interceptor;
-
- @Mock
- private DataPermissionRuleFactory ruleFactory;
-
- @BeforeEach
- public void setUp() {
- // 租户的数据权限规则
- DataPermissionRule tenantRule = new DataPermissionRule() {
-
- private static final String COLUMN = "tenant_id";
-
- @Override
- public Set getTableNames() {
- return asSet("entity", "entity1", "entity2", "entity3", "t1", "t2", "sys_dict_item", // 支持 MyBatis Plus 的单元测试
- "t_user", "t_role"); // 满足自己的单元测试
- }
-
- @Override
- public Expression getExpression(String tableName, Alias tableAlias) {
- Column column = MyBatisUtils.buildColumn(tableName, tableAlias, COLUMN);
- LongValue value = new LongValue(1L);
- return new EqualsTo(column, value);
- }
-
- };
- // 部门的数据权限规则
- DataPermissionRule deptRule = new DataPermissionRule() {
-
- private static final String COLUMN = "dept_id";
-
- @Override
- public Set getTableNames() {
- return asSet("t_user"); // 满足自己的单元测试
- }
-
- @Override
- public Expression getExpression(String tableName, Alias tableAlias) {
- Column column = MyBatisUtils.buildColumn(tableName, tableAlias, COLUMN);
- ExpressionList values = new ExpressionList(new LongValue(10L),
- new LongValue(20L));
- return new InExpression(column, values);
- }
-
- };
- // 设置到上下文,保证
- DataPermissionDatabaseInterceptor.ContextHolder.init(Arrays.asList(tenantRule, deptRule));
- }
-
- @Test
- void delete() {
- assertSql("delete from entity where id = ?",
- "DELETE FROM entity WHERE id = ? AND entity.tenant_id = 1");
- }
-
- @Test
- void update() {
- assertSql("update entity set name = ? where id = ?",
- "UPDATE entity SET name = ? WHERE id = ? AND entity.tenant_id = 1");
- }
-
- @Test
- void selectSingle() {
- // 单表
- assertSql("select * from entity where id = ?",
- "SELECT * FROM entity WHERE id = ? AND entity.tenant_id = 1");
-
- assertSql("select * from entity where id = ? or name = ?",
- "SELECT * FROM entity WHERE (id = ? OR name = ?) AND entity.tenant_id = 1");
-
- assertSql("SELECT * FROM entity WHERE (id = ? OR name = ?)",
- "SELECT * FROM entity WHERE (id = ? OR name = ?) AND entity.tenant_id = 1");
-
- /* not */
- assertSql("SELECT * FROM entity WHERE not (id = ? OR name = ?)",
- "SELECT * FROM entity WHERE NOT (id = ? OR name = ?) AND entity.tenant_id = 1");
- }
-
- @Test
- void selectSubSelectIn() {
- /* in */
- assertSql("SELECT * FROM entity e WHERE e.id IN (select e1.id from entity1 e1 where e1.id = ?)",
- "SELECT * FROM entity e WHERE e.id IN (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.tenant_id = 1");
- // 在最前
- assertSql("SELECT * FROM entity e WHERE e.id IN " +
- "(select e1.id from entity1 e1 where e1.id = ?) and e.id = ?",
- "SELECT * FROM entity e WHERE e.id IN " +
- "(SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.id = ? AND e.tenant_id = 1");
- // 在最后
- assertSql("SELECT * FROM entity e WHERE e.id = ? and e.id IN " +
- "(select e1.id from entity1 e1 where e1.id = ?)",
- "SELECT * FROM entity e WHERE e.id = ? AND e.id IN " +
- "(SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.tenant_id = 1");
- // 在中间
- assertSql("SELECT * FROM entity e WHERE e.id = ? and e.id IN " +
- "(select e1.id from entity1 e1 where e1.id = ?) and e.id = ?",
- "SELECT * FROM entity e WHERE e.id = ? AND e.id IN " +
- "(SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.id = ? AND e.tenant_id = 1");
- }
-
- @Test
- void selectSubSelectEq() {
- /* = */
- assertSql("SELECT * FROM entity e WHERE e.id = (select e1.id from entity1 e1 where e1.id = ?)",
- "SELECT * FROM entity e WHERE e.id = (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.tenant_id = 1");
- }
-
- @Test
- void selectSubSelectInnerNotEq() {
- /* inner not = */
- assertSql("SELECT * FROM entity e WHERE not (e.id = (select e1.id from entity1 e1 where e1.id = ?))",
- "SELECT * FROM entity e WHERE NOT (e.id = (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1)) AND e.tenant_id = 1");
-
- assertSql("SELECT * FROM entity e WHERE not (e.id = (select e1.id from entity1 e1 where e1.id = ?) and e.id = ?)",
- "SELECT * FROM entity e WHERE NOT (e.id = (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.id = ?) AND e.tenant_id = 1");
- }
-
- @Test
- void selectSubSelectExists() {
- /* EXISTS */
- assertSql("SELECT * FROM entity e WHERE EXISTS (select e1.id from entity1 e1 where e1.id = ?)",
- "SELECT * FROM entity e WHERE EXISTS (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.tenant_id = 1");
-
-
- /* NOT EXISTS */
- assertSql("SELECT * FROM entity e WHERE NOT EXISTS (select e1.id from entity1 e1 where e1.id = ?)",
- "SELECT * FROM entity e WHERE NOT EXISTS (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.tenant_id = 1");
- }
-
- @Test
- void selectSubSelect() {
- /* >= */
- assertSql("SELECT * FROM entity e WHERE e.id >= (select e1.id from entity1 e1 where e1.id = ?)",
- "SELECT * FROM entity e WHERE e.id >= (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.tenant_id = 1");
-
-
- /* <= */
- assertSql("SELECT * FROM entity e WHERE e.id <= (select e1.id from entity1 e1 where e1.id = ?)",
- "SELECT * FROM entity e WHERE e.id <= (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.tenant_id = 1");
-
-
- /* <> */
- assertSql("SELECT * FROM entity e WHERE e.id <> (select e1.id from entity1 e1 where e1.id = ?)",
- "SELECT * FROM entity e WHERE e.id <> (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.tenant_id = 1");
- }
-
- @Test
- void selectFromSelect() {
- assertSql("SELECT * FROM (select e.id from entity e WHERE e.id = (select e1.id from entity1 e1 where e1.id = ?))",
- "SELECT * FROM (SELECT e.id FROM entity e WHERE e.id = (SELECT e1.id FROM entity1 e1 WHERE e1.id = ? AND e1.tenant_id = 1) AND e.tenant_id = 1)");
- }
-
- @Test
- void selectBodySubSelect() {
- assertSql("select t1.col1,(select t2.col2 from t2 t2 where t1.col1=t2.col1) from t1 t1",
- "SELECT t1.col1, (SELECT t2.col2 FROM t2 t2 WHERE t1.col1 = t2.col1 AND t2.tenant_id = 1) FROM t1 t1 WHERE t1.tenant_id = 1");
- }
-
- @Test
- void selectLeftJoin() {
- // left join
- assertSql("SELECT * FROM entity e " +
- "left join entity1 e1 on e1.id = e.id " +
- "WHERE e.id = ? OR e.name = ?",
- "SELECT * FROM entity e " +
- "LEFT JOIN entity1 e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.name = ?) AND e.tenant_id = 1");
-
- assertSql("SELECT * FROM entity e " +
- "left join entity1 e1 on e1.id = e.id " +
- "WHERE (e.id = ? OR e.name = ?)",
- "SELECT * FROM entity e " +
- "LEFT JOIN entity1 e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.name = ?) AND e.tenant_id = 1");
-
- assertSql("SELECT * FROM entity e " +
- "left join entity1 e1 on e1.id = e.id " +
- "left join entity2 e2 on e1.id = e2.id",
- "SELECT * FROM entity e " +
- "LEFT JOIN entity1 e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
- "LEFT JOIN entity2 e2 ON e1.id = e2.id AND e2.tenant_id = 1 " +
- "WHERE e.tenant_id = 1");
- }
-
- @Test
- void selectRightJoin() {
- // right join
- assertSql("SELECT * FROM entity e " +
- "right join entity1 e1 on e1.id = e.id",
- "SELECT * FROM entity e " +
- "RIGHT JOIN entity1 e1 ON e1.id = e.id AND e.tenant_id = 1 " +
- "WHERE e1.tenant_id = 1");
-
- assertSql("SELECT * FROM with_as_1 e " +
- "right join entity1 e1 on e1.id = e.id",
- "SELECT * FROM with_as_1 e " +
- "RIGHT JOIN entity1 e1 ON e1.id = e.id " +
- "WHERE e1.tenant_id = 1");
-
- assertSql("SELECT * FROM entity e " +
- "right join entity1 e1 on e1.id = e.id " +
- "WHERE e.id = ? OR e.name = ?",
- "SELECT * FROM entity e " +
- "RIGHT JOIN entity1 e1 ON e1.id = e.id AND e.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.name = ?) AND e1.tenant_id = 1");
-
- assertSql("SELECT * FROM entity e " +
- "right join entity1 e1 on e1.id = e.id " +
- "right join entity2 e2 on e1.id = e2.id ",
- "SELECT * FROM entity e " +
- "RIGHT JOIN entity1 e1 ON e1.id = e.id AND e.tenant_id = 1 " +
- "RIGHT JOIN entity2 e2 ON e1.id = e2.id AND e1.tenant_id = 1 " +
- "WHERE e2.tenant_id = 1");
- }
-
- @Test
- void selectMixJoin() {
- assertSql("SELECT * FROM entity e " +
- "right join entity1 e1 on e1.id = e.id " +
- "left join entity2 e2 on e1.id = e2.id",
- "SELECT * FROM entity e " +
- "RIGHT JOIN entity1 e1 ON e1.id = e.id AND e.tenant_id = 1 " +
- "LEFT JOIN entity2 e2 ON e1.id = e2.id AND e2.tenant_id = 1 " +
- "WHERE e1.tenant_id = 1");
-
- assertSql("SELECT * FROM entity e " +
- "left join entity1 e1 on e1.id = e.id " +
- "right join entity2 e2 on e1.id = e2.id",
- "SELECT * FROM entity e " +
- "LEFT JOIN entity1 e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
- "RIGHT JOIN entity2 e2 ON e1.id = e2.id AND e1.tenant_id = 1 " +
- "WHERE e2.tenant_id = 1");
-
- assertSql("SELECT * FROM entity e " +
- "left join entity1 e1 on e1.id = e.id " +
- "inner join entity2 e2 on e1.id = e2.id",
- "SELECT * FROM entity e " +
- "LEFT JOIN entity1 e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
- "INNER JOIN entity2 e2 ON e1.id = e2.id AND e.tenant_id = 1 AND e2.tenant_id = 1");
- }
-
-
- @Test
- void selectJoinSubSelect() {
- assertSql("select * from (select * from entity) e1 " +
- "left join entity2 e2 on e1.id = e2.id",
- "SELECT * FROM (SELECT * FROM entity WHERE entity.tenant_id = 1) e1 " +
- "LEFT JOIN entity2 e2 ON e1.id = e2.id AND e2.tenant_id = 1");
-
- assertSql("select * from entity1 e1 " +
- "left join (select * from entity2) e2 " +
- "on e1.id = e2.id",
- "SELECT * FROM entity1 e1 " +
- "LEFT JOIN (SELECT * FROM entity2 WHERE entity2.tenant_id = 1) e2 " +
- "ON e1.id = e2.id " +
- "WHERE e1.tenant_id = 1");
- }
-
- @Test
- void selectSubJoin() {
-
- assertSql("select * FROM " +
- "(entity1 e1 right JOIN entity2 e2 ON e1.id = e2.id)",
- "SELECT * FROM " +
- "(entity1 e1 RIGHT JOIN entity2 e2 ON e1.id = e2.id AND e1.tenant_id = 1) " +
- "WHERE e2.tenant_id = 1");
-
- assertSql("select * FROM " +
- "(entity1 e1 LEFT JOIN entity2 e2 ON e1.id = e2.id)",
- "SELECT * FROM " +
- "(entity1 e1 LEFT JOIN entity2 e2 ON e1.id = e2.id AND e2.tenant_id = 1) " +
- "WHERE e1.tenant_id = 1");
-
-
- assertSql("select * FROM " +
- "(entity1 e1 LEFT JOIN entity2 e2 ON e1.id = e2.id) " +
- "right join entity3 e3 on e1.id = e3.id",
- "SELECT * FROM " +
- "(entity1 e1 LEFT JOIN entity2 e2 ON e1.id = e2.id AND e2.tenant_id = 1) " +
- "RIGHT JOIN entity3 e3 ON e1.id = e3.id AND e1.tenant_id = 1 " +
- "WHERE e3.tenant_id = 1");
-
-
- assertSql("select * FROM entity e " +
- "LEFT JOIN (entity1 e1 right join entity2 e2 ON e1.id = e2.id) " +
- "on e.id = e2.id",
- "SELECT * FROM entity e " +
- "LEFT JOIN (entity1 e1 RIGHT JOIN entity2 e2 ON e1.id = e2.id AND e1.tenant_id = 1) " +
- "ON e.id = e2.id AND e2.tenant_id = 1 " +
- "WHERE e.tenant_id = 1");
-
- assertSql("select * FROM entity e " +
- "LEFT JOIN (entity1 e1 left join entity2 e2 ON e1.id = e2.id) " +
- "on e.id = e2.id",
- "SELECT * FROM entity e " +
- "LEFT JOIN (entity1 e1 LEFT JOIN entity2 e2 ON e1.id = e2.id AND e2.tenant_id = 1) " +
- "ON e.id = e2.id AND e1.tenant_id = 1 " +
- "WHERE e.tenant_id = 1");
-
- assertSql("select * FROM entity e " +
- "RIGHT JOIN (entity1 e1 left join entity2 e2 ON e1.id = e2.id) " +
- "on e.id = e2.id",
- "SELECT * FROM entity e " +
- "RIGHT JOIN (entity1 e1 LEFT JOIN entity2 e2 ON e1.id = e2.id AND e2.tenant_id = 1) " +
- "ON e.id = e2.id AND e.tenant_id = 1 " +
- "WHERE e1.tenant_id = 1");
- }
-
-
- @Test
- void selectLeftJoinMultipleTrailingOn() {
- // 多个 on 尾缀的
- assertSql("SELECT * FROM entity e " +
- "LEFT JOIN entity1 e1 " +
- "LEFT JOIN entity2 e2 ON e2.id = e1.id " +
- "ON e1.id = e.id " +
- "WHERE (e.id = ? OR e.NAME = ?)",
- "SELECT * FROM entity e " +
- "LEFT JOIN entity1 e1 " +
- "LEFT JOIN entity2 e2 ON e2.id = e1.id AND e2.tenant_id = 1 " +
- "ON e1.id = e.id AND e1.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.NAME = ?) AND e.tenant_id = 1");
-
- assertSql("SELECT * FROM entity e " +
- "LEFT JOIN entity1 e1 " +
- "LEFT JOIN with_as_A e2 ON e2.id = e1.id " +
- "ON e1.id = e.id " +
- "WHERE (e.id = ? OR e.NAME = ?)",
- "SELECT * FROM entity e " +
- "LEFT JOIN entity1 e1 " +
- "LEFT JOIN with_as_A e2 ON e2.id = e1.id " +
- "ON e1.id = e.id AND e1.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.NAME = ?) AND e.tenant_id = 1");
- }
-
- @Test
- void selectInnerJoin() {
- // inner join
- assertSql("SELECT * FROM entity e " +
- "inner join entity1 e1 on e1.id = e.id " +
- "WHERE e.id = ? OR e.name = ?",
- "SELECT * FROM entity e " +
- "INNER JOIN entity1 e1 ON e1.id = e.id AND e.tenant_id = 1 AND e1.tenant_id = 1 " +
- "WHERE e.id = ? OR e.name = ?");
-
- assertSql("SELECT * FROM entity e " +
- "inner join entity1 e1 on e1.id = e.id " +
- "WHERE (e.id = ? OR e.name = ?)",
- "SELECT * FROM entity e " +
- "INNER JOIN entity1 e1 ON e1.id = e.id AND e.tenant_id = 1 AND e1.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.name = ?)");
-
- // 隐式内连接
- assertSql("SELECT * FROM entity,entity1 " +
- "WHERE entity.id = entity1.id",
- "SELECT * FROM entity, entity1 " +
- "WHERE entity.id = entity1.id AND entity.tenant_id = 1 AND entity1.tenant_id = 1");
-
- // 隐式内连接
- assertSql("SELECT * FROM entity a, with_as_entity1 b " +
- "WHERE a.id = b.id",
- "SELECT * FROM entity a, with_as_entity1 b " +
- "WHERE a.id = b.id AND a.tenant_id = 1");
-
- assertSql("SELECT * FROM with_as_entity a, with_as_entity1 b " +
- "WHERE a.id = b.id",
- "SELECT * FROM with_as_entity a, with_as_entity1 b " +
- "WHERE a.id = b.id");
-
- // SubJoin with 隐式内连接
- assertSql("SELECT * FROM (entity,entity1) " +
- "WHERE entity.id = entity1.id",
- "SELECT * FROM (entity, entity1) " +
- "WHERE entity.id = entity1.id " +
- "AND entity.tenant_id = 1 AND entity1.tenant_id = 1");
-
- assertSql("SELECT * FROM ((entity,entity1),entity2) " +
- "WHERE entity.id = entity1.id and entity.id = entity2.id",
- "SELECT * FROM ((entity, entity1), entity2) " +
- "WHERE entity.id = entity1.id AND entity.id = entity2.id " +
- "AND entity.tenant_id = 1 AND entity1.tenant_id = 1 AND entity2.tenant_id = 1");
-
- assertSql("SELECT * FROM (entity,(entity1,entity2)) " +
- "WHERE entity.id = entity1.id and entity.id = entity2.id",
- "SELECT * FROM (entity, (entity1, entity2)) " +
- "WHERE entity.id = entity1.id AND entity.id = entity2.id " +
- "AND entity.tenant_id = 1 AND entity1.tenant_id = 1 AND entity2.tenant_id = 1");
-
- // 沙雕的括号写法
- assertSql("SELECT * FROM (((entity,entity1))) " +
- "WHERE entity.id = entity1.id",
- "SELECT * FROM (((entity, entity1))) " +
- "WHERE entity.id = entity1.id " +
- "AND entity.tenant_id = 1 AND entity1.tenant_id = 1");
-
- }
-
-
- @Test
- void selectWithAs() {
- assertSql("with with_as_A as (select * from entity) select * from with_as_A",
- "WITH with_as_A AS (SELECT * FROM entity WHERE entity.tenant_id = 1) SELECT * FROM with_as_A");
- }
-
-
- @Test
- void selectIgnoreTable() {
- assertSql(" SELECT dict.dict_code, item.item_text AS \"text\", item.item_value AS \"value\" FROM sys_dict_item item INNER JOIN sys_dict dict ON dict.id = item.dict_id WHERE dict.dict_code IN (1, 2, 3) AND item.item_value IN (1, 2, 3)",
- "SELECT dict.dict_code, item.item_text AS \"text\", item.item_value AS \"value\" FROM sys_dict_item item INNER JOIN sys_dict dict ON dict.id = item.dict_id AND item.tenant_id = 1 WHERE dict.dict_code IN (1, 2, 3) AND item.item_value IN (1, 2, 3)");
- }
-
- private void assertSql(String sql, String targetSql) {
- assertEquals(targetSql, interceptor.parserSingle(sql, null));
- }
-
-
- // ========== 额外的测试 ==========
-
- @Test
- public void testSelectSingle() {
- // 单表
- assertSql("select * from t_user where id = ?",
- "SELECT * FROM t_user WHERE id = ? AND t_user.tenant_id = 1 AND t_user.dept_id IN (10, 20)");
-
- assertSql("select * from t_user where id = ? or name = ?",
- "SELECT * FROM t_user WHERE (id = ? OR name = ?) AND t_user.tenant_id = 1 AND t_user.dept_id IN (10, 20)");
-
- assertSql("SELECT * FROM t_user WHERE (id = ? OR name = ?)",
- "SELECT * FROM t_user WHERE (id = ? OR name = ?) AND t_user.tenant_id = 1 AND t_user.dept_id IN (10, 20)");
-
- /* not */
- assertSql("SELECT * FROM t_user WHERE not (id = ? OR name = ?)",
- "SELECT * FROM t_user WHERE NOT (id = ? OR name = ?) AND t_user.tenant_id = 1 AND t_user.dept_id IN (10, 20)");
- }
-
- @Test
- public void testSelectLeftJoin() {
- // left join
- assertSql("SELECT * FROM t_user e " +
- "left join t_role e1 on e1.id = e.id " +
- "WHERE e.id = ? OR e.name = ?",
- "SELECT * FROM t_user e " +
- "LEFT JOIN t_role e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.name = ?) AND e.tenant_id = 1 AND e.dept_id IN (10, 20)");
-
- // 条件 e.id = ? OR e.name = ? 带括号
- assertSql("SELECT * FROM t_user e " +
- "left join t_role e1 on e1.id = e.id " +
- "WHERE (e.id = ? OR e.name = ?)",
- "SELECT * FROM t_user e " +
- "LEFT JOIN t_role e1 ON e1.id = e.id AND e1.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.name = ?) AND e.tenant_id = 1 AND e.dept_id IN (10, 20)");
- }
-
- @Test
- public void testSelectRightJoin() {
- // right join
- assertSql("SELECT * FROM t_user e " +
- "right join t_role e1 on e1.id = e.id " +
- "WHERE e.id = ? OR e.name = ?",
- "SELECT * FROM t_user e " +
- "RIGHT JOIN t_role e1 ON e1.id = e.id AND e.tenant_id = 1 AND e.dept_id IN (10, 20) " +
- "WHERE (e.id = ? OR e.name = ?) AND e1.tenant_id = 1");
-
- // 条件 e.id = ? OR e.name = ? 带括号
- assertSql("SELECT * FROM t_user e " +
- "right join t_role e1 on e1.id = e.id " +
- "WHERE (e.id = ? OR e.name = ?)",
- "SELECT * FROM t_user e " +
- "RIGHT JOIN t_role e1 ON e1.id = e.id AND e.tenant_id = 1 AND e.dept_id IN (10, 20) " +
- "WHERE (e.id = ? OR e.name = ?) AND e1.tenant_id = 1");
- }
-
- @Test
- public void testSelectInnerJoin() {
- // inner join
- assertSql("SELECT * FROM t_user e " +
- "inner join entity1 e1 on e1.id = e.id " +
- "WHERE e.id = ? OR e.name = ?",
- "SELECT * FROM t_user e " +
- "INNER JOIN entity1 e1 ON e1.id = e.id AND e.tenant_id = 1 AND e.dept_id IN (10, 20) AND e1.tenant_id = 1 " +
- "WHERE e.id = ? OR e.name = ?");
-
- // 条件 e.id = ? OR e.name = ? 带括号
- assertSql("SELECT * FROM t_user e " +
- "inner join entity1 e1 on e1.id = e.id " +
- "WHERE (e.id = ? OR e.name = ?)",
- "SELECT * FROM t_user e " +
- "INNER JOIN entity1 e1 ON e1.id = e.id AND e.tenant_id = 1 AND e.dept_id IN (10, 20) AND e1.tenant_id = 1 " +
- "WHERE (e.id = ? OR e.name = ?)");
-
- // 没有 On 的 inner join
- assertSql("SELECT * FROM entity,entity1 " +
- "WHERE entity.id = entity1.id",
- "SELECT * FROM entity, entity1 " +
- "WHERE entity.id = entity1.id AND entity.tenant_id = 1 AND entity1.tenant_id = 1");
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/rule/DataPermissionRuleFactoryImplTest.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/rule/DataPermissionRuleFactoryImplTest.java
deleted file mode 100644
index 17dddc929e6380eb0ccb533c05f142e557895653..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/rule/DataPermissionRuleFactoryImplTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package cn.iocoder.yudao.framework.datapermission.core.rule;
-
-import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
-import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder;
-import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
-import net.sf.jsqlparser.expression.Alias;
-import net.sf.jsqlparser.expression.Expression;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Spy;
-import org.springframework.core.annotation.AnnotationUtils;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
-import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString;
-import static org.junit.jupiter.api.Assertions.*;
-
-/**
- * {@link DataPermissionRuleFactoryImpl} 单元测试
- *
- * @author 芋道源码
- */
-class DataPermissionRuleFactoryImplTest extends BaseMockitoUnitTest {
-
- @InjectMocks
- private DataPermissionRuleFactoryImpl dataPermissionRuleFactory;
-
- @Spy
- private List rules = Arrays.asList(new DataPermissionRule01(),
- new DataPermissionRule02());
-
- @BeforeEach
- public void setUp() {
- DataPermissionContextHolder.clear();
- }
-
- @Test
- public void testGetDataPermissionRule_02() {
- // 准备参数
- String mappedStatementId = randomString();
-
- // 调用
- List result = dataPermissionRuleFactory.getDataPermissionRule(mappedStatementId);
- // 断言
- assertSame(rules, result);
- }
-
- @Test
- public void testGetDataPermissionRule_03() {
- // 准备参数
- String mappedStatementId = randomString();
- // mock 方法
- DataPermissionContextHolder.add(AnnotationUtils.findAnnotation(TestClass03.class, DataPermission.class));
-
- // 调用
- List result = dataPermissionRuleFactory.getDataPermissionRule(mappedStatementId);
- // 断言
- assertTrue(result.isEmpty());
- }
-
- @Test
- public void testGetDataPermissionRule_04() {
- // 准备参数
- String mappedStatementId = randomString();
- // mock 方法
- DataPermissionContextHolder.add(AnnotationUtils.findAnnotation(TestClass04.class, DataPermission.class));
-
- // 调用
- List result = dataPermissionRuleFactory.getDataPermissionRule(mappedStatementId);
- // 断言
- assertEquals(1, result.size());
- assertEquals(DataPermissionRule01.class, result.get(0).getClass());
- }
-
- @Test
- public void testGetDataPermissionRule_05() {
- // 准备参数
- String mappedStatementId = randomString();
- // mock 方法
- DataPermissionContextHolder.add(AnnotationUtils.findAnnotation(TestClass05.class, DataPermission.class));
-
- // 调用
- List result = dataPermissionRuleFactory.getDataPermissionRule(mappedStatementId);
- // 断言
- assertEquals(1, result.size());
- assertEquals(DataPermissionRule02.class, result.get(0).getClass());
- }
-
- @Test
- public void testGetDataPermissionRule_06() {
- // 准备参数
- String mappedStatementId = randomString();
- // mock 方法
- DataPermissionContextHolder.add(AnnotationUtils.findAnnotation(TestClass06.class, DataPermission.class));
-
- // 调用
- List result = dataPermissionRuleFactory.getDataPermissionRule(mappedStatementId);
- // 断言
- assertSame(rules, result);
- }
-
- @DataPermission(enable = false)
- static class TestClass03 {}
-
- @DataPermission(includeRules = DataPermissionRule01.class)
- static class TestClass04 {}
-
- @DataPermission(excludeRules = DataPermissionRule01.class)
- static class TestClass05 {}
-
- @DataPermission
- static class TestClass06 {}
-
- static class DataPermissionRule01 implements DataPermissionRule {
-
- @Override
- public Set getTableNames() {
- return null;
- }
-
- @Override
- public Expression getExpression(String tableName, Alias tableAlias) {
- return null;
- }
-
- }
-
- static class DataPermissionRule02 implements DataPermissionRule {
-
- @Override
- public Set getTableNames() {
- return null;
- }
-
- @Override
- public Expression getExpression(String tableName, Alias tableAlias) {
- return null;
- }
-
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/rule/dept/DeptDataPermissionRuleTest.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/rule/dept/DeptDataPermissionRuleTest.java
deleted file mode 100644
index d0fe496edac30d72660f1421097b359ed6a6d92e..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/rule/dept/DeptDataPermissionRuleTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package cn.iocoder.yudao.framework.datapermission.core.rule.dept;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.ReflectUtil;
-import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
-import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
-import cn.iocoder.yudao.framework.security.core.LoginUser;
-import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
-import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
-import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
-import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespDTO;
-import net.sf.jsqlparser.expression.Alias;
-import net.sf.jsqlparser.expression.Expression;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockedStatic;
-
-import java.util.Map;
-
-import static cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRule.EXPRESSION_NULL;
-import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
-import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString;
-import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.same;
-import static org.mockito.Mockito.mockStatic;
-import static org.mockito.Mockito.when;
-
-/**
- * {@link DeptDataPermissionRule} 的单元测试
- *
- * @author 芋道源码
- */
-class DeptDataPermissionRuleTest extends BaseMockitoUnitTest {
-
- @InjectMocks
- private DeptDataPermissionRule rule;
-
- @Mock
- private PermissionApi permissionApi;
-
- @BeforeEach
- @SuppressWarnings("unchecked")
- public void setUp() {
- // 清空 rule
- rule.getTableNames().clear();
- ((Map) ReflectUtil.getFieldValue(rule, "deptColumns")).clear();
- ((Map) ReflectUtil.getFieldValue(rule, "deptColumns")).clear();
- }
-
- @Test // 无 LoginUser
- public void testGetExpression_noLoginUser() {
- // 准备参数
- String tableName = randomString();
- Alias tableAlias = new Alias(randomString());
- // mock 方法
-
- // 调用
- Expression expression = rule.getExpression(tableName, tableAlias);
- // 断言
- assertNull(expression);
- }
-
- @Test // 无数据权限时
- public void testGetExpression_noDeptDataPermission() {
- try (MockedStatic securityFrameworkUtilsMock
- = mockStatic(SecurityFrameworkUtils.class)) {
- // 准备参数
- String tableName = "t_user";
- Alias tableAlias = new Alias("u");
- // mock 方法
- LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setId(1L)
- .setUserType(UserTypeEnum.ADMIN.getValue()));
- securityFrameworkUtilsMock.when(SecurityFrameworkUtils::getLoginUser).thenReturn(loginUser);
- // mock 方法(permissionApi 返回 null)
- when(permissionApi.getDeptDataPermission(eq(loginUser.getId()))).thenReturn(null);
-
- // 调用
- NullPointerException exception = assertThrows(NullPointerException.class,
- () -> rule.getExpression(tableName, tableAlias));
- // 断言
- assertEquals("LoginUser(1) Table(t_user/u) 未返回数据权限", exception.getMessage());
- }
- }
-
- @Test // 全部数据权限
- public void testGetExpression_allDeptDataPermission() {
- try (MockedStatic securityFrameworkUtilsMock
- = mockStatic(SecurityFrameworkUtils.class)) {
- // 准备参数
- String tableName = "t_user";
- Alias tableAlias = new Alias("u");
- // mock 方法(LoginUser)
- LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setId(1L)
- .setUserType(UserTypeEnum.ADMIN.getValue()));
- securityFrameworkUtilsMock.when(SecurityFrameworkUtils::getLoginUser).thenReturn(loginUser);
- // mock 方法(DeptDataPermissionRespDTO)
- DeptDataPermissionRespDTO deptDataPermission = new DeptDataPermissionRespDTO().setAll(true);
- when(permissionApi.getDeptDataPermission(same(1L))).thenReturn(deptDataPermission);
-
- // 调用
- Expression expression = rule.getExpression(tableName, tableAlias);
- // 断言
- assertNull(expression);
- assertSame(deptDataPermission, loginUser.getContext(DeptDataPermissionRule.CONTEXT_KEY, DeptDataPermissionRespDTO.class));
- }
- }
-
- @Test // 即不能查看部门,又不能查看自己,则说明 100% 无权限
- public void testGetExpression_noDept_noSelf() {
- try (MockedStatic securityFrameworkUtilsMock
- = mockStatic(SecurityFrameworkUtils.class)) {
- // 准备参数
- String tableName = "t_user";
- Alias tableAlias = new Alias("u");
- // mock 方法(LoginUser)
- LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setId(1L)
- .setUserType(UserTypeEnum.ADMIN.getValue()));
- securityFrameworkUtilsMock.when(SecurityFrameworkUtils::getLoginUser).thenReturn(loginUser);
- // mock 方法(DeptDataPermissionRespDTO)
- DeptDataPermissionRespDTO deptDataPermission = new DeptDataPermissionRespDTO();
- when(permissionApi.getDeptDataPermission(same(1L))).thenReturn(deptDataPermission);
-
- // 调用
- Expression expression = rule.getExpression(tableName, tableAlias);
- // 断言
- assertEquals("null = null", expression.toString());
- assertSame(deptDataPermission, loginUser.getContext(DeptDataPermissionRule.CONTEXT_KEY, DeptDataPermissionRespDTO.class));
- }
- }
-
- @Test // 拼接 Dept 和 User 的条件(字段都不符合)
- public void testGetExpression_noDeptColumn_noSelfColumn() {
- try (MockedStatic securityFrameworkUtilsMock
- = mockStatic(SecurityFrameworkUtils.class)) {
- // 准备参数
- String tableName = "t_user";
- Alias tableAlias = new Alias("u");
- // mock 方法(LoginUser)
- LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setId(1L)
- .setUserType(UserTypeEnum.ADMIN.getValue()));
- securityFrameworkUtilsMock.when(SecurityFrameworkUtils::getLoginUser).thenReturn(loginUser);
- // mock 方法(DeptDataPermissionRespDTO)
- DeptDataPermissionRespDTO deptDataPermission = new DeptDataPermissionRespDTO()
- .setDeptIds(SetUtils.asSet(10L, 20L)).setSelf(true);
- when(permissionApi.getDeptDataPermission(same(1L))).thenReturn(deptDataPermission);
-
- // 调用
- Expression expression = rule.getExpression(tableName, tableAlias);
- // 断言
- assertSame(EXPRESSION_NULL, expression);
- assertSame(deptDataPermission, loginUser.getContext(DeptDataPermissionRule.CONTEXT_KEY, DeptDataPermissionRespDTO.class));
- }
- }
-
- @Test // 拼接 Dept 和 User 的条件(self 符合)
- public void testGetExpression_noDeptColumn_yesSelfColumn() {
- try (MockedStatic securityFrameworkUtilsMock
- = mockStatic(SecurityFrameworkUtils.class)) {
- // 准备参数
- String tableName = "t_user";
- Alias tableAlias = new Alias("u");
- // mock 方法(LoginUser)
- LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setId(1L)
- .setUserType(UserTypeEnum.ADMIN.getValue()));
- securityFrameworkUtilsMock.when(SecurityFrameworkUtils::getLoginUser).thenReturn(loginUser);
- // mock 方法(DeptDataPermissionRespDTO)
- DeptDataPermissionRespDTO deptDataPermission = new DeptDataPermissionRespDTO()
- .setSelf(true);
- when(permissionApi.getDeptDataPermission(same(1L))).thenReturn(deptDataPermission);
- // 添加 user 字段配置
- rule.addUserColumn("t_user", "id");
-
- // 调用
- Expression expression = rule.getExpression(tableName, tableAlias);
- // 断言
- assertEquals("u.id = 1", expression.toString());
- assertSame(deptDataPermission, loginUser.getContext(DeptDataPermissionRule.CONTEXT_KEY, DeptDataPermissionRespDTO.class));
- }
- }
-
- @Test // 拼接 Dept 和 User 的条件(dept 符合)
- public void testGetExpression_yesDeptColumn_noSelfColumn() {
- try (MockedStatic securityFrameworkUtilsMock
- = mockStatic(SecurityFrameworkUtils.class)) {
- // 准备参数
- String tableName = "t_user";
- Alias tableAlias = new Alias("u");
- // mock 方法(LoginUser)
- LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setId(1L)
- .setUserType(UserTypeEnum.ADMIN.getValue()));
- securityFrameworkUtilsMock.when(SecurityFrameworkUtils::getLoginUser).thenReturn(loginUser);
- // mock 方法(DeptDataPermissionRespDTO)
- DeptDataPermissionRespDTO deptDataPermission = new DeptDataPermissionRespDTO()
- .setDeptIds(CollUtil.newLinkedHashSet(10L, 20L));
- when(permissionApi.getDeptDataPermission(same(1L))).thenReturn(deptDataPermission);
- // 添加 dept 字段配置
- rule.addDeptColumn("t_user", "dept_id");
-
- // 调用
- Expression expression = rule.getExpression(tableName, tableAlias);
- // 断言
- assertEquals("u.dept_id IN (10, 20)", expression.toString());
- assertSame(deptDataPermission, loginUser.getContext(DeptDataPermissionRule.CONTEXT_KEY, DeptDataPermissionRespDTO.class));
- }
- }
-
- @Test // 拼接 Dept 和 User 的条件(dept + self 符合)
- public void testGetExpression_yesDeptColumn_yesSelfColumn() {
- try (MockedStatic securityFrameworkUtilsMock
- = mockStatic(SecurityFrameworkUtils.class)) {
- // 准备参数
- String tableName = "t_user";
- Alias tableAlias = new Alias("u");
- // mock 方法(LoginUser)
- LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setId(1L)
- .setUserType(UserTypeEnum.ADMIN.getValue()));
- securityFrameworkUtilsMock.when(SecurityFrameworkUtils::getLoginUser).thenReturn(loginUser);
- // mock 方法(DeptDataPermissionRespDTO)
- DeptDataPermissionRespDTO deptDataPermission = new DeptDataPermissionRespDTO()
- .setDeptIds(CollUtil.newLinkedHashSet(10L, 20L)).setSelf(true);
- when(permissionApi.getDeptDataPermission(same(1L))).thenReturn(deptDataPermission);
- // 添加 user 字段配置
- rule.addUserColumn("t_user", "id");
- // 添加 dept 字段配置
- rule.addDeptColumn("t_user", "dept_id");
-
- // 调用
- Expression expression = rule.getExpression(tableName, tableAlias);
- // 断言
- assertEquals("(u.dept_id IN (10, 20) OR u.id = 1)", expression.toString());
- assertSame(deptDataPermission, loginUser.getContext(DeptDataPermissionRule.CONTEXT_KEY, DeptDataPermissionRespDTO.class));
- }
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DataPermissionUtilsTest.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DataPermissionUtilsTest.java
deleted file mode 100644
index 1cc57c2586e100cb9dc672ae2d2ff262f6aea619..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DataPermissionUtilsTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package cn.iocoder.yudao.framework.datapermission.core.util;
-
-import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-public class DataPermissionUtilsTest {
-
- @Test
- public void testExecuteIgnore() {
- DataPermissionUtils.executeIgnore(() -> assertFalse(DataPermissionContextHolder.get().enable()));
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-ip/pom.xml b/yudao-framework/yudao-spring-boot-starter-biz-ip/pom.xml
index bc800c85d0d2c2ff9f14334c4323e2c4db49af9b..46026d4bc5eaac25e301f3c2349e32f0c51a210f 100644
--- a/yudao-framework/yudao-spring-boot-starter-biz-ip/pom.xml
+++ b/yudao-framework/yudao-spring-boot-starter-biz-ip/pom.xml
@@ -43,12 +43,6 @@
provided
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-test
- test
-
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-ip/src/test/java/cn/iocoder/yudao/framework/ip/core/utils/AreaUtilsTest.java b/yudao-framework/yudao-spring-boot-starter-biz-ip/src/test/java/cn/iocoder/yudao/framework/ip/core/utils/AreaUtilsTest.java
deleted file mode 100644
index 8f5646b337ad98bf646454862a61f7022b44e61e..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-ip/src/test/java/cn/iocoder/yudao/framework/ip/core/utils/AreaUtilsTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package cn.iocoder.yudao.framework.ip.core.utils;
-
-
-import cn.iocoder.yudao.framework.ip.core.Area;
-import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/**
- * {@link AreaUtils} 的单元测试
- *
- * @author 芋道源码
- */
-public class AreaUtilsTest {
-
- @Test
- public void testGetArea() {
- // 调用:北京
- Area area = AreaUtils.getArea(110100);
- // 断言
- assertEquals(area.getId(), 110100);
- assertEquals(area.getName(), "北京市");
- assertEquals(area.getType(), AreaTypeEnum.CITY.getType());
- assertEquals(area.getParent().getId(), 110000);
- assertEquals(area.getChildren().size(), 16);
- }
-
- @Test
- public void testFormat() {
- assertEquals(AreaUtils.format(110105), "北京 北京市 朝阳区");
- assertEquals(AreaUtils.format(1), "中国");
- assertEquals(AreaUtils.format(2), "蒙古");
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-ip/src/test/java/cn/iocoder/yudao/framework/ip/core/utils/IPUtilsTest.java b/yudao-framework/yudao-spring-boot-starter-biz-ip/src/test/java/cn/iocoder/yudao/framework/ip/core/utils/IPUtilsTest.java
deleted file mode 100644
index 761a1aa63feadccb042cfedd6713bee096cf0b6c..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-ip/src/test/java/cn/iocoder/yudao/framework/ip/core/utils/IPUtilsTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package cn.iocoder.yudao.framework.ip.core.utils;
-
-import cn.iocoder.yudao.framework.ip.core.Area;
-import org.junit.jupiter.api.Test;
-import org.lionsoul.ip2region.xdb.Searcher;
-
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/**
- * {@link IPUtils} 的单元测试
- *
- * @author wanglhup
- */
-public class IPUtilsTest {
-
- @Test
- public void testGetAreaId_string() {
- // 120.202.4.0|120.202.4.255|420600
- Integer areaId = IPUtils.getAreaId("120.202.4.50");
- assertEquals(420600, areaId);
- }
-
- @Test
- public void testGetAreaId_long() throws Exception {
- // 120.203.123.0|120.203.133.255|360900
- long ip = Searcher.checkIP("120.203.123.250");
- Integer areaId = IPUtils.getAreaId(ip);
- assertEquals(360900, areaId);
- }
-
- @Test
- public void testGetArea_string() {
- // 120.202.4.0|120.202.4.255|420600
- Area area = IPUtils.getArea("120.202.4.50");
- assertEquals("襄阳市", area.getName());
- }
-
- @Test
- public void testGetArea_long() throws Exception {
- // 120.203.123.0|120.203.133.255|360900
- long ip = Searcher.checkIP("120.203.123.252");
- Area area = IPUtils.getArea(ip);
- assertEquals("宜春市", area.getName());
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/pom.xml b/yudao-framework/yudao-spring-boot-starter-biz-tenant/pom.xml
index c1a537613ed3adfc8d3ab7c6420d1084e5e170cb..b831767fc6ca913f754aa331743bcacd369d35d3 100644
--- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/pom.xml
+++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/pom.xml
@@ -66,13 +66,6 @@
true
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-test
- test
-
-
com.google.guava
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/security/TenantSecurityWebFilter.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/security/TenantSecurityWebFilter.java
index c6d4d5e1b701de4b7efe93562a89699bde91fdc1..41ffef03b4768428936926bb0bcab559256b0e69 100644
--- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/security/TenantSecurityWebFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/security/TenantSecurityWebFilter.java
@@ -15,10 +15,10 @@ import cn.iocoder.yudao.framework.web.core.handler.GlobalExceptionHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.AntPathMatcher;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Objects;
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/web/TenantContextWebFilter.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/web/TenantContextWebFilter.java
index 41b7b4d7104a8a4977f4d53ffeb03f810ffb59b0..8e37727d9d2ca54c82c9e6f51dd39b7e340ab768 100644
--- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/web/TenantContextWebFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/web/TenantContextWebFilter.java
@@ -4,10 +4,10 @@ import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import org.springframework.web.filter.OncePerRequestFilter;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java
index de330fdc058e52e88bda7d998302b081d6622355..059d8f97febb8b270ea3d487622dcd073f17effc 100644
--- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java
+++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +16,6 @@
package org.springframework.messaging.handler.invocation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
import org.springframework.core.DefaultParameterNameDiscoverer;
@@ -32,6 +27,11 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.handler.HandlerMethod;
import org.springframework.util.ObjectUtils;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID;
/**
@@ -50,12 +50,10 @@ public class InvocableHandlerMethod extends HandlerMethod {
private static final Object[] EMPTY_ARGS = new Object[0];
-
private HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite();
private ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
-
/**
* Create an instance from a {@code HandlerMethod}.
*/
@@ -83,7 +81,6 @@ public class InvocableHandlerMethod extends HandlerMethod {
super(bean, methodName, parameterTypes);
}
-
/**
* Set {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers} to use for resolving method argument values.
*/
@@ -94,13 +91,12 @@ public class InvocableHandlerMethod extends HandlerMethod {
/**
* Set the ParameterNameDiscoverer for resolving parameter names when needed
* (e.g. default request attribute name).
- * Default is a {@link org.springframework.core.DefaultParameterNameDiscoverer}.
+ *
Default is a {@link DefaultParameterNameDiscoverer}.
*/
public void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer) {
this.parameterNameDiscoverer = parameterNameDiscoverer;
}
-
/**
* Invoke the method after resolving its argument values in the context of the given message.
*
Argument values are commonly resolved through
@@ -204,21 +200,20 @@ public class InvocableHandlerMethod extends HandlerMethod {
}
catch (IllegalArgumentException ex) {
assertTargetBean(getBridgedMethod(), getBean(), args);
- String text = (ex.getMessage() == null || ex.getCause() instanceof NullPointerException) ?
- "Illegal argument": ex.getMessage();
+ String text = (ex.getMessage() != null ? ex.getMessage() : "Illegal argument");
throw new IllegalStateException(formatInvokeError(text, args), ex);
}
catch (InvocationTargetException ex) {
// Unwrap for HandlerExceptionResolvers ...
Throwable targetException = ex.getTargetException();
- if (targetException instanceof RuntimeException runtimeException) {
- throw runtimeException;
+ if (targetException instanceof RuntimeException) {
+ throw (RuntimeException) targetException;
}
- else if (targetException instanceof Error error) {
- throw error;
+ else if (targetException instanceof Error) {
+ throw (Error) targetException;
}
- else if (targetException instanceof Exception exception) {
- throw exception;
+ else if (targetException instanceof Exception) {
+ throw (Exception) targetException;
}
else {
throw new IllegalStateException(formatInvokeError("Invocation failure", args), targetException);
@@ -230,8 +225,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
return new AsyncResultMethodParameter(returnValue);
}
-
- private class AsyncResultMethodParameter extends AnnotatedMethodParameter {
+ private class AsyncResultMethodParameter extends HandlerMethodParameter {
@Nullable
private final Object returnValue;
diff --git a/yudao-framework/yudao-spring-boot-starter-excel/pom.xml b/yudao-framework/yudao-spring-boot-starter-excel/pom.xml
index 3da22b0527dd84a6fa966f69326f1a8ff9a09545..8d778c7d4ae189aeb94232666c9189f815fee779 100644
--- a/yudao-framework/yudao-spring-boot-starter-excel/pom.xml
+++ b/yudao-framework/yudao-spring-boot-starter-excel/pom.xml
@@ -63,13 +63,6 @@
yudao-spring-boot-starter-biz-ip
true
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-test
- test
-
diff --git a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java
index f5c4b831394e115015c615e8dfdf8be1d5766d35..0bc59947faf4e8e799e7cd619123d0c4a217239b 100644
--- a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java
+++ b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java
@@ -4,9 +4,9 @@ import cn.iocoder.yudao.framework.excel.core.handler.SelectSheetWriteHandler;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
-import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
diff --git a/yudao-framework/yudao-spring-boot-starter-excel/src/test/java/cn/iocoder/yudao/framework/dict/core/util/DictFrameworkUtilsTest.java b/yudao-framework/yudao-spring-boot-starter-excel/src/test/java/cn/iocoder/yudao/framework/dict/core/util/DictFrameworkUtilsTest.java
deleted file mode 100644
index 54e8f8edb7ac5810c38e8a83d70565cff106ee42..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-excel/src/test/java/cn/iocoder/yudao/framework/dict/core/util/DictFrameworkUtilsTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package cn.iocoder.yudao.framework.dict.core.util;
-
-import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
-import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils;
-import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
-import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
-import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mock;
-
-import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.when;
-
-/**
- * {@link DictFrameworkUtils} 的单元测试
- */
-public class DictFrameworkUtilsTest extends BaseMockitoUnitTest {
-
- @Mock
- private DictDataApi dictDataApi;
-
- @BeforeEach
- public void setUp() {
- DictFrameworkUtils.init(dictDataApi);
- }
-
- @Test
- public void testGetDictDataLabel() {
- // mock 数据
- DictDataRespDTO dataRespDTO = randomPojo(DictDataRespDTO.class, o -> o.setStatus(CommonStatusEnum.ENABLE.getStatus()));
- // mock 方法
- when(dictDataApi.getDictData(dataRespDTO.getDictType(), dataRespDTO.getValue())).thenReturn(dataRespDTO);
-
- // 断言返回值
- assertEquals(dataRespDTO.getLabel(), DictFrameworkUtils.getDictDataLabel(dataRespDTO.getDictType(), dataRespDTO.getValue()));
- }
-
- @Test
- public void testParseDictDataValue() {
- // mock 数据
- DictDataRespDTO resp = randomPojo(DictDataRespDTO.class, o -> o.setStatus(CommonStatusEnum.ENABLE.getStatus()));
- // mock 方法
- when(dictDataApi.parseDictData(resp.getDictType(), resp.getLabel())).thenReturn(resp);
-
- // 断言返回值
- assertEquals(resp.getValue(), DictFrameworkUtils.parseDictDataValue(resp.getDictType(), resp.getLabel()));
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java
index d9b299056c0898fc647a6551b77c85b980b298b5..736126fec6486edca768396c7a45bfb7dddbcef3 100644
--- a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java
+++ b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java
@@ -13,8 +13,9 @@ import org.quartz.PersistJobDataAfterExecution;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.quartz.QuartzJobBean;
-import jakarta.annotation.Resource;
+import javax.annotation.Resource;
import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
import static cn.hutool.core.exceptions.ExceptionUtil.getRootCauseMessage;
diff --git a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java
index cd99cadba9c45ee816485d3844b3eb20d3243106..418dbfcd62bc567cc42b4b012fa35e74a39a4c5c 100644
--- a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java
+++ b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java
@@ -1,7 +1,7 @@
package cn.iocoder.yudao.framework.quartz.core.service;
-import jakarta.validation.constraints.NotEmpty;
-import jakarta.validation.constraints.NotNull;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/core/filter/TraceFilter.java b/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/core/filter/TraceFilter.java
index e8d7ca1b159a0db37cb490b962ad375bce124d93..91ac30fd598d1fcd71abe9bd72f1d04599c115d7 100644
--- a/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/core/filter/TraceFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/core/filter/TraceFilter.java
@@ -3,10 +3,10 @@ package cn.iocoder.yudao.framework.tracer.core.filter;
import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
import org.springframework.web.filter.OncePerRequestFilter;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/pom.xml b/yudao-framework/yudao-spring-boot-starter-mybatis/pom.xml
index fc7248a2f4fd5f80b3c8c782233367d74f7398da..acc2dc507b790f07c4b9226e7f319b366ff8f6c5 100644
--- a/yudao-framework/yudao-spring-boot-starter-mybatis/pom.xml
+++ b/yudao-framework/yudao-spring-boot-starter-mybatis/pom.xml
@@ -56,21 +56,15 @@
com.alibaba
- druid-spring-boot-3-starter
+ druid-spring-boot-starter
com.baomidou
- mybatis-plus-spring-boot3-starter
+ mybatis-plus-boot-starter
com.baomidou
- dynamic-datasource-spring-boot3-starter
-
-
- org.springframework.boot
- spring-boot-starter-undertow
-
-
+ dynamic-datasource-spring-boot-starter
diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/config/YudaoDataSourceAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/config/YudaoDataSourceAutoConfiguration.java
index 879a19aae373eaa791209aaa5899f6f3a3991ae5..7032b48376d01cec7494cc38e9cf3119b8644937 100644
--- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/config/YudaoDataSourceAutoConfiguration.java
+++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/config/YudaoDataSourceAutoConfiguration.java
@@ -1,7 +1,7 @@
package cn.iocoder.yudao.framework.datasource.config;
import cn.iocoder.yudao.framework.datasource.core.filter.DruidAdRemoveFilter;
-import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties;
+import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/core/filter/DruidAdRemoveFilter.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/core/filter/DruidAdRemoveFilter.java
index 18a86a8f48a2ae9b0bf583f482cd089d4c8c487f..78e8a3e64a1fa05c9fdc50e28c0792bb347c2d6d 100644
--- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/core/filter/DruidAdRemoveFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/core/filter/DruidAdRemoveFilter.java
@@ -3,10 +3,10 @@ package cn.iocoder.yudao.framework.datasource.core.filter;
import com.alibaba.druid.util.Utils;
import org.springframework.web.filter.OncePerRequestFilter;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/idempotent/core/keyresolver/impl/ExpressionIdempotentKeyResolver.java b/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/idempotent/core/keyresolver/impl/ExpressionIdempotentKeyResolver.java
index 665d327e900478da58180242f62bc0a76fa253e8..50b4a2c1948b90fe655d6a0849f361942537a417 100644
--- a/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/idempotent/core/keyresolver/impl/ExpressionIdempotentKeyResolver.java
+++ b/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/idempotent/core/keyresolver/impl/ExpressionIdempotentKeyResolver.java
@@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.idempotent.core.keyresolver.IdempotentKeyResolver;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
-import org.springframework.core.DefaultParameterNameDiscoverer;
+import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
@@ -21,8 +21,7 @@ import java.lang.reflect.Method;
*/
public class ExpressionIdempotentKeyResolver implements IdempotentKeyResolver {
- private final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
-
+ private final ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
private final ExpressionParser expressionParser = new SpelExpressionParser();
@Override
diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoRedisAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoRedisAutoConfiguration.java
index 01eeb049d5cf3f1c9305cab4c1c0b9bfeb777799..ff02c933718c648d692e0a17f6a3d802268847be 100644
--- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoRedisAutoConfiguration.java
+++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoRedisAutoConfiguration.java
@@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.redis.config;
import cn.hutool.core.util.ReflectUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import org.redisson.spring.starter.RedissonAutoConfigurationV2;
+import org.redisson.spring.starter.RedissonAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
@@ -13,7 +13,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
/**
* Redis 配置类
*/
-@AutoConfiguration(before = RedissonAutoConfigurationV2.class) // 目的:使用自己定义的 RedisTemplate Bean
+@AutoConfiguration(before = RedissonAutoConfiguration.class) // 目的:使用自己定义的 RedisTemplate Bean
public class YudaoRedisAutoConfiguration {
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/LogRecordServiceImpl.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/LogRecordServiceImpl.java
index d6aeb3bf0e6ef5b0c045930e40b3602040b5efaa..765857eed0cad8913c8dae6cbf5315688c7d73ff 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/LogRecordServiceImpl.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/LogRecordServiceImpl.java
@@ -8,10 +8,10 @@ import cn.iocoder.yudao.module.system.api.logger.OperateLogApi;
import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
import com.mzt.logapi.beans.LogRecord;
import com.mzt.logapi.service.ILogRecordService;
-import jakarta.annotation.Resource;
-import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/AuthorizeRequestsCustomizer.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/AuthorizeRequestsCustomizer.java
index 1b6bf68aae01cf380eaf1191bcfdbd65f065ebe1..5c862907612868607b67cb25667259f5780adb9b 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/AuthorizeRequestsCustomizer.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/AuthorizeRequestsCustomizer.java
@@ -1,11 +1,12 @@
package cn.iocoder.yudao.framework.security.config;
import cn.iocoder.yudao.framework.web.config.WebProperties;
-import jakarta.annotation.Resource;
import org.springframework.core.Ordered;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
+import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
+
+import javax.annotation.Resource;
/**
* 自定义的 URL 的安全配置
@@ -14,7 +15,7 @@ import org.springframework.security.config.annotation.web.configurers.AuthorizeH
* @author 芋道源码
*/
public abstract class AuthorizeRequestsCustomizer
- implements Customizer.AuthorizationManagerRequestMatcherRegistry>, Ordered {
+ implements Customizer.ExpressionInterceptUrlRegistry>, Ordered {
@Resource
private WebProperties webProperties;
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java
index 936e447f1470a2ee20136beba96227eb3c9da10b..3d19f32a65c2b4b8505fe6265c56cc94c7456992 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java
@@ -4,8 +4,8 @@ import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
-import jakarta.validation.constraints.NotEmpty;
-import jakarta.validation.constraints.NotNull;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.List;
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.java
index f23aeed542fd976b405d125317b5d00213808b2d..432b2acea8c4597803b67a52463b245371e47c19 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.java
@@ -10,7 +10,6 @@ import cn.iocoder.yudao.framework.security.core.service.SecurityFrameworkService
import cn.iocoder.yudao.framework.web.core.handler.GlobalExceptionHandler;
import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
-import jakarta.annotation.Resource;
import org.springframework.beans.factory.config.MethodInvokingFactoryBean;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
@@ -22,6 +21,8 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.access.AccessDeniedHandler;
+import javax.annotation.Resource;
+
/**
* Spring Security 自动配置类,主要用于相关组件的配置
*
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
index a914b1d7529ff19a72f10f3018e3a7b2c86f3d48..bb375708420ed7d6928c2a0f0f5350ac6bb9fd13 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
@@ -5,20 +5,15 @@ import cn.iocoder.yudao.framework.security.core.filter.TokenAuthenticationFilter
import cn.iocoder.yudao.framework.web.config.WebProperties;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
-import jakarta.annotation.Resource;
-import jakarta.annotation.security.PermitAll;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
-import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
-import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.SecurityFilterChain;
@@ -29,6 +24,8 @@ import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
+import javax.annotation.Resource;
+import javax.annotation.security.PermitAll;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -40,7 +37,7 @@ import java.util.Set;
*/
@AutoConfiguration
@AutoConfigureOrder(-1) // 目的:先于 Spring Security 自动配置,避免一键改包后,org.* 基础包无法生效
-@EnableMethodSecurity(securedEnabled = true)
+@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class YudaoWebSecurityConfigurerAdapter {
@Resource
@@ -106,15 +103,15 @@ public class YudaoWebSecurityConfigurerAdapter {
// 登出
httpSecurity
// 开启跨域
- .cors(Customizer.withDefaults())
+ .cors().and()
// CSRF 禁用,因为不使用 Session
- .csrf(AbstractHttpConfigurer::disable)
+ .csrf().disable()
// 基于 token 机制,所以不需要 Session
- .sessionManagement(c -> c.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
- .headers(c -> c.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable))
+ .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
+ .headers().frameOptions().disable().and()
// 一堆自定义的 Spring Security 处理器
- .exceptionHandling(c -> c.authenticationEntryPoint(authenticationEntryPoint)
- .accessDeniedHandler(accessDeniedHandler));
+ .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint)
+ .accessDeniedHandler(accessDeniedHandler);
// 登录、登录暂时不使用 Spring Security 的拓展点,主要考虑一方面拓展多用户、多种登录方式相对复杂,一方面用户的学习成本较高
// 获得 @PermitAll 带来的 URL 列表,免登录
@@ -122,25 +119,27 @@ public class YudaoWebSecurityConfigurerAdapter {
// 设置每个请求的权限
httpSecurity
// ①:全局共享规则
- .authorizeHttpRequests(c -> c
- // 1.1 静态资源,可匿名访问
- .requestMatchers(HttpMethod.GET, "/*.html", "/*.html", "/*.css", "/*.js").permitAll()
- // 1.1 设置 @PermitAll 无需认证
- .requestMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll()
- .requestMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll()
- .requestMatchers(HttpMethod.PUT, permitAllUrls.get(HttpMethod.PUT).toArray(new String[0])).permitAll()
- .requestMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
- .requestMatchers(HttpMethod.HEAD, permitAllUrls.get(HttpMethod.HEAD).toArray(new String[0])).permitAll()
- .requestMatchers(HttpMethod.PATCH, permitAllUrls.get(HttpMethod.PATCH).toArray(new String[0])).permitAll()
- // 1.2 基于 yudao.security.permit-all-urls 无需认证
- .requestMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
- // 1.3 设置 App API 无需认证
- .requestMatchers(buildAppApi("/**")).permitAll()
- )
+ .authorizeRequests()
+ // 1.1 静态资源,可匿名访问
+ .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
+ // 1.2 设置 @PermitAll 无需认证
+ .antMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll()
+ .antMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll()
+ .antMatchers(HttpMethod.PUT, permitAllUrls.get(HttpMethod.PUT).toArray(new String[0])).permitAll()
+ .antMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
+ // 1.3 基于 yudao.security.permit-all-urls 无需认证
+ .antMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
+ // 1.4 设置 App API 无需认证
+ .antMatchers(buildAppApi("/**")).permitAll()
+ // 1.5 验证码captcha 允许匿名访问
+ .antMatchers("/captcha/get", "/captcha/check").permitAll()
// ②:每个项目的自定义规则
- .authorizeHttpRequests(c -> authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(c)))
+ .and().authorizeRequests(registry -> // 下面,循环设置自定义规则
+ authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(registry)))
// ③:兜底规则,必须认证
- .authorizeHttpRequests(c -> c.anyRequest().authenticated());
+ .authorizeRequests()
+ .anyRequest().authenticated()
+ ;
// 添加 Token Filter
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
@@ -174,8 +173,6 @@ public class YudaoWebSecurityConfigurerAdapter {
result.putAll(HttpMethod.POST, urls);
result.putAll(HttpMethod.PUT, urls);
result.putAll(HttpMethod.DELETE, urls);
- result.putAll(HttpMethod.HEAD, urls);
- result.putAll(HttpMethod.PATCH, urls);
continue;
}
// 根据请求方法,添加到 result 结果
@@ -193,12 +190,6 @@ public class YudaoWebSecurityConfigurerAdapter {
case DELETE:
result.putAll(HttpMethod.DELETE, urls);
break;
- case HEAD:
- result.putAll(HttpMethod.HEAD, urls);
- break;
- case PATCH:
- result.putAll(HttpMethod.PATCH, urls);
- break;
}
});
}
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java
index bc7ff8a9a4679ac686460a71b089946ec4a0f552..086ccd94622d92edac818026dcdfed2c9a961fc4 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java
@@ -16,10 +16,10 @@ import lombok.RequiredArgsConstructor;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.filter.OncePerRequestFilter;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AccessDeniedHandlerImpl.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AccessDeniedHandlerImpl.java
index 0ec5262bcaae765232bfa07df0b690beb727866a..33f3f14f4e02f285245ac967e88537aeaeef4077 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AccessDeniedHandlerImpl.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AccessDeniedHandlerImpl.java
@@ -8,14 +8,16 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.security.web.access.ExceptionTranslationFilter;
+import org.springframework.stereotype.Component;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.FORBIDDEN;
+import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED;
/**
* 访问一个需要认证的 URL 资源,已经认证(登录)但是没有权限的情况下,返回 {@link GlobalErrorCodeConstants#FORBIDDEN} 错误码。
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AuthenticationEntryPointImpl.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AuthenticationEntryPointImpl.java
index 9d9caa6aae9ee353babc10ea826d750b4c9f09f3..0a451e0762757208558a75627484f735302197b3 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AuthenticationEntryPointImpl.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AuthenticationEntryPointImpl.java
@@ -8,9 +8,9 @@ import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.access.ExceptionTranslationFilter;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED;
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
index 14c089a1cb4ea1bd66d632f2d33dfefa1dda326e..f85d77c361d3943744f9fd520bba0c21ef4669f1 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
@@ -12,7 +12,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.util.StringUtils;
-import jakarta.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-test/pom.xml b/yudao-framework/yudao-spring-boot-starter-test/pom.xml
deleted file mode 100644
index 04576fee6c2225e0cb1b0d73fa9a172a93c661c0..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
- cn.iocoder.boot
- yudao-framework
- ${revision}
-
- 4.0.0
- yudao-spring-boot-starter-test
- jar
-
- ${project.artifactId}
- 测试组件,用于单元测试、集成测试
- https://github.com/YunaiV/ruoyi-vue-pro
-
-
-
- cn.iocoder.boot
- yudao-common
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-mybatis
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-redis
-
-
-
-
- org.mockito
- mockito-inline
-
-
- org.springframework.boot
- spring-boot-starter-test
-
-
-
- com.h2database
- h2
-
-
-
- com.github.fppt
- jedis-mock
-
-
-
- uk.co.jemos.podam
- podam
-
-
-
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/config/RedisTestConfiguration.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/config/RedisTestConfiguration.java
deleted file mode 100644
index 46222911e95cea49a62d60cd6ed416fa55679517..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/config/RedisTestConfiguration.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package cn.iocoder.yudao.framework.test.config;
-
-import com.github.fppt.jedismock.RedisServer;
-import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-
-import java.io.IOException;
-
-/**
- * Redis 测试 Configuration,主要实现内嵌 Redis 的启动
- *
- * @author 芋道源码
- */
-@Configuration(proxyBeanMethods = false)
-@Lazy(false) // 禁止延迟加载
-@EnableConfigurationProperties(RedisProperties.class)
-public class RedisTestConfiguration {
-
- /**
- * 创建模拟的 Redis Server 服务器
- */
- @Bean
- public RedisServer redisServer(RedisProperties properties) throws IOException {
- RedisServer redisServer = new RedisServer(properties.getPort());
- // 一次执行多个单元测试时,貌似创建多个 spring 容器,导致不进行 stop。这样,就导致端口被占用,无法启动。。。
- try {
- redisServer.start();
- } catch (Exception ignore) {}
- return redisServer;
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/config/SqlInitializationTestConfiguration.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/config/SqlInitializationTestConfiguration.java
deleted file mode 100644
index abaec9d84f64ca7b9b2dbaffa624cf493d358e8a..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/config/SqlInitializationTestConfiguration.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package cn.iocoder.yudao.framework.test.config;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
-import org.springframework.boot.autoconfigure.sql.init.SqlInitializationProperties;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer;
-import org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer;
-import org.springframework.boot.sql.init.DatabaseInitializationSettings;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-
-import javax.sql.DataSource;
-
-/**
- * SQL 初始化的测试 Configuration
- *
- * 为什么不使用 org.springframework.boot.autoconfigure.sql.init.DataSourceInitializationConfiguration 呢?
- * 因为我们在单元测试会使用 spring.main.lazy-initialization 为 true,开启延迟加载。此时,会导致 DataSourceInitializationConfiguration 初始化
- * 不过呢,当前类的实现代码,基本是复制 DataSourceInitializationConfiguration 的哈!
- *
- * @author 芋道源码
- */
-@Configuration(proxyBeanMethods = false)
-@ConditionalOnMissingBean(AbstractScriptDatabaseInitializer.class)
-@ConditionalOnSingleCandidate(DataSource.class)
-@ConditionalOnClass(name = "org.springframework.jdbc.datasource.init.DatabasePopulator")
-@Lazy(value = false) // 禁止延迟加载
-@EnableConfigurationProperties(SqlInitializationProperties.class)
-public class SqlInitializationTestConfiguration {
-
- @Bean
- public DataSourceScriptDatabaseInitializer dataSourceScriptDatabaseInitializer(DataSource dataSource,
- SqlInitializationProperties initializationProperties) {
- DatabaseInitializationSettings settings = createFrom(initializationProperties);
- return new DataSourceScriptDatabaseInitializer(dataSource, settings);
- }
-
- static DatabaseInitializationSettings createFrom(SqlInitializationProperties properties) {
- DatabaseInitializationSettings settings = new DatabaseInitializationSettings();
- settings.setSchemaLocations(properties.getSchemaLocations());
- settings.setDataLocations(properties.getDataLocations());
- settings.setContinueOnError(properties.isContinueOnError());
- settings.setSeparator(properties.getSeparator());
- settings.setEncoding(properties.getEncoding());
- settings.setMode(properties.getMode());
- return settings;
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbAndRedisUnitTest.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbAndRedisUnitTest.java
deleted file mode 100644
index d30cf6b3e750310d0e82c71952c0717bcabeb660..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbAndRedisUnitTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package cn.iocoder.yudao.framework.test.core.ut;
-
-import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
-import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
-import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
-import cn.iocoder.yudao.framework.test.config.RedisTestConfiguration;
-import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration;
-import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
-import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
-import org.redisson.spring.starter.RedissonAutoConfiguration;
-import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.Import;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-
-/**
- * 依赖内存 DB + Redis 的单元测试
- *
- * 相比 {@link BaseDbUnitTest} 来说,额外增加了内存 Redis
- *
- * @author 芋道源码
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbAndRedisUnitTest.Application.class)
-@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件
-@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB
-public class BaseDbAndRedisUnitTest {
-
- @Import({
- // DB 配置类
- YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类
- DataSourceAutoConfiguration.class, // Spring DB 自动配置类
- DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类
- DruidDataSourceAutoConfigure.class, // Druid 自动配置类
- SqlInitializationTestConfiguration.class, // SQL 初始化
- // MyBatis 配置类
- YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
- MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类
-
- // Redis 配置类
- RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
- YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类
- RedisAutoConfiguration.class, // Spring Redis 自动配置类
- RedissonAutoConfiguration.class, // Redisson 自动配置类
- })
- public static class Application {
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbUnitTest.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbUnitTest.java
deleted file mode 100644
index ee43fcb43baad4c2cc81e28bcfa0b2d30071eb48..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbUnitTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package cn.iocoder.yudao.framework.test.core.ut;
-
-import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration;
-import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration;
-import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration;
-import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
-import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
-import com.github.yulichang.autoconfigure.MybatisPlusJoinAutoConfiguration;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.Import;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.jdbc.Sql;
-
-/**
- * 依赖内存 DB 的单元测试
- *
- * 注意,Service 层同样适用。对于 Service 层的单元测试,我们针对自己模块的 Mapper 走的是 H2 内存数据库,针对别的模块的 Service 走的是 Mock 方法
- *
- * @author 芋道源码
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbUnitTest.Application.class)
-@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件
-@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB
-public class BaseDbUnitTest {
-
- @Import({
- // DB 配置类
- YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类
- DataSourceAutoConfiguration.class, // Spring DB 自动配置类
- DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类
- DruidDataSourceAutoConfigure.class, // Druid 自动配置类
- SqlInitializationTestConfiguration.class, // SQL 初始化
- // MyBatis 配置类
- YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类
- MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类
- MybatisPlusJoinAutoConfiguration.class, // MyBatis 的Join配置类
- })
- public static class Application {
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseMockitoUnitTest.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseMockitoUnitTest.java
deleted file mode 100644
index 26048695c5a331556b6816f7ffd7bae953138129..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseMockitoUnitTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package cn.iocoder.yudao.framework.test.core.ut;
-
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-/**
- * 纯 Mockito 的单元测试
- *
- * @author 芋道源码
- */
-@ExtendWith(MockitoExtension.class)
-public class BaseMockitoUnitTest {
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseRedisUnitTest.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseRedisUnitTest.java
deleted file mode 100644
index 7b84003d104fd7f0cc843ea6cdb47bf0b556ad8e..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseRedisUnitTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package cn.iocoder.yudao.framework.test.core.ut;
-
-import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
-import cn.iocoder.yudao.framework.test.config.RedisTestConfiguration;
-import org.redisson.spring.starter.RedissonAutoConfiguration;
-import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.Import;
-import org.springframework.test.context.ActiveProfiles;
-
-/**
- * 依赖内存 Redis 的单元测试
- *
- * 相比 {@link BaseDbUnitTest} 来说,从内存 DB 改成了内存 Redis
- *
- * @author 芋道源码
- */
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseRedisUnitTest.Application.class)
-@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件
-public class BaseRedisUnitTest {
-
- @Import({
- // Redis 配置类
- RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
- RedisAutoConfiguration.class, // Spring Redis 自动配置类
- YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类
- RedissonAutoConfiguration.class, // Redisson 自动配置类
- })
- public static class Application {
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/package-info.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/package-info.java
deleted file mode 100644
index bda7aad2524dc40cdc03233caba81794ae1d7243..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * 提供单元测试 Unit Test 的基类
- */
-package cn.iocoder.yudao.framework.test.core.ut;
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/AssertUtils.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/AssertUtils.java
deleted file mode 100644
index e98f4980fcdf6cded420031a3c351e1f82a0a7bf..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/AssertUtils.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package cn.iocoder.yudao.framework.test.core.util;
-
-import cn.hutool.core.util.ArrayUtil;
-import cn.hutool.core.util.ReflectUtil;
-import cn.iocoder.yudao.framework.common.exception.ErrorCode;
-import cn.iocoder.yudao.framework.common.exception.ServiceException;
-import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.function.Executable;
-
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.Objects;
-
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-/**
- * 单元测试,assert 断言工具类
- *
- * @author 芋道源码
- */
-public class AssertUtils {
-
- /**
- * 比对两个对象的属性是否一致
- *
- * 注意,如果 expected 存在的属性,actual 不存在的时候,会进行忽略
- *
- * @param expected 期望对象
- * @param actual 实际对象
- * @param ignoreFields 忽略的属性数组
- */
- public static void assertPojoEquals(Object expected, Object actual, String... ignoreFields) {
- Field[] expectedFields = ReflectUtil.getFields(expected.getClass());
- Arrays.stream(expectedFields).forEach(expectedField -> {
- // 忽略 jacoco 自动生成的 $jacocoData 属性的情况
- if (expectedField.isSynthetic()) {
- return;
- }
- // 如果是忽略的属性,则不进行比对
- if (ArrayUtil.contains(ignoreFields, expectedField.getName())) {
- return;
- }
- // 忽略不存在的属性
- Field actualField = ReflectUtil.getField(actual.getClass(), expectedField.getName());
- if (actualField == null) {
- return;
- }
- // 比对
- Assertions.assertEquals(
- ReflectUtil.getFieldValue(expected, expectedField),
- ReflectUtil.getFieldValue(actual, actualField),
- String.format("Field(%s) 不匹配", expectedField.getName())
- );
- });
- }
-
- /**
- * 比对两个对象的属性是否一致
- *
- * 注意,如果 expected 存在的属性,actual 不存在的时候,会进行忽略
- *
- * @param expected 期望对象
- * @param actual 实际对象
- * @param ignoreFields 忽略的属性数组
- * @return 是否一致
- */
- public static boolean isPojoEquals(Object expected, Object actual, String... ignoreFields) {
- Field[] expectedFields = ReflectUtil.getFields(expected.getClass());
- return Arrays.stream(expectedFields).allMatch(expectedField -> {
- // 如果是忽略的属性,则不进行比对
- if (ArrayUtil.contains(ignoreFields, expectedField.getName())) {
- return true;
- }
- // 忽略不存在的属性
- Field actualField = ReflectUtil.getField(actual.getClass(), expectedField.getName());
- if (actualField == null) {
- return true;
- }
- return Objects.equals(ReflectUtil.getFieldValue(expected, expectedField),
- ReflectUtil.getFieldValue(actual, actualField));
- });
- }
-
- /**
- * 执行方法,校验抛出的 Service 是否符合条件
- *
- * @param executable 业务异常
- * @param errorCode 错误码对象
- * @param messageParams 消息参数
- */
- public static void assertServiceException(Executable executable, ErrorCode errorCode, Object... messageParams) {
- // 调用方法
- ServiceException serviceException = assertThrows(ServiceException.class, executable);
- // 校验错误码
- Assertions.assertEquals(errorCode.getCode(), serviceException.getCode(), "错误码不匹配");
- String message = ServiceExceptionUtil.doFormat(errorCode.getCode(), errorCode.getMsg(), messageParams);
- Assertions.assertEquals(message, serviceException.getMessage(), "错误提示不匹配");
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java
deleted file mode 100644
index 66d15c5bfaba74907bd8aa48a773c7cacbb14a2e..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package cn.iocoder.yudao.framework.test.core.util;
-
-import cn.hutool.core.date.LocalDateTimeUtil;
-import cn.hutool.core.util.ArrayUtil;
-import cn.hutool.core.util.RandomUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
-import uk.co.jemos.podam.api.PodamFactory;
-import uk.co.jemos.podam.api.PodamFactoryImpl;
-
-import java.lang.reflect.Type;
-import java.time.LocalDateTime;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * 随机工具类
- *
- * @author 芋道源码
- */
-public class RandomUtils {
-
- private static final int RANDOM_STRING_LENGTH = 10;
-
- private static final int TINYINT_MAX = 127;
-
- private static final int RANDOM_DATE_MAX = 30;
-
- private static final int RANDOM_COLLECTION_LENGTH = 5;
-
- private static final PodamFactory PODAM_FACTORY = new PodamFactoryImpl();
-
- static {
- // 字符串
- PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(String.class,
- (dataProviderStrategy, attributeMetadata, map) -> randomString());
- // Integer
- PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(Integer.class, (dataProviderStrategy, attributeMetadata, map) -> {
- // 如果是 status 的字段,返回 0 或 1
- if ("status".equals(attributeMetadata.getAttributeName())) {
- return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus();
- }
- // 如果是 type、status 结尾的字段,返回 tinyint 范围
- if (StrUtil.endWithAnyIgnoreCase(attributeMetadata.getAttributeName(),
- "type", "status", "category", "scope", "result")) {
- return RandomUtil.randomInt(0, TINYINT_MAX + 1);
- }
- return RandomUtil.randomInt();
- });
- // LocalDateTime
- PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(LocalDateTime.class,
- (dataProviderStrategy, attributeMetadata, map) -> randomLocalDateTime());
- // Boolean
- PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(Boolean.class, (dataProviderStrategy, attributeMetadata, map) -> {
- // 如果是 deleted 的字段,返回非删除
- if ("deleted".equals(attributeMetadata.getAttributeName())) {
- return false;
- }
- return RandomUtil.randomBoolean();
- });
- }
-
- public static String randomString() {
- return RandomUtil.randomString(RANDOM_STRING_LENGTH);
- }
-
- public static Long randomLongId() {
- return RandomUtil.randomLong(0, Long.MAX_VALUE);
- }
-
- public static Integer randomInteger() {
- return RandomUtil.randomInt(0, Integer.MAX_VALUE);
- }
-
- public static Date randomDate() {
- return RandomUtil.randomDay(0, RANDOM_DATE_MAX);
- }
-
- public static LocalDateTime randomLocalDateTime() {
- // 设置 Nano 为零的原因,避免 MySQL、H2 存储不到时间戳
- return LocalDateTimeUtil.of(randomDate()).withNano(0);
- }
-
- public static Short randomShort() {
- return (short) RandomUtil.randomInt(0, Short.MAX_VALUE);
- }
-
- public static Set randomSet(Class clazz) {
- return Stream.iterate(0, i -> i).limit(RandomUtil.randomInt(1, RANDOM_COLLECTION_LENGTH))
- .map(i -> randomPojo(clazz)).collect(Collectors.toSet());
- }
-
- public static Integer randomCommonStatus() {
- return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus();
- }
-
- public static String randomEmail() {
- return randomString() + "@qq.com";
- }
-
- public static String randomURL() {
- return "https://www.iocoder.cn/" + randomString();
- }
-
- @SafeVarargs
- public static T randomPojo(Class clazz, Consumer... consumers) {
- T pojo = PODAM_FACTORY.manufacturePojo(clazz);
- // 非空时,回调逻辑。通过它,可以实现 Pojo 的进一步处理
- if (ArrayUtil.isNotEmpty(consumers)) {
- Arrays.stream(consumers).forEach(consumer -> consumer.accept(pojo));
- }
- return pojo;
- }
-
- @SafeVarargs
- public static T randomPojo(Class clazz, Type type, Consumer... consumers) {
- T pojo = PODAM_FACTORY.manufacturePojo(clazz, type);
- // 非空时,回调逻辑。通过它,可以实现 Pojo 的进一步处理
- if (ArrayUtil.isNotEmpty(consumers)) {
- Arrays.stream(consumers).forEach(consumer -> consumer.accept(pojo));
- }
- return pojo;
- }
-
- @SafeVarargs
- public static List randomPojoList(Class clazz, Consumer... consumers) {
- int size = RandomUtil.randomInt(1, RANDOM_COLLECTION_LENGTH);
- return Stream.iterate(0, i -> i).limit(size).map(o -> randomPojo(clazz, consumers))
- .collect(Collectors.toList());
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/package-info.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/package-info.java
deleted file mode 100644
index 3a17f5190037e5621e4dc2e6c575952cbfc8995a..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * 测试组件,用于单元测试、集成测试等等
- */
-package cn.iocoder.yudao.framework.test;
diff --git "a/yudao-framework/yudao-spring-boot-starter-test/\343\200\212\350\212\213\351\201\223 Spring Boot \345\215\225\345\205\203\346\265\213\350\257\225 Test \345\205\245\351\227\250\343\200\213.md" "b/yudao-framework/yudao-spring-boot-starter-test/\343\200\212\350\212\213\351\201\223 Spring Boot \345\215\225\345\205\203\346\265\213\350\257\225 Test \345\205\245\351\227\250\343\200\213.md"
deleted file mode 100644
index c6d0e9a9059953bb981c41feec0621069ee34ec6..0000000000000000000000000000000000000000
--- "a/yudao-framework/yudao-spring-boot-starter-test/\343\200\212\350\212\213\351\201\223 Spring Boot \345\215\225\345\205\203\346\265\213\350\257\225 Test \345\205\245\351\227\250\343\200\213.md"
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/yudao-framework/yudao-spring-boot-starter-web/pom.xml b/yudao-framework/yudao-spring-boot-starter-web/pom.xml
index b5d0aa84d7169c4558c902156db896e0a5615f20..2ec8017d165d63d63d19401638c2965b22849d22 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/pom.xml
+++ b/yudao-framework/yudao-spring-boot-starter-web/pom.xml
@@ -35,11 +35,11 @@
com.github.xiaoymin
- knife4j-openapi3-jakarta-spring-boot-starter
+ knife4j-openapi3-spring-boot-starter
org.springdoc
- springdoc-openapi-starter-webmvc-api
+ springdoc-openapi-ui
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/config/YudaoApiLogAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/config/YudaoApiLogAutoConfiguration.java
index d1f7453b6c9c17f33b984702afc923bb0001335b..2a0d8d8760981790c79a94628110df1f65e16715 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/config/YudaoApiLogAutoConfiguration.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/config/YudaoApiLogAutoConfiguration.java
@@ -11,7 +11,6 @@ import cn.iocoder.yudao.framework.web.config.WebProperties;
import cn.iocoder.yudao.framework.web.config.YudaoWebAutoConfiguration;
import cn.iocoder.yudao.module.infra.api.logger.ApiAccessLogApi;
import cn.iocoder.yudao.module.infra.api.logger.ApiErrorLogApi;
-import jakarta.servlet.Filter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -20,6 +19,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import javax.servlet.Filter;
+
@AutoConfiguration(after = YudaoWebAutoConfiguration.class)
public class YudaoApiLogAutoConfiguration implements WebMvcConfigurer {
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java
index b09268338480955334ae539461826c42be78320b..1474d0876a37b69678dc26f11be865de68a5fa4a 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java
@@ -22,21 +22,21 @@ import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Iterator;
import java.util.Map;
-import static cn.iocoder.yudao.framework.apilog.core.interceptor.ApiAccessLogInterceptor.*;
+import static cn.iocoder.yudao.framework.apilog.core.interceptor.ApiAccessLogInterceptor.ATTRIBUTE_HANDLER_METHOD;
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
/**
@@ -160,7 +160,8 @@ public class ApiAccessLogFilter extends ApiRequestFilter {
// ========== 解析 @ApiAccessLog、@Swagger 注解 ==========
private static OperateTypeEnum parseOperateLogType(HttpServletRequest request) {
- RequestMethod requestMethod = RequestMethod.resolve(request.getMethod());
+ RequestMethod requestMethod = ArrayUtil.firstMatch(method ->
+ StrUtil.equalsAnyIgnoreCase(method.name(), request.getMethod()), RequestMethod.values());
if (requestMethod == null) {
return OperateTypeEnum.OTHER;
}
@@ -235,7 +236,7 @@ public class ApiAccessLogFilter extends ApiRequestFilter {
return;
}
// 情况三:Object,遍历处理
- Iterator> iterator = node.properties().iterator();
+ Iterator> iterator = node.fields();
while (iterator.hasNext()) {
Map.Entry entry = iterator.next();
if (ArrayUtil.contains(sanitizeKeys, entry.getKey())
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java
index 04296ec57af51555ee4b879e7e5f0452e6962dcb..ef6ed5f9b9666cabacb9f15f4d3c2a8999070aad 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/interceptor/ApiAccessLogInterceptor.java
@@ -4,13 +4,13 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.common.util.spring.SpringUtils;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StopWatch;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/SwaggerProperties.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/SwaggerProperties.java
index 5374d3aca2dc224255004fdfd24f5a32529dc877..13a15688104cd01cd41cc5b526024d7647efab07 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/SwaggerProperties.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/SwaggerProperties.java
@@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.swagger.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
-import jakarta.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotEmpty;
/**
* Swagger 配置属性
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
index 295e3238ff8756f518f397dd15dc352c7ab077bd..a131d1f2d87e9eec52b4d9d88cf1b62a79b9597d 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
@@ -10,14 +10,10 @@ import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
+import org.springdoc.core.*;
import org.springdoc.core.customizers.OpenApiBuilderCustomizer;
import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
-import org.springdoc.core.models.GroupedOpenApi;
-import org.springdoc.core.properties.SpringDocConfigProperties;
import org.springdoc.core.providers.JavadocProvider;
-import org.springdoc.core.service.OpenAPIService;
-import org.springdoc.core.service.SecurityService;
-import org.springdoc.core.utils.PropertyResolverUtils;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java
index 8091e9afab7a4ee07c4b1fbd75139df692fb50b9..03f4d70b6b28d2d3e8db8f5cfa302cb84d4e2781 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java
@@ -7,9 +7,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
-import jakarta.validation.Valid;
-import jakarta.validation.constraints.NotEmpty;
-import jakarta.validation.constraints.NotNull;
+import javax.validation.Valid;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
@ConfigurationProperties(prefix = "yudao.web")
@Validated
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java
index 8c784d9f287e6f47c8ce69752f8c8b40889e06d9..d87582147aba93b4ecbff941369bef8731d11bad 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java
@@ -25,8 +25,8 @@ import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-import jakarta.annotation.Resource;
-import jakarta.servlet.Filter;
+import javax.annotation.Resource;
+import javax.servlet.Filter;
@AutoConfiguration
@EnableConfigurationProperties(WebProperties.class)
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/ApiRequestFilter.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/ApiRequestFilter.java
index b702515590d4623a6ba1bac33b6a5c7308d4664c..8e78a3b72738861778073af991fa724e2708e78e 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/ApiRequestFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/ApiRequestFilter.java
@@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.web.config.WebProperties;
import lombok.RequiredArgsConstructor;
import org.springframework.web.filter.OncePerRequestFilter;
-import jakarta.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequest;
/**
* 过滤 /admin-api、/app-api 等 API 请求的过滤器
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyFilter.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyFilter.java
index 9071998f91abdc5e5d298e9ceca27bc19d27a394..7051fc8835abae1f16ebd3976954f254875bf8f8 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyFilter.java
@@ -3,10 +3,10 @@ package cn.iocoder.yudao.framework.web.core.filter;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import org.springframework.web.filter.OncePerRequestFilter;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyWrapper.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyWrapper.java
index 8e80fa591f67cdf5a60b0835eefc3237d0e4d76d..616a340184710780b8fcf6c63f4c49a44d8e1a84 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyWrapper.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyWrapper.java
@@ -2,10 +2,10 @@ package cn.iocoder.yudao.framework.web.core.filter;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
-import jakarta.servlet.ReadListener;
-import jakarta.servlet.ServletInputStream;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.ReadListener;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/DemoFilter.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/DemoFilter.java
index eece3046a056553063ba1ff268f56dfb160a4489..8e37247d26a45f31025968dae640a451f69bfd27 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/DemoFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/DemoFilter.java
@@ -6,9 +6,9 @@ import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import org.springframework.web.filter.OncePerRequestFilter;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.DEMO_DENY;
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
index d86f353bccf0a9f86803ac263a3e1600879ed2e0..a997630bb6f7240b3da6f39214495fb4de44b8bc 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
@@ -12,10 +12,6 @@ import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.validation.ConstraintViolation;
-import jakarta.validation.ConstraintViolationException;
-import jakarta.validation.ValidationException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
@@ -31,6 +27,10 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.servlet.NoHandlerFoundException;
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import javax.validation.ValidationException;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.Set;
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java
index ae18634c292807f1703e5734822160bf2bdcd5a5..b5a52c09a71463a72045a124acf7e85c25f34fdd 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java
@@ -11,8 +11,8 @@ import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import jakarta.servlet.ServletRequest;
-import jakarta.servlet.http.HttpServletRequest;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
/**
* 专属于 web 包的工具类
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssFilter.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssFilter.java
index d33086a4259cfaf4fca271837b8cf93c9b0b9830..5f2ce6e3d374f7cdb47d803843802ba03f8a00cc 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssFilter.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssFilter.java
@@ -6,10 +6,10 @@ import lombok.AllArgsConstructor;
import org.springframework.util.PathMatcher;
import org.springframework.web.filter.OncePerRequestFilter;
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssRequestWrapper.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssRequestWrapper.java
index 427eb9baac5f8379a131c1d2c6f67cd48611f613..1466a97cc1f85c3264a0c6343de63cf1c4901b7b 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssRequestWrapper.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssRequestWrapper.java
@@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.xss.core.filter;
import cn.iocoder.yudao.framework.xss.core.clean.XssCleaner;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
import java.util.LinkedHashMap;
import java.util.Map;
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/json/XssStringJsonDeserializer.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/json/XssStringJsonDeserializer.java
index 047b19d38c89981778e67ff1b75616673b1cde6a..003244378b404f2e1833d426f3e7d04a2a0368cd 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/json/XssStringJsonDeserializer.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/json/XssStringJsonDeserializer.java
@@ -7,11 +7,11 @@ import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StringDeserializer;
-import jakarta.servlet.http.HttpServletRequest;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.PathMatcher;
+import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/test/java/cn/iocoder/yudao/framework/desensitize/core/DesensitizeTest.java b/yudao-framework/yudao-spring-boot-starter-web/src/test/java/cn/iocoder/yudao/framework/desensitize/core/DesensitizeTest.java
deleted file mode 100644
index dd214f0c3e4f0718e1517d204a8d56bf67e6fada..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-web/src/test/java/cn/iocoder/yudao/framework/desensitize/core/DesensitizeTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package cn.iocoder.yudao.framework.desensitize.core;
-
-import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
-import cn.iocoder.yudao.framework.desensitize.core.annotation.Address;
-import cn.iocoder.yudao.framework.desensitize.core.regex.annotation.EmailDesensitize;
-import cn.iocoder.yudao.framework.desensitize.core.regex.annotation.RegexDesensitize;
-import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.*;
-import lombok.Data;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-/**
- * {@link DesensitizeTest} 的单元测试
- */
-@ExtendWith(MockitoExtension.class)
-public class DesensitizeTest {
-
- @Test
- public void test() {
- // 准备参数
- DesensitizeDemo desensitizeDemo = new DesensitizeDemo();
- desensitizeDemo.setNickname("芋道源码");
- desensitizeDemo.setBankCard("9988002866797031");
- desensitizeDemo.setCarLicense("粤A66666");
- desensitizeDemo.setFixedPhone("01086551122");
- desensitizeDemo.setIdCard("530321199204074611");
- desensitizeDemo.setPassword("123456");
- desensitizeDemo.setPhoneNumber("13248765917");
- desensitizeDemo.setSlider1("ABCDEFG");
- desensitizeDemo.setSlider2("ABCDEFG");
- desensitizeDemo.setSlider3("ABCDEFG");
- desensitizeDemo.setEmail("1@email.com");
- desensitizeDemo.setRegex("你好,我是芋道源码");
- desensitizeDemo.setAddress("北京市海淀区上地十街10号");
- desensitizeDemo.setOrigin("芋道源码");
-
- // 调用
- DesensitizeDemo d = JsonUtils.parseObject(JsonUtils.toJsonString(desensitizeDemo), DesensitizeDemo.class);
- // 断言
- assertNotNull(d);
- assertEquals("芋***", d.getNickname());
- assertEquals("998800********31", d.getBankCard());
- assertEquals("粤A6***6", d.getCarLicense());
- assertEquals("0108*****22", d.getFixedPhone());
- assertEquals("530321**********11", d.getIdCard());
- assertEquals("******", d.getPassword());
- assertEquals("132****5917", d.getPhoneNumber());
- assertEquals("#######", d.getSlider1());
- assertEquals("ABC*EFG", d.getSlider2());
- assertEquals("*******", d.getSlider3());
- assertEquals("1****@email.com", d.getEmail());
- assertEquals("你好,我是*", d.getRegex());
- assertEquals("北京市海淀区上地十街10号*", d.getAddress());
- assertEquals("芋道源码", d.getOrigin());
- }
-
- @Data
- public static class DesensitizeDemo {
-
- @ChineseNameDesensitize
- private String nickname;
- @BankCardDesensitize
- private String bankCard;
- @CarLicenseDesensitize
- private String carLicense;
- @FixedPhoneDesensitize
- private String fixedPhone;
- @IdCardDesensitize
- private String idCard;
- @PasswordDesensitize
- private String password;
- @MobileDesensitize
- private String phoneNumber;
- @SliderDesensitize(prefixKeep = 6, suffixKeep = 1, replacer = "#")
- private String slider1;
- @SliderDesensitize(prefixKeep = 3, suffixKeep = 3)
- private String slider2;
- @SliderDesensitize(prefixKeep = 10)
- private String slider3;
- @EmailDesensitize
- private String email;
- @RegexDesensitize(regex = "芋道源码", replacer = "*")
- private String regex;
- @Address
- private String address;
- private String origin;
-
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/test/java/cn/iocoder/yudao/framework/desensitize/core/annotation/Address.java b/yudao-framework/yudao-spring-boot-starter-web/src/test/java/cn/iocoder/yudao/framework/desensitize/core/annotation/Address.java
deleted file mode 100644
index 13012098175e9f7c580102107c97809cf14f3b11..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-web/src/test/java/cn/iocoder/yudao/framework/desensitize/core/annotation/Address.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package cn.iocoder.yudao.framework.desensitize.core.annotation;
-
-import cn.iocoder.yudao.framework.desensitize.core.DesensitizeTest;
-import cn.iocoder.yudao.framework.desensitize.core.handler.AddressHandler;
-import cn.iocoder.yudao.framework.desensitize.core.base.annotation.DesensitizeBy;
-import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * 地址
- *
- * 用于 {@link DesensitizeTest} 测试使用
- *
- * @author gaibu
- */
-@Documented
-@Target({ElementType.FIELD})
-@Retention(RetentionPolicy.RUNTIME)
-@JacksonAnnotationsInside
-@DesensitizeBy(handler = AddressHandler.class)
-public @interface Address {
-
- String replacer() default "*";
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/test/java/cn/iocoder/yudao/framework/desensitize/core/handler/AddressHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/test/java/cn/iocoder/yudao/framework/desensitize/core/handler/AddressHandler.java
deleted file mode 100644
index 7a8455f8d1258384fa719083e8ba28739182f69c..0000000000000000000000000000000000000000
--- a/yudao-framework/yudao-spring-boot-starter-web/src/test/java/cn/iocoder/yudao/framework/desensitize/core/handler/AddressHandler.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package cn.iocoder.yudao.framework.desensitize.core.handler;
-
-import cn.iocoder.yudao.framework.desensitize.core.DesensitizeTest;
-import cn.iocoder.yudao.framework.desensitize.core.base.handler.DesensitizationHandler;
-import cn.iocoder.yudao.framework.desensitize.core.annotation.Address;
-
-/**
- * {@link Address} 的脱敏处理器
- *
- * 用于 {@link DesensitizeTest} 测试使用
- */
-public class AddressHandler implements DesensitizationHandler {
-
- @Override
- public String desensitize(String origin, Address annotation) {
- return origin + annotation.replacer();
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/WebSocketProperties.java b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/WebSocketProperties.java
index f1d84f7a0dcfda4eb106d6734c201c39a2bd6ffd..aa618fb04e100682de1ccde8947a9c8acda8487b 100644
--- a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/WebSocketProperties.java
+++ b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/WebSocketProperties.java
@@ -4,8 +4,8 @@ import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
-import jakarta.validation.constraints.NotEmpty;
-import jakarta.validation.constraints.NotNull;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
/**
* WebSocket 配置项
diff --git a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/security/WebSocketAuthorizeRequestsCustomizer.java b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/security/WebSocketAuthorizeRequestsCustomizer.java
index f260dfc201a8c408be54f168b4524299b45ceb20..5614f05ce96160c215fc7fd3eb84a82f22f8304a 100644
--- a/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/security/WebSocketAuthorizeRequestsCustomizer.java
+++ b/yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/security/WebSocketAuthorizeRequestsCustomizer.java
@@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
import cn.iocoder.yudao.framework.websocket.config.WebSocketProperties;
import lombok.RequiredArgsConstructor;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
+import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
/**
* WebSocket 的权限自定义
@@ -17,8 +17,8 @@ public class WebSocketAuthorizeRequestsCustomizer extends AuthorizeRequestsCusto
private final WebSocketProperties webSocketProperties;
@Override
- public void customize(AuthorizeHttpRequestsConfigurer.AuthorizationManagerRequestMatcherRegistry registry) {
- registry.requestMatchers(webSocketProperties.getPath()).permitAll();
+ public void customize(ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry) {
+ registry.antMatchers(webSocketProperties.getPath()).permitAll();
}
}
diff --git a/yudao-module-bpm/pom.xml b/yudao-module-bpm/pom.xml
deleted file mode 100644
index 95b798904c99d95a83a1f91b2e15507484888edb..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/pom.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
- yudao
- cn.iocoder.boot
- ${revision}
-
- 4.0.0
-
- yudao-module-bpm-api
- yudao-module-bpm-biz
-
- yudao-module-bpm
- pom
-
- ${project.artifactId}
-
- bpm 包下,业务流程管理(Business Process Management),我们放工作流的功能。
- 例如说:流程定义、表单配置、审核中心(我的申请、我的待办、我的已办)等等
- bpm 解释:https://baike.baidu.com/item/BPM/1933
-
- 工作流基于 Flowable 6 实现,分成流程定义、流程表单、流程实例、流程任务等功能模块。
-
-
-
diff --git a/yudao-module-bpm/yudao-module-bpm-api/pom.xml b/yudao-module-bpm/yudao-module-bpm-api/pom.xml
deleted file mode 100644
index 06554d7ff07b284a99c0976927187809ce469892..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- cn.iocoder.boot
- yudao-module-bpm
- ${revision}
-
- 4.0.0
- yudao-module-bpm-api
- jar
-
- ${project.artifactId}
-
- bpm 模块 API,暴露给其它模块调用
-
-
-
-
- cn.iocoder.boot
- yudao-common
-
-
-
-
- org.springframework.boot
- spring-boot-starter-validation
- true
-
-
-
-
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/package-info.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/package-info.java
deleted file mode 100644
index 37a92219f9de9051c1601095de6e27356293bb49..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * bpm API 包,定义暴露给其它模块的 API
- */
-package cn.iocoder.yudao.module.bpm.api;
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApi.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApi.java
deleted file mode 100644
index e4eddf6ebd523fc1c7442c953045650de6c831f6..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApi.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package cn.iocoder.yudao.module.bpm.api.task;
-
-import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
-
-import jakarta.validation.Valid;
-
-/**
- * 流程实例 Api 接口
- *
- * @author 芋道源码
- */
-public interface BpmProcessInstanceApi {
-
- /**
- * 创建流程实例(提供给内部)
- *
- * @param userId 用户编号
- * @param reqDTO 创建信息
- * @return 实例的编号
- */
- String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO reqDTO);
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/dto/BpmProcessInstanceCreateReqDTO.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/dto/BpmProcessInstanceCreateReqDTO.java
deleted file mode 100644
index b1ac35366f5e67c09641a5eed52f533d099ba2f0..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/dto/BpmProcessInstanceCreateReqDTO.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package cn.iocoder.yudao.module.bpm.api.task.dto;
-
-import lombok.Data;
-
-import jakarta.validation.constraints.NotEmpty;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 流程实例的创建 Request DTO
- *
- * @author 芋道源码
- */
-@Data
-public class BpmProcessInstanceCreateReqDTO {
-
- /**
- * 流程定义的标识
- */
- @NotEmpty(message = "流程定义的标识不能为空")
- private String processDefinitionKey;
- /**
- * 变量实例(动态表单)
- */
- private Map variables;
-
- /**
- * 业务的唯一标识
- *
- * 例如说,请假申请的编号。通过它,可以查询到对应的实例
- */
- @NotEmpty(message = "业务的唯一标识")
- private String businessKey;
-
- /**
- * 发起人自选审批人 Map
- *
- * key:taskKey 任务编码
- * value:审批人的数组
- * 例如:{ taskKey1 :[1, 2] },则表示 taskKey1 这个任务,提前设定了,由 userId 为 1,2 的用户进行审批
- */
- private Map> startUserSelectAssignees;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/DictTypeConstants.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/DictTypeConstants.java
deleted file mode 100644
index 7abb3e1dbccac9ad81a9b2b0e0cb24b97a6607f6..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/DictTypeConstants.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums;
-
-/**
- * BPM 字典类型的枚举类
- *
- * @author 芋道源码
- */
-public interface DictTypeConstants {
-
- String TASK_ASSIGN_RULE_TYPE = "bpm_task_assign_rule_type"; // 任务分配规则类型
- String TASK_ASSIGN_SCRIPT = "bpm_task_assign_script"; // 任务分配自定义脚本
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java
deleted file mode 100644
index ec167719ccb9705efd094e2951276bf39106b076..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums;
-
-import cn.iocoder.yudao.framework.common.exception.ErrorCode;
-
-/**
- * Bpm 错误码枚举类
- *
- * bpm 系统,使用 1-009-000-000 段
- */
-public interface ErrorCodeConstants {
-
- // ========== 通用流程处理 模块 1-009-000-000 ==========
-
- // ========== OA 流程模块 1-009-001-000 ==========
- ErrorCode OA_LEAVE_NOT_EXISTS = new ErrorCode(1_009_001_001, "请假申请不存在");
-
- // ========== 流程模型 1-009-002-000 ==========
- ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1_009_002_000, "已经存在流程标识为【{}】的流程");
- ErrorCode MODEL_NOT_EXISTS = new ErrorCode(1_009_002_001, "流程模型不存在");
- ErrorCode MODEL_KEY_VALID = new ErrorCode(1_009_002_002, "流程标识格式不正确,需要以字母或下划线开头,后接任意字母、数字、中划线、下划线、句点!");
- ErrorCode MODEL_DEPLOY_FAIL_FORM_NOT_CONFIG = new ErrorCode(1_009_002_003, "部署流程失败,原因:流程表单未配置,请点击【修改流程】按钮进行配置");
- ErrorCode MODEL_DEPLOY_FAIL_TASK_CANDIDATE_NOT_CONFIG = new ErrorCode(1_009_002_004, "部署流程失败," +
- "原因:用户任务({})未配置审批人,请点击【流程设计】按钮,选择该它的【任务(审批人)】进行配置");
- ErrorCode MODEL_DEPLOY_FAIL_BPMN_START_EVENT_NOT_EXISTS = new ErrorCode(1_009_002_005, "部署流程失败,原因:BPMN 流程图中,没有开始事件");
- ErrorCode MODEL_DEPLOY_FAIL_BPMN_USER_TASK_NAME_NOT_EXISTS = new ErrorCode(1_009_002_006, "部署流程失败,原因:BPMN 流程图中,用户任务({})的名字不存在");
-
- // ========== 流程定义 1-009-003-000 ==========
- ErrorCode PROCESS_DEFINITION_KEY_NOT_MATCH = new ErrorCode(1_009_003_000, "流程定义的标识期望是({}),当前是({}),请修改 BPMN 流程图");
- ErrorCode PROCESS_DEFINITION_NAME_NOT_MATCH = new ErrorCode(1_009_003_001, "流程定义的名字期望是({}),当前是({}),请修改 BPMN 流程图");
- ErrorCode PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1_009_003_002, "流程定义不存在");
- ErrorCode PROCESS_DEFINITION_IS_SUSPENDED = new ErrorCode(1_009_003_003, "流程定义处于挂起状态");
-
- // ========== 流程实例 1-009-004-000 ==========
- ErrorCode PROCESS_INSTANCE_NOT_EXISTS = new ErrorCode(1_009_004_000, "流程实例不存在");
- ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_EXISTS = new ErrorCode(1_009_004_001, "流程取消失败,流程不处于运行中");
- ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF = new ErrorCode(1_009_004_002, "流程取消失败,该流程不是你发起的");
- ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG = new ErrorCode(1_009_004_003, "审批任务({})的审批人未配置");
- ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_EXISTS = new ErrorCode(1_009_004_004, "审批任务({})的审批人({})不存在");
-
- // ========== 流程任务 1-009-005-000 ==========
- ErrorCode TASK_OPERATE_FAIL_ASSIGN_NOT_SELF = new ErrorCode(1_009_005_001, "操作失败,原因:该任务的审批人不是你");
- ErrorCode TASK_NOT_EXISTS = new ErrorCode(1_009_005_002, "流程任务不存在");
- ErrorCode TASK_IS_PENDING = new ErrorCode(1_009_005_003, "当前任务处于挂起状态,不能操作");
- ErrorCode TASK_TARGET_NODE_NOT_EXISTS = new ErrorCode(1_009_005_004, " 目标节点不存在");
- ErrorCode TASK_RETURN_FAIL_SOURCE_TARGET_ERROR = new ErrorCode(1_009_005_006, "回退任务失败,目标节点是在并行网关上或非同一路线上,不可跳转");
- ErrorCode TASK_DELEGATE_FAIL_USER_REPEAT = new ErrorCode(1_009_005_007, "任务委派失败,委派人和当前审批人为同一人");
- ErrorCode TASK_DELEGATE_FAIL_USER_NOT_EXISTS = new ErrorCode(1_009_005_008, "任务委派失败,被委派人不存在");
- ErrorCode TASK_SIGN_CREATE_USER_NOT_EXIST = new ErrorCode(1_009_005_009, "任务加签:选择的用户不存在");
- ErrorCode TASK_SIGN_CREATE_TYPE_ERROR = new ErrorCode(1_009_005_010, "任务加签:当前任务已经{},不能{}");
- ErrorCode TASK_SIGN_CREATE_USER_REPEAT = new ErrorCode(1_009_005_011, "任务加签失败,加签人与现有审批人[{}]重复");
- ErrorCode TASK_SIGN_DELETE_NO_PARENT = new ErrorCode(1_009_005_012, "任务减签失败,被减签的任务必须是通过加签生成的任务");
- ErrorCode TASK_TRANSFER_FAIL_USER_REPEAT = new ErrorCode(1_009_005_013, "任务转办失败,转办人和当前审批人为同一人");
- ErrorCode TASK_TRANSFER_FAIL_USER_NOT_EXISTS = new ErrorCode(1_009_005_014, "任务转办失败,转办人不存在");
- ErrorCode TASK_CREATE_FAIL_NO_CANDIDATE_USER = new ErrorCode(1_009_006_003, "操作失败,原因:找不到任务的审批人!");
-
- // ========== 动态表单模块 1-009-010-000 ==========
- ErrorCode FORM_NOT_EXISTS = new ErrorCode(1_009_010_000, "动态表单不存在");
- ErrorCode FORM_FIELD_REPEAT = new ErrorCode(1_009_010_001, "表单项({}) 和 ({}) 使用了相同的字段名({})");
-
- // ========== 用户组模块 1-009-011-000 ==========
- ErrorCode USER_GROUP_NOT_EXISTS = new ErrorCode(1_009_011_000, "用户分组不存在");
- ErrorCode USER_GROUP_IS_DISABLE = new ErrorCode(1_009_011_001, "名字为【{}】的用户分组已被禁用");
-
- // ========== 用户组模块 1-009-012-000 ==========
- ErrorCode CATEGORY_NOT_EXISTS = new ErrorCode(1_009_012_000, "流程分类不存在");
- ErrorCode CATEGORY_NAME_DUPLICATE = new ErrorCode(1_009_012_001, "流程分类名字【{}】重复");
- ErrorCode CATEGORY_CODE_DUPLICATE = new ErrorCode(1_009_012_002, "流程分类编码【{}】重复");
-
- // ========== BPM 流程监听器 1-009-013-000 ==========
- ErrorCode PROCESS_LISTENER_NOT_EXISTS = new ErrorCode(1_009_013_000, "流程监听器不存在");
- ErrorCode PROCESS_LISTENER_CLASS_NOT_FOUND = new ErrorCode(1_009_013_001, "流程监听器类({})不存在");
- ErrorCode PROCESS_LISTENER_CLASS_IMPLEMENTS_ERROR = new ErrorCode(1_009_013_002, "流程监听器类({})没有实现接口({})");
- ErrorCode PROCESS_LISTENER_EXPRESSION_INVALID = new ErrorCode(1_009_013_003, "流程监听器表达式({})不合法");
-
- // ========== BPM 流程表达式 1-009-014-000 ==========
- ErrorCode PROCESS_EXPRESSION_NOT_EXISTS = new ErrorCode(1_009_014_000, "流程表达式不存在");
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmModelFormTypeEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmModelFormTypeEnum.java
deleted file mode 100644
index 3bca6c82b8b047e2d114f5f42c8998fd25e285bd..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmModelFormTypeEnum.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums.definition;
-
-import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-import java.util.Arrays;
-
-/**
- * BPM 模型的表单类型的枚举
- *
- * @author 芋道源码
- */
-@Getter
-@AllArgsConstructor
-public enum BpmModelFormTypeEnum implements IntArrayValuable {
-
- NORMAL(10, "流程表单"), // 对应 BpmFormDO
- CUSTOM(20, "业务表单") // 业务自己定义的表单,自己进行数据的存储
- ;
-
- public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmModelFormTypeEnum::getType).toArray();
-
- private final Integer type;
- private final String name;
-
- @Override
- public int[] array() {
- return ARRAYS;
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerType.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerType.java
deleted file mode 100644
index 3dde5dfb5349fa30ae8821a90db708fdf4473739..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerType.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums.definition;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * BPM 流程监听器的类型
- *
- * @author 芋道源码
- */
-@Getter
-@AllArgsConstructor
-public enum BpmProcessListenerType {
-
- EXECUTION("execution", "执行监听器"),
- TASK("task", "任务执行器");
-
- private final String type;
- private final String name;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerValueType.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerValueType.java
deleted file mode 100644
index 63e23af236f11de6c9bd5dfbffa19335f526dacc..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmProcessListenerValueType.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums.definition;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * BPM 流程监听器的值类型
- *
- * @author 芋道源码
- */
-@Getter
-@AllArgsConstructor
-public enum BpmProcessListenerValueType {
-
- CLASS("class", "Java 类"),
- DELEGATE_EXPRESSION("delegateExpression", "代理表达式"),
- EXPRESSION("expression", "表达式");
-
- private final String type;
- private final String name;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/message/BpmMessageEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/message/BpmMessageEnum.java
deleted file mode 100644
index 79001fccd3c4bcad75fd309b297e888342a4ab7e..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/message/BpmMessageEnum.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums.message;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * Bpm 消息的枚举
- *
- * @author 芋道源码
- */
-@AllArgsConstructor
-@Getter
-public enum BpmMessageEnum {
-
- PROCESS_INSTANCE_APPROVE("bpm_process_instance_approve"), // 流程任务被审批通过时,发送给申请人
- PROCESS_INSTANCE_REJECT("bpm_process_instance_reject"), // 流程任务被审批不通过时,发送给申请人
- TASK_ASSIGNED("bpm_task_assigned"); // 任务被分配时,发送给审批人
-
- /**
- * 短信模板的标识
- *
- * 关联 SmsTemplateDO 的 code 属性
- */
- private final String smsTemplateCode;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmCommentTypeEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmCommentTypeEnum.java
deleted file mode 100644
index 8b7b7ce11f3f33ebd41251ab1cb4a150b20a20cc..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmCommentTypeEnum.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums.task;
-
-import cn.hutool.core.util.StrUtil;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * 流程任务的 Comment 评论类型枚举
- *
- * @author kehaiyou
- */
-@Getter
-@AllArgsConstructor
-public enum BpmCommentTypeEnum {
-
- APPROVE("1", "审批通过", "审批通过,原因是:{}"),
- REJECT("2", "不通过", "审批不通过:原因是:{}"),
- CANCEL("3", "已取消", "系统自动取消,原因是:{}"),
- RETURN("4", "退回", "任务被退回,原因是:{}"),
- DELEGATE_START("5", "委派发起", "[{}]将任务委派给[{}],委派理由为:{}"),
- DELEGATE_END("6", "委派完成", "[{}]完成委派任务,任务重新回到[{}]手中,审批建议为:{}"),
- TRANSFER("7", "转派", "[{}]将任务转派给[{}],转派理由为:{}"),
- ADD_SIGN("8", "加签", "[{}]{}给了[{}],理由为:{}"),
- SUB_SIGN("9", "减签", "[{}]操作了【减签】,审批人[{}]的任务被取消"),
- ;
-
- /**
- * 操作类型
- *
- * 由于 BPM Comment 类型为 String,所以这里就不使用 Integer
- */
- private final String type;
- /**
- * 操作名字
- */
- private final String name;
- /**
- * 操作描述
- */
- private final String comment;
-
- public String formatComment(Object... params) {
- return StrUtil.format(comment, params);
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmDeleteReasonEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmDeleteReasonEnum.java
deleted file mode 100644
index 802b9d890471a134fea102c22b81bfe9f1458424..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmDeleteReasonEnum.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums.task;
-
-import cn.hutool.core.util.StrUtil;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * 流程实例/任务的删除原因枚举
- *
- * @author 芋道源码
- */
-@Getter
-@AllArgsConstructor
-public enum BpmDeleteReasonEnum {
-
- // ========== 流程实例的独有原因 ==========
-
- REJECT_TASK("审批不通过任务,原因:{}"), // 场景:用户审批不通过任务。修改文案时,需要注意 isRejectReason 方法
- CANCEL_PROCESS_INSTANCE_BY_START_USER("用户主动取消流程,原因:{}"), // 场景:用户主动取消流程
- CANCEL_PROCESS_INSTANCE_BY_ADMIN("管理员【{}】取消流程,原因:{}"), // 场景:管理员取消流程
-
- // ========== 流程任务的独有原因 ==========
-
- CANCEL_BY_SYSTEM("系统自动取消"), // 场景:非常多,比如说:1)多任务审批已经满足条件,无需审批该任务;2)流程实例被取消,无需审批该任务;等等
- ;
-
- private final String reason;
-
- /**
- * 格式化理由
- *
- * @param args 参数
- * @return 理由
- */
- public String format(Object... args) {
- return StrUtil.format(reason, args);
- }
-
- // ========== 逻辑 ==========
-
- public static boolean isRejectReason(String reason) {
- return StrUtil.startWith(reason, "审批不通过任务,原因:");
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java
deleted file mode 100644
index 82a4119b57ca144c84083240a25701b5598a1e4c..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceStatusEnum.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums.task;
-
-import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-import java.util.Arrays;
-
-/**
- * 流程实例 ProcessInstance 的状态
- *
- * @author 芋道源码
- */
-@Getter
-@AllArgsConstructor
-public enum BpmProcessInstanceStatusEnum implements IntArrayValuable {
-
- RUNNING(1, "审批中"),
- APPROVE(2, "审批通过"),
- REJECT(3, "审批不通过"),
- CANCEL(4, "已取消");
-
- public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmProcessInstanceStatusEnum::getStatus).toArray();
-
- /**
- * 状态
- */
- private final Integer status;
- /**
- * 描述
- */
- private final String desc;
-
- @Override
- public int[] array() {
- return new int[0];
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmTaskSignTypeEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmTaskSignTypeEnum.java
deleted file mode 100644
index b01153d79460bf26bbc4ffe550c5bd67e8985152..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmTaskSignTypeEnum.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums.task;
-
-import cn.hutool.core.util.ArrayUtil;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * 流程任务的加签类型枚举
- *
- * @author kehaiyou
- */
-@Getter
-@AllArgsConstructor
-public enum BpmTaskSignTypeEnum {
-
- /**
- * 向前加签,需要前置任务审批完成,才回到原审批人
- */
- BEFORE("before", "向前加签"),
- /**
- * 向后加签,需要后置任务全部审批完,才会通过原审批人节点
- */
- AFTER("after", "向后加签");
-
- /**
- * 类型
- */
- private final String type;
- /**
- * 名字
- */
- private final String name;
-
- public static String nameOfType(String type) {
- for (BpmTaskSignTypeEnum value : values()) {
- if (value.type.equals(type)) {
- return value.name;
- }
- }
- return null;
- }
-
- public static BpmTaskSignTypeEnum of(String type) {
- return ArrayUtil.firstMatch(value -> value.getType().equals(type), values());
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmTaskStatusEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmTaskStatusEnum.java
deleted file mode 100644
index 40a385a582c591f9fcc1371355629650919bccfa..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmTaskStatusEnum.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package cn.iocoder.yudao.module.bpm.enums.task;
-
-import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * 流程任务 Task 的状态枚举
- *
- * @author jason
- */
-@Getter
-@AllArgsConstructor
-public enum BpmTaskStatusEnum {
-
- RUNNING(1, "审批中"),
- APPROVE(2, "审批通过"),
- REJECT(3, "审批不通过"),
- CANCEL(4, "已取消"),
-
- RETURN(5, "已退回"),
- DELEGATE(6, "委派中"),
-
- /**
- * 使用场景:
- * 1. 任务被向后【加签】时,它在审批通过后,会变成 APPROVING 这个状态,然后等到【加签】出来的任务都被审批后,才会变成 APPROVE 审批通过
- */
- APPROVING(7, "审批通过中"),
- /**
- * 使用场景:
- * 1. 任务被向前【加签】时,它会变成 WAIT 状态,需要等待【加签】出来的任务被审批后,它才能继续变为 RUNNING 继续审批
- * 2. 任务被向后【加签】时,【加签】出来的任务处于 WAIT 状态,它们需要等待该任务被审批后,它们才能继续变为 RUNNING 继续审批
- */
- WAIT(0, "待审批");
-
- /**
- * 状态
- *
- * 如果新增时,注意 {@link #isEndStatus(Integer)} 是否需要变更
- */
- private final Integer status;
- /**
- * 名字
- */
- private final String name;
-
- /**
- * 判断该状态是否已经处于 End 最终状态
- *
- * 主要用于一些状态更新的逻辑,如果已经是最终状态,就不再进行更新
- *
- * @param status 状态
- * @return 是否
- */
- public static boolean isEndStatus(Integer status) {
- return ObjectUtils.equalsAny(status,
- APPROVE.getStatus(), REJECT.getStatus(), CANCEL.getStatus(),
- RETURN.getStatus(), APPROVING.getStatus());
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/event/BpmProcessInstanceStatusEvent.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/event/BpmProcessInstanceStatusEvent.java
deleted file mode 100644
index f320948437ce6e17702076e529fb4cd3f8762d92..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/event/BpmProcessInstanceStatusEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package cn.iocoder.yudao.module.bpm.event;
-
-import jakarta.validation.constraints.NotNull;
-import lombok.Data;
-import org.springframework.context.ApplicationEvent;
-
-/**
- * 流程实例的状态(结果)发生变化的 Event
- *
- * @author 芋道源码
- */
-@SuppressWarnings("ALL")
-@Data
-public class BpmProcessInstanceStatusEvent extends ApplicationEvent {
-
- /**
- * 流程实例的编号
- */
- @NotNull(message = "流程实例的编号不能为空")
- private String id;
- /**
- * 流程实例的 key
- */
- @NotNull(message = "流程实例的 key 不能为空")
- private String processDefinitionKey;
- /**
- * 流程实例的结果
- */
- @NotNull(message = "流程实例的状态不能为空")
- private Integer status;
- /**
- * 流程实例对应的业务标识
- * 例如说,请假
- */
- private String businessKey;
-
- public BpmProcessInstanceStatusEvent(Object source) {
- super(source);
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/event/BpmProcessInstanceStatusEventListener.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/event/BpmProcessInstanceStatusEventListener.java
deleted file mode 100644
index f8b1863c6cd3da65d1175876c843259eddb14cb3..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/event/BpmProcessInstanceStatusEventListener.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package cn.iocoder.yudao.module.bpm.event;
-
-import cn.hutool.core.util.StrUtil;
-import org.springframework.context.ApplicationListener;
-
-/**
- * {@link BpmProcessInstanceStatusEvent} 的监听器
- *
- * @author 芋道源码
- */
-public abstract class BpmProcessInstanceStatusEventListener
- implements ApplicationListener {
-
- @Override
- public final void onApplicationEvent(BpmProcessInstanceStatusEvent event) {
- if (!StrUtil.equals(event.getProcessDefinitionKey(), getProcessDefinitionKey())) {
- return;
- }
- onEvent(event);
- }
-
- /**
- * @return 返回监听的流程定义 Key
- */
- protected abstract String getProcessDefinitionKey();
-
- /**
- * 处理事件
- *
- * @param event 事件
- */
- protected abstract void onEvent(BpmProcessInstanceStatusEvent event);
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/pom.xml b/yudao-module-bpm/yudao-module-bpm-biz/pom.xml
deleted file mode 100644
index 207b166bad414d5df8f2db42f66ddf5df5f0757f..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/pom.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
- cn.iocoder.boot
- yudao-module-bpm
- ${revision}
-
- 4.0.0
- yudao-module-bpm-biz
-
- ${project.artifactId}
-
- bpm 包下,业务流程管理(Business Process Management),我们放工作流的功能,基于 Flowable 6 版本实现。
- 例如说:流程定义、表单配置、审核中心(我的申请、我的待办、我的已办)等等
-
-
-
- cn.iocoder.boot
- yudao-module-bpm-api
- ${revision}
-
-
- cn.iocoder.boot
- yudao-module-system-api
- ${revision}
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-biz-data-permission
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-biz-tenant
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-web
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-security
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-mybatis
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-test
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-excel
-
-
-
-
- org.flowable
- flowable-spring-boot-starter-process
-
-
- org.flowable
- flowable-spring-boot-starter-actuator
-
-
-
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/api/package-info.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/api/package-info.java
deleted file mode 100644
index 2137e22031064059c93cf46767c76be6db0ff484..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/api/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * bpm API 实现类,定义暴露给其它模块的 API
- */
-package cn.iocoder.yudao.module.bpm.api;
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApiImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApiImpl.java
deleted file mode 100644
index f8aea4d74e21ca519e0566f8e4a3c8141437a05c..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApiImpl.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package cn.iocoder.yudao.module.bpm.api.task;
-
-import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
-import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
-import org.springframework.stereotype.Service;
-import org.springframework.validation.annotation.Validated;
-
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-
-/**
- * Flowable 流程实例 Api 实现类
- *
- * @author 芋道源码
- * @author jason
- */
-@Service
-@Validated
-public class BpmProcessInstanceApiImpl implements BpmProcessInstanceApi {
-
- @Resource
- private BpmProcessInstanceService processInstanceService;
-
- @Override
- public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO reqDTO) {
- return processInstanceService.createProcessInstance(userId, reqDTO);
- }
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmCategoryController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmCategoryController.java
deleted file mode 100644
index 322666615bf9dfa40d824bd1ba198ea2695b1b35..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmCategoryController.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition;
-
-import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.category.BpmCategoryPageReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.category.BpmCategoryRespVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.category.BpmCategorySaveReqVO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmCategoryService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Comparator;
-import java.util.List;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
-
-@Tag(name = "管理后台 - BPM 流程分类")
-@RestController
-@RequestMapping("/bpm/category")
-@Validated
-public class BpmCategoryController {
-
- @Resource
- private BpmCategoryService categoryService;
-
- @PostMapping("/create")
- @Operation(summary = "创建流程分类")
- @PreAuthorize("@ss.hasPermission('bpm:category:create')")
- public CommonResult createCategory(@Valid @RequestBody BpmCategorySaveReqVO createReqVO) {
- return success(categoryService.createCategory(createReqVO));
- }
-
- @PutMapping("/update")
- @Operation(summary = "更新流程分类")
- @PreAuthorize("@ss.hasPermission('bpm:category:update')")
- public CommonResult updateCategory(@Valid @RequestBody BpmCategorySaveReqVO updateReqVO) {
- categoryService.updateCategory(updateReqVO);
- return success(true);
- }
-
- @DeleteMapping("/delete")
- @Operation(summary = "删除流程分类")
- @Parameter(name = "id", description = "编号", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:category:delete')")
- public CommonResult deleteCategory(@RequestParam("id") Long id) {
- categoryService.deleteCategory(id);
- return success(true);
- }
-
- @GetMapping("/get")
- @Operation(summary = "获得流程分类")
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('bpm:category:query')")
- public CommonResult getCategory(@RequestParam("id") Long id) {
- BpmCategoryDO category = categoryService.getCategory(id);
- return success(BeanUtils.toBean(category, BpmCategoryRespVO.class));
- }
-
- @GetMapping("/page")
- @Operation(summary = "获得流程分类分页")
- @PreAuthorize("@ss.hasPermission('bpm:category:query')")
- public CommonResult> getCategoryPage(@Valid BpmCategoryPageReqVO pageReqVO) {
- PageResult pageResult = categoryService.getCategoryPage(pageReqVO);
- return success(BeanUtils.toBean(pageResult, BpmCategoryRespVO.class));
- }
-
- @GetMapping("/simple-list")
- @Operation(summary = "获取流程分类的精简信息列表", description = "只包含被开启的分类,主要用于前端的下拉选项")
- public CommonResult> getCategorySimpleList() {
- List list = categoryService.getCategoryListByStatus(CommonStatusEnum.ENABLE.getStatus());
- list.sort(Comparator.comparingInt(BpmCategoryDO::getSort));
- return success(convertList(list, category -> new BpmCategoryRespVO().setId(category.getId())
- .setName(category.getName()).setCode(category.getCode())));
- }
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmFormController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmFormController.java
deleted file mode 100644
index b957a75a7a862b0fab26573c3730790b70af9777..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmFormController.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition;
-
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormRespVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormSaveReqVO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmFormService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
-
-@Tag(name = "管理后台 - 动态表单")
-@RestController
-@RequestMapping("/bpm/form")
-@Validated
-public class BpmFormController {
-
- @Resource
- private BpmFormService formService;
-
- @PostMapping("/create")
- @Operation(summary = "创建动态表单")
- @PreAuthorize("@ss.hasPermission('bpm:form:create')")
- public CommonResult createForm(@Valid @RequestBody BpmFormSaveReqVO createReqVO) {
- return success(formService.createForm(createReqVO));
- }
-
- @PutMapping("/update")
- @Operation(summary = "更新动态表单")
- @PreAuthorize("@ss.hasPermission('bpm:form:update')")
- public CommonResult updateForm(@Valid @RequestBody BpmFormSaveReqVO updateReqVO) {
- formService.updateForm(updateReqVO);
- return success(true);
- }
-
- @DeleteMapping("/delete")
- @Operation(summary = "删除动态表单")
- @Parameter(name = "id", description = "编号", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:form:delete')")
- public CommonResult deleteForm(@RequestParam("id") Long id) {
- formService.deleteForm(id);
- return success(true);
- }
-
- @GetMapping("/get")
- @Operation(summary = "获得动态表单")
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('bpm:form:query')")
- public CommonResult getForm(@RequestParam("id") Long id) {
- BpmFormDO form = formService.getForm(id);
- return success(BeanUtils.toBean(form, BpmFormRespVO.class));
- }
-
- @GetMapping({"/list-all-simple", "/simple-list"})
- @Operation(summary = "获得动态表单的精简列表", description = "用于表单下拉框")
- public CommonResult> getFormSimpleList() {
- List list = formService.getFormList();
- return success(convertList(list, formDO -> // 只返回 id、name 字段
- new BpmFormRespVO().setId(formDO.getId()).setName(formDO.getName())));
- }
-
- @GetMapping("/page")
- @Operation(summary = "获得动态表单分页")
- @PreAuthorize("@ss.hasPermission('bpm:form:query')")
- public CommonResult> getFormPage(@Valid BpmFormPageReqVO pageVO) {
- PageResult pageResult = formService.getFormPage(pageVO);
- return success(BeanUtils.toBean(pageResult, BpmFormRespVO.class));
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmModelController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmModelController.java
deleted file mode 100644
index dcf91260fbe741a83f3a0611c822958217c91d58..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmModelController.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
-import cn.iocoder.yudao.framework.common.util.io.IoUtils;
-import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*;
-import cn.iocoder.yudao.module.bpm.convert.definition.BpmModelConvert;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmCategoryService;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmFormService;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
-import cn.iocoder.yudao.module.bpm.service.definition.dto.BpmModelMetaInfoRespDTO;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.flowable.engine.repository.Deployment;
-import org.flowable.engine.repository.Model;
-import org.flowable.engine.repository.ProcessDefinition;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
-
-@Tag(name = "管理后台 - 流程模型")
-@RestController
-@RequestMapping("/bpm/model")
-@Validated
-public class BpmModelController {
-
- @Resource
- private BpmModelService modelService;
- @Resource
- private BpmFormService formService;
- @Resource
- private BpmCategoryService categoryService;
- @Resource
- private BpmProcessDefinitionService processDefinitionService;
-
- @GetMapping("/page")
- @Operation(summary = "获得模型分页")
- public CommonResult> getModelPage(BpmModelPageReqVO pageVO) {
- PageResult pageResult = modelService.getModelPage(pageVO);
- if (CollUtil.isEmpty(pageResult.getList())) {
- return success(PageResult.empty(pageResult.getTotal()));
- }
-
- // 拼接数据
- // 获得 Form 表单
- Set formIds = convertSet(pageResult.getList(), model -> {
- BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class);
- return metaInfo != null ? metaInfo.getFormId() : null;
- });
- Map formMap = formService.getFormMap(formIds);
- // 获得 Category Map
- Map categoryMap = categoryService.getCategoryMap(
- convertSet(pageResult.getList(), Model::getCategory));
- // 获得 Deployment Map
- Set deploymentIds = new HashSet<>();
- pageResult.getList().forEach(model -> CollectionUtils.addIfNotNull(deploymentIds, model.getDeploymentId()));
- Map deploymentMap = processDefinitionService.getDeploymentMap(deploymentIds);
- // 获得 ProcessDefinition Map
- List processDefinitions = processDefinitionService.getProcessDefinitionListByDeploymentIds(deploymentIds);
- Map processDefinitionMap = convertMap(processDefinitions, ProcessDefinition::getDeploymentId);
- return success(BpmModelConvert.INSTANCE.buildModelPage(pageResult, formMap, categoryMap, deploymentMap, processDefinitionMap));
- }
-
- @GetMapping("/get")
- @Operation(summary = "获得模型")
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('bpm:model:query')")
- public CommonResult getModel(@RequestParam("id") String id) {
- Model model = modelService.getModel(id);
- if (model == null) {
- return null;
- }
- byte[] bpmnBytes = modelService.getModelBpmnXML(id);
- return success(BpmModelConvert.INSTANCE.buildModel(model, bpmnBytes));
- }
-
- @PostMapping("/create")
- @Operation(summary = "新建模型")
- @PreAuthorize("@ss.hasPermission('bpm:model:create')")
- public CommonResult createModel(@Valid @RequestBody BpmModelCreateReqVO createRetVO) {
- return success(modelService.createModel(createRetVO, null));
- }
-
- @PutMapping("/update")
- @Operation(summary = "修改模型")
- @PreAuthorize("@ss.hasPermission('bpm:model:update')")
- public CommonResult updateModel(@Valid @RequestBody BpmModelUpdateReqVO modelVO) {
- modelService.updateModel(modelVO);
- return success(true);
- }
-
- @PostMapping("/import")
- @Operation(summary = "导入模型")
- @PreAuthorize("@ss.hasPermission('bpm:model:import')")
- public CommonResult importModel(@Valid BpmModeImportReqVO importReqVO) throws IOException {
- BpmModelCreateReqVO createReqVO = BeanUtils.toBean(importReqVO, BpmModelCreateReqVO.class);
- // 读取文件
- String bpmnXml = IoUtils.readUtf8(importReqVO.getBpmnFile().getInputStream(), false);
- return success(modelService.createModel(createReqVO, bpmnXml));
- }
-
- @PostMapping("/deploy")
- @Operation(summary = "部署模型")
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('bpm:model:deploy')")
- public CommonResult deployModel(@RequestParam("id") String id) {
- modelService.deployModel(id);
- return success(true);
- }
-
- @PutMapping("/update-state")
- @Operation(summary = "修改模型的状态", description = "实际更新的部署的流程定义的状态")
- @PreAuthorize("@ss.hasPermission('bpm:model:update')")
- public CommonResult updateModelState(@Valid @RequestBody BpmModelUpdateStateReqVO reqVO) {
- modelService.updateModelState(reqVO.getId(), reqVO.getState());
- return success(true);
- }
-
- @DeleteMapping("/delete")
- @Operation(summary = "删除模型")
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('bpm:model:delete')")
- public CommonResult deleteModel(@RequestParam("id") String id) {
- modelService.deleteModel(id);
- return success(true);
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java
deleted file mode 100644
index 149737ca0f36f9e7be67a6771a54f042d95de7a1..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO;
-import cn.iocoder.yudao.module.bpm.convert.definition.BpmProcessDefinitionConvert;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
-import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.BpmTaskCandidateStartUserSelectStrategy;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmCategoryService;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmFormService;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import org.flowable.bpmn.model.BpmnModel;
-import org.flowable.bpmn.model.UserTask;
-import org.flowable.engine.repository.Deployment;
-import org.flowable.engine.repository.ProcessDefinition;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
-
-@Tag(name = "管理后台 - 流程定义")
-@RestController
-@RequestMapping("/bpm/process-definition")
-@Validated
-public class BpmProcessDefinitionController {
-
- @Resource
- private BpmProcessDefinitionService processDefinitionService;
- @Resource
- private BpmFormService formService;
- @Resource
- private BpmCategoryService categoryService;
-
- @GetMapping("/page")
- @Operation(summary = "获得流程定义分页")
- @PreAuthorize("@ss.hasPermission('bpm:process-definition:query')")
- public CommonResult> getProcessDefinitionPage(
- BpmProcessDefinitionPageReqVO pageReqVO) {
- PageResult pageResult = processDefinitionService.getProcessDefinitionPage(pageReqVO);
- if (CollUtil.isEmpty(pageResult.getList())) {
- return success(PageResult.empty(pageResult.getTotal()));
- }
-
- // 获得 Category Map
- Map categoryMap = categoryService.getCategoryMap(
- convertSet(pageResult.getList(), ProcessDefinition::getCategory));
- // 获得 Deployment Map
- Map deploymentMap = processDefinitionService.getDeploymentMap(
- convertSet(pageResult.getList(), ProcessDefinition::getDeploymentId));
- // 获得 BpmProcessDefinitionInfoDO Map
- Map processDefinitionMap = processDefinitionService.getProcessDefinitionInfoMap(
- convertSet(pageResult.getList(), ProcessDefinition::getId));
- // 获得 Form Map
- Map formMap = formService.getFormMap(
- convertSet(processDefinitionMap.values(), BpmProcessDefinitionInfoDO::getFormId));
- return success(BpmProcessDefinitionConvert.INSTANCE.buildProcessDefinitionPage(
- pageResult, deploymentMap, processDefinitionMap, formMap, categoryMap));
- }
-
- @GetMapping ("/list")
- @Operation(summary = "获得流程定义列表")
- @Parameter(name = "suspensionState", description = "挂起状态", required = true, example = "1") // 参见 Flowable SuspensionState 枚举
- @PreAuthorize("@ss.hasPermission('bpm:process-definition:query')")
- public CommonResult> getProcessDefinitionList(
- @RequestParam("suspensionState") Integer suspensionState) {
- List list = processDefinitionService.getProcessDefinitionListBySuspensionState(suspensionState);
- if (CollUtil.isEmpty(list)) {
- return success(Collections.emptyList());
- }
-
- // 获得 BpmProcessDefinitionInfoDO Map
- Map processDefinitionMap = processDefinitionService.getProcessDefinitionInfoMap(
- convertSet(list, ProcessDefinition::getId));
- return success(BpmProcessDefinitionConvert.INSTANCE.buildProcessDefinitionList(
- list, null, processDefinitionMap, null, null));
- }
-
- @GetMapping ("/get")
- @Operation(summary = "获得流程定义")
- @Parameter(name = "id", description = "流程编号", required = true, example = "1024")
- @Parameter(name = "key", description = "流程定义标识", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('bpm:process-definition:query')")
- public CommonResult getProcessDefinition(
- @RequestParam(value = "id", required = false) String id,
- @RequestParam(value = "key", required = false) String key) {
- ProcessDefinition processDefinition = id != null ? processDefinitionService.getProcessDefinition(id)
- : processDefinitionService.getActiveProcessDefinition(key);
- if (processDefinition == null) {
- return success(null);
- }
- BpmnModel bpmnModel = processDefinitionService.getProcessDefinitionBpmnModel(processDefinition.getId());
- List userTaskList = BpmTaskCandidateStartUserSelectStrategy.getStartUserSelectUserTaskList(bpmnModel);
- return success(BpmProcessDefinitionConvert.INSTANCE.buildProcessDefinition(
- processDefinition, null, null, null, null, bpmnModel, userTaskList));
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessExpressionController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessExpressionController.java
deleted file mode 100644
index 4b119f799691a67446d3e18408c778301a7d3698..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessExpressionController.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition;
-
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.expression.BpmProcessExpressionPageReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.expression.BpmProcessExpressionRespVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.expression.BpmProcessExpressionSaveReqVO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessExpressionDO;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessExpressionService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-
-@Tag(name = "管理后台 - BPM 流程表达式")
-@RestController
-@RequestMapping("/bpm/process-expression")
-@Validated
-public class BpmProcessExpressionController {
-
- @Resource
- private BpmProcessExpressionService processExpressionService;
-
- @PostMapping("/create")
- @Operation(summary = "创建流程表达式")
- @PreAuthorize("@ss.hasPermission('bpm:process-expression:create')")
- public CommonResult createProcessExpression(@Valid @RequestBody BpmProcessExpressionSaveReqVO createReqVO) {
- return success(processExpressionService.createProcessExpression(createReqVO));
- }
-
- @PutMapping("/update")
- @Operation(summary = "更新流程表达式")
- @PreAuthorize("@ss.hasPermission('bpm:process-expression:update')")
- public CommonResult updateProcessExpression(@Valid @RequestBody BpmProcessExpressionSaveReqVO updateReqVO) {
- processExpressionService.updateProcessExpression(updateReqVO);
- return success(true);
- }
-
- @DeleteMapping("/delete")
- @Operation(summary = "删除流程表达式")
- @Parameter(name = "id", description = "编号", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:process-expression:delete')")
- public CommonResult deleteProcessExpression(@RequestParam("id") Long id) {
- processExpressionService.deleteProcessExpression(id);
- return success(true);
- }
-
- @GetMapping("/get")
- @Operation(summary = "获得流程表达式")
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('bpm:process-expression:query')")
- public CommonResult getProcessExpression(@RequestParam("id") Long id) {
- BpmProcessExpressionDO processExpression = processExpressionService.getProcessExpression(id);
- return success(BeanUtils.toBean(processExpression, BpmProcessExpressionRespVO.class));
- }
-
- @GetMapping("/page")
- @Operation(summary = "获得流程表达式分页")
- @PreAuthorize("@ss.hasPermission('bpm:process-expression:query')")
- public CommonResult> getProcessExpressionPage(
- @Valid BpmProcessExpressionPageReqVO pageReqVO) {
- PageResult pageResult = processExpressionService.getProcessExpressionPage(pageReqVO);
- return success(BeanUtils.toBean(pageResult, BpmProcessExpressionRespVO.class));
- }
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessListenerController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessListenerController.java
deleted file mode 100644
index 843f53dbafb886c2ba382d272d3553fc60951ebb..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessListenerController.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition;
-
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerPageReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerRespVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerSaveReqVO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessListenerDO;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessListenerService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-
-@Tag(name = "管理后台 - BPM 流程监听器")
-@RestController
-@RequestMapping("/bpm/process-listener")
-@Validated
-public class BpmProcessListenerController {
-
- @Resource
- private BpmProcessListenerService processListenerService;
-
- @PostMapping("/create")
- @Operation(summary = "创建流程监听器")
- @PreAuthorize("@ss.hasPermission('bpm:process-listener:create')")
- public CommonResult createProcessListener(@Valid @RequestBody BpmProcessListenerSaveReqVO createReqVO) {
- return success(processListenerService.createProcessListener(createReqVO));
- }
-
- @PutMapping("/update")
- @Operation(summary = "更新流程监听器")
- @PreAuthorize("@ss.hasPermission('bpm:process-listener:update')")
- public CommonResult updateProcessListener(@Valid @RequestBody BpmProcessListenerSaveReqVO updateReqVO) {
- processListenerService.updateProcessListener(updateReqVO);
- return success(true);
- }
-
- @DeleteMapping("/delete")
- @Operation(summary = "删除流程监听器")
- @Parameter(name = "id", description = "编号", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:process-listener:delete')")
- public CommonResult deleteProcessListener(@RequestParam("id") Long id) {
- processListenerService.deleteProcessListener(id);
- return success(true);
- }
-
- @GetMapping("/get")
- @Operation(summary = "获得流程监听器")
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('bpm:process-listener:query')")
- public CommonResult getProcessListener(@RequestParam("id") Long id) {
- BpmProcessListenerDO processListener = processListenerService.getProcessListener(id);
- return success(BeanUtils.toBean(processListener, BpmProcessListenerRespVO.class));
- }
-
- @GetMapping("/page")
- @Operation(summary = "获得流程监听器分页")
- @PreAuthorize("@ss.hasPermission('bpm:process-listener:query')")
- public CommonResult> getProcessListenerPage(
- @Valid BpmProcessListenerPageReqVO pageReqVO) {
- PageResult pageResult = processListenerService.getProcessListenerPage(pageReqVO);
- return success(BeanUtils.toBean(pageResult, BpmProcessListenerRespVO.class));
- }
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmUserGroupController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmUserGroupController.java
deleted file mode 100644
index 64b80345c0e5b20f0b17b74277128f3218cce428..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmUserGroupController.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition;
-
-import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupPageReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupRespVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupSaveReqVO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmUserGroupService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
-
-@Tag(name = "管理后台 - 用户组")
-@RestController
-@RequestMapping("/bpm/user-group")
-@Validated
-public class BpmUserGroupController {
-
- @Resource
- private BpmUserGroupService userGroupService;
-
- @PostMapping("/create")
- @Operation(summary = "创建用户组")
- @PreAuthorize("@ss.hasPermission('bpm:user-group:create')")
- public CommonResult createUserGroup(@Valid @RequestBody BpmUserGroupSaveReqVO createReqVO) {
- return success(userGroupService.createUserGroup(createReqVO));
- }
-
- @PutMapping("/update")
- @Operation(summary = "更新用户组")
- @PreAuthorize("@ss.hasPermission('bpm:user-group:update')")
- public CommonResult updateUserGroup(@Valid @RequestBody BpmUserGroupSaveReqVO updateReqVO) {
- userGroupService.updateUserGroup(updateReqVO);
- return success(true);
- }
-
- @DeleteMapping("/delete")
- @Operation(summary = "删除用户组")
- @Parameter(name = "id", description = "编号", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:user-group:delete')")
- public CommonResult deleteUserGroup(@RequestParam("id") Long id) {
- userGroupService.deleteUserGroup(id);
- return success(true);
- }
-
- @GetMapping("/get")
- @Operation(summary = "获得用户组")
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('bpm:user-group:query')")
- public CommonResult getUserGroup(@RequestParam("id") Long id) {
- BpmUserGroupDO userGroup = userGroupService.getUserGroup(id);
- return success(BeanUtils.toBean(userGroup, BpmUserGroupRespVO.class));
- }
-
- @GetMapping("/page")
- @Operation(summary = "获得用户组分页")
- @PreAuthorize("@ss.hasPermission('bpm:user-group:query')")
- public CommonResult> getUserGroupPage(@Valid BpmUserGroupPageReqVO pageVO) {
- PageResult pageResult = userGroupService.getUserGroupPage(pageVO);
- return success(BeanUtils.toBean(pageResult, BpmUserGroupRespVO.class));
- }
-
- @GetMapping("/simple-list")
- @Operation(summary = "获取用户组精简信息列表", description = "只包含被开启的用户组,主要用于前端的下拉选项")
- public CommonResult> getUserGroupSimpleList() {
- List list = userGroupService.getUserGroupListByStatus(CommonStatusEnum.ENABLE.getStatus());
- return success(convertList(list, group -> new BpmUserGroupRespVO().setId(group.getId()).setName(group.getName())));
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategoryPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategoryPageReqVO.java
deleted file mode 100644
index b76e96c3149b91e123251977d819661faad60e6a..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategoryPageReqVO.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.category;
-
-import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.validation.InEnum;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDateTime;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@Schema(description = "管理后台 - BPM 流程分类分页 Request VO")
-@Data
-public class BpmCategoryPageReqVO extends PageParam {
-
- @Schema(description = "分类名", example = "王五")
- private String name;
-
- @Schema(description = "分类标志", example = "OA")
- private String code;
-
- @Schema(description = "分类状态", example = "1")
- @InEnum(CommonStatusEnum.class)
- private Integer status;
-
- @Schema(description = "创建时间")
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- private LocalDateTime[] createTime;
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategoryRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategoryRespVO.java
deleted file mode 100644
index 7ada55a1d985204790e9e09156a633ce3542c7ef..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategoryRespVO.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.category;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-@Schema(description = "管理后台 - BPM 流程分类 Response VO")
-@Data
-public class BpmCategoryRespVO {
-
- @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167")
- private Long id;
-
- @Schema(description = "分类名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
- private String name;
-
- @Schema(description = "分类标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "OA")
- private String code;
-
- @Schema(description = "分类描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
- private String description;
-
- @Schema(description = "分类状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer status;
-
- @Schema(description = "分类排序", requiredMode = Schema.RequiredMode.REQUIRED)
- private Integer sort;
-
- @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
- private LocalDateTime createTime;
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategorySaveReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategorySaveReqVO.java
deleted file mode 100644
index d1a175ec57ef4b9d83ad459b146a916cd41a2484..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/category/BpmCategorySaveReqVO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.category;
-
-import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
-import cn.iocoder.yudao.framework.common.validation.InEnum;
-import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.constraints.NotEmpty;
-import jakarta.validation.constraints.NotNull;
-import lombok.Data;
-
-@Schema(description = "管理后台 - BPM 流程分类新增/修改 Request VO")
-@Data
-public class BpmCategorySaveReqVO {
-
- @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167")
- private Long id;
-
- @Schema(description = "分类名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
- @NotEmpty(message = "分类名不能为空")
- private String name;
-
- @Schema(description = "分类描述", example = "你猜")
- private String description;
-
- @Schema(description = "分类标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "OA")
- @NotEmpty(message = "分类标志不能为空")
- private String code;
-
- @Schema(description = "分类状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- @NotNull(message = "分类状态不能为空")
- @InEnum(CommonStatusEnum.class)
- private Integer status;
-
- @Schema(description = "分类排序", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotNull(message = "分类排序不能为空")
- private Integer sort;
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionPageReqVO.java
deleted file mode 100644
index 37b02f0d9fc40b014bef3c14ad06f9795ed3fdc3..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionPageReqVO.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.expression;
-
-import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.validation.InEnum;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDateTime;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@Schema(description = "管理后台 - BPM 流程表达式分页 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class BpmProcessExpressionPageReqVO extends PageParam {
-
- @Schema(description = "表达式名字", example = "李四")
- private String name;
-
- @Schema(description = "表达式状态", example = "1")
- @InEnum(CommonStatusEnum.class)
- private Integer status;
-
- @Schema(description = "创建时间")
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- private LocalDateTime[] createTime;
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionRespVO.java
deleted file mode 100644
index d877f60a883c1f3ec1f3ce8cbe0acb756dd78f2a..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionRespVO.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.expression;
-
-import com.alibaba.excel.annotation.ExcelProperty;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-@Schema(description = "管理后台 - BPM 流程表达式 Response VO")
-@Data
-public class BpmProcessExpressionRespVO {
-
- @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3870")
- @ExcelProperty("编号")
- private Long id;
-
- @Schema(description = "表达式名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
- @ExcelProperty("表达式名字")
- private String name;
-
- @Schema(description = "表达式状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer status;
-
- @Schema(description = "表达式", requiredMode = Schema.RequiredMode.REQUIRED)
- private String expression;
-
- @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
- private LocalDateTime createTime;
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionSaveReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionSaveReqVO.java
deleted file mode 100644
index 9c7301a7d7d3ff826921881a99773833d0e1ec09..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/expression/BpmProcessExpressionSaveReqVO.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.expression;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.constraints.NotEmpty;
-import jakarta.validation.constraints.NotNull;
-import lombok.Data;
-
-@Schema(description = "管理后台 - BPM 流程表达式新增/修改 Request VO")
-@Data
-public class BpmProcessExpressionSaveReqVO {
-
- @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3870")
- private Long id;
-
- @Schema(description = "表达式名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
- @NotEmpty(message = "表达式名字不能为空")
- private String name;
-
- @Schema(description = "表达式状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- @NotNull(message = "表达式状态不能为空")
- private Integer status;
-
- @Schema(description = "表达式", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotEmpty(message = "表达式不能为空")
- private String expression;
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormPageReqVO.java
deleted file mode 100644
index 1657f02046d8cbd2cfc93206cfcfc28f499e9189..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormPageReqVO.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-@Schema(description = "管理后台 - 动态表单分页 Request VO")
-@Data
-public class BpmFormPageReqVO extends PageParam {
-
- @Schema(description = "表单名称", example = "芋道")
- private String name;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java
deleted file mode 100644
index 1c4eb762ca1ca0fef7ca8dc95b54cf5427f35032..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.constraints.NotNull;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-@Schema(description = "管理后台 - 动态表单 Response VO")
-@Data
-public class BpmFormRespVO {
-
- @Schema(description = "表单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
- private Long id;
-
- @Schema(description = "表单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
- @NotNull(message = "表单名称不能为空")
- private String name;
-
- @Schema(description = "表单的配置-JSON 字符串", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotNull(message = "表单的配置不能为空")
- private String conf;
-
- @Schema(description = "表单项的数组-JSON 字符串的数组", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotNull(message = "表单项的数组不能为空")
- private List fields;
-
- @Schema(description = "表单状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- @NotNull(message = "表单状态不能为空")
- private Integer status; // 参见 CommonStatusEnum 枚举
-
- @Schema(description = "备注", example = "我是备注")
- private String remark;
-
- @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
- private LocalDateTime createTime;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormSaveReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormSaveReqVO.java
deleted file mode 100644
index 4da13aaf8cfa304f375b0631b87ec4ef182ce4c4..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormSaveReqVO.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.*;
-
-import jakarta.validation.constraints.NotNull;
-import java.util.List;
-
-@Schema(description = "管理后台 - 动态表单创建/更新 Request VO")
-@Data
-public class BpmFormSaveReqVO {
-
- @Schema(description = "表单编号", example = "1024")
- private Long id;
-
- @Schema(description = "表单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
- @NotNull(message = "表单名称不能为空")
- private String name;
-
- @Schema(description = "表单的配置-JSON 字符串", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotNull(message = "表单的配置不能为空")
- private String conf;
-
- @Schema(description = "表单项的数组-JSON 字符串的数组", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotNull(message = "表单项的数组不能为空")
- private List fields;
-
- @Schema(description = "表单状态-参见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- @NotNull(message = "表单状态不能为空")
- private Integer status;
-
- @Schema(description = "备注", example = "我是备注")
- private String remark;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java
deleted file mode 100644
index 234ff2849d3dc4a849f50ff9ab3d0481fc6f598c..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.util.date.DateUtils;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDateTime;
-
-@Schema(description = "管理后台 - 用户组分页 Request VO")
-@Data
-public class BpmUserGroupPageReqVO extends PageParam {
-
- @Schema(description = "编号", example = "1024")
- private Long id;
-
- @Schema(description = "组名", example = "芋道")
- private String name;
-
- @Schema(description = "状态", example = "1")
- private Integer status;
-
- @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- @Schema(description = "创建时间")
- private LocalDateTime[] createTime;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java
deleted file mode 100644
index f20722a8d7f8b6fe45301487f7a12ad7a2d0be41..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-import java.util.Set;
-
-@Schema(description = "管理后台 - 用户组 Response VO")
-@Data
-public class BpmUserGroupRespVO {
-
- @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
- private Long id;
-
- @Schema(description = "组名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
- private String name;
-
- @Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码")
- private String description;
-
- @Schema(description = "成员编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3")
- private Set userIds;
-
- @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer status;
-
- @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
- private LocalDateTime createTime;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupSaveReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupSaveReqVO.java
deleted file mode 100644
index 1993cdba0784444849a1a42539f03b673070fb92..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupSaveReqVO.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
-import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.constraints.NotNull;
-import lombok.*;
-
-import java.util.Set;
-
-@Schema(description = "管理后台 - 用户组创建/修改 Request VO")
-@Data
-public class BpmUserGroupSaveReqVO {
-
- @Schema(description = "编号", example = "1024")
- private Long id;
-
- @Schema(description = "组名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
- @NotNull(message = "组名不能为空")
- private String name;
-
- @Schema(description = "描述", example = "芋道源码")
- private String description;
-
- @Schema(description = "成员编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3")
- @NotNull(message = "成员编号数组不能为空")
- private Set userIds;
-
- @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- @NotNull(message = "状态不能为空")
- private Integer status;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerPageReqVO.java
deleted file mode 100644
index d3b9746727000fdf3bb2c63b2b148ff87ee325d9..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerPageReqVO.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener;
-
-import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.validation.InEnum;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-@Schema(description = "管理后台 - BPM 流程监听器分页 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class BpmProcessListenerPageReqVO extends PageParam {
-
- @Schema(description = "监听器名字", example = "赵六")
- private String name;
-
- @Schema(description = "监听器类型", example = "execution")
- private String type;
-
- @Schema(description = "监听事件", example = "start")
- private String event;
-
- @Schema(description = "状态", example = "1")
- @InEnum(CommonStatusEnum.class)
- private Integer status;
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerRespVO.java
deleted file mode 100644
index f7a484254bf8e16e2bfc4ac1a08b62ddced6bb0b..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerRespVO.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-@Schema(description = "管理后台 - BPM 流程监听器 Response VO")
-@Data
-public class BpmProcessListenerRespVO {
-
- @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13089")
- private Long id;
-
- @Schema(description = "监听器名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
- private String name;
-
- @Schema(description = "监听器类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "execution")
- private String type;
-
- @Schema(description = "监听器状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer status;
-
- @Schema(description = "监听事件", requiredMode = Schema.RequiredMode.REQUIRED, example = "start")
- private String event;
-
- @Schema(description = "监听器值类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "class")
- private String valueType;
-
- @Schema(description = "监听器值", requiredMode = Schema.RequiredMode.REQUIRED)
- private String value;
-
- @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
- private LocalDateTime createTime;
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerSaveReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerSaveReqVO.java
deleted file mode 100644
index f69d0dfe1a19119633e8e8e652793d12cd075f12..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/listener/BpmProcessListenerSaveReqVO.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.listener;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.constraints.NotEmpty;
-import jakarta.validation.constraints.NotNull;
-import lombok.Data;
-
-@Schema(description = "管理后台 - BPM 流程监听器新增/修改 Request VO")
-@Data
-public class BpmProcessListenerSaveReqVO {
-
- @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13089")
- private Long id;
-
- @Schema(description = "监听器名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
- @NotEmpty(message = "监听器名字不能为空")
- private String name;
-
- @Schema(description = "监听器类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "execution")
- @NotEmpty(message = "监听器类型不能为空")
- private String type;
-
- @Schema(description = "监听器状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- @NotNull(message = "监听器状态不能为空")
- private Integer status;
-
- @Schema(description = "监听事件", requiredMode = Schema.RequiredMode.REQUIRED, example = "start")
- @NotEmpty(message = "监听事件不能为空")
- private String event;
-
- @Schema(description = "监听器值类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "class")
- @NotEmpty(message = "监听器值类型不能为空")
- private String valueType;
-
- @Schema(description = "监听器值", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotEmpty(message = "监听器值不能为空")
- private String value;
-
-}
\ No newline at end of file
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModeImportReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModeImportReqVO.java
deleted file mode 100644
index a78a96fcbd793f21ff59f6a0bd3148c525f4282c..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModeImportReqVO.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-import org.springframework.web.multipart.MultipartFile;
-
-import jakarta.validation.constraints.NotNull;
-
-@Schema(description = "管理后台 - 流程模型的导入 Request VO 相比流程模型的新建来说,只是多了一个 bpmnFile 文件")
-@Data
-public class BpmModeImportReqVO extends BpmModelCreateReqVO {
-
- @Schema(description = "BPMN 文件", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotNull(message = "BPMN 文件不能为空")
- private MultipartFile bpmnFile;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelCreateReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelCreateReqVO.java
deleted file mode 100644
index cd4a2c16602958cb05744185aa7b2ec7f2496963..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelCreateReqVO.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-import jakarta.validation.constraints.NotEmpty;
-
-@Schema(description = "管理后台 - 流程模型的创建 Request VO")
-@Data
-public class BpmModelCreateReqVO {
-
- @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "process_yudao")
- @NotEmpty(message = "流程标识不能为空")
- private String key;
-
- @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
- @NotEmpty(message = "流程名称不能为空")
- private String name;
-
- @Schema(description = "流程描述", example = "我是描述")
- private String description;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageReqVO.java
deleted file mode 100644
index ec14b1aa8e64680c5290e7d2640c2653a497ecd6..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageReqVO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-
-@Schema(description = "管理后台 - 流程模型分页 Request VO")
-@Data
-public class BpmModelPageReqVO extends PageParam {
-
- @Schema(description = "标识,精准匹配", example = "process1641042089407")
- private String key;
-
- @Schema(description = "名字,模糊匹配", example = "芋道")
- private String name;
-
- @Schema(description = "流程分类", example = "1")
- private String category;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java
deleted file mode 100644
index aad2015c7e88f1601e5b4215711276068d46d8b3..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model;
-
-import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-@Schema(description = "管理后台 - 流程模型 Response VO")
-@Data
-public class BpmModelRespVO {
-
- @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
- private String id;
-
- @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "process_yudao")
- private String key;
-
- @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
- private String name;
-
- @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg")
- private String icon;
-
- @Schema(description = "流程描述", example = "我是描述")
- private String description;
-
- @Schema(description = "流程分类编码", example = "1")
- private String category;
- @Schema(description = "流程分类名字", example = "请假")
- private String categoryName;
-
- @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1")
- private Integer formType;
-
- @Schema(description = "表单编号", example = "1024")
- private Long formId; // 在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空
- @Schema(description = "表单名字", example = "请假表单")
- private String formName;
-
- @Schema(description = "自定义表单的提交路径", example = "/bpm/oa/leave/create")
- private String formCustomCreatePath; // 使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空
- @Schema(description = "自定义表单的查看路径", example = "/bpm/oa/leave/view")
- private String formCustomViewPath; // ,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空
-
- @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
- private LocalDateTime createTime;
-
- @Schema(description = "BPMN XML", requiredMode = Schema.RequiredMode.REQUIRED)
- private String bpmnXml;
-
- /**
- * 最新部署的流程定义
- */
- private BpmProcessDefinitionRespVO processDefinition;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateReqVO.java
deleted file mode 100644
index 94585af3dee15111aa87a3b9eba6f511449aca90..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateReqVO.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model;
-
-import cn.iocoder.yudao.framework.common.validation.InEnum;
-import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum;
-import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.constraints.NotEmpty;
-import lombok.Data;
-import org.hibernate.validator.constraints.URL;
-
-@Schema(description = "管理后台 - 流程模型的更新 Request VO")
-@Data
-public class BpmModelUpdateReqVO {
-
- @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
- @NotEmpty(message = "编号不能为空")
- private String id;
-
- @Schema(description = "流程名称", example = "芋道")
- private String name;
-
- @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg")
- @URL(message = "流程图标格式不正确")
- private String icon;
-
- @Schema(description = "流程描述", example = "我是描述")
- private String description;
-
- @Schema(description = "流程分类", example = "1")
- private String category;
-
- @Schema(description = "BPMN XML", requiredMode = Schema.RequiredMode.REQUIRED)
- private String bpmnXml;
-
- @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1")
- @InEnum(BpmModelFormTypeEnum.class)
- private Integer formType;
- @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024")
- private Long formId;
- @Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空",
- example = "/bpm/oa/leave/create")
- private String formCustomCreatePath;
- @Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空",
- example = "/bpm/oa/leave/view")
- private String formCustomViewPath;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateStateReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateStateReqVO.java
deleted file mode 100644
index 7c5a356a24788ca689c9eacba962af6c6baab314..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelUpdateStateReqVO.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import jakarta.validation.constraints.NotNull;
-
-@Schema(description = "管理后台 - 流程模型更新状态 Request VO")
-@Data
-public class BpmModelUpdateStateReqVO {
-
- @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
- @NotNull(message = "编号不能为空")
- private String id;
-
- @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- @NotNull(message = "状态不能为空")
- private Integer state; // 参见 Flowable SuspensionState 枚举
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageReqVO.java
deleted file mode 100644
index 828654f1e7f49dcc38dffc29ced13ccbc6b14e04..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageReqVO.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-@Schema(description = "管理后台 - 流程定义分页 Request VO")
-@Data
-public class BpmProcessDefinitionPageReqVO extends PageParam {
-
- @Schema(description = "标识-精准匹配", example = "process1641042089407")
- private String key;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionRespVO.java
deleted file mode 100644
index 2fb8dd4dcb07fb2bd64eff24e9fbd9372883fea6..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionRespVO.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-@Schema(description = "管理后台 - 流程定义 Response VO")
-@Data
-public class BpmProcessDefinitionRespVO {
-
- @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
- private String id;
-
- @Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer version;
-
- @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
- private String name;
-
- @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao")
- private String key;
-
- @Schema(description = "流程图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/yudao.jpg")
- private String icon;
-
- @Schema(description = "流程描述", example = "我是描述")
- private String description;
-
- @Schema(description = "流程分类", example = "1")
- private String category;
- @Schema(description = "流程分类名字", example = "请假")
- private String categoryName;
-
- @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1")
- private Integer formType;
- @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024")
- private Long formId;
- @Schema(description = "表单名字", example = "请假表单")
- private String formName;
- @Schema(description = "表单的配置-JSON 字符串。在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", requiredMode = Schema.RequiredMode.REQUIRED)
- private String formConf;
- @Schema(description = "表单项的数组-JSON 字符串的数组。在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", requiredMode = Schema.RequiredMode.REQUIRED)
- private List formFields;
- @Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空",
- example = "/bpm/oa/leave/create")
- private String formCustomCreatePath;
- @Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空",
- example = "/bpm/oa/leave/view")
- private String formCustomViewPath;
-
- @Schema(description = "中断状态-参见 SuspensionState 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer suspensionState; // 参见 SuspensionState 枚举
-
- @Schema(description = "部署时间")
- private LocalDateTime deploymentTime; // 需要从对应的 Deployment 读取,非必须返回
-
- @Schema(description = "BPMN XML")
- private String bpmnXml; // 需要从对应的 BpmnModel 读取,非必须返回
-
- @Schema(description = "发起用户需要选择审批人的任务数组")
- private List startUserSelectTasks; // 需要从对应的 BpmnModel 读取,非必须返回
-
- @Schema(description = "BPMN UserTask 用户任务")
- @Data
- public static class UserTask {
-
- @Schema(description = "任务标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "sudo")
- private String id;
-
- @Schema(description = "任务名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
- private String name;
-
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/BpmOALeaveController.http b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/BpmOALeaveController.http
deleted file mode 100644
index 96bbf964db2ef2b10dedc07eeed59cd0e7014503..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/BpmOALeaveController.http
+++ /dev/null
@@ -1,12 +0,0 @@
-### 请求 /bpm/oa/leave/create 接口 => 成功
-POST {{baseUrl}}/bpm/oa/leave/create
-Content-Type: application/json
-tenant-id: 1
-Authorization: Bearer {{token}}
-
-{
- "startTime": "2022-03-01",
- "endTime": "2022-03-05",
- "type": 1,
- "reason": "我要请假啦啦啦!"
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/BpmOALeaveController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/BpmOALeaveController.java
deleted file mode 100644
index 14474945064067ea0b20a12f95d91a49319f9efb..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/BpmOALeaveController.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.oa;
-
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOALeaveCreateReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOALeavePageReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOALeaveRespVO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALeaveDO;
-import cn.iocoder.yudao.module.bpm.service.oa.BpmOALeaveService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
-
-/**
- * OA 请假申请 Controller,用于演示自己存储数据,接入工作流的例子
- *
- * @author jason
- * @author 芋道源码
- */
-@Tag(name = "管理后台 - OA 请假申请")
-@RestController
-@RequestMapping("/bpm/oa/leave")
-@Validated
-public class BpmOALeaveController {
-
- @Resource
- private BpmOALeaveService leaveService;
-
- @PostMapping("/create")
- @PreAuthorize("@ss.hasPermission('bpm:oa-leave:create')")
- @Operation(summary = "创建请求申请")
- public CommonResult createLeave(@Valid @RequestBody BpmOALeaveCreateReqVO createReqVO) {
- return success(leaveService.createLeave(getLoginUserId(), createReqVO));
- }
-
- @GetMapping("/get")
- @PreAuthorize("@ss.hasPermission('bpm:oa-leave:query')")
- @Operation(summary = "获得请假申请")
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
- public CommonResult getLeave(@RequestParam("id") Long id) {
- BpmOALeaveDO leave = leaveService.getLeave(id);
- return success(BeanUtils.toBean(leave, BpmOALeaveRespVO.class));
- }
-
- @GetMapping("/page")
- @PreAuthorize("@ss.hasPermission('bpm:oa-leave:query')")
- @Operation(summary = "获得请假申请分页")
- public CommonResult> getLeavePage(@Valid BpmOALeavePageReqVO pageVO) {
- PageResult pageResult = leaveService.getLeavePage(getLoginUserId(), pageVO);
- return success(BeanUtils.toBean(pageResult, BpmOALeaveRespVO.class));
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/package-info.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/package-info.java
deleted file mode 100644
index 7028708b1eb0a9cfeeefe203244ac0deb3ec8847..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * OA 示例,用于演示外部业务接入 BPM 工作流的示例
- * 一般的接入方式,只需要调用 接口,后续 Admin 用户在管理后台的【待办事务】进行审批
- */
-package cn.iocoder.yudao.module.bpm.controller.admin.oa;
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java
deleted file mode 100644
index 856a225477b27a2db2af2c364b5372dee6eccad4..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.constraints.AssertTrue;
-import jakarta.validation.constraints.NotNull;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDateTime;
-import java.util.List;
-import java.util.Map;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@Schema(description = "管理后台 - 请假申请创建 Request VO")
-@Data
-public class BpmOALeaveCreateReqVO {
-
- @Schema(description = "请假的开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotNull(message = "开始时间不能为空")
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- private LocalDateTime startTime;
-
- @Schema(description = "请假的结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
- @NotNull(message = "结束时间不能为空")
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- private LocalDateTime endTime;
-
- @Schema(description = "请假类型-参见 bpm_oa_type 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer type;
-
- @Schema(description = "原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "阅读芋道源码")
- private String reason;
-
- @Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}")
- private Map> startUserSelectAssignees;
-
- @AssertTrue(message = "结束时间,需要在开始时间之后")
- public boolean isEndTimeValid() {
- return !getEndTime().isBefore(getStartTime());
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeavePageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeavePageReqVO.java
deleted file mode 100644
index 3777564b4ab79431736c65987d74b3c55249490d..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeavePageReqVO.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalDateTime;
-
-import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-
-@Schema(description = "管理后台 - 请假申请分页 Request VO")
-@Data
-public class BpmOALeavePageReqVO extends PageParam {
-
- @Schema(description = "状态", example = "1")
- private Integer status; // 参见 BpmProcessInstanceResultEnum 枚举
-
- @Schema(description = "请假类型,参见 bpm_oa_type", example = "1")
- private Integer type;
-
- @Schema(description = "原因,模糊匹配", example = "阅读芋道源码")
- private String reason;
-
- @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
- @Schema(description = "申请时间")
- private LocalDateTime[] createTime;
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java
deleted file mode 100644
index dbfe9d90f3365893f83b3b79051b89f6ddb6426c..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-@Schema(description = "管理后台 - 请假申请 Response VO")
-@Data
-public class BpmOALeaveRespVO {
-
- @Schema(description = "请假表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
- private Long id;
-
- @Schema(description = "请假类型,参见 bpm_oa_type 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer type;
-
- @Schema(description = "原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "阅读芋道源码")
- private String reason;
-
- @Schema(description = "申请时间", requiredMode = Schema.RequiredMode.REQUIRED)
- private LocalDateTime createTime;
-
- @Schema(description = "请假的开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
- private LocalDateTime startTime;
-
- @Schema(description = "请假的结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
- private LocalDateTime endTime;
-
- @Schema(description = "流程编号")
- private String processInstanceId;
-
- @Schema(description = "审批结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
- private Integer status; // 参见 BpmProcessInstanceStatusEnum 枚举
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmActivityController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmActivityController.java
deleted file mode 100644
index 8e7e76a3e168d9b297c1d9f49e788273f5712c9c..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmActivityController.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.task;
-
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.activity.BpmActivityRespVO;
-import cn.iocoder.yudao.module.bpm.service.task.BpmActivityService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import jakarta.annotation.Resource;
-import java.util.List;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-
-@Tag(name = "管理后台 - 流程活动实例")
-@RestController
-@RequestMapping("/bpm/activity")
-@Validated
-public class BpmActivityController {
-
- @Resource
- private BpmActivityService activityService;
-
- @GetMapping("/list")
- @Operation(summary = "生成指定流程实例的高亮流程图",
- description = "只高亮进行中的任务。不过要注意,该接口暂时没用,通过前端的 ProcessViewer.vue 界面的 highlightDiagram 方法生成")
- @Parameter(name = "processInstanceId", description = "流程实例的编号", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:task:query')")
- public CommonResult> getActivityList(
- @RequestParam("processInstanceId") String processInstanceId) {
- return success(activityService.getActivityListByProcessInstanceId(processInstanceId));
- }
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java
deleted file mode 100644
index 50fbc9fa8b9d7cf5c36fdc766b9fee9f73deebaf..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.task;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCancelReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCreateReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstancePageReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceRespVO;
-import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
-import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmCategoryService;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
-import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
-import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
-import cn.iocoder.yudao.module.system.api.dept.DeptApi;
-import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
-import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
-import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.flowable.engine.history.HistoricProcessInstance;
-import org.flowable.engine.repository.ProcessDefinition;
-import org.flowable.task.api.Task;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Map;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
-import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
-
-@Tag(name = "管理后台 - 流程实例") // 流程实例,通过流程定义创建的一次“申请”
-@RestController
-@RequestMapping("/bpm/process-instance")
-@Validated
-public class BpmProcessInstanceController {
-
- @Resource
- private BpmProcessInstanceService processInstanceService;
- @Resource
- private BpmTaskService taskService;
- @Resource
- private BpmProcessDefinitionService processDefinitionService;
- @Resource
- private BpmCategoryService categoryService;
-
- @Resource
- private AdminUserApi adminUserApi;
- @Resource
- private DeptApi deptApi;
-
- @GetMapping("/my-page")
- @Operation(summary = "获得我的实例分页列表", description = "在【我的流程】菜单中,进行调用")
- @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
- public CommonResult> getProcessInstanceMyPage(
- @Valid BpmProcessInstancePageReqVO pageReqVO) {
- PageResult pageResult = processInstanceService.getProcessInstancePage(
- getLoginUserId(), pageReqVO);
- if (CollUtil.isEmpty(pageResult.getList())) {
- return success(PageResult.empty(pageResult.getTotal()));
- }
-
- // 拼接返回
- Map> taskMap = taskService.getTaskMapByProcessInstanceIds(
- convertList(pageResult.getList(), HistoricProcessInstance::getId));
- Map processDefinitionMap = processDefinitionService.getProcessDefinitionMap(
- convertSet(pageResult.getList(), HistoricProcessInstance::getProcessDefinitionId));
- Map categoryMap = categoryService.getCategoryMap(
- convertSet(processDefinitionMap.values(), ProcessDefinition::getCategory));
- return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstancePage(pageResult,
- processDefinitionMap, categoryMap, taskMap, null, null));
- }
-
- @GetMapping("/manager-page")
- @Operation(summary = "获得管理流程实例的分页列表", description = "在【流程实例】菜单中,进行调用")
- @PreAuthorize("@ss.hasPermission('bpm:process-instance:manager-query')")
- public CommonResult> getProcessInstanceManagerPage(
- @Valid BpmProcessInstancePageReqVO pageReqVO) {
- PageResult pageResult = processInstanceService.getProcessInstancePage(
- null, pageReqVO);
- if (CollUtil.isEmpty(pageResult.getList())) {
- return success(PageResult.empty(pageResult.getTotal()));
- }
-
- // 拼接返回
- Map> taskMap = taskService.getTaskMapByProcessInstanceIds(
- convertList(pageResult.getList(), HistoricProcessInstance::getId));
- Map processDefinitionMap = processDefinitionService.getProcessDefinitionMap(
- convertSet(pageResult.getList(), HistoricProcessInstance::getProcessDefinitionId));
- Map categoryMap = categoryService.getCategoryMap(
- convertSet(processDefinitionMap.values(), ProcessDefinition::getCategory));
- // 发起人信息
- Map userMap = adminUserApi.getUserMap(
- convertSet(pageResult.getList(), processInstance -> NumberUtils.parseLong(processInstance.getStartUserId())));
- Map deptMap = deptApi.getDeptMap(
- convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
- return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstancePage(pageResult,
- processDefinitionMap, categoryMap, taskMap, userMap, deptMap));
- }
-
- @PostMapping("/create")
- @Operation(summary = "新建流程实例")
- @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
- public CommonResult createProcessInstance(@Valid @RequestBody BpmProcessInstanceCreateReqVO createReqVO) {
- return success(processInstanceService.createProcessInstance(getLoginUserId(), createReqVO));
- }
-
- @GetMapping("/get")
- @Operation(summary = "获得指定流程实例", description = "在【流程详细】界面中,进行调用")
- @Parameter(name = "id", description = "流程实例的编号", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
- public CommonResult getProcessInstance(@RequestParam("id") String id) {
- HistoricProcessInstance processInstance = processInstanceService.getHistoricProcessInstance(id);
- if (processInstance == null) {
- return success(null);
- }
-
- // 拼接返回
- ProcessDefinition processDefinition = processDefinitionService.getProcessDefinition(
- processInstance.getProcessDefinitionId());
- BpmProcessDefinitionInfoDO processDefinitionInfo = processDefinitionService.getProcessDefinitionInfo(
- processInstance.getProcessDefinitionId());
- String bpmnXml = BpmnModelUtils.getBpmnXml(
- processDefinitionService.getProcessDefinitionBpmnModel(processInstance.getProcessDefinitionId()));
- AdminUserRespDTO startUser = adminUserApi.getUser(NumberUtils.parseLong(processInstance.getStartUserId()));
- DeptRespDTO dept = null;
- if (startUser != null) {
- dept = deptApi.getDept(startUser.getDeptId());
- }
- return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstance(processInstance,
- processDefinition, processDefinitionInfo, bpmnXml, startUser, dept));
- }
-
- @DeleteMapping("/cancel-by-start-user")
- @Operation(summary = "用户取消流程实例", description = "取消发起的流程")
- @PreAuthorize("@ss.hasPermission('bpm:process-instance:cancel')")
- public CommonResult cancelProcessInstanceByStartUser(
- @Valid @RequestBody BpmProcessInstanceCancelReqVO cancelReqVO) {
- processInstanceService.cancelProcessInstanceByStartUser(getLoginUserId(), cancelReqVO);
- return success(true);
- }
-
- @DeleteMapping("/cancel-by-admin")
- @Operation(summary = "管理员取消流程实例", description = "管理员撤回流程")
- @PreAuthorize("@ss.hasPermission('bpm:process-instance:cancel-by-admin')")
- public CommonResult cancelProcessInstanceByManager(
- @Valid @RequestBody BpmProcessInstanceCancelReqVO cancelReqVO) {
- processInstanceService.cancelProcessInstanceByAdmin(getLoginUserId(), cancelReqVO);
- return success(true);
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceCopyController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceCopyController.java
deleted file mode 100644
index e9f0eb4441b6fe2f74220dffb8831d20f13bf50a..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceCopyController.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.task;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
-import cn.iocoder.yudao.framework.common.util.date.DateUtils;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.cc.BpmProcessInstanceCopyRespVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCopyPageReqVO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceCopyDO;
-import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceCopyService;
-import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
-import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
-import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
-import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.flowable.engine.history.HistoricProcessInstance;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.Map;
-import java.util.stream.Stream;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
-import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
-
-@Tag(name = "管理后台 - 流程实例抄送")
-@RestController
-@RequestMapping("/bpm/process-instance/copy")
-@Validated
-public class BpmProcessInstanceCopyController {
-
- @Resource
- private BpmProcessInstanceCopyService processInstanceCopyService;
- @Resource
- private BpmProcessInstanceService processInstanceService;
- @Resource
- private BpmTaskService taskService;
-
- @Resource
- private AdminUserApi adminUserApi;
-
- @GetMapping("/page")
- @Operation(summary = "获得抄送流程分页列表")
- @PreAuthorize("@ss.hasPermission('bpm:process-instance-cc:query')")
- public CommonResult> getProcessInstanceCopyPage(
- @Valid BpmProcessInstanceCopyPageReqVO pageReqVO) {
- PageResult pageResult = processInstanceCopyService.getProcessInstanceCopyPage(
- getLoginUserId(), pageReqVO);
- if (CollUtil.isEmpty(pageResult.getList())) {
- return success(new PageResult<>(pageResult.getTotal()));
- }
-
- // 拼接返回
- Map taskNameMap = taskService.getTaskNameByTaskIds(
- convertSet(pageResult.getList(), BpmProcessInstanceCopyDO::getTaskId));
- Map processInstanceMap = processInstanceService.getHistoricProcessInstanceMap(
- convertSet(pageResult.getList(), BpmProcessInstanceCopyDO::getProcessInstanceId));
- Map userMap = adminUserApi.getUserMap(convertListByFlatMap(pageResult.getList(),
- copy -> Stream.of(copy.getStartUserId(), Long.parseLong(copy.getCreator()))));
- return success(BeanUtils.toBean(pageResult, BpmProcessInstanceCopyRespVO.class, copyVO -> {
- MapUtils.findAndThen(userMap, Long.valueOf(copyVO.getCreator()), user -> copyVO.setCreatorName(user.getNickname()));
- MapUtils.findAndThen(userMap, copyVO.getStartUserId(), user -> copyVO.setStartUserName(user.getNickname()));
- MapUtils.findAndThen(taskNameMap, copyVO.getTaskId(), copyVO::setTaskName);
- MapUtils.findAndThen(processInstanceMap, copyVO.getProcessInstanceId(),
- processInstance -> copyVO.setProcessInstanceStartTime(DateUtils.of(processInstance.getStartTime())));
- }));
- }
-
-}
diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmTaskController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmTaskController.java
deleted file mode 100644
index 70eb0f5e3d0877056a5181a8ac73fc4a56172cae..0000000000000000000000000000000000000000
--- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmTaskController.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package cn.iocoder.yudao.module.bpm.controller.admin.task;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
-import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*;
-import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO;
-import cn.iocoder.yudao.module.bpm.service.definition.BpmFormService;
-import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
-import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
-import cn.iocoder.yudao.module.system.api.dept.DeptApi;
-import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
-import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
-import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.annotation.Resource;
-import jakarta.validation.Valid;
-import org.flowable.bpmn.model.UserTask;
-import org.flowable.engine.history.HistoricProcessInstance;
-import org.flowable.engine.runtime.ProcessInstance;
-import org.flowable.task.api.Task;
-import org.flowable.task.api.history.HistoricTaskInstance;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Stream;
-
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
-import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
-
-@Tag(name = "管理后台 - 流程任务实例")
-@RestController
-@RequestMapping("/bpm/task")
-@Validated
-public class BpmTaskController {
-
- @Resource
- private BpmTaskService taskService;
- @Resource
- private BpmProcessInstanceService processInstanceService;
- @Resource
- private BpmFormService formService;
-
- @Resource
- private AdminUserApi adminUserApi;
- @Resource
- private DeptApi deptApi;
-
- @GetMapping("todo-page")
- @Operation(summary = "获取 Todo 待办任务分页")
- @PreAuthorize("@ss.hasPermission('bpm:task:query')")
- public CommonResult> getTaskTodoPage(@Valid BpmTaskPageReqVO pageVO) {
- PageResult pageResult = taskService.getTaskTodoPage(getLoginUserId(), pageVO);
- if (CollUtil.isEmpty(pageResult.getList())) {
- return success(PageResult.empty());
- }
-
- // 拼接数据
- Map processInstanceMap = processInstanceService.getProcessInstanceMap(
- convertSet(pageResult.getList(), Task::getProcessInstanceId));
- Map userMap = adminUserApi.getUserMap(
- convertSet(processInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId())));
- return success(BpmTaskConvert.INSTANCE.buildTodoTaskPage(pageResult, processInstanceMap, userMap));
- }
-
- @GetMapping("done-page")
- @Operation(summary = "获取 Done 已办任务分页")
- @PreAuthorize("@ss.hasPermission('bpm:task:query')")
- public CommonResult> getTaskDonePage(@Valid BpmTaskPageReqVO pageVO) {
- PageResult pageResult = taskService.getTaskDonePage(getLoginUserId(), pageVO);
- if (CollUtil.isEmpty(pageResult.getList())) {
- return success(PageResult.empty());
- }
-
- // 拼接数据
- Map processInstanceMap = processInstanceService.getHistoricProcessInstanceMap(
- convertSet(pageResult.getList(), HistoricTaskInstance::getProcessInstanceId));
- Map userMap = adminUserApi.getUserMap(
- convertSet(processInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId())));
- return success(BpmTaskConvert.INSTANCE.buildTaskPage(pageResult, processInstanceMap, userMap, null));
- }
-
- @GetMapping("manager-page")
- @Operation(summary = "获取全部任务的分页", description = "用于【流程任务】菜单")
- @PreAuthorize("@ss.hasPermission('bpm:task:mananger-query')")
- public CommonResult> getTaskManagerPage(@Valid BpmTaskPageReqVO pageVO) {
- PageResult pageResult = taskService.getTaskPage(getLoginUserId(), pageVO);
- if (CollUtil.isEmpty(pageResult.getList())) {
- return success(PageResult.empty());
- }
-
- // 拼接数据
- Map processInstanceMap = processInstanceService.getHistoricProcessInstanceMap(
- convertSet(pageResult.getList(), HistoricTaskInstance::getProcessInstanceId));
- // 获得 User 和 Dept Map
- Set userIds = convertSet(processInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId()));
- userIds.addAll(convertSet(pageResult.getList(), task -> NumberUtils.parseLong(task.getAssignee())));
- Map userMap = adminUserApi.getUserMap(userIds);
- Map deptMap = deptApi.getDeptMap(
- convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
- return success(BpmTaskConvert.INSTANCE.buildTaskPage(pageResult, processInstanceMap, userMap, deptMap));
- }
-
- @GetMapping("/list-by-process-instance-id")
- @Operation(summary = "获得指定流程实例的任务列表", description = "包括完成的、未完成的")
- @Parameter(name = "processInstanceId", description = "流程实例的编号", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:task:query')")
- public CommonResult> getTaskListByProcessInstanceId(
- @RequestParam("processInstanceId") String processInstanceId) {
- List taskList = taskService.getTaskListByProcessInstanceId(processInstanceId);
- if (CollUtil.isEmpty(taskList)) {
- return success(Collections.emptyList());
- }
-
- // 拼接数据
- HistoricProcessInstance processInstance = processInstanceService.getHistoricProcessInstance(processInstanceId);
- // 获得 User 和 Dept Map
- Set userIds = convertSetByFlatMap(taskList, task ->
- Stream.of(NumberUtils.parseLong(task.getAssignee()), NumberUtils.parseLong(task.getOwner())));
- userIds.add(NumberUtils.parseLong(processInstance.getStartUserId()));
- Map userMap = adminUserApi.getUserMap(userIds);
- Map deptMap = deptApi.getDeptMap(
- convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
- // 获得 Form Map
- Map formMap = formService.getFormMap(
- convertSet(taskList, task -> NumberUtils.parseLong(task.getFormKey())));
- return success(BpmTaskConvert.INSTANCE.buildTaskListByProcessInstanceId(taskList, processInstance,
- formMap, userMap, deptMap));
- }
-
- @PutMapping("/approve")
- @Operation(summary = "通过任务")
- @PreAuthorize("@ss.hasPermission('bpm:task:update')")
- public CommonResult approveTask(@Valid @RequestBody BpmTaskApproveReqVO reqVO) {
- taskService.approveTask(getLoginUserId(), reqVO);
- return success(true);
- }
-
- @PutMapping("/reject")
- @Operation(summary = "不通过任务")
- @PreAuthorize("@ss.hasPermission('bpm:task:update')")
- public CommonResult rejectTask(@Valid @RequestBody BpmTaskRejectReqVO reqVO) {
- taskService.rejectTask(getLoginUserId(), reqVO);
- return success(true);
- }
-
- @GetMapping("/list-by-return")
- @Operation(summary = "获取所有可回退的节点", description = "用于【流程详情】的【回退】按钮")
- @Parameter(name = "taskId", description = "当前任务ID", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:task:update')")
- public CommonResult> getTaskListByReturn(@RequestParam("id") String id) {
- List userTaskList = taskService.getUserTaskListByReturn(id);
- return success(convertList(userTaskList, userTask -> // 只返回 id 和 name
- new BpmTaskRespVO().setName(userTask.getName()).setTaskDefinitionKey(userTask.getId())));
- }
-
- @PutMapping("/return")
- @Operation(summary = "回退任务", description = "用于【流程详情】的【回退】按钮")
- @PreAuthorize("@ss.hasPermission('bpm:task:update')")
- public CommonResult returnTask(@Valid @RequestBody BpmTaskReturnReqVO reqVO) {
- taskService.returnTask(getLoginUserId(), reqVO);
- return success(true);
- }
-
- @PutMapping("/delegate")
- @Operation(summary = "委派任务", description = "用于【流程详情】的【委派】按钮")
- @PreAuthorize("@ss.hasPermission('bpm:task:update')")
- public CommonResult delegateTask(@Valid @RequestBody BpmTaskDelegateReqVO reqVO) {
- taskService.delegateTask(getLoginUserId(), reqVO);
- return success(true);
- }
-
- @PutMapping("/transfer")
- @Operation(summary = "转派任务", description = "用于【流程详情】的【转派】按钮")
- @PreAuthorize("@ss.hasPermission('bpm:task:update')")
- public CommonResult transferTask(@Valid @RequestBody BpmTaskTransferReqVO reqVO) {
- taskService.transferTask(getLoginUserId(), reqVO);
- return success(true);
- }
-
- @PutMapping("/create-sign")
- @Operation(summary = "加签", description = "before 前加签,after 后加签")
- @PreAuthorize("@ss.hasPermission('bpm:task:update')")
- public CommonResult createSignTask(@Valid @RequestBody BpmTaskSignCreateReqVO reqVO) {
- taskService.createSignTask(getLoginUserId(), reqVO);
- return success(true);
- }
-
- @DeleteMapping("/delete-sign")
- @Operation(summary = "减签")
- @PreAuthorize("@ss.hasPermission('bpm:task:update')")
- public CommonResult deleteSignTask(@Valid @RequestBody BpmTaskSignDeleteReqVO reqVO) {
- taskService.deleteSignTask(getLoginUserId(), reqVO);
- return success(true);
- }
-
- @GetMapping("/list-by-parent-task-id")
- @Operation(summary = "获得指定父级任务的子任务列表") // 目前用于,减签的时候,获得子任务列表
- @Parameter(name = "parentTaskId", description = "父级任务编号", required = true)
- @PreAuthorize("@ss.hasPermission('bpm:task:query')")
- public CommonResult> getTaskListByParentTaskId(@RequestParam("parentTaskId") String parentTaskId) {
- List taskList = taskService.getTaskListByParentTaskId(parentTaskId);
- if (CollUtil.isEmpty(taskList)) {
- return success(Collections.emptyList());
- }
- // 拼接数据
- Map userMap = adminUserApi.getUserMap(convertSetByFlatMap(taskList,
- user -> Stream.of(NumberUtils.parseLong(user.getAssignee()), NumberUtils.parseLong(user.getOwner()))));
- Map