From 60fbbcb790bb30d204c49b7cf3ee0bc6fb5ed707 Mon Sep 17 00:00:00 2001 From: caishunfeng Date: Tue, 15 Mar 2022 17:46:41 +0800 Subject: [PATCH] [Feature-8530][API] add system default timezone if no user timezone when get userInfo (#8899) Co-authored-by: caishunfeng <534328519@qq.com> --- .../dolphinscheduler/api/service/impl/UsersServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java index 441f44b530..d2ab2add20 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java @@ -66,6 +66,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TimeZone; import java.util.stream.Collectors; import org.slf4j.Logger; @@ -886,6 +887,11 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { } } + // add system default timezone if not user timezone + if (StringUtils.isEmpty(user.getTimeZone())) { + user.setTimeZone(TimeZone.getDefault().toZoneId().getId()); + } + result.put(Constants.DATA_LIST, user); putMsg(result, Status.SUCCESS);