[1078] 完善立即拍摄的结果查询和下载

This commit is contained in:
lin 2025-07-25 17:49:22 +08:00
parent 43ef080f55
commit 34fb79093e
13 changed files with 109 additions and 167 deletions

View File

@ -2,7 +2,11 @@ package com.genersoft.iot.vmp.jt1078.bean;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
@Schema(description = "多媒体检索项数据") @Schema(description = "多媒体检索项数据")
public class JTMediaDataInfo { public class JTMediaDataInfo {
@ -31,46 +35,6 @@ public class JTMediaDataInfo {
return jtMediaEventInfo; 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 @Override
public String toString() { public String toString() {
return "JTMediaDataInfo{" + return "JTMediaDataInfo{" +

View File

@ -5,7 +5,11 @@ import com.genersoft.iot.vmp.utils.DateUtil;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
@Schema(description = "存储多媒体数据") @Schema(description = "存储多媒体数据")
public class JTQueryMediaDataCommand { public class JTQueryMediaDataCommand {
@ -49,54 +53,6 @@ public class JTQueryMediaDataCommand {
return byteBuf; 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 @Override
public String toString() { public String toString() {
return "JTQueryMediaDataCommand{" + return "JTQueryMediaDataCommand{" +

View File

@ -4,8 +4,11 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Data @Getter
@Setter
@Schema(description = "拍摄命令参数") @Schema(description = "拍摄命令参数")
public class JTShootingCommand { public class JTShootingCommand {

View File

@ -419,7 +419,7 @@ public class JT1078Controller {
@Operation(summary = "JT-查询终端参数", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "JT-查询终端参数", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "phoneNumber", description = "设备手机号", required = true) @Parameter(name = "phoneNumber", description = "设备手机号", required = true)
@GetMapping("/config") @GetMapping("/config/get")
public JTDeviceConfig config(String phoneNumber, String[] params){ public JTDeviceConfig config(String phoneNumber, String[] params){
log.info("[JT-查询终端参数] phoneNumber{}", phoneNumber); log.info("[JT-查询终端参数] phoneNumber{}", phoneNumber);
@ -429,7 +429,7 @@ public class JT1078Controller {
@Operation(summary = "JT-设置终端参数", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "JT-设置终端参数", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "phoneNumber", description = "设备编号", required = true) @Parameter(name = "phoneNumber", description = "设备编号", required = true)
@Parameter(name = "config", description = "终端参数", required = true) @Parameter(name = "config", description = "终端参数", required = true)
@PostMapping("/set-config") @PostMapping("/config/set")
public void setConfig(@RequestBody SetConfigParam config){ public void setConfig(@RequestBody SetConfigParam config){
log.info("[JT-设置终端参数] 参数: {}", config.toString()); log.info("[JT-设置终端参数] 参数: {}", config.toString());
@ -898,7 +898,7 @@ public class JT1078Controller {
@Operation(summary = "JT-单条存储多媒体数据上传", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "JT-单条存储多媒体数据上传", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "phoneNumber", description = "设备编号", required = true) @Parameter(name = "phoneNumber", description = "设备编号", required = true)
@Parameter(name = "mediaId", description = "多媒体ID", 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){ public void uploadOneMedia(HttpServletResponse response, String phoneNumber, Long mediaId){
log.info("[JT-单条存储多媒体数据上传] 设备编号: {}, 多媒体ID: {}", phoneNumber, mediaId ); log.info("[JT-单条存储多媒体数据上传] 设备编号: {}, 多媒体ID: {}", phoneNumber, mediaId );
@ -906,7 +906,24 @@ public class JT1078Controller {
try { try {
ServletOutputStream outputStream = response.getOutputStream(); ServletOutputStream outputStream = response.getOutputStream();
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); 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) { }catch (Exception e) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), e.getMessage()); throw new ControllerException(ErrorCode.ERROR100.getCode(), e.getMessage());
} }

View File

@ -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.JTQueryMediaDataCommand;
import com.genersoft.iot.vmp.jt1078.bean.JTShootingCommand; import com.genersoft.iot.vmp.jt1078.bean.JTShootingCommand;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
@Schema(description = "存储多媒体数据参数") @Schema(description = "存储多媒体数据参数")
public class QueryMediaDataParam { public class QueryMediaDataParam {
@ -19,38 +23,6 @@ public class QueryMediaDataParam {
@Schema(description = "存储多媒体数据参数") @Schema(description = "存储多媒体数据参数")
private JTQueryMediaDataCommand queryMediaDataCommand; 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 @Override
public String toString() { public String toString() {
return "QueryMediaDataParam{" + return "QueryMediaDataParam{" +

View File

@ -2,6 +2,11 @@ package com.genersoft.iot.vmp.jt1078.controller.bean;
import com.genersoft.iot.vmp.jt1078.bean.JTShootingCommand; import com.genersoft.iot.vmp.jt1078.bean.JTShootingCommand;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
@Schema(description = "摄像头立即拍摄命令参数") @Schema(description = "摄像头立即拍摄命令参数")
public class ShootingParam { public class ShootingParam {
@ -11,22 +16,6 @@ public class ShootingParam {
@Schema(description = "拍摄命令参数") @Schema(description = "拍摄命令参数")
private JTShootingCommand shootingCommand; 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 @Override
public String toString() { public String toString() {
return "ShootingParam{" + return "ShootingParam{" +

View File

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

View File

@ -125,7 +125,7 @@ public interface Ijt1078Service {
void snap(String phoneNumber, int channelId, ServletOutputStream outputStream); 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);
} }

View File

@ -807,11 +807,11 @@ public class jt1078ServiceImpl implements Ijt1078Service {
} }
@Override @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); log.info("[JT-单条存储多媒体数据上传] 媒体编号: {} 设备编号: {}", mediaId, phoneNumber);
J8805 j8805 = new J8805(); J8805 j8805 = new J8805();
j8805.setMediaId(mediaId); j8805.setMediaId(mediaId);
j8805.setDelete(1); j8805.setDelete(delete ? 1 : 0);
log.info("[JT-单条存储多媒体数据上传] 请求上传,媒体编号: {} 设备编号: {}", mediaId, phoneNumber); log.info("[JT-单条存储多媒体数据上传] 请求上传,媒体编号: {} 设备编号: {}", mediaId, phoneNumber);
JTMediaEventInfo mediaEventInfo = (JTMediaEventInfo)jt1078Template.uploadMediaDataForSingle(phoneNumber, j8805, 600); JTMediaEventInfo mediaEventInfo = (JTMediaEventInfo)jt1078Template.uploadMediaDataForSingle(phoneNumber, j8805, 600);
if (mediaEventInfo == null) { if (mediaEventInfo == null) {

View File

@ -215,7 +215,7 @@ export function stopPlayback(params) {
export function queryConfig(phoneNumber) { export function queryConfig(phoneNumber) {
return request({ return request({
method: 'get', method: 'get',
url: '/api/jt1078/config', url: '/api/jt1078/config/get',
params: { params: {
phoneNumber: phoneNumber phoneNumber: phoneNumber
} }
@ -224,7 +224,7 @@ export function queryConfig(phoneNumber) {
export function setConfig(data) { export function setConfig(data) {
return request({ return request({
method: 'post', method: 'post',
url: '/api/jt1078/set-config', url: '/api/jt1078/config/set',
data: data data: data
}) })
} }

View File

@ -8,6 +8,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="showDialog" :visible.sync="showDialog"
:destroy-on-close="true" :destroy-on-close="true"
:append-to-body="true"
@close="close()" @close="close()"
> >
<div id="shared" style="height: 45rem; overflow: auto"> <div id="shared" style="height: 45rem; overflow: auto">

View File

@ -200,7 +200,6 @@ export default {
search: function() { search: function() {
this.mediaDataInfoList = [] this.mediaDataInfoList = []
this.queryLoading = true this.queryLoading = true
console.log(this.timeRange)
this.$store.dispatch('jtDevice/queryMediaData', { this.$store.dispatch('jtDevice/queryMediaData', {
phoneNumber: this.phoneNumber, phoneNumber: this.phoneNumber,
queryMediaDataCommand: { queryMediaDataCommand: {
@ -226,10 +225,10 @@ export default {
this.$refs.position.openDialog(row.positionBaseInfo) this.$refs.position.openDialog(row.positionBaseInfo)
}, },
download: function(row) { download: function(row) {
this.$message.success('已申请截图,完成后自动下载', { closed: true }) this.$message.success('下载请求已发送', { closed: true })
// //
const baseUrl = window.baseUrl ? window.baseUrl : '' const baseUrl = window.baseUrl ? window.baseUrl : ''
const fileUrl = ((process.env.NODE_ENV === 'development') ? process.env.VUE_APP_BASE_API : baseUrl) + `/api/jt1078/media/upload/one?phoneNumber=${this.phoneNumber}&mediaId=${row.id}` const fileUrl = ((process.env.NODE_ENV === 'development') ? process.env.VUE_APP_BASE_API : baseUrl) + `/api/jt1078/media/upload/one/upload?phoneNumber=${this.phoneNumber}&mediaId=${row.id}`
let controller = new AbortController() let controller = new AbortController()
let signal = controller.signal let signal = controller.signal
// //
@ -247,7 +246,19 @@ export default {
// //
const link = document.createElement('a') const link = document.createElement('a')
link.href = window.URL.createObjectURL(blob) link.href = window.URL.createObjectURL(blob)
link.download = `${this.device.phoneNumber}-${row.channelId}-${dayjs().format('YYYYMMDDHHmmss')}.jpg` // filename.ext let suffix = 'jpg'
switch (row.type){
case 0:
suffix = 'jpg'
break
case 1:
suffix = 'mp3'
break
case 2:
suffix = 'mp4'
break
}
link.download = `${row.id}.${suffix}` // filename.ext
document.body.appendChild(link) document.body.appendChild(link)
// //
link.click() link.click()

View File

@ -3,7 +3,7 @@
<el-dialog <el-dialog
v-el-drag-dialog v-el-drag-dialog
title="立即拍摄" title="立即拍摄"
width="60%" width="65%"
top="2rem" top="2rem"
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="showDialog" :visible.sync="showDialog"
@ -73,8 +73,14 @@
<el-checkbox v-model="showImageConfig">高级配置</el-checkbox> <el-checkbox v-model="showImageConfig">高级配置</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item style="margin-left: 2rem; text-align: right" > <el-form-item style="margin-left: 2rem; text-align: right" >
<el-button type="primary" :loading="queryLoading" icon="el-icon-search" @click="shooting()" > <el-button v-if="!commandType" type="danger" icon="el-icon-video-camera" @click="stopRecord()" >
执行 停止录像
</el-button>
<el-button v-if="!commandType" type="primary" icon="el-icon-video-camera" @click="shooting()" >
开始录像
</el-button>
<el-button v-if="commandType" type="primary" icon="el-icon-camera" @click="shooting()" >
拍照
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -186,6 +192,29 @@ export default {
message: '消息已经下发' message: '消息已经下发'
}) })
}) })
},
stopRecord: function() {
this.$store.dispatch('jtDevice/shooting', {
phoneNumber: this.phoneNumber,
shootingCommand: {
chanelId: this.chanelId,
command: 0,
time: 0,
save: 1,
resolvingPower: 0xff,
quality: 0,
brightness: 0,
contrastRatio: 0,
saturation: 0,
chroma: 0
}
})
.then( data => {
this.$message.success({
showClose: true,
message: '消息已经下发'
})
})
} }
} }
} }