xuhy
2023-08-11 1ec67d10e570856dd15160507dd823ea1b19863e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.stylefeng.guns.modular.system.controller.system;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.DateUtil;
import com.stylefeng.guns.core.util.MD5Util;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.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 java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.*;
 
/**
 * 总览信息
 *
 * @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;
 
    @Autowired
    private ITCompanyService companyService;
 
    private ResultUtil resultUtil;
 
    /**
     * 跳转到黑板
     */
    @RequestMapping("")
    public String blackboard(Model model,Integer type) {
        //查询当前用户是否有"首页"菜单的权限
        Integer id = ShiroKit.getUser().getId();
        User user = userService.selectById(id);
        Integer menuNum = userService.getMenuNumByRole(user.getRoleid());
        if (menuNum > 0){
            return "/home.html";
        } else {
            //查询登录次数
            int count = loginLogService.selectCount(new EntityWrapper<LoginLog>().eq("userid", ShiroKit.getUser().getId()));
            model.addAttribute("loginNum", count);
 
            Role role = roleService.selectById(user.getRoleid());
            Dept dept = deptService.selectById(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获取对应公司详细信息
     * @param uid
     * @return
     */
    @RequestMapping(value = "/getCompanyInfoByUserId", method = RequestMethod.POST)
    @ResponseBody
    public ResultUtil getCompanyInfoByUserId(String uid){
        try {
            User user = userService.selectById(uid);
//            resultUtil = companyService.selectCompanyInfoById(user.getObjectId().toString());
        }catch (Exception e){
            e.printStackTrace();
            resultUtil = ResultUtil.runErr();
        }
        return resultUtil;
    }
 
 
}