新增添加录制计划接口

pull/1719/head
648540858 2024-11-20 18:37:39 +08:00
parent 8b88a5e034
commit 2dcbee74b0
6 changed files with 99 additions and 19 deletions

View File

@ -17,7 +17,7 @@ public class ChannelProvider {
" stream_proxy_id,\n" + " stream_proxy_id,\n" +
" create_time,\n" + " create_time,\n" +
" update_time,\n" + " update_time,\n" +
" record_plan,\n" + " record_plan_id,\n" +
" coalesce(gb_device_id, device_id) as gb_device_id,\n" + " coalesce(gb_device_id, device_id) as gb_device_id,\n" +
" coalesce(gb_name, name) as gb_name,\n" + " coalesce(gb_name, name) as gb_name,\n" +
" coalesce(gb_manufacturer, manufacturer) as gb_manufacturer,\n" + " coalesce(gb_manufacturer, manufacturer) as gb_manufacturer,\n" +
@ -198,8 +198,8 @@ public class ChannelProvider {
if (params.get("online") != null && !(Boolean)params.get("online")) { if (params.get("online") != null && !(Boolean)params.get("online")) {
sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'"); sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'");
} }
if (params.get("hasRecordPlan") != null && !(Boolean)params.get("hasRecordPlan")) { if (params.get("hasRecordPlan") != null && (Boolean)params.get("hasRecordPlan")) {
sqlBuild.append(" AND record_plan == 0"); sqlBuild.append(" AND record_plan_id > 0");
} }
if (params.get("channelType") != null) { if (params.get("channelType") != null) {

View File

@ -1,9 +1,17 @@
package com.genersoft.iot.vmp.vmanager.recordPlan; package com.genersoft.iot.vmp.vmanager.recordPlan;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.service.bean.RecordPlan;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Tag(name = "录制计划") @Tag(name = "录制计划")
@Slf4j @Slf4j
@ -11,5 +19,20 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/api/record/plan") @RequestMapping("/api/record/plan")
public class RecordPlanController { public class RecordPlanController {
@ResponseBody
@PostMapping("/add")
@Operation(summary = "添加录制计划", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "channelId", description = "通道ID", required = true)
@Parameter(name = "deviceDbId", description = "国标设备ID", required = true)
@Parameter(name = "planList", description = "录制计划, 为空则清空计划", required = false)
public void openRtpServer(@RequestParam(required = false) Integer channelId, @RequestParam(required = false) Integer deviceDbId, @RequestParam(required = false) List<RecordPlan> planList
) {
if (channelId == null && deviceDbId == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "通道ID和国标设备ID不可都为NULL");
}
}
} }

View File

@ -76,7 +76,7 @@
<el-table-column label="录制计划" min-width="100"> <el-table-column label="录制计划" min-width="100">
<template v-slot:default="scope"> <template v-slot:default="scope">
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<el-tag size="medium" effect="dark" v-if="scope.row.recordPlan"></el-tag> <el-tag size="medium" effect="dark" v-if="scope.row.recordPlanId"></el-tag>
<el-tag size="medium" effect="dark" v-else></el-tag> <el-tag size="medium" effect="dark" v-else></el-tag>
</div> </div>
</template> </template>

View File

@ -11,9 +11,9 @@
> >
<div id="shared" style="margin-right: 20px;"> <div id="shared" style="margin-right: 20px;">
<ByteWeektimePicker v-model="byteTime" name="name"/> <ByteWeektimePicker v-model="byteTime" name="name"/>
<el-form status-icon label-width="80px"> <el-form >
<el-form-item> <el-form-item>
<div style="float: right;"> <div style="float: right; margin-top: 20px">
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="onSubmit"></el-button>
<el-button @click="close"></el-button> <el-button @click="close"></el-button>
</div> </div>
@ -36,7 +36,6 @@ export default {
}, },
data() { data() {
return { return {
value:"",
options: [], options: [],
loading: false, loading: false,
showDialog: false, showDialog: false,
@ -44,6 +43,7 @@ export default {
deviceDbId: "", deviceDbId: "",
endCallback: "", endCallback: "",
byteTime: "", byteTime: "",
planList: [],
}; };
}, },
methods: { methods: {
@ -52,15 +52,22 @@ export default {
this.deviceDbId = deviceDbId; this.deviceDbId = deviceDbId;
this.endCallback = endCallback; this.endCallback = endCallback;
this.showDialog = true; this.showDialog = true;
this.byteTime= "";
if (channel.recordPlanId) {
// plan
}
}, },
onSubmit: function () { onSubmit: function () {
let planList = this.byteTime2PlanList();
console.log(planList)
this.$axios({ this.$axios({
method: 'post', method: 'post',
url: "/api/user/add", url: "/api/record/plan/add",
params: { params: {
username: this.username, channelId: this.channel?this.channel.id:null,
password: this.password, deviceDbId: this.deviceDbId,
roleId: this.roleId planList: planList
} }
}).then((res) => { }).then((res) => {
if (res.data.code === 0) { if (res.data.code === 0) {
@ -68,11 +75,9 @@ export default {
showClose: true, showClose: true,
message: '添加成功', message: '添加成功',
type: 'success', type: 'success',
}); });
this.showDialog = false; this.showDialog = false;
this.listChangeCallback() this.endCallback()
} else { } else {
this.$message({ this.$message({
showClose: true, showClose: true,
@ -85,7 +90,6 @@ export default {
}); });
}, },
close: function () { close: function () {
console.log(this.byteTime)
this.channel = ""; this.channel = "";
this.deviceDbId = ""; this.deviceDbId = "";
this.showDialog = false; this.showDialog = false;
@ -93,6 +97,59 @@ export default {
this.endCallback(); this.endCallback();
} }
}, },
byteTime2PlanList() {
this.planList = []
if (this.byteTime.length === 0) {
return;
}
const DayTimes = 24 * 2;
let planList = []
let week = 1;
// 336 list 7 48
for (let i = 0; i < this.byteTime.length; i += DayTimes) {
let planArray = this.byteTime2Plan(this.byteTime.slice(i, i + DayTimes));
console.log(planArray)
if(!planArray || planArray.length === 0) {
week ++;
continue
}
for (let j = 0; j < planArray.length; j++) {
console.log(planArray[j])
planList.push({
startTime: planArray[j].startTime,
stopTime: planArray[j].stopTime,
weekDay: week
})
}
week ++;
}
return planList
},
byteTime2Plan(weekItem){
let startTime = 0;
let endTime = 0;
let result = []
for (let i = 0; i < weekItem.length; i++) {
let item = weekItem[i]
if (item === '1') {
endTime = 30*i
if (startTime === 0 ) {
startTime = 30*i
}
} else {
if (endTime !== 0){
result.push({
startTime: startTime * 60 * 1000,
stopTime: endTime * 60 * 1000,
})
startTime = 0
endTime = 0
}
}
}
return result;
}
}, },
}; };
</script> </script>

View File

@ -147,7 +147,7 @@ create table wvp_device_channel
gb_download_speed character varying(255), gb_download_speed character varying(255),
gb_svc_space_support_mod integer, gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer, gb_svc_time_support_mode integer,
record_plan integer, record_plan_id integer,
stream_push_id integer, stream_push_id integer,
stream_proxy_id integer, stream_proxy_id integer,
constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id), constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id),

View File

@ -163,7 +163,7 @@ create table wvp_device_channel
gb_download_speed character varying(255), gb_download_speed character varying(255),
gb_svc_space_support_mod integer, gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer, gb_svc_time_support_mode integer,
record_plan integer, record_plan_id integer,
stream_push_id integer, stream_push_id integer,
stream_proxy_id integer, stream_proxy_id integer,
constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id), constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id),