update 电单车

This commit is contained in:
Guoqs
2024-09-14 13:56:58 +08:00
parent bb18640175
commit 95a49969b4
9 changed files with 68 additions and 63 deletions

View File

@@ -1,5 +1,8 @@
package com.jsowell.common.enums.ebike;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.util.StringUtils;
/**
* 电单车端口状态
*/
@@ -64,4 +67,20 @@ public enum PortStatusEnum {
}
return null;
}
/**
* 电单车协议状态转换为数据库状态
* @param eBikeStatus
* @return
*/
public static String eBikeStatusTransformDBStatus(String eBikeStatus) {
String dbStatus = Constants.ZERO; // 默认0-离网
if (StringUtils.isNotBlank(eBikeStatus)) {
PortStatusEnum enumByValue = PortStatusEnum.getEnumByValue(Integer.parseInt(eBikeStatus));
if (enumByValue != null) {
dbStatus = enumByValue.getDbStatus();
}
}
return dbStatus;
}
}