[1078] 完善立即拍摄的结果查询和下载
This commit is contained in:
@@ -2,7 +2,11 @@ package com.genersoft.iot.vmp.jt1078.bean;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@Schema(description = "多媒体检索项数据")
|
||||
public class JTMediaDataInfo {
|
||||
|
||||
@@ -31,46 +35,6 @@ public class JTMediaDataInfo {
|
||||
return jtMediaEventInfo;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getEventCode() {
|
||||
return eventCode;
|
||||
}
|
||||
|
||||
public void setEventCode(int eventCode) {
|
||||
this.eventCode = eventCode;
|
||||
}
|
||||
|
||||
public int getChannelId() {
|
||||
return channelId;
|
||||
}
|
||||
|
||||
public void setChannelId(int channelId) {
|
||||
this.channelId = channelId;
|
||||
}
|
||||
|
||||
public JTPositionBaseInfo getPositionBaseInfo() {
|
||||
return positionBaseInfo;
|
||||
}
|
||||
|
||||
public void setPositionBaseInfo(JTPositionBaseInfo positionBaseInfo) {
|
||||
this.positionBaseInfo = positionBaseInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JTMediaDataInfo{" +
|
||||
|
||||
@@ -5,7 +5,11 @@ import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@Schema(description = "存储多媒体数据")
|
||||
public class JTQueryMediaDataCommand {
|
||||
|
||||
@@ -49,54 +53,6 @@ public class JTQueryMediaDataCommand {
|
||||
return byteBuf;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getChanelId() {
|
||||
return chanelId;
|
||||
}
|
||||
|
||||
public void setChanelId(int chanelId) {
|
||||
this.chanelId = chanelId;
|
||||
}
|
||||
|
||||
public int getEvent() {
|
||||
return event;
|
||||
}
|
||||
|
||||
public void setEvent(int event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public Integer getDelete() {
|
||||
return delete;
|
||||
}
|
||||
|
||||
public void setDelete(Integer delete) {
|
||||
this.delete = delete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JTQueryMediaDataCommand{" +
|
||||
|
||||
@@ -4,8 +4,11 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "拍摄命令参数")
|
||||
public class JTShootingCommand {
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@ public class JT1078Controller {
|
||||
|
||||
@Operation(summary = "JT-查询终端参数", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
|
||||
@GetMapping("/config")
|
||||
@GetMapping("/config/get")
|
||||
public JTDeviceConfig config(String phoneNumber, String[] params){
|
||||
|
||||
log.info("[JT-查询终端参数] phoneNumber:{}", phoneNumber);
|
||||
@@ -429,7 +429,7 @@ public class JT1078Controller {
|
||||
@Operation(summary = "JT-设置终端参数", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "config", description = "终端参数", required = true)
|
||||
@PostMapping("/set-config")
|
||||
@PostMapping("/config/set")
|
||||
public void setConfig(@RequestBody SetConfigParam config){
|
||||
|
||||
log.info("[JT-设置终端参数] 参数: {}", config.toString());
|
||||
@@ -898,7 +898,7 @@ public class JT1078Controller {
|
||||
@Operation(summary = "JT-单条存储多媒体数据上传", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "mediaId", description = "多媒体ID", required = true)
|
||||
@GetMapping("/media/upload/one")
|
||||
@GetMapping("/media/upload/one/upload")
|
||||
public void uploadOneMedia(HttpServletResponse response, String phoneNumber, Long mediaId){
|
||||
|
||||
log.info("[JT-单条存储多媒体数据上传] 设备编号: {}, 多媒体ID: {}", phoneNumber, mediaId );
|
||||
@@ -906,7 +906,24 @@ public class JT1078Controller {
|
||||
try {
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
service.uploadOneMedia(phoneNumber, mediaId, outputStream);
|
||||
service.uploadOneMedia(phoneNumber, mediaId, outputStream, false);
|
||||
}catch (Exception e) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "JT-单条存储多媒体数据删除", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "phoneNumber", description = "设备编号", required = true)
|
||||
@Parameter(name = "mediaId", description = "多媒体ID", required = true)
|
||||
@GetMapping("/media/upload/one/delete")
|
||||
public void deleteOneMedia(HttpServletResponse response, String phoneNumber, Long mediaId){
|
||||
|
||||
log.info("[JT-单条存储多媒体数据上传] 设备编号: {}, 多媒体ID: {}", phoneNumber, mediaId );
|
||||
Assert.notNull(mediaId, "缺少通道编号");
|
||||
try {
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
service.uploadOneMedia(phoneNumber, mediaId, outputStream, true);
|
||||
}catch (Exception e) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), e.getMessage());
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@ package com.genersoft.iot.vmp.jt1078.controller.bean;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTQueryMediaDataCommand;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTShootingCommand;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@Schema(description = "存储多媒体数据参数")
|
||||
public class QueryMediaDataParam {
|
||||
|
||||
@@ -19,38 +23,6 @@ public class QueryMediaDataParam {
|
||||
@Schema(description = "存储多媒体数据参数")
|
||||
private JTQueryMediaDataCommand queryMediaDataCommand;
|
||||
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public JTQueryMediaDataCommand getQueryMediaDataCommand() {
|
||||
return queryMediaDataCommand;
|
||||
}
|
||||
|
||||
public void setQueryMediaDataCommand(JTQueryMediaDataCommand 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
|
||||
public String toString() {
|
||||
return "QueryMediaDataParam{" +
|
||||
|
||||
@@ -2,6 +2,11 @@ package com.genersoft.iot.vmp.jt1078.controller.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTShootingCommand;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@Schema(description = "摄像头立即拍摄命令参数")
|
||||
public class ShootingParam {
|
||||
|
||||
@@ -11,22 +16,6 @@ public class ShootingParam {
|
||||
@Schema(description = "拍摄命令参数")
|
||||
private JTShootingCommand shootingCommand;
|
||||
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
public void setPhoneNumber(String phoneNumber) {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public JTShootingCommand getShootingCommand() {
|
||||
return shootingCommand;
|
||||
}
|
||||
|
||||
public void setShootingCommand(JTShootingCommand shootingCommand) {
|
||||
this.shootingCommand = shootingCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ShootingParam{" +
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public interface Ijt1078Service {
|
||||
|
||||
void snap(String phoneNumber, int channelId, ServletOutputStream outputStream);
|
||||
|
||||
void uploadOneMedia(String phoneNumber, Long mediaId, ServletOutputStream outputStream);
|
||||
void uploadOneMedia(String phoneNumber, Long mediaId, ServletOutputStream outputStream, boolean delete);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -807,11 +807,11 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadOneMedia(String phoneNumber, Long mediaId, ServletOutputStream outputStream) {
|
||||
public void uploadOneMedia(String phoneNumber, Long mediaId, ServletOutputStream outputStream, boolean delete) {
|
||||
log.info("[JT-单条存储多媒体数据上传] 媒体编号: {}, 设备编号: {}", mediaId, phoneNumber);
|
||||
J8805 j8805 = new J8805();
|
||||
j8805.setMediaId(mediaId);
|
||||
j8805.setDelete(1);
|
||||
j8805.setDelete(delete ? 1 : 0);
|
||||
log.info("[JT-单条存储多媒体数据上传] 请求上传,媒体编号: {}, 设备编号: {}", mediaId, phoneNumber);
|
||||
JTMediaEventInfo mediaEventInfo = (JTMediaEventInfo)jt1078Template.uploadMediaDataForSingle(phoneNumber, j8805, 600);
|
||||
if (mediaEventInfo == null) {
|
||||
|
||||
Reference in New Issue
Block a user