1078-单条存储多媒体数据检索上传命令
This commit is contained in:
@@ -44,6 +44,7 @@ public class JT1078Template {
|
|||||||
private static final String H8802 = "8802";
|
private static final String H8802 = "8802";
|
||||||
private static final String H8803 = "8803";
|
private static final String H8803 = "8803";
|
||||||
private static final String H8804 = "8804";
|
private static final String H8804 = "8804";
|
||||||
|
private static final String H8805 = "8805";
|
||||||
private static final String H9101 = "9101";
|
private static final String H9101 = "9101";
|
||||||
private static final String H9102 = "9102";
|
private static final String H9102 = "9102";
|
||||||
private static final String H9201 = "9201";
|
private static final String H9201 = "9201";
|
||||||
@@ -618,4 +619,15 @@ public class JT1078Template {
|
|||||||
.build();
|
.build();
|
||||||
return SessionManager.INSTANCE.request(cmd, timeOut);
|
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);
|
fail.setData(resultList);
|
||||||
deferredResult.setResult(fail);
|
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()) {
|
if (ids.isEmpty()) {
|
||||||
deferredResult.setResult(WVPResult.fail(ErrorCode.ERROR100));
|
deferredResult.setResult(WVPResult.fail(ErrorCode.ERROR100));
|
||||||
return deferredResult;
|
return deferredResult;
|
||||||
@@ -840,7 +848,12 @@ public class JT1078Controller {
|
|||||||
return deferredResult;
|
return deferredResult;
|
||||||
}
|
}
|
||||||
taskExecutor.execute(()->{
|
taskExecutor.execute(()->{
|
||||||
|
if (param.getMediaId() != null) {
|
||||||
|
service.uploadMediaDataForSingle(param.getDeviceId(), param.getMediaId(), param.getDelete());
|
||||||
|
}else {
|
||||||
service.uploadMediaData(param.getDeviceId(), param.getQueryMediaDataCommand());
|
service.uploadMediaData(param.getDeviceId(), param.getQueryMediaDataCommand());
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
return deferredResult;
|
return deferredResult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ public class QueryMediaDataParam {
|
|||||||
@Schema(description = "设备")
|
@Schema(description = "设备")
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
@Schema(description = "多媒体 ID, 单条存储多媒体数据检索上传时有效")
|
||||||
|
private Long mediaId;
|
||||||
|
|
||||||
|
@Schema(description = "删除标志, 单条存储多媒体数据检索上传时有效")
|
||||||
|
private int delete;
|
||||||
|
|
||||||
@Schema(description = "存储多媒体数据参数")
|
@Schema(description = "存储多媒体数据参数")
|
||||||
private JTQueryMediaDataCommand queryMediaDataCommand;
|
private JTQueryMediaDataCommand queryMediaDataCommand;
|
||||||
|
|
||||||
@@ -29,10 +35,27 @@ public class QueryMediaDataParam {
|
|||||||
this.queryMediaDataCommand = queryMediaDataCommand;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "QueryMediaDataParam{" +
|
return "QueryMediaDataParam{" +
|
||||||
"deviceId='" + deviceId + '\'' +
|
"deviceId='" + deviceId + '\'' +
|
||||||
|
", mediaId=" + mediaId +
|
||||||
", queryMediaDataCommand=" + queryMediaDataCommand +
|
", 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 uploadMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand);
|
||||||
|
|
||||||
void record(String deviceId, int command, Integer time, Integer save, Integer samplingRate);
|
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);
|
j8804.setSamplingRate(samplingRate);
|
||||||
jt1078Template.record(deviceId, j8804, 10);
|
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