使用阿里代码规范。规范代码写法

This commit is contained in:
648540858
2022-05-05 17:07:16 +08:00
parent 7f0ca85850
commit c286ecb455
51 changed files with 560 additions and 316 deletions

View File

@@ -85,16 +85,30 @@ public class AlarmController {
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime
) {
if (StringUtils.isEmpty(alarmPriority)) alarmPriority = null;
if (StringUtils.isEmpty(alarmMethod)) alarmMethod = null;
if (StringUtils.isEmpty(alarmType)) alarmType = null;
if (StringUtils.isEmpty(startTime)) startTime = null;
if (StringUtils.isEmpty(endTime)) endTime = null;
if (StringUtils.isEmpty(alarmPriority)) {
alarmPriority = null;
}
if (StringUtils.isEmpty(alarmMethod)) {
alarmMethod = null;
}
if (StringUtils.isEmpty(alarmType)) {
alarmType = null;
}
if (StringUtils.isEmpty(startTime)) {
startTime = null;
}
if (StringUtils.isEmpty(endTime)) {
endTime = null;
}
try {
if (startTime != null) format.parse(startTime);
if (endTime != null) format.parse(endTime);
if (startTime != null) {
format.parse(startTime);
}
if (endTime != null) {
format.parse(endTime);
}
} catch (ParseException e) {
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
}
@@ -125,9 +139,15 @@ public class AlarmController {
@RequestParam(required = false) String deviceIds,
@RequestParam(required = false) String time
) {
if (StringUtils.isEmpty(id)) id = null;
if (StringUtils.isEmpty(deviceIds)) deviceIds = null;
if (StringUtils.isEmpty(time)) time = null;
if (StringUtils.isEmpty(id)) {
id = null;
}
if (StringUtils.isEmpty(deviceIds)) {
deviceIds = null;
}
if (StringUtils.isEmpty(time)) {
time = null;
}
try {
if (time != null) {
format.parse(time);

View File

@@ -306,9 +306,15 @@ public class DeviceQuery {
if (device != null && device.getDeviceId() != null) {
Device deviceInStore = storager.queryVideoDevice(device.getDeviceId());
if (!StringUtils.isEmpty(device.getName())) deviceInStore.setName(device.getName());
if (!StringUtils.isEmpty(device.getCharset())) deviceInStore.setCharset(device.getCharset());
if (!StringUtils.isEmpty(device.getMediaServerId())) deviceInStore.setMediaServerId(device.getMediaServerId());
if (!StringUtils.isEmpty(device.getName())) {
deviceInStore.setName(device.getName());
}
if (!StringUtils.isEmpty(device.getCharset())) {
deviceInStore.setCharset(device.getCharset());
}
if (!StringUtils.isEmpty(device.getMediaServerId())) {
deviceInStore.setMediaServerId(device.getMediaServerId());
}
// 目录订阅相关的信息
if (device.getSubscribeCycleForCatalog() > 0) {

View File

@@ -286,7 +286,9 @@ public class PlatformController {
return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST);
}
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK);
if (parentPlatform == null) {
return new ResponseEntity<>("fail", HttpStatus.OK);
}
// 发送离线消息,无论是否成功都删除缓存
commanderForPlatform.unregister(parentPlatform, (event -> {
// 清空redis缓存