From 25008d50c78816095f20f5f14b0b8dead34869d8 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 28 Nov 2024 10:15:03 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BD=95=E5=88=B6=E8=AE=A1=E5=88=92]=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=A1=E5=88=92=E9=80=89=E6=8B=A9=E4=B8=8E?= =?UTF-8?q?=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/RecordPlanServiceImpl.java | 25 ++++++++++++------- .../src/components/dialog/editRecordPlan.vue | 18 ++++++------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/RecordPlanServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/RecordPlanServiceImpl.java index dc3de683..061769b8 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/RecordPlanServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/RecordPlanServiceImpl.java @@ -1,10 +1,7 @@ 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.SsrcTransactionNotFoundException; -import com.genersoft.iot.vmp.gb28181.bean.*; +import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper; import com.genersoft.iot.vmp.gb28181.service.IGbChannelService; 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.transaction.annotation.Transactional; -import javax.sip.InvalidArgumentException; -import javax.sip.SipException; -import java.text.ParseException; +import java.util.ArrayList; import java.util.List; @Service @@ -110,9 +105,21 @@ public class RecordPlanServiceImpl implements IRecordPlanService { public void update(RecordPlan plan) { plan.setUpdateTime(DateUtil.getNow()); recordPlanMapper.update(plan); + recordPlanMapper.cleanItems(plan.getId()); if (plan.getPlanItemList() != null && !plan.getPlanItemList().isEmpty()){ - recordPlanMapper.cleanItems(plan.getId()); - recordPlanMapper.batchAddItem(plan.getId(), plan.getPlanItemList()); + List planItemList = new ArrayList<>(); + 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 更新录像队列 diff --git a/web_src/src/components/dialog/editRecordPlan.vue b/web_src/src/components/dialog/editRecordPlan.vue index 5ae900c3..1de115cc 100644 --- a/web_src/src/components/dialog/editRecordPlan.vue +++ b/web_src/src/components/dialog/editRecordPlan.vue @@ -53,7 +53,6 @@ export default { }, methods: { openDialog: function (recordPlan, endCallback) { - console.log(recordPlan); this.endCallback = endCallback; this.showDialog = true; this.byteTime= ""; @@ -68,7 +67,7 @@ export default { planId: recordPlan.id, } }).then((res) => { - if (res.data.code === 0) { + if (res.data.code === 0 && res.data.data.planItemList) { this.byteTime = this.plan2Byte(res.data.data.planItemList) } }).catch((error) => { @@ -163,7 +162,7 @@ export default { } for (let j = 0; j < planArray.length; j++) { planList.push({ - id: this.id, + planId: this.id, start: planArray[j].start, stop: planArray[j].stop, weekDay: week @@ -177,28 +176,29 @@ export default { let start = null; let stop = null; let result = [] - + console.log("===================") for (let i = 0; i < weekItem.length; i++) { let item = weekItem[i] + console.log(item) if (item === '1') { // 表示选中 stop = i if (start === null ) { start = i } - if (i === weekItem.length - 1) { + if (i === weekItem.length - 1 && start != null && stop != null) { result.push({ start: start, stop: stop, }) } } else { - if (stop !== 0){ + if (stop !== null){ result.push({ start: start, stop: stop, }) - start = 0 - stop = 0 + start = null + stop = null } } } @@ -212,10 +212,8 @@ export default { let weekDay = planList[i].weekDay let index = planList[i].start let endIndex = planList[i].stop - console.log(index + "===" + endIndex) for (let j = index; j <= endIndex; j++) { indexArray["key_" + (j + (weekDay - 1 )*48)] = 1 - console.log("key_" + (j + (weekDay - 1 )*48)) } } for (let i = 0; i < 336; i++) {