Showing
9 changed files
with
281 additions
and
378 deletions
@@ -53,7 +53,6 @@ | @@ -53,7 +53,6 @@ | ||
53 | <!--<version>1.4.0-beta</version>--> | 53 | <!--<version>1.4.0-beta</version>--> |
54 | </dependency> | 54 | </dependency> |
55 | 55 | ||
56 | - | ||
57 | <!-- SpringBoot--> | 56 | <!-- SpringBoot--> |
58 | <dependency> | 57 | <dependency> |
59 | <groupId>org.springframework.boot</groupId> | 58 | <groupId>org.springframework.boot</groupId> |
@@ -196,11 +195,11 @@ | @@ -196,11 +195,11 @@ | ||
196 | <artifactId>lombok</artifactId> | 195 | <artifactId>lombok</artifactId> |
197 | </dependency> | 196 | </dependency> |
198 | 197 | ||
199 | - <dependency> | 198 | + <!--<dependency> |
200 | <groupId>org.influxdb</groupId> | 199 | <groupId>org.influxdb</groupId> |
201 | <artifactId>influxdb-java</artifactId> | 200 | <artifactId>influxdb-java</artifactId> |
202 | <version>2.7</version> | 201 | <version>2.7</version> |
203 | - </dependency> | 202 | + </dependency>--> |
204 | 203 | ||
205 | </dependencies> | 204 | </dependencies> |
206 | 205 |
@@ -2,7 +2,6 @@ package org.jeecg.modules.jmreport.ext.controller; | @@ -2,7 +2,6 @@ package org.jeecg.modules.jmreport.ext.controller; | ||
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | import org.apache.commons.lang3.StringUtils; | 4 | import org.apache.commons.lang3.StringUtils; |
5 | -import org.influxdb.dto.QueryResult; | ||
6 | import org.jeecg.modules.jmreport.ext.Base.BaseApiController; | 5 | import org.jeecg.modules.jmreport.ext.Base.BaseApiController; |
7 | import org.jeecg.modules.jmreport.ext.service.ApiService; | 6 | import org.jeecg.modules.jmreport.ext.service.ApiService; |
8 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -30,7 +29,7 @@ public class APiController extends BaseApiController { | @@ -30,7 +29,7 @@ public class APiController extends BaseApiController { | ||
30 | public JSONObject getTree(String resid) { | 29 | public JSONObject getTree(String resid) { |
31 | 30 | ||
32 | JSONObject jsonObject = new JSONObject(); | 31 | JSONObject jsonObject = new JSONObject(); |
33 | - jsonObject.put("data", StringUtils.isBlank(resid) ? "empty"+System.currentTimeMillis():resid); | 32 | + jsonObject.put("data", StringUtils.isBlank(resid) ? "empty" + System.currentTimeMillis() : resid); |
34 | 33 | ||
35 | return api(Arrays.asList(jsonObject)); | 34 | return api(Arrays.asList(jsonObject)); |
36 | } | 35 | } |
1 | package org.jeecg.modules.jmreport.ext.service.impl; | 1 | package org.jeecg.modules.jmreport.ext.service.impl; |
2 | 2 | ||
3 | -import org.influxdb.dto.QueryResult; | ||
4 | import org.jeecg.modules.jmreport.ext.service.ApiService; | 3 | import org.jeecg.modules.jmreport.ext.service.ApiService; |
5 | -import org.jeecg.modules.jmreport.utils.influx.InfluxDbUtils; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | 4 | import org.springframework.beans.factory.annotation.Autowired; |
7 | import org.springframework.stereotype.Service; | 5 | import org.springframework.stereotype.Service; |
8 | 6 | ||
@@ -12,15 +10,16 @@ import java.util.Map; | @@ -12,15 +10,16 @@ import java.util.Map; | ||
12 | @Service | 10 | @Service |
13 | public class ApiServiceImpl implements ApiService { | 11 | public class ApiServiceImpl implements ApiService { |
14 | 12 | ||
15 | - @Autowired | ||
16 | - private InfluxDbUtils influxDbUtils; | 13 | +// @Autowired |
14 | +// private InfluxDbUtils influxDbUtils; | ||
17 | 15 | ||
18 | public List<Map<String, Object>> queryInFlux(String sql) { | 16 | public List<Map<String, Object>> queryInFlux(String sql) { |
19 | - QueryResult monitor = influxDbUtils.query(sql, "monitor"); | ||
20 | - | ||
21 | - | ||
22 | - List<Map<String, Object>> maps = influxDbUtils.queryResultToMapList(monitor); | ||
23 | - | ||
24 | - return maps; | 17 | +// QueryResult monitor = influxDbUtils.query(sql, "monitor"); |
18 | +// | ||
19 | +// | ||
20 | +// List<Map<String, Object>> maps = influxDbUtils.queryResultToMapList(monitor); | ||
21 | +// | ||
22 | +// return maps; | ||
23 | + return null; | ||
25 | } | 24 | } |
26 | } | 25 | } |
1 | -package org.jeecg.modules.jmreport.utils.influx; | ||
2 | - | ||
3 | -import org.influxdb.InfluxDB; | ||
4 | -import org.influxdb.InfluxDBFactory; | ||
5 | -import org.springframework.beans.factory.annotation.Value; | ||
6 | -import org.springframework.stereotype.Component; | ||
7 | - | ||
8 | -@Component | ||
9 | -public class InfluxDBConfig { | ||
10 | - | ||
11 | - @Value("${spring.influx.url}") | ||
12 | - private String url; | ||
13 | - | ||
14 | - private String database; | ||
15 | - | ||
16 | - private String retentionPolicy; | ||
17 | - | ||
18 | - private InfluxDB influxDB; | ||
19 | - | ||
20 | - public InfluxDBConfig() { | ||
21 | - } | ||
22 | - | ||
23 | - | ||
24 | - public InfluxDBConfig(String userName, String password, String url, String database) { | ||
25 | -// this.userName = userName; | ||
26 | -// this.password = password; | ||
27 | - this.url = url; | ||
28 | - this.database = database; | ||
29 | - build(); | ||
30 | - } | ||
31 | - | ||
32 | - public InfluxDBConfig(String database) { | ||
33 | - this.database = database; | ||
34 | - build(); | ||
35 | - } | ||
36 | - | ||
37 | - private void build() { | ||
38 | - if (influxDB == null) { | ||
39 | - //influxDB = InfluxDBFactory.connect(this.url,this.userName,this.password); | ||
40 | - influxDB = InfluxDBFactory.connect(this.url); | ||
41 | - } | ||
42 | - influxDB.setDatabase(this.database); | ||
43 | - influxDB.setLogLevel(InfluxDB.LogLevel.BASIC); | ||
44 | - } | ||
45 | - | ||
46 | - public InfluxDB getInfluxDB() { | ||
47 | - return influxDB; | ||
48 | - } | ||
49 | - | ||
50 | - | ||
51 | -} | 1 | +//package org.jeecg.modules.jmreport.utils.influx; |
2 | +// | ||
3 | +//import org.influxdb.InfluxDB; | ||
4 | +//import org.influxdb.InfluxDBFactory; | ||
5 | +//import org.springframework.beans.factory.annotation.Value; | ||
6 | +//import org.springframework.stereotype.Component; | ||
7 | +// | ||
8 | +//@Component | ||
9 | +//public class InfluxDBConfig { | ||
10 | +// | ||
11 | +// @Value("${spring.influx.url}") | ||
12 | +// private String url; | ||
13 | +// | ||
14 | +// private String database; | ||
15 | +// | ||
16 | +// private String retentionPolicy; | ||
17 | +// | ||
18 | +// private InfluxDB influxDB; | ||
19 | +// | ||
20 | +// public InfluxDBConfig() { | ||
21 | +// } | ||
22 | +// | ||
23 | +// | ||
24 | +// public InfluxDBConfig(String userName, String password, String url, String database) { | ||
25 | +//// this.userName = userName; | ||
26 | +//// this.password = password; | ||
27 | +// this.url = url; | ||
28 | +// this.database = database; | ||
29 | +// build(); | ||
30 | +// } | ||
31 | +// | ||
32 | +// public InfluxDBConfig(String database) { | ||
33 | +// this.database = database; | ||
34 | +// build(); | ||
35 | +// } | ||
36 | +// | ||
37 | +// private void build() { | ||
38 | +// if (influxDB == null) { | ||
39 | +// //influxDB = InfluxDBFactory.connect(this.url,this.userName,this.password); | ||
40 | +// influxDB = InfluxDBFactory.connect(this.url); | ||
41 | +// } | ||
42 | +// influxDB.setDatabase(this.database); | ||
43 | +// influxDB.setLogLevel(InfluxDB.LogLevel.BASIC); | ||
44 | +// } | ||
45 | +// | ||
46 | +// public InfluxDB getInfluxDB() { | ||
47 | +// return influxDB; | ||
48 | +// } | ||
49 | +// | ||
50 | +// | ||
51 | +//} |
1 | -package org.jeecg.modules.jmreport.utils.influx; | ||
2 | - | ||
3 | -import lombok.extern.slf4j.Slf4j; | ||
4 | -import org.influxdb.InfluxDB; | ||
5 | -import org.influxdb.dto.Point; | ||
6 | -import org.influxdb.dto.Query; | ||
7 | -import org.influxdb.dto.QueryResult; | ||
8 | -import org.springframework.beans.factory.annotation.Autowired; | ||
9 | -import org.springframework.stereotype.Service; | ||
10 | - | ||
11 | -import java.text.SimpleDateFormat; | ||
12 | -import java.util.HashMap; | ||
13 | -import java.util.LinkedList; | ||
14 | -import java.util.List; | ||
15 | -import java.util.Map; | ||
16 | - | ||
17 | -@Slf4j | ||
18 | -@Service | ||
19 | -public class InfluxDbUtils { | ||
20 | - | ||
21 | - @Autowired | ||
22 | - InfluxDBConfig influxDBConfig; | ||
23 | - | ||
24 | - @Autowired | ||
25 | - private InfluxDB influxDB; | ||
26 | - | ||
27 | - /** | ||
28 | - * 创建数据库 | ||
29 | - * | ||
30 | - * @param dbName | ||
31 | - */ | ||
32 | - public void createDB(String dbName) { | ||
33 | - influxDB.createDatabase(dbName); | ||
34 | - } | ||
35 | - | ||
36 | - /** | ||
37 | - * 删除数据库 | ||
38 | - * | ||
39 | - * @param dbName | ||
40 | - */ | ||
41 | - public void deleteDB(String dbName) { | ||
42 | - influxDB.deleteDatabase(dbName); | ||
43 | - } | ||
44 | - | ||
45 | - /** | ||
46 | - * 创建策略 | ||
47 | - * | ||
48 | - * @param command | ||
49 | - * @param database | ||
50 | - */ | ||
51 | - public void createRetentionPolicy(String command, String defalut, String database, String policy, int fb) { | ||
52 | - command = String.format("CREATE RETENTION POLICY \"%s\" ON \"%s\" DURATION %s REPLICATION %s DEFAULT", defalut, database, policy, fb); | ||
53 | - query(command, database); | ||
54 | - } | ||
55 | - | ||
56 | - /** | ||
57 | - * 删除策略 | ||
58 | - * | ||
59 | - * @param command | ||
60 | - * @param database | ||
61 | - */ | ||
62 | - public void removeRetentionPolicy(String command, String defalut, String database, String policy, int fb) { | ||
63 | - | ||
64 | - } | ||
65 | - | ||
66 | - /** | ||
67 | - * 创建表 | ||
68 | - * | ||
69 | - * @param command 删除语句 | ||
70 | - * @return 返回错误信息 | ||
71 | - */ | ||
72 | - public void createMeasurementData(String command, String database) { | ||
73 | - | ||
74 | - } | ||
75 | - | ||
76 | - /** | ||
77 | - * 删除表 | ||
78 | - * | ||
79 | - * @param command 删除语句 | ||
80 | - * @return 返回错误信息 | ||
81 | - */ | ||
82 | - public String deleteMeasurementData(String command, String database) { | ||
83 | - QueryResult result = influxDB.query(new Query(command, database)); | ||
84 | - return result.getError(); | ||
85 | - } | ||
86 | - | ||
87 | - /** | ||
88 | - * 查询 | ||
89 | - * | ||
90 | - * @param command 查询语句 | ||
91 | - * @return | ||
92 | - */ | ||
93 | - public QueryResult query(String command, String database) { | ||
94 | - return influxDB.query(new Query(command, database)); | ||
95 | - } | ||
96 | - | ||
97 | - | ||
98 | -// public void insert(String measurements, Map<String, String> tagsMap, Map<String, Object> fieldsMap) { | ||
99 | -// influxDBConfig.getInfluxDB(); | ||
100 | -// influxDB.insert(measurements, tagsMap, fieldsMap); | 1 | +//package org.jeecg.modules.jmreport.utils.influx; |
2 | +// | ||
3 | +//import lombok.extern.slf4j.Slf4j; | ||
4 | +//import org.influxdb.InfluxDB; | ||
5 | +//import org.influxdb.dto.Point; | ||
6 | +//import org.influxdb.dto.Query; | ||
7 | +//import org.influxdb.dto.QueryResult; | ||
8 | +//import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +//import org.springframework.stereotype.Service; | ||
10 | +// | ||
11 | +//import java.text.SimpleDateFormat; | ||
12 | +//import java.util.HashMap; | ||
13 | +//import java.util.LinkedList; | ||
14 | +//import java.util.List; | ||
15 | +//import java.util.Map; | ||
16 | +// | ||
17 | +//@Slf4j | ||
18 | +//@Service | ||
19 | +//public class InfluxDbUtils { | ||
20 | +// | ||
21 | +// @Autowired | ||
22 | +// InfluxDBConfig influxDBConfig; | ||
23 | +// | ||
24 | +// @Autowired | ||
25 | +// private InfluxDB influxDB; | ||
26 | +// | ||
27 | +// /** | ||
28 | +// * 创建数据库 | ||
29 | +// * | ||
30 | +// * @param dbName | ||
31 | +// */ | ||
32 | +// public void createDB(String dbName) { | ||
33 | +// influxDB.createDatabase(dbName); | ||
101 | // } | 34 | // } |
102 | - | ||
103 | - /** | ||
104 | - * 新增 | ||
105 | - * | ||
106 | - * @param dateabse | ||
107 | - * @param measurements | ||
108 | - * @param tagsMap | ||
109 | - * @param fieldsMap | ||
110 | - */ | ||
111 | - public void insert(String dateabse, String measurements, Map<String, String> tagsMap, Map<String, Double> fieldsMap) { | ||
112 | - Point.Builder builder = Point.measurement(measurements); | ||
113 | - //builder.time(System.currentTimeMillis(),TimeUnit.MICROSECONDS); | ||
114 | - builder.addField("kpiValue", fieldsMap.get("kpiValue")); | ||
115 | - //builder.tag("resType", tagsMap.get("resType")); | ||
116 | - builder.tag("resId", tagsMap.get("resId")); | ||
117 | - builder.tag("kpiId", tagsMap.get("kpiId")); | ||
118 | - builder.tag("flag", tagsMap.get("flag")); | ||
119 | - //builder.tag("ipAdde", tagsMap.get("ipAdde")); | ||
120 | - Point point = builder.build(); | ||
121 | - influxDB.setDatabase(dateabse).write(point); | ||
122 | - } | ||
123 | - | ||
124 | - /** | ||
125 | - * 将queryResult 查询结果转换为 map | ||
126 | - * | ||
127 | - * @param queryResult 查询结果 | ||
128 | - * @return List<Map < String , Object>> | ||
129 | - * @author 惠佳旭 | ||
130 | - * @date 2020/12/17 | ||
131 | - */ | ||
132 | - public List<Map<String, Object>> queryResultToMapList(QueryResult queryResult) { | ||
133 | - List<Map<String, Object>> resultList = new LinkedList<>(); | ||
134 | - for (QueryResult.Result result : queryResult.getResults()) { | ||
135 | - if (result == null || result.getSeries() == null) { | ||
136 | - break; | ||
137 | - } | ||
138 | - for (QueryResult.Series series : result.getSeries()) { | ||
139 | - if (series == null || series.getValues() == null) { | ||
140 | - break; | ||
141 | - } | ||
142 | - List<String> columns = series.getColumns(); | ||
143 | - for (List<Object> value : series.getValues()) { | ||
144 | - if (value == null) { | ||
145 | - break; | ||
146 | - } | ||
147 | - Map<String, Object> map = new HashMap<>(columns.size()); | ||
148 | - for (int i = 0; i < value.size(); i++) { | ||
149 | - String columnName = columns.get(i); | ||
150 | - if ("time".equals(columnName)) { | ||
151 | - try { | ||
152 | - String timeStr = value.get(i).toString(); | ||
153 | - map.put(columnName, timeStr.substring(0, 10) + " " + timeStr.substring(11, 19)); | ||
154 | - } catch (Exception e) { | ||
155 | - log.error("转换失败:{}转换为日期失败", value.get(i)); | ||
156 | - map.put(columnName, value.get(i)); | ||
157 | - } | ||
158 | - } else { | ||
159 | - map.put(columnName, value.get(i)); | ||
160 | - } | ||
161 | - } | ||
162 | - resultList.add(map); | ||
163 | - } | ||
164 | - } | ||
165 | - } | ||
166 | - return resultList; | ||
167 | - } | ||
168 | - | ||
169 | - | ||
170 | - public List<Map<String, Object>> queryResultToMap(QueryResult queryResult, String dateFormat) { | ||
171 | - SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); | ||
172 | - List<Map<String, Object>> resultList = new LinkedList<>(); | ||
173 | - for (QueryResult.Result result : queryResult.getResults()) { | ||
174 | - if (result == null || result.getSeries() == null) { | ||
175 | - break; | ||
176 | - } | ||
177 | - for (QueryResult.Series series : result.getSeries()) { | ||
178 | - if (series == null || series.getValues() == null) { | ||
179 | - break; | ||
180 | - } | ||
181 | - List<String> columns = series.getColumns(); | ||
182 | - for (List<Object> value : series.getValues()) { | ||
183 | - if (value == null) { | ||
184 | - break; | ||
185 | - } | ||
186 | - Map<String, Object> map = new HashMap<>(columns.size()); | ||
187 | - for (int i = 0; i < value.size(); i++) { | ||
188 | - String columnName = columns.get(i); | ||
189 | - if ("time".equals(columnName)) { | ||
190 | - try { | ||
191 | - map.put(columnName, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(sdf.parse(value.get(i).toString()))); | ||
192 | - } catch (Exception e) { | ||
193 | - log.error("转换失败:{}转换为日期失败", value.get(i)); | ||
194 | - map.put(columnName, value.get(i)); | ||
195 | - } | ||
196 | - } else { | ||
197 | - map.put(columnName, value.get(i)); | ||
198 | - } | ||
199 | - } | ||
200 | - resultList.add(map); | ||
201 | - } | ||
202 | - } | ||
203 | - } | ||
204 | - return resultList; | ||
205 | - } | ||
206 | - | ||
207 | - | ||
208 | -} | 35 | +// |
36 | +// /** | ||
37 | +// * 删除数据库 | ||
38 | +// * | ||
39 | +// * @param dbName | ||
40 | +// */ | ||
41 | +// public void deleteDB(String dbName) { | ||
42 | +// influxDB.deleteDatabase(dbName); | ||
43 | +// } | ||
44 | +// | ||
45 | +// /** | ||
46 | +// * 创建策略 | ||
47 | +// * | ||
48 | +// * @param command | ||
49 | +// * @param database | ||
50 | +// */ | ||
51 | +// public void createRetentionPolicy(String command, String defalut, String database, String policy, int fb) { | ||
52 | +// command = String.format("CREATE RETENTION POLICY \"%s\" ON \"%s\" DURATION %s REPLICATION %s DEFAULT", defalut, database, policy, fb); | ||
53 | +// query(command, database); | ||
54 | +// } | ||
55 | +// | ||
56 | +// /** | ||
57 | +// * 删除策略 | ||
58 | +// * | ||
59 | +// * @param command | ||
60 | +// * @param database | ||
61 | +// */ | ||
62 | +// public void removeRetentionPolicy(String command, String defalut, String database, String policy, int fb) { | ||
63 | +// | ||
64 | +// } | ||
65 | +// | ||
66 | +// /** | ||
67 | +// * 创建表 | ||
68 | +// * | ||
69 | +// * @param command 删除语句 | ||
70 | +// * @return 返回错误信息 | ||
71 | +// */ | ||
72 | +// public void createMeasurementData(String command, String database) { | ||
73 | +// | ||
74 | +// } | ||
75 | +// | ||
76 | +// /** | ||
77 | +// * 删除表 | ||
78 | +// * | ||
79 | +// * @param command 删除语句 | ||
80 | +// * @return 返回错误信息 | ||
81 | +// */ | ||
82 | +// public String deleteMeasurementData(String command, String database) { | ||
83 | +// QueryResult result = influxDB.query(new Query(command, database)); | ||
84 | +// return result.getError(); | ||
85 | +// } | ||
86 | +// | ||
87 | +// /** | ||
88 | +// * 查询 | ||
89 | +// * | ||
90 | +// * @param command 查询语句 | ||
91 | +// * @return | ||
92 | +// */ | ||
93 | +// public QueryResult query(String command, String database) { | ||
94 | +// return influxDB.query(new Query(command, database)); | ||
95 | +// } | ||
96 | +// | ||
97 | +// | ||
98 | +//// public void insert(String measurements, Map<String, String> tagsMap, Map<String, Object> fieldsMap) { | ||
99 | +//// influxDBConfig.getInfluxDB(); | ||
100 | +//// influxDB.insert(measurements, tagsMap, fieldsMap); | ||
101 | +//// } | ||
102 | +// | ||
103 | +// /** | ||
104 | +// * 新增 | ||
105 | +// * | ||
106 | +// * @param dateabse | ||
107 | +// * @param measurements | ||
108 | +// * @param tagsMap | ||
109 | +// * @param fieldsMap | ||
110 | +// */ | ||
111 | +// public void insert(String dateabse, String measurements, Map<String, String> tagsMap, Map<String, Double> fieldsMap) { | ||
112 | +// Point.Builder builder = Point.measurement(measurements); | ||
113 | +// //builder.time(System.currentTimeMillis(),TimeUnit.MICROSECONDS); | ||
114 | +// builder.addField("kpiValue", fieldsMap.get("kpiValue")); | ||
115 | +// //builder.tag("resType", tagsMap.get("resType")); | ||
116 | +// builder.tag("resId", tagsMap.get("resId")); | ||
117 | +// builder.tag("kpiId", tagsMap.get("kpiId")); | ||
118 | +// builder.tag("flag", tagsMap.get("flag")); | ||
119 | +// //builder.tag("ipAdde", tagsMap.get("ipAdde")); | ||
120 | +// Point point = builder.build(); | ||
121 | +// influxDB.setDatabase(dateabse).write(point); | ||
122 | +// } | ||
123 | +// | ||
124 | +// /** | ||
125 | +// * 将queryResult 查询结果转换为 map | ||
126 | +// * | ||
127 | +// * @param queryResult 查询结果 | ||
128 | +// * @return List<Map < String , Object>> | ||
129 | +// * @author 惠佳旭 | ||
130 | +// * @date 2020/12/17 | ||
131 | +// */ | ||
132 | +// public List<Map<String, Object>> queryResultToMapList(QueryResult queryResult) { | ||
133 | +// List<Map<String, Object>> resultList = new LinkedList<>(); | ||
134 | +// for (QueryResult.Result result : queryResult.getResults()) { | ||
135 | +// if (result == null || result.getSeries() == null) { | ||
136 | +// break; | ||
137 | +// } | ||
138 | +// for (QueryResult.Series series : result.getSeries()) { | ||
139 | +// if (series == null || series.getValues() == null) { | ||
140 | +// break; | ||
141 | +// } | ||
142 | +// List<String> columns = series.getColumns(); | ||
143 | +// for (List<Object> value : series.getValues()) { | ||
144 | +// if (value == null) { | ||
145 | +// break; | ||
146 | +// } | ||
147 | +// Map<String, Object> map = new HashMap<>(columns.size()); | ||
148 | +// for (int i = 0; i < value.size(); i++) { | ||
149 | +// String columnName = columns.get(i); | ||
150 | +// if ("time".equals(columnName)) { | ||
151 | +// try { | ||
152 | +// String timeStr = value.get(i).toString(); | ||
153 | +// map.put(columnName, timeStr.substring(0, 10) + " " + timeStr.substring(11, 19)); | ||
154 | +// } catch (Exception e) { | ||
155 | +// log.error("转换失败:{}转换为日期失败", value.get(i)); | ||
156 | +// map.put(columnName, value.get(i)); | ||
157 | +// } | ||
158 | +// } else { | ||
159 | +// map.put(columnName, value.get(i)); | ||
160 | +// } | ||
161 | +// } | ||
162 | +// resultList.add(map); | ||
163 | +// } | ||
164 | +// } | ||
165 | +// } | ||
166 | +// return resultList; | ||
167 | +// } | ||
168 | +// | ||
169 | +// | ||
170 | +// public List<Map<String, Object>> queryResultToMap(QueryResult queryResult, String dateFormat) { | ||
171 | +// SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); | ||
172 | +// List<Map<String, Object>> resultList = new LinkedList<>(); | ||
173 | +// for (QueryResult.Result result : queryResult.getResults()) { | ||
174 | +// if (result == null || result.getSeries() == null) { | ||
175 | +// break; | ||
176 | +// } | ||
177 | +// for (QueryResult.Series series : result.getSeries()) { | ||
178 | +// if (series == null || series.getValues() == null) { | ||
179 | +// break; | ||
180 | +// } | ||
181 | +// List<String> columns = series.getColumns(); | ||
182 | +// for (List<Object> value : series.getValues()) { | ||
183 | +// if (value == null) { | ||
184 | +// break; | ||
185 | +// } | ||
186 | +// Map<String, Object> map = new HashMap<>(columns.size()); | ||
187 | +// for (int i = 0; i < value.size(); i++) { | ||
188 | +// String columnName = columns.get(i); | ||
189 | +// if ("time".equals(columnName)) { | ||
190 | +// try { | ||
191 | +// map.put(columnName, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(sdf.parse(value.get(i).toString()))); | ||
192 | +// } catch (Exception e) { | ||
193 | +// log.error("转换失败:{}转换为日期失败", value.get(i)); | ||
194 | +// map.put(columnName, value.get(i)); | ||
195 | +// } | ||
196 | +// } else { | ||
197 | +// map.put(columnName, value.get(i)); | ||
198 | +// } | ||
199 | +// } | ||
200 | +// resultList.add(map); | ||
201 | +// } | ||
202 | +// } | ||
203 | +// } | ||
204 | +// return resultList; | ||
205 | +// } | ||
206 | +// | ||
207 | +// | ||
208 | +//} |
1 | -server: | ||
2 | - port: 8085 | ||
3 | -spring: | ||
4 | - #配置静态资源 | ||
5 | - mvc: | ||
6 | - static-path-pattern: /** | ||
7 | - resource: | ||
8 | - static-locations: classpath:/static/ | ||
9 | - #配置数据库 | ||
10 | - datasource: | ||
11 | - url: jdbc:mysql://${MYSQL-HOST:192.168.0.249}:${MYSQL-PORT:3306}/${MYSQL-DB:jreport}?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true | ||
12 | - username: root | ||
13 | - password: 123456 | ||
14 | - driver-class-name: com.mysql.cj.jdbc.Driver | ||
15 | -#Minidao配置 | ||
16 | -minidao : | ||
17 | - base-package: org.jeecg.modules.jmreport.* | ||
18 | -#JimuReport[上传配置] | ||
19 | -jeecg : | ||
20 | - # local|minio|alioss | ||
21 | - uploadType: local | ||
22 | - # local | ||
23 | - path : | ||
24 | - #文件路径 | ||
25 | - upload: /opt/upload | ||
26 | - # alioss | ||
27 | - oss: | ||
28 | - endpoint: ?? | ||
29 | - accessKey: ?? | ||
30 | - secretKey: ?? | ||
31 | - bucketName: jimureport | ||
32 | - # minio | ||
33 | - minio: | ||
34 | - minio_url: http://minio.jeecg.com | ||
35 | - minio_name: ?? | ||
36 | - minio_pass: ?? | ||
37 | - bucketName: ?? | ||
38 | -#输出sql日志 | ||
39 | -logging: | ||
40 | - level: | ||
41 | - org.jeecg.modules.jmreport : info |
1 | -server: | ||
2 | - port: 8085 | ||
3 | -spring: | ||
4 | - #配置静态资源 | ||
5 | - mvc: | ||
6 | - static-path-pattern: /** | ||
7 | - resource: | ||
8 | - static-locations: classpath:/static/ | ||
9 | - #配置数据库 | ||
10 | - datasource: | ||
11 | - url: jdbc:mysql://192.168.0.249:3306/jreport?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true | ||
12 | - username: root | ||
13 | - password: 123456 | ||
14 | - driver-class-name: com.mysql.cj.jdbc.Driver | ||
15 | -#Minidao配置 | ||
16 | -minidao : | ||
17 | - base-package: org.jeecg.modules.jmreport.* | ||
18 | -#JimuReport[上传配置] | ||
19 | -jeecg : | ||
20 | - # local|minio|alioss | ||
21 | - uploadType: local | ||
22 | - # local | ||
23 | - path : | ||
24 | - #文件路径 | ||
25 | - upload: /opt/upload | ||
26 | - # alioss | ||
27 | - oss: | ||
28 | - endpoint: ?? | ||
29 | - accessKey: ?? | ||
30 | - secretKey: ?? | ||
31 | - bucketName: jimureport | ||
32 | - # minio | ||
33 | - minio: | ||
34 | - minio_url: http://minio.jeecg.com | ||
35 | - minio_name: ?? | ||
36 | - minio_pass: ?? | ||
37 | - bucketName: ?? | ||
38 | -#输出sql日志 | ||
39 | -logging: | ||
40 | - level: | ||
41 | - org.jeecg.modules.jmreport : info |
@@ -8,12 +8,10 @@ spring: | @@ -8,12 +8,10 @@ spring: | ||
8 | static-locations: classpath:/static/ | 8 | static-locations: classpath:/static/ |
9 | #配置数据库 | 9 | #配置数据库 |
10 | datasource: | 10 | datasource: |
11 | - url: jdbc:mysql://${MYSQL-HOST:127.0.0.1}:${MYSQL-PORT:3306}/${MYSQL-DB:jreport}?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true | ||
12 | - username: yx | 11 | + url: jdbc:mysql://192.168.0.249:3306/jreport?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true |
12 | + username: root | ||
13 | password: 123456 | 13 | password: 123456 |
14 | driver-class-name: com.mysql.cj.jdbc.Driver | 14 | driver-class-name: com.mysql.cj.jdbc.Driver |
15 | - profiles: | ||
16 | - active: tjserver | ||
17 | influx: | 15 | influx: |
18 | url: http://192.168.0.244:8086 | 16 | url: http://192.168.0.244:8086 |
19 | database: monitor | 17 | database: monitor |
@@ -45,22 +45,8 @@ | @@ -45,22 +45,8 @@ | ||
45 | <!--引入自定义组件--> | 45 | <!--引入自定义组件--> |
46 | <div id="app" style="padding-left: 30px;height: 100%"> | 46 | <div id="app" style="padding-left: 30px;height: 100%"> |
47 | <div class="layout" style="margin-left: -30px;margin-top: -10px;;height: 100%;display: flex"> | 47 | <div class="layout" style="margin-left: -30px;margin-top: -10px;;height: 100%;display: flex"> |
48 | - <div v-if="dataSource.child && dataSource.child.length > 0" style="width: 200px;height: 100%"> | 48 | + <div v-if="dataSource.child && dataSource.child.length > 1" style="width: 200px;height: 100%"> |
49 | <Sider breakpoint="md" collapsible :collapsed-width="78" v-model="isCollapsed"> | 49 | <Sider breakpoint="md" collapsible :collapsed-width="78" v-model="isCollapsed"> |
50 | - <#--<i-menu theme="primary" width="auto" :class="menuitemClasses" active-name="datainfo" | ||
51 | - :open-names="['sub']" @on-select="onMenuSelect"> | ||
52 | - <Submenu name="sub"> | ||
53 | - <template slot="title"> | ||
54 | - <Icon type="ios-apps"/> | ||
55 | - </Icon> | ||
56 | - {{dataSource.pageName}} | ||
57 | - </template> | ||
58 | - <Menu-Item :name="item.pageCode" v-for="(item,index) in dataSource.child"> | ||
59 | - <span>{{item.pageName}}</span> | ||
60 | - </Menu-Item> | ||
61 | - </Submenu> | ||
62 | - </i-menu>--> | ||
63 | - | ||
64 | <i-menu theme="primary" width="auto" :class="menuitemClasses" active-name="datainfo" | 50 | <i-menu theme="primary" width="auto" :class="menuitemClasses" active-name="datainfo" |
65 | :open-names="['sub']" @on-select="onMenuSelect"> | 51 | :open-names="['sub']" @on-select="onMenuSelect"> |
66 | <Submenu name="sub"> | 52 | <Submenu name="sub"> |
@@ -87,11 +73,11 @@ | @@ -87,11 +73,11 @@ | ||
87 | <div slot="trigger"></div> | 73 | <div slot="trigger"></div> |
88 | </Sider> | 74 | </Sider> |
89 | </div> | 75 | </div> |
90 | - <div v-if="dataSource.child && dataSource.child.length > 0" style="width: calc(100% - 200px);height: 100%"> | 76 | + <#--<div v-if="dataSource.child && dataSource.child.length == 1" style="width: calc(100% - 200px);height: 100%"> |
91 | <iframe id="reportFrame" frameborder="0" width="100%" :height="height" :src="src" | 77 | <iframe id="reportFrame" frameborder="0" width="100%" :height="height" :src="src" |
92 | style="border: none;padding-top: 15px;"></iframe> | 78 | style="border: none;padding-top: 15px;"></iframe> |
93 | - </div> | ||
94 | - <div v-else> | 79 | + </div>--> |
80 | + <div v-else style="margin-left: 3px;width: 100%"> | ||
95 | <iframe id="reportFrame" frameborder="0" width="100%" :height="height" :src="src" | 81 | <iframe id="reportFrame" frameborder="0" width="100%" :height="height" :src="src" |
96 | style="border: none;padding-top: 15px;"></iframe> | 82 | style="border: none;padding-top: 15px;"></iframe> |
97 | </div> | 83 | </div> |
@@ -108,7 +94,8 @@ | @@ -108,7 +94,8 @@ | ||
108 | src: '', | 94 | src: '', |
109 | height: document.documentElement.clientHeight, | 95 | height: document.documentElement.clientHeight, |
110 | dataSource: {}, | 96 | dataSource: {}, |
111 | - codeMaps:[] | 97 | + codeMaps:[], |
98 | + hideLeftView:false | ||
112 | }, | 99 | }, |
113 | computed: { | 100 | computed: { |
114 | menuitemClasses: function () { | 101 | menuitemClasses: function () { |
@@ -142,6 +129,9 @@ | @@ -142,6 +129,9 @@ | ||
142 | success: (result) => { | 129 | success: (result) => { |
143 | that.dataSource = result.root; | 130 | that.dataSource = result.root; |
144 | that.codeMaps = result.codeMaps; | 131 | that.codeMaps = result.codeMaps; |
132 | + if(Object.keys(that.codeMaps).length == 0){ | ||
133 | + that.hideLeftView = true; | ||
134 | + } | ||
145 | if (result.reportCode) { | 135 | if (result.reportCode) { |
146 | that.setReportSrc(result.reportCode); | 136 | that.setReportSrc(result.reportCode); |
147 | } else { | 137 | } else { |
-
Please register or login to post a comment