|
@@ -13,6 +13,7 @@ import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -42,21 +43,22 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoDao, CameraInfo
|
|
//根据牧场查询
|
|
//根据牧场查询
|
|
String farmId = (String) params.get("fromFarmId");
|
|
String farmId = (String) params.get("fromFarmId");
|
|
|
|
|
|
- QueryWrapper<CameraInfoEntity> wrapper = new QueryWrapper<CameraInfoEntity>();
|
|
|
|
- wrapper.eq(StringUtils.isNotBlank(farmId),"farm_id",farmId);
|
|
|
|
|
|
+ QueryWrapper<CameraInfoEntity> wrapper = new QueryWrapper<>();
|
|
|
|
+ wrapper.eq(StringUtils.isNotBlank(farmId), "farm_id", farmId);
|
|
|
|
|
|
//关键词
|
|
//关键词
|
|
- String keyword = (String)params.get("keyword");
|
|
|
|
- if (StringUtils.isNotBlank(keyword)){
|
|
|
|
- wrapper.like("name",keyword);
|
|
|
|
- wrapper.like("area_name",keyword);
|
|
|
|
- wrapper.like("ip",keyword);
|
|
|
|
- wrapper.like("camera_type",keyword);
|
|
|
|
-
|
|
|
|
|
|
+ String keyword = (String) params.get("keyword");
|
|
|
|
+ if (StringUtils.isNotBlank(keyword)) {
|
|
|
|
+ wrapper.like("name", keyword);
|
|
|
|
+ wrapper.or().like("area_name", keyword);
|
|
|
|
+ wrapper.or().like("ip", keyword);
|
|
|
|
+ wrapper.or().like("camera_type", keyword);
|
|
}
|
|
}
|
|
|
|
|
|
- Integer areaId = (Integer)params.get("areaId");
|
|
|
|
- wrapper.eq(areaId != null,"area_id",areaId);
|
|
|
|
|
|
+ String areaId = (String) params.get("areaId");
|
|
|
|
+ if (StringUtils.isNotBlank(areaId)) {
|
|
|
|
+ wrapper.eq("area_id", Integer.parseInt(areaId));
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
IPage<CameraInfoEntity> page = this.page(
|
|
IPage<CameraInfoEntity> page = this.page(
|
|
@@ -70,21 +72,21 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoDao, CameraInfo
|
|
@Override
|
|
@Override
|
|
public List getCameraDetails(Integer cameraId) {
|
|
public List getCameraDetails(Integer cameraId) {
|
|
List cameraDetailsList = new ArrayList();
|
|
List cameraDetailsList = new ArrayList();
|
|
- CameraInfoEntity cameraInfo = cameraInfoDao.selectById(cameraId);
|
|
|
|
|
|
+ CameraInfoEntity cameraInfo = cameraInfoDao.selectById(cameraId);
|
|
Integer farmId = cameraInfo.getFarmId();
|
|
Integer farmId = cameraInfo.getFarmId();
|
|
QueryWrapper<PublicNetworkEntity> urlWrapper = new QueryWrapper<PublicNetworkEntity>();
|
|
QueryWrapper<PublicNetworkEntity> urlWrapper = new QueryWrapper<PublicNetworkEntity>();
|
|
- urlWrapper.eq("farm_id",farmId);
|
|
|
|
|
|
+ urlWrapper.eq("farm_id", farmId);
|
|
String url = publicNetworkDao.selectOne(urlWrapper).getUrl();
|
|
String url = publicNetworkDao.selectOne(urlWrapper).getUrl();
|
|
|
|
|
|
Map map = new HashMap();
|
|
Map map = new HashMap();
|
|
- String cameraAccount = cameraInfo.getAccount();
|
|
|
|
- String cameraPassword = cameraInfo.getPassword();
|
|
|
|
|
|
+ String cameraAccount = cameraInfo.getAccount();
|
|
|
|
+ String cameraPassword = cameraInfo.getPassword();
|
|
String camerIp = cameraInfo.getIp();
|
|
String camerIp = cameraInfo.getIp();
|
|
Integer areaId = cameraInfo.getAreaId();
|
|
Integer areaId = cameraInfo.getAreaId();
|
|
String rtsp = cameraInfo.getRtsp();
|
|
String rtsp = cameraInfo.getRtsp();
|
|
- map.put("wsUrl","ws://"+url+"/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword+"%40"+camerIp);
|
|
|
|
- map.put("rtspUrl","rtsp://"+cameraAccount+":"+cameraPassword+"@"+camerIp+rtsp);
|
|
|
|
- map.put("areaId",areaId);
|
|
|
|
|
|
+ map.put("wsUrl", "ws://" + url + "/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword + "%40" + camerIp);
|
|
|
|
+ map.put("rtspUrl", "rtsp://" + cameraAccount + ":" + cameraPassword + "@" + camerIp + rtsp);
|
|
|
|
+ map.put("areaId", areaId);
|
|
|
|
|
|
cameraDetailsList.add(map);
|
|
cameraDetailsList.add(map);
|
|
|
|
|
|
@@ -95,7 +97,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoDao, CameraInfo
|
|
@Override
|
|
@Override
|
|
public List getByAreaId(Integer areaId) {
|
|
public List getByAreaId(Integer areaId) {
|
|
LambdaQueryWrapper<CameraInfoEntity> wrapper = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<CameraInfoEntity> wrapper = Wrappers.lambdaQuery();
|
|
- wrapper.eq(CameraInfoEntity::getAreaId,areaId);
|
|
|
|
|
|
+ wrapper.eq(CameraInfoEntity::getAreaId, areaId);
|
|
|
|
|
|
List<CameraInfoEntity> cameraInfoEntities = cameraInfoDao.selectList(wrapper);
|
|
List<CameraInfoEntity> cameraInfoEntities = cameraInfoDao.selectList(wrapper);
|
|
return cameraInfoEntities;
|
|
return cameraInfoEntities;
|