...
|
...
|
@@ -3,16 +3,15 @@ package org.thingsboard.server.controller.yunteng; |
3
|
3
|
import io.swagger.annotations.Api;
|
4
|
4
|
import io.swagger.annotations.ApiOperation;
|
5
|
5
|
import lombok.RequiredArgsConstructor;
|
|
6
|
+import org.apache.commons.lang3.StringUtils;
|
6
|
7
|
import org.springframework.http.ResponseEntity;
|
7
|
8
|
import org.springframework.security.access.prepost.PreAuthorize;
|
8
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
9
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
10
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
11
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
9
|
+import org.springframework.web.bind.annotation.*;
|
12
|
10
|
import org.thingsboard.server.common.data.EntityType;
|
13
|
11
|
import org.thingsboard.server.common.data.alarm.AlarmSeverity;
|
14
|
12
|
import org.thingsboard.server.common.data.alarm.AlarmStatus;
|
15
|
13
|
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
|
14
|
+import org.thingsboard.server.common.data.yunteng.dto.ConfigurationAlarmPageDTO;
|
16
|
15
|
import org.thingsboard.server.common.data.yunteng.dto.SysDictDTO;
|
17
|
16
|
import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum;
|
18
|
17
|
import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum;
|
...
|
...
|
@@ -46,11 +45,11 @@ public class TkAlarmInfoController extends BaseController { |
46
|
45
|
public TkPageData<TkAlarmEntity> pageAlarmInfo(
|
47
|
46
|
@RequestParam(PAGE_SIZE) int pageSize,
|
48
|
47
|
@RequestParam(PAGE) int page,
|
49
|
|
- @RequestParam(value = "status", required = false) List<AlarmStatus> status,
|
|
48
|
+ @RequestParam(value = "status", required = false) AlarmStatus status,
|
50
|
49
|
@RequestParam(value = "alarmType", required = false) String alarmType,
|
51
|
50
|
@RequestParam(value = "severity", required = false) AlarmSeverity severity,
|
52
|
51
|
@RequestParam(value = "organizationId", required = false) String organizationId,
|
53
|
|
- @RequestParam(value = "deviceIds", required = false) List<String> deviceIds,
|
|
52
|
+ @RequestParam(value = "deviceId", required = false) String deviceId,
|
54
|
53
|
@RequestParam(value = "deviceName", required = false) String deviceName,
|
55
|
54
|
@RequestParam(value = "deviceType", required = false) DeviceTypeEnum deviceType,
|
56
|
55
|
@RequestParam(value = "startTime", required = false) Long startTime,
|
...
|
...
|
@@ -63,7 +62,15 @@ public class TkAlarmInfoController extends BaseController { |
63
|
62
|
pageFilter.put(PAGE, page);
|
64
|
63
|
pageFilter.put(ORDER_FILED, orderBy);
|
65
|
64
|
pageFilter.put(ORDER_TYPE, orderType);
|
66
|
|
-
|
|
65
|
+ List<String> deviceIds = null;
|
|
66
|
+ List<AlarmStatus> statuses = null;
|
|
67
|
+ if(!StringUtils.isEmpty(deviceId))
|
|
68
|
+ {
|
|
69
|
+ deviceIds = List.of(deviceId);
|
|
70
|
+ }
|
|
71
|
+ if(null !=status){
|
|
72
|
+ statuses = List.of(status);
|
|
73
|
+ }
|
67
|
74
|
UUID customerId = null;
|
68
|
75
|
if (getCurrentUser().isCustomerUser()) {
|
69
|
76
|
customerId = getCurrentUser().getCustomerId().getId();
|
...
|
...
|
@@ -76,13 +83,53 @@ public class TkAlarmInfoController extends BaseController { |
76
|
83
|
alarmType,
|
77
|
84
|
startTime,
|
78
|
85
|
endTime,
|
79
|
|
- status,
|
|
86
|
+ statuses,
|
80
|
87
|
deviceIds,
|
81
|
88
|
deviceName,
|
82
|
89
|
deviceType,
|
83
|
90
|
EntityType.DEVICE,
|
84
|
91
|
organizationId);
|
85
|
92
|
}
|
|
93
|
+ @ApiOperation(value = "组态告警查询")
|
|
94
|
+ @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})")
|
|
95
|
+ @PostMapping("/configuration/page")
|
|
96
|
+ public TkPageData<TkAlarmEntity> pageAlarmInfoForConfiguration(@RequestBody ConfigurationAlarmPageDTO page) throws ThingsboardException {
|
|
97
|
+ Map<String, Object> pageFilter = new HashMap<>();
|
|
98
|
+ pageFilter.put(PAGE_SIZE, page.getPageSize());
|
|
99
|
+ pageFilter.put(PAGE, page.getPage());
|
|
100
|
+ pageFilter.put(ORDER_FILED, page.getOrderBy());
|
|
101
|
+ pageFilter.put(ORDER_TYPE, page.getOrderType());
|
|
102
|
+ UUID customerId = null;
|
|
103
|
+ if (getCurrentUser().isCustomerUser()) {
|
|
104
|
+ customerId = getCurrentUser().getCustomerId().getId();
|
|
105
|
+ }
|
|
106
|
+ AlarmSeverity severity = page.getSeverity();
|
|
107
|
+ AlarmStatus status = page.getStatus();
|
|
108
|
+ List<AlarmStatus> statuses = null;
|
|
109
|
+ if(null !=status){
|
|
110
|
+ statuses = List.of(status);
|
|
111
|
+ }
|
|
112
|
+ String alarmType = page.getAlarmType();
|
|
113
|
+ Long startTime = page.getStartTime();
|
|
114
|
+ Long endTime = page.getEndTime();
|
|
115
|
+ String deviceName = page.getDeviceName();
|
|
116
|
+ String organizationId = page.getOrganizationId();
|
|
117
|
+ DeviceTypeEnum deviceType = page.getDeviceType();
|
|
118
|
+ return alarmInfoService.alarmPage(
|
|
119
|
+ pageFilter,
|
|
120
|
+ getCurrentUser().getTenantId(),
|
|
121
|
+ customerId,
|
|
122
|
+ severity,
|
|
123
|
+ alarmType,
|
|
124
|
+ startTime,
|
|
125
|
+ endTime,
|
|
126
|
+ statuses,
|
|
127
|
+ page.getDeviceIds(),
|
|
128
|
+ deviceName,
|
|
129
|
+ deviceType,
|
|
130
|
+ EntityType.DEVICE,
|
|
131
|
+ organizationId);
|
|
132
|
+ }
|
86
|
133
|
|
87
|
134
|
@ApiOperation(value = "告警类型")
|
88
|
135
|
@GetMapping()
|
...
|
...
|
|