|
|
@ -11,6 +11,7 @@ import com.zc.business.domain.*; |
|
|
|
import com.zc.business.mapper.*; |
|
|
|
import com.zc.business.service.IDcEventService; |
|
|
|
import com.zc.business.service.IMiddleDatabaseService; |
|
|
|
import org.apache.poi.ss.formula.functions.T; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -137,9 +138,11 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl |
|
|
|
dcEvent.setId(uuid); |
|
|
|
dcEvent.setEventState(0L); |
|
|
|
//获取部门信息
|
|
|
|
dcEvent.setDeptId(SecurityUtils.getDeptId()); |
|
|
|
//dcEvent.setDeptId(SecurityUtils.getDeptId());
|
|
|
|
dcEvent.setDeptId(1l); |
|
|
|
//用户
|
|
|
|
dcEvent.setUserId(SecurityUtils.getUserId()); |
|
|
|
// dcEvent.setUserId(SecurityUtils.getUserId());
|
|
|
|
dcEvent.setUserId(1l); |
|
|
|
|
|
|
|
dcEvent.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
|
@ -180,9 +183,9 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl |
|
|
|
|
|
|
|
if (i7 > 0) { |
|
|
|
|
|
|
|
//中间库
|
|
|
|
/* //中间库
|
|
|
|
MdEvent mdEvent = new MdEvent(dcEvent); |
|
|
|
middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); |
|
|
|
middleDatabaseService.insertMiddleDatabaseEvent(mdEvent);*/ |
|
|
|
switch (eventType) { |
|
|
|
//交通事故
|
|
|
|
case 1: |
|
|
@ -207,57 +210,134 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl |
|
|
|
//TODO 插入多个收费站
|
|
|
|
if (dcEvent.getDcEventTrafficControl().getFacilityIds().length==1){//facilityIds==1 说明只选择了一个收费站
|
|
|
|
|
|
|
|
if (dcEventId !=null){ |
|
|
|
if (dcEventId !=null){//不等于空 事件处置页面 修改
|
|
|
|
dcEventMapper.deleteDcEventById(uuid);//删除添加的事件主类
|
|
|
|
|
|
|
|
DcEvent dcEvent1 = new DcEvent(); |
|
|
|
dcEvent1.setId(dcEventId);//事件id
|
|
|
|
dcEvent1.setEventNature(1l);//首发事件
|
|
|
|
dcEvent1.setLinkId(uuid);//关联管制事件id
|
|
|
|
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
|
|
|
|
dcEvent.getDcEventTrafficControl().setId(uuid); |
|
|
|
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id
|
|
|
|
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());//
|
|
|
|
}else { |
|
|
|
|
|
|
|
dcEvent.getDcEventTrafficControl().setId(uuid); |
|
|
|
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id
|
|
|
|
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); |
|
|
|
} |
|
|
|
|
|
|
|
dcEvent.getDcEventTrafficControl().setId(uuid); |
|
|
|
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id
|
|
|
|
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); |
|
|
|
}else { |
|
|
|
}else if (dcEvent.getDcEventTrafficControl().getFacilityIds().length>1){//facilityIds1=1 说明只选择了多个收费站
|
|
|
|
|
|
|
|
if (dcEventId !=null){//不等于空 事件处置页面 修改
|
|
|
|
dcEventMapper.deleteDcEventById(uuid);//删除添加的事件主类
|
|
|
|
DcEvent dcEvent1 = new DcEvent(); |
|
|
|
dcEvent1.setId(dcEventId);//事件id
|
|
|
|
dcEvent1.setEventNature(1l);//首发事件
|
|
|
|
Map<String,String> map = new HashMap<>(); |
|
|
|
for (int i = 0; i < dcEvent.getDcEventTrafficControl().getFacilityIds().length; i++) { //设置事件Id UUID无下划线格式32
|
|
|
|
String facilityUUID = IdUtils.fastSimpleUUID(); |
|
|
|
map.put("facilityId"+i,facilityUUID);//每循环一次生成一个uuid
|
|
|
|
} |
|
|
|
StringBuilder sb2 = new StringBuilder(); |
|
|
|
// 遍历map,
|
|
|
|
int a = 0; |
|
|
|
for (Map.Entry<String, String> entry : map.entrySet()) { |
|
|
|
sb2.append(entry.getValue()); |
|
|
|
if (dcEvent.getDcEventTrafficControl().getFacilityIds().length-a !=1){ |
|
|
|
sb2.append(","); |
|
|
|
} |
|
|
|
a++; |
|
|
|
} |
|
|
|
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来构建逗号分隔的字符串
|
|
|
|
|
|
|
|
//新增第一条数据
|
|
|
|
dcEvent.setId(map.get("facilityId" + i)); |
|
|
|
dcEvent.setEventState(0L); |
|
|
|
dcEvent.setDeptId(1l); |
|
|
|
dcEvent.setUserId(1l); |
|
|
|
dcEvent.setCreateTime(DateUtils.getNowDate()); |
|
|
|
dcEvent.setEventNature(2L);//关联管制
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
// 遍历map,排除与当前索引i对应的键
|
|
|
|
for (Map.Entry<String, String> entry : map.entrySet()) { |
|
|
|
if (!entry.getKey().equals("facilityId" + i)) { |
|
|
|
if (sb.length() > 0) { |
|
|
|
sb.append(","); |
|
|
|
} |
|
|
|
sb.append(entry.getValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
String linkId = sb.toString(); |
|
|
|
dcEvent.setLinkId(linkId); |
|
|
|
|
|
|
|
//交通管制
|
|
|
|
if (eventType == 3 && dcEvent.getDcEventTrafficControl().getFacilityIds()[i] != null) { |
|
|
|
String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]); |
|
|
|
dcEvent.setStakeMark(extracted(facilityId)); |
|
|
|
} |
|
|
|
dcEventMapper.insertDcEvent(dcEvent); |
|
|
|
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); |
|
|
|
|
|
|
|
} |
|
|
|
}else { |
|
|
|
|
|
|
|
|
|
|
|
dcEventMapper.deleteDcEventById(uuid);//删除添加的事件主类
|
|
|
|
Map<String,String> map = new HashMap<>(); |
|
|
|
for (int i = 0; i < dcEvent.getDcEventTrafficControl().getFacilityIds().length; i++) { //设置事件Id UUID无下划线格式32
|
|
|
|
String facilityUUID = IdUtils.fastSimpleUUID(); |
|
|
|
map.put("facilityId"+i,facilityUUID);//每循环一次生成一个uuid
|
|
|
|
Long facilityId = dcEvent.getDcEventTrafficControl().getFacilityIds()[i]; |
|
|
|
map.put(facilityUUID, String.valueOf(facilityId));//将uuid作为主键 设施id作为 值 存放map
|
|
|
|
} |
|
|
|
for (int i = 0; i < dcEvent.getDcEventTrafficControl().getFacilityIds().length; i++) { |
|
|
|
dcEvent.getDcEventTrafficControl().setId(map.get("facilityId"+i));//交通管制事件id
|
|
|
|
|
|
|
|
|
|
|
|
dcEvent.getDcEventTrafficControl().setId(map.get("facilityId" + i));//交通管制事件id
|
|
|
|
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]);//取出数组字段赋值 设施id
|
|
|
|
|
|
|
|
//新增第一条数据
|
|
|
|
dcEvent.setId(map.get("facilityId"+i)); |
|
|
|
dcEvent.setId(map.get("facilityId" + i)); |
|
|
|
dcEvent.setEventState(0L); |
|
|
|
dcEvent.setDeptId(SecurityUtils.getDeptId()); |
|
|
|
dcEvent.setUserId(SecurityUtils.getUserId()); |
|
|
|
dcEvent.setDeptId(1l); |
|
|
|
dcEvent.setUserId(1l); |
|
|
|
dcEvent.setCreateTime(DateUtils.getNowDate()); |
|
|
|
dcEvent.setEventNature(2L);//关联管制
|
|
|
|
|
|
|
|
// 使用StringBuilder来构建逗号分隔的字符串
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
boolean isFirst = true; |
|
|
|
// 迭代Map并过滤出不为1的键对应的值
|
|
|
|
|
|
|
|
// 遍历map,排除与当前索引i对应的键
|
|
|
|
for (Map.Entry<String, String> entry : map.entrySet()) { |
|
|
|
if (entry.getKey() !="facilityId"+i) { |
|
|
|
if (!isFirst) { |
|
|
|
if (!entry.getKey().equals("facilityId" + i)) { |
|
|
|
if (sb.length() > 0) { |
|
|
|
sb.append(","); |
|
|
|
} |
|
|
|
sb.append(entry.getValue()); |
|
|
|
isFirst = false; |
|
|
|
} |
|
|
|
} |
|
|
|
String linkId= sb.toString(); |
|
|
|
|
|
|
|
String linkId = sb.toString(); |
|
|
|
dcEvent.setLinkId(linkId); |
|
|
|
System.out.println(linkId); |
|
|
|
|
|
|
|
//交通管制
|
|
|
|
if (eventType ==3 && dcEvent.getDcEventTrafficControl().getFacilityIds()[i] != null) { |
|
|
|
if (eventType == 3 && dcEvent.getDcEventTrafficControl().getFacilityIds()[i] != null) { |
|
|
|
String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]); |
|
|
|
dcEvent.setStakeMark( extracted(facilityId)); |
|
|
|
dcEvent.setStakeMark(extracted(facilityId)); |
|
|
|
} |
|
|
|
dcEventMapper.insertDcEvent(dcEvent); |
|
|
|
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -574,6 +654,8 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 批量删除事件信息 |
|
|
|
* |
|
|
|