[1078] 增加音视频属性查询

This commit is contained in:
lin
2025-07-22 20:51:03 +08:00
parent 79ee116174
commit c0ab010475
13 changed files with 170 additions and 78 deletions

View File

@@ -1029,8 +1029,7 @@ public class JT1078Controller {
@Operation(summary = "JT-查询终端音视频属性", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
@GetMapping("/media/attribute")
public JTMediaAttribute queryMediaAttribute(HttpServletRequest request,
@Parameter(required = true) String phoneNumber
public JTMediaAttribute queryMediaAttribute( @Parameter(required = true) String phoneNumber
) {
return service.queryMediaAttribute(phoneNumber);
}

View File

@@ -59,6 +59,8 @@ public class JT1078TerminalController {
@PostMapping("/add")
public void addDevice(JTDevice device){
assert device.getPhoneNumber() != null;
String phoneNumber = device.getPhoneNumber().replaceFirst("^0*", "");
device.setPhoneNumber(phoneNumber);
service.addDevice(device);
}
@Operation(summary = "删除设备", security = @SecurityRequirement(name = JwtUtils.HEADER))

View File

@@ -1,12 +1,14 @@
package com.genersoft.iot.vmp.jt1078.proc.entity;
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
import lombok.Data;
/**
* @author QingtaiJiang
* @date 2023/4/27 18:23
* @email qingtaij@163.com
*/
@Data
public class Cmd {
String phoneNumber;
Long packageNo;
@@ -25,46 +27,6 @@ public class Cmd {
this.rs = builder.rs;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Long getPackageNo() {
return packageNo;
}
public void setPackageNo(Long packageNo) {
this.packageNo = packageNo;
}
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getRespId() {
return respId;
}
public void setRespId(String respId) {
this.respId = respId;
}
public Rs getRs() {
return rs;
}
public void setRs(Rs rs) {
this.rs = rs;
}
public static class Builder {
String phoneNumber;
Long packageNo;

View File

@@ -23,18 +23,9 @@ import java.nio.charset.Charset;
@MsgId(id = "0107")
public class J0107 extends Re {
private final static Logger logger = LoggerFactory.getLogger(J0107.class);
Integer respNo;
Integer paramLength;
@Override
protected Rs decode0(ByteBuf buf, Header header, Session session) {
// respNo = buf.readUnsignedShort();
// paramLength = (int) buf.readUnsignedByte();
// if (paramLength <= 0) {
// return null;
// }
JTDeviceAttribute deviceAttribute = new JTDeviceAttribute();
deviceAttribute.setType(JTDeviceType.getInstance(buf.readUnsignedShort()));

View File

@@ -33,20 +33,20 @@ public class J0801 extends Re {
protected Rs decode0(ByteBuf buf, Header header, Session session) {
JTMediaEventInfo mediaEventInfo = JTMediaEventInfo.decode(buf);
log.info("[JT-多媒体数据上传]: {}", mediaEventInfo);
try {
if (mediaEventInfo.getMediaData() != null) {
File file = new File("/home/lin/source.jpg");
if (file.exists()) {
file.delete();
}
FileOutputStream fileOutputStream = new FileOutputStream(file);
fileOutputStream.write(mediaEventInfo.getMediaData());
fileOutputStream.flush();
fileOutputStream.close();
}
}catch (Exception e) {
log.error("[JT-多媒体数据上传] 写入文件异常", e);
}
// try {
// if (mediaEventInfo.getMediaData() != null) {
// File file = new File("/home/lin/source.jpg");
// if (file.exists()) {
// file.delete();
// }
// FileOutputStream fileOutputStream = new FileOutputStream(file);
// fileOutputStream.write(mediaEventInfo.getMediaData());
// fileOutputStream.flush();
// fileOutputStream.close();
// }
// }catch (Exception e) {
// log.error("[JT-多媒体数据上传] 写入文件异常", e);
// }
SessionManager.INSTANCE.response(header.getPhoneNumber(), "0801", null, mediaEventInfo);
return null;
}

View File

@@ -781,6 +781,8 @@ public class jt1078ServiceImpl implements Ijt1078Service {
j8801.setCommand(shootingCommand);
log.info("[JT-抓图] 设备编号: {} 通道编号: {}", phoneNumber, channelId);
// 监听文件上传, 存在设备不回复抓图请求或者回复通用回复,导致缺少抓图编号,但是直接上传文件的,此处通过监听文件上传直接获取文件
@SuppressWarnings("unchecked")
List<Long> ids = (List<Long>) jt1078Template.shooting(phoneNumber, j8801, 300);
log.info("[JT-抓图] 抓图编号: {} 设备编号: {} 通道编号: {}", ids.get(0), phoneNumber, channelId);

View File

@@ -56,7 +56,7 @@ public enum SessionManager {
* @param clientId 设备ID
* @param newSession session
*/
protected void put(Object clientId, Session newSession) {
void put(Object clientId, Session newSession) {
sessionMap.put(clientId, newSession);
}

View File

@@ -322,7 +322,7 @@ public class ABLRESTfulUtils {
// 3 XHB (一家公司的打包格式) 只支持视频,音频不能加入打包
// 4 、Jt10782016版本码流接入
param.put("RtpPayloadDataType", 4);
param.put("jtt1078_version", "2016");
param.put("jtt1078_version", "2019");
}
if (port != null) {
param.put("port", port);