物联设备管理同步调整
This commit is contained in:
parent
e851bdc3f7
commit
1b7aef3095
|
|
@ -84,4 +84,6 @@ public class IotCameraInfoMQDto{
|
|||
private String maintainStatus;
|
||||
/**日志ID*/
|
||||
private String logId;
|
||||
private String dimension;//设备维度
|
||||
private String channel;//通道号
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,4 +38,5 @@ public class IotElectricityMeterMQDto{
|
|||
private String maintainStatus;
|
||||
/**日志ID*/
|
||||
private String logId;
|
||||
private String dimension;//设备维度
|
||||
}
|
||||
|
|
@ -72,4 +72,5 @@ public class IotHumidDeviceMQDto{
|
|||
private String maintainStatus;
|
||||
/**日志ID*/
|
||||
private String logId;
|
||||
private String dimension;//设备维度
|
||||
}
|
||||
|
|
@ -42,4 +42,5 @@ public class IotWaterMeterMQDto{
|
|||
private String maintainStatus;
|
||||
/**日志ID*/
|
||||
private String logId;
|
||||
private String dimension;//设备维度
|
||||
}
|
||||
|
|
@ -148,6 +148,17 @@ public class CameraInfoController extends JeecgController<CameraInfo, ICameraInf
|
|||
return service.syncProjectIpcDevice(cameraInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备详情信息
|
||||
*
|
||||
* @param cameraInfo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getDeviceDetails")
|
||||
public Result<JSONObject> getDeviceDetails(CameraInfo cameraInfo) {
|
||||
return service.getDeviceDetails(cameraInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取画面基本信息
|
||||
*
|
||||
|
|
@ -170,6 +181,28 @@ public class CameraInfoController extends JeecgController<CameraInfo, ICameraInf
|
|||
return service.setImageCommon(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取画面操作信息
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/getImageSwitch")
|
||||
public Result<JSONObject> getImageSwitch(@RequestBody Map<String,Object> map) {
|
||||
return service.getImageSwitch(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置画面操作信息
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/setImageSwitch")
|
||||
public Result setImageSwitch(@RequestBody Map<String,Object> map) {
|
||||
return service.setImageSwitch(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取OSD能力集
|
||||
*
|
||||
|
|
|
|||
|
|
@ -320,4 +320,6 @@ public class CameraInfo implements Serializable {
|
|||
/**维修状态*/
|
||||
private String maintainStatus;
|
||||
private String remarks;//备注
|
||||
private String channel;//通道号
|
||||
private String dimension;//设备维度
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@
|
|||
a.nu_id as nuId,
|
||||
b.nu_name as nuName,
|
||||
ifnull(c.multitrans,0) as multitrans,
|
||||
a.sn,a.maintain_status
|
||||
a.sn,
|
||||
a.maintain_status,
|
||||
a.channel
|
||||
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.nu_id
|
||||
left join nu_iot_tplink_camera_capability c on a.device_index = c.device_index
|
||||
<where>
|
||||
|
|
@ -88,7 +90,8 @@
|
|||
protocol as protocol,
|
||||
record_plan_id as recordPlanId,
|
||||
a.nu_id as nuId,
|
||||
b.nu_name as nuName
|
||||
b.nu_name as nuName,
|
||||
a.channel
|
||||
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.nu_id
|
||||
<where>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
|
|
@ -127,7 +130,8 @@
|
|||
system_type as systemType,
|
||||
protocol as protocol,
|
||||
record_plan_id as recordPlanId,
|
||||
nu_id as nuId
|
||||
nu_id as nuId,
|
||||
a.channel
|
||||
from nu_iot_tplink_camera a
|
||||
</select>
|
||||
|
||||
|
|
@ -170,7 +174,8 @@
|
|||
system_type as systemType,
|
||||
protocol as protocol,
|
||||
a.nu_id as nuId,
|
||||
b.nu_name as nuName
|
||||
b.nu_name as nuName,
|
||||
a.channel
|
||||
from nu_iot_tplink_camera a left join nu_base_info b on a.nu_id = b.nu_id
|
||||
where device_index = #{deviceIndex}
|
||||
</select>
|
||||
|
|
@ -262,7 +267,10 @@
|
|||
|
||||
<update id="updateDeviceStatusByDevId">
|
||||
UPDATE nu_iot_tplink_camera
|
||||
SET device_status = #{deviceStatus}
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deviceStatus != null">device_status = #{deviceStatus},</if>
|
||||
<if test="channel != null">channel = #{channel},</if>
|
||||
</trim>
|
||||
where device_index = #{deviceIndex}
|
||||
</update>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@ public interface ICameraInfoService extends IService<CameraInfo> {
|
|||
void syncCapability(String deviceIndex,String jsonResponse);
|
||||
Result<String> syncProjectIpcDevice(CameraInfo cameraInfo);
|
||||
Result<JSONObject> getIpcCapability(CameraInfo cameraInfo);
|
||||
Result<JSONObject> getDeviceDetails(CameraInfo cameraInfo);
|
||||
Result<JSONObject> getImageCommon(Map<String,Object> map);
|
||||
Result setImageCommon(Map<String,Object> map);
|
||||
Result<JSONObject> getImageSwitch(Map<String,Object> map);
|
||||
Result setImageSwitch(Map<String,Object> map);
|
||||
Result<JSONObject> getOsdCapability(Map<String,Object> map);
|
||||
Result<JSONObject> getOsd(Map<String,Object> map);
|
||||
Result<String> setOsd(Map<String,Object> map);
|
||||
|
|
|
|||
|
|
@ -404,6 +404,42 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口调用-获取设备详情信息
|
||||
* @param ci
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<JSONObject> getDeviceDetails(CameraInfo ci){
|
||||
String id = ci.getDeviceIndex();
|
||||
StringBuffer paramsSb = new StringBuffer();
|
||||
paramsSb.append("{");
|
||||
paramsSb.append("\"deviceIndex\"").append(":").append("\"").append(id).append("\"");
|
||||
paramsSb.append("}");
|
||||
String ipcCapabilityRes = tumsApi.getDeviceDetails(paramsSb.toString());
|
||||
JSONObject jsonObject = new JSONObject(ipcCapabilityRes);
|
||||
if(jsonObject.getInt("error_code").equals(0)){
|
||||
JSONObject json = (JSONObject)jsonObject.get("result");
|
||||
JSONObject extend = json.getJSONObject("extendInfo");
|
||||
String channel = extend.getStr("channel");
|
||||
try {
|
||||
String deviceIndex = json.getStr("deviceIndex");
|
||||
String deviceStatus = json.getStr("deviceStatus");
|
||||
CameraInfo cameraInfo = new CameraInfo();
|
||||
cameraInfo.setDeviceIndex(deviceIndex);
|
||||
cameraInfo.setDeviceStatus(deviceStatus);
|
||||
cameraInfo.setChannel(channel);
|
||||
baseMapper.updateDeviceStatusByDevId(cameraInfo);
|
||||
if(deviceStatus.equals("0")){
|
||||
return Result.error("设备已离线");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取画面基本信息
|
||||
*
|
||||
|
|
@ -534,6 +570,152 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取画面操作信息
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Result<JSONObject> getImageSwitch(Map<String,Object> map){
|
||||
String id = map.get("deviceIndex").toString();
|
||||
String type = map.get("type").toString();
|
||||
CameraInfo cameraInfo = new CameraInfo();
|
||||
cameraInfo.setDeviceIndex(id);
|
||||
cameraInfo = baseMapper.getByDeviceId(cameraInfo);
|
||||
String parentId = cameraInfo.getParentId();
|
||||
if(!parentId.equals("0")){
|
||||
id = parentId;
|
||||
type = "chn"+cameraInfo.getChannel()+"_switch";
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"devId\"").append(":").append("\"").append(id).append("\"").append(",");
|
||||
sb.append("\"param\"").append(":").append("{");
|
||||
sb.append("\"method\"").append(":").append("\"get\"").append(",");
|
||||
sb.append("\"image\"").append(":").append("{");
|
||||
sb.append("\"name\"").append(":").append("\"").append(type).append("\"");
|
||||
sb.append("}");
|
||||
sb.append("}");
|
||||
sb.append("}");
|
||||
String addPreviewRes = tumsApi.passthrough(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(addPreviewRes);
|
||||
String errCode = jsonObject.getStr("error_code");
|
||||
if("0".equals(errCode)){
|
||||
JSONObject result = (JSONObject)jsonObject.get("result");
|
||||
JSONObject responseData = (JSONObject)result.get("responseData");
|
||||
String errorCode = responseData.getStr("error_code");
|
||||
if("0".equals(errorCode)){
|
||||
JSONObject image = (JSONObject)responseData.get("image");
|
||||
JSONObject data = (JSONObject)image.get(type);
|
||||
updateDeviceStatus(id,errorCode);
|
||||
return Result.OK(data);
|
||||
}else{
|
||||
String errorMsg = "";
|
||||
try{
|
||||
ErrorCode errorVo = errorCodeService.getByCode(errorCode);
|
||||
errorMsg = errorVo.getErrorMsg();
|
||||
}catch (Exception e){
|
||||
errorMsg = errorCode;
|
||||
}
|
||||
updateDeviceStatus(id,errorCode);
|
||||
log.info("getImageCommon:{}",errorMsg);
|
||||
return Result.error(errorMsg);
|
||||
}
|
||||
}else{
|
||||
String errMsg = "";
|
||||
try{
|
||||
ErrorCode errVo = errorCodeService.getByCode(errCode);
|
||||
errMsg = errVo.getErrorMsg();
|
||||
}catch (Exception e){
|
||||
errMsg = errCode;
|
||||
}
|
||||
updateDeviceStatus(id,errCode);
|
||||
log.info("getImageCommon:{}",errMsg);
|
||||
return Result.error(errMsg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置画面操作信息
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Result setImageSwitch(Map<String,Object> map){
|
||||
String id = map.get("deviceIndex").toString();
|
||||
String type = map.get("type").toString();
|
||||
CameraInfo cameraInfo = new CameraInfo();
|
||||
cameraInfo.setDeviceIndex(id);
|
||||
cameraInfo = baseMapper.getByDeviceId(cameraInfo);
|
||||
String parentId = cameraInfo.getParentId();
|
||||
if(!parentId.equals("0")){
|
||||
id = parentId;
|
||||
type = "chn"+cameraInfo.getChannel()+"_switch";
|
||||
}
|
||||
Map<String,Object> paramMap = (Map<String,Object>)map.get("param");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"devId\"").append(":").append("\"").append(id).append("\"").append(",");
|
||||
sb.append("\"param\"").append(":").append("{");
|
||||
sb.append("\"method\"").append(":").append("\"set\"").append(",");
|
||||
sb.append("\"image\"").append(":").append("{");
|
||||
sb.append("\"").append(type).append("\"").append(":").append("{");
|
||||
//类属性+类值
|
||||
StringBuffer csb = new StringBuffer();
|
||||
Set<String> keys = paramMap.keySet();
|
||||
// 遍历键的集合并打印每个键
|
||||
for (String key : keys) {
|
||||
String value = paramMap.get(key).toString();
|
||||
csb.append("\"").append(key).append("\"").append(":").append("\"").append(value).append("\"").append(",");
|
||||
}
|
||||
String cstr = csb.toString();
|
||||
if(cstr.length()>0){
|
||||
cstr = cstr.substring(0,cstr.length()-1);
|
||||
}
|
||||
sb.append(cstr);
|
||||
sb.append("}");
|
||||
sb.append("}");
|
||||
sb.append("}");
|
||||
sb.append("}");
|
||||
String addPreviewRes = tumsApi.passthrough(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(addPreviewRes);
|
||||
String errCode = jsonObject.getStr("error_code");
|
||||
if("0".equals(errCode)){
|
||||
JSONObject result = (JSONObject)jsonObject.get("result");
|
||||
JSONObject responseData = (JSONObject)result.get("responseData");
|
||||
String errorCode = responseData.getStr("error_code");
|
||||
if("0".equals(errorCode)){
|
||||
return Result.OK("设置成功");
|
||||
}else{
|
||||
String errorMsg = "";
|
||||
try{
|
||||
ErrorCode errorVo = errorCodeService.getByCode(errorCode);
|
||||
errorMsg = errorVo.getErrorMsg();
|
||||
}catch (Exception e){
|
||||
errorMsg = errorCode;
|
||||
}
|
||||
updateDeviceStatus(id,errorCode);
|
||||
log.info("setImageCommon:{}",errorMsg);
|
||||
return Result.error(errorMsg);
|
||||
}
|
||||
}else{
|
||||
String errMsg = "";
|
||||
try{
|
||||
ErrorCode errVo = errorCodeService.getByCode(errCode);
|
||||
errMsg = errVo.getErrorMsg();
|
||||
}catch (Exception e){
|
||||
errMsg = errCode;
|
||||
}
|
||||
updateDeviceStatus(id,errCode);
|
||||
log.info("setImageCommon:{}",errMsg);
|
||||
return Result.error(errMsg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取OSD能力集参数
|
||||
*
|
||||
|
|
@ -2630,9 +2812,23 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("error", "0");
|
||||
map.put("error", "0");
|
||||
String id = cameraInfo.getVideoDevId();
|
||||
cameraInfo.setDeviceIndex(id);
|
||||
CameraInfo entity = baseMapper.getByDeviceId(cameraInfo);
|
||||
String parentId = entity.getParentId();
|
||||
String channelId = "0";
|
||||
if(!parentId.equals("0")){
|
||||
channelId = entity.getChannel();
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"devId\"").append(":").append("\"").append(cameraInfo.getVideoDevId()).append("\"");
|
||||
if(!parentId.equals("0")){
|
||||
sb.append("\"devId\"").append(":").append("\"").append(id).append("\"");
|
||||
}else{
|
||||
sb.append("\"devId\"").append(":").append("\"").append(parentId).append("\",");
|
||||
sb.append("\"videoDeviceIndex\"").append(":").append("\"").append(id).append("\",");
|
||||
sb.append("\"channelId\"").append(":").append(channelId);
|
||||
}
|
||||
sb.append("}");
|
||||
String res = tumsApi.getMultitransUrl(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(res);
|
||||
|
|
@ -2642,12 +2838,12 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
String url = result.getStr("rtspUrl");
|
||||
String wsUrl = result.getStr("wsUrl");
|
||||
String wssUrl = result.getStr("wssUrl");
|
||||
CameraInfo entity = new CameraInfo();
|
||||
entity.setVideoDevId(cameraInfo.getVideoDevId());
|
||||
entity.setUrl(url);
|
||||
entity.setWsUrl(wsUrl);
|
||||
entity.setWssUrl(wssUrl);
|
||||
map.put("data", entity);
|
||||
CameraInfo resVo = new CameraInfo();
|
||||
resVo.setVideoDevId(cameraInfo.getVideoDevId());
|
||||
resVo.setUrl(url);
|
||||
resVo.setWsUrl(wsUrl);
|
||||
resVo.setWssUrl(wssUrl);
|
||||
map.put("data", resVo);
|
||||
} else if (errorCode.equals("-80703")) {
|
||||
try {
|
||||
if (counter > 10) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public enum ApiEnum {
|
|||
QUERY_ALARM_LOG("/tums/logManager/v2/queryAlarmLog","查询告警日志列表"),
|
||||
QUERY_UNREAD_ALARM_MSG("/tums/logManager/v2/queryUnreadAlarmMsg","查询未读告警日志列表"),
|
||||
IPC_GET_IPC_CAPABILITY("/tums/deviceManager/v1/getIpcCapability","获取ipc能力集"),
|
||||
GET_DEVICE_DETAILS("/tums/deviceManager/v2/getDeviceDetails","获取设备详情信息"),
|
||||
IPC_PASSTHROUGH("/tums/devConfig/v1/passthrough","设备配置信息"),
|
||||
|
||||
IPC_ADD_PREVIEW_CHN("/tums/preview/v1/addPreviewChn","添加预览通道"),
|
||||
|
|
|
|||
|
|
@ -410,6 +410,19 @@ public class TumsApi {
|
|||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备详情信息
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String getDeviceDetails(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("getDeviceDetails:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.request(jsonRequest, ApiEnum.GET_DEVICE_DETAILS.getValue());
|
||||
log.info("getDeviceDetails:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备配置信息
|
||||
* @param jsonRequest
|
||||
|
|
|
|||
|
|
@ -80,5 +80,6 @@ public class ElectricityMeter implements Serializable {
|
|||
private String oldDepartName;//原机构名称
|
||||
/**维修状态*/
|
||||
private String maintainStatus;
|
||||
private String dimension;//设备维度
|
||||
|
||||
}
|
||||
|
|
@ -79,4 +79,5 @@ public class WaterMeter implements Serializable {
|
|||
private String departServerUrl;//机构服务地址
|
||||
/**维修状态*/
|
||||
private String maintainStatus;
|
||||
private String dimension;//设备维度
|
||||
}
|
||||
|
|
@ -118,4 +118,5 @@ public class HumidDevice implements Serializable {
|
|||
private String oldDepartName;//原机构名称
|
||||
/**维修状态*/
|
||||
private String maintainStatus;
|
||||
private String dimension;//设备维度
|
||||
}
|
||||
Loading…
Reference in New Issue