package com.emr.controller;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @ProjectName:
 * @Description:
 * @Param 传输参数
 * @Return
 * @Author: 曾文和
 * @CreateDate: 2019/9/17 14:20
 * @UpdateUser: 曾文和
 * @UpdateDate: 2019/9/17 14:20
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class FormTokenFlagUtil {
    public static boolean isFlag(HttpServletRequest request) {
        HttpSession session = request.getSession();
        String sesionToken = (String) session.getAttribute("formToken");
        String token = request.getParameter("formToken");
        if (StringUtils.isNoneBlank(token) && !(token.equals(sesionToken))) {
            return  false;
        }
        session.removeAttribute("formToken");
        return  true;
    }
}
