puzhibing
2026-08-21 3f6d5b788670170da195be8d8cee814069b3b224
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.xiaopeng.admin.support;
 
import com.xiaopeng.api.vo.commandCenter.CommandCenterKpiVo;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
 
/**
 * 指挥中心 Mock KPI
 *
 * @ClassName CommandCenterMockKpiSupport
 * @Description 与 mock 车辆 99901~99908 状态分布一致的 KPI
 */
public final class CommandCenterMockKpiSupport {
 
    private CommandCenterMockKpiSupport() {
    }
 
    /**
     * 构建 mock KPI(8 辆 mock 车各一种状态)
     *
     * @return mock KPI
     */
    public static CommandCenterKpiVo buildMockKpi() {
        CommandCenterKpiVo kpi = new CommandCenterKpiVo();
        kpi.setCruisingCount(1);
        kpi.setPickUpCount(1);
        kpi.setDropOffCount(1);
        kpi.setHasOrderCount(2);
        kpi.setChargingCount(1);
        kpi.setPreparingCount(1);
        kpi.setReturningCount(1);
        kpi.setOccupiedCount(3);
        kpi.setAbnormalCount(1);
        kpi.setOddOutCount(1);
        kpi.setTotalAbnormalCount(2);
        kpi.setTodayCompletedOrders(18);
        kpi.setAvgOrdersPerVehicle(BigDecimal.valueOf(18).divide(BigDecimal.valueOf(8), 2, RoundingMode.HALF_UP));
        return kpi;
    }
 
    /**
     * KPI 是否为空(聚合失败或未初始化)
     *
     * @param kpi KPI
     * @return 是否为空
     */
    public static boolean isEmptyKpi(CommandCenterKpiVo kpi) {
        return kpi == null || kpi.getCruisingCount() == null;
    }
}