MonitorController.java
1.88 KB
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
package vion.controller.mqtt;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.dto.monitor.OrgDTO;
import vion.model.monitor.Agent;
import vion.model.monitor.AgentRecord;
import vion.model.monitor.ServiceRecord;
import vion.model.monitor.Upgrade;
import vion.service.monitor.IAgentService;
import java.util.List;
/**
* @author vion
* @date 2024/10/16
*/
@RestController
@RequestMapping("/api/monitor")
@RequiredArgsConstructor
public class MonitorController {
private final IAgentService agentService;
/**
* Agent 注册
*
* @param agent agent自身信息
* @return java.lang.String
*/
@PostMapping("/reg")
public String reg(@RequestBody Agent agent) {
return agentService.reg(agent);
}
/**
* Agent 获取升级包信息
*
* @param type 1:store 2:mall
* @return Upgrade 升级包信息
*/
@GetMapping("/upgrade")
public Upgrade getUpgradeInfo(Short type) {
return agentService.getUpgradeInfo(type);
}
/**
* Agent 发送服务器信息
*
* @param agentRecord 服务器相关信息
* @return java.lang.String
*/
@PostMapping("/server")
public String recServerInfo(@RequestBody AgentRecord agentRecord) {
return agentService.recAgentRecord(agentRecord);
}
/**
* Agent 发送服务状态
*
* @param recList 服务状态
* @return java.lang.String
*/
@PostMapping("/service")
public String recServiceInfo(@RequestBody List<ServiceRecord> recList) {
return agentService.recServiceInfo(recList);
}
/**
* Agent 发送组织关系
*
* @param orgDTO account、mall
* @return java.lang.String
*/
@PostMapping("/org")
public String recOrgInfo(@RequestBody OrgDTO orgDTO) {
return agentService.recOrgInfo(orgDTO);
}
}