Commit aad242ae028fd362a9f81f0dbe9cee9b0d4a6bca
1 parent
0a315b9a
JeecgBoot2.3 里程碑版本,支持微服务和单体自由切换、提供新行编辑表格JVXETable
Showing
198 changed files
with
228543 additions
and
1 deletions
Too many changes to show.
To preserve performance only 4 of 198 files are displayed.
jeecg-boot/.gitignore
jeecg-boot/jeecg-boot-module-demo/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
5 | + <parent> | ||
6 | + <artifactId>jeecg-boot-parent</artifactId> | ||
7 | + <groupId>org.jeecgframework.boot</groupId> | ||
8 | + <version>2.3.0</version> | ||
9 | + </parent> | ||
10 | + <modelVersion>4.0.0</modelVersion> | ||
11 | + | ||
12 | + <artifactId>jeecg-boot-module-demo</artifactId> | ||
13 | + | ||
14 | + <dependencies> | ||
15 | + <dependency> | ||
16 | + <groupId>org.jeecgframework.boot</groupId> | ||
17 | + <artifactId>jeecg-boot-base-common</artifactId> | ||
18 | + </dependency> | ||
19 | + <dependency> | ||
20 | + <groupId>org.jeecgframework.boot</groupId> | ||
21 | + <artifactId>jeecg-system-local-api</artifactId> | ||
22 | + </dependency> | ||
23 | + </dependencies> | ||
24 | +</project> | ||
0 | \ No newline at end of file | 25 | \ No newline at end of file |
jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/JeecgDemoApplication.java
0 → 100644
1 | +//package org.jeecg; | ||
2 | +// | ||
3 | +//import org.springframework.boot.SpringApplication; | ||
4 | +//import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
5 | +//import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
6 | +//import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | ||
7 | +//import org.springframework.cloud.openfeign.EnableFeignClients; | ||
8 | +// | ||
9 | +//import java.net.UnknownHostException; | ||
10 | +// | ||
11 | +//@SpringBootApplication | ||
12 | +//@EnableDiscoveryClient | ||
13 | +//@EnableFeignClients | ||
14 | +//@EnableAutoConfiguration(exclude={org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class}) | ||
15 | +//public class JeecgDemoApplication { | ||
16 | +// | ||
17 | +// public static void main(String[] args) throws UnknownHostException { | ||
18 | +// SpringApplication.run(JeecgDemoApplication.class, args); | ||
19 | +// } | ||
20 | +//} | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/mock/MockController.java
0 → 100644
1 | +package org.jeecg.modules.demo.mock; | ||
2 | + | ||
3 | +import java.io.File; | ||
4 | +import java.io.IOException; | ||
5 | +import java.io.InputStream; | ||
6 | +import java.util.ArrayList; | ||
7 | +import java.util.HashMap; | ||
8 | +import java.util.List; | ||
9 | +import java.util.Map; | ||
10 | + | ||
11 | +import javax.servlet.http.HttpServletRequest; | ||
12 | +import javax.servlet.http.HttpServletResponse; | ||
13 | +import javax.swing.filechooser.FileSystemView; | ||
14 | + | ||
15 | +import org.apache.commons.io.IOUtils; | ||
16 | +import org.jeecg.common.api.vo.Result; | ||
17 | +import org.springframework.web.bind.annotation.GetMapping; | ||
18 | +import org.springframework.web.bind.annotation.PathVariable; | ||
19 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
20 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
21 | +import org.springframework.web.bind.annotation.RestController; | ||
22 | + | ||
23 | +import lombok.extern.slf4j.Slf4j; | ||
24 | + | ||
25 | +@RestController | ||
26 | +@RequestMapping("/api") | ||
27 | +@Slf4j | ||
28 | +public class MockController { | ||
29 | + | ||
30 | + private final String JSON_PATH = "classpath:org/jeecg/modules/demo/mock/json"; | ||
31 | + | ||
32 | + /** | ||
33 | + * 通用json访问接口 | ||
34 | + * 格式: http://localhost:8080/jeecg-boot/api/json/{filename} | ||
35 | + * @param filename | ||
36 | + * @return | ||
37 | + */ | ||
38 | + @RequestMapping(value = "/json/{filename}", method = RequestMethod.GET) | ||
39 | + public String getJsonData(@PathVariable String filename) { | ||
40 | + String jsonpath = "classpath:org/jeecg/modules/demo/mock/json/"+filename+".json"; | ||
41 | + return readJson(jsonpath); | ||
42 | + } | ||
43 | + | ||
44 | + @GetMapping(value = "/asynTreeList") | ||
45 | + public String asynTreeList(String id) { | ||
46 | + return readJson(JSON_PATH + "/asyn_tree_list_" + id + ".json"); | ||
47 | + } | ||
48 | + | ||
49 | + @GetMapping(value = "/user") | ||
50 | + public String user() { | ||
51 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/user.json"); | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * 老的登录获取用户信息接口 | ||
56 | + * @return | ||
57 | + */ | ||
58 | + @GetMapping(value = "/user/info") | ||
59 | + public String userInfo() { | ||
60 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/user_info.json"); | ||
61 | + } | ||
62 | + | ||
63 | + @GetMapping(value = "/role") | ||
64 | + public String role() { | ||
65 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/role.json"); | ||
66 | + } | ||
67 | + | ||
68 | + @GetMapping(value = "/service") | ||
69 | + public String service() { | ||
70 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/service.json"); | ||
71 | + } | ||
72 | + | ||
73 | + @GetMapping(value = "/permission") | ||
74 | + public String permission() { | ||
75 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/permission.json"); | ||
76 | + } | ||
77 | + | ||
78 | + @GetMapping(value = "/permission/no-pager") | ||
79 | + public String permission_no_page() { | ||
80 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/permission_no_page.json"); | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * 省市县 | ||
85 | + */ | ||
86 | + @GetMapping(value = "/area") | ||
87 | + public String area() { | ||
88 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/area.json"); | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * 测试报表数据 | ||
93 | + */ | ||
94 | + @GetMapping(value = "/report/getYearCountInfo") | ||
95 | + public String getYearCountInfo() { | ||
96 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/getCntrNoCountInfo.json"); | ||
97 | + } | ||
98 | + @GetMapping(value = "/report/getMonthCountInfo") | ||
99 | + public String getMonthCountInfo() { | ||
100 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/getCntrNoCountInfo.json"); | ||
101 | + } | ||
102 | + @GetMapping(value = "/report/getCntrNoCountInfo") | ||
103 | + public String getCntrNoCountInfo() { | ||
104 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/getCntrNoCountInfo.json"); | ||
105 | + } | ||
106 | + @GetMapping(value = "/report/getCabinetCountInfo") | ||
107 | + public String getCabinetCountInfo() { | ||
108 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/getCntrNoCountInfo.json"); | ||
109 | + } | ||
110 | + | ||
111 | + /** | ||
112 | + * 实时磁盘监控 | ||
113 | + * @param request | ||
114 | + * @param response | ||
115 | + * @return | ||
116 | + */ | ||
117 | + @GetMapping("/queryDiskInfo") | ||
118 | + public Result<List<Map<String,Object>>> queryDiskInfo(HttpServletRequest request, HttpServletResponse response){ | ||
119 | + Result<List<Map<String,Object>>> res = new Result<>(); | ||
120 | + try { | ||
121 | + // 当前文件系统类 | ||
122 | + FileSystemView fsv = FileSystemView.getFileSystemView(); | ||
123 | + // 列出所有windows 磁盘 | ||
124 | + File[] fs = File.listRoots(); | ||
125 | + log.info("查询磁盘信息:"+fs.length+"个"); | ||
126 | + List<Map<String,Object>> list = new ArrayList<>(); | ||
127 | + | ||
128 | + for (int i = 0; i < fs.length; i++) { | ||
129 | + if(fs[i].getTotalSpace()==0) { | ||
130 | + continue; | ||
131 | + } | ||
132 | + Map<String,Object> map = new HashMap<>(); | ||
133 | + map.put("name", fsv.getSystemDisplayName(fs[i])); | ||
134 | + map.put("max", fs[i].getTotalSpace()); | ||
135 | + map.put("rest", fs[i].getFreeSpace()); | ||
136 | + map.put("restPPT", fs[i].getFreeSpace()*100/fs[i].getTotalSpace()); | ||
137 | + list.add(map); | ||
138 | + log.info(map.toString()); | ||
139 | + } | ||
140 | + res.setResult(list); | ||
141 | + res.success("查询成功"); | ||
142 | + } catch (Exception e) { | ||
143 | + res.error500("查询失败"+e.getMessage()); | ||
144 | + } | ||
145 | + return res; | ||
146 | + } | ||
147 | + | ||
148 | + //------------------------------------------------------------------------------------------- | ||
149 | + /** | ||
150 | + * 工作台首页的数据 | ||
151 | + * @return | ||
152 | + */ | ||
153 | + @GetMapping(value = "/list/search/projects") | ||
154 | + public String projects() { | ||
155 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_projects.json"); | ||
156 | + } | ||
157 | + | ||
158 | + @GetMapping(value = "/workplace/activity") | ||
159 | + public String activity() { | ||
160 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_activity.json"); | ||
161 | + } | ||
162 | + | ||
163 | + @GetMapping(value = "/workplace/teams") | ||
164 | + public String teams() { | ||
165 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_teams.json"); | ||
166 | + } | ||
167 | + | ||
168 | + @GetMapping(value = "/workplace/radar") | ||
169 | + public String radar() { | ||
170 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_radar.json"); | ||
171 | + } | ||
172 | + | ||
173 | + @GetMapping(value = "/task/process") | ||
174 | + public String taskProcess() { | ||
175 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/task_process.json"); | ||
176 | + } | ||
177 | + //------------------------------------------------------------------------------------------- | ||
178 | + | ||
179 | + //author:lvdandan-----date:20190315---for:添加数据日志json---- | ||
180 | + public String sysDataLogJson() { | ||
181 | + return readJson("classpath:org/jeecg/modules/demo/mock/json/sysdatalog.json"); | ||
182 | + } | ||
183 | + //author:lvdandan-----date:20190315---for:添加数据日志json---- | ||
184 | + | ||
185 | + /** | ||
186 | + * 读取json格式文件 | ||
187 | + * @param jsonSrc | ||
188 | + * @return | ||
189 | + */ | ||
190 | + private String readJson(String jsonSrc) { | ||
191 | + String json = ""; | ||
192 | + try { | ||
193 | + //File jsonFile = ResourceUtils.getFile(jsonSrc); | ||
194 | + //json = FileUtils.re.readFileToString(jsonFile); | ||
195 | + //换个写法,解决springboot读取jar包中文件的问题 | ||
196 | + InputStream stream = getClass().getClassLoader().getResourceAsStream(jsonSrc.replace("classpath:", "")); | ||
197 | + json = IOUtils.toString(stream,"UTF-8"); | ||
198 | + } catch (IOException e) { | ||
199 | + log.error(e.getMessage(),e); | ||
200 | + } | ||
201 | + return json; | ||
202 | + } | ||
203 | + | ||
204 | +} |