新增添加录制计划接口
parent
8b88a5e034
commit
2dcbee74b0
|
@ -17,7 +17,7 @@ public class ChannelProvider {
|
|||
" stream_proxy_id,\n" +
|
||||
" create_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_name, name) as gb_name,\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")) {
|
||||
sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'");
|
||||
}
|
||||
if (params.get("hasRecordPlan") != null && !(Boolean)params.get("hasRecordPlan")) {
|
||||
sqlBuild.append(" AND record_plan == 0");
|
||||
if (params.get("hasRecordPlan") != null && (Boolean)params.get("hasRecordPlan")) {
|
||||
sqlBuild.append(" AND record_plan_id > 0");
|
||||
}
|
||||
|
||||
if (params.get("channelType") != null) {
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "录制计划")
|
||||
@Slf4j
|
||||
|
@ -11,5 +19,20 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequestMapping("/api/record/plan")
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<el-table-column label="录制计划" min-width="100">
|
||||
<template v-slot:default="scope">
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
>
|
||||
<div id="shared" style="margin-right: 20px;">
|
||||
<ByteWeektimePicker v-model="byteTime" name="name"/>
|
||||
<el-form status-icon label-width="80px">
|
||||
<el-form >
|
||||
<el-form-item>
|
||||
<div style="float: right;">
|
||||
<div style="float: right; margin-top: 20px">
|
||||
<el-button type="primary" @click="onSubmit">保存</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
</div>
|
||||
|
@ -36,7 +36,6 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
value:"",
|
||||
options: [],
|
||||
loading: false,
|
||||
showDialog: false,
|
||||
|
@ -44,6 +43,7 @@ export default {
|
|||
deviceDbId: "",
|
||||
endCallback: "",
|
||||
byteTime: "",
|
||||
planList: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
@ -52,15 +52,22 @@ export default {
|
|||
this.deviceDbId = deviceDbId;
|
||||
this.endCallback = endCallback;
|
||||
this.showDialog = true;
|
||||
this.byteTime= "";
|
||||
if (channel.recordPlanId) {
|
||||
// 请求plan信息
|
||||
|
||||
}
|
||||
},
|
||||
onSubmit: function () {
|
||||
let planList = this.byteTime2PlanList();
|
||||
console.log(planList)
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url: "/api/user/add",
|
||||
url: "/api/record/plan/add",
|
||||
params: {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
roleId: this.roleId
|
||||
channelId: this.channel?this.channel.id:null,
|
||||
deviceDbId: this.deviceDbId,
|
||||
planList: planList
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.data.code === 0) {
|
||||
|
@ -68,11 +75,9 @@ export default {
|
|||
showClose: true,
|
||||
message: '添加成功',
|
||||
type: 'success',
|
||||
|
||||
});
|
||||
this.showDialog = false;
|
||||
this.listChangeCallback()
|
||||
|
||||
this.endCallback()
|
||||
} else {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
|
@ -85,7 +90,6 @@ export default {
|
|||
});
|
||||
},
|
||||
close: function () {
|
||||
console.log(this.byteTime)
|
||||
this.channel = "";
|
||||
this.deviceDbId = "";
|
||||
this.showDialog = false;
|
||||
|
@ -93,6 +97,59 @@ export default {
|
|||
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>
|
||||
|
|
|
@ -147,7 +147,7 @@ create table wvp_device_channel
|
|||
gb_download_speed character varying(255),
|
||||
gb_svc_space_support_mod integer,
|
||||
gb_svc_time_support_mode integer,
|
||||
record_plan integer,
|
||||
record_plan_id integer,
|
||||
stream_push_id integer,
|
||||
stream_proxy_id integer,
|
||||
constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id),
|
||||
|
|
|
@ -163,7 +163,7 @@ create table wvp_device_channel
|
|||
gb_download_speed character varying(255),
|
||||
gb_svc_space_support_mod integer,
|
||||
gb_svc_time_support_mode integer,
|
||||
record_plan integer,
|
||||
record_plan_id integer,
|
||||
stream_push_id integer,
|
||||
stream_proxy_id integer,
|
||||
constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id),
|
||||
|
|
Loading…
Reference in New Issue