package com.sysware.task.util;/** * 任务状态对应任务图标枚举类 */public enum TaskStatusEnum { PLANNING("planning", "编制中", "icon-p2m-planning"), UNACTIVE("unactive", "未激活", "icon-p2m-unactived"), UNACCEPT("unaccept", "未接受", "icon-p2m-unaccepted"), RUNNING("running", "进行中", "icon-p2m-running"), APPROVING("approving", "审批中", "icon-p2m-aproving"), CONFIRMING("confirming", "确认中", "icon-p2m-confirming"), TERMINATED("terminated", "已终止", "icon-p2m-terminated"), COMPLETED("completed", "已完成", "icon-p2m-completed"), PAUSED("paused", "暂停", "icon-p2m-paused"); private String statusId; private String statusName; private String statusIcon; /** * 构造方法 * * @param statusName 任务状态名称 * @param statusIcon 任务状态图标 */ TaskStatusEnum(String statusId, String statusName, String statusIcon) { this.statusId = statusId; this.statusName = statusName; this.statusIcon = statusIcon; } /** * 根据任务状态名称获取状态图标 * * @param statusName 任务状态名称 * @return */ public static String getStatusIconByStatusName(String statusName) { for (TaskStatusEnum status : TaskStatusEnum.values()) { if (status.getStatusName().equals(statusName)) { return status.statusIcon; } } return null; } /** * 根据任务状态ID获取状态图标 * * @param statusId * @return */ public static String getStatusIconByStatusId(String statusId) { for (TaskStatusEnum status : TaskStatusEnum.values()) { if (status.getStatusId().equals(statusId)) { return status.statusIcon; } } return null; } public String getStatusId() { return statusId; } public void setStatusId(String statusId) { this.statusId = statusId; } public String getStatusName() { return statusName; } public void setStatusName(String statusName) { this.statusName = statusName; } public String getStatusIcon() { return statusIcon; } public void setStatusIcon(String statusIcon) { this.statusIcon = statusIcon; }}
调用方式
TaskStatusEnum.getStatusIconByStatusId(map.get("STATUSID"))