From e3de7818ef71ed85e5e557eddd7d78c538d0bf8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Wed, 10 Apr 2024 19:50:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E4=BA=A4=E9=80=9A?= =?UTF-8?q?=E7=AE=A1=E5=88=B6=20=E6=94=B6=E8=B4=B9=E7=AB=99=E8=AE=BE?= =?UTF-8?q?=E6=96=BD=20=E7=AD=89=20=E5=A4=9A=E9=80=89=20=E6=8F=92=E5=85=A5?= =?UTF-8?q?=20=E3=80=82=E4=BA=8B=E4=BB=B6=E5=A4=84=E7=BD=AE=20=E6=94=B6?= =?UTF-8?q?=E8=B4=B9=E7=AB=99=E5=A4=9A=E9=80=89=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DcEventServiceImpl.java | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index 9a789863..84128e87 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -125,9 +125,7 @@ public class DcEventServiceImpl extends ServiceImpl impl public int insertDcEvent(DcEvent dcEvent) { String dcEventId =dcEvent.getId(); - if (dcEventId ==null){ - } //获取事件类型 @@ -138,11 +136,9 @@ public class DcEventServiceImpl extends ServiceImpl impl dcEvent.setId(uuid); dcEvent.setEventState(0L); //获取部门信息 - //dcEvent.setDeptId(SecurityUtils.getDeptId()); - dcEvent.setDeptId(1l); + dcEvent.setDeptId(SecurityUtils.getDeptId()); //用户 - // dcEvent.setUserId(SecurityUtils.getUserId()); - dcEvent.setUserId(1l); + dcEvent.setUserId(SecurityUtils.getUserId()); dcEvent.setCreateTime(DateUtils.getNowDate()); @@ -183,9 +179,11 @@ public class DcEventServiceImpl extends ServiceImpl impl if (i7 > 0) { - /* //中间库 - MdEvent mdEvent = new MdEvent(dcEvent); - middleDatabaseService.insertMiddleDatabaseEvent(mdEvent);*/ +if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == null){//非 事件处置 和收费站等多条数据添加 + //中间库 + MdEvent mdEvent = new MdEvent(dcEvent); + middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); +} switch (eventType) { //交通事故 case 1: @@ -221,6 +219,9 @@ public class DcEventServiceImpl extends ServiceImpl impl dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());// }else { + //中间库 + MdEvent mdEvent = new MdEvent(dcEvent); + middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); dcEvent.getDcEventTrafficControl().setId(uuid); dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id @@ -251,11 +252,8 @@ public class DcEventServiceImpl extends ServiceImpl impl } String linkId2 = sb2.toString(); dcEvent1.setLinkId(linkId2);//关联管制事件id - dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质 - for (int i = 0; i < dcEvent.getDcEventTrafficControl().getFacilityIds().length; i++) { - dcEvent.getDcEventTrafficControl().setId(map.get("facilityId"+i));//交通管制事件id dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]);//取出数组字段赋值 设施id // 使用StringBuilder来构建逗号分隔的字符串 @@ -263,8 +261,8 @@ public class DcEventServiceImpl extends ServiceImpl impl //新增第一条数据 dcEvent.setId(map.get("facilityId" + i)); dcEvent.setEventState(0L); - dcEvent.setDeptId(1l); - dcEvent.setUserId(1l); + dcEvent.setDeptId(SecurityUtils.getDeptId()); + dcEvent.setUserId(SecurityUtils.getUserId()); dcEvent.setCreateTime(DateUtils.getNowDate()); dcEvent.setEventNature(2L);//关联管制 @@ -287,12 +285,15 @@ public class DcEventServiceImpl extends ServiceImpl impl dcEvent.setStakeMark(extracted(facilityId)); } dcEventMapper.insertDcEvent(dcEvent); + //中间库 + MdEvent mdEvent = new MdEvent(dcEvent); + middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); + int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); } }else { - dcEventMapper.deleteDcEventById(uuid);//删除添加的事件主类 Map map = new HashMap<>(); for (int i = 0; i < dcEvent.getDcEventTrafficControl().getFacilityIds().length; i++) { //设置事件Id UUID无下划线格式32 @@ -301,15 +302,14 @@ public class DcEventServiceImpl extends ServiceImpl impl } for (int i = 0; i < dcEvent.getDcEventTrafficControl().getFacilityIds().length; i++) { - dcEvent.getDcEventTrafficControl().setId(map.get("facilityId" + i));//交通管制事件id dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]);//取出数组字段赋值 设施id //新增第一条数据 dcEvent.setId(map.get("facilityId" + i)); dcEvent.setEventState(0L); - dcEvent.setDeptId(1l); - dcEvent.setUserId(1l); + dcEvent.setDeptId(SecurityUtils.getDeptId()); + dcEvent.setUserId(SecurityUtils.getUserId()); dcEvent.setCreateTime(DateUtils.getNowDate()); dcEvent.setEventNature(2L);//关联管制 @@ -335,7 +335,12 @@ public class DcEventServiceImpl extends ServiceImpl impl String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]); dcEvent.setStakeMark(extracted(facilityId)); } + //中间库 + MdEvent mdEvent = new MdEvent(dcEvent); + middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); + dcEventMapper.insertDcEvent(dcEvent); + int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); } }