Merge branch 'dev' into pr@dev_st_fix

This commit is contained in:
dataeaseShu 2023-05-24 13:30:42 +08:00
commit c16f58a9d5
37 changed files with 314 additions and 129 deletions

View File

@ -2,17 +2,16 @@ package io.dataease.auth.filter;
import io.dataease.auth.entity.ASKToken;
import io.dataease.auth.entity.JWTToken;
import io.dataease.auth.handler.ApiKeyHandler;
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.commons.utils.TokenCacheUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMethod;
@ -26,6 +25,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
public final static String expireMessage = "Login token is expire.";
public final static String licMessage = "license invalid";
/**
@ -49,6 +49,17 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
if (ApiKeyHandler.isApiKeyCall(httpServletRequest)) {
DefaultLicenseService licenseService = CommonBeanFactory.getBean(DefaultLicenseService.class);
F2CLicenseResponse licenseResponse = null;
try {
licenseResponse = licenseService.validateLicense();
} catch (Exception e) {
throw new AuthenticationException(licMessage);
}
if (licenseResponse.getStatus() != F2CLicenseResponse.Status.valid) {
throw new AuthenticationException(licMessage);
}
ASKToken askToken = ApiKeyHandler.buildToken(httpServletRequest);
getSubject(request, response).login(askToken);
@ -87,6 +98,8 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
LogUtil.error(e);
if (e instanceof AuthenticationException && StringUtils.equals(e.getMessage(), expireMessage)) {
responseExpire(request, response, e);
} else if (StringUtils.equals(licMessage, e.getMessage())) {
responseLicError(request, response, e);
} else {
tokenError(request, response, e);
}
@ -127,4 +140,10 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
httpServletResponse.setHeader("authentication-status", "login_expire");
}
private void responseLicError(ServletRequest req, ServletResponse resp, Exception e1) {
HttpServletResponse httpServletResponse = (HttpServletResponse) resp;
httpServletResponse.addHeader("Access-Control-Expose-Headers", "authentication-status");
httpServletResponse.setHeader("authentication-status", licMessage);
}
}

View File

@ -131,6 +131,9 @@ public class MsgController {
if (msgChannelId == 5L) {
return authUserService.supportLark();
}
if (msgChannelId == 6L) {
return authUserService.supportLarksuite();
}
return true;
}).collect(Collectors.toList());
}

View File

@ -17,6 +17,8 @@ public interface ExtPanelGroupMapper {
//会级联删除pid 下的所有数据
int deleteCircle(@Param("pid") String pid, @Param("nodeType") String nodeType);
int deleteLinkDefaultCircle(@Param("pid") String pid);
int deleteCircleView(@Param("pid") String pid, @Param("nodeType") String nodeType);
int deleteCircleViewCache(@Param("pid") String pid, @Param("nodeType") String nodeType);

View File

@ -202,6 +202,10 @@
ORDER BY panel_group.node_type desc, CONVERT(panel_group.name using gbk)
</select>
<delete id="deleteLinkDefaultCircle">
delete from panel_group where FIND_IN_SET(panel_group.source, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
</delete>
<delete id="deleteCircle">
delete
from panel_group
@ -211,7 +215,6 @@
panel_group.source = #{pid}
<if test="nodeType == 'folder'">
or FIND_IN_SET(panel_group.id, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
or FIND_IN_SET(panel_group.source, GET_PANEL_GROUP_WITH_CHILDREN(#{pid}))
</if>
</delete>

View File

@ -1109,7 +1109,9 @@ public class DorisQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

View File

@ -39,8 +39,11 @@ public class MysqlDDLProvider extends DDLProviderImpl {
for (int i = 0; i < strings.length; i++) {
if (StringUtils.isEmpty(strings[i])) {
strings1[i] = null;
} else {
strings1[i] = strings[i].replace("'", "\\'");
continue;
}
strings1[i] = strings[i].replace("'", "\\'");
if(strings1[i].equals("/")){
strings1[i] = "//";
}
}
values.append("('").append(UUID.randomUUID())

View File

@ -1096,7 +1096,9 @@ public class MysqlQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == 1) {
if (request.getDatasetTableField().getDeExtractType() == 2

View File

@ -1091,7 +1091,7 @@ public class CKQueryProvider extends QueryProvider {
return null;
}
AtomicReference<ChartExtFilterRequest> atomicReference = new AtomicReference<>();
List<ChartExtFilterRequest> chartExtFilterRequests = new ArrayList<>();
requestList.forEach(request -> {
DatasetTableField datasetTableField = request.getDatasetTableField();
List<String> requestValue = request.getValue();
@ -1106,12 +1106,12 @@ public class CKQueryProvider extends QueryProvider {
requestCopy.setValue(new ArrayList<String>() {{
add(String.format(toDateTime64, "'" + simpleDateFormat.format(new Date(Long.parseLong(requestValue.get(1)))) + "'"));
}});
atomicReference.set(requestCopy);
chartExtFilterRequests.add(requestCopy);
}
});
if (ObjectUtils.isNotEmpty(atomicReference.get())) {
requestList.add(atomicReference.get());
if (CollectionUtils.isNotEmpty(chartExtFilterRequests)) {
requestList.addAll(chartExtFilterRequests);
}
List<SQLObj> list = new ArrayList<>();
for (ChartExtFilterRequest request : requestList) {
@ -1181,7 +1181,9 @@ public class CKQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

View File

@ -1169,7 +1169,9 @@ public class Db2QueryProvider extends QueryProvider {
whereValue = "('" + StringUtils.join(value, "','") + "')";
}
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

View File

@ -1119,7 +1119,9 @@ public class EsQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

View File

@ -1075,7 +1075,9 @@ public class HiveQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

View File

@ -1077,7 +1077,9 @@ public class ImpalaQueryProvider extends QueryProvider {
whereValue = "('" + StringUtils.join(value, "','") + "')";
}
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

View File

@ -979,7 +979,9 @@ public class MongoQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

View File

@ -1104,7 +1104,9 @@ public class MysqlQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == 1) {
if (request.getDatasetTableField().getDeExtractType() == 2

View File

@ -1259,7 +1259,9 @@ public class OracleQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

View File

@ -1127,7 +1127,9 @@ public class PgQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

View File

@ -1108,7 +1108,9 @@ public class RedshiftQueryProvider extends QueryProvider {
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

View File

@ -54,6 +54,7 @@ public class SqlserverQueryProvider extends QueryProvider {
case "NCHAR":
case "NTEXT":
case "VARCHAR":
case "NVARCHAR":
case "TEXT":
case "TINYTEXT":
case "MEDIUMTEXT":
@ -898,11 +899,19 @@ public class SqlserverQueryProvider extends QueryProvider {
} else if (StringUtils.equalsIgnoreCase(item.getTerm(), "not_empty")) {
whereValue = "''";
} else if (StringUtils.containsIgnoreCase(item.getTerm(), "in") || StringUtils.containsIgnoreCase(item.getTerm(), "not in")) {
whereValue = "('" + String.join("','", value.split(",")) + "')";
if(field.getType().equals("NVARCHAR")){
whereValue = Arrays.asList(value.split(",")).stream().map(str ->{return "N"+ str;}).collect(Collectors.joining(","));
}else {
whereValue = "('" + String.join("','", value.split(",")) + "')";
}
} else if (StringUtils.containsIgnoreCase(item.getTerm(), "like")) {
whereValue = "'%" + value + "%'";
} else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
if(field.getType().equals("NVARCHAR")){
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value);
}else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
}
}
SQLObj build = SQLObj.builder()
.whereField(whereName)
@ -1025,11 +1034,19 @@ public class SqlserverQueryProvider extends QueryProvider {
} else if (StringUtils.equalsIgnoreCase(filterItemDTO.getTerm(), "not_empty")) {
whereValue = "''";
} else if (StringUtils.containsIgnoreCase(filterItemDTO.getTerm(), "in") || StringUtils.containsIgnoreCase(filterItemDTO.getTerm(), "not in")) {
whereValue = "('" + String.join("','", value.split(",")) + "')";
if(field.getType().equals("NVARCHAR")){
whereValue = Arrays.asList(value.split(",")).stream().map(str ->{return "N"+ str;}).collect(Collectors.joining(","));
}else {
whereValue = "('" + String.join("','", value.split(",")) + "')";
}
} else if (StringUtils.containsIgnoreCase(filterItemDTO.getTerm(), "like")) {
whereValue = "'%" + value + "%'";
} else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
if(field.getType().equals("NVARCHAR")){
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value);
}else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value);
}
}
list.add(SQLObj.builder()
.whereField(whereName)
@ -1129,9 +1146,15 @@ public class SqlserverQueryProvider extends QueryProvider {
String whereValue = "";
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
whereValue = "('" + StringUtils.join(value, "','") + "')";
if(request.getDatasetTableField().getType().equals("NVARCHAR")){
whereValue = value.stream().map(str ->{return "N"+ str;}).collect(Collectors.joining(","));
}else {
whereValue = "('" + StringUtils.join(value, "','") + "')";
}
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
whereValue = "'%" + value.get(0) + "%'";
String keyword = value.get(0).toUpperCase();
whereValue = "'%" + keyword + "%'";
whereName = "upper(" + whereName + ")";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -1142,7 +1165,13 @@ public class SqlserverQueryProvider extends QueryProvider {
whereValue = String.format(SqlServerSQLConstants.WHERE_BETWEEN, value.get(0), value.get(1));
}
} else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value.get(0));
if(request.getDatasetTableField().getType().equals("NVARCHAR")){
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, value.get(0));
}else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, value.get(0));
}
}
list.add(SQLObj.builder()
.whereField(whereName)
@ -1299,11 +1328,19 @@ public class SqlserverQueryProvider extends QueryProvider {
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_empty")) {
whereValue = "''";
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
whereValue = "('" + StringUtils.join(f.getValue(), "','") + "')";
if(y.getType().equals("NVARCHAR")){
whereValue = Arrays.asList(f.getValue().split(",")).stream().map(str ->{return "N"+ str;}).collect(Collectors.joining(","));
}else {
whereValue = "('" + String.join("','", f.getValue().split(",")) + "')";
}
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
whereValue = "'%" + f.getValue() + "%'";
} else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, f.getValue());
if(y.getType().equals("NVARCHAR")){
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE_CH, f.getValue());
}else {
whereValue = String.format(SqlServerSQLConstants.WHERE_VALUE_VALUE, f.getValue());
}
}
list.add(SQLObj.builder()
.whereField(fieldAlias)

View File

@ -725,7 +725,9 @@ public class ChartViewService {
xAxis = xAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.keySet().contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
yAxis = yAxis.stream().filter(item -> chartViewFieldNameList.contains(item.getDataeaseName()) || (!desensitizationList.keySet().contains(item.getDataeaseName()) && dataeaseNames.contains(item.getDataeaseName()))).collect(Collectors.toList());
}
Map<String, ChartViewFieldDTO> chartFieldMap = Stream.of(xAxisBase, xAxisExt, extStack)
.flatMap(Collection::stream)
.collect(Collectors.toMap(ChartViewFieldDTO::getId, o -> o, ((p, n) -> p)));
// 过滤来自仪表板的条件
List<ChartExtFilterRequest> extFilterList = new ArrayList<>();
//组件过滤条件
@ -834,6 +836,14 @@ public class ChartViewService {
if (!desensitizationList.keySet().contains(datasetTableField.getDataeaseName()) && dataeaseNames.contains(datasetTableField.getDataeaseName())) {
request.setDatasetTableField(datasetTableField);
if (StringUtils.equalsIgnoreCase(datasetTableField.getTableId(), view.getTableId())) {
// 设置日期格式以视图字段设置的格式为准先不处理组件的条件因为格式无法统一
if (request.getDatasetTableField() != null) {
ChartViewFieldDTO chartViewFieldDTO = chartFieldMap.get(request.getDatasetTableField().getId());
if (chartViewFieldDTO != null) {
request.setDatePattern(chartViewFieldDTO.getDatePattern());
request.setDateStyle(chartViewFieldDTO.getDateStyle());
}
}
if (CollectionUtils.isNotEmpty(request.getViewIds())) {
if (request.getViewIds().contains(view.getId())) {
extFilterList.add(request);
@ -883,9 +893,6 @@ public class ChartViewService {
ChartDrillRequest head = drillRequestList.get(0);
Map<String, String> dimValMap = new HashMap<>();
head.getDimensionList().forEach(item -> dimValMap.put(item.getId(), item.getValue()));
Map<String, ChartViewFieldDTO> fieldMap = Stream.of(xAxisBase, xAxisExt, extStack)
.flatMap(Collection::stream)
.collect(Collectors.toMap(ChartViewFieldDTO::getId, o -> o, ((p, n) -> p)));
for (int i = 0; i < drillRequestList.size(); i++) {
ChartDrillRequest request = drillRequestList.get(i);
ChartViewFieldDTO chartViewFieldDTO = drill.get(i);
@ -896,7 +903,7 @@ public class ChartViewService {
fieldsToFilter.add(chartViewFieldDTO);
dimValMap.put(requestDimension.getId(), requestDimension.getValue());
if (!checkDrillExist(xAxis, extStack, requestDimension.getId(), view)) {
fieldMap.put(chartViewFieldDTO.getId(), chartViewFieldDTO);
chartFieldMap.put(chartViewFieldDTO.getId(), chartViewFieldDTO);
xAxis.add(chartViewFieldDTO);
}
if (i == drillRequestList.size() - 1) {
@ -916,8 +923,8 @@ public class ChartViewService {
DatasetTableField datasetTableField = dataSetTableFieldsService.get(tmpField.getId());
tmpFilter.setDatasetTableField(datasetTableField);
tmpFilter.setOperator("in");
tmpFilter.setDateStyle(fieldMap.get(tmpField.getId()).getDateStyle());
tmpFilter.setDatePattern(fieldMap.get(tmpField.getId()).getDatePattern());
tmpFilter.setDateStyle(chartFieldMap.get(tmpField.getId()).getDateStyle());
tmpFilter.setDatePattern(chartFieldMap.get(tmpField.getId()).getDatePattern());
tmpFilter.setFieldId(tmpField.getId());
tmpFilter.setValue(Collections.singletonList(dimValMap.get(tmpField.getId())));
extFilterList.add(tmpFilter);

View File

@ -1,8 +1,8 @@
package io.dataease.service.chart.util;
import cn.hutool.core.util.ArrayUtil;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.dto.chart.*;
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
import io.dataease.plugins.xpack.auth.dto.request.ColumnPermissionItem;
import org.apache.commons.collections4.CollectionUtils;
@ -1071,11 +1071,11 @@ public class ChartDataBuild {
break;
}
if (originStr.length() >= columnPermissionItem.getDesensitizationRule().getM() && originStr.length() >= columnPermissionItem.getDesensitizationRule().getN()) {
desensitizationStr = "***" + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, columnPermissionItem.getDesensitizationRule().getN()) + "***";
desensitizationStr = buildPrefix(columnPermissionItem.getDesensitizationRule().getM()) + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, columnPermissionItem.getDesensitizationRule().getN()) + "***";
break;
}
if (originStr.length() >= columnPermissionItem.getDesensitizationRule().getM() && originStr.length() < columnPermissionItem.getDesensitizationRule().getN()) {
desensitizationStr = "***" + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, originStr.length());
desensitizationStr = buildPrefix(columnPermissionItem.getDesensitizationRule().getM()) + StringUtils.substring(originStr, columnPermissionItem.getDesensitizationRule().getM() - 1, originStr.length());
}
break;
default:
@ -1086,6 +1086,18 @@ public class ChartDataBuild {
return desensitizationStr;
}
private static String buildPrefix(Integer integer) {
String prefix = "";
if (integer <= 1) {
return prefix;
}
for (int i = 0; i < integer - 1; i++) {
prefix = prefix + "*";
}
return prefix;
}
private static Map<String, Object> transTableNormal(List<ChartViewFieldDTO> fields, ChartViewWithBLOBs view, List<String[]> data, Map<String, ColumnPermissionItem> desensitizationList) {
Map<String, Object> map = new TreeMap<>();
List<Map<String, Object>> tableRow = new ArrayList<>();

View File

@ -34,7 +34,6 @@ import io.dataease.plugins.common.base.mapper.*;
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.chart.ChartViewFieldDTO;
import io.dataease.plugins.common.dto.dataset.SqlVariableDetails;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableField;
@ -1071,7 +1070,7 @@ public class DataSetTableService {
defaultsSqlVariableDetail.getDefaultValueScope().equals(SqlVariableDetails.DefaultValueScope.ALLSCOPE) && StringUtils.isNotEmpty(defaultsSqlVariableDetail.getDefaultValue())) {
sql = sql.replace(matcher.group(), defaultsSqlVariableDetail.getDefaultValue());
}
if (isEdit && defaultsSqlVariableDetail != null && StringUtils.isNotEmpty(defaultsSqlVariableDetail.getDefaultValue())){
if (isEdit && defaultsSqlVariableDetail != null && StringUtils.isNotEmpty(defaultsSqlVariableDetail.getDefaultValue())) {
sql = sql.replace(matcher.group(), defaultsSqlVariableDetail.getDefaultValue());
}
}
@ -1171,7 +1170,7 @@ public class DataSetTableService {
if (binaryExpression != null) {
if (!(binaryExpression.getLeftExpression() instanceof BinaryExpression) && !(binaryExpression.getLeftExpression() instanceof InExpression) && hasVariable(binaryExpression.getRightExpression().toString())) {
stringBuilder.append(SubstitutedSql);
}else {
} else {
expr.accept(getExpressionDeParser(stringBuilder));
}
} else {
@ -1258,7 +1257,7 @@ public class DataSetTableService {
throw new Exception(Translator.get("i18n_invalid_ds"));
}
String tmpSql = removeVariables(sql, ds.getType());
if(!realData){
if (!realData) {
tmpSql.replaceAll(SubstitutedSql, SubstitutedSqlVirtualData);
}
if (dataSetTableRequest.getMode() == 1 && (tmpSql.contains(SubstitutedParams) || tmpSql.contains(SubstitutedSql.trim()))) {
@ -2022,7 +2021,9 @@ public class DataSetTableService {
// custom 创建doris视图
createDorisView(TableUtils.tableName(datasetTable.getId()), sql);
datasourceRequest.setQuery(sql);
// getQuerySql to get field
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(qp.createSQLPreview(sql, null));
fields = datasourceProvider.fetchResultField(datasourceRequest);
for (DatasetTableField field : fieldList) {
for (TableField tableField : fields) {
@ -2045,8 +2046,9 @@ public class DataSetTableService {
String sql = (String) sqlMap.get("sql");
List<DatasetTableField> fieldList = (List<DatasetTableField>) sqlMap.get("field");
datasourceRequest.setQuery(sql);
// getQuerySql to get field
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(qp.createSQLPreview(sql, null));
fields = datasourceProvider.fetchResultField(datasourceRequest);
for (DatasetTableField field : fieldList) {

View File

@ -156,6 +156,12 @@ public class DataSetTableTaskLogService {
entity2.setOperator("eq");
entity2.setValue("1");
conditionEntities.add(entity2);
conditionEntities = conditionEntities.stream().map(conditionEntity -> {
if(conditionEntity.getField().equals("dataset_table_task.last_exec_status")){
conditionEntity.setField("dataset_table_task_log.status");
}
return conditionEntity;
}).collect(Collectors.toList());
request.setConditions(conditionEntities);
GridExample gridExample = request.convertExample();

View File

@ -208,7 +208,10 @@ public class PermissionService {
dataSetColumnPermissionsDTO.setDatasetId(datasetId);
dataSetColumnPermissionsDTO.setAuthTargetIds(Collections.singletonList(userId));
dataSetColumnPermissionsDTO.setAuthTargetType("user");
datasetColumnPermissions.addAll(columnPermissionService.searchPermissions(dataSetColumnPermissionsDTO));
List<DataSetColumnPermissionsDTO> dataSetColumnPermissionsDTOS = columnPermissionService.searchPermissions(dataSetColumnPermissionsDTO);
if(CollectionUtils.isNotEmpty(dataSetColumnPermissionsDTOS)){
datasetColumnPermissions.addAll(dataSetColumnPermissionsDTOS);
}
if (CollectionUtils.isNotEmpty(roleIds)) {
DataSetColumnPermissionsDTO request = new DataSetColumnPermissionsDTO();
request.setDatasetId(datasetId);

View File

@ -305,6 +305,7 @@ public class PanelGroupService {
extPanelGroupMapper.deleteCircleView(id, nodeType);
extPanelGroupMapper.deleteCircleViewCache(id, nodeType);
// 同时会删除对应默认仪表盘
extPanelGroupMapper.deleteLinkDefaultCircle(id);
extPanelGroupMapper.deleteCircle(id, nodeType);
storeService.removeByPanelId(id);
shareService.delete(id, null);

View File

@ -150,13 +150,13 @@ export default {
}
})
chartBatchCopy({ 'sourceAndTargetIds': sourceAndTargetIds }, state.panel.panelInfo.id).then((rsp) => {
needAdaptor && adaptCurThemeCommonStyle(newCop)
needAdaptor && adaptCurThemeCommonStyle(newCop,'copy')
store.commit('addComponent', { component: newCop })
})
} else {
const newCop = deepCopy(data)
newCop.id = uuid.v1()
needAdaptor && adaptCurThemeCommonStyle(newCop)
needAdaptor && adaptCurThemeCommonStyle(newCop,'copy')
store.commit('addComponent', { component: newCop })
}
if (state.isCut) {

View File

@ -375,7 +375,7 @@ export function adaptCurTheme(customStyle, customAttr, chartType) {
}
}
export function adaptCurThemeCommonStyle(component) {
export function adaptCurThemeCommonStyle(component,adaptFrom = 'them') {
const commonStyle = store.state.canvasStyleData.chartInfo.chartCommonStyle
for (const key in commonStyle) {
Vue.set(component.commonBackground, key, commonStyle[key])
@ -383,8 +383,10 @@ export function adaptCurThemeCommonStyle(component) {
if (isFilterComponent(component.component)) {
const filterStyle = store.state.canvasStyleData.chartInfo.filterStyle
for (const styleKey in filterStyle) {
// 位置属性不修改
if (styleKey !== 'horizontal' && styleKey !== 'vertical') {
if(adaptFrom === 'copy'){
Vue.set(component.style, styleKey, filterStyle[styleKey])
}else if (adaptFrom === 'them' && styleKey !== 'horizontal' && styleKey !== 'vertical') {
// 主题变化位置属性不修改
Vue.set(component.style, styleKey, filterStyle[styleKey])
}
}

View File

@ -25,7 +25,7 @@
<el-tab-pane
v-for="(item, index) in element.options.tabList"
:key="item.name+index"
:lazy="false"
:lazy="true"
:name="item.name"
>
<span slot="label">

View File

@ -109,6 +109,13 @@ const actions = {
if (!data) {
reject('Verification failed, please Login again.')
}
const historyUserId = localStorage.getItem('userId')
if(historyUserId && historyUserId !== data.userId+''){
const clearLocalStorage = [ 'panel-main-tree', 'panel-default-tree','chart-tree','dataset-tree']
clearLocalStorage.forEach((item) => {
localStorage.removeItem(item)
})
}
localStorage.setItem('userId', data.userId)
const currentUser = data
commit('SET_USER', currentUser)

View File

@ -62,6 +62,11 @@ export function getCustomTheme(chart) {
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
seriesText: {
fill: DEFAULT_COLOR_CASE.tableItemBgColor,
fontSize: DEFAULT_SIZE.tableItemFontSize,
textAlign: itemAlign
}
},
colCell: {
@ -140,6 +145,7 @@ export function getCustomTheme(chart) {
theme.rowCell.bolderText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.rowCell.text.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.rowCell.measureText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.rowCell.seriesText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
} else {
theme.rowCell.cell.backgroundColor = i_c // 这个参数其实只对开启序号列的行头生效
theme.rowCell.cell.horizontalBorderColor = i_c
@ -147,6 +153,7 @@ export function getCustomTheme(chart) {
theme.rowCell.bolderText.fill = c.tableFontColor
theme.rowCell.text.fill = c.tableFontColor
theme.rowCell.measureText.fill = c.tableFontColor
theme.rowCell.seriesText.fill = c.tableFontColor
}
theme.colCell.cell.backgroundColor = h_c
@ -187,6 +194,8 @@ export function getCustomTheme(chart) {
theme.rowCell.text.textAlign = h_a
theme.rowCell.measureText.fontSize = parseInt(s.tableTitleFontSize)
theme.rowCell.measureText.textAlign = h_a
theme.rowCell.seriesText.fontSize = parseInt(s.tableTitleFontSize)
theme.rowCell.seriesText.textAlign = h_a
} else {
// 序号列的数字单元格内容样式使用指标的内容样式而不是表头的内容样式
theme.rowCell.bolderText.fontSize = parseInt(s.tableItemFontSize)
@ -195,6 +204,8 @@ export function getCustomTheme(chart) {
theme.rowCell.text.textAlign = i_a
theme.rowCell.measureText.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.measureText.textAlign = i_a
theme.rowCell.seriesText.fontSize = parseInt(s.tableItemFontSize)
theme.rowCell.seriesText.textAlign = i_a
}
theme.rowCell.seriesNumberWidth = parseInt(s.tableColumnWidth)

View File

@ -83,9 +83,9 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
chart_option.tooltip.borderColor = bgColor
}
}
chart_option.title.text = chart.title
// 处理data
if (chart.data) {
chart_option.title.text = chart.title
if (chart.data.series && chart.data.series.length > 0) {
chart_option.series[0].name = chart.data.series[seriesIndex].name
chart_option.series[0].selectedMode = true

View File

@ -18,7 +18,7 @@
>{{ $t('chart.show') }}
</el-checkbox>
</el-form-item>
<div v-show="titleForm.show">
<div v-show="titleForm.show || chart.type ==='richTextView'">
<el-form-item
v-show="showProperty('title')"
v-if="!batchOptStatus"

View File

@ -2953,7 +2953,7 @@ export default {
//
changeChart() {
const optType = this.view.tableId === this.changeTable.id ? 'same' : 'change'
const optType = this.view.tableId === this.changeTable.id && this.view.dataFrom!=='template' ? 'same' : 'change'
//
if (optType === 'change') {
this.view.dataFrom = 'dataset'

View File

@ -91,8 +91,6 @@ export default {
computed: {},
mounted() {},
beforeCreate() {
// this.loadChannelData()
channelList().then((res) => {
this.msg_channels = res.data
})
@ -153,12 +151,6 @@ export default {
// this.checkBoxStatus(node, )
}
},
//
loadChannelData() {
channelList().then((res) => {
this.msg_channels = res.data
})
},
//
loadSettingData(callBack) {
// this.setting_data = {}

View File

@ -447,12 +447,13 @@ export default {
this.currentElement = JSON.parse(JSON.stringify(this.element))
this.myAttrs = this.currentElement.options.attrs
this.treeNode(this.groupForm)
this.loadViews()
if (this.myAttrs && this.myAttrs.dragItems) {
this.enableSureButton()
}
this.initWithField()
this.loadViews()
this.ProhibitMultiple()
},
mounted() {
@ -462,7 +463,29 @@ export default {
bus.$off('valid-values-change', this.validateFilterValue)
},
methods: {
checkSuperior(list) {
let fieldValid = false
const fieldId = this.myAttrs?.fieldId
if (fieldId && list?.length) {
const stack = [...list]
while (stack.length) {
const item = stack.pop()
if (item.id === fieldId) {
fieldValid = true
break
}
if (item.children?.length) {
item.children.forEach(kid => stack.push(kid))
}
}
}
if (!fieldValid) {
this.myAttrs.fieldId = null
this.myAttrs.dragItems = []
this.myAttrs.fieldsParent = null
}
return fieldValid
},
treeNode(cache) {
const modelInfo = localStorage.getItem('dataset-tree')
const userCache = (modelInfo && cache)
@ -471,6 +494,7 @@ export default {
const results = this.buildTree(this.tData)
this.defaultData = JSON.parse(JSON.stringify(results))
this.treeData = JSON.parse(JSON.stringify(results))
return
}
queryAuthModel({ modelType: 'dataset' }, !userCache).then(res => {
localStorage.setItem('dataset-tree', JSON.stringify(res.data))
@ -488,8 +512,8 @@ export default {
if (this.myAttrs.fieldsParent) {
this.fieldsParent = this.myAttrs.fieldsParent
this.$nextTick(() => {
this.activeName === 'dataset' && this.showFieldData(this.fieldsParent)
this.activeName !== 'dataset' && this.comShowFieldData(this.fieldsParent)
this.activeName === 'dataset' && this.showFieldData(this.fieldsParent, true)
this.activeName !== 'dataset' && this.comShowFieldData(this.fieldsParent, true)
})
}
}
@ -692,7 +716,7 @@ export default {
},
removeTail(bread) {
if (!bread.id) {
if (!bread?.id) {
this.dataSetBreads = this.dataSetBreads.slice(0, 1)
this.dataSetBreads[this.dataSetBreads.length - 1]['link'] = false
return
@ -718,7 +742,7 @@ export default {
this.expandedArray = []
this.keyWord = ''
this.isTreeSearch = false
if (bread.id) {
if (bread?.id) {
const node = this.getNode(bread.id, this.treeData)
if (node) {
this.tempTreeData = node.children
@ -736,15 +760,17 @@ export default {
this.comRemoveTail()
},
loadField(tableId) {
fieldListWithPermission(tableId).then(res => {
let data = res.data
if (this.widget && this.widget.filterFieldMethod) {
data = this.widget.filterFieldMethod(data)
}
this.originFieldData = data
this.fieldData = JSON.parse(JSON.stringify(data))
})
async loadField(tableId, init) {
const res = await fieldListWithPermission(tableId)
let data = res.data || []
if (init && !this.checkSuperior(data)) {
this.backToLink()
}
if (this.widget && this.widget.filterFieldMethod) {
data = this.widget.filterFieldMethod(data)
}
this.originFieldData = data
this.fieldData = JSON.parse(JSON.stringify(data))
},
loadDatasetParams(tableId) {
var type = 'TEXT'
@ -758,22 +784,24 @@ export default {
this.datasetParams = res.data || []
})
},
comLoadField(tableId) {
fieldListWithPermission(tableId).then(res => {
let data = res.data
if (this.widget && this.widget.filterFieldMethod) {
data = this.widget.filterFieldMethod(data)
}
this.originComFieldData = data
this.comFieldData = JSON.parse(JSON.stringify(data))
})
async comLoadField(tableId, init) {
const res = await fieldListWithPermission(tableId)
let data = res.data || []
if (init && !this.checkSuperior(data)) {
this.comBackLink()
}
if (this.widget && this.widget.filterFieldMethod) {
data = this.widget.filterFieldMethod(data)
}
this.originComFieldData = data
this.comFieldData = JSON.parse(JSON.stringify(data))
},
showFieldData(row) {
showFieldData(row, init) {
this.keyWord = ''
this.showDomType = 'field'
this.addQueue(row)
this.fieldsParent = row
this.loadField(row.id)
this.loadField(row.id, init)
this.loadDatasetParams(row.id)
},
showNextGroup(row) {
@ -782,13 +810,13 @@ export default {
this.showDomType = 'tree'
this.addQueue(row)
},
comShowFieldData(row) {
comShowFieldData(row, init) {
this.viewKeyWord = ''
this.comShowDomType = 'field'
this.comSetTailLink(row)
this.comAddTail(row)
this.fieldsParent = row
this.comLoadField(row.tableId)
this.comLoadField(row.tableId, init)
},
onMove(e, originalEvent) {
this.showTips = false

View File

@ -85,6 +85,7 @@ export default {
}
},
mounted() {
this.$store.commit('setMobileLayoutStatus', false)
// init all views (include plugins) base info
localStorage.removeItem('plugin-views')
pluginTypes().then(res => {

View File

@ -17,7 +17,7 @@
style="border-bottom: 1px solid;border-bottom-color:#E6E6E6;"
>
<div style="height: 100%;">
<share-head />
<share-head/>
</div>
</el-row>
<el-row
@ -29,21 +29,26 @@
<div style="height: 100%;">
<el-col
:span="12"
style="text-overflow:ellipsis;overflow: hidden;white-space: nowrap;font-size: 14px"
style="font-size: 14px;display: flex"
>
<span class="panel-name">{{ panelInfo.name || '测试仪表板' }}</span>
<span
v-if="panelInfo.isDefault"
style="color: green;font-size: 12px"
>({{ $t('panel.default_panel_name') }}:{{ panelInfo.defaultPanelName }})</span>
<span
v-if="panelInfo.sourcePanelName"
style="color: green;font-size: 12px"
>&nbsp;({{ $t('panel.source_panel_name') }}:{{ panelInfo.sourcePanelName }})</span>
<span
v-if="!hasStar && panelInfo && showType !== 1&&panelInfo.status==='publish'"
style="margin-left: 9px"
<div :title="showName" style="text-overflow:ellipsis;overflow: hidden;white-space: nowrap;font-size: 14px;max-width: 300px"><span
class="panel-name"
>
{{ panelInfo.name || '测试仪表板' }}</span>
<span
v-if="panelInfo.isDefault"
style="color: green;font-size: 12px"
>({{ $t('panel.default_panel_name') }}:{{ panelInfo.defaultPanelName }})</span>
<span
v-if="panelInfo.sourcePanelName"
style="color: green;font-size: 12px"
>&nbsp;({{ $t('panel.source_panel_name') }}:{{ panelInfo.sourcePanelName }})</span>
</div>
<div style="width: 200px">
<span
v-if="!hasStar && panelInfo && showType !== 1&&panelInfo.status==='publish'"
style="margin-left: 9px"
>
<el-tooltip :content="$t('panel.store')">
<i
class="el-icon-star-off"
@ -51,10 +56,10 @@
/>
</el-tooltip>
</span>
<span
v-if="hasStar && panelInfo && showType !== 1&&panelInfo.status==='publish'"
style="margin-left: 9px"
>
<span
v-if="hasStar && panelInfo && showType !== 1&&panelInfo.status==='publish'"
style="margin-left: 9px"
>
<el-tooltip :content="$t('commons.cancel') + $t('panel.store')">
<i
class="el-icon-star-on"
@ -62,23 +67,27 @@
/>
</el-tooltip>
</span>
<template v-if="panelInfo.creatorName">
<el-divider
style="margin: 0 16px;"
direction="vertical"
/>
<span class="panel-create">
<template v-if="panelInfo.creatorName">
<el-divider
style="margin: 0 16px;"
direction="vertical"
/>
<span class="panel-create">
{{ $t('panel.create_by') + ':' + panelInfo.creatorName }}
</span>
</template>
<el-popover
placement="right-start"
width="400"
trigger="click"
>
<panel-detail-info />
<svg-icon slot="reference" style="margin-left: 4px;cursor: pointer;font-size: 14px;" class="icon-class" icon-class="icon_info_outlined" />
</el-popover>
</template>
<el-popover
placement="right-start"
width="400"
trigger="click"
>
<panel-detail-info/>
<svg-icon slot="reference" style="margin-left: 4px;cursor: pointer;font-size: 14px;" class="icon-class"
icon-class="icon_info_outlined"
/>
</el-popover>
</div>
</el-col>
<el-col :span="12">
@ -427,6 +436,17 @@ export default {
}
},
computed: {
showName(){
let name = this.panelInfo.name || '测试仪表板'
if(this.panelInfo.isDefault){
name = name +'('+ this.$t('panel.default_panel_name') +':'+ this.panelInfo.defaultPanelName +')'
}
if(this.panelInfo.sourcePanelName){
name = name +'('+ this.$t('panel.source_panel_name') +':'+ this.panelInfo.sourcePanelName +')'
}
return name
},
mainCanvasComponentData() {
return getNowCanvasComponentData(this.canvasId)
},
@ -841,6 +861,7 @@ export default {
font-size: 16px;
font-weight: 500;
line-height: 24px;
flex: 1;
color: var(--deTextPrimary, #1F2329);
}

View File

@ -454,6 +454,7 @@
size="840px"
:before-close="closeEditItem"
direction="rtl"
:wrapper-closable="false"
>
<el-steps
:active="active"