From 19fe926856c11b3efb641e4f5d5ceb4b387b8a29 Mon Sep 17 00:00:00 2001 From: Lemon Date: Fri, 30 May 2025 13:10:47 +0800 Subject: [PATCH] =?UTF-8?q?=20update=20=E6=96=B0=E5=A2=9E=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=9F=A5=E8=AF=A2=E6=9E=AA=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=8A=B6=E6=80=81=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PileConnectorInfoServiceImpl.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index 66f06bdf1..34a5ee062 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -440,6 +440,19 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { List pileConnectorInfoList = pileConnectorInfoMapper.getPileConnectorInfoList(pileSns, connectorIds, connectorCodeList); + // 根据枪口状态排序 + // 定义 status 的优先级(值越小,优先级越高) + Map priority = Collections.unmodifiableMap(new HashMap() {{ + put(Integer.parseInt(PileConnectorDataBaseStatusEnum.FREE.getValue()), 1); // 空闲 → 1 + put(Integer.parseInt(PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue()), 2); // 占用 → 2 + put(Integer.parseInt(PileConnectorDataBaseStatusEnum.FAULT.getValue()), 3); // 故障 → 3 + put(Integer.parseInt(PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue()), 4); // 离线 → 4 + }}); + pileConnectorInfoList.sort( + Comparator.comparingInt((PileConnectorInfoVO vo) -> priority.get(vo.getStatus())) + .thenComparing(PileConnectorInfoVO::getPileConnectorCode) // 状态相同则按枪口号排序 + ); + PageInfo pageInfo = new PageInfo<>(pileConnectorInfoList); // 查询枪口当前订单