Merge branch 'dev' into pr@dev_one_dot_x

This commit is contained in:
dataeaseShu 2023-12-19 10:23:30 +08:00
commit ab2af799a5
108 changed files with 600 additions and 438 deletions

View File

@ -1,13 +0,0 @@
on: [push, pull_request, release]
name: DataEase pull request handler
jobs:
generic_handler:
name: Generic handler for DataEase Repos
runs-on: ubuntu-latest
steps:
- name: Add labels
uses: jumpserver/action-generic-handler@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }}

View File

@ -24,6 +24,7 @@ extend-exclude = [
"core/frontend/src/views/chart/components/table/TableNormal.vue",
"core/backend/src/main/java/io/dataease/ext/ExtSysUserMapper.xml",
"core/backend/src/main/java/io/dataease/ext/AuthMapper.xml",
"core/backend/src/main/java/io/dataease/ext/ExtAuthMapper.xml",
"installer/dataease/templates/be.conf"
]

View File

@ -6,6 +6,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
@ -18,7 +19,6 @@ import io.dataease.auth.annotation.DePermissionProxy;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.dto.PermissionProxy;
import io.dataease.exception.DataEaseException;
@Aspect
@Component

View File

@ -2,7 +2,7 @@ package io.dataease.auth.aop;
import cn.hutool.core.util.ArrayUtil;
import io.dataease.auth.annotation.SqlInjectValidator;
import io.dataease.commons.exception.DEException;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.KeywordRequest;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -47,7 +47,7 @@ public class SqlInjectAop {
String[] value = annotation.value();
boolean illegal = isIllegal(value, request.getOrders());
if (illegal) {
DEException.throwException("Illegal sort exp");
DataEaseException.throwException("Illegal sort exp");
}
return point.proceed(args);
} catch (Throwable e) {

View File

@ -1,7 +1,6 @@
package io.dataease.auth.filter;
import cn.hutool.core.util.ArrayUtil;
import com.auth0.jwt.algorithms.Algorithm;
import io.dataease.auth.entity.SysUserEntity;
import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.service.AuthUserService;
@ -10,8 +9,6 @@ import io.dataease.commons.license.DefaultLicenseService;
import io.dataease.commons.license.F2CLicenseResponse;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.commons.utils.LogUtil;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.web.filter.AccessControlFilter;

View File

@ -13,12 +13,11 @@ import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.util.JWTUtils;
import io.dataease.auth.util.RsaUtil;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.*;
import io.dataease.controller.sys.request.LdapAddRequest;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.entity.XpackLdapUserEntity;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.util.PluginUtils;
import io.dataease.plugins.xpack.cas.service.CasXpackService;
@ -328,7 +327,7 @@ public class AuthServer implements AuthApi {
oidcXpackService.logout(idToken);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException("oidc_logout_error");
DataEaseException.throwException("oidc_logout_error");
}
}
}
@ -349,7 +348,7 @@ public class AuthServer implements AuthApi {
result = casXpackService.logout();
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException("cas_logout_error");
DataEaseException.throwException("cas_logout_error");
}
}
try {

View File

@ -8,7 +8,6 @@ import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.constants.ParamConstants;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.LogUtil;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.AuthMapper;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysLoginLimit;
@ -16,6 +15,7 @@ import io.dataease.plugins.common.base.domain.SysLoginLimitExample;
import io.dataease.plugins.common.base.domain.SysUser;
import io.dataease.plugins.common.base.mapper.SysLoginLimitMapper;
import io.dataease.plugins.common.base.mapper.SysUserMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.service.PluginCommonService;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.util.PluginUtils;

View File

@ -11,7 +11,7 @@ import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.entity.TokenInfo.TokenInfoBuilder;
import io.dataease.commons.model.OnlineUserModel;
import io.dataease.commons.utils.*;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.env.Environment;

View File

@ -1,24 +0,0 @@
package io.dataease.commons.exception;
public class DEException extends RuntimeException {
private DEException(String message) {
super(message);
}
private DEException(Throwable t) {
super(t);
}
public static void throwException(String message) {
throw new DEException(message);
}
public static DEException getException(String message) {
throw new DEException(message);
}
public static void throwException(Throwable t) {
throw new DEException(t);
}
}

View File

@ -1,8 +1,8 @@
package io.dataease.commons.filter;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.holder.ThreadLocalContextHolder;
import io.dataease.commons.wrapper.XssAndSqlHttpServletRequestWrapper;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
@ -54,7 +54,7 @@ public class SqlFilter implements Filter {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json;charset=UTF-8");
String msg = ThreadLocalContextHolder.getData().toString();
DEException.throwException(msg);
DataEaseException.throwException(msg);
return;
}
}
@ -63,7 +63,7 @@ public class SqlFilter implements Filter {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json;charset=UTF-8");
String msg = ThreadLocalContextHolder.getData().toString();
DEException.throwException(msg);
DataEaseException.throwException(msg);
return;
}
chain.doFilter(xssRequest, response);

View File

