11
This commit is contained in:
1 parent
6c73388fdd
commit
30da249b6b
14 files changed
+540
-69
No files matched your search
@@ -22,6 +22,11 @@
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>luqj-javacv</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.luqj.ec.controller;
|
||||
|
||||
import com.luqj.ec.domain.EcDevice;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.luqj.ec.domain.dto.EcDeviceHeartbeatDto;
|
||||
import com.luqj.ec.domain.dto.EcDeviceReportDto;
|
||||
import com.luqj.ec.service.IEcDeviceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/ec/device-api")
|
||||
@@ -26,7 +24,17 @@ public class EcDeviceApiController extends BaseController {
|
||||
ecDeviceService.reportDevice(reportDto);
|
||||
return AjaxResult.success("设备上报成功");
|
||||
}
|
||||
|
||||
@GetMapping("/snapshop")
|
||||
public AjaxResult snapshop(@RequestParam(name = "deviceCode") String deviceCode) {
|
||||
EcDevice ecDevice = new EcDevice();
|
||||
try {
|
||||
ecDevice.setLastScreenPic(ecDeviceService.snapshop(deviceCode));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.success(ecDevice);
|
||||
}
|
||||
@PostMapping("/heartbeat")
|
||||
public AjaxResult heartbeat(@RequestBody EcDeviceHeartbeatDto heartbeatDto) {
|
||||
if (heartbeatDto.getDeviceCode() == null || heartbeatDto.getDeviceCode().isEmpty()) {
|
||||
|
||||
@@ -72,6 +72,8 @@ public interface IEcDeviceService extends IService<EcDevicePlus> {
|
||||
|
||||
EcDevicePlus getById(Long id, SFunction<EcDevicePlus, ?>... columns);
|
||||
|
||||
String snapshop(String deviceCode) throws Exception;
|
||||
|
||||
Map<Long, EcDevicePlus> getMapByIds(List<Long> ids, SFunction<EcDevicePlus, ?>... columns);
|
||||
|
||||
List<EcDevicePlus> getByIds(List<Long> ids);
|
||||
|
||||
@@ -1,33 +1,29 @@
|
||||
package com.luqj.ec.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.luqj.ec.mapper.EcDeviceMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.luqj.ec.domain.EcDevice;
|
||||
import com.luqj.ec.domain.EcDevicePlus;
|
||||
import com.luqj.ec.domain.dto.EcDeviceHeartbeatDto;
|
||||
import com.luqj.ec.domain.dto.EcDeviceReportDto;
|
||||
import com.luqj.ec.mapper.EcDeviceMapper;
|
||||
import com.luqj.ec.service.IEcDeviceService;
|
||||
import com.luqj.javacv.utils.RtspUtil;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 设备(手机设备)Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author luqj
|
||||
* @date 2026-02-27
|
||||
*/
|
||||
@@ -37,6 +33,8 @@ public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlu
|
||||
private EcDeviceMapper ecDeviceMapper;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@Autowired
|
||||
private RuoYiConfig ruoYiConfig;
|
||||
|
||||
@Override
|
||||
public List<EcDevicePlus> getByIds(List<Long> ids, SFunction<EcDevicePlus, ?>... columns) {
|
||||
@@ -61,6 +59,15 @@ public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlu
|
||||
return result;
|
||||
}
|
||||
|
||||
public String snapshop(String deviceCode) throws Exception {
|
||||
File file = new File(RuoYiConfig.getProfile() + "/ec/" + deviceCode + "/");
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
String fileName = RtspUtil.screenshot("rtsp://192.168.3.186:554/live/" + deviceCode, RuoYiConfig.getProfile() + "/ec/" + deviceCode + "/");
|
||||
return ruoYiConfig.getReqUrl() + "/ec/" + deviceCode + "/" + fileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EcDevicePlus getById(Long id, SFunction<EcDevicePlus, ?>... columns) {
|
||||
LambdaQueryWrapper<EcDevicePlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDevicePlus>()
|
||||
@@ -141,7 +148,7 @@ public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlu
|
||||
|
||||
/**
|
||||
* 查询设备(手机设备)
|
||||
*
|
||||
*
|
||||
* @param id 设备(手机设备)ID
|
||||
* @return 设备(手机设备)
|
||||
*/
|
||||
@@ -152,7 +159,7 @@ public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlu
|
||||
|
||||
/**
|
||||
* 查询设备(手机设备)列表
|
||||
*
|
||||
*
|
||||
* @param ecDevice 设备(手机设备)
|
||||
* @return 设备(手机设备)
|
||||
*/
|
||||
@@ -163,7 +170,7 @@ public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlu
|
||||
|
||||
/**
|
||||
* 新增设备(手机设备)
|
||||
*
|
||||
*
|
||||
* @param ecDevice 设备(手机设备)
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -174,7 +181,7 @@ public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlu
|
||||
|
||||
/**
|
||||
* 修改设备(手机设备)
|
||||
*
|
||||
*
|
||||
* @param ecDevice 设备(手机设备)
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -185,7 +192,7 @@ public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlu
|
||||
|
||||
/**
|
||||
* 批量删除设备(手机设备)
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的设备(手机设备)ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -196,7 +203,7 @@ public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlu
|
||||
|
||||
/**
|
||||
* 删除设备(手机设备)信息
|
||||
*
|
||||
*
|
||||
* @param id 设备(手机设备)ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user