使用阿里代码规范。规范代码写法
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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缓存
|
||||
|
||||
@@ -65,16 +65,26 @@ public class LogController {
|
||||
@RequestParam(required = false) String startTime,
|
||||
@RequestParam(required = false) String endTime
|
||||
) {
|
||||
if (StringUtils.isEmpty(query)) query = null;
|
||||
if (StringUtils.isEmpty(startTime)) startTime = null;
|
||||
if (StringUtils.isEmpty(endTime)) endTime = null;
|
||||
if (StringUtils.isEmpty(query)) {
|
||||
query = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(startTime)) {
|
||||
startTime = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(endTime)) {
|
||||
endTime = null;
|
||||
}
|
||||
if (!userSetting.getLogInDatebase()) {
|
||||
logger.warn("自动记录日志功能已关闭,查询结果可能不完整。");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -69,9 +69,15 @@ public class StreamProxyController {
|
||||
@ResponseBody
|
||||
public WVPResult save(@RequestBody StreamProxyItem param){
|
||||
logger.info("添加代理: " + JSONObject.toJSONString(param));
|
||||
if (StringUtils.isEmpty(param.getMediaServerId())) param.setMediaServerId("auto");
|
||||
if (StringUtils.isEmpty(param.getType())) param.setType("default");
|
||||
if (StringUtils.isEmpty(param.getGbId())) param.setGbId(null);
|
||||
if (StringUtils.isEmpty(param.getMediaServerId())) {
|
||||
param.setMediaServerId("auto");
|
||||
}
|
||||
if (StringUtils.isEmpty(param.getType())) {
|
||||
param.setType("default");
|
||||
}
|
||||
if (StringUtils.isEmpty(param.getGbId())) {
|
||||
param.setGbId(null);
|
||||
}
|
||||
WVPResult<StreamInfo> result = streamProxyService.save(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user