代码调整

This commit is contained in:
tiger_zhou 2023-12-22 16:38:13 +08:00
parent fc36033c44
commit 926a12d4e2
2 changed files with 5 additions and 3 deletions

View File

@ -79,11 +79,13 @@ public class InterLockData extends AbstractData {
private void handleLevelOne(AlertType alertType, Map<AlertType, List<AreaConfigVO>> alertTypeListMap, MessageOrBuilder builder, Integer lineId) { private void handleLevelOne(AlertType alertType, Map<AlertType, List<AreaConfigVO>> alertTypeListMap, MessageOrBuilder builder, Integer lineId) {
List<AreaConfigVO> interlockList = alertTypeListMap.get(alertType); List<AreaConfigVO> interlockList = alertTypeListMap.get(alertType);
Integer rtuId = DeviceStatusDataOperate.findFieldVal(builder, "rtuId", Integer.class); Integer rtuId = DeviceStatusDataOperate.findFieldVal(builder, "rtuId", Integer.class);
for (AreaConfigVO interlockArea : interlockList) { for (AreaConfigVO interlockArea : interlockList) {
List<Station> sortStationList = this.sortRtu(interlockArea.getDatas(), lineId); List<Station> sortStationList = this.sortRtu(interlockArea.getDatas(), lineId);
Integer min = Integer.parseInt(sortStationList.get(0).getCode()); Integer min = Integer.parseInt(sortStationList.get(0).getCode());
Integer max = Integer.parseInt(sortStationList.get(sortStationList.size() - 1).getCode()); Integer max = Integer.parseInt(sortStationList.get(sortStationList.size() - 1).getCode());
if (rtuId >= min && rtuId <= max) { if (rtuId >= min && rtuId <= max) {
if (builder instanceof Track.Builder track) { if (builder instanceof Track.Builder track) {
String axleCode = LineGraphicDataRepository.findAxleCodeFromLogicCode(lineId, track.getId()); String axleCode = LineGraphicDataRepository.findAxleCodeFromLogicCode(lineId, track.getId());
@ -169,7 +171,7 @@ public class InterLockData extends AbstractData {
@Override @Override
public void reset() { public void reset() {
} }
public static class InterLockDetail { public static class InterLockDetail {

View File

@ -104,7 +104,7 @@ public class DeviceAreaConfigService {
public void saveOrUpdate(DeviceAreaConfigDto dto) { public void saveOrUpdate(DeviceAreaConfigDto dto) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(CollectionUtils.isNotEmpty(dto.getAlertTypes()), "绑定数据类型不能为空"); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(CollectionUtils.isNotEmpty(dto.getAlertTypes()), "绑定数据类型不能为空");
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(dto.getAlertTypes().contains(AlertType.INTERLOCK_LEVEL_ONE.name()) && dto.getAlertTypes().size() != 1, "联锁区只能选择一个类型"); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(dto.getAlertTypes().contains(AlertType.INTERLOCK_LEVEL_ONE.name()) && dto.getAlertTypes().size() != 1, "联锁区只能选择一个类型");
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(dto.getAlertTypes().contains(AlertType.INTERLOCK_LEVEL_ONE.name()) && dto.getData().size() > 1, "联锁区只能添加一个设备"); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(dto.getAlertTypes().contains(AlertType.INTERLOCK_LEVEL_ONE.name()) && dto.getData().size() > 2, "联锁区只能添加二个设备");
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(CollectionUtils.isNotEmpty(dto.getData()), "绑定数据不能为空"); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(CollectionUtils.isNotEmpty(dto.getData()), "绑定数据不能为空");
boolean isUpdate = false; boolean isUpdate = false;