@ -1,9 +1,9 @@
package io.dataease.commons.license;
import com.google.gson.Gson;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.LogUtil;
import io.dataease.plugins.common.base.domain.License;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -103,10 +103,10 @@ public class DefaultLicenseService {
public License readLicense() {
License license = innerLicenseService.getLicense(LICENSE_ID);
if (license == null) {
DEException.throwException("i18n_no_license_record");
DataEaseException.throwException("i18n_no_license_record");
}
if (StringUtils.isBlank(license.getLicense())) {
DEException.throwException("i18n_license_is_empty");
DataEaseException.throwException("i18n_license_is_empty");
}
return license;
}
@ -114,7 +114,7 @@ public class DefaultLicenseService {
// 创建或更新License
private void writeLicense(String licenseKey, F2CLicenseResponse response) {
if (StringUtils.isBlank(licenseKey)) {
DEException.throwException("i18n_license_is_empty");
DataEaseException.throwException("i18n_license_is_empty");
}
License license = new License();
license.setId(LICENSE_ID);

View File

@ -1,6 +1,6 @@
package io.dataease.commons.utils;
import io.dataease.commons.exception.DEException;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.MultipartFile;
@ -47,11 +47,11 @@ public class DeFileUtils {
public static void validateFile(MultipartFile file) {
String name = getFileNameNoEx(file.getOriginalFilename());
if (StringUtils.contains(name, "./")) {
DEException.throwException("file path invalid");
DataEaseException.throwException("file path invalid");
}
String suffix = getExtensionName(file.getOriginalFilename());
if (!StringUtils.equalsIgnoreCase(suffix, "zip")) {
DEException.throwException("please upload valid zip file");
DataEaseException.throwException("please upload valid zip file");
}
}
/**

View File

@ -3,8 +3,7 @@ package io.dataease.commons.utils;
import static io.dataease.commons.constants.StaticResourceConstants.*;
import cn.hutool.core.codec.Base64Encoder;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.lang.NonNull;
import org.springframework.util.Assert;

View File

@ -1,10 +1,10 @@
package io.dataease.controller;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.license.DefaultLicenseService;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.service.panel.PanelLinkService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
@ -74,7 +74,7 @@ public class IndexController {
response.sendRedirect(url);
} catch (IOException e) {
LogUtil.error(e.getMessage());
DEException.throwException(e);
DataEaseException.throwException(e);
}
}
@ -90,7 +90,7 @@ public class IndexController {
response.sendRedirect(url);
} catch (IOException e) {
LogUtil.error(e.getMessage());
DEException.throwException(e);
DataEaseException.throwException(e);
}
}

View File

@ -4,13 +4,13 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.exception.DEException;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.response.ChartViewField4Type;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewField;
import io.dataease.plugins.common.base.domain.DatasetTable;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.service.chart.ChartViewFieldService;
import io.dataease.service.dataset.DataSetTableService;
import io.swagger.annotations.Api;
@ -48,7 +48,7 @@ public class ChartViewFieldController {
BeanUtils.copyProperties(chartViewField, datasetTableField);
dataSetTableService.getPreviewData(dataSetTableRequest, 1, 1, Collections.singletonList(datasetTableField), null);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_calc_field_error"));
DataEaseException.throwException(Translator.get("i18n_calc_field_error"));
}
return chartViewFieldService.save(chartViewField);
}

View File

@ -9,7 +9,6 @@ import io.dataease.auth.annotation.DePermissions;
import io.dataease.auth.filter.F2CLinkFilter;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.exception.DEException;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.dataset.MultFieldValuesRequest;
import io.dataease.controller.response.DatasetTableField4Type;
@ -18,6 +17,7 @@ import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.DatasetTable;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.Datasource;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.datasource.entity.Dateformat;
import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.plugins.xpack.auth.dto.request.ColumnPermissionItem;
@ -167,7 +167,7 @@ public class DataSetTableFieldController {
BeanUtils.copyProperties(datasetTable, dataSetTableRequest);
dataSetTableService.getPreviewData(dataSetTableRequest, 1, 1, Collections.singletonList(datasetTableField), null);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_calc_field_error"));
DataEaseException.throwException(Translator.get("i18n_calc_field_error"));
}
return dataSetTableFieldsService.save(datasetTableField);
}

View File

@ -19,10 +19,6 @@ import io.dataease.dto.DatasourceDTO;
import io.dataease.dto.SysLogDTO;
import io.dataease.dto.datasource.DBTableDTO;
import io.dataease.plugins.common.base.domain.Datasource;
import io.dataease.plugins.common.base.domain.DatasourceExample;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.datasource.provider.Provider;
import io.dataease.provider.ProviderFactory;
import io.dataease.service.datasource.DatasourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -36,7 +32,6 @@ import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
@Api(tags = "数据源:数据源管理")

View File

@ -3,16 +3,19 @@ package io.dataease.controller.datasource;
import io.dataease.auth.annotation.DeLog;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.dto.DriverDTO;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.DeDriver;
import io.dataease.plugins.common.base.domain.DeDriverDetails;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.service.datasource.DriverService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -33,7 +36,7 @@ public class DriverMgmController {
@RequiresPermissions("datasource:read")
@ApiOperation("驱动列表")
@PostMapping("/list")
public List<DriverDTO> listDeDriver() throws Exception{
public List<DriverDTO> listDeDriver() throws Exception {
return driverService.list();
}
@ -47,7 +50,7 @@ public class DriverMgmController {
positionKey = "type",
value = "id"
)
public void delete(@RequestBody DeDriver deDriver) throws Exception{
public void delete(@RequestBody DeDriver deDriver) throws Exception {
checkPermission();
driverService.delete(deDriver);
}
@ -55,8 +58,26 @@ public class DriverMgmController {
@RequiresPermissions("datasource:read")
@ApiOperation("驱动列表")
@GetMapping("/list/{type}")
public List<DriverDTO> listDeDriver(@PathVariable String type) throws Exception{
return listDeDriver().stream().filter(driverDTO -> driverDTO.getType().equalsIgnoreCase(type)).collect(Collectors.toList());
public List<DriverDTO> listDeDriver(@PathVariable String type) throws Exception {
List<DriverDTO> driverDTOS = listDeDriver().stream().filter(driverDTO -> driverDTO.getType().equalsIgnoreCase(type)).collect(Collectors.toList());
DriverDTO driverDTO = new DriverDTO();
driverDTO.setId("default");
driverDTO.setName("default");
driverDTO.setDriverClass("default");
SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values().forEach(dataSourceType -> {
if (dataSourceType.getType().equalsIgnoreCase(type)) {
driverDTO.setSurpportVersions(dataSourceType.getSurpportVersions());
}
});
driverDTOS.add(driverDTO);
driverDTOS.forEach(driverDTO1 -> {
if (StringUtils.isEmpty(driverDTO1.getSurpportVersions())) {
driverDTO1.setNameAlias(driverDTO1.getName());
} else {
driverDTO1.setNameAlias(driverDTO1.getName() + "(" + driverDTO1.getSurpportVersions() + ")");
}
});
return driverDTOS;
}
@RequiresPermissions("datasource:read")
@ -69,7 +90,7 @@ public class DriverMgmController {
positionKey = "type",
value = "id"
)
public DeDriver save(@RequestBody DeDriver deDriver) throws Exception{
public DeDriver save(@RequestBody DeDriver deDriver) throws Exception {
checkPermission();
return driverService.save(deDriver);
}
@ -80,10 +101,10 @@ public class DriverMgmController {
@DeLog(
operatetype = SysLogConstants.OPERATE_TYPE.MODIFY,
sourcetype = SysLogConstants.SOURCE_TYPE.DRIVER,
positionIndex = 0,positionKey = "type",
positionIndex = 0, positionKey = "type",
value = "id"
)
public DeDriver update(@RequestBody DeDriver deDriver) throws Exception{
public DeDriver update(@RequestBody DeDriver deDriver) throws Exception {
checkPermission();
return driverService.update(deDriver);
}
@ -91,7 +112,7 @@ public class DriverMgmController {
@RequiresPermissions("datasource:read")
@ApiOperation("驱动文件列表")
@GetMapping("/listDriverDetails/{id}")
public List<DeDriverDetails> listDriverDetails(@PathVariable String id) throws Exception{
public List<DeDriverDetails> listDriverDetails(@PathVariable String id) throws Exception {
checkPermission();
return driverService.listDriverDetails(id);
}
@ -99,7 +120,7 @@ public class DriverMgmController {
@RequiresPermissions("datasource:read")
@ApiOperation("删除驱动文件")
@PostMapping("/deleteDriverFile")
public void deleteDriverFile(@RequestBody DeDriverDetails deDriverDetails) throws Exception{
public void deleteDriverFile(@RequestBody DeDriverDetails deDriverDetails) throws Exception {
checkPermission();
driverService.deleteDriverFile(deDriverDetails.getId());
}
@ -117,9 +138,9 @@ public class DriverMgmController {
}
private void checkPermission()throws Exception{
if(!AuthUtils.getUser().getIsAdmin()){
DEException.throwException(Translator.get("I18N_NO_DRIVER_PERMISSION"));
private void checkPermission() throws Exception {
if (!AuthUtils.getUser().getIsAdmin()) {
DataEaseException.throwException(Translator.get("I18N_NO_DRIVER_PERMISSION"));
}
}

View File

@ -3,7 +3,7 @@ package io.dataease.controller.sys;
import io.dataease.commons.license.DefaultLicenseService;
import io.dataease.commons.license.F2CLicenseResponse;
import io.dataease.controller.ResultHolder;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.exception.DataEaseException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -12,7 +12,6 @@ import io.dataease.auth.service.AuthUserService;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
@ -21,11 +20,11 @@ import io.dataease.controller.sys.request.*;
import io.dataease.controller.sys.response.AuthBindDTO;
import io.dataease.controller.sys.response.RoleUserItem;
import io.dataease.controller.sys.response.SysUserGridResponse;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysRole;
import io.dataease.plugins.common.base.domain.SysUser;
import io.dataease.plugins.common.base.domain.SysUserAssist;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.KeywordRequest;
import io.dataease.service.sys.SysRoleService;
import io.dataease.service.sys.SysUserService;
@ -72,7 +71,7 @@ public class SysUserController {
public Long transAccount(@RequestBody TransAccountRequest request) {
String account = request.getAccount();
if (StringUtils.isBlank(account)) {
DEException.throwException("account can not be null");
DataEaseException.throwException("account can not be null");
}
return sysUserService.uidByAccount(account);
}
@ -297,7 +296,7 @@ public class SysUserController {
Boolean valid = StringUtils.equals(WECOM, type) || StringUtils.equals(DINGTALK, type) || StringUtils.equals(LARK, type) || StringUtils.equals(LARKSUITE, type);
if (!valid) {
DEException.throwException("only [wecom, dingtalk, lark, larksuite] is valid");
DataEaseException.throwException("only [wecom, dingtalk, lark, larksuite] is valid");
}
Long userId = AuthUtils.getUser().getUserId();
SysUserAssist sysUserAssist = sysUserService.assistInfo(userId);

View File

@ -6,4 +6,5 @@ import lombok.Data;
@Data
public class DriverDTO extends DeDriver {
private String typeDesc;
private String nameAlias;
}

View File

@ -4,7 +4,8 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import io.dataease.commons.utils.LogUtil;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.exception.DataEaseException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

View File

@ -1,24 +0,0 @@
package io.dataease.exception;
public class DataEaseException extends RuntimeException {
private DataEaseException(String message) {
super(message);
}
private DataEaseException(Throwable t) {
super(t);
}
public static void throwException(String message) {
throw new DataEaseException(message);
}
public static DataEaseException getException(String message) {
throw new DataEaseException(message);
}
public static void throwException(Throwable t) {
throw new DataEaseException(t);
}
}

View File

@ -1,18 +0,0 @@
package io.dataease.exception;
/**
* @author jianxing.chen
*/
public class ExcelException extends RuntimeException {
private static final long serialVersionUID = 1L;
public ExcelException(String message, Exception e) {
super(message, e);
}
public ExcelException(String message) {
super(message);
}
}

View File

@ -6,7 +6,7 @@ import com.alibaba.fastjson.serializer.ObjectSerializer;
import com.alibaba.fastjson.serializer.SerializeConfig;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.context.MessageSource;

View File

@ -1,8 +1,8 @@
package io.dataease.job.sechedule;
import io.dataease.commons.utils.LogUtil;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.exception.DataEaseException;
import org.quartz.*;
import org.springframework.stereotype.Component;

View File

@ -2,7 +2,6 @@ package io.dataease.map.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.FileUtil;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.listener.util.CacheUtils;
import io.dataease.map.dto.entity.AreaEntity;
@ -10,6 +9,7 @@ import io.dataease.map.dto.request.MapNodeRequest;
import io.dataease.map.utils.MapUtils;
import io.dataease.plugins.common.base.domain.AreaMappingGlobal;
import io.dataease.plugins.common.base.domain.AreaMappingGlobalExample;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
@ -199,10 +199,10 @@ public class MapService {
long size = file.getSize();
String name = file.getOriginalFilename();
if (size / 1024 / 1024 > 30) {
DEException.throwException("large file that exceed 30M is not supported");
DataEaseException.throwException("large file that exceed 30M is not supported");
}
if (!StringUtils.endsWith(name, ".json")) {
DEException.throwException("only json file supported");
DataEaseException.throwException("only json file supported");
}
}
@Transactional
@ -231,11 +231,11 @@ public class MapService {
}else if (plevel == 4) {
example.createCriteria().andCityCodeEqualTo(pCode).andCountyCodeEqualTo(code);
} else {
DEException.throwException("只支持3级行政区");
DataEaseException.throwException("只支持3级行政区");
}
List<AreaMappingGlobal> lists = MapUtils.selectByExample(example);
if (CollectionUtil.isNotEmpty(lists)) {
DEException.throwException("区域代码已存在");
DataEaseException.throwException("区域代码已存在");
}
example.clear();
@ -314,7 +314,7 @@ public class MapService {
MapUtils.addNode(node);
}
} else {
DEException.throwException("只支持3级行政区");
DataEaseException.throwException("只支持3级行政区");
}
uploadMapFile(file, code);
CacheUtils.removeAll("sys_map_areas_global");

View File

@ -5,10 +5,10 @@ import com.github.pagehelper.PageHelper;
import io.dataease.auth.annotation.DePermission;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeRequest;
import io.dataease.plugins.common.util.SpringContextUtil;
@ -34,11 +34,11 @@ public class RowPermissionsTreeController {
@PostMapping("save")
public void save(@RequestBody DataSetRowPermissionsTreeDTO request) {
if (StringUtils.isEmpty(request.getAuthTargetType())) {
DEException.throwException(Translator.get("i18n_row_permission_type_error"));
DataEaseException.throwException(Translator.get("i18n_row_permission_type_error"));
}
if (!StringUtils.equalsIgnoreCase(request.getAuthTargetType(), "sysParams")) {
if (ObjectUtils.isEmpty(request.getAuthTargetId())) {
DEException.throwException(Translator.get("i18n_row_permission_id"));
DataEaseException.throwException(Translator.get("i18n_row_permission_id"));
}
}
RowPermissionTreeService rowPermissionTreeService = SpringContextUtil.getBean(RowPermissionTreeService.class);

View File

@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.utils.DeLogUtils;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,7 +24,6 @@ import io.dataease.auth.entity.SysUserEntity;
import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.util.JWTUtils;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
@ -53,12 +53,12 @@ public class SSOServer {
try {
Map<String, OidcXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((OidcXpackService.class));
if (beansOfType.keySet().size() == 0) {
DEException.throwException("缺少oidc插件");
DataEaseException.throwException("缺少oidc插件");
}
oidcXpackService = SpringContextUtil.getBean(OidcXpackService.class);
Boolean supportOIDC = oidcXpackService.isSupportOIDC();
if (!supportOIDC) {
DEException.throwException("未开启oidc");
DataEaseException.throwException("未开启oidc");
}
Map<String, String> config = config(oidcXpackService);
SSOToken ssoToken = oidcXpackService.requestSsoToken(config, code, state);

View File

@ -2,6 +2,7 @@ package io.dataease.plugins.server;
import java.util.List;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.xpack.theme.dto.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.LogUtil;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.util.SpringContextUtil;
@ -49,11 +49,11 @@ public class ThemeServer {
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
if (ObjectUtils.isNotEmpty(e.getMessage()) && e.getMessage().indexOf("theme_name_repeat") != -1) {
DEException.throwException(Translator.get("theme_name_repeat"));
DataEaseException.throwException(Translator.get("theme_name_repeat"));
} else if (ObjectUtils.isNotEmpty(e.getMessage()) && e.getMessage().indexOf("theme_name_empty") != -1) {
DEException.throwException(Translator.get("theme_name_empty"));
DataEaseException.throwException(Translator.get("theme_name_empty"));
} else {
DEException.throwException(e);
DataEaseException.throwException(e);
}
}
@ -71,11 +71,11 @@ public class ThemeServer {
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
if (ObjectUtils.isNotEmpty(e.getMessage()) && e.getMessage().indexOf("theme_name_repeat") != -1) {
DEException.throwException(Translator.get("theme_name_repeat"));
DataEaseException.throwException(Translator.get("theme_name_repeat"));
} else if (ObjectUtils.isNotEmpty(e.getMessage()) && e.getMessage().indexOf("theme_name_empty") != -1) {
DEException.throwException(Translator.get("theme_name_empty"));
DataEaseException.throwException(Translator.get("theme_name_empty"));
} else {
DEException.throwException(e);
DataEaseException.throwException(e);
}
}

View File

@ -12,7 +12,6 @@ import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.DeLogUtils;
import io.dataease.commons.utils.PageUtils;
@ -20,6 +19,7 @@ import io.dataease.commons.utils.Pager;
import io.dataease.controller.sys.response.DeptNodeResponse;
import io.dataease.dto.SysLogDTO;
import io.dataease.listener.util.CacheUtils;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.xpack.dept.dto.request.*;
import io.dataease.plugins.xpack.dept.dto.response.DeptUserItemDTO;
@ -191,7 +191,7 @@ public class XDeptServer {
public void unBindUser(@RequestBody XpackDeptBindRequest request) {
DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class);
if (CollectionUtil.isEmpty(request.getUserIds())) {
DEException.throwException("userIds can not be empty");
DataEaseException.throwException("userIds can not be empty");
}
request.getUserIds().forEach(userId -> {
SysLogDTO sysLogDTO = DeLogUtils.buildBindRoleUserLog(request.getDeptId(), userId, SysLogConstants.OPERATE_TYPE.UNBIND, SysLogConstants.SOURCE_TYPE.DEPT);

View File

@ -5,13 +5,12 @@ import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.util.JWTUtils;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.DeLogUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysUserAssist;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.xpack.dingtalk.dto.response.DingQrResult;
import io.dataease.plugins.xpack.dingtalk.dto.response.DingUserEntity;
@ -87,19 +86,19 @@ public class XDingtalkServer {
try {
Map<String, DingtalkXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((DingtalkXpackService.class));
if (beansOfType.keySet().size() == 0) {
DEException.throwException("缺少钉钉插件");
DataEaseException.throwException("缺少钉钉插件");
}
dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
Boolean isOpen = dingtalkXpackService.isOpen();
if (!isOpen) {
DEException.throwException("未开启钉钉");
DataEaseException.throwException("未开启钉钉");
}
DingUserEntity dingUserEntity = withoutLogin ? dingtalkXpackService.userInfoWithoutLogin(code) : dingtalkXpackService.userInfo(code);
String username = dingUserEntity.getUserid();
SysUserEntity sysUserEntity = authUserService.getUserByDingtalkId(username);
if (null == sysUserEntity) {
if (authUserService.checkScanCreateLimit())
DEException.throwException(Translator.get("I18N_PROHIBIT_SCANNING_TO_CREATE_USER"));
DataEaseException.throwException(Translator.get("I18N_PROHIBIT_SCANNING_TO_CREATE_USER"));
String email = StringUtils.isNotBlank(dingUserEntity.getOrg_email()) ? dingUserEntity.getOrg_email() : StringUtils.isNotBlank(dingUserEntity.getEmail()) ? dingUserEntity.getEmail() : (username + "@dingtalk.work");
sysUserService.validateExistUser(username, dingUserEntity.getName(), email);
sysUserService.saveDingtalkCUser(dingUserEntity, email);
@ -162,7 +161,7 @@ public class XDingtalkServer {
response.sendRedirect(url);
} catch (IOException e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException(e);
DataEaseException.throwException(e);
}
}
@ -188,7 +187,7 @@ public class XDingtalkServer {
}
Boolean isOpen = authUserService.supportDingtalk();
if (!isOpen) {
DEException.throwException("未开启钉钉");
DataEaseException.throwException("未开启钉钉");
}
dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
DingUserEntity dingUserEntity = dingtalkXpackService.userInfo(code);

View File

@ -7,13 +7,13 @@ import com.github.pagehelper.PageHelper;
import io.dataease.auth.annotation.DeRateLimiter;
import io.dataease.auth.annotation.SqlInjectValidator;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.model.excel.ExcelSheetModel;
import io.dataease.commons.pool.PriorityThreadPoolExecutor;
import io.dataease.commons.utils.*;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.entity.GlobalTaskEntity;
import io.dataease.plugins.common.entity.GlobalTaskInstance;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.xpack.email.dto.request.*;
import io.dataease.plugins.xpack.email.dto.response.XpackTaskEntity;
@ -172,7 +172,7 @@ public class XEmailTaskServer {
return emailXpackService.printPdf(url, currentToken, buildPixel(request.getPixel()), request.isShowPageNo(), false);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException("预览失败,请联系管理员");
DataEaseException.throwException("预览失败,请联系管理员");
}
return null;
}, 0);
@ -191,7 +191,7 @@ public class XEmailTaskServer {
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException("预览失败,请联系管理员");
DataEaseException.throwException("预览失败,请联系管理员");
}
return null;
@ -210,7 +210,7 @@ public class XEmailTaskServer {
return emailXpackService.print(url, currentToken, buildPixel(request.getPixel()), request.getExtWaitTime());
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException("预览失败,请联系管理员");
DataEaseException.throwException("预览失败,请联系管理员");
}
return null;
}, 0);
@ -229,7 +229,7 @@ public class XEmailTaskServer {
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException("预览失败,请联系管理员");
DataEaseException.throwException("预览失败,请联系管理员");
}
return null;
@ -250,7 +250,7 @@ public class XEmailTaskServer {
return emailXpackService.print(url, token, buildPixel(request.getPixel()), request.getExtWaitTime());
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException("预览失败,请联系管理员");
DataEaseException.throwException("预览失败,请联系管理员");
}
return null;
}, 0);
@ -268,7 +268,7 @@ public class XEmailTaskServer {
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException("预览失败,请联系管理员");
DataEaseException.throwException("预览失败,请联系管理员");
}
return null;
@ -285,7 +285,7 @@ public class XEmailTaskServer {
emailXpackService.delete(taskId);
} catch (Exception e) {
LogUtil.error(e);
DEException.throwException(e);
DataEaseException.throwException(e);
}
}
@ -302,7 +302,7 @@ public class XEmailTaskServer {
emailXpackService.batchDel(taskIds);
} catch (Exception e) {
LogUtil.error(e);
DEException.throwException(e);
DataEaseException.throwException(e);
}
}

View File

@ -5,14 +5,13 @@ import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.util.JWTUtils;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.DeLogUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysUserAssist;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.lark.dto.entity.LarkAppUserEntity;
@ -104,12 +103,12 @@ public class XLarkServer {
try {
Map<String, LarkXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((LarkXpackService.class));
if (beansOfType.keySet().size() == 0) {
DEException.throwException("缺少飞书插件");
DataEaseException.throwException("缺少飞书插件");
}
larkXpackService = SpringContextUtil.getBean(LarkXpackService.class);
Boolean isOpen = larkXpackService.isOpen();
if (!isOpen) {
DEException.throwException("未开启飞书");
DataEaseException.throwException("未开启飞书");
}
LarkUserInfo larkUserInfo = null;
if (withoutLogin) {
@ -123,7 +122,7 @@ public class XLarkServer {
SysUserEntity sysUserEntity = authUserService.getUserByLarkId(username);
if (null == sysUserEntity) {
if (authUserService.checkScanCreateLimit())
DEException.throwException(Translator.get("I18N_PROHIBIT_SCANNING_TO_CREATE_USER"));
DataEaseException.throwException(Translator.get("I18N_PROHIBIT_SCANNING_TO_CREATE_USER"));
String email = StringUtils.isNotBlank(larkUserInfo.getEmail()) ? larkUserInfo.getEmail() : (username + "@lark.work");
sysUserService.validateExistUser(username, larkUserInfo.getName(), email);
sysUserService.saveLarkCUser(larkUserInfo, email);
@ -180,7 +179,7 @@ public class XLarkServer {
response.sendRedirect(url);
} catch (IOException e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException(e);
DataEaseException.throwException(e);
}
}
@ -205,7 +204,7 @@ public class XLarkServer {
Boolean isOpen = authUserService.supportLark();
if (!isOpen) {
DEException.throwException("未开启飞书");
DataEaseException.throwException("未开启飞书");
}
larkXpackService = SpringContextUtil.getBean(LarkXpackService.class);
LarkUserInfo larkUserInfo = larkXpackService.userInfo(code, state, true);

View File

@ -5,13 +5,12 @@ import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.util.JWTUtils;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.DeLogUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysUserAssist;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.lark.dto.entity.LarkQrResult;
@ -88,12 +87,12 @@ public class XLarksuiteServer {
try {
Map<String, LarksuiteXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((LarksuiteXpackService.class));
if (beansOfType.keySet().size() == 0) {
DEException.throwException("缺少国际飞书插件");
DataEaseException.throwException("缺少国际飞书插件");
}
larksuiteXpackService = SpringContextUtil.getBean(LarksuiteXpackService.class);
Boolean isOpen = larksuiteXpackService.isOpen();
if (!isOpen) {
DEException.throwException("未开启国际飞书");
DataEaseException.throwException("未开启国际飞书");
}
LarksuiteUserResult larksuiteUserResult = larksuiteXpackService.userInfo(code, state, false);
UserData larkUserInfo = larksuiteUserResult.getData();
@ -101,7 +100,7 @@ public class XLarksuiteServer {
SysUserEntity sysUserEntity = authUserService.getUserByLarksuiteId(username);
if (null == sysUserEntity) {
if (authUserService.checkScanCreateLimit())
DEException.throwException(Translator.get("I18N_PROHIBIT_SCANNING_TO_CREATE_USER"));
DataEaseException.throwException(Translator.get("I18N_PROHIBIT_SCANNING_TO_CREATE_USER"));
String email = StringUtils.isNotBlank(larkUserInfo.getEmail()) ? larkUserInfo.getEmail() : (username + "@larksuite.work");
sysUserService.validateExistUser(username, larkUserInfo.getName(), email);
sysUserService.saveLarksuiteCUser(larkUserInfo, email);
@ -148,7 +147,7 @@ public class XLarksuiteServer {
response.sendRedirect(url);
} catch (IOException e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException(e);
DataEaseException.throwException(e);
}
}
@ -173,7 +172,7 @@ public class XLarksuiteServer {
Boolean isOpen = authUserService.supportLarksuite();
if (!isOpen) {
DEException.throwException("未开启国际飞书");
DataEaseException.throwException("未开启国际飞书");
}
larksuiteXpackService = SpringContextUtil.getBean(LarksuiteXpackService.class);
LarksuiteUserResult larksuiteUserResult = larksuiteXpackService.userInfo(code, state, true);

View File

@ -6,13 +6,12 @@ import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.util.JWTUtils;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.DeLogUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysUserAssist;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
@ -98,12 +97,12 @@ public class XWecomServer {
try {
Map<String, WecomXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((WecomXpackService.class));
if (beansOfType.keySet().size() == 0) {
DEException.throwException("缺少企业微信插件");
DataEaseException.throwException("缺少企业微信插件");
}
wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
Boolean isOpen = wecomXpackService.isOpen();
if (!isOpen) {
DEException.throwException("未开启企业微信");
DataEaseException.throwException("未开启企业微信");
}
WecomAuthResult authResult = wecomXpackService.auth(code);
@ -113,7 +112,7 @@ public class XWecomServer {
SysUserEntity sysUserEntity = authUserService.getUserByWecomId(userId);
if (null == sysUserEntity) {
if (authUserService.checkScanCreateLimit())
DEException.throwException(Translator.get("I18N_PROHIBIT_SCANNING_TO_CREATE_USER"));
DataEaseException.throwException(Translator.get("I18N_PROHIBIT_SCANNING_TO_CREATE_USER"));
Object emailObj = ObjectUtils.isEmpty(userMap.get("biz_mail")) ? userMap.get("email") : userMap.get("biz_mail");
String email = ObjectUtils.isEmpty(emailObj) ? (userId + "@wecom.work") : emailObj.toString();
sysUserService.validateExistUser(userId, userMap.get("name").toString(), email);
@ -170,7 +169,7 @@ public class XWecomServer {
response.sendRedirect(url);
} catch (IOException e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException(e);
DataEaseException.throwException(e);
}
}
@ -196,7 +195,7 @@ public class XWecomServer {
Boolean supportWecom = authUserService.supportWecom();
if (!supportWecom) {
DEException.throwException("未开启企业微信");
DataEaseException.throwException("未开启企业微信");
return;
}
wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);

View File

@ -34,6 +34,7 @@ public class ProviderFactory implements ApplicationContextAware {
dataSourceType.setKeywordPrefix(d.getKeywordPrefix());
dataSourceType.setAliasSuffix(d.getAliasSuffix());
dataSourceType.setAliasPrefix(d.getAliasPrefix());
dataSourceType.setSurpportVersions(d.getSurpportVersions());
beanFactory.registerSingleton(d.getType(), dataSourceType);
}
}

View File

@ -8,11 +8,11 @@ import io.dataease.controller.request.datasource.es.EsResponse;
import io.dataease.controller.request.datasource.es.Request;
import io.dataease.controller.request.datasource.es.RequestWithCursor;
import io.dataease.dto.datasource.EsConfiguration;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.constants.datasource.EsSqlLConstants;
import io.dataease.plugins.common.dto.datasource.TableDesc;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.datasource.provider.Provider;
import io.dataease.provider.query.es.EsQueryProvider;

View File

@ -5,15 +5,18 @@ import com.alibaba.druid.pool.DruidPooledConnection;
import com.google.gson.Gson;
import io.dataease.commons.utils.LogUtil;
import io.dataease.dto.datasource.*;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.Datasource;
import io.dataease.plugins.common.base.domain.DeDriver;
import io.dataease.plugins.common.base.mapper.DeDriverMapper;
import io.dataease.plugins.common.constants.DatasourceTypes;
import io.dataease.plugins.common.constants.datasource.MySQLConstants;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.provider.DefaultJdbcProvider;
import io.dataease.plugins.datasource.provider.ExtendedJdbcClassLoader;
@ -21,6 +24,7 @@ import io.dataease.plugins.datasource.query.QueryProvider;
import io.dataease.provider.ProviderFactory;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.math.BigDecimal;
@ -510,16 +514,23 @@ public class JdbcProvider extends DefaultJdbcProvider {
}
Connection conn;
String surpportVersions = null;
String driverClassName;
ExtendedJdbcClassLoader jdbcClassLoader;
if (isDefaultClassLoader(customDriver)) {
driverClassName = defaultDriver;
jdbcClassLoader = extendedJdbcClassLoader;
for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
if(value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())){
surpportVersions = value.getSurpportVersions();
}
}
} else {
if (deDriver == null) {
deDriver = deDriverMapper.selectByPrimaryKey(customDriver);
}
driverClassName = deDriver.getDriverClass();
surpportVersions = deDriver.getSurpportVersions();
jdbcClassLoader = getCustomJdbcClassLoader(deDriver);
}
@ -534,6 +545,12 @@ public class JdbcProvider extends DefaultJdbcProvider {
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
if(StringUtils.isNotEmpty(surpportVersions) && surpportVersions.split(",").length > 0){
if(! Arrays.asList(surpportVersions.split(",")).contains(String.valueOf(conn.getMetaData().getDatabaseMajorVersion()))){
DataEaseException.throwException("当前驱动不支持此版本!");
};
}
return conn;
}

View File

@ -1,7 +1,6 @@
package io.dataease.provider.engine.doris;
import com.alibaba.fastjson.JSONArray;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -18,6 +17,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1424,7 +1424,7 @@ public class DorisQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1433,7 +1433,7 @@ public class DorisQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1465,7 +1465,7 @@ public class DorisQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -1,7 +1,6 @@
package io.dataease.provider.engine.mysql;
import com.alibaba.fastjson.JSONArray;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -18,6 +17,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1372,7 +1372,7 @@ public class MysqlQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1381,7 +1381,7 @@ public class MysqlQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1413,7 +1413,7 @@ public class MysqlQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -1,7 +1,6 @@
package io.dataease.provider.query.ck;
import com.alibaba.fastjson.JSONArray;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
@ -17,6 +16,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1422,7 +1422,7 @@ public class CKQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1431,7 +1431,7 @@ public class CKQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1463,7 +1463,7 @@ public class CKQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -2,7 +2,7 @@ package io.dataease.provider.query.db2;
import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson;
import io.dataease.commons.exception.DEException;
import io.dataease.dto.datasource.Db2Configuration;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
@ -18,6 +18,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1410,7 +1411,7 @@ public class Db2QueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1419,7 +1420,7 @@ public class Db2QueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1451,7 +1452,7 @@ public class Db2QueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -1,7 +1,6 @@
package io.dataease.provider.query.es;
import com.alibaba.fastjson.JSONArray;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -16,6 +15,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1328,7 +1328,7 @@ public class EsQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1337,7 +1337,7 @@ public class EsQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1369,7 +1369,7 @@ public class EsQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -1,7 +1,6 @@
package io.dataease.provider.query.hive;
import com.alibaba.fastjson.JSONArray;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -16,6 +15,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1340,7 +1340,7 @@ public class HiveQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1349,7 +1349,7 @@ public class HiveQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1381,7 +1381,7 @@ public class HiveQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -1,7 +1,6 @@
package io.dataease.provider.query.impala;
import com.alibaba.fastjson.JSONArray;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -16,6 +15,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1329,7 +1329,7 @@ public class ImpalaQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1338,7 +1338,7 @@ public class ImpalaQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1370,7 +1370,7 @@ public class ImpalaQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -1,7 +1,6 @@
package io.dataease.provider.query.mongodb;
import com.alibaba.fastjson.JSONArray;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -16,6 +15,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1165,7 +1165,7 @@ public class MongoQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1174,7 +1174,7 @@ public class MongoQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1206,7 +1206,7 @@ public class MongoQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -1,7 +1,6 @@
package io.dataease.provider.query.mysql;
import com.alibaba.fastjson.JSONArray;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -18,6 +17,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1439,7 +1439,7 @@ public class MysqlQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1448,7 +1448,7 @@ public class MysqlQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1480,7 +1480,7 @@ public class MysqlQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -2,7 +2,6 @@ package io.dataease.provider.query.oracle;
import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson;
import io.dataease.commons.exception.DEException;
import io.dataease.dto.datasource.OracleConfiguration;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
@ -18,6 +17,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1522,7 +1522,7 @@ public class OracleQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1531,7 +1531,7 @@ public class OracleQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1563,7 +1563,7 @@ public class OracleQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -2,7 +2,6 @@ package io.dataease.provider.query.pg;
import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -18,6 +17,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1338,7 +1338,7 @@ public class PgQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1347,7 +1347,7 @@ public class PgQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1379,7 +1379,7 @@ public class PgQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -2,7 +2,6 @@ package io.dataease.provider.query.redshift;
import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -16,6 +15,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1319,7 +1319,7 @@ public class RedshiftQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1328,7 +1328,7 @@ public class RedshiftQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1360,7 +1360,7 @@ public class RedshiftQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -2,7 +2,6 @@ package io.dataease.provider.query.sqlserver;
import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTableField;
@ -17,6 +16,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.dto.sqlObj.SQLObj;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
@ -1479,7 +1479,7 @@ public class SqlserverQueryProvider extends QueryProvider {
int i = 0;
return buildCalcField(originField, tableObj, i);
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_ref"));
DataEaseException.throwException(Translator.get("i18n_field_circular_ref"));
}
return null;
}
@ -1488,7 +1488,7 @@ public class SqlserverQueryProvider extends QueryProvider {
try {
i++;
if (i > 100) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
@ -1520,7 +1520,7 @@ public class SqlserverQueryProvider extends QueryProvider {
}
return originField;
} catch (Exception e) {
DEException.throwException(Translator.get("i18n_field_circular_error"));
DataEaseException.throwException(Translator.get("i18n_field_circular_error"));
}
return null;
}

View File

@ -2,13 +2,13 @@ package io.dataease.service;
import io.dataease.commons.constants.FileType;
import io.dataease.commons.exception.DEException;
import io.dataease.plugins.common.base.domain.FileContent;
import io.dataease.plugins.common.base.domain.FileContentExample;
import io.dataease.plugins.common.base.domain.FileMetadata;
import io.dataease.plugins.common.base.domain.FileMetadataExample;
import io.dataease.plugins.common.base.mapper.FileContentMapper;
import io.dataease.plugins.common.base.mapper.FileMetadataMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
@ -60,7 +60,7 @@ public class FileService {
try {
fileContent.setFile(file.getBytes());
} catch (IOException e) {
DEException.throwException(e);
DataEaseException.throwException(e);
}
fileContentMapper.insert(fileContent);

View File

@ -1,11 +1,11 @@
package io.dataease.service.chart;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.TableUtils;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewField;
import io.dataease.plugins.common.base.domain.ChartViewFieldExample;
import io.dataease.plugins.common.base.mapper.ChartViewFieldMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -79,7 +79,7 @@ public class ChartViewFieldService {
}
List<ChartViewField> datasetTableFields = chartViewFieldMapper.selectByExample(chartViewFieldExample);
if (CollectionUtils.isNotEmpty(datasetTableFields)) {
DEException.throwException(Translator.get("i18n_field_name_repeat"));
DataEaseException.throwException(Translator.get("i18n_field_name_repeat"));
}
}
}

View File

@ -9,7 +9,6 @@ import io.dataease.auth.entity.SysUserEntity;
import io.dataease.auth.service.AuthUserService;
import io.dataease.commons.constants.CommonConstants;
import io.dataease.commons.constants.JdbcConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.model.PluginViewSetImpl;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
@ -21,7 +20,6 @@ import io.dataease.dto.chart.*;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.DataSetTableUnionDTO;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.ExtChartGroupMapper;
import io.dataease.ext.ExtChartViewMapper;
import io.dataease.ext.ExtPanelGroupExtendDataMapper;
@ -40,6 +38,7 @@ import io.dataease.plugins.common.dto.chart.ChartFieldCompareDTO;
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.dataset.SqlVariableDetails;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
@ -1570,7 +1569,7 @@ public class ChartViewService {
Map<String, ViewPluginService> beanMap = SpringContextUtil.getApplicationContext().getBeansOfType(ViewPluginService.class);
if (beanMap.keySet().size() == 0) {
DEException.throwException("没有此插件");
DataEaseException.throwException("没有此插件");
}
ViewPluginService viewPluginService = null;
@ -1580,7 +1579,7 @@ public class ChartViewService {
return viewPluginService;
}
}
if (null == viewPluginService) DEException.throwException("没有此插件");
if (null == viewPluginService) DataEaseException.throwException("没有此插件");
return viewPluginService;
}
@ -2086,7 +2085,7 @@ public class ChartViewService {
if (ObjectUtils.isNotEmpty(datasetTableField)) {
if (datasetTableField.getDeType() == 0 || datasetTableField.getDeType() == 1 || datasetTableField.getDeType() == 5) {
if (!StringUtils.containsIgnoreCase(summary, "count")) {
DEException.throwException(Translator.get("i18n_gauge_field_change"));
DataEaseException.throwException(Translator.get("i18n_gauge_field_change"));
}
}
ChartViewFieldDTO dto = new ChartViewFieldDTO();
@ -2094,7 +2093,7 @@ public class ChartViewService {
dto.setSummary(summary);
return dto;
} else {
DEException.throwException(Translator.get("i18n_gauge_field_delete"));
DataEaseException.throwException(Translator.get("i18n_gauge_field_delete"));
}
}
return null;

View File

@ -1,6 +1,7 @@
package io.dataease.service.chart;
import com.google.gson.internal.LinkedTreeMap;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -9,7 +10,6 @@ import org.springframework.stereotype.Service;
import com.google.gson.Gson;
import io.dataease.auth.annotation.DePermissionProxy;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.model.excel.ExcelSheetModel;
import io.dataease.commons.utils.ExcelUtils;
import io.dataease.commons.utils.LogUtil;
@ -91,7 +91,7 @@ public class ViewExportExcel {
chartViewDTO = chartViewService.getData(viewId, request);
} catch (Exception e) {
LogUtil.error(e.getMessage());
DEException.throwException(e);
DataEaseException.throwException(e);
}
String title = Optional.ofNullable(chartViewDTO.getTitle()).orElse(chartViewDTO.getName());
Map<String, Object> chart = chartViewDTO.getData();

View File

@ -1,8 +1,8 @@
package io.dataease.service.chart.build;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.LogUtil;
import io.dataease.dto.chart.FilterParamTO;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.service.chart.FilterBuildTemplate;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@ -160,7 +160,7 @@ public abstract class TimeBuild extends FilterBuildTemplate {
Method setMethod = instance.getClass().getMethod("set", int.class, int.class);
setMethod.invoke(instance, fieldFlag, value);
} catch (Exception e) {
DEException.throwException(e);
DataEaseException.throwException(e);
LogUtil.error(e.getMessage(), e);
}
}

View File

@ -1,11 +1,11 @@
package io.dataease.service.dataset;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.TableUtils;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -58,7 +58,7 @@ public class DataSetTableFieldsService {
}
List<DatasetTableField> datasetTableFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
if (CollectionUtils.isNotEmpty(datasetTableFields)) {
DEException.throwException(Translator.get("i18n_field_name_repeat"));
DataEaseException.throwException(Translator.get("i18n_field_name_repeat"));
}
}
}

View File

@ -16,7 +16,6 @@ import com.google.gson.reflect.TypeToken;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.constants.*;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.*;
import io.dataease.controller.ResultHolder;
import io.dataease.controller.dataset.request.DataSetTaskInstanceGridRequest;
@ -30,7 +29,6 @@ import io.dataease.dto.dataset.*;
import io.dataease.dto.dataset.union.UnionDTO;
import io.dataease.dto.dataset.union.UnionItemDTO;
import io.dataease.dto.dataset.union.UnionParamDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.ExtDataSetGroupMapper;
import io.dataease.ext.ExtDataSetTableMapper;
import io.dataease.ext.UtilMapper;
@ -44,6 +42,7 @@ import io.dataease.plugins.common.constants.DeTypeConstants;
import io.dataease.plugins.common.dto.dataset.SqlVariableDetails;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeObj;
@ -643,7 +642,7 @@ public class DataSetTableService {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
try {
@ -653,7 +652,7 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
} else {
// check doris table
@ -680,7 +679,7 @@ public class DataSetTableService {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields,
@ -688,7 +687,7 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
}
@ -722,7 +721,7 @@ public class DataSetTableService {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
try {
datasourceRequest.setPageable(false);
@ -731,7 +730,7 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
} else {
// check doris table
@ -751,7 +750,7 @@ public class DataSetTableService {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields,
@ -759,7 +758,7 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
}
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
@ -780,7 +779,7 @@ public class DataSetTableService {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields,
@ -788,7 +787,7 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
DataSetTaskInstanceGridRequest request = new DataSetTaskInstanceGridRequest();
request.setTableId(List.of(dataSetTableRequest.getId()));
@ -818,7 +817,7 @@ public class DataSetTableService {
sql = getCustomSQLDatasource(dt, list, ds);
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(
@ -834,7 +833,7 @@ public class DataSetTableService {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
try {
datasourceRequest.setPageable(false);
@ -843,7 +842,7 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
} else {
Datasource ds = engineService.getDeEngine();
@ -859,7 +858,7 @@ public class DataSetTableService {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
try {
@ -868,14 +867,14 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
}
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "union")) {
if (datasetTable.getMode() == 0) {
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
if (ObjectUtils.isEmpty(ds)) {
DEException.throwException(Translator.get("i18n_datasource_delete"));
DataEaseException.throwException(Translator.get("i18n_datasource_delete"));
}
Provider datasourceProvider = ProviderFactory.getProvider(ds.getType());
DatasourceRequest datasourceRequest = new DatasourceRequest();
@ -888,7 +887,7 @@ public class DataSetTableService {
sql = (String) getUnionSQLDatasource(dt, ds).get("sql");
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(
@ -904,7 +903,7 @@ public class DataSetTableService {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
try {
datasourceRequest.setPageable(false);
@ -913,7 +912,7 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
} else {
Datasource ds = engineService.getDeEngine();
@ -929,7 +928,7 @@ public class DataSetTableService {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
try {
@ -938,7 +937,7 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
logger.error(e.getMessage());
DEException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
DataEaseException.throwException(Translator.get("i18n_ds_error") + "->" + e.getMessage());
}
}
}
@ -1559,7 +1558,7 @@ public class DataSetTableService {
DatasetTableField sourceField = dataSetTableFieldsService.get(dto.getSourceTableFieldId());
DatasetTableField targetField = dataSetTableFieldsService.get(dto.getTargetTableFieldId());
if (ObjectUtils.isEmpty(sourceField) || ObjectUtils.isEmpty(targetField)) {
DEException.throwException(Translator.get("i18n_dataset_field_delete"));
DataEaseException.throwException(Translator.get("i18n_dataset_field_delete"));
}
join.append(convertUnionTypeToSQL(dto.getSourceUnionRelation()))
@ -1627,7 +1626,7 @@ public class DataSetTableService {
DatasetTableField sourceField = dataSetTableFieldsService.get(dto.getSourceTableFieldId());
DatasetTableField targetField = dataSetTableFieldsService.get(dto.getTargetTableFieldId());
if (ObjectUtils.isEmpty(sourceField) || ObjectUtils.isEmpty(targetField)) {
DEException.throwException(Translator.get("i18n_dataset_field_delete"));
DataEaseException.throwException(Translator.get("i18n_dataset_field_delete"));
}
DatasetTable sourceTable = datasetTableMapper.selectByPrimaryKey(dto.getSourceTableId());
String sourceTableName = new Gson().fromJson(sourceTable.getInfo(), DataTableInfoDTO.class)
@ -1692,14 +1691,14 @@ public class DataSetTableService {
String table = TableUtils.tableName(tableId);
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(tableId);
if (ObjectUtils.isEmpty(datasetTable)) {
DEException.throwException(
DataEaseException.throwException(
Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
}
CurrentUserDto user = AuthUtils.getUser();
if (user != null && !user.getIsAdmin()) {
DataSetTableDTO withPermission = getWithPermission(datasetTable.getId(), user.getUserId());
if (ObjectUtils.isEmpty(withPermission.getPrivileges()) || !withPermission.getPrivileges().contains("use")) {
DEException.throwException(
DataEaseException.throwException(
Translator.get("i18n_dataset_no_permission") + String.format(":table name [%s]", withPermission.getName()));
}
}
@ -1709,7 +1708,7 @@ public class DataSetTableService {
.map(f -> {
String s = "";
if (f == null) {
DEException.throwException(
DataEaseException.throwException(
Translator.get("i18n_ds_error"));
} else {
s = table + "." + f.getDataeaseName() + " AS "
@ -1743,7 +1742,7 @@ public class DataSetTableService {
DatasetTableField pField = dataSetTableFieldsService.get(u.getParentField().getId());
DatasetTableField cField = dataSetTableFieldsService.get(u.getCurrentField().getId());
if (ObjectUtils.isEmpty(pField) || ObjectUtils.isEmpty(cField)) {
DEException.throwException(Translator.get("i18n_dataset_field_delete"));
DataEaseException.throwException(Translator.get("i18n_dataset_field_delete"));
}
DatasetTable parentTable = datasetTableMapper.selectByPrimaryKey(pField.getTableId());
DatasetTable currentTable = datasetTableMapper.selectByPrimaryKey(cField.getTableId());
@ -1769,7 +1768,7 @@ public class DataSetTableService {
}
}
if (StringUtils.isEmpty(f)) {
DEException.throwException(Translator.get("i18n_union_ds_no_checked"));
DataEaseException.throwException(Translator.get("i18n_union_ds_no_checked"));
}
sql = MessageFormat.format("SELECT {0} FROM {1}", f,
TableUtils.tableName(union.get(0).getCurrentDs().getId())) + join.toString();
@ -1797,7 +1796,7 @@ public class DataSetTableService {
String table = TableUtils.tableName(tableId);
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(tableId);
if (ObjectUtils.isEmpty(datasetTable)) {
DEException.throwException(
DataEaseException.throwException(
Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
}
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField());
@ -1832,7 +1831,7 @@ public class DataSetTableService {
if (StringUtils.isNotEmpty(schema) && (StringUtils.equalsIgnoreCase(ds.getType(), DatasourceTypes.db2.getType()) ||
StringUtils.equalsIgnoreCase(ds.getType(), DatasourceTypes.sqlServer.getType()) ||
StringUtils.equalsIgnoreCase(ds.getType(), DatasourceTypes.oracle.getType()) ||
StringUtils.equalsIgnoreCase(ds.getType(), DatasourceTypes.kingbase.getType()) ||
StringUtils.equalsIgnoreCase(ds.getType(), "kingbase") ||
StringUtils.equalsIgnoreCase(ds.getType(), DatasourceTypes.pg.getType()))) {
joinPrefix = String.format(keyword, schema) + ".";
}
@ -1852,14 +1851,14 @@ public class DataSetTableService {
String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
String tableId = unionDTO.getCurrentDs().getId();
if (ObjectUtils.isEmpty(datasetTable)) {
DEException.throwException(
DataEaseException.throwException(
Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
}
CurrentUserDto user = AuthUtils.getUser();
if (user != null && !user.getIsAdmin()) {
DataSetTableDTO withPermission = getWithPermission(datasetTable.getId(), user.getUserId());
if (ObjectUtils.isEmpty(withPermission.getPrivileges()) || !withPermission.getPrivileges().contains("use")) {
DEException.throwException(
DataEaseException.throwException(
Translator.get("i18n_dataset_no_permission") + String.format(":table name [%s]", withPermission.getName()));
}
}
@ -1894,7 +1893,7 @@ public class DataSetTableService {
DatasetTableField pField = dataSetTableFieldsService.get(u.getParentField().getId());
DatasetTableField cField = dataSetTableFieldsService.get(u.getCurrentField().getId());
if (ObjectUtils.isEmpty(pField) || ObjectUtils.isEmpty(cField)) {
DEException.throwException(Translator.get("i18n_dataset_field_delete"));
DataEaseException.throwException(Translator.get("i18n_dataset_field_delete"));
}
DatasetTable parentTable = datasetTableMapper.selectByPrimaryKey(pField.getTableId());
String parentTableName = new Gson().fromJson(parentTable.getInfo(), DataTableInfoDTO.class).getTable();
@ -1923,7 +1922,7 @@ public class DataSetTableService {
}
}
if (StringUtils.isEmpty(f)) {
DEException.throwException(Translator.get("i18n_union_ds_no_checked"));
DataEaseException.throwException(Translator.get("i18n_union_ds_no_checked"));
}
sql = MessageFormat.format("SELECT {0} FROM {1}", f, joinPrefix + String.format(keyword, tableName)) + join.toString();
} else {
@ -1957,7 +1956,7 @@ public class DataSetTableService {
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(unionDTO.getCurrentDs().getId());
String tableId = unionDTO.getCurrentDs().getId();
if (ObjectUtils.isEmpty(datasetTable)) {
DEException.throwException(
DataEaseException.throwException(
Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
}
String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();

View File

@ -7,13 +7,13 @@ import io.dataease.commons.utils.ServletUtils;
import io.dataease.controller.dataset.request.DataSetTaskInstanceGridRequest;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.dto.dataset.DataSetTaskLogDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.ExtDataSetTaskMapper;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.DatasetTableTaskLog;
import io.dataease.plugins.common.base.domain.DatasetTableTaskLogExample;
import io.dataease.plugins.common.base.mapper.DatasetTableTaskLogMapper;
import io.dataease.plugins.common.base.mapper.DatasetTableTaskMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.service.system.SystemParameterService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -8,13 +8,12 @@ import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.dataset.request.DatasetTaskGridRequest;
import io.dataease.controller.request.dataset.DataSetTaskRequest;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.ExtDataSetTaskMapper;
import io.dataease.i18n.Translator;
import io.dataease.job.sechedule.ScheduleManager;
import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.DatasetTableMapper;
import io.dataease.plugins.common.base.mapper.DatasetTableTaskMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.service.ScheduleService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;

View File

@ -9,7 +9,6 @@ import io.dataease.controller.request.datasource.ApiDefinition;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.dto.dataset.ExcelSheetData;
import io.dataease.dto.datasource.*;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.ExtChartViewMapper;
import io.dataease.listener.util.CacheUtils;
import io.dataease.plugins.common.base.domain.*;
@ -17,6 +16,7 @@ import io.dataease.plugins.common.constants.DatasetType;
import io.dataease.plugins.common.constants.DatasourceTypes;
import io.dataease.plugins.common.constants.DeTypeConstants;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.provider.Provider;

View File

@ -3,7 +3,6 @@ package io.dataease.service.dataset.impl.direct;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
import com.google.gson.Gson;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.model.BaseTreeNode;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.LogUtil;
@ -12,13 +11,13 @@ import io.dataease.dto.dataset.DataSetTableUnionDTO;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.dto.dataset.DeSortDTO;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.base.domain.DatasetTable;
import io.dataease.plugins.common.base.domain.DatasetTableField;
import io.dataease.plugins.common.base.domain.Datasource;
import io.dataease.plugins.common.constants.DatasetType;
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.datasource.DeSortField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
import io.dataease.plugins.datasource.provider.Provider;
@ -119,7 +118,7 @@ public class DirectFieldService implements DataSetFieldService {
final List<String> allTableFieldIds = fields.stream().map(DatasetTableField::getId).collect(Collectors.toList());
boolean multi = fieldIds.stream().anyMatch(item -> !allTableFieldIds.contains(item));
if (multi && needMapping) {
DEException.throwException(Translator.get("i18n_dataset_cross_multiple"));
DataEaseException.throwException(Translator.get("i18n_dataset_cross_multiple"));
}
List<DatasetTableField> permissionFields = fields;

View File

@ -9,7 +9,6 @@ import io.dataease.auth.annotation.DeCleaner;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.RedisConstants;
import io.dataease.commons.constants.SysAuthConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.model.AuthURD;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
@ -39,6 +38,7 @@ import io.dataease.plugins.common.constants.DatasourceTypes;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableDesc;
import io.dataease.plugins.common.entity.GlobalTaskEntity;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
@ -371,11 +371,9 @@ public class DatasourceService {
String datasourceStatus = null;
try {
Provider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
System.out.println(datasourceProvider.getClass());
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(datasource);
datasourceStatus = datasourceProvider.checkStatus(datasourceRequest);
System.out.println(datasourceStatus);
if (datasource.getType().equalsIgnoreCase("api")) {
List<ApiDefinition> apiDefinitionList = new Gson().fromJson(datasource.getConfiguration(), new TypeToken<List<ApiDefinition>>() {
}.getType());
@ -499,7 +497,7 @@ public class DatasourceService {
criteria.andIdNotEqualTo(id);
}
if (CollectionUtils.isNotEmpty(datasourceMapper.selectByExample(example))) {
DEException.throwException(Translator.get("i18n_ds_name_exists"));
DataEaseException.throwException(Translator.get("i18n_ds_name_exists"));
}
}

View File

@ -47,7 +47,7 @@ public class DriverService {
public List<DriverDTO> list() throws Exception {
List<DriverDTO> driverDTOS = new ArrayList<>();
deDriverMapper.selectByExample(null).forEach(deDriver -> {
deDriverMapper.selectByExampleWithBLOBs(null).forEach(deDriver -> {
DriverDTO driverDTO = new DriverDTO();
BeanUtils.copyBean(driverDTO, deDriver);
datasourceService.types().forEach(dataSourceType -> {
@ -81,10 +81,9 @@ public class DriverService {
}
DeDriverExample example = new DeDriverExample();
example.createCriteria().andNameEqualTo(deDriver.getName());
if(CollectionUtil.isNotEmpty(deDriverMapper.selectByExample(example))){
if(CollectionUtil.isNotEmpty(deDriverMapper.selectByExampleWithBLOBs(example))){
throw new RuntimeException(Translator.get("I18N_DRIVER_REPEAT_NAME"));
}
deDriver.setCreateTime(System.currentTimeMillis());
deDriver.setId(UUID.randomUUID().toString());
deDriverMapper.insert(deDriver);
@ -92,7 +91,7 @@ public class DriverService {
}
public DeDriver update(DeDriver deDriver) {
deDriverMapper.updateByPrimaryKey(deDriver);
deDriverMapper.updateByPrimaryKeyWithBLOBs(deDriver);
return deDriver;
}

View File

@ -2,10 +2,10 @@ package io.dataease.service.panel;
import com.google.gson.Gson;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.base.domain.PanelGroupExtendData;
import io.dataease.plugins.common.base.domain.PanelGroupExtendDataExample;
import io.dataease.plugins.common.base.mapper.PanelGroupExtendDataMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;

View File

@ -26,13 +26,13 @@ import io.dataease.dto.panel.PanelExport2App;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.dto.panel.PanelTemplateFileDTO;
import io.dataease.dto.panel.po.PanelViewInsertDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.*;
import io.dataease.i18n.Translator;
import io.dataease.listener.util.CacheUtils;
import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.*;
import io.dataease.plugins.common.constants.DeTypeConstants;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.service.chart.ChartViewService;
import io.dataease.service.dataset.DataSetGroupService;
import io.dataease.service.dataset.DataSetTableService;

View File

@ -1,10 +1,10 @@
package io.dataease.service.panel;
import io.dataease.controller.request.panel.PanelSubjectRequest;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.base.domain.PanelSubject;
import io.dataease.plugins.common.base.domain.PanelSubjectExample;
import io.dataease.plugins.common.base.mapper.PanelSubjectMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

View File

@ -6,12 +6,12 @@ import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.controller.request.panel.PanelTemplateRequest;
import io.dataease.dto.panel.PanelTemplateDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.PanelTemplate;
import io.dataease.plugins.common.base.domain.PanelTemplateExample;
import io.dataease.plugins.common.base.domain.PanelTemplateWithBLOBs;
import io.dataease.plugins.common.base.mapper.PanelTemplateMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.service.staticResource.StaticResourceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

View File

@ -3,12 +3,11 @@ package io.dataease.service.staticResource;
import cn.hutool.core.codec.Base64Decoder;
import cn.hutool.core.collection.CollectionUtil;
import com.google.gson.Gson;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.FileUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.StaticResourceUtils;
import io.dataease.controller.request.resource.StaticResourceRequest;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
@ -16,7 +15,6 @@ import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
@ -42,7 +40,7 @@ public class StaticResourceService {
Assert.notNull(file, "Multipart file must not be null");
try {
if (!isImage(file)) {
DEException.throwException("Multipart file must be image");
DataEaseException.throwException("Multipart file must be image");
}
String originName = file.getOriginalFilename();
String newFileName = fileId + originName.substring(originName.lastIndexOf("."), originName.length());

View File

@ -4,7 +4,6 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil;
import com.google.gson.Gson;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.DeFileUtils;
import io.dataease.commons.utils.IPUtils;
@ -15,6 +14,7 @@ import io.dataease.i18n.Translator;
import io.dataease.listener.util.CacheUtils;
import io.dataease.plugins.common.base.domain.MyPlugin;
import io.dataease.plugins.common.base.mapper.MyPluginMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.KeywordRequest;
import io.dataease.plugins.config.LoadjarUtil;
import io.dataease.plugins.entity.PluginOperate;
@ -90,7 +90,7 @@ public class PluginService {
DeFileUtils.deleteFile(folder);
// 需要删除文件
LogUtil.error(e.getMessage(), e);
DEException.throwException(e);
DataEaseException.throwException(e);
}
//3.解析plugin.json 失败则 直接返回错误 删除文件
File folderFile = new File(folder);
@ -100,14 +100,14 @@ public class PluginService {
DeFileUtils.deleteFile(folder);
String msg = "缺少插件描述文件【plugin.json】";
LogUtil.error(msg);
DEException.throwException(msg);
DataEaseException.throwException(msg);
}
MyPluginDTO myPlugin = formatJsonFile(jsonFiles[0]);
if (!versionMatch(myPlugin.getRequire())) {
String msg = "当前插件要求系统版本最低为:" + myPlugin.getRequire();
LogUtil.error(msg);
DEException.throwException(msg);
DataEaseException.throwException(msg);
}
//4.加载jar包 失败则 直接返回错误 删除文件
File[] jarFiles = folderFile.listFiles(this::isPluginJar);
@ -116,13 +116,13 @@ public class PluginService {
DeFileUtils.deleteFile(folder);
String msg = "缺少插件jar文件";
LogUtil.error(msg);
DEException.throwException(msg);
DataEaseException.throwException(msg);
}
if (pluginExist(myPlugin)) {
String msg = "插件【" + myPlugin.getName() + "】已存在,请先卸载";
LogUtil.error(msg);
DEException.throwException(msg);
DataEaseException.throwException(msg);
}
String targetDir = null;
try {
@ -144,7 +144,7 @@ public class PluginService {
deleteJarFile(myPlugin);
}
LogUtil.error(e.getMessage(), e);
DEException.throwException(e);
DataEaseException.throwException(e);
} finally {
DeFileUtils.deleteFile(pluginDir + "temp/");
DeFileUtils.deleteFile(folder);
@ -229,7 +229,7 @@ public class PluginService {
if (ObjectUtils.isEmpty(myPlugin)) {
String msg = "当前插件不存在";
LogUtil.error(msg);
DEException.throwException(msg);
DataEaseException.throwException(msg);
}
myPlugin = deleteJarFile(myPlugin);
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
@ -238,7 +238,7 @@ public class PluginService {
if (myPlugin.getCategory().equalsIgnoreCase("datasource") && !forUpdate) {
if (CollectionUtils.isNotEmpty(datasourceService.selectByType(myPlugin.getDsType()))) {
DEException.throwException(Translator.get("i18n_plugin_not_allow_delete"));
DataEaseException.throwException(Translator.get("i18n_plugin_not_allow_delete"));
}
loadjarUtil.deleteModule(myPlugin.getModuleName() + "-" + myPlugin.getVersion());
}
@ -254,7 +254,7 @@ public class PluginService {
if (myPlugin.getCategory().equalsIgnoreCase("datasource")) {
if (CollectionUtils.isNotEmpty(datasourceService.selectByType(myPlugin.getDsType()))) {
DEException.throwException(Translator.get("i18n_plugin_not_allow_delete"));
DataEaseException.throwException(Translator.get("i18n_plugin_not_allow_delete"));
}
loadjarUtil.deleteModule(myPlugin.getModuleName() + "-" + myPlugin.getVersion());
}

View File

@ -4,7 +4,7 @@ import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.service.ExtAuthService;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CodingUtil;
@ -18,6 +18,7 @@ import io.dataease.plugins.common.base.mapper.SysUserAssistMapper;
import io.dataease.plugins.common.base.mapper.SysUserMapper;
import io.dataease.plugins.common.base.mapper.SysUsersRolesMapper;
import io.dataease.plugins.common.entity.XpackLdapUserEntity;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.xpack.dingtalk.dto.response.DingUserEntity;
import io.dataease.plugins.xpack.lark.dto.entity.LarkUserInfo;
import io.dataease.plugins.xpack.larksuite.dto.entity.UserData;
@ -389,17 +390,17 @@ public class SysUserService {
if (ObjectUtils.isEmpty(user)) {
String msg = "I18N_USER_DONOT_EXIST";
DEException.throwException(Translator.get(msg));
DataEaseException.throwException(Translator.get(msg));
}
if (!StringUtils.equals(CodingUtil.md5(request.getPassword()), user.getPassword())) {
String msg = "I18N_USER_SOURCE_PWD_ERROR";
DEException.throwException(Translator.get(msg));
DataEaseException.throwException(Translator.get(msg));
}
SysUser sysUser = new SysUser();
sysUser.setUserId(user.getUserId());
if (!request.getNewPassword().matches("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{8,30}$")) {
String msg = "I18N_USER_PWD_FORMAT_ERROR";
DEException.throwException(Translator.get(msg));
DataEaseException.throwException(Translator.get(msg));
}
sysUser.setPassword(CodingUtil.md5(request.getNewPassword()));
return sysUserMapper.updateByPrimaryKeySelective(sysUser);
@ -445,7 +446,7 @@ public class SysUserService {
@Transactional
public int delete(Long userId) {
if (userId.equals(1L)) {
DEException.throwException(Translator.get("I18n_del_admin_tips"));
DataEaseException.throwException(Translator.get("I18n_del_admin_tips"));
}
extAuthService.clearUserResource(userId);
deleteUserRoles(userId);

View File

@ -14,12 +14,12 @@ import io.dataease.controller.sys.request.LogGridRequest;
import io.dataease.dto.SysLogDTO;
import io.dataease.dto.SysLogGridDTO;
import io.dataease.dto.log.FolderItem;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.ExtSysLogMapper;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysLogExample;
import io.dataease.plugins.common.base.domain.SysLogWithBLOBs;
import io.dataease.plugins.common.base.mapper.SysLogMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.service.system.SystemParameterService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;

View File

@ -2,7 +2,7 @@ package io.dataease.service.system;
import cn.hutool.core.util.ArrayUtil;
import io.dataease.commons.constants.ParamConstants;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.commons.utils.EncryptUtils;
import io.dataease.commons.utils.LogUtil;
@ -11,6 +11,7 @@ import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SystemParameter;
import io.dataease.plugins.common.base.domain.SystemParameterExample;
import io.dataease.plugins.common.base.mapper.SystemParameterMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@ -78,7 +79,7 @@ public class EmailService {
driver.send(mimeMessage);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException(Translator.get("connection_failed"));
DataEaseException.throwException(Translator.get("connection_failed"));
}
}
@ -109,7 +110,7 @@ public class EmailService {
driver.send(mimeMessage);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException(e);
DataEaseException.throwException(e);
}
}
@ -139,7 +140,7 @@ public class EmailService {
driver.send(mimeMessage);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException(e);
DataEaseException.throwException(e);
}
}
@ -314,7 +315,7 @@ public class EmailService {
LogUtil.error(e.getMessage(), e);
String key = "connection_failed";
if (isAdmin) key = "connection_failed_admin";
DEException.throwException(Translator.get(key));
DataEaseException.throwException(Translator.get(key));
}
}
}
@ -326,7 +327,7 @@ public class EmailService {
javaMailSender.testConnection();
} catch (MessagingException e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException(Translator.get("connection_failed"));
DataEaseException.throwException(Translator.get("connection_failed"));
}
testSendEmail(email, javaMailSender, true);
}
@ -353,7 +354,7 @@ public class EmailService {
javaMailSender.testConnection();
} catch (MessagingException e) {
LogUtil.error(e.getMessage(), e);
DEException.throwException(Translator.get("connection_failed"));
DataEaseException.throwException(Translator.get("connection_failed"));
}
testSendEmail(recipients, javaMailSender, false);
}

View File

@ -1,17 +1,17 @@
package io.dataease.service.system;
import io.dataease.commons.constants.ParamConstants;
import io.dataease.commons.exception.DEException;
;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.EncryptUtils;
import io.dataease.controller.sys.response.BasicInfo;
import io.dataease.dto.SystemParameterDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.ext.ExtSystemParameterMapper;
import io.dataease.plugins.common.base.domain.FileMetadata;
import io.dataease.plugins.common.base.domain.SystemParameter;
import io.dataease.plugins.common.base.domain.SystemParameterExample;
import io.dataease.plugins.common.base.mapper.SystemParameterMapper;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.xpack.cas.dto.CasSaveResult;
import io.dataease.plugins.xpack.cas.service.CasXpackService;
@ -196,9 +196,9 @@ public class SystemParameterService {
@Transactional
public void resetCas() {
Map<String, CasXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((CasXpackService.class));
if (beansOfType.keySet().size() == 0) DEException.throwException("当前未启用CAS");
if (beansOfType.keySet().size() == 0) DataEaseException.throwException("当前未启用CAS");
CasXpackService casXpackService = SpringContextUtil.getBean(CasXpackService.class);
if (ObjectUtils.isEmpty(casXpackService)) DEException.throwException("当前未启用CAS");
if (ObjectUtils.isEmpty(casXpackService)) DataEaseException.throwException("当前未启用CAS");
String loginTypePk = "basic.loginType";
SystemParameter loginTypeParameter = systemParameterMapper.selectByPrimaryKey(loginTypePk);
@ -345,7 +345,7 @@ public class SystemParameterService {
// It's an image (only BMP, GIF, JPG and PNG are recognized).
ImageIO.read(input).toString();
} catch (Exception e) {
DEException.throwException("Uploaded images do not meet the image format requirements");
DataEaseException.throwException("Uploaded images do not meet the image format requirements");
return;
}
}

View File

@ -10,7 +10,7 @@ import io.dataease.dto.panel.PanelTemplateFileDTO;
import io.dataease.dto.templateMarket.MarketBaseResponse;
import io.dataease.dto.templateMarket.TemplateCategory;
import io.dataease.dto.templateMarket.TemplateMarketDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.service.system.SystemParameterService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -9,5 +9,10 @@ ALTER TABLE `sys_task_email`
ADD COLUMN `ext_wait_time` int(0) NOT NULL DEFAULT 0 COMMENT '加载仪表板额外等待时间(s)' AFTER `groups`;
ALTER TABLE `sys_task_email`
ADD COLUMN `role_list` varchar(255) NULL COMMENT '收件角色' AFTER `ext_wait_time`,
ADD COLUMN `org_list` varchar(255) NULL COMMENT '收件组织' AFTER `role_list`;
ADD COLUMN `role_list` longtext NULL COMMENT '收件角色' AFTER `ext_wait_time`,
ADD COLUMN `org_list` longtext NULL COMMENT '收件组织' AFTER `role_list`;
ALTER TABLE `sys_task_email`
MODIFY COLUMN `reci_users` longtext NULL COMMENT '接收人账号' AFTER `conditions`;
ALTER TABLE de_driver` ADD COLUMN `surpport_versions` LONGTEXT NULL AFTER `desc`;

View File

@ -1385,8 +1385,10 @@ export default {
filter_type: 'Filter Type',
filter_value_can_not_str: 'Value type can not input string',
enum_value_can_not_null: 'Enum Value can not empty.',
column: 'Column',
table_config: 'Table Config',
table_column_width_config: 'Column Width',
table_column_freeze: 'Column Freeze',
table_column_adapt: 'Adapt',
table_column_custom: 'Custom',
chart_table_pivot: 'Pivot Table',

View File

@ -1383,8 +1383,10 @@ export default {
filter_type: '過濾方式',
filter_value_can_not_str: '數值類型字段過濾值不能包含文本',
enum_value_can_not_null: '字段枚舉值不能為空',
column: '列',
table_config: '表格配置',
table_column_width_config: '列寬調整',
table_column_freeze: '列凍結',
table_column_adapt: '自適應',
table_column_custom: '自定義',
chart_table_pivot: '透視表',

View File

@ -1383,8 +1383,10 @@ export default {
filter_type: '过滤方式',
filter_value_can_not_str: '数值类型字段过滤值不能包含文本',
enum_value_can_not_null: '字段枚举值不能为空',
column: '列',
table_config: '表格配置',
table_column_width_config: '列宽调整',
table_column_freeze: '列冻结',
table_column_adapt: '自适应',
table_column_custom: '自定义',
chart_table_pivot: '透视表',
@ -1870,7 +1872,9 @@ export default {
show_info: '驱动信息',
file_name: '文件名',
version: '版本',
please_set_driverClass: '请指定驱动类'
please_set_driverClass: '请指定驱动类',
please_set_surpportVersions: '请输入支持的数据库大版本',
surpportVersions: '支持版本'
},
datasource: {
data_source_configuration: '数据源配置',

View File

@ -170,7 +170,9 @@ export const DEFAULT_SIZE = {
quotaSuffixFontIsItalic: false,
quotaSuffixFontIsBolder: false,
quotaSuffixLetterSpace: '0',
quotaSuffixFontShadow: false
quotaSuffixFontShadow: false,
tableColumnFreezeHead: 0,
tableColumnFreezeTail: 0
}
export const DEFAULT_SUSPENSION = {
show: true

View File

@ -91,7 +91,8 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo)
height: containerDom.offsetHeight,
showSeriesNumber: customAttr.size.showIndex,
style: getSize(chart),
conditions: getConditions(chart)
conditions: getConditions(chart),
frozenColCount: customAttr.size.tableColumnFreezeHead ?? 0
}
// 开启序号之后,第一列就是序号列,修改 label 即可
if (s2Options.showSeriesNumber) {
@ -279,7 +280,8 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
height: containerDom.offsetHeight,
showSeriesNumber: customAttr.size.showIndex,
style: getSize(chart),
conditions: getConditions(chart)
conditions: getConditions(chart),
frozenColCount: customAttr.size.tableColumnFreezeHead ?? 0
}
// 开启序号之后,第一列就是序号列,修改 label 即可
if (s2Options.showSeriesNumber) {
@ -291,7 +293,6 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
node.label = customAttr.size.indexLabel
}
}
return node.belongsCell
}
s2Options.dataCell = (viewMeta) => {
return new DataCell(viewMeta, viewMeta?.spreadsheet)

View File

@ -63,6 +63,7 @@ export const TYPE_CONFIGS = [
'tableTitleHeight',
'tableItemHeight',
'tableColumnMode',
'tableColumnFreeze',
'showIndex',
'indexLabel',
'tableColTooltip',
@ -119,7 +120,8 @@ export const TYPE_CONFIGS = [
'showIndex',
'indexLabel',
'tableColTooltip',
'showTableHeader'
'showTableHeader',
'tableColumnFreeze'
],
'title-selector-ant-v': [
'show',
@ -2081,6 +2083,7 @@ export const TYPE_CONFIGS = [
'tableTitleHeight',
'tableItemHeight',
'tableColumnWidth',
'tableColumnFreeze',
'showIndex',
'indexLabel',
'tableAutoBreakLine',
@ -2130,6 +2133,7 @@ export const TYPE_CONFIGS = [
'tableColumnWidth',
'showIndex',
'indexLabel',
'tableColumnFreeze',
'tableAutoBreakLine',
'showTableHeader'
],

View File

@ -117,13 +117,16 @@
v-show="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'"
v-model="item.value"
class="value-item"
style="margin-left: 10px;"
style="padding-left: 10px"
:placeholder="$t('chart.drag_block_label_value')"
size="mini"
clearable
@change="changeThreshold"
/>
<span v-if="item.term === 'between'">
<span
v-if="item.term === 'between'"
class="flex-between"
>
<el-input
v-model="item.min"
class="item-long-between"
@ -147,7 +150,10 @@
v-if="item.field === '1'"
:span="12"
>
<span v-show="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'">
<span
v-show="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'"
class="flex-between"
>
<el-select
v-model="item.targetField.fieldId"
size="mini"
@ -205,7 +211,10 @@
</el-select>
</span>
<span v-if="item.term === 'between'">
<span
v-if="item.term === 'between'"
class="flex-between"
>
<el-select
v-model="item.minField.fieldId"
size="mini"
@ -787,4 +796,9 @@ span {
color: #F56C6C;
font-size: 12px;
}
.flex-between {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

View File

@ -329,6 +329,21 @@
@change="changeBarSizeCase('tableColumnWidth')"
/>
</el-form-item>
<el-form-item
v-if="showProperty('tableColumnFreeze')"
:label="$t('chart.table_column_freeze')"
class="form-item"
>
<span>{{ $t('dynamic_time.before') }} </span>
<el-input-number
v-model="sizeForm.tableColumnFreezeHead"
:min="0"
:max="100"
:step-strictly="true"
@change="changeBarSizeCase('tableColumnFreezeHead')"
/>
<span> {{ $t('chart.column') }}</span>
</el-form-item>
<el-form-item
v-if="showProperty('tableAutoBreakLine')"
:label="$t('chart.table_auto_break_line')"
@ -1236,6 +1251,8 @@ export default {
this.sizeForm.liquidOutlineDistance = (this.sizeForm.liquidOutlineDistance || this.sizeForm.liquidOutlineDistance === 0) ? this.sizeForm.liquidOutlineDistance : DEFAULT_SIZE.liquidOutlineDistance
this.sizeForm.liquidWaveLength = this.sizeForm.liquidWaveLength ? this.sizeForm.liquidWaveLength : DEFAULT_SIZE.liquidWaveLength
this.sizeForm.liquidWaveCount = this.sizeForm.liquidWaveCount ? this.sizeForm.liquidWaveCount : DEFAULT_SIZE.liquidWaveCount
this.sizeForm.tableColumnFreezeHead = this.sizeForm.tableColumnFreezeHead ?? DEFAULT_SIZE.tableColumnFreezeHead
this.sizeForm.tableColumnFreezeTail = this.sizeForm.tableColumnFreezeTail ?? DEFAULT_SIZE.tableColumnFreezeTail
this.sizeForm.tablePageMode = this.sizeForm.tablePageMode ? this.sizeForm.tablePageMode : DEFAULT_SIZE.tablePageMode
this.sizeForm.tablePageSize = this.sizeForm.tablePageSize ? this.sizeForm.tablePageSize : DEFAULT_SIZE.tablePageSize

View File

@ -295,6 +295,21 @@
@change="changeBarSizeCase('tableColumnWidth')"
/>
</el-form-item>
<el-form-item
v-if="showProperty('tableColumnFreeze')"
:label="$t('chart.table_column_freeze')"
class="form-item"
>
<span>{{ $t('dynamic_time.before') }} </span>
<el-input-number
v-model="sizeForm.tableColumnFreezeHead"
:min="0"
:max="100"
:step-strictly="true"
@change="changeBarSizeCase('tableColumnFreezeHead')"
/>
<span> {{ $t('chart.column') }}</span>
</el-form-item>
<el-form-item
v-if="showProperty('showIndex')"
:label="$t('chart.table_show_index')"
@ -1680,6 +1695,8 @@ export default {
this.sizeForm.tableItemAlign = this.sizeForm.tableItemAlign ? this.sizeForm.tableItemAlign : DEFAULT_SIZE.tableItemAlign
this.sizeForm.tableRowTooltip = this.sizeForm.tableRowTooltip ?? DEFAULT_SIZE.tableRowTooltip
this.sizeForm.tableColTooltip = this.sizeForm.tableColTooltip ?? DEFAULT_SIZE.tableColTooltip
this.sizeForm.tableColumnFreezeHead = this.sizeForm.tableColumnFreezeHead ?? DEFAULT_SIZE.tableColumnFreezeHead
this.sizeForm.tableColumnFreezeTail = this.sizeForm.tableColumnFreezeTail ?? DEFAULT_SIZE.tableColumnFreezeTail
this.sizeForm.showIndex = this.sizeForm.showIndex ? this.sizeForm.showIndex : DEFAULT_SIZE.showIndex
this.sizeForm.showTableHeader = this.sizeForm.showTableHeader !== false

View File

@ -42,15 +42,18 @@
type="index"
:title="indexLabel"
:width="columnWidth"
:resizable="true"
:fixed="getFixed(-1)"
/>
<ux-table-column
v-for="field in fields"
v-for="(field, index) in fields"
:key="field.name"
:field="field.child ? '' : field.dataeaseName"
:resizable="true"
:sortable="(!mergeCells || !mergeCells.length) && (!field.child || !field.child.length)"
:title="field.name"
:width="columnWidth"
:fixed="getFixed(index)"
>
<ux-table-column
v-for="item in field.child"
@ -728,6 +731,14 @@ export default {
default:
break
}
},
getFixed(index) {
const size = JSON.parse(this.chart.customAttr).size
const { showIndex, tableColumnFreezeHead } = size
if (showIndex) {
return index < tableColumnFreezeHead - 1 ? 'left' : ''
}
return index < tableColumnFreezeHead ? 'left' : ''
}
}
}

View File

@ -29,6 +29,16 @@
autocomplete="off"
/>
</el-form-item>
<el-form-item
:label="$t('driver.surpportVersions')"
prop="surpportVersions"
>
<el-input
v-model="driverForm.surpportVersions"
style="width: 600px"
autocomplete="off"
/>
</el-form-item>
</el-form>
<el-upload
:action="baseUrl + 'driver/file/upload'"
@ -176,6 +186,13 @@ export default {
message: i18n.t('driver.please_set_driverClass'),
trigger: 'blur'
}
],
surpportVersions: [
{
required: true,
message: i18n.t('driver.please_set_surpportVersions'),
trigger: 'blur'
}
]
},
canEdit: false,

View File

@ -137,7 +137,7 @@
<el-option
v-for="item in driverList"
:key="item.id"
:label="item.name"
:label="item.nameAlias"
:value="item.id"
:disabled="!item.driverClass"
/>
@ -760,7 +760,6 @@ export default {
if (this.datasourceType.isJdbc) {
listDriverByType(this.datasourceType.type).then(res => {
this.driverList = []
this.driverList.push({ id: 'default', name: 'Default', driverClass: 'Default' })
this.driverList = this.driverList.concat(res.data)
})
}

View File

@ -213,7 +213,7 @@
<el-option
v-for="item in driverList"
:key="item.id"
:label="item.name"
:label="item.nameAlias"
:value="item.id"
:disabled="!item.driverClass"
/>
@ -1225,11 +1225,6 @@ export default {
if (this.datasourceType.isJdbc) {
listDriverByType(this.datasourceType.type).then((res) => {
this.driverList = []
this.driverList.push({
id: 'default',
name: 'Default',
driverClass: 'Default'
})
this.driverList = this.driverList.concat(res.data)
})
}

View File

@ -159,12 +159,17 @@
const param = getUrlParams(url)
if (param?.detoken) {
if(param.detoken.endsWith('#/'))
param.detoken = param.detoken.substr(0, param.detoken.length - 2)
param.detoken = param.detoken.substr(0, param.detoken.length - 2)
const redirect = window.location.href.split('?')[0]
setToken(param.detoken)
getInfo().then(res => {
setUserInfo(res.data)
const redirect = window.location.href.split('?')[0]
window.location.href = redirect
}).catch(() => {
setToken(null)
localStorage.removeItem('Authorization')
window.cookieStore.delete('Authorization')
window.location.href = redirect
})
return true

View File

@ -4,10 +4,12 @@ import com.google.gson.Gson;
import io.dataease.plugins.common.base.domain.DeDriver;
import io.dataease.plugins.common.base.mapper.DeDriverMapper;
import io.dataease.plugins.common.constants.DatasourceTypes;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableDesc;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.provider.DefaultJdbcProvider;
import io.dataease.plugins.datasource.provider.ExtendedJdbcClassLoader;
@ -17,10 +19,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.sql.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.*;
@Component()
@ -77,15 +76,22 @@ public class DmDsProvider extends DefaultJdbcProvider {
}
Connection conn;
String surpportVersions = null;
String driverClassName;
ExtendedJdbcClassLoader jdbcClassLoader;
if (isDefaultClassLoader(customDriver)) {
driverClassName = defaultDriver;
jdbcClassLoader = extendedJdbcClassLoader;
for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
if(value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())){
surpportVersions = value.getSurpportVersions();
}
}
} else {
if (deDriver == null) {
deDriver = deDriverMapper.selectByPrimaryKey(customDriver);
}
surpportVersions = deDriver.getSurpportVersions();
driverClassName = deDriver.getDriverClass();
jdbcClassLoader = getCustomJdbcClassLoader(deDriver);
}
@ -101,6 +107,11 @@ public class DmDsProvider extends DefaultJdbcProvider {
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
if(StringUtils.isNotEmpty(surpportVersions) && surpportVersions.split(",").length > 0){
if(! Arrays.asList(surpportVersions.split(",")).contains(String.valueOf(conn.getMetaData().getDatabaseMajorVersion()))){
DataEaseException.throwException("当前驱动不支持此版本!");
};
}
return conn;
}

View File

@ -47,6 +47,7 @@ public class DmService extends DatasourceService {
dataSourceType.setAliasPrefix("\"");
dataSourceType.setAliasSuffix("\"");
dataSourceType.setDatabaseClassification(DatabaseClassification.OLTP);
dataSourceType.setSurpportVersions("8");
return dataSourceType;
}

View File

@ -3,10 +3,12 @@ package io.dataease.plugins.datasource.kingbase.provider;
import com.google.gson.Gson;
import io.dataease.plugins.common.base.domain.DeDriver;
import io.dataease.plugins.common.base.mapper.DeDriverMapper;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableDesc;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.provider.DefaultJdbcProvider;
import io.dataease.plugins.datasource.provider.ExtendedJdbcClassLoader;
@ -15,10 +17,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.sql.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.*;
@Component()
@ -58,18 +57,25 @@ public class KingbaseDsProvider extends DefaultJdbcProvider {
props.setProperty("password", password);
}
}
String surpportVersions = null;
Connection conn;
String driverClassName;
ExtendedJdbcClassLoader jdbcClassLoader;
if (isDefaultClassLoader(customDriver)) {
driverClassName = defaultDriver;
jdbcClassLoader = extendedJdbcClassLoader;
for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
if(value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())){
surpportVersions = value.getSurpportVersions();
}
}
} else {
if (deDriver == null) {
deDriver = deDriverMapper.selectByPrimaryKey(customDriver);
}
driverClassName = deDriver.getDriverClass();
jdbcClassLoader = getCustomJdbcClassLoader(deDriver);
surpportVersions = deDriver.getSurpportVersions();
}
Driver driverClass = (Driver) jdbcClassLoader.loadClass(driverClassName).newInstance();
@ -83,6 +89,11 @@ public class KingbaseDsProvider extends DefaultJdbcProvider {
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
if(StringUtils.isNotEmpty(surpportVersions) && surpportVersions.split(",").length > 0){
if(! Arrays.asList(surpportVersions.split(",")).contains(String.valueOf(conn.getMetaData().getDatabaseMajorVersion()))){
DataEaseException.throwException("当前驱动不支持此版本!");
};
}
return conn;
}
@ -202,7 +213,6 @@ public class KingbaseDsProvider extends DefaultJdbcProvider {
int queryTimeout = Math.max(jdbcConfiguration.getQueryTimeout(), 0);
try (Connection con = getConnection(datasourceRequest); Statement statement = getStatement(con, queryTimeout); ResultSet resultSet = statement.executeQuery(queryStr)) {
} catch (Exception e) {
e.printStackTrace();
DataEaseException.throwException(e.getMessage());
}
return "Success";

View File

@ -59,6 +59,7 @@ public class KingbaseService extends DatasourceService {
dataSourceType.setAliasPrefix("\"");
dataSourceType.setAliasSuffix("\"");
dataSourceType.setDatabaseClassification(DatabaseClassification.OLTP);
dataSourceType.setSurpportVersions("12");
return dataSourceType;
}

View File

@ -1,15 +1,15 @@
package io.dataease.plugins.datasource.kylin.provider;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.google.gson.Gson;
import io.dataease.plugins.common.base.domain.DeDriver;
import io.dataease.plugins.common.base.mapper.DeDriverMapper;
import io.dataease.plugins.common.constants.DatasourceTypes;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableDesc;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.datasource.provider.DefaultJdbcProvider;
import io.dataease.plugins.datasource.provider.ExtendedJdbcClassLoader;
import org.apache.commons.lang3.StringUtils;
@ -51,17 +51,23 @@ public class KylinDsProvider extends DefaultJdbcProvider {
props.setProperty("password", prestoConfig.getPassword());
}
}
String surpportVersions = null;
Connection conn;
String driverClassName ;
ExtendedJdbcClassLoader jdbcClassLoader;
if(isDefaultClassLoader(customDriver)){
driverClassName = defaultDriver;
jdbcClassLoader = extendedJdbcClassLoader;
for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
if(value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())){
surpportVersions = value.getSurpportVersions();
}
}
}else {
if(deDriver == null){
deDriver = deDriverMapper.selectByPrimaryKey(customDriver);
}
surpportVersions = deDriver.getSurpportVersions();
driverClassName = deDriver.getDriverClass();
jdbcClassLoader = getCustomJdbcClassLoader(deDriver);
}
@ -76,6 +82,11 @@ public class KylinDsProvider extends DefaultJdbcProvider {
}finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
if(StringUtils.isNotEmpty(surpportVersions) && surpportVersions.split(",").length > 0){
if(! Arrays.asList(surpportVersions.split(",")).contains(String.valueOf(conn.getMetaData().getDatabaseMajorVersion()))){
DataEaseException.throwException("当前驱动不支持此版本!");
};
}
return conn;
}

View File

@ -42,6 +42,7 @@ public class KylinService extends DatasourceService {
public DataSourceType getDataSourceType() {
DataSourceType dataSourceType = new DataSourceType("kylin", "Kylin" , true , "", DatasourceCalculationMode.DIRECT, true);
dataSourceType.setDatabaseClassification(DatabaseClassification.DL);
dataSourceType.setSurpportVersions("3,4,5");
return dataSourceType;
}

View File

@ -3,10 +3,12 @@ package io.dataease.plugins.datasource.mongo.provider;
import com.google.gson.Gson;
import io.dataease.plugins.common.base.domain.DeDriver;
import io.dataease.plugins.common.base.mapper.DeDriverMapper;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableDesc;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.mongo.query.MongoConstants;
import io.dataease.plugins.datasource.provider.DefaultJdbcProvider;
@ -15,9 +17,9 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.sql.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
@ -53,18 +55,24 @@ public class MongobiDsProvider extends DefaultJdbcProvider {
props.setProperty("password", mongoConfig.getPassword());
}
}
String surpportVersions = null;
Connection conn;
String driverClassName ;
ExtendedJdbcClassLoader jdbcClassLoader;
if(isDefaultClassLoader(customDriver)){
driverClassName = defaultDriver;
jdbcClassLoader = extendedJdbcClassLoader;
for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
if(value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())){
surpportVersions = value.getSurpportVersions();
}
}
}else {
if(deDriver == null){
deDriver = deDriverMapper.selectByPrimaryKey(customDriver);
}
driverClassName = deDriver.getDriverClass();
surpportVersions = deDriver.getSurpportVersions();
jdbcClassLoader = getCustomJdbcClassLoader(deDriver);
}
@ -79,6 +87,11 @@ public class MongobiDsProvider extends DefaultJdbcProvider {
}finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
if(StringUtils.isNotEmpty(surpportVersions) && surpportVersions.split(",").length > 0){
if(! Arrays.asList(surpportVersions.split(",")).contains(String.valueOf(conn.getMetaData().getDatabaseMajorVersion()))){
DataEaseException.throwException("当前驱动不支持此版本!");
};
}
return conn;
}

View File

@ -46,6 +46,7 @@ public class MongoService extends DatasourceService {
dataSourceType.setAliasPrefix("");
dataSourceType.setAliasSuffix("");
dataSourceType.setDatabaseClassification(DatabaseClassification.OLTP);
dataSourceType.setSurpportVersions("3,4,5");
return dataSourceType;
}

View File

@ -3,10 +3,12 @@ package io.dataease.plugins.datasource.dm.provider;
import com.google.gson.Gson;
import io.dataease.plugins.common.base.domain.DeDriver;
import io.dataease.plugins.common.base.mapper.DeDriverMapper;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableDesc;
import io.dataease.plugins.common.dto.datasource.TableField;
import io.dataease.plugins.common.exception.DataEaseException;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.common.util.SpringContextUtil;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.provider.DefaultJdbcProvider;
import io.dataease.plugins.datasource.provider.ExtendedJdbcClassLoader;
@ -17,6 +19,7 @@ import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.sql.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
@ -42,7 +45,7 @@ public class PrestoDsProvider extends DefaultJdbcProvider {
String defaultDriver = prestoConfig.getDriver();
String customDriver = prestoConfig.getCustomDriver();
String surpportVersions = null;
String url = prestoConfig.getJdbc();
Properties props = new Properties();
DeDriver deDriver = null;
@ -51,9 +54,15 @@ public class PrestoDsProvider extends DefaultJdbcProvider {
ExtendedJdbcClassLoader classLoader;
if(isDefaultClassLoader(customDriver)){
classLoader = extendedJdbcClassLoader;
for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
if(value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())){
surpportVersions = value.getSurpportVersions();
}
}
}else {
deDriver = deDriverMapper.selectByPrimaryKey(customDriver);
classLoader = getCustomJdbcClassLoader(deDriver);
surpportVersions = deDriver.getSurpportVersions();
}
Class<?> ConfigurationClass = classLoader.loadClass("org.apache.hadoop.conf.Configuration");
Method set = ConfigurationClass.getMethod("set",String.class, String.class) ;
@ -99,6 +108,13 @@ public class PrestoDsProvider extends DefaultJdbcProvider {
}finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
if(StringUtils.isNotEmpty(surpportVersions) && surpportVersions.split(",").length > 0){
if(! Arrays.asList(surpportVersions.split(",")).contains(String.valueOf(conn.getMetaData().getDatabaseProductVersion().split("-")[0]))){
DataEaseException.throwException("当前驱动不支持此版本!");
};
}
return conn;
}

Some files were not shown because too many files have changed in this diff Show More