Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -20,21 +20,21 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.dromara.visor.launch.configuration;
|
package org.dromara.visor.common.configuration;
|
||||||
|
|
||||||
import cn.orionsec.kit.spring.SpringHolder;
|
import cn.orionsec.kit.spring.SpringHolder;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用配置类
|
* spring 配置类
|
||||||
*
|
*
|
||||||
* @author Jiahang Li
|
* @author Jiahang Li
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/6/20 10:34
|
* @since 2023/6/20 10:34
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class LaunchApplicationConfiguration {
|
public class SpringConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return spring 容器工具类
|
* @return spring 容器工具类
|
||||||
@@ -8,7 +8,7 @@ const $vue.moduleConst: AppRouteRecordRaw = {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: '$vue.featureEntityFirstLower',
|
name: '$vue.featureEntityFirstLower',
|
||||||
path: '/$vue.feature',
|
path: '/$vue.module/$vue.feature',
|
||||||
component: () => import('@/views/$vue.module/$vue.feature/index.vue'),
|
component: () => import('@/views/$vue.module/$vue.feature/index.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ package org.dromara.visor.framework.test.core.base;
|
|||||||
|
|
||||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||||
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
||||||
|
import org.dromara.visor.common.configuration.SpringConfiguration;
|
||||||
import org.dromara.visor.framework.datasource.configuration.OrionDataSourceAutoConfiguration;
|
import org.dromara.visor.framework.datasource.configuration.OrionDataSourceAutoConfiguration;
|
||||||
import org.dromara.visor.framework.mybatis.configuration.OrionMybatisAutoConfiguration;
|
import org.dromara.visor.framework.mybatis.configuration.OrionMybatisAutoConfiguration;
|
||||||
import org.dromara.visor.framework.redis.configuration.OrionRedisAutoConfiguration;
|
import org.dromara.visor.framework.redis.configuration.OrionRedisAutoConfiguration;
|
||||||
@@ -57,6 +58,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
public class BaseUnitTest {
|
public class BaseUnitTest {
|
||||||
|
|
||||||
@Import({
|
@Import({
|
||||||
|
// spring
|
||||||
|
SpringConfiguration.class,
|
||||||
// mock
|
// mock
|
||||||
OrionMockBeanTestConfiguration.class,
|
OrionMockBeanTestConfiguration.class,
|
||||||
OrionMockRedisTestConfiguration.class,
|
OrionMockRedisTestConfiguration.class,
|
||||||
@@ -74,7 +77,6 @@ public class BaseUnitTest {
|
|||||||
RedisAutoConfiguration.class,
|
RedisAutoConfiguration.class,
|
||||||
RedissonAutoConfiguration.class,
|
RedissonAutoConfiguration.class,
|
||||||
})
|
})
|
||||||
// TODO
|
|
||||||
public static class Application {
|
public static class Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,11 @@ import java.util.Optional;
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2023/6/19 16:55
|
* @since 2023/6/19 16:55
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(scanBasePackages = {"org.dromara.visor.launch", "org.dromara.visor.module"})
|
@SpringBootApplication(scanBasePackages = {
|
||||||
|
"org.dromara.visor.launch",
|
||||||
|
"org.dromara.visor.common",
|
||||||
|
"org.dromara.visor.module"
|
||||||
|
})
|
||||||
public class LaunchApplication {
|
public class LaunchApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -82,6 +82,10 @@
|
|||||||
<groupId>org.dromara.visor</groupId>
|
<groupId>org.dromara.visor</groupId>
|
||||||
<artifactId>orion-visor-spring-boot-starter-job</artifactId>
|
<artifactId>orion-visor-spring-boot-starter-job</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dromara.visor</groupId>
|
||||||
|
<artifactId>orion-visor-spring-boot-starter-test</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -135,13 +135,6 @@ public interface HostService {
|
|||||||
*/
|
*/
|
||||||
void deleteHostRelByIdListAsync(List<Long> idList);
|
void deleteHostRelByIdListAsync(List<Long> idList);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前更新配置的 hostId
|
|
||||||
*
|
|
||||||
* @return hostId
|
|
||||||
*/
|
|
||||||
Long getCurrentUpdateConfigHostId();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除缓存
|
* 清除缓存
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -83,8 +83,6 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
public class HostServiceImpl implements HostService {
|
public class HostServiceImpl implements HostService {
|
||||||
|
|
||||||
private static final ThreadLocal<Long> CURRENT_UPDATE_CONFIG_ID = new ThreadLocal<>();
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private HostDAO hostDAO;
|
private HostDAO hostDAO;
|
||||||
|
|
||||||
@@ -185,30 +183,25 @@ public class HostServiceImpl implements HostService {
|
|||||||
OperatorLogs.add(ExtraFieldConst.CONFIG, param);
|
OperatorLogs.add(ExtraFieldConst.CONFIG, param);
|
||||||
log.info("HostService-updateHostConfig request: {}", param);
|
log.info("HostService-updateHostConfig request: {}", param);
|
||||||
Long id = request.getId();
|
Long id = request.getId();
|
||||||
try {
|
// 查询主机信息
|
||||||
CURRENT_UPDATE_CONFIG_ID.set(id);
|
HostDO host = hostDAO.selectById(id);
|
||||||
// 查询主机信息
|
Valid.notNull(host, ErrorMessage.HOST_ABSENT);
|
||||||
HostDO host = hostDAO.selectById(id);
|
HostTypeEnum type = Valid.valid(HostTypeEnum::of, host.getType());
|
||||||
Valid.notNull(host, ErrorMessage.HOST_ABSENT);
|
GenericsDataModel beforeConfig = type.parse(host.getConfig());
|
||||||
HostTypeEnum type = Valid.valid(HostTypeEnum::of, host.getType());
|
GenericsDataModel newConfig = type.parse(request.getConfig());
|
||||||
GenericsDataModel beforeConfig = type.parse(host.getConfig());
|
// 添加日志参数
|
||||||
GenericsDataModel newConfig = type.parse(request.getConfig());
|
OperatorLogs.add(OperatorLogs.ID, id);
|
||||||
// 添加日志参数
|
OperatorLogs.add(OperatorLogs.NAME, host.getName());
|
||||||
OperatorLogs.add(OperatorLogs.ID, id);
|
// 更新前校验
|
||||||
OperatorLogs.add(OperatorLogs.NAME, host.getName());
|
type.doValid(beforeConfig, newConfig);
|
||||||
// 更新前校验
|
// 修改配置
|
||||||
type.doValid(beforeConfig, newConfig);
|
HostDO updateHost = HostDO.builder()
|
||||||
// 修改配置
|
.id(id)
|
||||||
HostDO updateHost = HostDO.builder()
|
.config(newConfig.serial())
|
||||||
.id(id)
|
.build();
|
||||||
.config(newConfig.serial())
|
int effect = hostDAO.updateById(updateHost);
|
||||||
.build();
|
log.info("HostService-updateHostConfig effect: {}", effect);
|
||||||
int effect = hostDAO.updateById(updateHost);
|
return effect;
|
||||||
log.info("HostService-updateHostConfig effect: {}", effect);
|
|
||||||
return effect;
|
|
||||||
} finally {
|
|
||||||
CURRENT_UPDATE_CONFIG_ID.remove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -348,11 +341,6 @@ public class HostServiceImpl implements HostService {
|
|||||||
dataExtraApi.deleteByRelIdList(DataExtraTypeEnum.HOST, idList);
|
dataExtraApi.deleteByRelIdList(DataExtraTypeEnum.HOST, idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getCurrentUpdateConfigHostId() {
|
|
||||||
return CURRENT_UPDATE_CONFIG_ID.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearCache() {
|
public void clearCache() {
|
||||||
RedisMaps.scanKeysDelete(HostCacheKeyDefine.HOST_INFO.format("*"));
|
RedisMaps.scanKeysDelete(HostCacheKeyDefine.HOST_INFO.format("*"));
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ const ASSET_AUDIT: AppRouteRecordRaw = {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'connectLog',
|
name: 'connectLog',
|
||||||
path: '/connect-log',
|
path: '/audit/connect-log',
|
||||||
component: () => import('@/views/asset-audit/connect-log/index.vue'),
|
component: () => import('@/views/asset-audit/connect-log/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'connectSession',
|
name: 'connectSession',
|
||||||
path: '/connect-session',
|
path: '/audit/connect-session',
|
||||||
component: () => import('@/views/asset-audit/connect-session/index.vue'),
|
component: () => import('@/views/asset-audit/connect-session/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'sftpLog',
|
name: 'sftpLog',
|
||||||
path: '/sftp-log',
|
path: '/audit/sftp-log',
|
||||||
component: () => import('@/views/asset-audit/sftp-log/index.vue'),
|
component: () => import('@/views/asset-audit/sftp-log/index.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -8,19 +8,19 @@ const ASSET: AppRouteRecordRaw = {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'hostList',
|
name: 'hostList',
|
||||||
path: '/host-list',
|
path: '/asset/host',
|
||||||
component: () => import('@/views/asset/host-list/index.vue'),
|
component: () => import('@/views/asset/host-list/index.vue'),
|
||||||
}, {
|
}, {
|
||||||
name: 'hostKey',
|
name: 'hostKey',
|
||||||
path: '/host-key',
|
path: '/asset/host-key',
|
||||||
component: () => import('@/views/asset/host-key/index.vue'),
|
component: () => import('@/views/asset/host-key/index.vue'),
|
||||||
}, {
|
}, {
|
||||||
name: 'hostIdentity',
|
name: 'hostIdentity',
|
||||||
path: '/host-identity',
|
path: '/asset/host-identity',
|
||||||
component: () => import('@/views/asset/host-identity/index.vue'),
|
component: () => import('@/views/asset/host-identity/index.vue'),
|
||||||
}, {
|
}, {
|
||||||
name: 'assetGrant',
|
name: 'assetGrant',
|
||||||
path: '/asset-grant',
|
path: '/asset/grant',
|
||||||
component: () => import('@/views/asset/grant/index.vue'),
|
component: () => import('@/views/asset/grant/index.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -9,37 +9,37 @@ const EXEC: Array<AppRouteRecordRaw> = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'execCommand',
|
name: 'execCommand',
|
||||||
path: '/exec-command',
|
path: '/exec/command',
|
||||||
component: () => import('@/views/exec/exec-command/index.vue'),
|
component: () => import('@/views/exec/exec-command/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'execCommandLog',
|
name: 'execCommandLog',
|
||||||
path: '/exec-log',
|
path: '/exec/command-log',
|
||||||
component: () => import('@/views/exec/exec-command-log/index.vue'),
|
component: () => import('@/views/exec/exec-command-log/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'execJob',
|
name: 'execJob',
|
||||||
path: '/exec-job',
|
path: '/exec/job',
|
||||||
component: () => import('@/views/exec/exec-job/index.vue'),
|
component: () => import('@/views/exec/exec-job/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'execJobLog',
|
name: 'execJobLog',
|
||||||
path: '/exec-job-log',
|
path: '/exec/job-log',
|
||||||
component: () => import('@/views/exec/exec-job-log/index.vue'),
|
component: () => import('@/views/exec/exec-job-log/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'batchUpload',
|
name: 'batchUpload',
|
||||||
path: '/batch-upload',
|
path: '/exec/upload',
|
||||||
component: () => import('@/views/exec/batch-upload/index.vue'),
|
component: () => import('@/views/exec/batch-upload/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'uploadTask',
|
name: 'uploadTask',
|
||||||
path: '/upload-task',
|
path: '/exec/upload-task',
|
||||||
component: () => import('@/views/exec/upload-task/index.vue'),
|
component: () => import('@/views/exec/upload-task/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'execTemplate',
|
name: 'execTemplate',
|
||||||
path: '/exec-template',
|
path: '/exec/template',
|
||||||
component: () => import('@/views/exec/exec-template/index.vue'),
|
component: () => import('@/views/exec/exec-template/index.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -50,7 +50,7 @@ const EXEC: Array<AppRouteRecordRaw> = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'execJobLogView',
|
name: 'execJobLogView',
|
||||||
path: '/job-log-view',
|
path: '/exec/job-log/view',
|
||||||
component: () => import('@/views/exec/exec-job-log-view/index.vue'),
|
component: () => import('@/views/exec/exec-job-log-view/index.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ const SYSTEM: AppRouteRecordRaw = {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'systemMenu',
|
name: 'systemMenu',
|
||||||
path: '/menu',
|
path: '/system/menu',
|
||||||
component: () => import('@/views/system/menu/index.vue'),
|
component: () => import('@/views/system/menu/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'dictKey',
|
name: 'dictKey',
|
||||||
path: '/dict-key',
|
path: '/system/dict-key',
|
||||||
component: () => import('@/views/system/dict-key/index.vue'),
|
component: () => import('@/views/system/dict-key/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'dictValue',
|
name: 'dictValue',
|
||||||
path: '/dict-value',
|
path: '/system/dict-value',
|
||||||
component: () => import('@/views/system/dict-value/index.vue'),
|
component: () => import('@/views/system/dict-value/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,22 +8,22 @@ const USER: AppRouteRecordRaw = {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'role',
|
name: 'role',
|
||||||
path: '/role',
|
path: '/user/role',
|
||||||
component: () => import('@/views/user/role/index.vue'),
|
component: () => import('@/views/user/role/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'user',
|
name: 'user',
|
||||||
path: '/user',
|
path: '/user/list',
|
||||||
component: () => import('@/views/user/user/index.vue'),
|
component: () => import('@/views/user/user/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'userInfo',
|
name: 'userInfo',
|
||||||
path: '/user-info',
|
path: '/user/info',
|
||||||
component: () => import('@/views/user/info/index.vue'),
|
component: () => import('@/views/user/info/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'operatorLog',
|
name: 'operatorLog',
|
||||||
path: '/operator-log',
|
path: '/user/operator-log',
|
||||||
component: () => import('@/views/user/operator-log/index.vue'),
|
component: () => import('@/views/user/operator-log/index.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user