package cn.com.taiji.core.entity.dict.basic; | package cn.com.taiji.core.entity.dict.basic; | ||||
import cn.com.taiji.common.pub.AssertUtil; | |||||
/** | /** | ||||
* @ClassName 设备型号 | |||||
* @ClassName 设备版本-卡签都合并了 | |||||
*/ | */ | ||||
public enum DeviceVersion { | public enum DeviceVersion { | ||||
CARD_4X("4X版本卡",4,4, "40"){}, | |||||
CARD_2X("2X版本卡",2,3, "20"){}, | |||||
OBU_4X("4X版本签",4,2, "40"){}, | |||||
OBU_2X("2X版本签",2,1, "20"){}, | |||||
CARD_GM("国密版本卡",5,5, "50"){}, | |||||
OBU_GM("国密版本签",5,6,"50"){}, | |||||
CARD_BOTH("双算法版本卡",4,7,"40"){}, | |||||
OBU_BOTH("双算法版本签",4,8,"40"){}, | |||||
// 双算法 | |||||
VER_2X("2X"){}, | |||||
VER_4X("4X"){}, | |||||
VER_BOTH("双算法"){}, | |||||
VER_GM("国密"){}, | |||||
; | ; | ||||
private String name; | private String name; | ||||
//开卡校验用 | |||||
private Integer versionCode; | |||||
//入库校验用 | |||||
private Integer code; | |||||
//vfjcode | |||||
private String vfjCode; | |||||
private DeviceVersion(String name, Integer versionCode , Integer code, String vfjCode) { | |||||
private DeviceVersion(String name) { | |||||
this.name = name; | this.name = name; | ||||
this.versionCode = versionCode; | |||||
this.code = code; | |||||
this.vfjCode = vfjCode; | |||||
} | |||||
public String getVfjCode() { | |||||
return vfjCode; | |||||
} | } | ||||
public void setVfjCode(String vfjCode) { | |||||
this.vfjCode = vfjCode; | |||||
} | |||||
public Integer getCode() { | |||||
return code; | |||||
} | |||||
public void setCode(Integer code) { | |||||
this.code = code; | |||||
} | |||||
public Integer getVersionCode() { | |||||
return versionCode; | |||||
} | |||||
public void setVersionCode(Integer versionCode) { | |||||
this.versionCode = versionCode; | |||||
} | |||||
public String getName() { | public String getName() { | ||||
return name; | return name; | ||||
} | } | ||||
public void setName(String name) { | public void setName(String name) { | ||||
this.name = name; | this.name = name; | ||||
} | } | ||||
public static boolean versionCheck(DeviceVersion cardVersion,DeviceVersion obuVersion){ | |||||
/*AssertUtil.notNull(cardVersion); | |||||
AssertUtil.notNull(obuVersion);*/ | |||||
return cardVersion.getVersionCode().intValue() == obuVersion.getVersionCode().intValue(); | |||||
} | |||||
public static DeviceVersion getDeviceVersionFromCode(Integer code) { | |||||
DeviceVersion version = null; | |||||
for(DeviceVersion deviceVersion :DeviceVersion.values()) { | |||||
if(deviceVersion.getCode().intValue()==code.intValue()) { | |||||
version = deviceVersion; | |||||
} | |||||
} | |||||
return version; | |||||
} | |||||
} | } |
package cn.com.taiji.core.entity.dict.basic; | |||||
/** | |||||
* @desc : OBU类型 | |||||
*/ | |||||
public enum ObuType { | |||||
SINGLE_CHIP("单片式OBU",1){}, | |||||
DOUBLE_CHIPS("双片式OBU",2){}, | |||||
; | |||||
private String value; | |||||
private int code; | |||||
private ObuType(String value,int code){ | |||||
this.value=value; | |||||
this.code=code; | |||||
} | |||||
public static ObuType fromCode(Integer code){ | |||||
for(ObuType type:ObuType.values()){ | |||||
if(type.getCode()==code){ | |||||
return type; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
public String getValue() { | |||||
return value; | |||||
} | |||||
public int getCode() { | |||||
return code; | |||||
} | |||||
} |
package cn.com.taiji.core.entity.dict.ods; | |||||
import cn.com.taiji.common.pub.AssertUtil; | |||||
/** | |||||
* 老系统实体引用,其他地方禁用本枚举 | |||||
*/ | |||||
@Deprecated | |||||
public enum DeviceVersion { | |||||
CARD_4X("4X版本卡",4,4, "40"){}, | |||||
CARD_2X("2X版本卡",2,3, "20"){}, | |||||
OBU_4X("4X版本签",4,2, "40"){}, | |||||
OBU_2X("2X版本签",2,1, "20"){}, | |||||
CARD_GM("国密版本卡",5,5, "50"){}, | |||||
OBU_GM("国密版本签",5,6,"50"){}, | |||||
CARD_BOTH("双算法版本卡",4,7,"40"){}, | |||||
OBU_BOTH("双算法版本签",4,8,"40"){}, | |||||
// 双算法 | |||||
; | |||||
private String name; | |||||
//开卡校验用 | |||||
private Integer versionCode; | |||||
//入库校验用 | |||||
private Integer code; | |||||
//vfjcode | |||||
private String vfjCode; | |||||
private DeviceVersion(String name, Integer versionCode , Integer code, String vfjCode) { | |||||
this.name = name; | |||||
this.versionCode = versionCode; | |||||
this.code = code; | |||||
this.vfjCode = vfjCode; | |||||
} | |||||
public String getVfjCode() { | |||||
return vfjCode; | |||||
} | |||||
public void setVfjCode(String vfjCode) { | |||||
this.vfjCode = vfjCode; | |||||
} | |||||
public Integer getCode() { | |||||
return code; | |||||
} | |||||
public void setCode(Integer code) { | |||||
this.code = code; | |||||
} | |||||
public Integer getVersionCode() { | |||||
return versionCode; | |||||
} | |||||
public void setVersionCode(Integer versionCode) { | |||||
this.versionCode = versionCode; | |||||
} | |||||
public String getName() { | |||||
return name; | |||||
} | |||||
public void setName(String name) { | |||||
this.name = name; | |||||
} | |||||
public static boolean versionCheck(DeviceVersion cardVersion,DeviceVersion obuVersion){ | |||||
AssertUtil.notNull(cardVersion); | |||||
AssertUtil.notNull(obuVersion); | |||||
return cardVersion.getVersionCode().intValue() == obuVersion.getVersionCode().intValue(); | |||||
} | |||||
public static DeviceVersion getDeviceVersionFromCode(Integer code) { | |||||
DeviceVersion version = null; | |||||
for(DeviceVersion deviceVersion :DeviceVersion.values()) { | |||||
if(deviceVersion.getCode().intValue()==code.intValue()) { | |||||
version = deviceVersion; | |||||
} | |||||
} | |||||
return version; | |||||
} | |||||
} |