package com.zksy.cockpit.workorder; import java.util.List; /** * 全量工单列表响应(票 65:报警效率面板的「当前工单列表」)。 * *

与按设备/按事件的 {@link CockpitWorkOrderReadResponse} 保持同一套外形约定 * ({@code requestId/apiVersion/readOnly/state/stateReason/stateDictionary/workOrders}), * 只把「设备/事件」两个维度字段换成分页四件套 —— 前端两处可共用同一份转换与卡片渲染。 */ public class CockpitWorkOrderListResponse { private final String requestId; private final String apiVersion; private final boolean readOnly; private final String state; private final String stateReason; private final List stateDictionary; private final List workOrders; private final Pagination pagination; public CockpitWorkOrderListResponse( String requestId, String apiVersion, boolean readOnly, String state, String stateReason, List stateDictionary, List workOrders, Pagination pagination) { this.requestId = requestId; this.apiVersion = apiVersion; this.readOnly = readOnly; this.state = state; this.stateReason = stateReason; this.stateDictionary = stateDictionary; this.workOrders = workOrders; this.pagination = pagination; } public String getRequestId() { return requestId; } public String getApiVersion() { return apiVersion; } public boolean isReadOnly() { return readOnly; } public String getState() { return state; } public String getStateReason() { return stateReason; } public List getStateDictionary() { return stateDictionary; } public List getWorkOrders() { return workOrders; } public Pagination getPagination() { return pagination; } /** 分页回显(与其它驾驶舱端点同名字段:page/pageSize/total/totalPages,前端读同一套)。 */ public static class Pagination { private final int page; private final int pageSize; private final int total; private final int totalPages; public Pagination(int page, int pageSize, int total) { this.page = page; this.pageSize = pageSize; this.total = total; this.totalPages = pageSize <= 0 ? 1 : Math.max(1, (total + pageSize - 1) / pageSize); } public int getPage() { return page; } public int getPageSize() { return pageSize; } public int getTotal() { return total; } public int getTotalPages() { return totalPages; } } }