优化设备在线状态
This commit is contained in:
@@ -2,12 +2,12 @@ package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
||||
import com.genersoft.iot.vmp.service.IDeviceAlarmService;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ class DeviceAlarmServiceImplTest {
|
||||
@Resource
|
||||
private IDeviceAlarmService deviceAlarmService;
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void getAllAlarm() {
|
||||
// deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111",null,null,null, null, null);
|
||||
@@ -67,7 +65,7 @@ class DeviceAlarmServiceImplTest {
|
||||
*/
|
||||
deviceAlarm.setAlarmMethod((int)(Math.random()*7 + 1) + "");
|
||||
Date date = randomDate("2021-01-01 00:00:00", "2021-06-01 00:00:00");
|
||||
deviceAlarm.setAlarmTime(format.format(date));
|
||||
deviceAlarm.setAlarmTime(DateUtil.format.format(date));
|
||||
/**
|
||||
* 报警级别, 1为一级警情, 2为二级警情, 3为三级警情, 4为四级 警情-
|
||||
*/
|
||||
@@ -90,8 +88,8 @@ class DeviceAlarmServiceImplTest {
|
||||
private Date randomDate(String beginDate, String endDate) {
|
||||
try {
|
||||
|
||||
Date start = format.parse(beginDate);//构造开始日期
|
||||
Date end = format.parse(endDate);//构造结束日期
|
||||
Date start = DateUtil.format.parse(beginDate);//构造开始日期
|
||||
Date end = DateUtil.format.parse(endDate);//构造结束日期
|
||||
//getTime()表示返回自 1970 年 1 月 1 日 00:00:00 GMT 以来此 Date 对象表示的毫秒数。
|
||||
if (start.getTime() >= end.getTime()) {
|
||||
return null;
|
||||
|
||||
@@ -4,12 +4,12 @@ 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 org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ class RoleServiceImplTest {
|
||||
@Resource
|
||||
private IRoleService roleService;
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@org.junit.jupiter.api.Test
|
||||
void getAllUser() {
|
||||
List<Role> all = roleService.getAll();
|
||||
@@ -35,8 +34,8 @@ class RoleServiceImplTest {
|
||||
Role role = new Role();
|
||||
role.setName("test+" + i);
|
||||
role.setAuthority("adadadda");
|
||||
role.setCreateTime(format.format(System.currentTimeMillis()));
|
||||
role.setUpdateTime(format.format(System.currentTimeMillis()));
|
||||
role.setCreateTime(DateUtil.getNow());
|
||||
role.setUpdateTime(DateUtil.getNow());
|
||||
roleService.add(role);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
||||
import com.genersoft.iot.vmp.service.IDeviceAlarmService;
|
||||
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 org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -22,7 +19,6 @@ class UserServiceImplTest {
|
||||
@Resource
|
||||
private IUserService userService;
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void getAllUser() {
|
||||
@@ -42,8 +38,8 @@ class UserServiceImplTest {
|
||||
Role role = new Role();
|
||||
role.setId(1);
|
||||
user.setRole(role);
|
||||
user.setCreateTime(format.format(System.currentTimeMillis()));
|
||||
user.setUpdateTime(format.format(System.currentTimeMillis()));
|
||||
user.setCreateTime(DateUtil.getNow());
|
||||
user.setUpdateTime(DateUtil.getNow());
|
||||
userService.addUser(user);
|
||||
}
|
||||
}
|
||||
@@ -62,7 +58,7 @@ class UserServiceImplTest {
|
||||
Role role = new Role();
|
||||
role.setId(2);
|
||||
user.setRole(role);
|
||||
user.setUpdateTime(format.format(System.currentTimeMillis()));
|
||||
user.setUpdateTime(DateUtil.getNow());
|
||||
userService.updateUsers(user);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user