双重预防项目-国泰新华二开定制版
SZH
2022-08-20 f9f0687195e0fe349185437d22c495d74c8d4a20
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
package com.ruoyi.project.system.user.controller;
 
import java.util.List;
import java.util.Set;
 
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.system.company.service.ICompanyService;
import com.ruoyi.project.system.role.domain.Role;
import com.ruoyi.project.system.role.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import com.ruoyi.framework.config.RuoYiConfig;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.project.system.config.service.IConfigService;
import com.ruoyi.project.system.menu.domain.Menu;
import com.ruoyi.project.system.menu.service.IMenuService;
import com.ruoyi.project.system.user.domain.User;
 
/**
 * 首页 业务处理
 * 
 * @author ruoyi
 */
@Controller
public class IndexController extends BaseController
{
    @Autowired
    private IMenuService menuService;
 
    @Autowired
    private IConfigService configService;
 
    @Autowired
    private ICompanyService companyService;
 
    @Autowired
    private RuoYiConfig ruoYiConfig;
 
    @Autowired
    private IRoleService roleService;
 
    // 系统首页
    @GetMapping("/index")
    public String index(ModelMap mmap)
    {
        // 取身份信息
        User user = getSysUser();
        // 根据用户id取出菜单
        List<Menu> menus = menuService.selectMenusByUser(user);
        mmap.put("menus", menus);
        mmap.put("user", user);
        mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
        mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
        mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear());
        mmap.put("demoEnabled", ruoYiConfig.isDemoEnabled());
 
        Set<String> stringSet = roleService.selectRoleKeys(user.getUserId());
        if (stringSet.contains("regionUser")||stringSet.contains("straightRegionUser")){
            return "indexByRegionUser";
        }else{
            return "index";
        }
    }
 
    // 切换主题
    @GetMapping("/system/switchSkin")
    public String switchSkin(ModelMap mmap)
    {
        return "skin";
    }
 
    // 系统介绍
    @GetMapping("/system/main")
    public String main(ModelMap mmap){
        //返回该公司的四色图
        mmap.put("companyImages",companyService.getCompanyImagesById(ShiroUtils.getSysUser().getCompanyId()));
        mmap.put("version", ruoYiConfig.getVersion());
        return "main";
    }
 
    // 数据统计
    @GetMapping("/system/main_two")
    public String mainTwo(ModelMap mmap){
        mmap.put("version", ruoYiConfig.getVersion());
        return "main_two";
    }
}