|
@ -6,6 +6,7 @@ import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.SecurityUtils; |
|
|
import com.ruoyi.common.utils.SecurityUtils; |
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
import com.ruoyi.system.service.ISysDeptService; |
|
|
import com.ruoyi.system.service.ISysDeptService; |
|
|
|
|
|
import com.sun.xml.bind.v2.TODO; |
|
|
import com.zc.business.domain.*; |
|
|
import com.zc.business.domain.*; |
|
|
import com.zc.business.mapper.*; |
|
|
import com.zc.business.mapper.*; |
|
|
import com.zc.business.service.IDcEventService; |
|
|
import com.zc.business.service.IDcEventService; |
|
@ -121,6 +122,10 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public int insertDcEvent(DcEvent dcEvent) { |
|
|
public int insertDcEvent(DcEvent dcEvent) { |
|
|
|
|
|
|
|
|
|
|
|
String dcEventId =dcEvent.getId(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取事件类型
|
|
|
//获取事件类型
|
|
|
int eventType = Math.toIntExact(dcEvent.getEventType()); |
|
|
int eventType = Math.toIntExact(dcEvent.getEventType()); |
|
|
|
|
|
|
|
@ -196,8 +201,57 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl |
|
|
//交通管制
|
|
|
//交通管制
|
|
|
case 3: |
|
|
case 3: |
|
|
if (dcEvent.getDcEventTrafficControl() != null) { |
|
|
if (dcEvent.getDcEventTrafficControl() != null) { |
|
|
|
|
|
//TODO 插入多个收费站
|
|
|
|
|
|
if (dcEvent.getDcEventTrafficControl().getFacilityIds().length==1){//facilityIds==1 说明只选择了一个收费站
|
|
|
dcEvent.getDcEventTrafficControl().setId(uuid); |
|
|
dcEvent.getDcEventTrafficControl().setId(uuid); |
|
|
|
|
|
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id
|
|
|
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); |
|
|
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().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]);//取出数组字段赋值 设施id
|
|
|
|
|
|
|
|
|
|
|
|
//新增第一条数据
|
|
|
|
|
|
dcEvent.setId(map.get("facilityId"+i)); |
|
|
|
|
|
dcEvent.setEventState(0L); |
|
|
|
|
|
dcEvent.setDeptId(SecurityUtils.getDeptId()); |
|
|
|
|
|
dcEvent.setUserId(SecurityUtils.getUserId()); |
|
|
|
|
|
dcEvent.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
dcEvent.setEventNature(2L);//关联管制
|
|
|
|
|
|
// 使用StringBuilder来构建逗号分隔的字符串
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
|
|
boolean isFirst = true; |
|
|
|
|
|
// 迭代Map并过滤出不为1的键对应的值
|
|
|
|
|
|
for (Map.Entry<String, String> entry : map.entrySet()) { |
|
|
|
|
|
if (entry.getKey() !="facilityId"+i) { |
|
|
|
|
|
if (!isFirst) { |
|
|
|
|
|
sb.append(","); |
|
|
|
|
|
} |
|
|
|
|
|
sb.append(entry.getValue()); |
|
|
|
|
|
isFirst = false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
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()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
//交通拥堵
|
|
|
//交通拥堵
|
|
@ -723,6 +777,11 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl |
|
|
return dcEvents; |
|
|
return dcEvents; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public int updateDcEventState(String id, int state) { |
|
|
|
|
|
return dcEventMapper.updateDcEventState(id,state); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static <T> List<T> castList(Object obj, Class<T> clazz) { |
|
|
public static <T> List<T> castList(Object obj, Class<T> clazz) { |
|
|
List<T> result = new ArrayList<T>(); |
|
|
List<T> result = new ArrayList<T>(); |
|
|
if (obj instanceof List<?>) { |
|
|
if (obj instanceof List<?>) { |
|
|