updateMerge branch 'master' of http://git.yoho.cn/ops/monitor-service
Showing
25 changed files
with
636 additions
and
122 deletions
1 | +package com.monitor.cmdb.ctrl; | ||
2 | + | ||
3 | +import com.model.HostInfo; | ||
4 | +import com.model.JavaApiInfo; | ||
5 | +import com.monitor.cmdb.service.IJavaApiInfoService; | ||
6 | +import com.monitor.cmdb.service.impl.JavaApiInfoService; | ||
7 | +import com.monitor.model.request.JavaApiInfoReq; | ||
8 | +import com.monitor.model.response.BaseResponse; | ||
9 | +import com.monitor.model.response.PageResponse; | ||
10 | +import org.slf4j.Logger; | ||
11 | +import org.slf4j.LoggerFactory; | ||
12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
13 | +import org.springframework.util.CollectionUtils; | ||
14 | +import org.springframework.web.bind.annotation.*; | ||
15 | + | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | +/** | ||
19 | + * Created by fruwei on 2016/6/20. | ||
20 | + */ | ||
21 | +@RestController | ||
22 | +@RequestMapping(value = "/javaApi") | ||
23 | +public class JavaApiInfoCtrl { | ||
24 | + | ||
25 | + Logger log = LoggerFactory.getLogger(JavaApiInfoCtrl.class); | ||
26 | + | ||
27 | + @Autowired | ||
28 | + private IJavaApiInfoService javaApiInfoService; | ||
29 | + | ||
30 | + | ||
31 | + @RequestMapping("/query") | ||
32 | + @ResponseBody | ||
33 | + public BaseResponse<PageResponse<JavaApiInfo>> getJavaApiInfos(@RequestBody JavaApiInfoReq req) throws Exception { | ||
34 | + | ||
35 | + log.info("getJavaApiInfos with param is {}", req); | ||
36 | + // 查询列表 | ||
37 | + | ||
38 | + PageResponse<JavaApiInfo> responseBO = javaApiInfoService.getJavaApiInfos(req); | ||
39 | + if (responseBO == null || CollectionUtils.isEmpty(responseBO.getRows())) { | ||
40 | + return new BaseResponse<PageResponse<JavaApiInfo>>(); | ||
41 | + } | ||
42 | + PageResponse<JavaApiInfo> response = new PageResponse<JavaApiInfo>(); | ||
43 | + response.setCurrentPage(responseBO.getCurrentPage()); | ||
44 | + response.setRows(responseBO.getRows()); | ||
45 | + response.setPageSize(responseBO.getPageSize()); | ||
46 | + response.setTotal(responseBO.getTotal()); | ||
47 | + log.info("getJavaApiInfos success and total={}", response.getTotal()); | ||
48 | + | ||
49 | + return new BaseResponse<PageResponse<JavaApiInfo>>(response); | ||
50 | + } | ||
51 | + | ||
52 | + @RequestMapping("/save") | ||
53 | + @ResponseBody | ||
54 | + public BaseResponse<Integer> saveJavaApiInfo(@RequestBody JavaApiInfo req) throws Exception { | ||
55 | + log.info("saveMechineInfo with param is {}", req); | ||
56 | + return javaApiInfoService.saveJavaApiInfo(req); | ||
57 | + } | ||
58 | + | ||
59 | + | ||
60 | + @RequestMapping("/del") | ||
61 | + @ResponseBody | ||
62 | + public BaseResponse<Integer> delJavaApiInfo(@RequestParam(value = "id", required = true) Integer id) throws Exception { | ||
63 | + log.info("delMechineInfo with param is {}", id); | ||
64 | + return javaApiInfoService.delJavaApiInfo(id); | ||
65 | + } | ||
66 | + | ||
67 | + | ||
68 | +} |
1 | package com.monitor.cmdb.ctrl; | 1 | package com.monitor.cmdb.ctrl; |
2 | 2 | ||
3 | +import com.fasterxml.jackson.databind.deser.Deserializers; | ||
3 | import com.model.HostGroup; | 4 | import com.model.HostGroup; |
4 | import com.model.HostInfo; | 5 | import com.model.HostInfo; |
5 | import com.model.MObjectInfo; | 6 | import com.model.MObjectInfo; |
7 | +import com.model.TypeInfo; | ||
6 | import com.monitor.cmdb.service.IHostGroupService; | 8 | import com.monitor.cmdb.service.IHostGroupService; |
7 | import com.monitor.cmdb.service.IHostInfoService; | 9 | import com.monitor.cmdb.service.IHostInfoService; |
8 | import com.monitor.cmdb.service.IMObjectInfoService; | 10 | import com.monitor.cmdb.service.IMObjectInfoService; |
@@ -47,10 +49,21 @@ public class MObjectInfoCtrl { | @@ -47,10 +49,21 @@ public class MObjectInfoCtrl { | ||
47 | ITypeInfoService typeInfoService; | 49 | ITypeInfoService typeInfoService; |
48 | 50 | ||
49 | @RequestMapping(value = "/queryHost", method = RequestMethod.POST) | 51 | @RequestMapping(value = "/queryHost", method = RequestMethod.POST) |
50 | - public BaseResponse queryMObject(@RequestBody MObjectHostInfoReq request) { | 52 | + public BaseResponse queryMObjectHost(@RequestBody MObjectHostInfoReq request) { |
51 | 53 | ||
52 | - DEBUG.debug("Query mobject host info by request: {}", request.getSelectIp()); | 54 | + DEBUG.debug("Query mobject host info by request: {}", request); |
53 | 55 | ||
56 | + BaseResponse response = null; | ||
57 | + | ||
58 | + if (0 == request.getIsGroup()) { | ||
59 | + response = queryMHostInfoByIp(request); | ||
60 | + } else { | ||
61 | + response = queryMHostInfoByGroup(request); | ||
62 | + } | ||
63 | + return response; | ||
64 | + } | ||
65 | + | ||
66 | + private BaseResponse queryMHostInfoByIp(MObjectHostInfoReq request) { | ||
54 | BaseResponse response = new BaseResponse(); | 67 | BaseResponse response = new BaseResponse(); |
55 | 68 | ||
56 | MObjectHostInfoModel model = new MObjectHostInfoModel(); | 69 | MObjectHostInfoModel model = new MObjectHostInfoModel(); |
@@ -72,10 +85,11 @@ public class MObjectInfoCtrl { | @@ -72,10 +85,11 @@ public class MObjectInfoCtrl { | ||
72 | 85 | ||
73 | selectIp = info.getHostIp(); | 86 | selectIp = info.getHostIp(); |
74 | 87 | ||
75 | - selectGroup = info.getGroupName(); | ||
76 | - | ||
77 | selectGroupId = info.getGroupId(); | 88 | selectGroupId = info.getGroupId(); |
78 | 89 | ||
90 | + selectGroup = groupService.getHostGroupById(selectGroupId).getData().getGroupName(); | ||
91 | + | ||
92 | + | ||
79 | } else { | 93 | } else { |
80 | if (sourceGroupList.size() > 0) { | 94 | if (sourceGroupList.size() > 0) { |
81 | selectGroup = sourceGroupList.get(0).getGroupName(); | 95 | selectGroup = sourceGroupList.get(0).getGroupName(); |
@@ -111,6 +125,50 @@ public class MObjectInfoCtrl { | @@ -111,6 +125,50 @@ public class MObjectInfoCtrl { | ||
111 | } | 125 | } |
112 | 126 | ||
113 | 127 | ||
128 | + private BaseResponse queryMHostInfoByGroup(MObjectHostInfoReq request) { | ||
129 | + BaseResponse response = new BaseResponse(); | ||
130 | + | ||
131 | + MObjectHostInfoModel model = new MObjectHostInfoModel(); | ||
132 | + | ||
133 | + List<String> groupList = new ArrayList<>(); | ||
134 | + | ||
135 | + List<String> ipList = new ArrayList<>(); | ||
136 | + | ||
137 | + String selectIp = ""; | ||
138 | + | ||
139 | + String selectGroup = ""; | ||
140 | + | ||
141 | + int selectGroupId = 0; | ||
142 | + | ||
143 | + List<HostGroup> sourceGroupList = groupService.getListGroups(); | ||
144 | + | ||
145 | + for (HostGroup group : sourceGroupList) { | ||
146 | + if (StringUtils.equals(group.getGroupName(), request.getSelectGroup())) { | ||
147 | + selectGroupId = group.getId(); | ||
148 | + selectGroup = group.getGroupName(); | ||
149 | + } | ||
150 | + } | ||
151 | + | ||
152 | + for (HostGroup group : sourceGroupList) { | ||
153 | + groupList.add(group.getGroupName()); | ||
154 | + } | ||
155 | + | ||
156 | + if (StringUtils.isNotBlank(selectGroup)) { | ||
157 | + for (HostInfo info : hostInfoService.getHostInfosByGroupId(selectGroupId)) { | ||
158 | + ipList.add(info.getHostIp()); | ||
159 | + } | ||
160 | + } | ||
161 | + | ||
162 | + selectIp = ipList.get(0); | ||
163 | + model.setSelectIp(selectIp); | ||
164 | + model.setSelectGroup(selectGroup); | ||
165 | + model.setIpList(ipList); | ||
166 | + model.setGroupList(groupList); | ||
167 | + response.setData(model); | ||
168 | + return response; | ||
169 | + } | ||
170 | + | ||
171 | + | ||
114 | @RequestMapping(value = "/query", method = RequestMethod.POST) | 172 | @RequestMapping(value = "/query", method = RequestMethod.POST) |
115 | public BaseResponse queryMObject(@RequestBody MObjectInfoReq request) { | 173 | public BaseResponse queryMObject(@RequestBody MObjectInfoReq request) { |
116 | 174 | ||
@@ -362,4 +420,53 @@ public class MObjectInfoCtrl { | @@ -362,4 +420,53 @@ public class MObjectInfoCtrl { | ||
362 | return true; | 420 | return true; |
363 | } | 421 | } |
364 | 422 | ||
423 | + | ||
424 | + /** | ||
425 | + * 获取所有java app服务 | ||
426 | + * @return | ||
427 | + */ | ||
428 | + @RequestMapping(value = "/javaapi") | ||
429 | + @ResponseBody | ||
430 | + public BaseResponse queryJavaApiMobject() { | ||
431 | + | ||
432 | + List<TypeInfo> allTypeInfo = null; | ||
433 | + | ||
434 | + BaseResponse response = new BaseResponse(); | ||
435 | + | ||
436 | + try { | ||
437 | + TypeInfo typeInfo = typeInfoService.queryTypeInfoByName(TypeInfoCtrl.TYPE_JAVA_APP); | ||
438 | + | ||
439 | + | ||
440 | + if (typeInfo == null) { | ||
441 | + return response; | ||
442 | + } | ||
443 | + allTypeInfo = typeInfoService.queryChildTypesInfo(typeInfo.getTypeId()); | ||
444 | + | ||
445 | + if (null == allTypeInfo) { | ||
446 | + return response; | ||
447 | + } | ||
448 | + String ids=""; | ||
449 | + for(TypeInfo type:allTypeInfo){ | ||
450 | + if(ids.equals("")) | ||
451 | + ids+=type.getTypeId(); | ||
452 | + else | ||
453 | + ids+=","+type.getTypeId(); | ||
454 | + } | ||
455 | + | ||
456 | + MObjectInfoReq req=new MObjectInfoReq(); | ||
457 | + req.setIsType(1); | ||
458 | + req.setTypeIds(ids); | ||
459 | + return queryMObjectByType(req); | ||
460 | + | ||
461 | + } catch (Exception e) { | ||
462 | + DEBUG.error("Failed to query all typeInfo, error: {}", e); | ||
463 | + response.setCode(400); | ||
464 | + response.setMessage(e.getMessage()); | ||
465 | + } | ||
466 | + | ||
467 | + return response; | ||
468 | + | ||
469 | + | ||
470 | + } | ||
471 | + | ||
365 | } | 472 | } |
@@ -22,6 +22,8 @@ import java.util.List; | @@ -22,6 +22,8 @@ import java.util.List; | ||
22 | public class TypeInfoCtrl { | 22 | public class TypeInfoCtrl { |
23 | public static final Logger DEBUG = LoggerFactory.getLogger(TypeInfoCtrl.class); | 23 | public static final Logger DEBUG = LoggerFactory.getLogger(TypeInfoCtrl.class); |
24 | 24 | ||
25 | + public static final String TYPE_JAVA_APP = "java_app"; | ||
26 | + | ||
25 | @Autowired | 27 | @Autowired |
26 | ITypeInfoService typeInfoService; | 28 | ITypeInfoService typeInfoService; |
27 | 29 | ||
@@ -72,10 +74,8 @@ public class TypeInfoCtrl { | @@ -72,10 +74,8 @@ public class TypeInfoCtrl { | ||
72 | 74 | ||
73 | if (null != allTypeInfo) { | 75 | if (null != allTypeInfo) { |
74 | 76 | ||
75 | - for (TypeInfo info : allTypeInfo) | ||
76 | - { | ||
77 | - if(1==info.getTypeIsLeaf()) | ||
78 | - { | 77 | + for (TypeInfo info : allTypeInfo) { |
78 | + if (1 == info.getTypeIsLeaf()) { | ||
79 | leafTypeInfo.add(info); | 79 | leafTypeInfo.add(info); |
80 | } | 80 | } |
81 | } | 81 | } |
@@ -249,6 +249,31 @@ public class TypeInfoCtrl { | @@ -249,6 +249,31 @@ public class TypeInfoCtrl { | ||
249 | } | 249 | } |
250 | 250 | ||
251 | 251 | ||
252 | + @RequestMapping(value = "/queryJavaApi", method = RequestMethod.GET) | ||
253 | + public BaseResponse queryJavaApi() { | ||
254 | + | ||
255 | + DEBUG.debug("Query all java api info..."); | ||
256 | + | ||
257 | + List<TypeInfo> allTypeInfo = null; | ||
258 | + BaseResponse response = new BaseResponse(); | ||
259 | + try { | ||
260 | + TypeInfo typeInfo = typeInfoService.queryTypeInfoByName(TYPE_JAVA_APP); | ||
261 | + | ||
262 | + if (typeInfo != null) { | ||
263 | + allTypeInfo = typeInfoService.queryChildTypesInfo(typeInfo.getTypeId()); | ||
264 | + if (null != allTypeInfo) { | ||
265 | + response.setData(allTypeInfo); | ||
266 | + } | ||
267 | + } | ||
268 | + | ||
269 | + } catch (Exception e) { | ||
270 | + DEBUG.error("Failed to query all typeInfo, error: {}", e); | ||
271 | + response.setCode(400); | ||
272 | + response.setMessage(e.getMessage()); | ||
273 | + } | ||
274 | + return response; | ||
275 | + } | ||
276 | + | ||
252 | @RequestMapping(value = "/queryNode", method = RequestMethod.GET) | 277 | @RequestMapping(value = "/queryNode", method = RequestMethod.GET) |
253 | public BaseResponse queryNodeTypeInfo() { | 278 | public BaseResponse queryNodeTypeInfo() { |
254 | 279 | ||
@@ -265,10 +290,8 @@ public class TypeInfoCtrl { | @@ -265,10 +290,8 @@ public class TypeInfoCtrl { | ||
265 | 290 | ||
266 | if (null != allTypeInfo) { | 291 | if (null != allTypeInfo) { |
267 | 292 | ||
268 | - for (TypeInfo info : allTypeInfo) | ||
269 | - { | ||
270 | - if(0==info.getTypeIsLeaf()) | ||
271 | - { | 293 | + for (TypeInfo info : allTypeInfo) { |
294 | + if (0 == info.getTypeIsLeaf()) { | ||
272 | leafTypeInfo.add(info); | 295 | leafTypeInfo.add(info); |
273 | } | 296 | } |
274 | } | 297 | } |
@@ -288,5 +311,4 @@ public class TypeInfoCtrl { | @@ -288,5 +311,4 @@ public class TypeInfoCtrl { | ||
288 | } | 311 | } |
289 | 312 | ||
290 | 313 | ||
291 | - | ||
292 | } | 314 | } |
1 | package com.monitor.cmdb.service; | 1 | package com.monitor.cmdb.service; |
2 | 2 | ||
3 | import com.model.JavaApiInfo; | 3 | import com.model.JavaApiInfo; |
4 | +import com.monitor.model.request.JavaApiInfoReq; | ||
4 | import com.monitor.model.response.BaseResponse; | 5 | import com.monitor.model.response.BaseResponse; |
6 | +import com.monitor.model.response.PageResponse; | ||
5 | 7 | ||
6 | import java.util.List; | 8 | import java.util.List; |
7 | 9 | ||
@@ -19,5 +21,5 @@ public interface IJavaApiInfoService { | @@ -19,5 +21,5 @@ public interface IJavaApiInfoService { | ||
19 | 21 | ||
20 | public BaseResponse<Integer> delJavaApiInfo(int id); | 22 | public BaseResponse<Integer> delJavaApiInfo(int id); |
21 | 23 | ||
22 | - | 24 | + PageResponse<JavaApiInfo> getJavaApiInfos(JavaApiInfoReq req); |
23 | } | 25 | } |
@@ -2,11 +2,17 @@ package com.monitor.cmdb.service.impl; | @@ -2,11 +2,17 @@ package com.monitor.cmdb.service.impl; | ||
2 | 2 | ||
3 | import com.model.JavaApiInfo; | 3 | import com.model.JavaApiInfo; |
4 | import com.monitor.cmdb.service.IJavaApiInfoService; | 4 | import com.monitor.cmdb.service.IJavaApiInfoService; |
5 | +import com.monitor.model.domain.PageBean; | ||
6 | +import com.monitor.model.request.JavaApiInfoReq; | ||
5 | import com.monitor.model.response.BaseResponse; | 7 | import com.monitor.model.response.BaseResponse; |
8 | +import com.monitor.model.response.PageResponse; | ||
6 | import com.monitor.mysql.mapper.JavaApiInfoMapper; | 9 | import com.monitor.mysql.mapper.JavaApiInfoMapper; |
10 | +import org.slf4j.Logger; | ||
11 | +import org.slf4j.LoggerFactory; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
8 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
9 | import org.springframework.stereotype.Service; | 14 | import org.springframework.stereotype.Service; |
15 | +import org.springframework.util.CollectionUtils; | ||
10 | 16 | ||
11 | import java.util.List; | 17 | import java.util.List; |
12 | 18 | ||
@@ -15,6 +21,7 @@ import java.util.List; | @@ -15,6 +21,7 @@ import java.util.List; | ||
15 | */ | 21 | */ |
16 | @Service | 22 | @Service |
17 | public class JavaApiInfoService implements IJavaApiInfoService { | 23 | public class JavaApiInfoService implements IJavaApiInfoService { |
24 | + Logger log= LoggerFactory.getLogger(JavaApiInfoService.class); | ||
18 | @Autowired | 25 | @Autowired |
19 | private JavaApiInfoMapper javaApiInfoMapper; | 26 | private JavaApiInfoMapper javaApiInfoMapper; |
20 | @Override | 27 | @Override |
@@ -44,4 +51,33 @@ public class JavaApiInfoService implements IJavaApiInfoService { | @@ -44,4 +51,33 @@ public class JavaApiInfoService implements IJavaApiInfoService { | ||
44 | return new BaseResponse<Integer>(result); | 51 | return new BaseResponse<Integer>(result); |
45 | } | 52 | } |
46 | 53 | ||
54 | + @Override | ||
55 | + public PageResponse<JavaApiInfo> getJavaApiInfos(JavaApiInfoReq req) { | ||
56 | + | ||
57 | + log.info("get api infos with param is {}", req); | ||
58 | + // 组装分页对象 | ||
59 | + PageBean page = PageBean.initPageInfo(req.getCurrentPage(), | ||
60 | + req.getPageSize(), req); | ||
61 | + // 先查询符合条件的总数量 | ||
62 | + int total = javaApiInfoMapper.selectCountByCodition(page); | ||
63 | + log.info("get api infos num is {}, with param is {}", total, | ||
64 | + req); | ||
65 | + // 数量为0 直接返回 | ||
66 | + if (total == 0) { | ||
67 | + return null; | ||
68 | + } | ||
69 | + // 获取列表 | ||
70 | + List<JavaApiInfo> JavaApiInfo = javaApiInfoMapper.selectJavaInfosByCodition(page); | ||
71 | + if (CollectionUtils.isEmpty(JavaApiInfo)) { | ||
72 | + log.debug("get api infos is null with param is {}", req); | ||
73 | + return null; | ||
74 | + } | ||
75 | + PageResponse<JavaApiInfo> response = new PageResponse<JavaApiInfo>(); | ||
76 | + response.setCurrentPage(req.getCurrentPage()); | ||
77 | + response.setPageSize(req.getPageSize()); | ||
78 | + response.setTotal(total); | ||
79 | + response.setRows(JavaApiInfo); | ||
80 | + return response; | ||
81 | + } | ||
82 | + | ||
47 | } | 83 | } |
@@ -71,4 +71,9 @@ public class TypeInfoServiceImpl implements ITypeInfoService { | @@ -71,4 +71,9 @@ public class TypeInfoServiceImpl implements ITypeInfoService { | ||
71 | mTypeInfoMapper.updateTypeInfo(typeInfo); | 71 | mTypeInfoMapper.updateTypeInfo(typeInfo); |
72 | } | 72 | } |
73 | 73 | ||
74 | + @Override | ||
75 | + public TypeInfo queryTypeInfoByName(String typeName) { | ||
76 | + return mTypeInfoMapper.selectTypeInfoByName(typeName); | ||
77 | + } | ||
78 | + | ||
74 | } | 79 | } |
1 | +package com.monitor.common.contants; | ||
2 | + | ||
3 | +public class InfluxDBContants { | ||
4 | + | ||
5 | + /** | ||
6 | + * influxdb监控数据源 | ||
7 | + */ | ||
8 | + public static final String YOMO_MONITOR = "yoho_monitor"; | ||
9 | + | ||
10 | + public static final String YOMO_REPORT = "yoho_report"; | ||
11 | + | ||
12 | + public static final String YOHO_ORDER = "yoho_order"; | ||
13 | + | ||
14 | + public static final String YOHO_ALARM = "yoho_alarm"; | ||
15 | + | ||
16 | + | ||
17 | + /** | ||
18 | + * influxdb 表 | ||
19 | + */ | ||
20 | + public static final String YOMO_TB_JAVAAPI = "yoho_javaapi_statics"; | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | +} |
monitor-service-influxdb/src/main/java/com/monitor/influxdb/mapper/impl/JavaApiStaticsMapper.java
0 → 100644
1 | +package com.monitor.influxdb.mapper.impl; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.monitor.common.contants.InfluxDBContants; | ||
5 | +import com.monitor.influxdb.InluxDBSingle; | ||
6 | +import com.monitor.influxdb.mapper.IJavaApiStaticsMapper; | ||
7 | +import org.influxdb.dto.BatchPoints; | ||
8 | +import org.influxdb.dto.Point; | ||
9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
10 | +import org.springframework.stereotype.Component; | ||
11 | + | ||
12 | +/** | ||
13 | + * Created by fruwei on 2016/6/21. | ||
14 | + */ | ||
15 | +@Component | ||
16 | +public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { | ||
17 | + | ||
18 | + @Autowired | ||
19 | + private InluxDBSingle inluxDBSingle; | ||
20 | + | ||
21 | + @Override | ||
22 | + public void insertJavaApiStatics(String influxDBName, JSONObject statics) { | ||
23 | + | ||
24 | + | ||
25 | + BatchPoints batchPoints = BatchPoints | ||
26 | + .database(InfluxDBContants.YOHO_ALARM).retentionPolicy("default") | ||
27 | + .build(); | ||
28 | + Point point = Point.measurement(InfluxDBContants.YOMO_TB_JAVAAPI) | ||
29 | + .addField("java_api_info", statics.get("javaApiInfo").toString()) | ||
30 | + .addField("mobject_info", statics.get("mobject").toString()) | ||
31 | + .addField("start", statics.getLongValue("start")) | ||
32 | + .addField("end", statics.getLongValue("end")).build(); | ||
33 | + batchPoints.point(point); | ||
34 | + if (influxDBName == null) { | ||
35 | + influxDBName = inluxDBSingle.getDBNames().get(0); | ||
36 | + } | ||
37 | + inluxDBSingle.getInfluxDBByName(influxDBName).getInfluxDB() | ||
38 | + .write(batchPoints); | ||
39 | + | ||
40 | + | ||
41 | + } | ||
42 | +} |
monitor-service-influxdb/src/main/java/com/monitor/influxdb/mapper/impl/ZookeeperMapper.java
0 → 100644
1 | +package com.monitor.influxdb.mapper.impl; | ||
2 | + | ||
3 | +import com.monitor.influxdb.InluxDBSingle; | ||
4 | +import com.monitor.influxdb.mapper.IZookeeperMapper; | ||
5 | +import com.monitor.influxdb.model.ZookeeperInfo; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Component; | ||
8 | + | ||
9 | +/** | ||
10 | + * Created by yoho on 2016/6/21. | ||
11 | + */ | ||
12 | +@Component | ||
13 | +public class ZookeeperMapper implements IZookeeperMapper{ | ||
14 | + | ||
15 | + @Autowired | ||
16 | + private InluxDBSingle inluxDBSingle; | ||
17 | + | ||
18 | + @Override | ||
19 | + public void insert(String influxDBName, ZookeeperInfo zkInfo) { | ||
20 | + | ||
21 | + } | ||
22 | +} |
@@ -147,17 +147,32 @@ public class JavaApiClient { | @@ -147,17 +147,32 @@ public class JavaApiClient { | ||
147 | // | 147 | // |
148 | // mObjInfoMap.add(1, mObj2); | 148 | // mObjInfoMap.add(1, mObj2); |
149 | 149 | ||
150 | + MObjectInfo mObj2 = new MObjectInfo(); | ||
151 | + mObj2.setMoId(0); | ||
152 | + mObj2.setMoHostIp("localhost"); | ||
153 | + mObj2.setMoTags("10080"); | ||
154 | + mObj2.setMoName("gay"); | ||
155 | + mObj2.setMoTypeId(0); | ||
156 | + | ||
157 | + mObjInfoMap.add(0, mObj2); | ||
158 | + | ||
150 | int uid = 8041886; | 159 | int uid = 8041886; |
151 | - for (int i = 0; i < 10; i++) { | 160 | + for (int i = 0; i < 1; i++) { |
152 | JavaApiInfo javaApiInfo = new JavaApiInfo(); | 161 | JavaApiInfo javaApiInfo = new JavaApiInfo(); |
153 | javaApiInfo.setApiName("order.get_" + i); | 162 | javaApiInfo.setApiName("order.get_" + i); |
154 | javaApiInfo.setApiReqMethod(0); | 163 | javaApiInfo.setApiReqMethod(0); |
155 | javaApiInfo.setApiToggle(0); | 164 | javaApiInfo.setApiToggle(0); |
156 | javaApiInfo.setApiUrl("/gateway/?debug=XYZ&method=app.Shopping.listCoupon&uid=" + (uid++)); | 165 | javaApiInfo.setApiUrl("/gateway/?debug=XYZ&method=app.Shopping.listCoupon&uid=" + (uid++)); |
157 | javaApiInfo.setServiceType(1); | 166 | javaApiInfo.setServiceType(1); |
158 | - javaApimap.put("order.get_" + i, javaApiInfo); | 167 | + javaApimap.put(javaApiInfo.getApiName(), javaApiInfo); |
159 | } | 168 | } |
160 | - | 169 | + JavaApiInfo javaApiInfo = new JavaApiInfo(); |
170 | + javaApiInfo.setApiName("frw.test"); | ||
171 | + javaApiInfo.setApiReqMethod(0); | ||
172 | + javaApiInfo.setApiToggle(0); | ||
173 | + javaApiInfo.setApiUrl("/gay/time/get?second=40"); | ||
174 | + javaApiInfo.setServiceType(0); | ||
175 | + javaApimap.put(javaApiInfo.getApiName(), javaApiInfo); | ||
161 | 176 | ||
162 | } | 177 | } |
163 | 178 |
1 | package com.monitor.javaserver.handle.impl; | 1 | package com.monitor.javaserver.handle.impl; |
2 | 2 | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.monitor.influxdb.mapper.impl.JavaApiStaticsMapper; | ||
3 | import com.monitor.javaserver.common.JavaApiStatics; | 5 | import com.monitor.javaserver.common.JavaApiStatics; |
4 | import com.monitor.javaserver.handle.IJavaApiHadnler; | 6 | import com.monitor.javaserver.handle.IJavaApiHadnler; |
5 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
6 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
8 | 11 | ||
9 | /** | 12 | /** |
10 | * Created by fruwei on 2016/6/20. | 13 | * Created by fruwei on 2016/6/20. |
11 | */ | 14 | */ |
12 | @Component("influxDBJavaApiHandler") | 15 | @Component("influxDBJavaApiHandler") |
13 | -public class InfluxDBJavaApiHandler implements IJavaApiHadnler{ | ||
14 | - Logger log= LoggerFactory.getLogger(InfluxDBJavaApiHandler.class); | 16 | +public class InfluxDBJavaApiHandler implements IJavaApiHadnler { |
17 | + Logger log = LoggerFactory.getLogger(InfluxDBJavaApiHandler.class); | ||
18 | + | ||
19 | + @Autowired | ||
20 | + private JavaApiStaticsMapper javaApiStaticsMapper; | ||
15 | 21 | ||
16 | @Override | 22 | @Override |
17 | public void handler(JavaApiStatics javaApiStatics) { | 23 | public void handler(JavaApiStatics javaApiStatics) { |
18 | - log.info("handle result: {}",javaApiStatics); | ||
19 | - //TODO handle | 24 | + log.info("handle result: {}", javaApiStatics); |
25 | + | ||
20 | 26 | ||
27 | + JSONObject jsonObject = new JSONObject(); | ||
28 | + jsonObject.put("javaApiInfo", javaApiStatics.getJavaApiInfo()); | ||
29 | + jsonObject.put("mobject", javaApiStatics.getMObjectInfo()); | ||
30 | + jsonObject.put("statrt", javaApiStatics.getStartTime()); | ||
31 | + jsonObject.put("end", javaApiStatics.getEndTime()); | ||
32 | + javaApiStaticsMapper.insertJavaApiStatics(null, jsonObject); | ||
21 | 33 | ||
22 | 34 | ||
23 | } | 35 | } |
@@ -3,6 +3,7 @@ package com.monitor.middleware.zookeeper; | @@ -3,6 +3,7 @@ package com.monitor.middleware.zookeeper; | ||
3 | /** | 3 | /** |
4 | * Created by yoho on 2016/6/21. | 4 | * Created by yoho on 2016/6/21. |
5 | */ | 5 | */ |
6 | +@Component | ||
6 | public class ZookeeperMonitorTask { | 7 | public class ZookeeperMonitorTask { |
7 | 8 | ||
8 | } | 9 | } |
1 | +package com.monitor.model.request; | ||
2 | + | ||
3 | +import com.monitor.model.page.PageRequest; | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +/** | ||
7 | + * Created by fruwei on 2016/6/20. | ||
8 | + */ | ||
9 | +@Data | ||
10 | +public class JavaApiInfoReq extends PageRequest { | ||
11 | + | ||
12 | + private Integer serviceId; | ||
13 | + | ||
14 | + private Integer serviceType; | ||
15 | + | ||
16 | + private String apiName; | ||
17 | + | ||
18 | + private String apiUrl; | ||
19 | + | ||
20 | + private String apiData; | ||
21 | + | ||
22 | + private Integer apiToggle; | ||
23 | + | ||
24 | + private Integer apiReqMethod; | ||
25 | + | ||
26 | + private Integer apiWarnTrigger; | ||
27 | + | ||
28 | +} |
@@ -17,6 +17,8 @@ public class JavaApiInfo { | @@ -17,6 +17,8 @@ public class JavaApiInfo { | ||
17 | 17 | ||
18 | private Integer apiReqMethod; | 18 | private Integer apiReqMethod; |
19 | 19 | ||
20 | + private Integer apiWarnTrigger; | ||
21 | + | ||
20 | public Integer getServiceId() { | 22 | public Integer getServiceId() { |
21 | return serviceId; | 23 | return serviceId; |
22 | } | 24 | } |
@@ -77,4 +79,12 @@ public class JavaApiInfo { | @@ -77,4 +79,12 @@ public class JavaApiInfo { | ||
77 | public String toString() { | 79 | public String toString() { |
78 | return ReflectionToStringBuilder.toString(this); | 80 | return ReflectionToStringBuilder.toString(this); |
79 | } | 81 | } |
82 | + | ||
83 | + public Integer getApiWarnTrigger() { | ||
84 | + return apiWarnTrigger; | ||
85 | + } | ||
86 | + | ||
87 | + public void setApiWarnTrigger(Integer apiWarnTrigger) { | ||
88 | + this.apiWarnTrigger = apiWarnTrigger; | ||
89 | + } | ||
80 | } | 90 | } |
@@ -2,6 +2,7 @@ package com.monitor.mysql.mapper; | @@ -2,6 +2,7 @@ package com.monitor.mysql.mapper; | ||
2 | 2 | ||
3 | 3 | ||
4 | import com.model.JavaApiInfo; | 4 | import com.model.JavaApiInfo; |
5 | +import com.monitor.model.domain.PageBean; | ||
5 | 6 | ||
6 | import java.util.List; | 7 | import java.util.List; |
7 | 8 | ||
@@ -19,4 +20,8 @@ public interface JavaApiInfoMapper { | @@ -19,4 +20,8 @@ public interface JavaApiInfoMapper { | ||
19 | int updateByPrimaryKey(JavaApiInfo record); | 20 | int updateByPrimaryKey(JavaApiInfo record); |
20 | 21 | ||
21 | List<JavaApiInfo> selectAllApi(); | 22 | List<JavaApiInfo> selectAllApi(); |
23 | + | ||
24 | + int selectCountByCodition(PageBean page); | ||
25 | + | ||
26 | + List<JavaApiInfo> selectJavaInfosByCodition(PageBean page); | ||
22 | } | 27 | } |
1 | <?xml version="1.0" encoding="UTF-8" ?> | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
3 | -<mapper namespace="com.monitor.mysql.mapper.JavaApiInfoMapper" > | ||
4 | - <resultMap id="BaseResultMap" type="com.model.JavaApiInfo" > | ||
5 | - <id column="service_id" property="serviceId" jdbcType="INTEGER" /> | ||
6 | - <result column="service_type" property="serviceType" jdbcType="INTEGER" /> | ||
7 | - <result column="api_name" property="apiName" jdbcType="VARCHAR" /> | ||
8 | - <result column="api_url" property="apiUrl" jdbcType="VARCHAR" /> | ||
9 | - <result column="api_data" property="apiData" jdbcType="VARCHAR" /> | ||
10 | - <result column="api_toggle" property="apiToggle" jdbcType="INTEGER" /> | ||
11 | - <result column="api_req_method" property="apiReqMethod" jdbcType="INTEGER" /> | ||
12 | - </resultMap> | ||
13 | - <sql id="Base_Column_List" > | 3 | +<mapper namespace="com.monitor.mysql.mapper.JavaApiInfoMapper"> |
4 | + <resultMap id="BaseResultMap" type="com.model.JavaApiInfo"> | ||
5 | + <id column="service_id" property="serviceId" jdbcType="INTEGER"/> | ||
6 | + <result column="service_type" property="serviceType" jdbcType="INTEGER"/> | ||
7 | + <result column="api_name" property="apiName" jdbcType="VARCHAR"/> | ||
8 | + <result column="api_url" property="apiUrl" jdbcType="VARCHAR"/> | ||
9 | + <result column="api_data" property="apiData" jdbcType="VARCHAR"/> | ||
10 | + <result column="api_toggle" property="apiToggle" jdbcType="INTEGER"/> | ||
11 | + <result column="api_req_method" property="apiReqMethod" jdbcType="INTEGER"/> | ||
12 | + </resultMap> | ||
13 | + <sql id="Base_Column_List"> | ||
14 | service_id, service_type, api_name, api_url, api_data, api_toggle, api_req_method | 14 | service_id, service_type, api_name, api_url, api_data, api_toggle, api_req_method |
15 | </sql> | 15 | </sql> |
16 | - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > | ||
17 | - select | ||
18 | - <include refid="Base_Column_List" /> | ||
19 | - from java_api_info | ||
20 | - where service_id = #{serviceId,jdbcType=INTEGER} | ||
21 | - </select> | ||
22 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | 16 | + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer"> |
17 | + select | ||
18 | + <include refid="Base_Column_List"/> | ||
19 | + from java_api_info | ||
20 | + where service_id = #{serviceId,jdbcType=INTEGER} | ||
21 | + </select> | ||
22 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||
23 | delete from java_api_info | 23 | delete from java_api_info |
24 | where service_id = #{serviceId,jdbcType=INTEGER} | 24 | where service_id = #{serviceId,jdbcType=INTEGER} |
25 | </delete> | 25 | </delete> |
26 | - <insert id="insert" parameterType="com.model.JavaApiInfo" > | 26 | + <insert id="insert" parameterType="com.model.JavaApiInfo"> |
27 | insert into java_api_info (service_id, service_type, api_name, | 27 | insert into java_api_info (service_id, service_type, api_name, |
28 | api_url, api_data, api_toggle, | 28 | api_url, api_data, api_toggle, |
29 | api_req_method) | 29 | api_req_method) |
@@ -31,80 +31,80 @@ | @@ -31,80 +31,80 @@ | ||
31 | #{apiUrl,jdbcType=VARCHAR}, #{apiData,jdbcType=VARCHAR}, #{apiToggle,jdbcType=INTEGER}, | 31 | #{apiUrl,jdbcType=VARCHAR}, #{apiData,jdbcType=VARCHAR}, #{apiToggle,jdbcType=INTEGER}, |
32 | #{apiReqMethod,jdbcType=INTEGER}) | 32 | #{apiReqMethod,jdbcType=INTEGER}) |
33 | </insert> | 33 | </insert> |
34 | - <insert id="insertSelective" parameterType="com.model.JavaApiInfo" > | ||
35 | - insert into java_api_info | ||
36 | - <trim prefix="(" suffix=")" suffixOverrides="," > | ||
37 | - <if test="serviceId != null" > | ||
38 | - service_id, | ||
39 | - </if> | ||
40 | - <if test="serviceType != null" > | ||
41 | - service_type, | ||
42 | - </if> | ||
43 | - <if test="apiName != null" > | ||
44 | - api_name, | ||
45 | - </if> | ||
46 | - <if test="apiUrl != null" > | ||
47 | - api_url, | ||
48 | - </if> | ||
49 | - <if test="apiData != null" > | ||
50 | - api_data, | ||
51 | - </if> | ||
52 | - <if test="apiToggle != null" > | ||
53 | - api_toggle, | ||
54 | - </if> | ||
55 | - <if test="apiReqMethod != null" > | ||
56 | - api_req_method, | ||
57 | - </if> | ||
58 | - </trim> | ||
59 | - <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
60 | - <if test="serviceId != null" > | ||
61 | - #{serviceId,jdbcType=INTEGER}, | ||
62 | - </if> | ||
63 | - <if test="serviceType != null" > | ||
64 | - #{serviceType,jdbcType=INTEGER}, | ||
65 | - </if> | ||
66 | - <if test="apiName != null" > | ||
67 | - #{apiName,jdbcType=VARCHAR}, | ||
68 | - </if> | ||
69 | - <if test="apiUrl != null" > | ||
70 | - #{apiUrl,jdbcType=VARCHAR}, | ||
71 | - </if> | ||
72 | - <if test="apiData != null" > | ||
73 | - #{apiData,jdbcType=VARCHAR}, | ||
74 | - </if> | ||
75 | - <if test="apiToggle != null" > | ||
76 | - #{apiToggle,jdbcType=INTEGER}, | ||
77 | - </if> | ||
78 | - <if test="apiReqMethod != null" > | ||
79 | - #{apiReqMethod,jdbcType=INTEGER}, | ||
80 | - </if> | ||
81 | - </trim> | ||
82 | - </insert> | ||
83 | - <update id="updateByPrimaryKeySelective" parameterType="com.model.JavaApiInfo" > | ||
84 | - update java_api_info | ||
85 | - <set > | ||
86 | - <if test="serviceType != null" > | ||
87 | - service_type = #{serviceType,jdbcType=INTEGER}, | ||
88 | - </if> | ||
89 | - <if test="apiName != null" > | ||
90 | - api_name = #{apiName,jdbcType=VARCHAR}, | ||
91 | - </if> | ||
92 | - <if test="apiUrl != null" > | ||
93 | - api_url = #{apiUrl,jdbcType=VARCHAR}, | ||
94 | - </if> | ||
95 | - <if test="apiData != null" > | ||
96 | - api_data = #{apiData,jdbcType=VARCHAR}, | ||
97 | - </if> | ||
98 | - <if test="apiToggle != null" > | ||
99 | - api_toggle = #{apiToggle,jdbcType=INTEGER}, | ||
100 | - </if> | ||
101 | - <if test="apiReqMethod != null" > | ||
102 | - api_req_method = #{apiReqMethod,jdbcType=INTEGER}, | ||
103 | - </if> | ||
104 | - </set> | ||
105 | - where service_id = #{serviceId,jdbcType=INTEGER} | ||
106 | - </update> | ||
107 | - <update id="updateByPrimaryKey" parameterType="com.model.JavaApiInfo" > | 34 | + <insert id="insertSelective" parameterType="com.model.JavaApiInfo"> |
35 | + insert into java_api_info | ||
36 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
37 | + <if test="serviceId != null"> | ||
38 | + service_id, | ||
39 | + </if> | ||
40 | + <if test="serviceType != null"> | ||
41 | + service_type, | ||
42 | + </if> | ||
43 | + <if test="apiName != null"> | ||
44 | + api_name, | ||
45 | + </if> | ||
46 | + <if test="apiUrl != null"> | ||
47 | + api_url, | ||
48 | + </if> | ||
49 | + <if test="apiData != null"> | ||
50 | + api_data, | ||
51 | + </if> | ||
52 | + <if test="apiToggle != null"> | ||
53 | + api_toggle, | ||
54 | + </if> | ||
55 | + <if test="apiReqMethod != null"> | ||
56 | + api_req_method, | ||
57 | + </if> | ||
58 | + </trim> | ||
59 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
60 | + <if test="serviceId != null"> | ||
61 | + #{serviceId,jdbcType=INTEGER}, | ||
62 | + </if> | ||
63 | + <if test="serviceType != null"> | ||
64 | + #{serviceType,jdbcType=INTEGER}, | ||
65 | + </if> | ||
66 | + <if test="apiName != null"> | ||
67 | + #{apiName,jdbcType=VARCHAR}, | ||
68 | + </if> | ||
69 | + <if test="apiUrl != null"> | ||
70 | + #{apiUrl,jdbcType=VARCHAR}, | ||
71 | + </if> | ||
72 | + <if test="apiData != null"> | ||
73 | + #{apiData,jdbcType=VARCHAR}, | ||
74 | + </if> | ||
75 | + <if test="apiToggle != null"> | ||
76 | + #{apiToggle,jdbcType=INTEGER}, | ||
77 | + </if> | ||
78 | + <if test="apiReqMethod != null"> | ||
79 | + #{apiReqMethod,jdbcType=INTEGER}, | ||
80 | + </if> | ||
81 | + </trim> | ||
82 | + </insert> | ||
83 | + <update id="updateByPrimaryKeySelective" parameterType="com.model.JavaApiInfo"> | ||
84 | + update java_api_info | ||
85 | + <set> | ||
86 | + <if test="serviceType != null"> | ||
87 | + service_type = #{serviceType,jdbcType=INTEGER}, | ||
88 | + </if> | ||
89 | + <if test="apiName != null"> | ||
90 | + api_name = #{apiName,jdbcType=VARCHAR}, | ||
91 | + </if> | ||
92 | + <if test="apiUrl != null"> | ||
93 | + api_url = #{apiUrl,jdbcType=VARCHAR}, | ||
94 | + </if> | ||
95 | + <if test="apiData != null"> | ||
96 | + api_data = #{apiData,jdbcType=VARCHAR}, | ||
97 | + </if> | ||
98 | + <if test="apiToggle != null"> | ||
99 | + api_toggle = #{apiToggle,jdbcType=INTEGER}, | ||
100 | + </if> | ||
101 | + <if test="apiReqMethod != null"> | ||
102 | + api_req_method = #{apiReqMethod,jdbcType=INTEGER}, | ||
103 | + </if> | ||
104 | + </set> | ||
105 | + where service_id = #{serviceId,jdbcType=INTEGER} | ||
106 | + </update> | ||
107 | + <update id="updateByPrimaryKey" parameterType="com.model.JavaApiInfo"> | ||
108 | update java_api_info | 108 | update java_api_info |
109 | set service_type = #{serviceType,jdbcType=INTEGER}, | 109 | set service_type = #{serviceType,jdbcType=INTEGER}, |
110 | api_name = #{apiName,jdbcType=VARCHAR}, | 110 | api_name = #{apiName,jdbcType=VARCHAR}, |
@@ -115,11 +115,64 @@ | @@ -115,11 +115,64 @@ | ||
115 | where service_id = #{serviceId,jdbcType=INTEGER} | 115 | where service_id = #{serviceId,jdbcType=INTEGER} |
116 | </update> | 116 | </update> |
117 | 117 | ||
118 | - <select id="selectAllApi" resultMap="BaseResultMap" > | ||
119 | - select | ||
120 | - <include refid="Base_Column_List" /> | ||
121 | - from java_api_info | ||
122 | - </select> | 118 | + <select id="selectAllApi" resultMap="BaseResultMap"> |
119 | + select | ||
120 | + <include refid="Base_Column_List"/> | ||
121 | + from java_api_info | ||
122 | + </select> | ||
123 | + | ||
124 | + | ||
125 | + <select id="selectCountByCodition" resultType="java.lang.Integer"> | ||
126 | + select | ||
127 | + count(1) | ||
128 | + from java_api_info | ||
129 | + where | ||
130 | + 1=1 | ||
131 | + <if test="params.serviceType != null"> | ||
132 | + and service_type = #{params.serviceType,jdbcType=INTEGER} | ||
133 | + </if> | ||
134 | + <if test="params.apiName != null"> | ||
135 | + and api_name = #{params.apiName,jdbcType=VARCHAR} | ||
136 | + </if> | ||
137 | + <if test="params.apiUrl != null"> | ||
138 | + and api_url = #{params.apiUrl,jdbcType=VARCHAR} | ||
139 | + </if> | ||
140 | + <if test="params.apiData != null"> | ||
141 | + and api_data = #{params.apiData,jdbcType=VARCHAR} | ||
142 | + </if> | ||
143 | + <if test="params.apiToggle != null"> | ||
144 | + and api_toggle = #{params.apiToggle,jdbcType=INTEGER} | ||
145 | + </if> | ||
146 | + <if test="params.apiReqMethod != null"> | ||
147 | + and api_req_method = #{params.apiReqMethod,jdbcType=INTEGER} | ||
148 | + </if> | ||
149 | + </select> | ||
123 | 150 | ||
151 | + <select id="selectJavaInfosByCodition" resultMap="BaseResultMap"> | ||
152 | + select | ||
153 | + <include refid="Base_Column_List"/> | ||
154 | + from java_api_info | ||
155 | + where | ||
156 | + 1=1 | ||
157 | + <if test="params.serviceType != null"> | ||
158 | + and service_type = #{params.serviceType,jdbcType=INTEGER} | ||
159 | + </if> | ||
160 | + <if test="params.apiName != null"> | ||
161 | + and api_name = #{params.apiName,jdbcType=VARCHAR} | ||
162 | + </if> | ||
163 | + <if test="params.apiUrl != null"> | ||
164 | + and api_url = #{params.apiUrl,jdbcType=VARCHAR} | ||
165 | + </if> | ||
166 | + <if test="params.apiData != null"> | ||
167 | + and api_data = #{params.apiData,jdbcType=VARCHAR} | ||
168 | + </if> | ||
169 | + <if test="params.apiToggle != null"> | ||
170 | + and api_toggle = #{params.apiToggle,jdbcType=INTEGER} | ||
171 | + </if> | ||
172 | + <if test="params.apiReqMethod != null"> | ||
173 | + and api_req_method = #{params.apiReqMethod,jdbcType=INTEGER} | ||
174 | + </if> | ||
175 | + limit #{startIndex},#{pageSize} | ||
176 | + </select> | ||
124 | 177 | ||
125 | </mapper> | 178 | </mapper> |
@@ -12,8 +12,12 @@ | @@ -12,8 +12,12 @@ | ||
12 | <id property="typeParentId" column="parent_id"></id> | 12 | <id property="typeParentId" column="parent_id"></id> |
13 | </resultMap> | 13 | </resultMap> |
14 | 14 | ||
15 | + <sql id="Base_Column_List"> id, alias, isLeaf, parent_id </sql> | ||
16 | + | ||
15 | <select id="getAllTypesInfo" resultType="com.model.TypeInfo" resultMap="typeInfoMap" useCache="true"> | 17 | <select id="getAllTypesInfo" resultType="com.model.TypeInfo" resultMap="typeInfoMap" useCache="true"> |
16 | - SELECT * FROM type_info ORDER BY id asc | 18 | + SELECT |
19 | + <include refid="Base_Column_List"/> | ||
20 | + FROM type_info ORDER BY id asc | ||
17 | </select> | 21 | </select> |
18 | 22 | ||
19 | <!-- <select id="getChildTypesInfo" parameterType="int" resultType="com.model.TypeInfo" resultMap="typeInfoMap"> | 23 | <!-- <select id="getChildTypesInfo" parameterType="int" resultType="com.model.TypeInfo" resultMap="typeInfoMap"> |
@@ -37,4 +41,11 @@ | @@ -37,4 +41,11 @@ | ||
37 | WHERE id=#{typeId} | 41 | WHERE id=#{typeId} |
38 | </update> | 42 | </update> |
39 | 43 | ||
44 | + | ||
45 | + <select id="selectTypeInfoByName" resultMap="typeInfoMap" resultType="com.model.TypeInfo"> | ||
46 | + SELECT | ||
47 | + <include refid="Base_Column_List"/> | ||
48 | + FROM type_info where alias =#{typeName} limit 1 | ||
49 | + </select> | ||
50 | + | ||
40 | </mapper> | 51 | </mapper> |
@@ -23,6 +23,11 @@ | @@ -23,6 +23,11 @@ | ||
23 | <!-- 支持异步方法执行 --> | 23 | <!-- 支持异步方法执行 --> |
24 | <task:annotation-driven /> | 24 | <task:annotation-driven /> |
25 | 25 | ||
26 | + <!-- Enables the Spring Task @Scheduled programming model --> | ||
27 | + <task:executor id="executor" pool-size="50"/> | ||
28 | + <task:scheduler id="scheduler" pool-size="50"/> | ||
29 | + <task:annotation-driven executor="executor" scheduler="scheduler"/> | ||
30 | + | ||
26 | <mvc:annotation-driven> | 31 | <mvc:annotation-driven> |
27 | <mvc:message-converters> | 32 | <mvc:message-converters> |
28 | <ref bean="stringConverter" /> | 33 | <ref bean="stringConverter" /> |
1 | # ******************** influxdb common configs ******************** | 1 | # ******************** influxdb common configs ******************** |
2 | influxdb.num=2 | 2 | influxdb.num=2 |
3 | influxdb.name=aws;qcloud | 3 | influxdb.name=aws;qcloud |
4 | -influxdb.ip=http://127.0.0.1:8086;http://10.66.4.25:8086 | 4 | +influxdb.ip=http://123.206.79.151:8086;http://10.66.4.25:8086 |
5 | influxdb.user=root;root | 5 | influxdb.user=root;root |
6 | influxdb.pwd=root;root | 6 | influxdb.pwd=root;root |
7 | influxdb.connect.timeout=15;15 | 7 | influxdb.connect.timeout=15;15 |
-
Please register or login to post a comment