Showing
1 changed file
with
7 additions
and
0 deletions
... | ... | @@ -18,6 +18,7 @@ package org.thingsboard.server.controller; |
18 | 18 | import io.swagger.annotations.Api; |
19 | 19 | import io.swagger.annotations.ApiOperation; |
20 | 20 | import io.swagger.annotations.ApiParam; |
21 | +import lombok.AllArgsConstructor; | |
21 | 22 | import org.apache.commons.lang3.StringUtils; |
22 | 23 | import org.springframework.http.HttpStatus; |
23 | 24 | import org.springframework.http.MediaType; |
... | ... | @@ -47,6 +48,7 @@ import org.thingsboard.server.common.data.id.EntityId; |
47 | 48 | import org.thingsboard.server.common.data.id.EntityIdFactory; |
48 | 49 | import org.thingsboard.server.common.data.page.PageData; |
49 | 50 | import org.thingsboard.server.common.data.page.TimePageLink; |
51 | +import org.thingsboard.server.dao.yunteng.service.YtDeviceService; | |
50 | 52 | import org.thingsboard.server.queue.util.TbCoreComponent; |
51 | 53 | import org.thingsboard.server.service.security.permission.Operation; |
52 | 54 | import org.thingsboard.server.service.security.permission.Resource; |
... | ... | @@ -73,6 +75,7 @@ import static org.thingsboard.server.controller.ControllerConstants.UUID_WIKI_LI |
73 | 75 | @TbCoreComponent |
74 | 76 | @RequestMapping("/api") |
75 | 77 | @Api(tags = {"告警"}) |
78 | +@AllArgsConstructor | |
76 | 79 | public class AlarmController extends BaseController { |
77 | 80 | |
78 | 81 | public static final String ALARM_ID = "alarmId"; |
... | ... | @@ -88,6 +91,8 @@ public class AlarmController extends BaseController { |
88 | 91 | private static final String ALARM_QUERY_FETCH_ORIGINATOR_DESCRIPTION = "A boolean value to specify if the alarm originator name will be " + |
89 | 92 | "filled in the AlarmInfo object field: 'originatorName' or will returns as null."; |
90 | 93 | |
94 | + private final YtDeviceService ytDeviceService; | |
95 | + | |
91 | 96 | @ApiOperation(value = "Get Alarm (getAlarmById)", |
92 | 97 | notes = "Fetch the Alarm object based on the provided Alarm Id. " + ALARM_SECURITY_CHECK, produces = MediaType.APPLICATION_JSON_VALUE) |
93 | 98 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
... | ... | @@ -218,6 +223,8 @@ public class AlarmController extends BaseController { |
218 | 223 | Alarm alarm = checkAlarmId(alarmId, Operation.WRITE); |
219 | 224 | long clearTs = System.currentTimeMillis(); |
220 | 225 | alarmService.clearAlarm(getCurrentUser().getTenantId(), alarmId, null, clearTs).get(); |
226 | + //Thingskit function | |
227 | + ytDeviceService.freshAlarmStatus(alarm.getOriginator(), 0); | |
221 | 228 | alarm.setClearTs(clearTs); |
222 | 229 | alarm.setStatus(alarm.getStatus().isAck() ? AlarmStatus.CLEARED_ACK : AlarmStatus.CLEARED_UNACK); |
223 | 230 | logEntityAction(alarm.getOriginator(), alarm, getCurrentUser().getCustomerId(), ActionType.ALARM_CLEAR, null); | ... | ... |