From f9401cabb2afcc9ce69f0ea3aa8a27f6f4284ed1 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 9 Feb 2023 18:36:14 +0800 Subject: [PATCH 01/48] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=AE=A1=E7=90=86api=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/plugins/server/XAuthServer.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java b/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java index 331d6b1c58..1cd27cad47 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java @@ -16,19 +16,20 @@ import io.dataease.plugins.xpack.auth.dto.request.XpackSysAuthRequest; import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetail; import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetailDTO; import io.dataease.plugins.xpack.auth.dto.response.XpackVAuthModelDTO; +import io.dataease.plugins.xpack.auth.service.AuthXpackService; import io.dataease.service.datasource.DatasourceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.*; -import io.dataease.plugins.xpack.auth.service.AuthXpackService; -import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; -@ApiIgnore +@Api(tags = "权限管理") @RequestMapping("/plugin/auth") @RestController public class XAuthServer { @@ -41,6 +42,7 @@ public class XAuthServer { @RequiresPermissions("auth:read") @PostMapping("/authModels") @I18n + @ApiOperation("根据类型查询权限树") public List authModels(@RequestBody XpackBaseTreeRequest request) { AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); CurrentUserDto user = AuthUtils.getUser(); @@ -49,6 +51,7 @@ public class XAuthServer { @RequiresPermissions("auth:read") @PostMapping("/authDetails") + @ApiOperation("查询权限源目标映射关系") public Map> authDetails(@RequestBody XpackSysAuthRequest request) { AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); return sysAuthService.searchAuthDetails(request); @@ -57,6 +60,7 @@ public class XAuthServer { @RequiresPermissions("auth:read") @GetMapping("/authDetailsModel/{authType}/{direction}") @I18n + @ApiOperation("查询授权明细") public List authDetailsModel(@PathVariable String authType, @PathVariable String direction) { AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); List authDetails = sysAuthService.searchAuthDetailsModel(authType); @@ -72,6 +76,7 @@ public class XAuthServer { @RequiresPermissions("auth:read") @PostMapping("/authChange") + @ApiOperation("变更授权信息") public void authChange(@RequestBody XpackSysAuthRequest request) { AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); CurrentUserDto user = AuthUtils.getUser(); @@ -157,17 +162,17 @@ public class XAuthServer { } @GetMapping("/getDatasourceTypes") - public List getDatasourceTypes(){ - Collection activeType = datasourceService.types(); - Map activeTypeMap = activeType.stream().collect(Collectors.toMap(DataSourceType::getType, DataSourceType::getName)); - activeTypeMap.put("all","所有数据源"); + public List getDatasourceTypes() { + Collection activeType = datasourceService.types(); + Map activeTypeMap = activeType.stream().collect(Collectors.toMap(DataSourceType::getType, DataSourceType::getName)); + activeTypeMap.put("all", "所有数据源"); AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); List presentTypes = sysAuthService.getDatasourceTypes(); presentTypes.stream().forEach(datasourceBaseType -> { - if(activeTypeMap.get(datasourceBaseType.getType())!=null){ + if (activeTypeMap.get(datasourceBaseType.getType()) != null) { datasourceBaseType.setName(activeTypeMap.get(datasourceBaseType.getType())); } }); - return presentTypes; + return presentTypes; } } From 1b83afc800928f21a46f8dc4c82252103624a250 Mon Sep 17 00:00:00 2001 From: junjun Date: Thu, 9 Feb 2023 20:18:46 +0800 Subject: [PATCH 02/48] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Ddoris=E4=B8=AD=E4=BD=BF=E7=94=A8case=E8=AF=AD=E6=B3=95?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/doris/DorisQueryProvider.java | 25 +++++++++++++++---- .../src/main/resources/sql/sqlTemplate.stg | 14 +++++++++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java b/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java index 204a3f73f0..26e12c4b12 100644 --- a/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java @@ -155,7 +155,10 @@ public class DorisQueryProvider extends QueryProvider { STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); ST st_sql = stg.getInstanceOf("previewSql"); st_sql.add("isGroup", isGroup); - if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(xFields)) { + st_sql.add("useAliasForGroup", true); + st_sql.add("groups", xFields); + } if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); String customWheres = transCustomFilterList(tableObj, fieldCustomFilter); // row permissions tree @@ -345,7 +348,10 @@ public class DorisQueryProvider extends QueryProvider { STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); ST st_sql = stg.getInstanceOf("querySql"); - if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(xFields)) { + st_sql.add("useAliasForGroup", true); + st_sql.add("groups", xFields); + } if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields); if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres); if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); @@ -435,7 +441,10 @@ public class DorisQueryProvider extends QueryProvider { STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); ST st_sql = stg.getInstanceOf("previewSql"); st_sql.add("isGroup", false); - if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(xFields)) { + st_sql.add("useAliasForGroup", true); + st_sql.add("groups", xFields); + } if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres); if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); String sql = st_sql.render(); @@ -558,7 +567,10 @@ public class DorisQueryProvider extends QueryProvider { STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); ST st_sql = stg.getInstanceOf("querySql"); - if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(xFields)) { + st_sql.add("useAliasForGroup", true); + st_sql.add("groups", xFields); + } if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields); if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres); if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); @@ -672,7 +684,10 @@ public class DorisQueryProvider extends QueryProvider { STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE); ST st_sql = stg.getInstanceOf("querySql"); - if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields); + if (CollectionUtils.isNotEmpty(xFields)) { + st_sql.add("useAliasForGroup", true); + st_sql.add("groups", xFields); + } if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields); if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres); if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj); diff --git a/backend/src/main/resources/sql/sqlTemplate.stg b/backend/src/main/resources/sql/sqlTemplate.stg index 41cd934e64..9a0485cd51 100644 --- a/backend/src/main/resources/sql/sqlTemplate.stg +++ b/backend/src/main/resources/sql/sqlTemplate.stg @@ -1,4 +1,4 @@ -querySql(limitFiled, groups, aggregators, filters, orders, table, notUseAs) +querySql(limitFiled, groups, aggregators, filters, orders, table, notUseAs, useAliasForGroup) ::=<< SELECT @@ -25,8 +25,13 @@ WHERE GROUP BY + }; separator=",\n"> + + }; separator=",\n"> + + ORDER BY }; separator=",\n"> @@ -34,7 +39,7 @@ ORDER BY >> -previewSql(limitFiled, groups, aggregators, filters, orders, table, isGroup, notUseAs) +previewSql(limitFiled, groups, aggregators, filters, orders, table, isGroup, notUseAs, useAliasForGroup) ::=<< SELECT @@ -61,8 +66,13 @@ WHERE GROUP BY + }; separator=",\n"> + + }; separator=",\n"> + + ORDER BY }; separator=",\n"> From e41295c36b49b22f6efc927c1f2fd72a69de5c18 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 10 Feb 2023 10:01:16 +0800 Subject: [PATCH 03/48] =?UTF-8?q?refactor:=20Api=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/auth/api/AuthApi.java | 5 ++-- .../io/dataease/auth/api/DynamicMenuApi.java | 4 +++- .../dataease/config/Knife4jConfiguration.java | 23 +++++++++++-------- .../dataease/plugins/server/XAuthServer.java | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/api/AuthApi.java b/backend/src/main/java/io/dataease/auth/api/AuthApi.java index aeaee10e13..2b15b62e51 100644 --- a/backend/src/main/java/io/dataease/auth/api/AuthApi.java +++ b/backend/src/main/java/io/dataease/auth/api/AuthApi.java @@ -6,14 +6,13 @@ import io.dataease.auth.api.dto.LoginDto; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; -import springfox.documentation.annotations.ApiIgnore; - import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; +import springfox.documentation.annotations.ApiIgnore; import java.util.Map; -@Api(tags = "权限:权限管理") +@Api(tags = "登录:登录管理") @ApiSupport(order = 10) @RequestMapping("/api/auth") public interface AuthApi { diff --git a/backend/src/main/java/io/dataease/auth/api/DynamicMenuApi.java b/backend/src/main/java/io/dataease/auth/api/DynamicMenuApi.java index 790c4917bb..9b972800f7 100644 --- a/backend/src/main/java/io/dataease/auth/api/DynamicMenuApi.java +++ b/backend/src/main/java/io/dataease/auth/api/DynamicMenuApi.java @@ -8,15 +8,17 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; + import java.util.List; -@Api(tags = "权限:动态菜单") +@Api(tags = "登录:动态菜单") @ApiSupport(order = 20) @RequestMapping("/api/dynamicMenu") public interface DynamicMenuApi { /** * 根据heads中获取的token 获取username 获取对应权限的菜单 + * * @return */ @ApiOperation("查询") diff --git a/backend/src/main/java/io/dataease/config/Knife4jConfiguration.java b/backend/src/main/java/io/dataease/config/Knife4jConfiguration.java index eff1bb147e..c5b13ab877 100644 --- a/backend/src/main/java/io/dataease/config/Knife4jConfiguration.java +++ b/backend/src/main/java/io/dataease/config/Knife4jConfiguration.java @@ -7,15 +7,19 @@ import com.google.common.base.Predicate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.context.annotation.*; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration; import springfox.documentation.RequestHandler; -import springfox.documentation.builders.*; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; import springfox.documentation.oas.annotations.EnableOpenApi; import springfox.documentation.service.*; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; + import java.util.ArrayList; import java.util.List; @@ -23,7 +27,7 @@ import java.util.List; @EnableOpenApi @Configuration @Import(BeanValidatorPluginsConfiguration.class) -public class Knife4jConfiguration implements BeanPostProcessor{ +public class Knife4jConfiguration implements BeanPostProcessor { private static final String splitor = ","; @@ -33,7 +37,6 @@ public class Knife4jConfiguration implements BeanPostProcessor{ private String version; - @Autowired public Knife4jConfiguration(OpenApiExtensionResolver openApiExtensionResolver) { this.openApiExtensionResolver = openApiExtensionResolver; @@ -41,7 +44,7 @@ public class Knife4jConfiguration implements BeanPostProcessor{ @Bean(value = "authApi") public Docket authApi() { - return defaultApi("权限管理", "io.dataease.auth"); + return defaultApi("登录管理", "io.dataease.auth"); } @Bean(value = "chartApi") @@ -69,24 +72,24 @@ public class Knife4jConfiguration implements BeanPostProcessor{ return defaultApi("系统管理", "io.dataease.controller.sys,io.dataease.plugins.server"); } - private ApiInfo apiInfo(){ + private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("DataEase") .description("人人可用的开源数据可视化分析工具") .termsOfServiceUrl("https://dataease.io") - .contact(new Contact("Dataease","https://www.fit2cloud.com/dataease/index.html","dataease@fit2cloud.com")) + .contact(new Contact("Dataease", "https://www.fit2cloud.com/dataease/index.html", "dataease@fit2cloud.com")) .version(version) .build(); } private Docket defaultApi(String groupName, String packageName) { - List securitySchemes=new ArrayList<>(); + List securitySchemes = new ArrayList<>(); securitySchemes.add(accessKey()); securitySchemes.add(signature()); List securityContexts = new ArrayList<>(); securityContexts.add(securityContext()); - Docket docket=new Docket(DocumentationType.OAS_30) + Docket docket = new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) .groupName(groupName) .select() @@ -131,7 +134,7 @@ public class Knife4jConfiguration implements BeanPostProcessor{ return input -> declaringClass(input).transform(handlerPackage(basePackage)).or(true); } - private static Function, Boolean> handlerPackage(final String basePackage) { + private static Function, Boolean> handlerPackage(final String basePackage) { return input -> { // 循环判断匹配 for (String strPackage : basePackage.split(splitor)) { diff --git a/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java b/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java index 1cd27cad47..7a9952fa61 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java @@ -29,7 +29,7 @@ import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; -@Api(tags = "权限管理") +@Api(tags = "xpack:权限管理") @RequestMapping("/plugin/auth") @RestController public class XAuthServer { From 7e01b14c859b2e5bcac618a44f417c1b7526d7cb Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 10 Feb 2023 10:02:19 +0800 Subject: [PATCH 04/48] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Ddoris=E4=B8=AD=E4=BD=BF=E7=94=A8case=E8=AF=AD=E6=B3=95?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/sql/sqlTemplate.stg | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/src/main/resources/sql/sqlTemplate.stg b/backend/src/main/resources/sql/sqlTemplate.stg index 9a0485cd51..d24d71b521 100644 --- a/backend/src/main/resources/sql/sqlTemplate.stg +++ b/backend/src/main/resources/sql/sqlTemplate.stg @@ -23,15 +23,14 @@ FROM WHERE }; separator="\nAND "> - + GROUP BY - }; separator=",\n"> - + +GROUP BY }; separator=",\n"> - ORDER BY }; separator=",\n"> @@ -64,15 +63,14 @@ FROM WHERE }; separator="\nAND "> - + GROUP BY - }; separator=",\n"> - + +GROUP BY }; separator=",\n"> - ORDER BY }; separator=",\n"> From ad8746e1bcd07bae8f5996086947c3d831efbf96 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 10 Feb 2023 12:54:44 +0800 Subject: [PATCH 05/48] =?UTF-8?q?fix(=E7=99=BB=E5=BD=95):=20=E5=88=B7?= =?UTF-8?q?=E6=96=B0token=E5=AF=BC=E8=87=B4=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/auth/filter/JWTFilter.java | 3 ++- .../io/dataease/commons/utils/TokenCacheUtils.java | 10 ++++++++++ backend/src/main/resources/ehcache/ehcache.xml | 12 ++++++++++++ frontend/src/utils/request.js | 3 ++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java index 973b0fced2..24ca87c8d6 100644 --- a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java @@ -66,7 +66,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { if (StringUtils.startsWith(authorization, "Basic")) { return false; } - if (!TokenCacheUtils.validate(authorization)) { + if (!TokenCacheUtils.validate(authorization) && TokenCacheUtils.validateDelay(authorization)) { throw new AuthenticationException(expireMessage); } // 当没有出现登录超时 且需要刷新token 则执行刷新token @@ -75,6 +75,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { throw new AuthenticationException(expireMessage); } if (JWTUtils.needRefresh(authorization)) { + TokenCacheUtils.addWithTtl(authorization, 1L); TokenCacheUtils.remove(authorization); authorization = refreshToken(request, response); } diff --git a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java index e17f293b51..338adbf2da 100644 --- a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java +++ b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java @@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils; public class TokenCacheUtils { private static final String KEY = "sys_token_store"; + private static final String DELAY_KEY = "sys_token_store_delay"; public static void add(String token, Long userId) { CacheUtils.put(KEY, token, userId, null, null); @@ -25,4 +26,13 @@ public class TokenCacheUtils { Object sys_token_store = CacheUtils.get(KEY, token); return ObjectUtils.isNotEmpty(sys_token_store) && StringUtils.isNotBlank(sys_token_store.toString()) && userId == Long.parseLong(sys_token_store.toString()); } + + public static void addWithTtl(String token, Long userId) { + CacheUtils.put(DELAY_KEY, token, userId, 3, 5); + } + + public static boolean validateDelay(String token) { + Object tokenObj = CacheUtils.get(DELAY_KEY, token); + return ObjectUtils.isNotEmpty(tokenObj) && StringUtils.isNotBlank(tokenObj.toString()); + } } diff --git a/backend/src/main/resources/ehcache/ehcache.xml b/backend/src/main/resources/ehcache/ehcache.xml index c1fedd7f25..f8d8591b20 100644 --- a/backend/src/main/resources/ehcache/ehcache.xml +++ b/backend/src/main/resources/ehcache/ehcache.xml @@ -279,5 +279,17 @@ diskPersistent="false" /> + + \ No newline at end of file diff --git a/frontend/src/utils/request.js b/frontend/src/utils/request.js index 78536360fc..477c20817c 100644 --- a/frontend/src/utils/request.js +++ b/frontend/src/utils/request.js @@ -1,7 +1,7 @@ import axios from 'axios' import store from '@/store' import { $alert, $error } from './message' -import { getToken, getIdToken } from '@/utils/auth' +import { getToken, getIdToken, setToken } from '@/utils/auth' import Config from '@/settings' import i18n from '@/lang' import { tryShowLoading, tryHideLoading } from './loading' @@ -157,6 +157,7 @@ const checkAuth = response => { // token到期后自动续命 刷新token if (response.headers[RefreshTokenKey]) { const refreshToken = response.headers[RefreshTokenKey] + setToken(refreshToken) store.dispatch('user/refreshToken', refreshToken) } From 44978fad4fc98e7001c719551bdbfe38b7b3ee57 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 10 Feb 2023 14:12:02 +0800 Subject: [PATCH 06/48] =?UTF-8?q?refactor:=20Api=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/dataease/plugins/server/XAuthServer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java b/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java index 7a9952fa61..9c1e1efbcd 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java @@ -162,6 +162,7 @@ public class XAuthServer { } @GetMapping("/getDatasourceTypes") + @ApiOperation("查询授权的数据类型") public List getDatasourceTypes() { Collection activeType = datasourceService.types(); Map activeTypeMap = activeType.stream().collect(Collectors.toMap(DataSourceType::getType, DataSourceType::getName)); From 67d31c839da8190a3a5e285ed42a73978d500524 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 13 Feb 2023 11:15:28 +0800 Subject: [PATCH 07/48] =?UTF-8?q?fix(=E7=99=BB=E5=BD=95):=20=E5=88=B7?= =?UTF-8?q?=E6=96=B0token=E5=AF=BC=E8=87=B4=E7=94=A8=E6=88=B7=E9=A2=91?= =?UTF-8?q?=E7=B9=81=E6=8E=89=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/io/dataease/auth/filter/JWTFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java index 24ca87c8d6..e5bd636789 100644 --- a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java @@ -66,7 +66,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { if (StringUtils.startsWith(authorization, "Basic")) { return false; } - if (!TokenCacheUtils.validate(authorization) && TokenCacheUtils.validateDelay(authorization)) { + if (!TokenCacheUtils.validate(authorization) && !TokenCacheUtils.validateDelay(authorization)) { throw new AuthenticationException(expireMessage); } // 当没有出现登录超时 且需要刷新token 则执行刷新token From 82547eb12d47a64887691d201aab5875c288aa0a Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 13 Feb 2023 14:00:33 +0800 Subject: [PATCH 08/48] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=88=86=E9=A1=B5=E6=98=8E=E7=BB=86=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=AE=BE=E7=BD=AE=E8=B7=B3=E8=BD=AC=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=EF=BC=8C=E5=8F=AA=E6=9C=89=E7=AC=AC=E4=B8=80=E9=A1=B5?= =?UTF-8?q?=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=20#4494?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/components/ChartComponentS2.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/chart/components/ChartComponentS2.vue b/frontend/src/views/chart/components/ChartComponentS2.vue index 63d8bbd690..deb834afdc 100644 --- a/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/frontend/src/views/chart/components/ChartComponentS2.vue @@ -67,8 +67,8 @@ > {{ $t('chart.total') }} {{ - (chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) - }} + (chart.datasetMode === 0 && !not_support_page_dataset.includes(chart.datasourceType)) ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0) + }} {{ $t('chart.items') }} Date: Tue, 14 Feb 2023 11:40:58 +0800 Subject: [PATCH 09/48] =?UTF-8?q?feat:=20=E6=A0=B9=E6=8D=AEdataease.proper?= =?UTF-8?q?ties=E9=85=8D=E7=BD=AE=E9=87=8C=E7=9A=84mysql=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=9D=A5=E6=9B=B4=E6=96=B0demo=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90=E7=9A=84=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/DataSourceInitStartListener.java | 1 + .../service/datasource/DatasourceService.java | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/backend/src/main/java/io/dataease/listener/DataSourceInitStartListener.java b/backend/src/main/java/io/dataease/listener/DataSourceInitStartListener.java index fed96e7708..157c2f97aa 100644 --- a/backend/src/main/java/io/dataease/listener/DataSourceInitStartListener.java +++ b/backend/src/main/java/io/dataease/listener/DataSourceInitStartListener.java @@ -26,6 +26,7 @@ public class DataSourceInitStartListener implements ApplicationListener Date: Tue, 14 Feb 2023 14:08:37 +0800 Subject: [PATCH 10/48] =?UTF-8?q?feat:=20=E5=8D=87=E7=BA=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E5=88=B01.18.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/pom.xml | 8 ++++---- backend/src/main/resources/db/migration/V50__1.18.3.sql | 4 ++++ frontend/package.json | 2 +- frontend/pom.xml | 2 +- mobile/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 backend/src/main/resources/db/migration/V50__1.18.3.sql diff --git a/backend/pom.xml b/backend/pom.xml index f5ece1d4af..039930587b 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -5,7 +5,7 @@ dataease-server io.dataease - 1.18.2 + 1.18.3 4.0.0 @@ -204,7 +204,7 @@ io.dataease dataease-plugin-interface - 1.18.2 + 1.18.3 guava @@ -215,12 +215,12 @@ io.dataease dataease-plugin-view - 1.18.2 + 1.18.3 io.dataease dataease-plugin-datasource - 1.18.2 + 1.18.3 diff --git a/backend/src/main/resources/db/migration/V50__1.18.3.sql b/backend/src/main/resources/db/migration/V50__1.18.3.sql new file mode 100644 index 0000000000..f9f320fd3f --- /dev/null +++ b/backend/src/main/resources/db/migration/V50__1.18.3.sql @@ -0,0 +1,4 @@ +UPDATE `my_plugin` +SET `version` = '1.18.3' +where `plugin_id` > 0 + and `version` = '1.18.2'; diff --git a/frontend/package.json b/frontend/package.json index f312476501..3816f0a7ab 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "dataease", - "version": "1.18.2", + "version": "1.18.3", "description": "dataease front", "private": true, "scripts": { diff --git a/frontend/pom.xml b/frontend/pom.xml index d49c6b1aa2..123e82483a 100644 --- a/frontend/pom.xml +++ b/frontend/pom.xml @@ -6,7 +6,7 @@ dataease-server io.dataease - 1.18.2 + 1.18.3 4.0.0 diff --git a/mobile/pom.xml b/mobile/pom.xml index c565ce5e97..063e794c90 100644 --- a/mobile/pom.xml +++ b/mobile/pom.xml @@ -6,7 +6,7 @@ dataease-server io.dataease - 1.18.2 + 1.18.3 4.0.0 diff --git a/pom.xml b/pom.xml index 0fcfa4d2bd..e99f15476b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.dataease dataease-server - 1.18.2 + 1.18.3 pom From fc60ba441b56bb419bef9e45d37705ceb4c6a8b9 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Wed, 15 Feb 2023 11:11:04 +0800 Subject: [PATCH 11/48] =?UTF-8?q?feat:=20=E6=A0=B9=E6=8D=AEdataease.proper?= =?UTF-8?q?ties=E9=85=8D=E7=BD=AE=E9=87=8C=E7=9A=84mysql=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=9D=A5=E6=9B=B4=E6=96=B0demo=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90=E7=9A=84=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/service/datasource/DatasourceService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java index cd8c115e50..80474a31b3 100644 --- a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java +++ b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java @@ -663,7 +663,7 @@ public class DatasourceService { mysqlConfiguration.setUsername(env.getProperty("spring.datasource.username")); mysqlConfiguration.setPassword(env.getProperty("spring.datasource.password")); datasource.setConfiguration(new Gson().toJson(mysqlConfiguration)); - datasourceMapper.updateByPrimaryKey(datasource); + datasourceMapper.updateByPrimaryKeyWithBLOBs(datasource); } } From cf2ccfd0dbf08b710880721c0106f15f57257c50 Mon Sep 17 00:00:00 2001 From: zhaoqian Date: Wed, 15 Feb 2023 11:50:41 +0800 Subject: [PATCH 12/48] =?UTF-8?q?feat:=20=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=AF=B7=E6=B1=82=E4=BD=93=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/service/chart/ChartViewService.java | 8 ++++++++ .../io/dataease/service/dataset/DataSetTableService.java | 2 ++ .../service/dataset/impl/direct/DirectFieldService.java | 1 + 3 files changed, 11 insertions(+) diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 582eae1a61..fb4ea88283 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -529,6 +529,9 @@ public class ChartViewService { xAxisForRequest.addAll(xAxis); xAxisForRequest.addAll(extStack); datasourceRequest.setXAxis(xAxisForRequest); + List yAxisForRequest = new ArrayList<>(); + yAxisForRequest.addAll(yAxis); + datasourceRequest.setYAxis(yAxisForRequest); data = datasourceProvider.getData(datasourceRequest); } else if (table.getMode() == 1) {// 抽取 datasourceRequest.setDatasource(ds); @@ -1037,6 +1040,7 @@ public class ChartViewService { } if (StringUtils.isNotEmpty(totalPageSql) && StringUtils.equalsIgnoreCase((String) mapSize.get("tablePageMode"), "page")) { datasourceRequest.setQuery(totalPageSql); + datasourceRequest.setTotalPageFlag(true); java.util.List tmpData = datasourceProvider.getData(datasourceRequest); totalItems = CollectionUtils.isEmpty(tmpData) ? 0 : Long.valueOf(tmpData.get(0)[0]); totalPage = (totalItems / pageInfo.getPageSize()) + (totalItems % pageInfo.getPageSize() > 0 ? 1 : 0); @@ -1047,6 +1051,10 @@ public class ChartViewService { xAxisForRequest.addAll(xAxis); xAxisForRequest.addAll(extStack); datasourceRequest.setXAxis(xAxisForRequest); + List yAxisForRequest = new ArrayList<>(); + yAxisForRequest.addAll(yAxis); + datasourceRequest.setYAxis(yAxisForRequest); + datasourceRequest.setTotalPageFlag(false); data = datasourceProvider.getData(datasourceRequest); if (CollectionUtils.isNotEmpty(assistFields)) { datasourceAssistRequest.setQuery(assistSQL(datasourceRequest.getQuery(), assistFields)); diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index fd494179ea..2a6ba0f346 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -34,6 +34,7 @@ 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; @@ -712,6 +713,7 @@ public class DataSetTableService { datasourceRequest.setPreviewData(true); try { datasourceRequest.setPageable(true); + datasourceRequest.setPermissionFields(fields); data.addAll(datasourceProvider.getData(datasourceRequest)); } catch (Exception e) { logger.error(e.getMessage()); diff --git a/backend/src/main/java/io/dataease/service/dataset/impl/direct/DirectFieldService.java b/backend/src/main/java/io/dataease/service/dataset/impl/direct/DirectFieldService.java index 4ad4eb61e4..a06283d097 100644 --- a/backend/src/main/java/io/dataease/service/dataset/impl/direct/DirectFieldService.java +++ b/backend/src/main/java/io/dataease/service/dataset/impl/direct/DirectFieldService.java @@ -195,6 +195,7 @@ public class DirectFieldService implements DataSetFieldService { datasourceRequest.setQuery(qp.createQuerySQL(tableName, permissionFields, !needSort, null, customFilter, rowPermissionsTree, deSortFields)); } LogUtil.info(datasourceRequest.getQuery()); + datasourceRequest.setPermissionFields(permissionFields); List rows = datasourceProvider.getData(datasourceRequest); if (!needMapping) { List results = rows.stream().map(row -> row[0]).distinct().collect(Collectors.toList()); From 5c2da88248a8b9933b2add1d38ac773b898ddb2a Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Wed, 15 Feb 2023 14:12:20 +0800 Subject: [PATCH 13/48] =?UTF-8?q?feat:=20=E7=94=A8=E6=88=B7=E7=99=BB?= =?UTF-8?q?=E9=99=86=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.vue | 31 ++++- frontend/src/store/modules/user.js | 6 +- .../views/system/user/PasswordUpdateForm.vue | 111 ++++++++++++++++++ frontend/src/views/system/user/PersonPwd.vue | 104 +--------------- 4 files changed, 147 insertions(+), 105 deletions(-) create mode 100644 frontend/src/views/system/user/PasswordUpdateForm.vue diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 184adffb84..48e6959159 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -6,17 +6,42 @@ ref="de-theme" component-name="ThemeSetting" /> + + + diff --git a/frontend/src/store/modules/user.js b/frontend/src/store/modules/user.js index 648afec6ad..18aca6f46a 100644 --- a/frontend/src/store/modules/user.js +++ b/frontend/src/store/modules/user.js @@ -13,6 +13,7 @@ const getDefaultState = () => { name: '', user: {}, roles: [], + passwordModified: true, avatar: '', // 第一次加载菜单时用到 loadMenus: false, @@ -66,7 +67,10 @@ const mutations = { if (language && i18n.locale !== language) { i18n.locale = language } - } + }, + SET_PASSWORD_MODIFIED: (state, passwordModified) => { + state.passwordModified = passwordModified + }, } const actions = { diff --git a/frontend/src/views/system/user/PasswordUpdateForm.vue b/frontend/src/views/system/user/PasswordUpdateForm.vue new file mode 100644 index 0000000000..4962649982 --- /dev/null +++ b/frontend/src/views/system/user/PasswordUpdateForm.vue @@ -0,0 +1,111 @@ + + + \ No newline at end of file diff --git a/frontend/src/views/system/user/PersonPwd.vue b/frontend/src/views/system/user/PersonPwd.vue index 55e6939488..8e5a4f1ca1 100644 --- a/frontend/src/views/system/user/PersonPwd.vue +++ b/frontend/src/views/system/user/PersonPwd.vue @@ -5,45 +5,7 @@
{{ $t('user.change_password') }}
- - - - - - - - - - - - {{ $t('commons.confirm') }} - - + @@ -51,39 +13,9 @@ diff --git a/frontend/src/views/dataset/add/AddExcel.vue b/frontend/src/views/dataset/add/AddExcel.vue index cae74db8ae..0766591964 100644 --- a/frontend/src/views/dataset/add/AddExcel.vue +++ b/frontend/src/views/dataset/add/AddExcel.vue @@ -8,7 +8,7 @@ class="arrow-right" @click="showLeft = true" > - +

-
- {{ $t('dataset.excel_info_1') }}
- {{ $t('dataset.excel_info_2') }}
- {{ $t('dataset.excel_info_3') }} -
- - +
+ {{ $t('dataset.excel_info_1') }}
+ {{ $t('dataset.excel_info_2') }}
+ {{ $t('dataset.excel_info_3') }} +
+ +

- + - + { + if (!table.id) { + updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree'))) + } this.openMessageSuccess('deDataset.set_saved_successfully') this.cancel(response.data) }) @@ -582,6 +586,9 @@ export default { this.loading = true post('/dataset/table/update', table) .then((response) => { + if (!table.id) { + updateCacheTree('batchNew', 'dataset-tree', response.data, JSON.parse(localStorage.getItem('dataset-tree'))) + } this.openMessageSuccess('deDataset.set_saved_successfully') this.cancel(response.data) }) @@ -637,10 +644,12 @@ export default { border-top-right-radius: 13px; border-bottom-right-radius: 13px; } + .table-list { p { margin: 0; } + height: 100%; width: 240px; padding: 16px 12px; @@ -653,6 +662,7 @@ export default { display: flex; justify-content: space-between; color: var(--deTextPrimary, #1f2329); + i { font-size: 14px; color: var(--deTextPlaceholder, #8f959e); @@ -666,10 +676,12 @@ export default { .table-checkbox-list { height: calc(100% - 100px); overflow-y: auto; + .custom-tree-node { position: relative; width: 80%; display: flex; + .label { overflow: hidden; white-space: nowrap; @@ -677,11 +689,13 @@ export default { width: 85%; } } + .error-name-exist { position: absolute; top: 0; right: 0; } + .item { height: 40px; width: 215px; @@ -719,6 +733,7 @@ export default { display: flex; align-items: center; position: relative; + .name { font-size: 14px; font-weight: 400; @@ -749,10 +764,12 @@ export default { padding: 2px 1.5px; display: inline-block; cursor: pointer; + i { margin-left: 4px; font-size: 12px; } + &:hover { background: rgba(31, 35, 41, 0.1); border-radius: 4px; diff --git a/frontend/src/views/dataset/add/AddSQL.vue b/frontend/src/views/dataset/add/AddSQL.vue index d3cef63e5c..fb193a2f0e 100644 --- a/frontend/src/views/dataset/add/AddSQL.vue +++ b/frontend/src/views/dataset/add/AddSQL.vue @@ -70,7 +70,7 @@ class="de-text-btn" @click="dataReference = true" > - + {{ $t('deDataset.data_reference') }} - + {{ $t('sql_variable.variable_mgm') }} - + - + {{ $t('deDataset.run_a_query') }} @@ -111,7 +111,7 @@ dataTable = '' ;keywords = '' " - > {{ $t('chart.back') }} + > {{ $t('chart.back') }} {{ $t('deDataset.data_reference') }} - + {{ (showTable && dataTable) || selectedDatasource.name }} @@ -146,59 +146,61 @@ v-if="!dataSource" class="no-select-datasource" >{{ - $t('deDataset.to_start_using') - }} + $t('deDataset.to_start_using') + }} - +
{{ - `(${$t('dataset.preview_show')} 1000 ${$t( - 'dataset.preview_item' - )})` - }} + `(${$t('dataset.preview_show')} 1000 ${$t( + 'dataset.preview_item' + )})` + }} {{ errMsgCont }} + >{{ errMsgCont }} +
- + {{ $t('dataset.sql_variable_limit_1') }}
{{ $t('dataset.sql_variable_limit_2') }}
@@ -451,7 +454,7 @@ :content="$t('commons.parameter_effect')" placement="top" > - + + .oauth-image image { + width: 30px; + height: 30px; + margin: 10px; + } + + .oauth-image button { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + opacity: 0; + } + + .captcha-view { + line-height: 0; + justify-content: center; + align-items: center; + display: flex; + position: relative; + background-color: #f3f3f3; + } + + .welcome { + padding-left: 15px; + font-size: x-large; + font-weight: 500; + letter-spacing: 2px; + } + \ No newline at end of file From 0e6cb26ba9c9a3aa6647108f95f214da8503ec0b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 17 Feb 2023 21:53:57 +0800 Subject: [PATCH 24/48] =?UTF-8?q?perf(token):=20=E7=A6=81=E7=94=A8token?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/auth/filter/JWTFilter.java | 4 +--- .../java/io/dataease/auth/util/JWTUtils.java | 21 +++---------------- .../commons/utils/TokenCacheUtils.java | 9 -------- .../src/main/resources/ehcache/ehcache.xml | 12 +---------- 4 files changed, 5 insertions(+), 41 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java index e5bd636789..db9be9a709 100644 --- a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java @@ -66,7 +66,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { if (StringUtils.startsWith(authorization, "Basic")) { return false; } - if (!TokenCacheUtils.validate(authorization) && !TokenCacheUtils.validateDelay(authorization)) { + if (!TokenCacheUtils.validate(authorization)) { throw new AuthenticationException(expireMessage); } // 当没有出现登录超时 且需要刷新token 则执行刷新token @@ -75,8 +75,6 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { throw new AuthenticationException(expireMessage); } if (JWTUtils.needRefresh(authorization)) { - TokenCacheUtils.addWithTtl(authorization, 1L); - TokenCacheUtils.remove(authorization); authorization = refreshToken(request, response); } JWTToken token = new JWTToken(authorization); diff --git a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java index cebe34c5f5..2c671abda9 100644 --- a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java +++ b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java @@ -20,9 +20,6 @@ import java.util.Date; public class JWTUtils { - // token过期时间1min (过期会自动刷新续命 目的是避免一直都是同一个token ) - private static final long EXPIRE_TIME = 1 * 60 * 1000; - // 登录间隔时间10min 超过这个时间强制重新登录 private static long Login_Interval; /** @@ -67,9 +64,7 @@ public class JWTUtils { } public static boolean needRefresh(String token) { - Date exp = JWTUtils.getExp(token); - Long advanceTime = 5000L; - return (new Date().getTime() + advanceTime) >= exp.getTime(); + return false; } /** @@ -95,18 +90,9 @@ public class JWTUtils { return isExpire; } - public static Date getExp(String token) { - try { - DecodedJWT jwt = JWT.decode(token); - return jwt.getClaim("exp").asDate(); - } catch (JWTDecodeException e) { - e.printStackTrace(); - return null; - } - } + /** - * 生成签名,5min后过期 * * @param tokenInfo 用户信息 * @param secret 用户的密码 @@ -114,12 +100,11 @@ public class JWTUtils { */ public static String sign(TokenInfo tokenInfo, String secret) { try { - Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME); Algorithm algorithm = Algorithm.HMAC256(secret); Builder builder = JWT.create() .withClaim("username", tokenInfo.getUsername()) .withClaim("userId", tokenInfo.getUserId()); - String sign = builder.withExpiresAt(date).sign(algorithm); + String sign = builder.sign(algorithm); TokenCacheUtils.add(sign, tokenInfo.getUserId()); return sign; diff --git a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java index 338adbf2da..bc936c3be5 100644 --- a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java +++ b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java @@ -7,7 +7,6 @@ import org.apache.commons.lang3.StringUtils; public class TokenCacheUtils { private static final String KEY = "sys_token_store"; - private static final String DELAY_KEY = "sys_token_store_delay"; public static void add(String token, Long userId) { CacheUtils.put(KEY, token, userId, null, null); @@ -27,12 +26,4 @@ public class TokenCacheUtils { return ObjectUtils.isNotEmpty(sys_token_store) && StringUtils.isNotBlank(sys_token_store.toString()) && userId == Long.parseLong(sys_token_store.toString()); } - public static void addWithTtl(String token, Long userId) { - CacheUtils.put(DELAY_KEY, token, userId, 3, 5); - } - - public static boolean validateDelay(String token) { - Object tokenObj = CacheUtils.get(DELAY_KEY, token); - return ObjectUtils.isNotEmpty(tokenObj) && StringUtils.isNotBlank(tokenObj.toString()); - } } diff --git a/backend/src/main/resources/ehcache/ehcache.xml b/backend/src/main/resources/ehcache/ehcache.xml index f8d8591b20..eccd3b1661 100644 --- a/backend/src/main/resources/ehcache/ehcache.xml +++ b/backend/src/main/resources/ehcache/ehcache.xml @@ -277,19 +277,9 @@ maxElementsOnDisk="3000" overflowToDisk="true" diskPersistent="false" - /> - - + \ No newline at end of file From a34e99d7c1bab3a1555c67e7ed81eae0d571f466 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 17 Feb 2023 22:05:00 +0800 Subject: [PATCH 25/48] =?UTF-8?q?Revert=20"perf(token):=20=E7=A6=81?= =?UTF-8?q?=E7=94=A8token=E5=88=B7=E6=96=B0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0e6cb26ba9c9a3aa6647108f95f214da8503ec0b. --- .../io/dataease/auth/filter/JWTFilter.java | 4 +++- .../java/io/dataease/auth/util/JWTUtils.java | 21 ++++++++++++++++--- .../commons/utils/TokenCacheUtils.java | 9 ++++++++ .../src/main/resources/ehcache/ehcache.xml | 12 ++++++++++- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java index db9be9a709..e5bd636789 100644 --- a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java @@ -66,7 +66,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { if (StringUtils.startsWith(authorization, "Basic")) { return false; } - if (!TokenCacheUtils.validate(authorization)) { + if (!TokenCacheUtils.validate(authorization) && !TokenCacheUtils.validateDelay(authorization)) { throw new AuthenticationException(expireMessage); } // 当没有出现登录超时 且需要刷新token 则执行刷新token @@ -75,6 +75,8 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { throw new AuthenticationException(expireMessage); } if (JWTUtils.needRefresh(authorization)) { + TokenCacheUtils.addWithTtl(authorization, 1L); + TokenCacheUtils.remove(authorization); authorization = refreshToken(request, response); } JWTToken token = new JWTToken(authorization); diff --git a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java index 2c671abda9..cebe34c5f5 100644 --- a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java +++ b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java @@ -20,6 +20,9 @@ import java.util.Date; public class JWTUtils { + // token过期时间1min (过期会自动刷新续命 目的是避免一直都是同一个token ) + private static final long EXPIRE_TIME = 1 * 60 * 1000; + // 登录间隔时间10min 超过这个时间强制重新登录 private static long Login_Interval; /** @@ -64,7 +67,9 @@ public class JWTUtils { } public static boolean needRefresh(String token) { - return false; + Date exp = JWTUtils.getExp(token); + Long advanceTime = 5000L; + return (new Date().getTime() + advanceTime) >= exp.getTime(); } /** @@ -90,9 +95,18 @@ public class JWTUtils { return isExpire; } - + public static Date getExp(String token) { + try { + DecodedJWT jwt = JWT.decode(token); + return jwt.getClaim("exp").asDate(); + } catch (JWTDecodeException e) { + e.printStackTrace(); + return null; + } + } /** + * 生成签名,5min后过期 * * @param tokenInfo 用户信息 * @param secret 用户的密码 @@ -100,11 +114,12 @@ public class JWTUtils { */ public static String sign(TokenInfo tokenInfo, String secret) { try { + Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME); Algorithm algorithm = Algorithm.HMAC256(secret); Builder builder = JWT.create() .withClaim("username", tokenInfo.getUsername()) .withClaim("userId", tokenInfo.getUserId()); - String sign = builder.sign(algorithm); + String sign = builder.withExpiresAt(date).sign(algorithm); TokenCacheUtils.add(sign, tokenInfo.getUserId()); return sign; diff --git a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java index bc936c3be5..338adbf2da 100644 --- a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java +++ b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java @@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils; public class TokenCacheUtils { private static final String KEY = "sys_token_store"; + private static final String DELAY_KEY = "sys_token_store_delay"; public static void add(String token, Long userId) { CacheUtils.put(KEY, token, userId, null, null); @@ -26,4 +27,12 @@ public class TokenCacheUtils { return ObjectUtils.isNotEmpty(sys_token_store) && StringUtils.isNotBlank(sys_token_store.toString()) && userId == Long.parseLong(sys_token_store.toString()); } + public static void addWithTtl(String token, Long userId) { + CacheUtils.put(DELAY_KEY, token, userId, 3, 5); + } + + public static boolean validateDelay(String token) { + Object tokenObj = CacheUtils.get(DELAY_KEY, token); + return ObjectUtils.isNotEmpty(tokenObj) && StringUtils.isNotBlank(tokenObj.toString()); + } } diff --git a/backend/src/main/resources/ehcache/ehcache.xml b/backend/src/main/resources/ehcache/ehcache.xml index eccd3b1661..f8d8591b20 100644 --- a/backend/src/main/resources/ehcache/ehcache.xml +++ b/backend/src/main/resources/ehcache/ehcache.xml @@ -277,9 +277,19 @@ maxElementsOnDisk="3000" overflowToDisk="true" diskPersistent="false" + /> + + - \ No newline at end of file From 13adc3de0bac706b84940699d649169004e1e372 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 20 Feb 2023 09:15:14 +0800 Subject: [PATCH 26/48] =?UTF-8?q?perf(token):=20token=E9=80=80=E5=87=BA?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E9=87=87=E7=94=A8token=E9=BB=91=E5=90=8D?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/auth/config/F2CRealm.java | 2 +- .../io/dataease/auth/filter/JWTFilter.java | 4 +- .../io/dataease/auth/server/AuthServer.java | 6 +- .../java/io/dataease/auth/util/JWTUtils.java | 2 - .../commons/utils/TokenCacheUtils.java | 72 ++++++++++++++----- 5 files changed, 61 insertions(+), 25 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/config/F2CRealm.java b/backend/src/main/java/io/dataease/auth/config/F2CRealm.java index 2084145759..504d8cfb6f 100644 --- a/backend/src/main/java/io/dataease/auth/config/F2CRealm.java +++ b/backend/src/main/java/io/dataease/auth/config/F2CRealm.java @@ -84,7 +84,7 @@ public class F2CRealm extends AuthorizingRealm { token = (String) auth.getCredentials(); // 解密获得username,用于和数据库进行对比 tokenInfo = JWTUtils.tokenInfoByToken(token); - if (!TokenCacheUtils.validate(token)) { + if (TokenCacheUtils.invalid(token)) { throw new AuthenticationException("token invalid"); } } catch (Exception e) { diff --git a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java index e5bd636789..0d70181289 100644 --- a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java @@ -66,7 +66,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { if (StringUtils.startsWith(authorization, "Basic")) { return false; } - if (!TokenCacheUtils.validate(authorization) && !TokenCacheUtils.validateDelay(authorization)) { + if (TokenCacheUtils.invalid(authorization)) { throw new AuthenticationException(expireMessage); } // 当没有出现登录超时 且需要刷新token 则执行刷新token @@ -75,8 +75,6 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { throw new AuthenticationException(expireMessage); } if (JWTUtils.needRefresh(authorization)) { - TokenCacheUtils.addWithTtl(authorization, 1L); - TokenCacheUtils.remove(authorization); authorization = refreshToken(request, response); } JWTToken token = new JWTToken(authorization); diff --git a/backend/src/main/java/io/dataease/auth/server/AuthServer.java b/backend/src/main/java/io/dataease/auth/server/AuthServer.java index 6e1fdafd57..ed7cdb0328 100644 --- a/backend/src/main/java/io/dataease/auth/server/AuthServer.java +++ b/backend/src/main/java/io/dataease/auth/server/AuthServer.java @@ -148,7 +148,7 @@ public class AuthServer implements AuthApi { AccountLockStatus lockStatus = authUserService.recordLoginFail(username, 0); DataEaseException.throwException(appendLoginErrorMsg(Translator.get("i18n_id_or_pwd_error"), lockStatus)); } - if(user.getIsAdmin() && user.getPassword().equals("40b8893ea9ebc2d631c4bb42bb1e8996")){ + if (user.getIsAdmin() && user.getPassword().equals("40b8893ea9ebc2d631c4bb42bb1e8996")) { result.put("passwordModified", false); } } @@ -237,7 +237,7 @@ public class AuthServer implements AuthApi { if (StringUtils.isBlank(result)) { result = "success"; } - TokenCacheUtils.remove(token); + TokenCacheUtils.add(token, userId); } catch (Exception e) { LogUtil.error(e); if (StringUtils.isBlank(result)) { @@ -291,7 +291,7 @@ public class AuthServer implements AuthApi { if (StringUtils.isBlank(result)) { result = "success"; } - TokenCacheUtils.remove(token); + TokenCacheUtils.add(token, userId); } catch (Exception e) { LogUtil.error(e); if (StringUtils.isBlank(result)) { diff --git a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java index cebe34c5f5..fc297d1e17 100644 --- a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java +++ b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java @@ -10,7 +10,6 @@ import com.auth0.jwt.interfaces.Verification; import io.dataease.auth.entity.TokenInfo; import io.dataease.auth.entity.TokenInfo.TokenInfoBuilder; import io.dataease.commons.utils.CommonBeanFactory; -import io.dataease.commons.utils.TokenCacheUtils; import io.dataease.exception.DataEaseException; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; @@ -120,7 +119,6 @@ public class JWTUtils { .withClaim("username", tokenInfo.getUsername()) .withClaim("userId", tokenInfo.getUserId()); String sign = builder.withExpiresAt(date).sign(algorithm); - TokenCacheUtils.add(sign, tokenInfo.getUserId()); return sign; } catch (Exception e) { diff --git a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java index 338adbf2da..0bcec3b8c8 100644 --- a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java +++ b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java @@ -3,36 +3,76 @@ package io.dataease.commons.utils; import io.dataease.listener.util.CacheUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Component; +import java.util.concurrent.TimeUnit; + + +@Component public class TokenCacheUtils { + private static final String KEY = "sys_token_store"; - private static final String DELAY_KEY = "sys_token_store_delay"; + + private static String cacheType; + + private static Long expTime; + + @Value("${spring.cache.type:ehcache}") + public void setCacheType(String cacheType) { + TokenCacheUtils.cacheType = cacheType; + } + + @Value("${dataease.login_timeout:480}") + public void setExpTime(Long expTime) { + TokenCacheUtils.expTime = expTime; + } + + private static boolean useRedis() { + return StringUtils.equals(cacheType, "redis"); + } + + + private static ValueOperations cacheHandler() { + RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate"); + ValueOperations valueOperations = redisTemplate.opsForValue(); + return valueOperations; + } public static void add(String token, Long userId) { - CacheUtils.put(KEY, token, userId, null, null); + if (useRedis()) { + ValueOperations valueOperations = cacheHandler(); + valueOperations.set(KEY + token, userId, expTime, TimeUnit.MINUTES); + return; + } + + Long time = expTime * 60; + CacheUtils.put(KEY, token, userId, time.intValue(), null); + } public static void remove(String token) { + if (useRedis()) { + RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate"); + String key = KEY + token; + if (redisTemplate.hasKey(key)) { + redisTemplate.delete(key); + } + return; + } CacheUtils.remove(KEY, token); } - public static boolean validate(String token) { + public static boolean invalid(String token) { + if (useRedis()) { + RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate"); + return redisTemplate.hasKey(KEY + token); + } Object sys_token_store = CacheUtils.get(KEY, token); return ObjectUtils.isNotEmpty(sys_token_store) && StringUtils.isNotBlank(sys_token_store.toString()); } - public static boolean validate(String token, Long userId) { - Object sys_token_store = CacheUtils.get(KEY, token); - return ObjectUtils.isNotEmpty(sys_token_store) && StringUtils.isNotBlank(sys_token_store.toString()) && userId == Long.parseLong(sys_token_store.toString()); - } - - public static void addWithTtl(String token, Long userId) { - CacheUtils.put(DELAY_KEY, token, userId, 3, 5); - } - - public static boolean validateDelay(String token) { - Object tokenObj = CacheUtils.get(DELAY_KEY, token); - return ObjectUtils.isNotEmpty(tokenObj) && StringUtils.isNotBlank(tokenObj.toString()); - } } From 2a350c61c78643f9418811b3e492fb7f3ccabfee Mon Sep 17 00:00:00 2001 From: taojinlong Date: Mon, 20 Feb 2023 12:52:08 +0800 Subject: [PATCH 27/48] =?UTF-8?q?revert:=20excel=20=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/commons/utils/ExcelXlsxReader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java b/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java index 2300f7dded..15014155a6 100644 --- a/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java +++ b/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java @@ -359,8 +359,8 @@ public class ExcelXlsxReader extends DefaultHandler { formatIndex = style.getDataFormat(); formatString = style.getDataFormatString(); short format = this.formatIndex; - if ((14 <= format && format <= 17) || format == 0 || format == 20 || format == 22 || format == 31 || format == 35 || (45 <= format && format <= 49) || format == 46 || format == 47 || (57 <= format && format <= 59) - || (59 < format && format <= 76) || (175 < format && format <= 196) || (210 <= format && format <= 213) || (208 == format)) { // 日期 + if ((14 <= format && format <= 17) || format == 20 || format == 22 || format == 31 || format == 35 || format == 45 || format == 46 || format == 47 || (57 <= format && format <= 59) + || (175 < format && format < 178) || (182 <= format && format <= 196) || (210 <= format && format <= 213) || (208 == format)) { // 日期 isDateFormat = true; } From dfadeb6dbb6e00871fdcb563d408ab3a6cb70b95 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Mon, 20 Feb 2023 12:58:32 +0800 Subject: [PATCH 28/48] =?UTF-8?q?fix:=20=E6=8A=BD=E5=8F=96=20oralce=20data?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=95=B0=E6=8D=AE=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/provider/query/oracle/OracleQueryProvider.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java index e5dada23c6..ebd8846aa9 100644 --- a/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java @@ -916,6 +916,9 @@ public class OracleQueryProvider extends QueryProvider { continue; } String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName()); + if(datasetTableField.getType().equals("DATE")){ + originField = String.format(OracleConstants.TO_CHAR, originField, OracleConstants.DEFAULT_DATE_FORMAT); + } String fieldAlias = String.format(OracleConstants.KEYWORD_TABLE, x.getOriginName()); xFields.add(getXFields(x, originField, fieldAlias)); } From 67672fbc94e0cca4e2f78214f19f744f016b4c90 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 20 Feb 2023 13:49:59 +0800 Subject: [PATCH 29/48] =?UTF-8?q?perf(=E7=99=BB=E5=BD=95):=20=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E9=92=89=E9=92=89=E5=B7=A5=E4=BD=9C=E5=8F=B0?= =?UTF-8?q?=E5=85=8D=E7=99=BB=E4=BD=BF=E7=94=A8DE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/ehcache/ehcache.xml | 18 ++++-------------- mobile/src/locale/zh-Hans.json | 2 +- mobile/src/locale/zh-Hant.json | 2 +- mobile/src/pages.json | 2 +- mobile/src/pages/login/index.vue | 11 +++++++++-- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/backend/src/main/resources/ehcache/ehcache.xml b/backend/src/main/resources/ehcache/ehcache.xml index f8d8591b20..5976911a62 100644 --- a/backend/src/main/resources/ehcache/ehcache.xml +++ b/backend/src/main/resources/ehcache/ehcache.xml @@ -273,23 +273,13 @@ - + \ No newline at end of file diff --git a/mobile/src/locale/zh-Hans.json b/mobile/src/locale/zh-Hans.json index afaed12e0f..3da2e19ea1 100644 --- a/mobile/src/locale/zh-Hans.json +++ b/mobile/src/locale/zh-Hans.json @@ -1,5 +1,5 @@ { - "app.name": "Hello uni-app", + "app.name": "DataEase", "navigate.menuHome": "首页", "navigate.menuDir": "目录", diff --git a/mobile/src/locale/zh-Hant.json b/mobile/src/locale/zh-Hant.json index a3b8f5f97c..ff6fb1f846 100644 --- a/mobile/src/locale/zh-Hant.json +++ b/mobile/src/locale/zh-Hant.json @@ -1,5 +1,5 @@ { - "app.name": "Hello uni-app", + "app.name": "DataEase", "navigate.menuHome": "首頁", "navigate.menuDir": "目錄", "navigate.menuMe": "我的", diff --git a/mobile/src/pages.json b/mobile/src/pages.json index 1fcfb0dc34..11a720f61d 100644 --- a/mobile/src/pages.json +++ b/mobile/src/pages.json @@ -4,7 +4,7 @@ { "path": "pages/login/index", "style": { - "navigationBarTitleText": "%navigate.login%", + "navigationBarTitleText": "%app.name%", "app-plus": { "titleNView": false } diff --git a/mobile/src/pages/login/index.vue b/mobile/src/pages/login/index.vue index 12b9d94dee..5c68fc6808 100644 --- a/mobile/src/pages/login/index.vue +++ b/mobile/src/pages/login/index.vue @@ -69,7 +69,7 @@ title: this.$t('commons.loading') }); this.loadUiInfo() - this.loadPublicKey() + this.loadPublicKey() if (!this.autoLogin() && getToken() && getUserInfo()) { this.toMain() } @@ -154,8 +154,15 @@ const url = window.location.href const param = getUrlParams(url) if (param?.detoken) { + if(param.detoken.endsWith('#/')) + param.detoken = param.detoken.substr(0, param.detoken.length - 2) setToken(param.detoken) - this.toMain() + getInfo().then(res => { + setUserInfo(res.data) + const redirect = window.location.href.split('?')[0] + + window.location.href = redirect + }) return true } return false From d9b664f86db371b19bd1a3142eb17809e44d4880 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 20 Feb 2023 15:01:22 +0800 Subject: [PATCH 30/48] =?UTF-8?q?perf(=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?):=20=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=97=B6=E5=A2=9E=E5=8A=A0=E9=A1=B5=E9=9D=A2=E9=81=AE=E7=BD=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/system/user.js | 1 + frontend/src/views/system/user/UserEditer.vue | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/api/system/user.js b/frontend/src/api/system/user.js index cdfc543a6d..6b366912e4 100644 --- a/frontend/src/api/system/user.js +++ b/frontend/src/api/system/user.js @@ -35,6 +35,7 @@ export const addUser = (data) => { return request({ url: pathMap.createPath, method: 'post', + loading: true, data }) } diff --git a/frontend/src/views/system/user/UserEditer.vue b/frontend/src/views/system/user/UserEditer.vue index 5635d732a8..5e58d7b4c8 100644 --- a/frontend/src/views/system/user/UserEditer.vue +++ b/frontend/src/views/system/user/UserEditer.vue @@ -1,5 +1,6 @@ @@ -80,7 +80,7 @@ export default { }, textInfo() { if (this.element && this.element.hyperlinks && this.element.hyperlinks.enable) { - return "" + this.element.propValue + '' + return '' + this.element.propValue + '' } else { return this.element.propValue } diff --git a/frontend/src/main.js b/frontend/src/main.js index 459f66280a..673cf928ec 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -43,6 +43,12 @@ import 'video.js/dist/video-js.css' // 控制标签宽高成比例的指令 import proportion from 'vue-proportion-directive' +import xss from 'xss' +// 定义全局XSS解决方法 +Object.defineProperty(Vue.prototype, '$xss', { + value: xss +}) + Vue.config.productionTip = false Vue.use(VueClipboard) Vue.use(widgets) From 2a5e9cdf3dd63252f22cd9efd4a7e04949187516 Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Tue, 21 Feb 2023 14:01:58 +0800 Subject: [PATCH 39/48] =?UTF-8?q?fix:=20URL=E9=80=80=E5=87=BA=E5=90=8E?= =?UTF-8?q?=E4=BD=BF=E7=94=A8URL=E7=99=BB=E9=99=86=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/permission.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/permission.js b/frontend/src/permission.js index c612f949c9..afe2e5421e 100644 --- a/frontend/src/permission.js +++ b/frontend/src/permission.js @@ -127,7 +127,7 @@ router.beforeEach(async(to, from, next) => routeBefore(() => { next() } else { // other pages that do not have permission to access are redirected to the login page. - next(`/login?redirect=${to.path}`) + next(`/login?redirect=${to.fullPath}`) NProgress.done() } } From d9cfc4dfc50e0d1676b74db787837860b91d65de Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 21 Feb 2023 14:05:36 +0800 Subject: [PATCH 40/48] =?UTF-8?q?fix(=E8=B7=AF=E7=94=B1):=20=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=B7=AF=E7=94=B1=E5=88=B0=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/permission.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/permission.js b/frontend/src/permission.js index 96aa5902fd..efcede886b 100644 --- a/frontend/src/permission.js +++ b/frontend/src/permission.js @@ -130,7 +130,7 @@ router.beforeEach(async (to, from, next) => routeBefore(() => { next() } else { // other pages that do not have permission to access are redirected to the login page. - next(`/login?redirect=${to.path}`) + next(`/login?redirect=${to.fullPath}`) NProgress.done() } } From 6bb338a36433a24a9044f2030f445507d65cc4c3 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 21 Feb 2023 14:41:22 +0800 Subject: [PATCH 41/48] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E7=89=88):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81=E4=B8=8B?= =?UTF-8?q?Tab=E7=BB=84=E4=BB=B6=E5=86=85=E9=83=A8=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E6=9D=BF=E6=9D=BF=E5=88=87=E6=8D=A2=E6=97=B6=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E9=94=99=E4=BD=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/widget/deWidget/DeTabs.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/components/widget/deWidget/DeTabs.vue b/frontend/src/components/widget/deWidget/DeTabs.vue index 3e9fe23856..786622fa4e 100644 --- a/frontend/src/components/widget/deWidget/DeTabs.vue +++ b/frontend/src/components/widget/deWidget/DeTabs.vue @@ -411,6 +411,10 @@ export default { const _this = this _this.$nextTick(() => { try { + const targetRef = _this.$refs['canvasTabRef-' + _this.activeTabName] + if (targetRef) { + targetRef[0].restore() + } _this.$refs[this.activeTabName][0].resizeChart() } catch (e) { // ignore From ac4bf63a8949a92e00cbdf4a8f7651fac7c9ae41 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 21 Feb 2023 16:35:27 +0800 Subject: [PATCH 42/48] =?UTF-8?q?perf(token):=20=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E6=AF=8F=E5=88=86=E9=92=9F=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0?= =?UTF-8?q?token=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/auth/filter/F2CDocFilter.java | 21 +----- .../io/dataease/auth/filter/JWTFilter.java | 46 ++----------- .../java/io/dataease/auth/util/JWTUtils.java | 67 ++----------------- .../commons/utils/TokenCacheUtils.java | 5 +- .../ApplicationCloseEventListener.java | 24 +++++++ .../io/dataease/listener/util/CacheUtils.java | 6 ++ .../src/main/resources/ehcache/ehcache.xml | 14 ++-- 7 files changed, 55 insertions(+), 128 deletions(-) create mode 100644 backend/src/main/java/io/dataease/listener/ApplicationCloseEventListener.java diff --git a/backend/src/main/java/io/dataease/auth/filter/F2CDocFilter.java b/backend/src/main/java/io/dataease/auth/filter/F2CDocFilter.java index d5d8438c3a..ef1c304810 100644 --- a/backend/src/main/java/io/dataease/auth/filter/F2CDocFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/F2CDocFilter.java @@ -79,12 +79,7 @@ public class F2CDocFilter extends AccessControlFilter { if (StringUtils.isBlank(authorization)) { return false; } - if (JWTUtils.loginExpire(authorization)) { - return false; - } - if (JWTUtils.needRefresh(authorization)) { - authorization = refreshToken(authorization); - } + TokenInfo tokenInfo = JWTUtils.tokenInfoByToken(authorization); AuthUserService authUserService = CommonBeanFactory.getBean(AuthUserService.class); SysUserEntity user = authUserService.getUserById(tokenInfo.getUserId()); @@ -96,20 +91,6 @@ public class F2CDocFilter extends AccessControlFilter { return verify; } - private String refreshToken(String token) throws Exception { - TokenInfo tokenInfo = JWTUtils.tokenInfoByToken(token); - AuthUserService authUserService = CommonBeanFactory.getBean(AuthUserService.class); - SysUserEntity user = authUserService.getUserById(tokenInfo.getUserId()); - if (user == null) { - DataEaseException.throwException(Translator.get("i18n_not_find_user")); - } - String password = user.getPassword(); - Algorithm algorithm = Algorithm.HMAC256(password); - JWTUtils.verifySign(algorithm, token); - String newToken = JWTUtils.sign(tokenInfo, password); - return newToken; - } - @Override protected boolean onAccessDenied(ServletRequest req, ServletResponse res) throws Exception { HttpServletResponse response = (HttpServletResponse) res; diff --git a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java index 0d70181289..83c73fc1ca 100644 --- a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java @@ -1,24 +1,18 @@ package io.dataease.auth.filter; -import com.auth0.jwt.algorithms.Algorithm; import io.dataease.auth.entity.ASKToken; import io.dataease.auth.entity.JWTToken; -import io.dataease.auth.entity.SysUserEntity; -import io.dataease.auth.entity.TokenInfo; + import io.dataease.auth.handler.ApiKeyHandler; -import io.dataease.auth.service.AuthUserService; -import io.dataease.auth.util.JWTUtils; -import io.dataease.commons.utils.CommonBeanFactory; + import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.TokenCacheUtils; -import io.dataease.exception.DataEaseException; -import io.dataease.i18n.Translator; + 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.slf4j.Logger; -import org.slf4j.LoggerFactory; + import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestMethod; @@ -30,7 +24,6 @@ import javax.servlet.http.HttpServletResponse; public class JWTFilter extends BasicHttpAuthenticationFilter { - private Logger LOGGER = LoggerFactory.getLogger(this.getClass()); public final static String expireMessage = "Login token is expire."; @@ -69,14 +62,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { if (TokenCacheUtils.invalid(authorization)) { throw new AuthenticationException(expireMessage); } - // 当没有出现登录超时 且需要刷新token 则执行刷新token - if (JWTUtils.loginExpire(authorization)) { - TokenCacheUtils.remove(authorization); - throw new AuthenticationException(expireMessage); - } - if (JWTUtils.needRefresh(authorization)) { - authorization = refreshToken(request, response); - } + JWTToken token = new JWTToken(authorization); Subject subject = getSubject(request, response); // 提交给realm进行登入,如果错误他会抛出异常并被捕获 @@ -110,28 +96,6 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { } - private String refreshToken(ServletRequest request, ServletResponse response) throws Exception { - // 获取AccessToken(Shiro中getAuthzHeader方法已经实现) - String token = this.getAuthzHeader(request); - // 获取当前Token的帐号信息 - TokenInfo tokenInfo = JWTUtils.tokenInfoByToken(token); - AuthUserService authUserService = CommonBeanFactory.getBean(AuthUserService.class); - SysUserEntity user = authUserService.getUserById(tokenInfo.getUserId()); - if (user == null) { - DataEaseException.throwException(Translator.get("i18n_not_find_user")); - } - String password = user.getPassword(); - Algorithm algorithm = Algorithm.HMAC256(password); - JWTUtils.verifySign(algorithm, token); - String newToken = JWTUtils.sign(tokenInfo, password); - // 设置响应的Header头新Token - HttpServletResponse httpServletResponse = (HttpServletResponse) response; - httpServletResponse.addHeader("Access-Control-Expose-Headers", "RefreshAuthorization"); - httpServletResponse.setHeader("RefreshAuthorization", newToken); - return newToken; - } - - /** * 对跨域提供支持 */ diff --git a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java index fc297d1e17..a541433842 100644 --- a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java +++ b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java @@ -4,7 +4,6 @@ import com.auth0.jwt.JWT; import com.auth0.jwt.JWTVerifier; import com.auth0.jwt.JWTCreator.Builder; import com.auth0.jwt.algorithms.Algorithm; -import com.auth0.jwt.exceptions.JWTDecodeException; import com.auth0.jwt.interfaces.DecodedJWT; import com.auth0.jwt.interfaces.Verification; import io.dataease.auth.entity.TokenInfo; @@ -19,10 +18,8 @@ import java.util.Date; public class JWTUtils { - // token过期时间1min (过期会自动刷新续命 目的是避免一直都是同一个token ) - private static final long EXPIRE_TIME = 1 * 60 * 1000; - // 登录间隔时间10min 超过这个时间强制重新登录 - private static long Login_Interval; + + private static Long expireTime; /** * 校验token是否正确 @@ -65,62 +62,24 @@ public class JWTUtils { return tokenInfoBuilder.build(); } - public static boolean needRefresh(String token) { - Date exp = JWTUtils.getExp(token); - Long advanceTime = 5000L; - return (new Date().getTime() + advanceTime) >= exp.getTime(); - } - /** - * 当前token是否登录超时 - * - * @param token - * @return - */ - public static boolean loginExpire(String token) { - if (Login_Interval == 0) { - // 默认超时时间是8h - Long minute = CommonBeanFactory.getBean(Environment.class).getProperty("dataease.login_timeout", Long.class, - 8 * 60L); - // 分钟换算成毫秒 - Login_Interval = minute * 1000 * 60; - } - Long lastOperateTime = tokenLastOperateTime(token); - boolean isExpire = true; - if (lastOperateTime != null) { - Long now = System.currentTimeMillis(); - isExpire = now - lastOperateTime > Login_Interval; - } - return isExpire; - } - - public static Date getExp(String token) { - try { - DecodedJWT jwt = JWT.decode(token); - return jwt.getClaim("exp").asDate(); - } catch (JWTDecodeException e) { - e.printStackTrace(); - return null; - } - } - - /** - * 生成签名,5min后过期 - * * @param tokenInfo 用户信息 * @param secret 用户的密码 * @return 加密的token */ public static String sign(TokenInfo tokenInfo, String secret) { try { - Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME); + if (ObjectUtils.isEmpty(expireTime)) { + expireTime = CommonBeanFactory.getBean(Environment.class).getProperty("dataease.login_timeout", Long.class, 480L); + } + long expireTimeMillis = expireTime * 60000L; + Date date = new Date(System.currentTimeMillis() + expireTimeMillis); Algorithm algorithm = Algorithm.HMAC256(secret); Builder builder = JWT.create() .withClaim("username", tokenInfo.getUsername()) .withClaim("userId", tokenInfo.getUserId()); String sign = builder.withExpiresAt(date).sign(algorithm); return sign; - } catch (Exception e) { return null; } @@ -143,7 +102,6 @@ public class JWTUtils { } else { verifier = JWT.require(algorithm).withClaim("resourceId", resourceId).withClaim("userId", userId).build(); } - try { verifier.verify(token); return true; @@ -152,16 +110,5 @@ public class JWTUtils { } } - /** - * 获取当前token上次操作时间 - * - * @param token - * @return - */ - public static Long tokenLastOperateTime(String token) { - DecodedJWT jwt = JWT.decode(token); - Date expiresAt = jwt.getExpiresAt(); - return expiresAt.getTime(); - } } diff --git a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java index 0bcec3b8c8..32b68267ab 100644 --- a/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java +++ b/backend/src/main/java/io/dataease/commons/utils/TokenCacheUtils.java @@ -50,8 +50,9 @@ public class TokenCacheUtils { } Long time = expTime * 60; - CacheUtils.put(KEY, token, userId, time.intValue(), null); - + Double v = time * 0.6; + CacheUtils.put(KEY, token, userId, time.intValue(), v.intValue()); + CacheUtils.flush(KEY); } public static void remove(String token) { diff --git a/backend/src/main/java/io/dataease/listener/ApplicationCloseEventListener.java b/backend/src/main/java/io/dataease/listener/ApplicationCloseEventListener.java new file mode 100644 index 0000000000..4fde79311f --- /dev/null +++ b/backend/src/main/java/io/dataease/listener/ApplicationCloseEventListener.java @@ -0,0 +1,24 @@ +package io.dataease.listener; + +import io.dataease.commons.utils.LogUtil; +import net.sf.ehcache.CacheManager; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextClosedEvent; +import org.springframework.stereotype.Component; + +@Component +public class ApplicationCloseEventListener implements ApplicationListener { + + @Autowired(required = false) + CacheManager cacheManager; + + @Override + public void onApplicationEvent(ContextClosedEvent event) { + + if (ObjectUtils.isNotEmpty(cacheManager)) + cacheManager.shutdown(); + LogUtil.info("DataEase is stopping"); + } +} diff --git a/backend/src/main/java/io/dataease/listener/util/CacheUtils.java b/backend/src/main/java/io/dataease/listener/util/CacheUtils.java index 22ebed424a..9a4fd3aa88 100644 --- a/backend/src/main/java/io/dataease/listener/util/CacheUtils.java +++ b/backend/src/main/java/io/dataease/listener/util/CacheUtils.java @@ -66,6 +66,12 @@ public class CacheUtils { return cache(cacheName).remove(key); } + public static void flush(String cacheName) { + CacheManager manager = getCacheManager(); + if (manager instanceof RedisCacheManager) return; + cache(cacheName).flush(); + } + public static void removeAll(String cacheName) { if (getCacheManager() instanceof RedisCacheManager) { org.springframework.cache.Cache cache = getCacheManager().getCache(cacheName); diff --git a/backend/src/main/resources/ehcache/ehcache.xml b/backend/src/main/resources/ehcache/ehcache.xml index 5976911a62..144cdb7ad6 100644 --- a/backend/src/main/resources/ehcache/ehcache.xml +++ b/backend/src/main/resources/ehcache/ehcache.xml @@ -272,12 +272,16 @@ + timeToIdleSeconds="28800" + timeToLiveSeconds="28800" + memoryStoreEvictionPolicy="LRU" + diskPersistent="true"> + + From 2d18c0aa45511e6b66401d962e9ccfc3c2026e80 Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Wed, 22 Feb 2023 11:58:09 +0800 Subject: [PATCH 43/48] =?UTF-8?q?fix:=20info=20=E5=9B=BE=E6=A0=87=E6=9B=B4?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/icons/svg/icon_info_filled.svg | 5 +++++ frontend/src/icons/svg/icon_info_outlined.svg | 12 ++++++++++++ .../dragItem/components/FieldErrorTips.vue | 2 +- frontend/src/views/chart/view/ChartEdit.vue | 6 +----- frontend/src/views/dataset/add/AddExcel.vue | 2 +- frontend/src/views/dataset/add/AddSQL.vue | 2 +- frontend/src/views/dataset/data/ViewTable.vue | 5 +---- frontend/src/views/panel/list/PanelViewShow.vue | 6 +----- .../src/views/system/datasource/DsConfiguration.vue | 2 +- frontend/src/views/system/sysParam/BasicSetting.vue | 2 +- frontend/src/views/system/sysParam/EmailSetting.vue | 6 +++--- frontend/src/views/system/user/index.vue | 2 +- 12 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 frontend/src/icons/svg/icon_info_filled.svg create mode 100644 frontend/src/icons/svg/icon_info_outlined.svg diff --git a/frontend/src/icons/svg/icon_info_filled.svg b/frontend/src/icons/svg/icon_info_filled.svg new file mode 100644 index 0000000000..34439a4850 --- /dev/null +++ b/frontend/src/icons/svg/icon_info_filled.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/frontend/src/icons/svg/icon_info_outlined.svg b/frontend/src/icons/svg/icon_info_outlined.svg new file mode 100644 index 0000000000..eebdd2f505 --- /dev/null +++ b/frontend/src/icons/svg/icon_info_outlined.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/frontend/src/views/chart/components/dragItem/components/FieldErrorTips.vue b/frontend/src/views/chart/components/dragItem/components/FieldErrorTips.vue index 8f184ef6bc..30e56d3d1c 100644 --- a/frontend/src/views/chart/components/dragItem/components/FieldErrorTips.vue +++ b/frontend/src/views/chart/components/dragItem/components/FieldErrorTips.vue @@ -6,7 +6,7 @@ :content="$t('chart.field_error_tips')" placement="bottom" > - +
diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 48c63a2925..82756d5a20 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -28,11 +28,7 @@ :data="view" :tab-status="tabStatus" /> - + {{ $t('dataset.excel_info_3') }}
- + - + - + - + @@ -118,7 +118,7 @@ :content="$t('system_parameter_setting.to_enable_tsl')" placement="top" > - + diff --git a/frontend/src/views/system/user/index.vue b/frontend/src/views/system/user/index.vue index a45d78fb37..c1f4fc52f2 100644 --- a/frontend/src/views/system/user/index.vue +++ b/frontend/src/views/system/user/index.vue @@ -261,7 +261,7 @@ popper-class="reset-pwd" trigger="click" > - +
{{ $t('user.recover_pwd') }}
Date: Wed, 22 Feb 2023 23:12:26 +0800 Subject: [PATCH 44/48] =?UTF-8?q?fix(=E5=88=86=E7=BB=84=E6=9F=B1=E7=8A=B6?= =?UTF-8?q?=E5=9B=BE-=E4=B8=8B=E9=92=BB):=20=E4=BF=AE=E5=A4=8D=E5=88=86?= =?UTF-8?q?=E7=BB=84=E6=9F=B1=E7=8A=B6=E5=9B=BE=E5=AD=90=E7=BB=B4=E5=BA=A6?= =?UTF-8?q?=E4=B8=8B=E9=92=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复分组柱状图在在下钻初始维度为子维度时数据不准确的问题 https://www.tapd.cn/55578866/bugtrace/bugs/view/1155578866001023529 --- .../service/chart/ChartViewService.java | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index fb4ea88283..76916b2905 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -844,22 +844,37 @@ public class ChartViewService { // 下钻 List drillFilters = new ArrayList<>(); boolean isDrill = false; - List drillRequest = chartExtRequest.getDrill(); - if (CollectionUtils.isNotEmpty(drillRequest) && (drill.size() > drillRequest.size())) { - for (int i = 0; i < drillRequest.size(); i++) { - ChartDrillRequest request = drillRequest.get(i); - for (ChartDimensionDTO dto : request.getDimensionList()) { - ChartViewFieldDTO chartViewFieldDTO = drill.get(i); + List drillRequestList = chartExtRequest.getDrill(); + if (CollectionUtils.isNotEmpty(drillRequestList) && (drill.size() > drillRequestList.size())) { +// 如果是从子维度开始下钻,那么先把主维度的条件先加上去 + if (CollectionUtils.isNotEmpty(xAxisExt) && StringUtils.equalsIgnoreCase(drill.get(0).getId(),xAxisExt.get(0).getId())) { + ChartDrillRequest head = drillRequestList.get(0); + for (int i = 0; i < xAxisBase.size(); i++) { + ChartDimensionDTO dimensionDTO = head.getDimensionList().get(i); + DatasetTableField datasetTableField = dataSetTableFieldsService.get(dimensionDTO.getId()); + ChartExtFilterRequest tmp = new ChartExtFilterRequest(); + tmp.setFieldId(tmp.getFieldId()); + tmp.setValue(Collections.singletonList(dimensionDTO.getValue())); + tmp.setOperator("in"); + tmp.setDatasetTableField(datasetTableField); + extFilterList.add(tmp); + drillFilters.add(tmp); + } + } + for (int i = 0; i < drillRequestList.size(); i++) { + ChartDrillRequest request = drillRequestList.get(i); + ChartViewFieldDTO chartViewFieldDTO = drill.get(i); + for (ChartDimensionDTO requestDimension : request.getDimensionList()) { // 将钻取值作为条件传递,将所有钻取字段作为xAxis并加上下一个钻取字段 - if (StringUtils.equalsIgnoreCase(dto.getId(), chartViewFieldDTO.getId())) { + if (StringUtils.equalsIgnoreCase(requestDimension.getId(), chartViewFieldDTO.getId())) { isDrill = true; - DatasetTableField datasetTableField = dataSetTableFieldsService.get(dto.getId()); + DatasetTableField datasetTableField = dataSetTableFieldsService.get(requestDimension.getId()); ChartViewFieldDTO d = new ChartViewFieldDTO(); BeanUtils.copyBean(d, datasetTableField); ChartExtFilterRequest drillFilter = new ChartExtFilterRequest(); - drillFilter.setFieldId(dto.getId()); - drillFilter.setValue(Collections.singletonList(dto.getValue())); + drillFilter.setFieldId(requestDimension.getId()); + drillFilter.setValue(Collections.singletonList(requestDimension.getValue())); drillFilter.setOperator("in"); drillFilter.setDatasetTableField(datasetTableField); extFilterList.add(drillFilter); @@ -869,7 +884,8 @@ public class ChartViewService { if (!checkDrillExist(xAxis, extStack, d, view)) { xAxis.add(d); } - if (i == drillRequest.size() - 1) { +// + if (i == drillRequestList.size() - 1) { ChartViewFieldDTO nextDrillField = drill.get(i + 1); if (!checkDrillExist(xAxis, extStack, nextDrillField, view)) { // get drill list first element's sort,then assign to nextDrillField From 345f0c03bf85881c087135ef184c00e2bcdbbc3d Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Thu, 23 Feb 2023 10:31:25 +0800 Subject: [PATCH 45/48] =?UTF-8?q?fix:=20=E7=94=A8=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=87=8D=E5=88=B6=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/system/user/index.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/system/user/index.vue b/frontend/src/views/system/user/index.vue index c1f4fc52f2..9b63cfa36e 100644 --- a/frontend/src/views/system/user/index.vue +++ b/frontend/src/views/system/user/index.vue @@ -261,7 +261,7 @@ popper-class="reset-pwd" trigger="click" > - +
{{ $t('user.recover_pwd') }}