| package com.dsh.guns.modular.system.controller.system; | 
|   | 
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
| import com.dsh.guns.config.UserExt; | 
| import com.dsh.guns.core.base.controller.BaseController; | 
| import com.dsh.guns.modular.system.model.Dept; | 
| import com.dsh.guns.modular.system.model.LoginLog; | 
| import com.dsh.guns.modular.system.model.Role; | 
| import com.dsh.guns.modular.system.model.User; | 
| import com.dsh.guns.modular.system.service.*; | 
| import com.dsh.guns.modular.system.util.ResultUtil; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Controller; | 
| import org.springframework.ui.Model; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.RequestMethod; | 
| import org.springframework.web.bind.annotation.ResponseBody; | 
| import com.dsh.guns.modular.system.util.DateUtil; | 
|   | 
| import java.util.Date; | 
|   | 
| /** | 
|  * 总览信息 | 
|  * | 
|  * @author fengshuonan | 
|  * @Date 2017年3月4日23:05:54 | 
|  */ | 
| @Controller | 
| @RequestMapping("/blackboard") | 
| public class BlackboardController extends BaseController { | 
|   | 
|     @Autowired | 
|     private ILoginLogService loginLogService; | 
|   | 
|     @Autowired | 
|     private IUserService userService; | 
|   | 
|     @Autowired | 
|     private IRoleService roleService; | 
|   | 
|     @Autowired | 
|     private IDeptService deptService; | 
|   | 
|   | 
|     private ResultUtil resultUtil; | 
|   | 
|     /** | 
|      * 跳转到黑板 | 
|      */ | 
|     @RequestMapping("") | 
|     public String blackboard(Model model,Integer type) { | 
|         //查询当前用户是否有"首页"菜单的权限 | 
|         //Check if the current user has permission to access the "home page" menu. | 
|         Integer id = 1; | 
|         User user = userService.getById(id); | 
|         Integer menuNum = userService.getMenuNumByRole(user.getRoleid()); | 
|         model.addAttribute("language", UserExt.getLanguage()); | 
|         if (menuNum > 0){ | 
|             return "/home.html"; | 
|         } else { | 
|             //查询登录次数 Check login times | 
|             int count = loginLogService.getBaseMapper().selectCount(new QueryWrapper<LoginLog>().eq("userid",44)); | 
|             model.addAttribute("loginNum", count); | 
|   | 
|             Role role = roleService.getById(user.getRoleid()); | 
|             Dept dept = deptService.getById(user.getDeptid()); | 
|   | 
|             model.addAttribute("deptName",dept==null?"顶级":dept.getFullname()); | 
|             model.addAttribute("roleName", role.getName()); | 
|             model.addAttribute("userName", user.getName()); | 
|             model.addAttribute("date", DateUtil.getTime(new Date())); | 
|             model.addAttribute("user", user); | 
|             return "/blackboardBlank.html"; | 
|         } | 
|     } | 
|   | 
|     /** | 
|      * 根据当前登录账户id获取对应公司详细信息 | 
|      * Get detailed information of the corresponding company based on the ID of the currently logged-in account. | 
|      * @param uid | 
|      * @return | 
|      */ | 
|     @RequestMapping(value = "/getCompanyInfoByUserId", method = RequestMethod.POST) | 
|     @ResponseBody | 
|     public ResultUtil getCompanyInfoByUserId(String uid){ | 
|         try { | 
|             User user = userService.getById(uid); | 
| //            resultUtil = companyService.selectCompanyInfoById(user.getObjectId().toString()); | 
|         }catch (Exception e){ | 
|             e.printStackTrace(); | 
|             resultUtil = ResultUtil.runErr(); | 
|         } | 
|         return resultUtil; | 
|     } | 
|   | 
|   | 
| } |