class UserLoginStatusCookieServiceImpl implements UserLoginStatusService {

    private Logger logger = LoggerFactory.getLogger(UserLoginStatusCookieServiceImpl.class);

    @Autowired
    private LoginComponent loginComponent;

    @Autowired
    protected UserService userService;

    @Autowired
    private Environment environment;

    private static final String CONCATE_STR = "&&";

    @Override
    public String getUserNameFromLoginStatus(HttpServletRequest request) {
        if (EnvUtil.isLocal(environment)) {
            //todo for local
            return "admin";
        }
        String userName = null;
        String userCookie = null;
        String cookie = WebUtil.getLoginCookieValue(request);
        try {
            userCookie = AESCoder.decrypt(cookie, ConstUtils.USER_LOGIN_ENCRY_KEY);
        } catch (Exception e) {
            logger.error("getUserNameFromLoginStatus decrypt error: ", e);
        }
        if(StringUtil.isBlank(userCookie)){
            return null;
        }
        String[] userInfos = userCookie.split(CONCATE_STR);
        if(userInfos != null && userInfos.length > 0){
            userName = userInfos[0];
        }
        if (StringUtils.isNotBlank(userName)) {
            return userName;
        }
        return null;
    }

    @Override
    public String getUserNameFromTicket(HttpServletRequest request) {
        String ticket = request.getParameter("ticket");
        if (StringUtils.isNotBlank(ticket)) {
            String email = loginComponent.getEmail(ticket);
            if (StringUtils.isNotBlank(email) && email.contains("@")) {
                String userName = email.substring(0, email.indexOf("@"));
                return userName;
            }
        }
        return null;
    }

    @Override
    public String getRedirectUrl(HttpServletRequest request) {
        return loginComponent.getRedirectUrl(request);
    }

    @Override
    public String getLogoutUrl() {
        return loginComponent.getLogoutUrl();
    }

    @Override
    public String getRegisterUrl(AppUser user) {
        if (user != null && user.getType() == -1) {
            return "/user/register?success=1";
        }
        return "/user/register";
    }

    @Override
    public void addLoginStatus(HttpServletRequest request, HttpServletResponse response, String userName) {<FILL_FUNCTION_BODY>}

    @Override
    public void removeLoginStatus(HttpServletRequest request, HttpServletResponse response) {
        addLoginStatus(request, response, "");
    }

    private String getRandomStr4Encrypt(){
        return String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
    }
}

        if(userName == null){
            userName = "";
        }else{
            userName = userName + CONCATE_STR + getRandomStr4Encrypt();
            try {
                userName = AESCoder.encrypt(userName,  ConstUtils.USER_LOGIN_ENCRY_KEY);
            } catch (Exception e) {
                logger.error("addLoginStatus encrypt error: ",e);
            }
        }
        Cookie cookie = new Cookie(LOGIN_USER_STATUS_NAME, userName);
        cookie.setDomain(request.getServerName());
        cookie.setPath("/");
        cookie.setMaxAge(-1);
        response.addCookie(cookie);
    
<no_super_class>