1、设备详情安防页面数据第二版
2、增加监控获取连接地址
This commit is contained in:
parent
67a44caf49
commit
7356e2d199
@ -14,6 +14,7 @@ import com.fastbee.common.utils.SecurityUtils;
|
|||||||
import com.fastbee.common.utils.StringUtils;
|
import com.fastbee.common.utils.StringUtils;
|
||||||
import com.fastbee.common.utils.poi.ExcelUtil;
|
import com.fastbee.common.utils.poi.ExcelUtil;
|
||||||
import com.fastbee.iot.domain.Device;
|
import com.fastbee.iot.domain.Device;
|
||||||
|
import com.fastbee.iot.domain.JiankongDeviceParam;
|
||||||
import com.fastbee.iot.model.DeviceAssignmentVO;
|
import com.fastbee.iot.model.DeviceAssignmentVO;
|
||||||
import com.fastbee.iot.model.DeviceImportVO;
|
import com.fastbee.iot.model.DeviceImportVO;
|
||||||
import com.fastbee.iot.model.DeviceRelateUserInput;
|
import com.fastbee.iot.model.DeviceRelateUserInput;
|
||||||
@ -48,8 +49,7 @@ import java.util.stream.Collectors;
|
|||||||
@Api(tags = "设备管理")
|
@Api(tags = "设备管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/iot/device")
|
@RequestMapping("/iot/device")
|
||||||
public class DeviceController extends BaseController
|
public class DeviceController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceService deviceService;
|
private IDeviceService deviceService;
|
||||||
|
|
||||||
@ -63,8 +63,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperation("设备分页列表")
|
@ApiOperation("设备分页列表")
|
||||||
public TableDataInfo list(Device device)
|
public TableDataInfo list(Device device) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
// 限制当前用户机构
|
// 限制当前用户机构
|
||||||
if (null == device.getDeptId()) {
|
if (null == device.getDeptId()) {
|
||||||
@ -79,8 +78,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/unAuthlist")
|
@GetMapping("/unAuthlist")
|
||||||
@ApiOperation("设备分页列表")
|
@ApiOperation("设备分页列表")
|
||||||
public TableDataInfo unAuthlist(Device device)
|
public TableDataInfo unAuthlist(Device device) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
if (null == device.getDeptId()) {
|
if (null == device.getDeptId()) {
|
||||||
device.setDeptId(getLoginUser().getDeptId());
|
device.setDeptId(getLoginUser().getDeptId());
|
||||||
@ -94,8 +92,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/listByGroup")
|
@GetMapping("/listByGroup")
|
||||||
@ApiOperation("查询分组可添加设备分页列表")
|
@ApiOperation("查询分组可添加设备分页列表")
|
||||||
public TableDataInfo listByGroup(Device device)
|
public TableDataInfo listByGroup(Device device) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
if (null == loginUser.getDeptId()) {
|
if (null == loginUser.getDeptId()) {
|
||||||
@ -114,8 +111,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/shortList")
|
@GetMapping("/shortList")
|
||||||
@ApiOperation("设备分页简短列表")
|
@ApiOperation("设备分页简短列表")
|
||||||
public TableDataInfo shortList(Device device)
|
public TableDataInfo shortList(Device device) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
if (null == loginUser.getDeptId()) {
|
if (null == loginUser.getDeptId()) {
|
||||||
@ -126,7 +122,7 @@ public class DeviceController extends BaseController
|
|||||||
if (null == device.getDeptId()) {
|
if (null == device.getDeptId()) {
|
||||||
device.setDeptId(getLoginUser().getDeptId());
|
device.setDeptId(getLoginUser().getDeptId());
|
||||||
}
|
}
|
||||||
if (Objects.isNull(device.getTenantId())){
|
if (Objects.isNull(device.getTenantId())) {
|
||||||
device.setTenantId(getLoginUser().getUserId());
|
device.setTenantId(getLoginUser().getUserId());
|
||||||
}
|
}
|
||||||
if (null == device.getShowChild()) {
|
if (null == device.getShowChild()) {
|
||||||
@ -141,8 +137,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
@ApiOperation("查询所有设备简短列表")
|
@ApiOperation("查询所有设备简短列表")
|
||||||
public TableDataInfo allShortList()
|
public TableDataInfo allShortList() {
|
||||||
{
|
|
||||||
Device device = new Device();
|
Device device = new Device();
|
||||||
device.setDeptId(SecurityUtils.getLoginUser().getUser().getDeptId());
|
device.setDeptId(SecurityUtils.getLoginUser().getUser().getDeptId());
|
||||||
device.setShowChild(true);
|
device.setShowChild(true);
|
||||||
@ -156,8 +151,7 @@ public class DeviceController extends BaseController
|
|||||||
@Log(title = "设备", businessType = BusinessType.EXPORT)
|
@Log(title = "设备", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ApiOperation("导出设备")
|
@ApiOperation("导出设备")
|
||||||
public void export(HttpServletResponse response, Device device)
|
public void export(HttpServletResponse response, Device device) {
|
||||||
{
|
|
||||||
List<Device> list = deviceService.selectDeviceList(device);
|
List<Device> list = deviceService.selectDeviceList(device);
|
||||||
ExcelUtil<Device> util = new ExcelUtil<Device>(Device.class);
|
ExcelUtil<Device> util = new ExcelUtil<Device>(Device.class);
|
||||||
util.exportExcel(response, list, "设备数据");
|
util.exportExcel(response, list, "设备数据");
|
||||||
@ -169,20 +163,19 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/{deviceId}")
|
@GetMapping(value = "/{deviceId}")
|
||||||
@ApiOperation("获取设备详情")
|
@ApiOperation("获取设备详情")
|
||||||
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId)
|
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
||||||
{
|
|
||||||
Device device = deviceService.selectDeviceByDeviceId(deviceId);
|
Device device = deviceService.selectDeviceByDeviceId(deviceId);
|
||||||
// 判断当前用户是否有设备分享权限 (设备所属机构管理员和设备所属用户有权限)
|
// 判断当前用户是否有设备分享权限 (设备所属机构管理员和设备所属用户有权限)
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
List<SysRole> roles = loginUser.getUser().getRoles();
|
List<SysRole> roles = loginUser.getUser().getRoles();
|
||||||
//判断当前用户是否为设备所属机构管理员
|
//判断当前用户是否为设备所属机构管理员
|
||||||
if(roles.stream().anyMatch(a-> "admin".equals(a.getRoleKey()))){
|
if (roles.stream().anyMatch(a -> "admin".equals(a.getRoleKey()))) {
|
||||||
device.setIsOwner(1);
|
device.setIsOwner(1);
|
||||||
} else {
|
} else {
|
||||||
//判断当前用户是否是设备所属用户
|
//判断当前用户是否是设备所属用户
|
||||||
if (Objects.equals(device.getTenantId(), loginUser.getUserId())){
|
if (Objects.equals(device.getTenantId(), loginUser.getUserId())) {
|
||||||
device.setIsOwner(1);
|
device.setIsOwner(1);
|
||||||
}else {
|
} else {
|
||||||
device.setIsOwner(0);
|
device.setIsOwner(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,8 +188,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/synchronization/{serialNumber}")
|
@GetMapping(value = "/synchronization/{serialNumber}")
|
||||||
@ApiOperation("设备数据同步")
|
@ApiOperation("设备数据同步")
|
||||||
public AjaxResult deviceSynchronization(@PathVariable("serialNumber") String serialNumber)
|
public AjaxResult deviceSynchronization(@PathVariable("serialNumber") String serialNumber) {
|
||||||
{
|
|
||||||
return AjaxResult.success(messagePublish.deviceSynchronization(serialNumber));
|
return AjaxResult.success(messagePublish.deviceSynchronization(serialNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,8 +198,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/getDeviceBySerialNumber/{serialNumber}")
|
@GetMapping(value = "/getDeviceBySerialNumber/{serialNumber}")
|
||||||
@ApiOperation("根据设备编号获取设备详情")
|
@ApiOperation("根据设备编号获取设备详情")
|
||||||
public AjaxResult getInfoBySerialNumber(@PathVariable("serialNumber") String serialNumber)
|
public AjaxResult getInfoBySerialNumber(@PathVariable("serialNumber") String serialNumber) {
|
||||||
{
|
|
||||||
return AjaxResult.success(deviceService.selectDeviceBySerialNumber(serialNumber));
|
return AjaxResult.success(deviceService.selectDeviceBySerialNumber(serialNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,8 +208,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/statistic")
|
@GetMapping(value = "/statistic")
|
||||||
@ApiOperation("获取设备统计信息")
|
@ApiOperation("获取设备统计信息")
|
||||||
public AjaxResult getDeviceStatistic()
|
public AjaxResult getDeviceStatistic() {
|
||||||
{
|
|
||||||
return AjaxResult.success(deviceService.selectDeviceStatistic());
|
return AjaxResult.success(deviceService.selectDeviceStatistic());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,8 +218,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/runningStatus")
|
@GetMapping(value = "/runningStatus")
|
||||||
@ApiOperation("获取设备详情和运行状态")
|
@ApiOperation("获取设备详情和运行状态")
|
||||||
public AjaxResult getRunningStatusInfo(Long deviceId)
|
public AjaxResult getRunningStatusInfo(Long deviceId) {
|
||||||
{
|
|
||||||
return AjaxResult.success(deviceService.selectDeviceRunningStatusByDeviceId(deviceId));
|
return AjaxResult.success(deviceService.selectDeviceRunningStatusByDeviceId(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,8 +229,7 @@ public class DeviceController extends BaseController
|
|||||||
@Log(title = "添加设备", businessType = BusinessType.INSERT)
|
@Log(title = "添加设备", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("添加设备")
|
@ApiOperation("添加设备")
|
||||||
public AjaxResult add(@RequestBody Device device)
|
public AjaxResult add(@RequestBody Device device) {
|
||||||
{
|
|
||||||
return AjaxResult.success(deviceService.insertDevice(device));
|
return AjaxResult.success(deviceService.insertDevice(device));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,12 +241,11 @@ public class DeviceController extends BaseController
|
|||||||
@Log(title = "设备关联用户", businessType = BusinessType.UPDATE)
|
@Log(title = "设备关联用户", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/relateUser")
|
@PostMapping("/relateUser")
|
||||||
@ApiOperation("终端-设备关联用户")
|
@ApiOperation("终端-设备关联用户")
|
||||||
public AjaxResult relateUser(@RequestBody DeviceRelateUserInput deviceRelateUserInput)
|
public AjaxResult relateUser(@RequestBody DeviceRelateUserInput deviceRelateUserInput) {
|
||||||
{
|
if (deviceRelateUserInput.getUserId() == 0 || deviceRelateUserInput.getUserId() == null) {
|
||||||
if(deviceRelateUserInput.getUserId()==0 || deviceRelateUserInput.getUserId()==null){
|
|
||||||
return AjaxResult.error(MessageUtils.message("device.user.id.null"));
|
return AjaxResult.error(MessageUtils.message("device.user.id.null"));
|
||||||
}
|
}
|
||||||
if(deviceRelateUserInput.getDeviceNumberAndProductIds()==null || deviceRelateUserInput.getDeviceNumberAndProductIds().size()==0){
|
if (deviceRelateUserInput.getDeviceNumberAndProductIds() == null || deviceRelateUserInput.getDeviceNumberAndProductIds().size() == 0) {
|
||||||
return AjaxResult.error(MessageUtils.message("device.product.id.null"));
|
return AjaxResult.error(MessageUtils.message("device.product.id.null"));
|
||||||
}
|
}
|
||||||
return deviceService.deviceRelateUser(deviceRelateUserInput);
|
return deviceService.deviceRelateUser(deviceRelateUserInput);
|
||||||
@ -271,8 +258,7 @@ public class DeviceController extends BaseController
|
|||||||
@Log(title = "修改设备", businessType = BusinessType.UPDATE)
|
@Log(title = "修改设备", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改设备")
|
@ApiOperation("修改设备")
|
||||||
public AjaxResult edit(@RequestBody Device device)
|
public AjaxResult edit(@RequestBody Device device) {
|
||||||
{
|
|
||||||
return deviceService.updateDevice(device);
|
return deviceService.updateDevice(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,9 +269,8 @@ public class DeviceController extends BaseController
|
|||||||
@Log(title = "重置设备状态", businessType = BusinessType.UPDATE)
|
@Log(title = "重置设备状态", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/reset/{serialNumber}")
|
@PutMapping("/reset/{serialNumber}")
|
||||||
@ApiOperation("重置设备状态")
|
@ApiOperation("重置设备状态")
|
||||||
public AjaxResult resetDeviceStatus(@PathVariable String serialNumber)
|
public AjaxResult resetDeviceStatus(@PathVariable String serialNumber) {
|
||||||
{
|
Device device = new Device();
|
||||||
Device device=new Device();
|
|
||||||
device.setSerialNumber(serialNumber);
|
device.setSerialNumber(serialNumber);
|
||||||
return toAjax(deviceService.resetDeviceStatus(device.getSerialNumber()));
|
return toAjax(deviceService.resetDeviceStatus(device.getSerialNumber()));
|
||||||
}
|
}
|
||||||
@ -295,7 +280,7 @@ public class DeviceController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
||||||
@Log(title = "删除设备", businessType = BusinessType.DELETE)
|
@Log(title = "删除设备", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deviceIds}")
|
@DeleteMapping("/{deviceIds}")
|
||||||
@ApiOperation("批量删除设备")
|
@ApiOperation("批量删除设备")
|
||||||
public AjaxResult remove(@PathVariable Long[] deviceIds) throws SchedulerException {
|
public AjaxResult remove(@PathVariable Long[] deviceIds) throws SchedulerException {
|
||||||
return deviceService.deleteDeviceByDeviceId(deviceIds[0]);
|
return deviceService.deleteDeviceByDeviceId(deviceIds[0]);
|
||||||
@ -307,27 +292,27 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||||
@GetMapping("/generator")
|
@GetMapping("/generator")
|
||||||
@ApiOperation("生成设备编号")
|
@ApiOperation("生成设备编号")
|
||||||
public AjaxResult generatorDeviceNum(Integer type){
|
public AjaxResult generatorDeviceNum(Integer type) {
|
||||||
return AjaxResult.success(MessageUtils.message("operate.success"),deviceService.generationDeviceNum(type));
|
return AjaxResult.success(MessageUtils.message("operate.success"), deviceService.generationDeviceNum(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设备MQTT连接参数
|
* 获取设备MQTT连接参数
|
||||||
|
*
|
||||||
* @param deviceId 设备主键id
|
* @param deviceId 设备主键id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping("/getMqttConnectData")
|
@GetMapping("/getMqttConnectData")
|
||||||
@ApiOperation("获取设备MQTT连接参数")
|
@ApiOperation("获取设备MQTT连接参数")
|
||||||
public AjaxResult getMqttConnectData(Long deviceId){
|
public AjaxResult getMqttConnectData(Long deviceId) {
|
||||||
return AjaxResult.success(deviceService.getMqttConnectData(deviceId));
|
return AjaxResult.success(deviceService.getMqttConnectData(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||||
@ApiOperation("下载设备导入模板")
|
@ApiOperation("下载设备导入模板")
|
||||||
@PostMapping("/uploadTemplate")
|
@PostMapping("/uploadTemplate")
|
||||||
public void uploadTemplate(HttpServletResponse response, @RequestParam(name = "type") Integer type)
|
public void uploadTemplate(HttpServletResponse response, @RequestParam(name = "type") Integer type) {
|
||||||
{
|
|
||||||
// 1-设备导入;2-设备分配
|
// 1-设备导入;2-设备分配
|
||||||
if (1 == type) {
|
if (1 == type) {
|
||||||
ExcelUtil<DeviceImportVO> util = new ExcelUtil<>(DeviceImportVO.class);
|
ExcelUtil<DeviceImportVO> util = new ExcelUtil<>(DeviceImportVO.class);
|
||||||
@ -342,8 +327,7 @@ public class DeviceController extends BaseController
|
|||||||
@ApiOperation("批量导入设备")
|
@ApiOperation("批量导入设备")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
public AjaxResult importData(@RequestParam("file") MultipartFile file, @RequestParam("productId") Long productId) throws Exception
|
public AjaxResult importData(@RequestParam("file") MultipartFile file, @RequestParam("productId") Long productId) throws Exception {
|
||||||
{
|
|
||||||
if (null == file) {
|
if (null == file) {
|
||||||
return error(MessageUtils.message("import.failed.file.null"));
|
return error(MessageUtils.message("import.failed.file.null"));
|
||||||
}
|
}
|
||||||
@ -364,10 +348,7 @@ public class DeviceController extends BaseController
|
|||||||
@ApiOperation("批量导入分配设备")
|
@ApiOperation("批量导入分配设备")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
@PostMapping("/importAssignmentData")
|
@PostMapping("/importAssignmentData")
|
||||||
public AjaxResult importAssignmentData(@RequestParam("file") MultipartFile file,
|
public AjaxResult importAssignmentData(@RequestParam("file") MultipartFile file, @RequestParam("productId") Long productId, @RequestParam("deptId") Long deptId) throws Exception {
|
||||||
@RequestParam("productId") Long productId,
|
|
||||||
@RequestParam("deptId") Long deptId) throws Exception
|
|
||||||
{
|
|
||||||
if (null == file) {
|
if (null == file) {
|
||||||
return error(MessageUtils.message("import.failed.file.null"));
|
return error(MessageUtils.message("import.failed.file.null"));
|
||||||
}
|
}
|
||||||
@ -386,15 +367,15 @@ public class DeviceController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 分配设备
|
* 分配设备
|
||||||
|
*
|
||||||
* @param deptId 机构id
|
* @param deptId 机构id
|
||||||
* @param: deviceIds 设备id字符串
|
|
||||||
* @return com.fastbee.common.core.domain.AjaxResult
|
* @return com.fastbee.common.core.domain.AjaxResult
|
||||||
|
* @param: deviceIds 设备id字符串
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:assignment')")
|
@PreAuthorize("@ss.hasPermi('iot:device:assignment')")
|
||||||
@ApiOperation("分配设备")
|
@ApiOperation("分配设备")
|
||||||
@PostMapping("/assignment")
|
@PostMapping("/assignment")
|
||||||
public AjaxResult assignment(@RequestParam("deptId") Long deptId,
|
public AjaxResult assignment(@RequestParam("deptId") Long deptId, @RequestParam("deviceIds") String deviceIds) {
|
||||||
@RequestParam("deviceIds") String deviceIds) {
|
|
||||||
if (null == deptId) {
|
if (null == deptId) {
|
||||||
return error(MessageUtils.message("device.dept.id.null"));
|
return error(MessageUtils.message("device.dept.id.null"));
|
||||||
}
|
}
|
||||||
@ -406,14 +387,14 @@ public class DeviceController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 回收设备
|
* 回收设备
|
||||||
* @param: deviceIds 设备id字符串
|
*
|
||||||
* @return com.fastbee.common.core.domain.AjaxResult
|
* @return com.fastbee.common.core.domain.AjaxResult
|
||||||
|
* @param: deviceIds 设备id字符串
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:recovery')")
|
@PreAuthorize("@ss.hasPermi('iot:device:recovery')")
|
||||||
@ApiOperation("回收设备")
|
@ApiOperation("回收设备")
|
||||||
@PostMapping("/recovery")
|
@PostMapping("/recovery")
|
||||||
public AjaxResult recovery(@RequestParam("deviceIds") String deviceIds,
|
public AjaxResult recovery(@RequestParam("deviceIds") String deviceIds, @RequestParam("recoveryDeptId") Long recoveryDeptId) {
|
||||||
@RequestParam("recoveryDeptId") Long recoveryDeptId) {
|
|
||||||
if (StringUtils.isEmpty(deviceIds)) {
|
if (StringUtils.isEmpty(deviceIds)) {
|
||||||
return error("请选择设备");
|
return error("请选择设备");
|
||||||
}
|
}
|
||||||
@ -426,8 +407,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:batchGenerator')")
|
@PreAuthorize("@ss.hasPermi('iot:device:batchGenerator')")
|
||||||
@PostMapping("/batchGenerator")
|
@PostMapping("/batchGenerator")
|
||||||
@ApiOperation("批量生成设备编号")
|
@ApiOperation("批量生成设备编号")
|
||||||
public void batchGeneratorDeviceNum(HttpServletResponse response,
|
public void batchGeneratorDeviceNum(HttpServletResponse response, @RequestParam("count") Integer count) {
|
||||||
@RequestParam("count") Integer count){
|
|
||||||
if (count > 200) {
|
if (count > 200) {
|
||||||
throw new ServiceException("最多只能生成200个!");
|
throw new ServiceException("最多只能生成200个!");
|
||||||
}
|
}
|
||||||
@ -448,8 +428,7 @@ public class DeviceController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping("/listThingsModel")
|
@GetMapping("/listThingsModel")
|
||||||
@ApiOperation("查询变量概况")
|
@ApiOperation("查询变量概况")
|
||||||
public TableDataInfo listThingsModel(Integer pageNum, Integer pageSize, Long deviceId, String modelName, Integer type)
|
public TableDataInfo listThingsModel(Integer pageNum, Integer pageSize, Long deviceId, String modelName, Integer type) {
|
||||||
{
|
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
rspData.setCode(HttpStatus.SUCCESS);
|
rspData.setCode(HttpStatus.SUCCESS);
|
||||||
rspData.setMsg("查询成功");
|
rspData.setMsg("查询成功");
|
||||||
@ -497,9 +476,20 @@ public class DeviceController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/getDeviceLogAllCurves")
|
@GetMapping("/getDeviceLogAllCurves")
|
||||||
@ApiOperation("查询设备历史数据曲线图")
|
@ApiOperation("查询设备历史数据曲线图")
|
||||||
public AjaxResult getDeviceLogAllCurves(Long deviceId,String beginTime ,String endTime) {
|
public AjaxResult getDeviceLogAllCurves(Long deviceId, String beginTime, String endTime) {
|
||||||
ArrayList<Object> data = deviceService.getDeviceLogAllCurves(deviceId,beginTime ,endTime);
|
ArrayList<Object> data = deviceService.getDeviceLogAllCurves(deviceId, beginTime, endTime);
|
||||||
return success(data);
|
return success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取视频监控
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getvideourl")
|
||||||
|
public AjaxResult getvideourl(JiankongDeviceParam baseGet) throws Exception {
|
||||||
|
return AjaxResult.success(deviceService.getvideourl(baseGet));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,24 @@
|
|||||||
package com.fastbee.data.domain.vo;
|
package com.fastbee.data.domain.vo;
|
||||||
|
|
||||||
import com.fastbee.iot.domain.Device;
|
import com.fastbee.iot.domain.Device;
|
||||||
|
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安防信息
|
* 安防信息
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class AnfangInfoVo {
|
public class AnfangInfoVo {
|
||||||
|
@ApiModelProperty("监控设备")
|
||||||
private Device jiankongDevice;
|
private Device jiankongDevice;
|
||||||
|
@ApiModelProperty("门状态:0=正常,1=箱门振动,2=箱门打开")
|
||||||
|
private Integer doorStatus;
|
||||||
|
@ApiModelProperty("柜门ID,控制柜门开启的设备ID")
|
||||||
|
private String guimenId;
|
||||||
|
@ApiModelProperty("安防告警列表")
|
||||||
|
private List<UploadedPhotos>anfangList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,11 @@ import com.fastbee.common.utils.StringUtils;
|
|||||||
import com.fastbee.common.utils.StringUtils;
|
import com.fastbee.common.utils.StringUtils;
|
||||||
import com.fastbee.data.domain.vo.AnfangInfoVo;
|
import com.fastbee.data.domain.vo.AnfangInfoVo;
|
||||||
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
|
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
|
||||||
|
import com.fastbee.iot.anfang.service.IUploadedPhotosService;
|
||||||
import com.fastbee.iot.domain.Device;
|
import com.fastbee.iot.domain.Device;
|
||||||
import com.fastbee.iot.haiwei.service.HaiWeiService;
|
import com.fastbee.iot.haiwei.service.HaiWeiService;
|
||||||
import com.fastbee.iot.mapper.DeviceMapper;
|
import com.fastbee.iot.mapper.DeviceMapper;
|
||||||
|
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
||||||
import com.fastbee.iot.model.haiwei.CmdHaiWeiVo;
|
import com.fastbee.iot.model.haiwei.CmdHaiWeiVo;
|
||||||
import com.fastbee.iot.model.haiwei.dto.CmdHaiWeiDto;
|
import com.fastbee.iot.model.haiwei.dto.CmdHaiWeiDto;
|
||||||
import com.fastbee.iot.service.IDeviceService;
|
import com.fastbee.iot.service.IDeviceService;
|
||||||
@ -24,6 +26,7 @@ import com.fastbee.xunjian.mapper.XjInspectionRoutesMapper;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.xml.crypto.Data;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -41,6 +44,9 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
private XjInspectionRecordsMapper xjInspectionRecordsMapper;
|
private XjInspectionRecordsMapper xjInspectionRecordsMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private HaiWeiService haiWeiService;
|
private HaiWeiService haiWeiService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUploadedPhotosService uploadedPhotosService;
|
||||||
public DeviceDetailServiceImpl(DeviceMapper deviceMapper) {
|
public DeviceDetailServiceImpl(DeviceMapper deviceMapper) {
|
||||||
this.deviceMapper = deviceMapper;
|
this.deviceMapper = deviceMapper;
|
||||||
}
|
}
|
||||||
@ -140,9 +146,33 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
if(StringUtils.isNotEmpty(anfangIds)){
|
if(StringUtils.isNotEmpty(anfangIds)){
|
||||||
Device anfangDevice = iDeviceService.selectDeviceByDeviceId(Long.parseLong(anfangIds));
|
Device anfangDevice = iDeviceService.selectDeviceByDeviceId(Long.parseLong(anfangIds));
|
||||||
//获取当前安防告警状态
|
//获取当前安防告警状态
|
||||||
|
UploadedPhotos uploadedPhotos = new UploadedPhotos();
|
||||||
|
uploadedPhotos.setSn(anfangDevice.getSerialNumber());
|
||||||
|
List<UploadedPhotos> uploadedPhotos1 = uploadedPhotosService.selectUploadedPhotosList(uploadedPhotos);
|
||||||
|
int doorStatus = 0;//0=正常,1=箱门振动,2=箱门打开
|
||||||
|
if(uploadedPhotos1.size() > 0){
|
||||||
|
UploadedPhotos temp = uploadedPhotos1.get(0);
|
||||||
|
if(new Date().getTime() - temp.getUploadTime().getTime() < 36000000){
|
||||||
|
if(temp.getShakeState().equals("1")){
|
||||||
|
doorStatus = 1;
|
||||||
|
}
|
||||||
|
if(temp.getDoorState().equals("1")){
|
||||||
|
doorStatus = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(uploadedPhotos1.size() > 5){
|
||||||
|
uploadedPhotos1 = uploadedPhotos1.subList(0,5);
|
||||||
|
}
|
||||||
|
anfangInfoVo.setDoorStatus(doorStatus);
|
||||||
|
anfangInfoVo.setAnfangList(uploadedPhotos1);
|
||||||
}
|
}
|
||||||
//获取安防历史记录
|
//安防设备
|
||||||
return null;
|
String guimenIds = devParams.get("guimenIds").toString();
|
||||||
|
if(StringUtils.isNotEmpty(guimenIds)){
|
||||||
|
anfangInfoVo.setGuimenId(devParams.get("guimenIds").toString());
|
||||||
|
}
|
||||||
|
return anfangInfoVo;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<CmdHaiWeiVo> cmdDevices(CmdHaiWeiDto cmdHaiWeiDto) {
|
public CommonResult<CmdHaiWeiVo> cmdDevices(CmdHaiWeiDto cmdHaiWeiDto) {
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.fastbee.iot.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备参数设置对象 device_param_config
|
||||||
|
*
|
||||||
|
* @author mafa
|
||||||
|
* @date 2023-08-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class JiankongDeviceParam
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/** 设备id */
|
||||||
|
private Long deviceId;
|
||||||
|
/** ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 */
|
||||||
|
private String startTime;
|
||||||
|
/** ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 */
|
||||||
|
private String stopTime;
|
||||||
|
/** ezopen协议地址的类型,1-预览,2-本地录像回放,3-云存储录像回放,非必选,默认为1 */
|
||||||
|
private String type;
|
||||||
|
/** ezopen协议地址的设备的视频加密密码 */
|
||||||
|
private String code;
|
||||||
|
/** 流播放协议,1-ezopen、2-hls、3-rtmp、4-flv,默认为1 */
|
||||||
|
private String protocol;
|
||||||
|
|
||||||
|
/** 视频清晰度,1-高清(主码流)、2-流畅(子码流) */
|
||||||
|
private String quality;
|
||||||
|
|
||||||
|
/** 云台操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 */
|
||||||
|
private String direction;
|
||||||
|
/** 云台操作命令:速度 */
|
||||||
|
private String speed;
|
||||||
|
|
||||||
|
/** 云台操作命令:传了一直动 不传移动一格 */
|
||||||
|
private String notStop;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,132 @@
|
|||||||
|
package com.fastbee.iot.haikang;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点点控api界面
|
||||||
|
*/
|
||||||
|
public class HaikangYingshiApi {
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject getToken(Map<String, Object> params) {
|
||||||
|
String url = UrlConstant.getToken;//指定URL
|
||||||
|
|
||||||
|
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||||
|
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||||
|
JSONObject jsonObject = new JSONObject(result);
|
||||||
|
// System.out.println("jsonObject = " + jsonObject);
|
||||||
|
// Map<String,Object> data =null;
|
||||||
|
// if (jsonObject.get("code").equals("200")) {
|
||||||
|
// data= (Map<String,Object>) jsonObject.get("data");
|
||||||
|
// }
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param params accessToken String 授权过程获取的access_token Y
|
||||||
|
* deviceSerial String 直播源,例如427734222,均采用英文符号,限制50个 Y
|
||||||
|
* channelNo Integer 通道号,,非必选,默认为1 N
|
||||||
|
* code String ezopen协议地址的设备的视频加密密码 N
|
||||||
|
* expireTime Integer 过期时长,单位秒;针对hls/rtmp设置有效期,相对时间;30秒-720天 N
|
||||||
|
* protocol Integer 流播放协议,1-ezopen、2-hls、3-rtmp、4-flv,默认为1 N
|
||||||
|
* quality Integer 视频清晰度,1-高清(主码流)、2-流畅(子码流) N
|
||||||
|
* startTime String ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 N
|
||||||
|
* stopTime String ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 N
|
||||||
|
* type String ezopen协议地址的类型,1-预览,2-本地录像回放,3-云存储录像回放,非必选,默认为1 N
|
||||||
|
* supportH265 Integer 是否要求播放视频为H265编码格式,1表示需要,0表示不要求 N
|
||||||
|
* gbchannel String 国标设备的通道编号,视频通道编号ID N
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject getAddress(Map<String, Object> params) {
|
||||||
|
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||||
|
String url = UrlConstant.address;//指定URL
|
||||||
|
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||||
|
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||||
|
JSONObject jsonObject = new JSONObject(result);
|
||||||
|
// System.out.println("result = " + result);
|
||||||
|
// Map<String,Object> data =(Map<String,Object>) jsonObject.get("data");
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param params accessToken String 授权过程获取的access_token Y
|
||||||
|
* deviceSerial String 设备序列号,存在英文字母的设备序列号,字母需为大写 Y
|
||||||
|
* channelNo int 通道号 Y
|
||||||
|
* direction int 操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 Y
|
||||||
|
* speed int 云台速度:0-慢,1-适中,2-快,海康设备参数不可为0
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject startMove(Map<String, Object> params) {
|
||||||
|
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||||
|
String url = UrlConstant.startyuntai;//指定URL
|
||||||
|
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||||
|
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||||
|
JSONObject jsonObject = new JSONObject(result);
|
||||||
|
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param params accessToken String 授权过程获取的access_token Y
|
||||||
|
* deviceSerial String 设备序列号,存在英文字母的设备序列号,字母需为大写 Y
|
||||||
|
* channelNo int 通道号 Y
|
||||||
|
* direction int 操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 Y
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject stopMove(Map<String, Object> params) {
|
||||||
|
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||||
|
String url = UrlConstant.stopyuntai;//指定URL
|
||||||
|
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||||
|
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||||
|
JSONObject jsonObject = new JSONObject(result);
|
||||||
|
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param params accessToken String 授权过程获取的access_token Y
|
||||||
|
* deviceSerial String 设备序列号,存在英文字母的设备序列号,字母需为大写 Y
|
||||||
|
* channelNo int 通道号 Y
|
||||||
|
* direction int 操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 Y
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject getDeviceInfo(Map<String, Object> params) {
|
||||||
|
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||||
|
String url = UrlConstant.deviceInfo;//指定URL
|
||||||
|
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||||
|
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||||
|
JSONObject jsonObject = new JSONObject(result);
|
||||||
|
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param params accessToken String 授权过程获取的access_token Y
|
||||||
|
* deviceSerial String 直播源,例如427734222,均采用英文符号,限制50个 Y
|
||||||
|
* channelNo Integer 通道号,,非必选,默认为1 N
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject capture(Map<String, Object> params) {
|
||||||
|
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||||
|
String url = UrlConstant.capture;//指定URL
|
||||||
|
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||||
|
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||||
|
JSONObject jsonObject = new JSONObject(result);
|
||||||
|
// System.out.println("result = " + result);
|
||||||
|
// Map<String,Object> data =(Map<String,Object>) jsonObject.get("data");
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.fastbee.iot.haikang;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点点控
|
||||||
|
*/
|
||||||
|
public class UrlConstant {
|
||||||
|
|
||||||
|
public static String appKey = "be85054cf4504710861fad77ec4e4af9";
|
||||||
|
public static String appSecret = "104f39e29f9847e5d819a99c1c32fc88";
|
||||||
|
|
||||||
|
//获取 token
|
||||||
|
public static String getToken = "https://open.ys7.com/api/lapp/token/get";
|
||||||
|
//获取 直播地址
|
||||||
|
public static String address = "https://open.ys7.com/api/lapp/v2/live/address/get";
|
||||||
|
//开始云台
|
||||||
|
public static String startyuntai = "https://open.ys7.com/api/lapp/device/ptz/start";
|
||||||
|
//停止云台
|
||||||
|
public static String stopyuntai = "https://open.ys7.com/api/lapp/device/ptz/stop";
|
||||||
|
//设备信息
|
||||||
|
public static String deviceInfo = "https://open.ys7.com/api/lapp/device/info";
|
||||||
|
//设备抓拍图片
|
||||||
|
public static String capture = "https://open.ys7.com/api/lapp/device/capture";
|
||||||
|
//关闭设备视频加密
|
||||||
|
public static String deviceEncryptOff = "https://open.ys7.com/api/lapp/device/encrypt/off";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ import com.fastbee.common.core.thingsModel.ThingsModelSimpleItem;
|
|||||||
import com.fastbee.common.enums.DeviceStatus;
|
import com.fastbee.common.enums.DeviceStatus;
|
||||||
import com.fastbee.iot.domain.Device;
|
import com.fastbee.iot.domain.Device;
|
||||||
import com.fastbee.iot.domain.DeviceGroup;
|
import com.fastbee.iot.domain.DeviceGroup;
|
||||||
|
import com.fastbee.iot.domain.JiankongDeviceParam;
|
||||||
import com.fastbee.iot.model.*;
|
import com.fastbee.iot.model.*;
|
||||||
import com.fastbee.iot.model.ThingsModels.ThingsModelShadow;
|
import com.fastbee.iot.model.ThingsModels.ThingsModelShadow;
|
||||||
import com.fastbee.iot.model.ThingsModels.ThingsModelValueItem;
|
import com.fastbee.iot.model.ThingsModels.ThingsModelValueItem;
|
||||||
@ -334,5 +335,5 @@ public interface IDeviceService
|
|||||||
|
|
||||||
|
|
||||||
ArrayList<Object> getDeviceLogAllCurves(Long deviceId, String beginTime, String endTime);
|
ArrayList<Object> getDeviceLogAllCurves(Long deviceId, String beginTime, String endTime);
|
||||||
|
Map<String, Object> getvideourl(JiankongDeviceParam jiankongDeviceParam);
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,13 @@ import com.fastbee.common.core.thingsModel.ThingsModelSimpleItem;
|
|||||||
import com.fastbee.common.core.thingsModel.ThingsModelValuesInput;
|
import com.fastbee.common.core.thingsModel.ThingsModelValuesInput;
|
||||||
import com.fastbee.common.enums.*;
|
import com.fastbee.common.enums.*;
|
||||||
import com.fastbee.common.exception.ServiceException;
|
import com.fastbee.common.exception.ServiceException;
|
||||||
import com.fastbee.common.utils.CaculateUtils;
|
import com.fastbee.common.utils.*;
|
||||||
import com.fastbee.common.utils.DateUtils;
|
|
||||||
import com.fastbee.common.utils.SecurityUtils;
|
|
||||||
import com.fastbee.common.utils.StringUtils;
|
|
||||||
import com.fastbee.common.utils.http.HttpUtils;
|
import com.fastbee.common.utils.http.HttpUtils;
|
||||||
import com.fastbee.common.utils.ip.IpUtils;
|
import com.fastbee.common.utils.ip.IpUtils;
|
||||||
import com.fastbee.common.utils.json.JsonUtils;
|
import com.fastbee.common.utils.json.JsonUtils;
|
||||||
import com.fastbee.iot.cache.ITSLCache;
|
import com.fastbee.iot.cache.ITSLCache;
|
||||||
import com.fastbee.iot.domain.*;
|
import com.fastbee.iot.domain.*;
|
||||||
|
import com.fastbee.iot.haikang.HaikangYingshiApi;
|
||||||
import com.fastbee.iot.mapper.*;
|
import com.fastbee.iot.mapper.*;
|
||||||
import com.fastbee.iot.model.*;
|
import com.fastbee.iot.model.*;
|
||||||
import com.fastbee.iot.model.ThingsModelItem.Datatype;
|
import com.fastbee.iot.model.ThingsModelItem.Datatype;
|
||||||
@ -1668,4 +1666,76 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getvideourl(JiankongDeviceParam jiankongDeviceParam) {
|
||||||
|
if (jiankongDeviceParam.getDeviceId() == null) {
|
||||||
|
throw new RuntimeException("请上传设备id");
|
||||||
|
}
|
||||||
|
Device device = selectDeviceByDeviceId(jiankongDeviceParam.getDeviceId());
|
||||||
|
|
||||||
|
if (device == null) {
|
||||||
|
throw new RuntimeException("设备未找到");
|
||||||
|
}
|
||||||
|
Map devData = DevParamsUtils.getDevParams(device.getDevParams());
|
||||||
|
if (devData.get("appKey") == null) {
|
||||||
|
throw new RuntimeException("未绑定设备参数appKey");
|
||||||
|
}
|
||||||
|
if (devData.get("appSecret") == null) {
|
||||||
|
throw new RuntimeException("未绑定设备参数appSecret");
|
||||||
|
}
|
||||||
|
if (devData.get("channelNo") == null) {
|
||||||
|
throw new RuntimeException("未绑定设备参数channelNo");
|
||||||
|
}
|
||||||
|
Map<String, Object> map = new HashMap<>();//存放参数
|
||||||
|
map.put("appKey", devData.get("appKey"));
|
||||||
|
map.put("appSecret", devData.get("appSecret"));
|
||||||
|
cn.hutool.json.JSONObject token = HaikangYingshiApi.getToken(map);
|
||||||
|
if (token != null && token.get("code").equals("200")) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||||
|
token = (cn.hutool.json.JSONObject) token.get("data");
|
||||||
|
params.put("accessToken", token.get("accessToken"));
|
||||||
|
params.put("deviceSerial", device.getSerialNumber());
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(jiankongDeviceParam.getStartTime())) {
|
||||||
|
params.put("startTime", jiankongDeviceParam.getStartTime());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(jiankongDeviceParam.getStopTime())) {
|
||||||
|
params.put("stopTime", jiankongDeviceParam.getStopTime());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(jiankongDeviceParam.getType())) {
|
||||||
|
params.put("type", jiankongDeviceParam.getType());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(jiankongDeviceParam.getCode())) {
|
||||||
|
params.put("code", jiankongDeviceParam.getCode());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(jiankongDeviceParam.getProtocol())) {
|
||||||
|
params.put("protocol", jiankongDeviceParam.getProtocol());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(jiankongDeviceParam.getQuality())) {
|
||||||
|
params.put("quality", jiankongDeviceParam.getQuality());
|
||||||
|
}
|
||||||
|
|
||||||
|
cn.hutool.json.JSONObject response = HaikangYingshiApi.getAddress(params);
|
||||||
|
if (response != null && response.get("code").equals("200")) {
|
||||||
|
Map data = (cn.hutool.json.JSONObject) response.get("data");
|
||||||
|
Map<String, Object> reMap = new HashMap<>();
|
||||||
|
reMap.put("url", data.get("url"));
|
||||||
|
reMap.put("devName", device.getDeviceName());
|
||||||
|
reMap.put("accessToken", token.get("accessToken"));
|
||||||
|
reMap.put("id", device.getDeviceId());
|
||||||
|
reMap.put("status", device.getStatus() == null || device.getStatus() == 4 ? "离线" : "在线");
|
||||||
|
return reMap;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(response.get("msg").toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user