forked from github/dataease
Merge pull request #7901 from dataease/pr@dev-v2@perf_xpack_log
perf(X-Pack): 日志模块使用异步线程避免与主线程事务相互影响
This commit is contained in:
commit
7af660508c
@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import io.dataease.api.ds.vo.DatasourceDTO;
|
||||
import io.dataease.commons.constants.OptConstants;
|
||||
import io.dataease.constant.DataSourceType;
|
||||
import io.dataease.constant.LogOT;
|
||||
import io.dataease.constant.LogST;
|
||||
import io.dataease.datasource.dao.auto.entity.CoreDatasource;
|
||||
import io.dataease.datasource.dao.auto.mapper.CoreDatasourceMapper;
|
||||
import io.dataease.datasource.dao.ext.mapper.DataSourceExtMapper;
|
||||
@ -14,7 +12,6 @@ import io.dataease.datasource.dao.ext.po.DataSourceNodePO;
|
||||
import io.dataease.datasource.dto.DatasourceNodeBO;
|
||||
import io.dataease.exception.DEException;
|
||||
import io.dataease.license.config.XpackInteract;
|
||||
import io.dataease.log.DeLog;
|
||||
import io.dataease.model.BusiNodeRequest;
|
||||
import io.dataease.model.BusiNodeVO;
|
||||
import io.dataease.operation.manage.CoreOptRecentManage;
|
||||
@ -73,14 +70,14 @@ public class DataSourceManage {
|
||||
return TreeUtils.mergeTree(nodes, BusiNodeVO.class, false);
|
||||
}
|
||||
|
||||
@DeLog(id = "#p0.id", pid = "#p0.pid", ot = LogOT.CREATE, st = LogST.DATASOURCE)
|
||||
|
||||
@XpackInteract(value = "datasourceResourceTree", before = false)
|
||||
public void innerSave(CoreDatasource coreDatasource) {
|
||||
coreDatasourceMapper.insert(coreDatasource);
|
||||
coreOptRecentManage.saveOpt(coreDatasource.getId(), OptConstants.OPT_RESOURCE_TYPE.DATASOURCE, OptConstants.OPT_TYPE.NEW);
|
||||
}
|
||||
|
||||
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASOURCE)
|
||||
|
||||
@XpackInteract(value = "datasourceResourceTree", before = false)
|
||||
public void innerEdit(CoreDatasource coreDatasource) {
|
||||
UpdateWrapper<CoreDatasource> updateWrapper = new UpdateWrapper<>();
|
||||
@ -91,7 +88,7 @@ public class DataSourceManage {
|
||||
coreOptRecentManage.saveOpt(coreDatasource.getId(), OptConstants.OPT_RESOURCE_TYPE.DATASOURCE, OptConstants.OPT_TYPE.UPDATE);
|
||||
}
|
||||
|
||||
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASOURCE)
|
||||
|
||||
@XpackInteract(value = "datasourceResourceTree", before = false)
|
||||
public void innerEditStatus(CoreDatasource coreDatasource) {
|
||||
UpdateWrapper<CoreDatasource> updateWrapper = new UpdateWrapper<>();
|
||||
@ -99,7 +96,7 @@ public class DataSourceManage {
|
||||
coreDatasourceMapper.update(coreDatasource, updateWrapper);
|
||||
}
|
||||
|
||||
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASOURCE)
|
||||
|
||||
@XpackInteract(value = "datasourceResourceTree", before = false)
|
||||
public void move(DatasourceDTO dataSourceDTO) {
|
||||
Long id = dataSourceDTO.getId();
|
||||
|
@ -188,6 +188,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
return hasRepeat;
|
||||
}
|
||||
|
||||
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASOURCE)
|
||||
@Transactional
|
||||
public DatasourceDTO move(DatasourceDTO dataSourceDTO) {
|
||||
if (dataSourceDTO.getPid() == null) {
|
||||
@ -218,6 +219,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
return dataSourceDTO;
|
||||
}
|
||||
|
||||
@DeLog(id = "#p0.id", pid = "#p0.pid", ot = LogOT.CREATE, st = LogST.DATASOURCE)
|
||||
@Transactional
|
||||
public DatasourceDTO createFolder(DatasourceDTO dataSourceDTO) {
|
||||
dataSourceDTO.setCreateTime(System.currentTimeMillis());
|
||||
@ -232,6 +234,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
return dataSourceDTO;
|
||||
}
|
||||
|
||||
@DeLog(id = "#p0.id", pid = "#p0.pid", ot = LogOT.CREATE, st = LogST.DATASOURCE)
|
||||
@Transactional
|
||||
@Override
|
||||
public DatasourceDTO save(DatasourceDTO dataSourceDTO) throws DEException {
|
||||
@ -311,6 +314,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
return dataSourceDTO;
|
||||
}
|
||||
|
||||
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASOURCE)
|
||||
@Transactional
|
||||
@Override
|
||||
public DatasourceDTO update(DatasourceDTO dataSourceDTO) throws DEException {
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit 51107923868b5d6eb0b05d3f7a28c8b7c5b44591
|
||||
Subproject commit 4889ffa0fcdfebe2755f5f1ce3b371e858abc981
|
45
sdk/common/src/main/java/io/dataease/utils/DeClassUtils.java
Normal file
45
sdk/common/src/main/java/io/dataease/utils/DeClassUtils.java
Normal file
@ -0,0 +1,45 @@
|
||||
package io.dataease.utils;
|
||||
|
||||
public class DeClassUtils {
|
||||
|
||||
public static boolean isPrimitiveOrWrapper(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Class<?> objClass = obj.getClass();
|
||||
for (Class<?> primitiveWrapper : primitiveWrappers) {
|
||||
if (primitiveWrapper.isAssignableFrom(objClass)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return isPrimitive(objClass);
|
||||
}
|
||||
|
||||
private static boolean isPrimitive(Class<?> clazz) {
|
||||
if (clazz.isPrimitive()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String name = clazz.getName();
|
||||
for (String primitiveTypeName : primitiveTypeNames) {
|
||||
if (name.equals(primitiveTypeName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final Class<?>[] primitiveWrappers = {
|
||||
Boolean.class, Character.class, Byte.class, Short.class,
|
||||
Integer.class, Long.class, Float.class, Double.class
|
||||
};
|
||||
|
||||
private static final String[] primitiveTypeNames = {
|
||||
"boolean", "char", "byte", "short",
|
||||
"int", "long", "float", "double"
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user