eyeryone opened a new issue, #12122:
URL: https://github.com/apache/dolphinscheduler/issues/12122

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   version :DolphinScheduler -3.0.0-beta-2  release
   When I update the project name, the time is not synchronized, and the UI and 
database are inconsistent with the local time!
   时间错乱,更新时间为14:15,ui界面显示为06:15,数据库显示为01:15!
   并且 日志时间也是06:15!
   ![微信
   
![微信图片_20220923142902](https://user-images.githubusercontent.com/45895838/191903621-87fcffe3-0dfe-4275-9468-caa25e59f8c8.png)
   
图片_20220923142804](https://user-images.githubusercontent.com/45895838/191903601-d50683f7-8cbe-4c69-a91f-156f1209cac7.png)
   
   
   ### What you expected to happen
   
   i think all updatetime is now(),local time!
   
   ### How to reproduce
   
   1.下载源码
   2. 更改源码
   _/*
    * Licensed to the Apache Software Foundation (ASF) under one or more
    * contributor license agreements.  See the NOTICE file distributed with
    * this work for additional information regarding copyright ownership.
    * The ASF licenses this file to You under the Apache License, Version 2.0
    * (the "License"); you may not use this file except in compliance with
    * the License.  You may obtain a copy of the License at
    *
    *    http://www.apache.org/licenses/LICENSE-2.0
    *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
   
   package org.apache.dolphinscheduler.api.interceptor;
   
   import org.apache.dolphinscheduler.api.enums.Status;
   import org.apache.dolphinscheduler.api.security.Authenticator;
   import org.apache.dolphinscheduler.common.Constants;
   import org.apache.dolphinscheduler.common.enums.Flag;
   import org.apache.dolphinscheduler.common.enums.UserType;
   import org.apache.dolphinscheduler.common.thread.ThreadLocalContext;
   import org.apache.dolphinscheduler.dao.entity.User;
   import org.apache.dolphinscheduler.dao.mapper.UserMapper;
   
   import org.apache.commons.httpclient.HttpStatus;
   import org.apache.commons.lang.StringUtils;
   
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
   import org.slf4j.Logger;
   import org.slf4j.LoggerFactory;
   import org.springframework.beans.factory.annotation.Autowired;
   import org.springframework.web.servlet.HandlerInterceptor;
   import org.springframework.web.servlet.ModelAndView;
   
   import java.util.Date;
   
   /**
    * login interceptor, must log in first
    */
   public class LoginHandlerInterceptor implements HandlerInterceptor {
       private static final Logger logger = 
LoggerFactory.getLogger(LoginHandlerInterceptor.class);
   
       @Autowired
       private UserMapper userMapper;
   
       @Autowired
       private Authenticator authenticator;
   
       /**
        * Intercept the execution of a handler. Called after HandlerMapping 
determined
        *
        * @param request current HTTP request
        * @param response current HTTP response
        * @param handler chosen handler to execute, for type and/or instance 
evaluation
        * @return boolean true or false
        */
       @Override
       public boolean preHandle(HttpServletRequest request, HttpServletResponse 
response, Object handler) {
           // get token
           /*String token = request.getHeader("token");
           User user;
           if (StringUtils.isEmpty(token)) {
               user = authenticator.getAuthUser(request);
               // if user is null
               if (user == null) {
                   response.setStatus(HttpStatus.SC_UNAUTHORIZED);
                   logger.info("user does not exist");
                   return false;
               }
           } else {
               user = userMapper.queryUserByToken(token, new Date());
               if (user == null) {
                   response.setStatus(HttpStatus.SC_UNAUTHORIZED);
                   logger.info("user token has expired");
                   return false;
               }
           }
   
           // check user state
           if (user.getState() == Flag.NO.ordinal()) {
               response.setStatus(HttpStatus.SC_UNAUTHORIZED);
               logger.info(Status.USER_DISABLED.getMsg());
               return false;
           }*/
   
   //        User user;
           User user = new User();
           user.setId(1);
           user.setUserName("admin");
           user.setUserPassword("Vip1234");
           user.setUserType(UserType.ADMIN_USER);
           user.setEmail("[email protected]");
           user.setTenantId(1);
           user.setCreateTime(new Date(1522136930));
           user.setUpdateTime(new Date(1661282997));
           user.setQueue("default");
           user.setState(1);
           request.setAttribute(Constants.SESSION_USER, user);
           ThreadLocalContext.getTimezoneThreadLocal().set(user.getTimeZone());
           return true;
       }
   
       @Override
       public void postHandle(HttpServletRequest request, HttpServletResponse 
response, Object handler, ModelAndView modelAndView) throws Exception {
           ThreadLocalContext.getTimezoneThreadLocal().remove();
       }
   }_
   3. mvn -Dmaven.test.skip=true clean package install -Prelease
   4. install.sh
   
   ### Anything else
   
   Other services are normal
   
   
   
   ### Version
   
   3.0.0
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to