地质所 沉降监测网建设项目
suerwei
2024-05-22 fc15aa768cdb6c48ee8b21a5f43570c2f955a9ff
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
package com.javaweb.web.controller.system;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import com.javaweb.cms.util.CmsConstants;
import com.javaweb.common.core.domain.AjaxResult;
import com.javaweb.common.utils.Arith;
import com.javaweb.common.utils.StringUtils;
import com.javaweb.geo.domain.Hole;
import com.javaweb.geo.domain.HoleMedia;
import com.javaweb.geo.domain.Project;
import com.javaweb.geo.enums.RecordType;
import com.javaweb.geo.mapper.HoleMapper;
import com.javaweb.geo.service.IHoleMediaService;
import com.javaweb.geo.service.IHoleService;
import com.javaweb.geo.service.IProjectService;
import com.javaweb.geo.vo.IndexVo;
import com.javaweb.geo.vo.ProjectProcessVO;
import com.javaweb.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import com.javaweb.common.config.Global;
import com.javaweb.common.core.controller.BaseController;
import com.javaweb.framework.util.ShiroUtils;
import com.javaweb.system.domain.SysMenu;
import com.javaweb.system.domain.SysUser;
import com.javaweb.system.service.ISysMenuService;
 
 
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import javax.servlet.http.HttpServletRequest;
 
/**
 * 首页 业务处理
 *
 * @author ruoyi
 */
@Controller
public class SysIndexController extends BaseController {
    @Autowired
    private ISysMenuService menuService;
 
    @Autowired
    private ISysConfigService configService;
 
    @Autowired
    private IProjectService projectService;
 
    @Autowired
    private IHoleService holeService;
 
    @Autowired
    private IHoleMediaService holeMediaService;
 
    private String getAdminIndex() {
        return configService.selectConfigByKey(CmsConstants.KEY_ADMIN_INDEX);
    }
 
    @RequestMapping("/admin")
    public String admin() {
        return "forward:/index";
    }
 
    // 系统首页
    @GetMapping("/index")
    public String index(ModelMap mmap) {
        // 取身份信息
        SysUser user = ShiroUtils.getSysUser();
        // 根据用户id取出菜单
        List<SysMenu> menus = menuService.selectMenusByUser(user);
        mmap.put("menus", menus);
        mmap.put("user", user);
        mmap.put("copyrightYear", Global.getCopyrightYear());
        mmap.put("demoEnabled", Global.isDemoEnabled());
 
        String indePage = this.getAdminIndex();
        if (CmsConstants.ADMIN_INDEX_TOP_MENU.equals(indePage)) {
            return CmsConstants.ADMIN_INDEX_TOP_MENU; // index_topMenu
        } else {
            return "index";
        }
    }
 
    // 系统首页顶部菜单
    @PostMapping("/index/getMenu")
    @ResponseBody
    public AjaxResult getMenu(HttpServletRequest request) {
        // 取身份信息
        SysUser user = ShiroUtils.getSysUser();
        // 根据用户id取出菜单
        List<SysMenu> menus = menuService.selectMenusByUser(user);
        return AjaxResult.success(menus);
    }
 
    // 切换主题
    @GetMapping("/system/switchSkin")
    public String switchSkin(ModelMap mmap) {
        return "skin";
    }
 
 
    // 系统介绍
    @GetMapping("/system/main")
    public String main(ModelMap mmap) {
        mmap.put("version", Global.getVersion());
 
        return "main";
    }
 
    // 系统介绍
    @ResponseBody
    @GetMapping("/system/project")
    public AjaxResult project() {
        AjaxResult ajaxResult = AjaxResult.success();
        List<Project> projects = projectService.selectProjectList(new Project());
        ajaxResult.put("projects", projects);
        return ajaxResult;
    }
 
    /**
     * 总进度
     * @return
     */
    @ResponseBody
    @GetMapping("/system/totalProcess")
    public AjaxResult totalProcess() {
        AjaxResult ajaxResult = AjaxResult.success();
        Hole hole = holeService.selectHoleTotalProcess();
        Double data = Arith.div(hole.getFootageCpl(), hole.getFootage(), 2);
        ajaxResult.put("pointerData", data);
        return ajaxResult;
    }
 
    /**
     * 场地进度
     * @return
     */
    @ResponseBody
    @GetMapping("/system/projectProcess")
    public AjaxResult projectProcess() {
        AjaxResult ajaxResult = AjaxResult.success();
        List<Hole> holes = holeService.selectHoleProjectProcess();
        Map<String, Double> holeMap = new HashMap<>();
        for (Hole hole : holes) {
            Double val = Arith.div(hole.getFootageCpl(), hole.getFootage(), 2);
            val = Arith.round(val * 100, 2);
            holeMap.put(hole.getProjectId(), val);
        }
 
        List<Project> projects = projectService.selectProjectList(new Project());
        List<ProjectProcessVO> vos = new ArrayList<>();
        ProjectProcessVO vo;
        if (!ObjectUtils.isEmpty(projects)) {
            for (int i = 0; i < projects.size(); i++) {
                String ids = projects.get(i).getIds();
                Double val = holeMap.get(ids);
                vo = new ProjectProcessVO();
                vo.setRanking(i + 1);
                vo.setStation(projects.get(i).getCode());
                vo.setValue(val);
                if (val == null) {
                    vo.setValue(0.0d);
                }
                vo.setStatus(projects.get(i).getStatus());
                vos.add(vo);
            }
        }
        ajaxResult.put("projectData", vos);
        return ajaxResult;
    }
 
 
    /**
     * 数量统计
     *
     * @return
     */
    @ResponseBody
    @GetMapping("/system/indexVo")
    public AjaxResult projectProcess2() {
        IndexVo result = new IndexVo();
 
        //=============================查询场地数量===============================
        List<Project> projectList = projectService.selectProjectCountByStatus();
        if (!ObjectUtils.isEmpty(projectList)) {
            for (Project item : projectList) {
                if (RecordType.projectStatus0.getId().equals(item.getStatus())) {
                    result.setProjectStatus0(item.getStatusNumber());
                }
                if (RecordType.projectStatus1.getId().equals(item.getStatus())) {
                    result.setProjectStatus0(item.getStatusNumber());
                }
                if (RecordType.projectStatus2.getId().equals(item.getStatus())) {
                    result.setProjectStatus0(item.getStatusNumber());
                }
            }
        }
        if (ObjectUtils.isEmpty(result.getProjectStatus1())) {
            result.setProjectStatus0(0);
        }
        if (ObjectUtils.isEmpty(result.getProjectStatus2())) {
            result.setProjectStatus0(0);
        }
        if (ObjectUtils.isEmpty(result.getProjectStatus2())) {
            result.setProjectStatus0(0);
        }
 
        //=============================查询进尺===============================
        Hole hole = holeService.selectHoleTotalProcess();
        result.setFootageCplCount(hole.getFootageCpl());
        result.setFootageCount(hole.getFootage());
 
        //=============================查询资料===============================
        HoleMedia holeMedia = holeMediaService.selectHoleMediaNumber();
        result.setFileCount(holeMedia.getNumber());
 
        return AjaxResult.success("查询成功",result);
    }
 
 
}