/*    */ package com.picc.grab.controller;
/*    */ 
/*    */ import com.picc.grab.common.shiro.ShiroExt;
/*    */ import com.picc.grab.entity.Menu;
/*    */ import java.util.LinkedHashMap;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import org.apache.commons.lang3.StringUtils;
/*    */ import org.slf4j.Logger;
/*    */ import org.slf4j.LoggerFactory;
/*    */ import org.springframework.ui.ModelMap;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class BaseController
/*    */ {
/* 19 */   private static final Logger logger = LoggerFactory.getLogger(BaseController.class);
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   @RequestMapping
/*    */   public String index(ModelMap map, HttpServletRequest request) {
/* 29 */     String url = request.getRequestURI();
/* 30 */     logger.info("-----------------------base url: " + url);
/* 31 */     if (StringUtils.isNotBlank(url)) {
/* 32 */       url = url.substring(1, url.length());
/*    */     }
/*    */ 
/*    */     
/* 36 */     ShiroExt shiroExt = new ShiroExt();
/*    */     
/* 38 */     LinkedHashMap<String, Menu> menuMap = shiroExt.getLevelTwoMenu();
/* 39 */     String menu = "";
/* 40 */     if (menuMap != null && menuMap.size() > 0) {
/* 41 */       for (String code : menuMap.keySet()) {
/* 42 */         if (((Menu)menuMap.get(code)).getPcode().equals(url)) {
/* 43 */           menu = code;
/*    */           
/*    */           break;
/*    */         } 
/*    */       } 
/*    */     }
/* 49 */     if (StringUtils.isNotBlank(menu)) {
/* 50 */       return "forward:/" + menu;
/*    */     }
/* 52 */     map.put("msg", "menu error 权限错误");
/* 53 */     return "nopermissions";
/*    */   }
/*    */ }


/* Location:              C:\Users\Administrator\Desktop\ROOT\WEB-INF\classes\!\com\picc\grab\controller\BaseController.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */