Java Code Examples for cn.hutool.core.collection.CollectionUtil#newHashMap()

The following examples show how to use cn.hutool.core.collection.CollectionUtil#newHashMap() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Aooms   File: ParamInterceptor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler){
    Map<String,String[]> paramMaps = request.getParameterMap();
    Map<String,Object> params = CollectionUtil.newHashMap();
    paramMaps.forEach((k,v) -> {
        params.put(k,convert(v));
    });

    // 文件上传
    if(request instanceof AbstractMultipartHttpServletRequest){
        //CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver(request.getServletContext());
        StandardMultipartHttpServletRequest multipartHttpServletRequest = (StandardMultipartHttpServletRequest)request;
        Map<String,MultipartFile> multipartFileMap = multipartHttpServletRequest.getFileMap();
        DataBoss.self().getPara().setFiles(multipartFileMap);
    }

    // 请求参数
    DataBoss.self().getPara().setData(params);
    // 路径参数
    DataBoss.self().getPara().setPathVars((Map)request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE));
    return true;
}
 
Example 2
Source Project: datax-web   File: ServletUtils.java    License: MIT License 5 votes vote down vote up
/**
 * 获得请求参数Map
 */
public static Map<String, Object> getParameters(ServletRequest request) {
    if (request == null) {
        return CollectionUtil.newHashMap();
    }
    return getParametersStartingWith(request, "");
}
 
Example 3
/**
 * 获取用户的基本信息
 *
 * @author fengshuonan
 * @Date 2019-05-04 17:12
 */
public Map<String, Object> getUserInfo(Long userId) {
    RestUser user = this.getById(userId);
    Map<String, Object> map = RestUserFactory.removeUnSafeFieldsRest(user);

    HashMap<String, Object> hashMap = CollectionUtil.newHashMap();
    hashMap.putAll(map);
    hashMap.put("roleName", ConstantFactory.me().getRoleName(user.getRoleId()));
    hashMap.put("deptName", ConstantFactory.me().getDeptName(user.getDeptId()));

    hashMap.put("positionIds", ConstantFactory.me().getPositionIds(userId));
    hashMap.put("positionNames", ConstantFactory.me().getPositionName(userId));

    return hashMap;
}
 
Example 4
/**
 * 获取用户的基本信息
 *
 * @author fengshuonan
 * @Date 2019-05-04 17:12
 */
public Map<String, Object> getUserInfo(Long userId) {
    User user = this.getById(userId);
    Map<String, Object> map = UserFactory.removeUnSafeFields(user);

    HashMap<String, Object> hashMap = CollectionUtil.newHashMap();
    hashMap.putAll(map);
    hashMap.put("roleName", ConstantFactory.me().getRoleName(user.getRoleId()));
    hashMap.put("deptName", ConstantFactory.me().getDeptName(user.getDeptId()));

    return hashMap;
}