|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "allotMenus", method = RequestMethod.POST) | 
|---|
|  |  |  | public ResultMessage allotMenus(HttpServletRequest request) { | 
|---|
|  |  |  | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); | 
|---|
|  |  |  | if (!parameters.containsKey("userId")) { | 
|---|
|  |  |  | if (!parameters.containsKey("groupId")) { | 
|---|
|  |  |  | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String token = request.getHeader("token"); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.moral.api.entity.GroupMenu; | 
|---|
|  |  |  | import com.moral.api.entity.UserGroup; | 
|---|
|  |  |  | import com.moral.api.mapper.GroupMenuMapper; | 
|---|
|  |  |  | import com.moral.api.service.GroupMenuService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | 
|---|
|  |  |  | groupMenu.setMenuId(menuId); | 
|---|
|  |  |  | groupMenu.setChannel(Constants.WEB_CHANNEL); | 
|---|
|  |  |  | groupMenu.setOrganizationId((Integer) currentUserInfo.get("organizationId")); | 
|---|
|  |  |  | groupMenuMapper.insert(groupMenu); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public Map<String, Object> selectMenusByOrgId(Integer orgId) { | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("orgId",orgId); | 
|---|
|  |  |  | Map<String, Object> menus = userService.getMenus(map); | 
|---|
|  |  |  | return menus; | 
|---|
|  |  |  | return userService.getMenus(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | //校验密码 | 
|---|
|  |  |  | String password = parameters.get("password").toString(); | 
|---|
|  |  |  | //密码解密 | 
|---|
|  |  |  | //password = AESUtils.decrypt(password, AESKey); | 
|---|
|  |  |  | password = AESUtils.decrypt(password, AESKey); | 
|---|
|  |  |  | if (!MD5Utils.saltMD5Verify(password, userBo.getPassword())) { | 
|---|
|  |  |  | result.put("code", ResponseCodeEnum.PASSWORD_INVALID.getCode()); | 
|---|
|  |  |  | result.put("msg", ResponseCodeEnum.PASSWORD_INVALID.getMsg()); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取用户层级菜单递归方法 | 
|---|
|  |  |  | private List<Map<String, Object>> getMenusByRecursion(Menu menu, List<Menu> menus) { | 
|---|
|  |  |  | List<List<Map<String, Object>>> resultList = new ArrayList(); | 
|---|
|  |  |  | Menu newMenu = new Menu(); | 
|---|
|  |  |  | newMenu.setParentId(menu.getId()); | 
|---|
|  |  |  | //筛选出下一级菜单信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | menuMap.put("menus", getMenusByRecursion(o, menus)); | 
|---|
|  |  |  | list.add(menuMap); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | resultList.add(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|