1078-单条存储多媒体数据检索上传命令
This commit is contained in:
@@ -44,6 +44,7 @@ public class JT1078Template {
|
||||
private static final String H8802 = "8802";
|
||||
private static final String H8803 = "8803";
|
||||
private static final String H8804 = "8804";
|
||||
private static final String H8805 = "8805";
|
||||
private static final String H9101 = "9101";
|
||||
private static final String H9102 = "9102";
|
||||
private static final String H9201 = "9201";
|
||||
@@ -618,4 +619,15 @@ public class JT1078Template {
|
||||
.build();
|
||||
return SessionManager.INSTANCE.request(cmd, timeOut);
|
||||
}
|
||||
|
||||
public Object uploadMediaDataForSingle(String devId, J8805 j8805, int timeOut) {
|
||||
Cmd cmd = new Cmd.Builder()
|
||||
.setDevId(devId)
|
||||
.setPackageNo(randomInt())
|
||||
.setMsgId(H8805)
|
||||
.setRespId(H0801)
|
||||
.setRs(j8805)
|
||||
.build();
|
||||
return SessionManager.INSTANCE.request(cmd, timeOut);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -808,7 +808,15 @@ public class JT1078Controller {
|
||||
fail.setData(resultList);
|
||||
deferredResult.setResult(fail);
|
||||
});
|
||||
List<JTMediaDataInfo> ids = service.queryMediaData(param.getDeviceId(), param.getQueryMediaDataCommand());
|
||||
List<JTMediaDataInfo> ids;
|
||||
if (param.getMediaId() != null) {
|
||||
ids = new ArrayList<>();
|
||||
JTMediaDataInfo mediaDataInfo = new JTMediaDataInfo();
|
||||
mediaDataInfo.setId(param.getMediaId());
|
||||
ids.add(mediaDataInfo);
|
||||
}else {
|
||||
ids = service.queryMediaData(param.getDeviceId(), param.getQueryMediaDataCommand());
|
||||
}
|
||||
if (ids.isEmpty()) {
|
||||
deferredResult.setResult(WVPResult.fail(ErrorCode.ERROR100));
|
||||
return deferredResult;
|
||||
@@ -840,7 +848,12 @@ public class JT1078Controller {
|
||||
return deferredResult;
|
||||
}
|
||||
taskExecutor.execute(()->{
|
||||
service.uploadMediaData(param.getDeviceId(), param.getQueryMediaDataCommand());
|
||||
if (param.getMediaId() != null) {
|
||||
service.uploadMediaDataForSingle(param.getDeviceId(), param.getMediaId(), param.getDelete());
|
||||
}else {
|
||||
service.uploadMediaData(param.getDeviceId(), param.getQueryMediaDataCommand());
|
||||
}
|
||||
|
||||
});
|
||||
return deferredResult;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,12 @@ public class QueryMediaDataParam {
|
||||
@Schema(description = "设备")
|
||||
private String deviceId;
|
||||
|
||||
@Schema(description = "多媒体 ID, 单条存储多媒体数据检索上传时有效")
|
||||
private Long mediaId;
|
||||
|
||||
@Schema(description = "删除标志, 单条存储多媒体数据检索上传时有效")
|
||||
private int delete;
|
||||
|
||||
@Schema(description = "存储多媒体数据参数")
|
||||
private JTQueryMediaDataCommand queryMediaDataCommand;
|
||||
|
||||
@@ -29,10 +35,27 @@ public class QueryMediaDataParam {
|
||||
this.queryMediaDataCommand = queryMediaDataCommand;
|
||||
}
|
||||
|
||||
public int getDelete() {
|
||||
return delete;
|
||||
}
|
||||
|
||||
public void setDelete(int delete) {
|
||||
this.delete = delete;
|
||||
}
|
||||
|
||||
public Long getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(Long mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QueryMediaDataParam{" +
|
||||
"deviceId='" + deviceId + '\'' +
|
||||
", mediaId=" + mediaId +
|
||||
", queryMediaDataCommand=" + queryMediaDataCommand +
|
||||
'}';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.genersoft.iot.vmp.jt1078.proc.response;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTQueryMediaDataCommand;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 单条存储多媒体数据检索上传命令
|
||||
*/
|
||||
@MsgId(id = "8805")
|
||||
public class J8805 extends Rs {
|
||||
|
||||
/**
|
||||
* 多媒体 ID
|
||||
*/
|
||||
private Long mediaId;
|
||||
|
||||
/**
|
||||
* 删除标志, 0:保留;1:删除, 存储多媒体数据上传命令中使用
|
||||
*/
|
||||
private Integer delete;
|
||||
|
||||
@Override
|
||||
public ByteBuf encode() {
|
||||
ByteBuf byteBuf = Unpooled.buffer();
|
||||
byteBuf.writeInt((int) (mediaId & 0xffffffffL));
|
||||
byteBuf.writeByte(delete);
|
||||
return byteBuf;
|
||||
}
|
||||
|
||||
public Long getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(Long mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public Integer getDelete() {
|
||||
return delete;
|
||||
}
|
||||
|
||||
public void setDelete(Integer delete) {
|
||||
this.delete = delete;
|
||||
}
|
||||
}
|
||||
@@ -103,4 +103,6 @@ public interface Ijt1078Service {
|
||||
void uploadMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand);
|
||||
|
||||
void record(String deviceId, int command, Integer time, Integer save, Integer samplingRate);
|
||||
|
||||
void uploadMediaDataForSingle(String deviceId, Long mediaId, Integer delete);
|
||||
}
|
||||
|
||||
@@ -736,4 +736,12 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
j8804.setSamplingRate(samplingRate);
|
||||
jt1078Template.record(deviceId, j8804, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadMediaDataForSingle(String deviceId, Long mediaId, Integer delete) {
|
||||
J8805 j8805 = new J8805();
|
||||
j8805.setMediaId(mediaId);
|
||||
j8805.setDelete(delete);
|
||||
jt1078Template.uploadMediaDataForSingle(deviceId, j8805, 10);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user