[录制计划] 修复计划选择与回显

dev/数据库统合
648540858 2024-11-28 10:15:03 +08:00
parent cb12bd731d
commit 25008d50c7
2 changed files with 24 additions and 19 deletions

View File

@ -1,10 +1,7 @@
package com.genersoft.iot.vmp.service.impl; package com.genersoft.iot.vmp.service.impl;
import com.genersoft.iot.vmp.common.InviteInfo;
import com.genersoft.iot.vmp.common.InviteSessionStatus;
import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper; import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService; import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent; import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
@ -25,9 +22,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.sip.InvalidArgumentException; import java.util.ArrayList;
import javax.sip.SipException;
import java.text.ParseException;
import java.util.List; import java.util.List;
@Service @Service
@ -110,9 +105,21 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
public void update(RecordPlan plan) { public void update(RecordPlan plan) {
plan.setUpdateTime(DateUtil.getNow()); plan.setUpdateTime(DateUtil.getNow());
recordPlanMapper.update(plan); recordPlanMapper.update(plan);
recordPlanMapper.cleanItems(plan.getId());
if (plan.getPlanItemList() != null && !plan.getPlanItemList().isEmpty()){ if (plan.getPlanItemList() != null && !plan.getPlanItemList().isEmpty()){
recordPlanMapper.cleanItems(plan.getId()); List<RecordPlanItem> planItemList = new ArrayList<>();
recordPlanMapper.batchAddItem(plan.getId(), plan.getPlanItemList()); for (RecordPlanItem recordPlanItem : plan.getPlanItemList()) {
if (recordPlanItem.getStart() == null || recordPlanItem.getStop() == null || recordPlanItem.getWeekDay() == null){
continue;
}
if (recordPlanItem.getPlanId() == null) {
recordPlanItem.setPlanId(plan.getId());
}
planItemList.add(recordPlanItem);
}
if(!planItemList.isEmpty()) {
recordPlanMapper.batchAddItem(plan.getId(), planItemList);
}
} }
// TODO 更新录像队列 // TODO 更新录像队列

View File

@ -53,7 +53,6 @@ export default {
}, },
methods: { methods: {
openDialog: function (recordPlan, endCallback) { openDialog: function (recordPlan, endCallback) {
console.log(recordPlan);
this.endCallback = endCallback; this.endCallback = endCallback;
this.showDialog = true; this.showDialog = true;
this.byteTime= ""; this.byteTime= "";
@ -68,7 +67,7 @@ export default {
planId: recordPlan.id, planId: recordPlan.id,
} }
}).then((res) => { }).then((res) => {
if (res.data.code === 0) { if (res.data.code === 0 && res.data.data.planItemList) {
this.byteTime = this.plan2Byte(res.data.data.planItemList) this.byteTime = this.plan2Byte(res.data.data.planItemList)
} }
}).catch((error) => { }).catch((error) => {
@ -163,7 +162,7 @@ export default {
} }
for (let j = 0; j < planArray.length; j++) { for (let j = 0; j < planArray.length; j++) {
planList.push({ planList.push({
id: this.id, planId: this.id,
start: planArray[j].start, start: planArray[j].start,
stop: planArray[j].stop, stop: planArray[j].stop,
weekDay: week weekDay: week
@ -177,28 +176,29 @@ export default {
let start = null; let start = null;
let stop = null; let stop = null;
let result = [] let result = []
console.log("===================")
for (let i = 0; i < weekItem.length; i++) { for (let i = 0; i < weekItem.length; i++) {
let item = weekItem[i] let item = weekItem[i]
console.log(item)
if (item === '1') { // if (item === '1') { //
stop = i stop = i
if (start === null ) { if (start === null ) {
start = i start = i
} }
if (i === weekItem.length - 1) { if (i === weekItem.length - 1 && start != null && stop != null) {
result.push({ result.push({
start: start, start: start,
stop: stop, stop: stop,
}) })
} }
} else { } else {
if (stop !== 0){ if (stop !== null){
result.push({ result.push({
start: start, start: start,
stop: stop, stop: stop,
}) })
start = 0 start = null
stop = 0 stop = null
} }
} }
} }
@ -212,10 +212,8 @@ export default {
let weekDay = planList[i].weekDay let weekDay = planList[i].weekDay
let index = planList[i].start let index = planList[i].start
let endIndex = planList[i].stop let endIndex = planList[i].stop
console.log(index + "===" + endIndex)
for (let j = index; j <= endIndex; j++) { for (let j = index; j <= endIndex; j++) {
indexArray["key_" + (j + (weekDay - 1 )*48)] = 1 indexArray["key_" + (j + (weekDay - 1 )*48)] = 1
console.log("key_" + (j + (weekDay - 1 )*48))
} }
} }
for (let i = 0; i < 336; i++) { for (let i = 0; i < 336; i++) {