优化设备在线状态

This commit is contained in:
648540858
2022-05-11 18:37:24 +08:00
parent c395cf42d1
commit f6893cf95b
52 changed files with 571 additions and 802 deletions

View File

@@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.service.IDeviceAlarmService;
import com.genersoft.iot.vmp.service.IGbStreamService;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
@@ -23,9 +24,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@Api(tags = "报警信息管理")
@@ -46,9 +45,6 @@ public class AlarmController {
@Autowired
private IVideoManagerStorage storage;
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private SimpleDateFormat formatForGB = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
/**
* 分页查询报警
*
@@ -104,10 +100,10 @@ public class AlarmController {
try {
if (startTime != null) {
format.parse(startTime);
DateUtil.format.parse(startTime);
}
if (endTime != null) {
format.parse(endTime);
DateUtil.format.parse(endTime);
}
} catch (ParseException e) {
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
@@ -150,7 +146,7 @@ public class AlarmController {
}
try {
if (time != null) {
format.parse(time);
DateUtil.format.parse(time);
}
} catch (ParseException e) {
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
@@ -193,7 +189,7 @@ public class AlarmController {
deviceAlarm.setAlarmDescription("test");
deviceAlarm.setAlarmMethod("1");
deviceAlarm.setAlarmPriority("1");
deviceAlarm.setAlarmTime(formatForGB.format(System.currentTimeMillis()));
deviceAlarm.setAlarmTime(DateUtil.formatISO8601.format(System.currentTimeMillis()));
deviceAlarm.setAlarmType("1");
deviceAlarm.setLongitude(115.33333);
deviceAlarm.setLatitude(39.33333);

View File

@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.vmanager.log;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.service.ILogService;
import com.genersoft.iot.vmp.storager.dao.dto.LogDto;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
@@ -18,7 +19,6 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@Api(tags = "日志管理")
@CrossOrigin
@@ -34,8 +34,6 @@ public class LogController {
@Autowired
private UserSetting userSetting;
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/**
* 分页查询日志
*
@@ -80,10 +78,10 @@ public class LogController {
try {
if (startTime != null) {
format.parse(startTime);
DateUtil.format.parse(startTime);
}
if (endTime != null) {
format.parse(endTime);
DateUtil.format.parse(endTime);
}
} catch (ParseException e) {
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);

View File

@@ -2,9 +2,8 @@ package com.genersoft.iot.vmp.vmanager.user;
import com.genersoft.iot.vmp.conf.security.SecurityUtils;
import com.genersoft.iot.vmp.service.IRoleService;
import com.genersoft.iot.vmp.service.IUserService;
import com.genersoft.iot.vmp.storager.dao.dto.Role;
import com.genersoft.iot.vmp.storager.dao.dto.User;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -13,12 +12,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.List;
@Api(tags = "角色管理")
@@ -30,8 +25,6 @@ public class RoleController {
@Autowired
private IRoleService roleService;
private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ApiOperation("添加角色")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", required = true, value = "角色名", dataTypeClass = String.class),
@@ -53,8 +46,8 @@ public class RoleController {
Role role = new Role();
role.setName(name);
role.setAuthority(authority);
role.setCreateTime(format.format(System.currentTimeMillis()));
role.setUpdateTime(format.format(System.currentTimeMillis()));
role.setCreateTime(DateUtil.getNow());
role.setUpdateTime(DateUtil.getNow());
int addResult = roleService.add(role);

View File

@@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.service.IRoleService;
import com.genersoft.iot.vmp.service.IUserService;
import com.genersoft.iot.vmp.storager.dao.dto.Role;
import com.genersoft.iot.vmp.storager.dao.dto.User;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -20,7 +21,6 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.security.sasl.AuthenticationException;
import java.text.SimpleDateFormat;
import java.util.List;
@Api(tags = "用户管理")
@@ -38,8 +38,6 @@ public class UserController {
@Autowired
private IRoleService roleService;
private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ApiOperation("登录")
@ApiImplicitParams({
@ApiImplicitParam(name = "username", required = true, value = "用户名", dataTypeClass = String.class),
@@ -135,8 +133,8 @@ public class UserController {
return new ResponseEntity<>(result, HttpStatus.OK);
}
user.setRole(role);
user.setCreateTime(format.format(System.currentTimeMillis()));
user.setUpdateTime(format.format(System.currentTimeMillis()));
user.setCreateTime(DateUtil.getNow());
user.setUpdateTime(DateUtil.getNow());
int addResult = userService.addUser(user);
result.setCode(addResult > 0 ? 0 : -1);