Commit ab344be5 authored by 黄福新's avatar 黄福新

[add] 1、新增信号控制模式枚举;2、新增路口交通状态枚举;3、新增车道转向与转向类型枚举 等

        2、新增时间转换时间戳处理
parent abd757f4
package net.wanji.common.enums;
/**
* @author hfx
* @date 2023/1/28 16:13
* @desc 控制模式
*/
public enum ControlModeEnum {
FIXED_PERIOD(1, "定周期"),
GREEN_WAVE(2, "绿波协调"),
YELLOW_FLASH(3, "黄闪"),
FULL_RED(4, "全红"),
OFF_LIGHT(5, "关灯"),
SINGLE_POINT_ADAPTATION(6, "单点自适应"),
FULL_INDUCTION(7, "全感应"),
HALF_INDUCTION(8, "半感应");
private Integer code;
private String name;
ControlModeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return this.code;
}
public String getName() {
return this.name;
}
}
package net.wanji.common.enums;
public enum CrossStatusEnum {
NORMAL(0, "正常"),
UNBALANCE(1, "失衡"),
CONGESTION(2, "拥堵"),
SPILLOVER(3, "溢出"),
DEADLOCK(4, "死锁");
private Integer code;
private String name;
private CrossStatusEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return this.code;
}
public String getName() {
return this.name;
}
}
package net.wanji.common.enums;
/**
* @author hfx
* @date 2023/1/28 18:03
* @desc 转向转换
*/
public enum TurnConvertEnum {
/**
* 车道转向转换转向类型:key 车道转向,code 转向类型,desc 描述
* 车道转向:0未知;1左转;2直行;3右转;4掉头;5直左;6直右;7左直右;8左右;
* 9左转掉头;10直行掉头;11右转掉头;12左直掉头;13直右掉头;14左直右掉头;15左右掉头
*/
UNKNOWN(0, "UNKNOWN", "未知"),
L(1, "L", "左转"),
S(2, "S", "直行"),
R(3, "R", "右转"),
U(4, "U", "掉头"),
L_S(5, "L_S", "左转+直行"),
S_R(6, "S_R", "直行+右转"),
L_S_R(7, "L_S_R", "左转+直行+右转"),
L_R(8, "L_R", "左转+右转"),
L_U(9, "L_U", "左转+掉头"),
S_U(10, "S_U", "直行+掉头"),
R_U(11, "R_U", "右转+掉头"),
L_S_U(12, "L_S_U", "左转+直行+掉头"),
U_S_R(13, "U_S_R", "直行+右转+掉头"),
L_S_R_U(14, "L_S_R_U", "左转+直行+右转+掉头"),
L_R_U(15, "L_R_U", "左转+右转+掉头");
private Integer key;
private String code;
private String desc;
TurnConvertEnum(Integer key, String code, String desc){
this.key = key;
this.code = code;
this.desc = desc;
}
public Integer getKey() {
return key;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
public static String getCodeByKey(Integer key){
for (TurnConvertEnum e : TurnConvertEnum.values()) {
if(e.key.equals(key)){
return e.code;
}
}
return null;
}
public static Integer getKeyByCode(String code){
for (TurnConvertEnum e : TurnConvertEnum.values()) {
if(e.code.equals(code)){
return e.key;
}
}
return null;
}
public static String getDescByCode(String code){
for (TurnConvertEnum e : TurnConvertEnum.values()) {
if(e.code.equals(code)){
return e.desc;
}
}
return null;
}
}
package net.wanji.common.enums;
/**
* @author hfx
* @date 2023/1/28 15:37
* @desc WeekEnum
*/
public enum WeekEnum {
DEFAULT(0, "特殊日期"),
MONDAY(1, "星期一"),
TUESDAY(2,"星期二"),
WEDNESDAY(3,"星期三"),
THURSDAY(4,"星期四"),
FRIDAY(5,"星期五"),
SATURDAY(6,"星期六"),
SUNDAY(7,"星期日");
private Integer code;
private String name;
WeekEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return this.code;
}
public String getName() {
return this.name;
}
}
...@@ -427,6 +427,15 @@ public final class Constants { ...@@ -427,6 +427,15 @@ public final class Constants {
} }
public final static class SystemParam { public final static class SystemParam {
/**
* 分隔符:下划线
**/
public static final String SEPARATOR_UNDER_LINE = "_";
/**
* 分隔符:减号
**/
public static final String SEPARATOR_MINUS = "-";
/** /**
* 逗号分隔符 * 逗号分隔符
*/ */
...@@ -439,6 +448,26 @@ public final class Constants { ...@@ -439,6 +448,26 @@ public final class Constants {
* 空Json串 * 空Json串
*/ */
public static String BLANK_JSON_STRING = "{}"; public static String BLANK_JSON_STRING = "{}";
/**
* null
*/
public static final String NULL = null;
/**
* 否
*/
public static final Integer NO = 0;
/**
* 是
*/
public static final Integer YES = 1;
/**
* 零
*/
public static final Integer ZERO = 0;
} }
/** /**
......
...@@ -290,6 +290,33 @@ public class DateUtil { ...@@ -290,6 +290,33 @@ public class DateUtil {
return new SimpleDateFormat(format).format(date); return new SimpleDateFormat(format).format(date);
} }
/**
* 日期时间转换成豪秒
*
* @param dateTime
* @return
* @throws ParseException
*/
public static long dateToStamp(String dateTime) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = simpleDateFormat.parse(dateTime);
return date.getTime();
}
/**
* 日期时间转换成豪秒
*
* @param dateTime
* @param format
* @return
* @throws ParseException
*/
public static long dateToStamp(String dateTime, String format) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
Date date = simpleDateFormat.parse(dateTime);
return date.getTime();
}
/** /**
* 添加秒 * 添加秒
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment