package com.yeejoin.amos.boot.module.ccs.biz.util;

import org.typroject.tyboot.core.foundation.utils.ValidationUtil;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * @author DELL
 */
public class RequestUtil {

    public static Map<String, Object> getRequestParamMap(HttpServletRequest request){
        Map<String, String[]> parameterMap = request.getParameterMap();
        Map<String, String[]> localMap = new HashMap<>(parameterMap);
        Map<String, Object> params = new HashMap<>();
        if (!ValidationUtil.isEmpty(localMap)) {
            for (String key : localMap.keySet()) {
                if (!ValidationUtil.isEmpty(localMap.get(key))) {
                    params.put(key, localMap.get(key)[0]);
                }
            }
        }
        return params;
    }
}
