commit
3b3be2aa58
@ -0,0 +1,58 @@
|
|||||||
|
package com.ssf.mysqloracletest.Controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.ssf.mysqloracletest.domain.dto.DevopsVideoInfoDto;
|
||||||
|
import com.ssf.mysqloracletest.service.DevopsVideoInfoService0;
|
||||||
|
import com.ssf.mysqloracletest.task.AlarmInfoTask;
|
||||||
|
import com.ssf.mysqloracletest.utils.ConfigParam;
|
||||||
|
import com.ssf.mysqloracletest.utils.StringKit;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.java.Log;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频监控设备表(DevopsVideoInfo)Controller
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2023-11-29 09:34:46
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Component
|
||||||
|
public class DevopsVideoInfoController {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(DevopsVideoInfoController.class);
|
||||||
|
private final DevopsVideoInfoService0 devopsVideoInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一键导入
|
||||||
|
*/
|
||||||
|
@Scheduled(initialDelay = 100, fixedDelay = 3000)
|
||||||
|
public void yjdr(DevopsVideoInfoDto villageDeviceInfo) {
|
||||||
|
|
||||||
|
if (!"true".equals(ConfigParam.DevopeVideoInfoSwitch)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String res = "error";
|
||||||
|
try {
|
||||||
|
res = devopsVideoInfoService.yjdr(villageDeviceInfo);
|
||||||
|
if (res.contains("success")) {
|
||||||
|
logger.info("导入成功");
|
||||||
|
} else {
|
||||||
|
logger.info("导入失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(StringKit.getTrace(e) + "导入出现错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,150 @@
|
|||||||
|
package com.ssf.mysqloracletest.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频监控设备表(DevopsVideoInfo)Domain
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2023-12-01 20:06:03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName(value = "devops_video_info")
|
||||||
|
public class DevopsVideoInfo0 implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所编码
|
||||||
|
*/
|
||||||
|
private String placeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@TableField(condition = SqlCondition.LIKE)
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监控类型
|
||||||
|
*/
|
||||||
|
private Integer monitoringType;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String monitoringTypeCn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装位置
|
||||||
|
*/
|
||||||
|
private String deviceAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备方位
|
||||||
|
*/
|
||||||
|
private Integer orientation;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String orientationCn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备SN编号
|
||||||
|
*/
|
||||||
|
private String deviceSn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备品牌
|
||||||
|
*/
|
||||||
|
private String deviceBrand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ip
|
||||||
|
*/
|
||||||
|
private String deviceIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备端口
|
||||||
|
*/
|
||||||
|
private Integer devicePort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备MAC
|
||||||
|
*/
|
||||||
|
private String deviceMac;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备经度
|
||||||
|
*/
|
||||||
|
private Double longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备纬度
|
||||||
|
*/
|
||||||
|
private Double latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* U3D经度
|
||||||
|
*/
|
||||||
|
private Double u3dLongitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* U3D纬度
|
||||||
|
*/
|
||||||
|
private Double u3dLatitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备高度
|
||||||
|
*/
|
||||||
|
private String deviceHeight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备厂家
|
||||||
|
*/
|
||||||
|
private String manufactor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆帐号
|
||||||
|
*/
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道国标编码
|
||||||
|
*/
|
||||||
|
@TableField(condition = SqlCondition.LIKE)
|
||||||
|
private String gbsChannelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NVR设备编码
|
||||||
|
*/
|
||||||
|
private String gbsNvrNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道号
|
||||||
|
*/
|
||||||
|
private Integer channelNo;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
package com.ssf.mysqloracletest.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频监控状态表(DevopsVideoStatus)Domain
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2023-12-01 20:06:03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName(value = "devops_video_status")
|
||||||
|
public class DevopsVideoStatus implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所编码
|
||||||
|
*/
|
||||||
|
private String placeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NVR设备编码
|
||||||
|
*/
|
||||||
|
private String gbsNvrNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道国标编码
|
||||||
|
*/
|
||||||
|
@TableField(condition = SqlCondition.LIKE)
|
||||||
|
private String gbsChannelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@TableField(condition = SqlCondition.LIKE)
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ip
|
||||||
|
*/
|
||||||
|
private String deviceIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监控类型
|
||||||
|
*/
|
||||||
|
private Integer monitoringType;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String monitoringTypeCn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心跳时间
|
||||||
|
*/
|
||||||
|
private Long heartbeatTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否在线
|
||||||
|
*/
|
||||||
|
private Integer isOnline;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String isOnlineCn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备经度
|
||||||
|
*/
|
||||||
|
private Double longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备纬度
|
||||||
|
*/
|
||||||
|
private Double latitude;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,144 @@
|
|||||||
|
package com.ssf.mysqloracletest.domain.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频监控设备表(DevopsVideoInfo)Domain
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2023-09-15 17:30:11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DevopsVideoInfoDto implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所编码
|
||||||
|
*/
|
||||||
|
private String placeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监控类型
|
||||||
|
*/
|
||||||
|
private Integer monitoringType;
|
||||||
|
|
||||||
|
private String monitoringTypeCn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装位置
|
||||||
|
*/
|
||||||
|
private String deviceAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道国标编码
|
||||||
|
*/
|
||||||
|
private String gbsChannelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NVR设备编码
|
||||||
|
*/
|
||||||
|
private String gbsNvrNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ip
|
||||||
|
*/
|
||||||
|
private String deviceIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备经度
|
||||||
|
*/
|
||||||
|
private Double longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备纬度
|
||||||
|
*/
|
||||||
|
private Double latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备高度
|
||||||
|
*/
|
||||||
|
private String deviceHeight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备方位
|
||||||
|
*/
|
||||||
|
private Integer orientation;
|
||||||
|
|
||||||
|
private String orientationCn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道号
|
||||||
|
*/
|
||||||
|
private Integer channelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* U3D经度
|
||||||
|
*/
|
||||||
|
private Double u3dLongitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* U3D纬度
|
||||||
|
*/
|
||||||
|
private Double u3dLatitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆帐号
|
||||||
|
*/
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备厂家
|
||||||
|
*/
|
||||||
|
private String manufactor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备品牌
|
||||||
|
*/
|
||||||
|
private String deviceBrand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备SN编号
|
||||||
|
*/
|
||||||
|
private String deviceSn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备端口
|
||||||
|
*/
|
||||||
|
private Integer devicePort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备MAC
|
||||||
|
*/
|
||||||
|
private String deviceMac;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
}
|
@ -0,0 +1,140 @@
|
|||||||
|
package com.ssf.mysqloracletest.domain.vo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频监控设备表(DevopsVideoInfo)Domain
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2023-12-01 20:06:03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DevopsVideoInfoVo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所编码
|
||||||
|
*/
|
||||||
|
private String placeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场所名称
|
||||||
|
*/
|
||||||
|
private String placeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监控类型
|
||||||
|
*/
|
||||||
|
private Integer monitoringType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装位置
|
||||||
|
*/
|
||||||
|
private String deviceAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备方位
|
||||||
|
*/
|
||||||
|
private Integer orientation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备SN编号
|
||||||
|
*/
|
||||||
|
private String deviceSn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备品牌
|
||||||
|
*/
|
||||||
|
private String deviceBrand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ip
|
||||||
|
*/
|
||||||
|
private String deviceIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备端口
|
||||||
|
*/
|
||||||
|
private Integer devicePort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备MAC
|
||||||
|
*/
|
||||||
|
private String deviceMac;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备经度
|
||||||
|
*/
|
||||||
|
private Double longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备纬度
|
||||||
|
*/
|
||||||
|
private Double latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* U3D经度
|
||||||
|
*/
|
||||||
|
private Double u3dLongitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* U3D纬度
|
||||||
|
*/
|
||||||
|
private Double u3dLatitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备高度
|
||||||
|
*/
|
||||||
|
private String deviceHeight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备厂家
|
||||||
|
*/
|
||||||
|
private String manufactor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆帐号
|
||||||
|
*/
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道国标编码
|
||||||
|
*/
|
||||||
|
private String gbsChannelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NVR设备编码
|
||||||
|
*/
|
||||||
|
private String gbsNvrNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道号
|
||||||
|
*/
|
||||||
|
private Integer channelNo;
|
||||||
|
|
||||||
|
private String plateNo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.ssf.mysqloracletest.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ssf.mysqloracletest.domain.DevopsVideoInfo0;
|
||||||
|
import com.ssf.mysqloracletest.domain.vo.DevopsVideoInfoVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频监控设备表(DevopsVideoInfo)Mapper
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2023-11-29 09:33:21
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface DevopsVideoInfoMapper extends BaseMapper<DevopsVideoInfo0> {
|
||||||
|
|
||||||
|
@Select(" select " +
|
||||||
|
" *, " +
|
||||||
|
" CONCAT('苏',SUBSTRING_INDEX(SUBSTRING_INDEX(device_name, '苏', -1), ' ', 1) ) AS plate_no " +
|
||||||
|
" from devops_video_info where device_name like '%苏J%' ")
|
||||||
|
public List<DevopsVideoInfoVo> listPoliceVehicle(DevopsVideoInfo0 bean) ;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.ssf.mysqloracletest.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ssf.mysqloracletest.domain.DevopsVideoInfo0;
|
||||||
|
import com.ssf.mysqloracletest.domain.dto.DevopsVideoInfoDto;
|
||||||
|
import com.ssf.mysqloracletest.domain.vo.DevopsVideoInfoVo;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频监控设备表(DevopsVideoInfo)Service
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2023-11-29 09:33:20
|
||||||
|
*/
|
||||||
|
public interface DevopsVideoInfoService0 extends IService<DevopsVideoInfo0> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增或者更新视频监控设备表
|
||||||
|
*
|
||||||
|
* @param devopsVideoInfo 视频监控设备表对象
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean insertOrUpdate(DevopsVideoInfo0 devopsVideoInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入视频监控设备表
|
||||||
|
*
|
||||||
|
* @param list 视频监控设备表列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Object importData(List<DevopsVideoInfo0> list);
|
||||||
|
|
||||||
|
public String yjdr(DevopsVideoInfoDto bean);
|
||||||
|
|
||||||
|
public List<DevopsVideoInfoVo> listPoliceVehicle(DevopsVideoInfo0 bean);
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.ssf.mysqloracletest.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ssf.mysqloracletest.domain.DevopsVideoStatus;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频监控状态表(DevopsVideoStatus)Service
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2023-11-29 09:33:21
|
||||||
|
*/
|
||||||
|
public interface DevopsVideoStatusService extends IService<DevopsVideoStatus> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增或者更新视频监控状态表
|
||||||
|
*
|
||||||
|
* @param devopsVideoStatus 视频监控状态表对象
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean insertOrUpdate(DevopsVideoStatus devopsVideoStatus);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入视频监控状态表
|
||||||
|
*
|
||||||
|
* @param list 视频监控状态表列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Object importData(List<DevopsVideoStatus> list);
|
||||||
|
|
||||||
|
int getGbsListOnline();
|
||||||
|
}
|
@ -0,0 +1,188 @@
|
|||||||
|
package com.ssf.mysqloracletest.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.jsoup.Connection;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class JsoupUtils {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(JsoupUtils.class);
|
||||||
|
|
||||||
|
public static String getJsoupDocGet(String url) {
|
||||||
|
//三次试错
|
||||||
|
final int MAX = 10;
|
||||||
|
int time = 0;
|
||||||
|
Document doc = null;
|
||||||
|
while (time < MAX) {
|
||||||
|
try {
|
||||||
|
doc = Jsoup
|
||||||
|
.connect(url)
|
||||||
|
.ignoreContentType(true)
|
||||||
|
.ignoreHttpErrors(true)
|
||||||
|
.timeout(1000 * 30)
|
||||||
|
.userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36")
|
||||||
|
.header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
|
||||||
|
.header("accept-encoding", "gzip, deflate, br")
|
||||||
|
.header("accept-language", "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7")
|
||||||
|
.maxBodySize(0)
|
||||||
|
.get();
|
||||||
|
String text = doc.text();
|
||||||
|
if (text.contains("illegal")) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return doc.text();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info(StringKit.getTrace(e));
|
||||||
|
} finally {
|
||||||
|
time++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//将文件传入 post请求中
|
||||||
|
public static String doPostFileRequest(String url, Map<String, String> param, InputStream fis, String fileName) throws Exception {
|
||||||
|
try {
|
||||||
|
Connection conn = Jsoup.connect(url);
|
||||||
|
if (param != null) {
|
||||||
|
conn.data(param);
|
||||||
|
}
|
||||||
|
conn.data("imagefile", fileName, fis);
|
||||||
|
Connection.Response response = conn.timeout(50000)
|
||||||
|
.ignoreContentType(true)
|
||||||
|
.maxBodySize(0)
|
||||||
|
.followRedirects(true)
|
||||||
|
.method(Connection.Method.POST).execute();
|
||||||
|
return response.body();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new Exception(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* post 请求通用入口
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String jsoupPost(String url, Map<String, Object> map, String json) {
|
||||||
|
String res = "";
|
||||||
|
try {
|
||||||
|
Connection con = Jsoup.connect(url);
|
||||||
|
con.requestBody(json);
|
||||||
|
con.header("Content-Type", "application/json");
|
||||||
|
con.ignoreContentType(true);
|
||||||
|
Document doc = con.timeout(50000).post();
|
||||||
|
res = doc.text();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info(StringKit.getTrace(e));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String jsoupPost(String url, Map<String, Object> map) {
|
||||||
|
String res = "";
|
||||||
|
try {
|
||||||
|
Connection con = Jsoup.connect(url);
|
||||||
|
if (map != null && map.size() > 0) {
|
||||||
|
Set<String> sets = map.keySet();
|
||||||
|
for (String s : sets) {
|
||||||
|
con.data(s, StringKit.toString(map.get(s)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
con.ignoreContentType(true);
|
||||||
|
Document doc =
|
||||||
|
con.timeout(50000)
|
||||||
|
.post();
|
||||||
|
res = doc.text();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info(StringKit.getTrace(e));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Gbs平台token
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getGbsToken() {
|
||||||
|
String urlToken = "";
|
||||||
|
try {
|
||||||
|
String gbsIp = PropertiesUtil.queryPropertiesByKey("gbsIp");
|
||||||
|
if (StringUtils.isBlank(gbsIp)) {
|
||||||
|
gbsIp = "127.0.0.1";
|
||||||
|
}
|
||||||
|
String gbsPort = PropertiesUtil.queryPropertiesByKey("gbsPort");
|
||||||
|
String url = "http://" + gbsIp + ":" + gbsPort + "/api/v1/login?username=admin&password=af7548eedff8e737c0e4b2a669497290&url_token_only=true";
|
||||||
|
String res = JsoupUtils.getJsoupDocGet(url);
|
||||||
|
JSONObject loginResJson = JSON.parseObject(res);
|
||||||
|
if (loginResJson != null) {
|
||||||
|
urlToken = StringKit.toString(loginResJson.get("URLToken"));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info(StringKit.getTrace(e));
|
||||||
|
}
|
||||||
|
return urlToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getGbsToken(String ip) {
|
||||||
|
String urlToken = "";
|
||||||
|
try {
|
||||||
|
String gbsIp = PropertiesUtil.queryPropertiesByKey("gbsIp");
|
||||||
|
if (StringUtils.isBlank(gbsIp)) {
|
||||||
|
gbsIp = ip;
|
||||||
|
}
|
||||||
|
String gbsPort = PropertiesUtil.queryPropertiesByKey("gbsPort");
|
||||||
|
String url = "http://" + gbsIp + ":" + gbsPort + "/api/v1/login?username=admin&password=af7548eedff8e737c0e4b2a669497290&url_token_only=true";
|
||||||
|
String res = JsoupUtils.getJsoupDocGet(url);
|
||||||
|
JSONObject loginResJson = JSON.parseObject(res);
|
||||||
|
if (loginResJson != null) {
|
||||||
|
urlToken = StringKit.toString(loginResJson.get("URLToken"));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return urlToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取NVR平台token
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getNvrToken() {
|
||||||
|
String urlToken = "";
|
||||||
|
try {
|
||||||
|
String nvrIp = PropertiesUtil.queryPropertiesByKey("nvrIp");
|
||||||
|
String nvrPort = PropertiesUtil.queryPropertiesByKey("nvrPort");
|
||||||
|
String url = "http://" + nvrIp + ":" + nvrPort + "/api/v1/login?username=admin&password=af7548eedff8e737c0e4b2a669497290&url_token_only=true";
|
||||||
|
String res = JsoupUtils.getJsoupDocGet(url);
|
||||||
|
JSONObject loginResJson = JSON.parseObject(res);
|
||||||
|
JSONObject liveQing = JSON.parseObject(StringKit.toString(loginResJson.get("LiveQing")));
|
||||||
|
JSONObject body = JSON.parseObject(StringKit.toString(liveQing.get("Body")));
|
||||||
|
urlToken = StringKit.toString(body.get("URLToken"));
|
||||||
|
if (StringUtils.isNotBlank(urlToken)) {
|
||||||
|
System.out.println("urlToken:" + urlToken);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return urlToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue