mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 新增小程序查询枪列表根据状态排序
This commit is contained in:
@@ -440,6 +440,19 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
|
||||
List<PileConnectorInfoVO> pileConnectorInfoList = pileConnectorInfoMapper.getPileConnectorInfoList(pileSns, connectorIds, connectorCodeList);
|
||||
|
||||
// 根据枪口状态排序
|
||||
// 定义 status 的优先级(值越小,优先级越高)
|
||||
Map<Integer, Integer> priority = Collections.unmodifiableMap(new HashMap<Integer, Integer>() {{
|
||||
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<PileConnectorInfoVO> pageInfo = new PageInfo<>(pileConnectorInfoList);
|
||||
|
||||
// 查询枪口当前订单
|
||||
|
||||
Reference in New Issue
Block a user