Java Code Examples for cn.hutool.core.collection.CollectionUtil#newHashMap()
The following examples show how to use
cn.hutool.core.collection.CollectionUtil#newHashMap() .
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 File: ParamInterceptor.java From Aooms with Apache License 2.0 | 6 votes |
@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 File: ServletUtils.java From datax-web with MIT License | 5 votes |
/** * 获得请求参数Map */ public static Map<String, Object> getParameters(ServletRequest request) { if (request == null) { return CollectionUtil.newHashMap(); } return getParametersStartingWith(request, ""); }
Example 3
Source File: RestUserService.java From Guns with GNU Lesser General Public License v3.0 | 5 votes |
/** * 获取用户的基本信息 * * @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
Source File: UserService.java From Guns with GNU Lesser General Public License v3.0 | 5 votes |
/** * 获取用户的基本信息 * * @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; }