Merge remote-tracking branch 'origin/wvp-28181-2.0' into commercial

This commit is contained in:
648540858
2022-05-12 10:54:46 +08:00
55 changed files with 651 additions and 898 deletions

View File

@@ -169,7 +169,7 @@ public class MobilePositionController {
Device device = storager.queryVideoDevice(deviceId);
device.setSubscribeCycleForMobilePosition(Integer.parseInt(expires));
device.setMobilePositionSubmissionInterval(Integer.parseInt(interval));
storager.updateDevice(device);
deviceService.updateDevice(device);
String result = msg;
if (deviceService.removeMobilePositionSubscribe(device)) {
result += ",成功";

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

@@ -288,7 +288,8 @@ public class DeviceQuery {
public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
Device device = storager.queryVideoDevice(deviceId);
device.setStreamMode(streamMode);
storager.updateDevice(device);
// storager.updateDevice(device);
deviceService.updateDevice(device);
return new ResponseEntity<>(null,HttpStatus.OK);
}
@@ -305,51 +306,12 @@ public class DeviceQuery {
public ResponseEntity<WVPResult<String>> updateDevice(Device device){
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 (device.getSubscribeCycleForCatalog() > 0) {
if (deviceInStore.getSubscribeCycleForCatalog() == 0 || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
// 开启订阅
deviceService.addCatalogSubscribe(deviceInStore);
}
}else if (device.getSubscribeCycleForCatalog() == 0) {
if (deviceInStore.getSubscribeCycleForCatalog() != 0) {
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
// 取消订阅
deviceService.removeCatalogSubscribe(deviceInStore);
}
}
// 移动位置订阅相关的信息
if (device.getSubscribeCycleForMobilePosition() > 0) {
if (deviceInStore.getSubscribeCycleForMobilePosition() == 0 || deviceInStore.getSubscribeCycleForMobilePosition() != device.getSubscribeCycleForMobilePosition()) {
deviceInStore.setMobilePositionSubmissionInterval(device.getMobilePositionSubmissionInterval());
deviceInStore.setSubscribeCycleForMobilePosition(device.getSubscribeCycleForMobilePosition());
// 开启订阅
deviceService.addMobilePositionSubscribe(deviceInStore);
}
}else if (device.getSubscribeCycleForMobilePosition() == 0) {
if (deviceInStore.getSubscribeCycleForMobilePosition() != 0) {
// 取消订阅
deviceService.removeMobilePositionSubscribe(deviceInStore);
}
}
// TODO 报警订阅相关的信息
storager.updateDevice(device);
cmder.deviceInfoQuery(device);
deviceService.updateDevice(device);
// cmder.deviceInfoQuery(device);
}
WVPResult<String> result = new WVPResult<>();
result.setCode(0);

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);