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.api.ds.vo.DatasourceDTO;
|
||||||
import io.dataease.commons.constants.OptConstants;
|
import io.dataease.commons.constants.OptConstants;
|
||||||
import io.dataease.constant.DataSourceType;
|
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.entity.CoreDatasource;
|
||||||
import io.dataease.datasource.dao.auto.mapper.CoreDatasourceMapper;
|
import io.dataease.datasource.dao.auto.mapper.CoreDatasourceMapper;
|
||||||
import io.dataease.datasource.dao.ext.mapper.DataSourceExtMapper;
|
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.datasource.dto.DatasourceNodeBO;
|
||||||
import io.dataease.exception.DEException;
|
import io.dataease.exception.DEException;
|
||||||
import io.dataease.license.config.XpackInteract;
|
import io.dataease.license.config.XpackInteract;
|
||||||
import io.dataease.log.DeLog;
|
|
||||||
import io.dataease.model.BusiNodeRequest;
|
import io.dataease.model.BusiNodeRequest;
|
||||||
import io.dataease.model.BusiNodeVO;
|
import io.dataease.model.BusiNodeVO;
|
||||||
import io.dataease.operation.manage.CoreOptRecentManage;
|
import io.dataease.operation.manage.CoreOptRecentManage;
|
||||||
@ -73,14 +70,14 @@ public class DataSourceManage {
|
|||||||
return TreeUtils.mergeTree(nodes, BusiNodeVO.class, false);
|
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)
|
@XpackInteract(value = "datasourceResourceTree", before = false)
|
||||||
public void innerSave(CoreDatasource coreDatasource) {
|
public void innerSave(CoreDatasource coreDatasource) {
|
||||||
coreDatasourceMapper.insert(coreDatasource);
|
coreDatasourceMapper.insert(coreDatasource);
|
||||||
coreOptRecentManage.saveOpt(coreDatasource.getId(), OptConstants.OPT_RESOURCE_TYPE.DATASOURCE, OptConstants.OPT_TYPE.NEW);
|
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)
|
@XpackInteract(value = "datasourceResourceTree", before = false)
|
||||||
public void innerEdit(CoreDatasource coreDatasource) {
|
public void innerEdit(CoreDatasource coreDatasource) {
|
||||||
UpdateWrapper<CoreDatasource> updateWrapper = new UpdateWrapper<>();
|
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);
|
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)
|
@XpackInteract(value = "datasourceResourceTree", before = false)
|
||||||
public void innerEditStatus(CoreDatasource coreDatasource) {
|
public void innerEditStatus(CoreDatasource coreDatasource) {
|
||||||
UpdateWrapper<CoreDatasource> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<CoreDatasource> updateWrapper = new UpdateWrapper<>();
|
||||||
@ -99,7 +96,7 @@ public class DataSourceManage {
|
|||||||
coreDatasourceMapper.update(coreDatasource, updateWrapper);
|
coreDatasourceMapper.update(coreDatasource, updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASOURCE)
|
|
||||||
@XpackInteract(value = "datasourceResourceTree", before = false)
|
@XpackInteract(value = "datasourceResourceTree", before = false)
|
||||||
public void move(DatasourceDTO dataSourceDTO) {
|
public void move(DatasourceDTO dataSourceDTO) {
|
||||||
Long id = dataSourceDTO.getId();
|
Long id = dataSourceDTO.getId();
|
||||||
|
@ -188,6 +188,7 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
return hasRepeat;
|
return hasRepeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASOURCE)
|
||||||
@Transactional
|
@Transactional
|
||||||
public DatasourceDTO move(DatasourceDTO dataSourceDTO) {
|
public DatasourceDTO move(DatasourceDTO dataSourceDTO) {
|
||||||
if (dataSourceDTO.getPid() == null) {
|
if (dataSourceDTO.getPid() == null) {
|
||||||
@ -218,6 +219,7 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
return dataSourceDTO;
|
return dataSourceDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeLog(id = "#p0.id", pid = "#p0.pid", ot = LogOT.CREATE, st = LogST.DATASOURCE)
|
||||||
@Transactional
|
@Transactional
|
||||||
public DatasourceDTO createFolder(DatasourceDTO dataSourceDTO) {
|
public DatasourceDTO createFolder(DatasourceDTO dataSourceDTO) {
|
||||||
dataSourceDTO.setCreateTime(System.currentTimeMillis());
|
dataSourceDTO.setCreateTime(System.currentTimeMillis());
|
||||||
@ -232,6 +234,7 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
return dataSourceDTO;
|
return dataSourceDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeLog(id = "#p0.id", pid = "#p0.pid", ot = LogOT.CREATE, st = LogST.DATASOURCE)
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public DatasourceDTO save(DatasourceDTO dataSourceDTO) throws DEException {
|
public DatasourceDTO save(DatasourceDTO dataSourceDTO) throws DEException {
|
||||||
@ -311,6 +314,7 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
return dataSourceDTO;
|
return dataSourceDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASOURCE)
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public DatasourceDTO update(DatasourceDTO dataSourceDTO) throws DEException {
|
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