From 30ef80efa4b2fc0338d603356de75e689a3f91bf Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 12 Dec 2022 13:39:55 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E3=80=90=E5=AE=9E=E8=AE=AD=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E9=97=AE=E9=A2=98=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/training2/rule/MapLocationRule.java | 2 +- .../vo/training2/rule/PropertyValueRule.java | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java index 1d214686f..ff3124e91 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java @@ -111,7 +111,7 @@ public enum MapLocationRule { .filter(mapStationNewVO -> !mapStationNewVO.isDepot()).findFirst().get(); // 横向偏差 int x = point.getX() - 960; // 屏幕一般宽度 - int y = point.getY() + stationNewVO.getPosition().getY(); + int y = stationNewVO.getPosition().getY(); return String.format("{\"x\":%d,\"y\":%d,\"scale\":\"%s\"}", x, y, s); } } diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java index 71fdaf11f..a1f4dd09a 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java @@ -79,26 +79,29 @@ public enum PropertyValueRule { ROUTE_END_SIGNAL_NAME("进路末端名称") { @Override public String resolve(Simulation simulation, Object mapElement) { - return ((Route) mapElement).getDestination().getShowName(); + Route route = (Route) mapElement; + if (route.getDestinationButtonSignal() != null) { + return route.getDestinationButtonSignal().getShowName(); + } else { + return route.getDestination().getShowName(); + } } }, ROUTE_END_SIGNAL_CODE("进路末端信号机编码") { @Override public String resolve(Simulation simulation, Object mapElement) { - return ((Route) mapElement).getDestination().getCode(); + Route route = (Route) mapElement; + if (route.getDestinationButtonSignal() != null) { + return route.getDestinationButtonSignal().getCode(); + } else { + return route.getDestination().getCode(); + } } }, - ROUTE_END_BUTTON_CODE("进路末端按钮编码") { + ROUTE_END_BUTTON_SIGNAL_NAME("进路终端按钮信号机名称") { @Override - public String resolve(Simulation simulation, Object mapElement) { - Route route = (Route) mapElement; - List signalButtonList = simulation.getBuildParams().getMap().getGraphDataNew().getSignalButtonList(); - MapSignalButtonVO buttonVO = signalButtonList.stream().filter(button -> MapSignalButtonVO.Type.PICK.equals(button.getType()) - && Objects.equals(button.getSignalCode(), route.getDestination().getCode())).findFirst().orElse(null); - if (buttonVO == null) { - throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "错误数据"); - } - return buttonVO.getCode(); + public Object resolve(Simulation simulation, Object mapElement) { + return ((Route) mapElement).getDestinationButtonSignal().getShowName(); } }, SIGNAL_BUTTON_CODE("信号机按钮编码") { From aacec609a8540647e7a2671ca8c590e77bad90ce Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Mon, 12 Dec 2022 15:54:09 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=9D=83=E9=99=90=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../permission/OldPermissionDataSyncService.java | 12 +++++++++--- .../rtss/vo/permission/sync/UserPermissionVO.java | 2 ++ .../resources/mybatis/mapper/permission/SyncDAO.xml | 4 +++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/permission/OldPermissionDataSyncService.java b/src/main/java/club/joylink/rtss/services/permission/OldPermissionDataSyncService.java index 052dae846..d9a0cda45 100644 --- a/src/main/java/club/joylink/rtss/services/permission/OldPermissionDataSyncService.java +++ b/src/main/java/club/joylink/rtss/services/permission/OldPermissionDataSyncService.java @@ -214,6 +214,7 @@ public class OldPermissionDataSyncService { List refList = PermissionDistributeConvertor.convertDistributeRefListTo(dataVO.getPermissionIds(),null); for (RtsPermissionDistributeRef ref : refList) { + ref.setRemains(0); ref.setIsSync(true); allRefList.add(ref); } @@ -232,6 +233,7 @@ public class OldPermissionDataSyncService { } for (PermissionSubject ps : psList) { ps.setIsSync(true); + ps.setRemains(0); } this.subjectDAO.batchInsert(psList); } @@ -429,17 +431,19 @@ public class OldPermissionDataSyncService { dataVO.setCreatorId(vo.permission.getCreatorId()); dataVO.setId(vo.getDistributeId()); dataVO.setDsc(vo.getPermission().getName()); - dataVO.setCreateTime(vo.getPermission().getCreateTime()); - dataVO.setUpdateTime(vo.getPermission().getUpdateTime()); + dataVO.setCreateTime(vo.getStartTime()); + dataVO.setUpdateTime(vo.getStartTime()); dataVO.setForever(vo.forever); dataVO.setStartTime(vo.getStartTime()); dataVO.setEndTime(vo.getEndTime()); dataVO.setStatus(PermissionDistributeStatusEnum.Valid.getValue()); + dataVO.setDsc(vo.getOrganizationName()); DistributeDataVO.DistributePermissionVO dpVO = new DistributeDataVO.DistributePermissionVO(); dpVO.setPermissionId(vo.getPermission().getId()); dpVO.setDistributeId(vo.getDistributeId()); dpVO.setAmount(vo.getAmount()); - dpVO.setRemains(vo.getRemains()); + dpVO.setRemains(0); + dataVO.setPermissionIds(Arrays.asList(dpVO)); return dataVO; } @@ -452,6 +456,7 @@ public class OldPermissionDataSyncService { syncVO.setStartTime(permissionVO.getStartTime()); syncVO.setEndTime(permissionVO.getEndTime()); syncVO.setDistributeId(permissionVO.getDistributeId()); + syncVO.setOrganizationName(permissionVO.getOrganizationName()); return syncVO; } } @@ -465,6 +470,7 @@ public class OldPermissionDataSyncService { Integer amount; Integer remains; Long distributeId; + String organizationName; List systemAbility; public SyncVO(Permission permission, List systemAbility) { diff --git a/src/main/java/club/joylink/rtss/vo/permission/sync/UserPermissionVO.java b/src/main/java/club/joylink/rtss/vo/permission/sync/UserPermissionVO.java index 375ea7497..8347c34fe 100644 --- a/src/main/java/club/joylink/rtss/vo/permission/sync/UserPermissionVO.java +++ b/src/main/java/club/joylink/rtss/vo/permission/sync/UserPermissionVO.java @@ -34,6 +34,8 @@ public class UserPermissionVO { private Integer amount; private Integer remains; private String mapName; + private Long organizationId; + private String organizationName; // private boolean errorData; private List permissionVO; } diff --git a/src/main/resources/mybatis/mapper/permission/SyncDAO.xml b/src/main/resources/mybatis/mapper/permission/SyncDAO.xml index 7ada1f049..100ae4ae8 100644 --- a/src/main/resources/mybatis/mapper/permission/SyncDAO.xml +++ b/src/main/resources/mybatis/mapper/permission/SyncDAO.xml @@ -4,9 +4,11 @@ From 2021702a7d11ad7f48cc30385525de75fbbf5e5d Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 12 Dec 2022 16:14:36 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E3=80=90=E5=AE=9E=E8=AE=AD=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E3=80=81=E5=AE=9A=E4=BD=8D=E3=80=81=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=80=BC=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/vo/training2/rule/MapDeviceRule.java | 8 ++++---- .../joylink/rtss/vo/training2/rule/MapLocationRule.java | 4 +++- .../rtss/vo/training2/rule/PropertyValueRule.java | 9 ++++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java index fcb383434..616183656 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java @@ -7,10 +7,7 @@ import lombok.Getter; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Random; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -121,6 +118,9 @@ public enum MapDeviceRule { if (route.getInterlockStation().isDepot() || !route.getInterlockStation().isInterlock()) { return false; } + if (!Objects.equals(route.getInterlockStation(), route.getStart().getDeviceStation())) { + return false; + } if (route.getSectionList().size() < 2) { return false; } diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java index ff3124e91..16b880a15 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java @@ -107,11 +107,13 @@ public enum MapLocationRule { private static String calcMapLocation(Simulation simulation, Supplier devicePoint) { Point point = devicePoint.get(); String s = simulation.getBuildParams().getMap().getGraphDataNew().getScaling(); // 默认缩放比 + s = StringUtils.isEmpty(s) ? "1" : s; MapStationNewVO stationNewVO = simulation.getBuildParams().getMap().getGraphDataNew().getStationList().stream() .filter(mapStationNewVO -> !mapStationNewVO.isDepot()).findFirst().get(); // 横向偏差 int x = point.getX() - 960; // 屏幕一般宽度 - int y = stationNewVO.getPosition().getY(); + int y = stationNewVO.getPosition().getY() - 540; + return String.format("{\"x\":%d,\"y\":%d,\"scale\":\"%s\"}", x, y, s); } } diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java index a1f4dd09a..b00ac98fc 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java @@ -17,7 +17,11 @@ public enum PropertyValueRule { NAME("地图设备名称") { @Override public String resolve(Simulation simulation, Object mapElement) { - return ((MapNamedElement) mapElement).getName(); + if (mapElement instanceof Signal) { + return ((Signal) mapElement).getShowName(); + } else { + return ((MapNamedElement) mapElement).getName(); + } } }, CODE("地图设备编码") { @@ -136,8 +140,7 @@ public enum PropertyValueRule { SIGNAL_ROUTE_CODE_LIST("信号机关联的所有进路编码") { @Override public Object resolve(Simulation simulation, Object mapElement) { - Signal signal = (Signal) mapElement; - return signal.getRouteList().stream().map(Route::getCode).collect(Collectors.toList()); + return ((Signal) mapElement).getRouteList().stream().map(Route::getCode).sorted().collect(Collectors.toList()); } }, CENTER_CONTROL_STATION_CODE_LIST("站控转中控时车站列表") { From a9aa76685e66edfce207f9193adbb9056ddd1dbe Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Mon, 12 Dec 2022 16:51:29 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=9D=83=E9=99=90=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mybatis/mapper/permission/SyncDAO.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/mybatis/mapper/permission/SyncDAO.xml b/src/main/resources/mybatis/mapper/permission/SyncDAO.xml index 100ae4ae8..e958a594f 100644 --- a/src/main/resources/mybatis/mapper/permission/SyncDAO.xml +++ b/src/main/resources/mybatis/mapper/permission/SyncDAO.xml @@ -9,7 +9,7 @@ left join map_info C on B.map_id = C.id left join permission_distribute D on A.distribute_id = D.id left join organization E on E.id = D.organization_id - where 1 = 1 and C.id is not null and C.status = '1' + where 1 = 1 and C.id is not null and C.status = '1' and A.status = '1' From 9a8e43c1f26cf6f2dc3fece8cfb24ccecda0d9e3 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 12 Dec 2022 17:37:39 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E3=80=90=E5=AE=9E=E8=AE=AD=E5=85=83?= =?UTF-8?q?=E7=B4=A0=E5=AE=9A=E4=BD=8D=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../club/joylink/rtss/vo/training2/rule/MapLocationRule.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java index 16b880a15..4bccbf946 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java @@ -112,8 +112,9 @@ public enum MapLocationRule { .filter(mapStationNewVO -> !mapStationNewVO.isDepot()).findFirst().get(); // 横向偏差 int x = point.getX() - 960; // 屏幕一般宽度 - int y = stationNewVO.getPosition().getY() - 540; - + // 纵向偏差 + Point origin = simulation.getBuildParams().getMap().getGraphDataNew().getOrigin(); + int y = (origin == null) ? stationNewVO.getPosition().getY() - 200 : origin.getY(); return String.format("{\"x\":%d,\"y\":%d,\"scale\":\"%s\"}", x, y, s); } }