mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 预约启动
This commit is contained in:
@@ -8,6 +8,7 @@ import javax.xml.bind.DatatypeConverter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Stack;
|
||||
|
||||
@@ -403,6 +404,11 @@ public class BytesUtil {
|
||||
return rightPadBytes(target, len, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* ASCII转字符串 小端模式
|
||||
* @param ascs
|
||||
* @return
|
||||
*/
|
||||
public static String ascii2StrLittle(byte[] ascs) {
|
||||
byte[] data = revert(ascs);
|
||||
String asciiStr = null;
|
||||
@@ -414,6 +420,11 @@ public class BytesUtil {
|
||||
return asciiStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* ASCII转字符串
|
||||
* @param ascs
|
||||
* @return
|
||||
*/
|
||||
public static String ascii2Str(byte[] ascs) {
|
||||
byte[] data = ascs;
|
||||
String asciiStr = null;
|
||||
@@ -425,17 +436,20 @@ public class BytesUtil {
|
||||
return asciiStr;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String vin1 = "SAITER00000000001";
|
||||
byte[] bytes = str2Asc(vin1);
|
||||
String s = ascii2Str(bytes);
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转ASCII 小端模式
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static byte[] str2AscLittle(String str) {
|
||||
return revert(str2Asc(str));
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转ASCII
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static byte[] str2Asc(String str) {
|
||||
byte[] bytes = null;
|
||||
try {
|
||||
|
||||
@@ -184,7 +184,7 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
}
|
||||
// 如果 vinCodes 的数量少于 3,用 "0" 补足
|
||||
while (vinCodes.size() < 3) {
|
||||
vinCodes.add("0");
|
||||
vinCodes.add("");
|
||||
}
|
||||
|
||||
String type = StringUtils.equals(pileReservationInfo.getReservationType(), "single") ? "00" : "01";
|
||||
|
||||
@@ -508,24 +508,14 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
|
||||
// VIN1
|
||||
String vin1 = command.getVin1();
|
||||
if (StringUtils.isBlank(vin1)) {
|
||||
vin1 = Constants.ZERO;
|
||||
}
|
||||
// byte[] vin1ByteArr = BytesUtil.str2Bcd(vin1);
|
||||
byte[] vin1ByteArr = BytesUtil.str2Asc(vin1);
|
||||
vin1ByteArr = BytesUtil.ensureLength(vin1ByteArr, 17);
|
||||
|
||||
String vin2 = command.getVin2();
|
||||
if (StringUtils.isBlank(vin2)) {
|
||||
vin2 = Constants.ZERO;
|
||||
}
|
||||
byte[] vin2ByteArr = BytesUtil.str2Asc(vin2);
|
||||
vin2ByteArr = BytesUtil.ensureLength(vin2ByteArr, 17);
|
||||
|
||||
String vin3 = command.getVin3();
|
||||
if (StringUtils.isBlank(vin3)) {
|
||||
vin3 = Constants.ZERO;
|
||||
}
|
||||
byte[] vin3ByteArr = BytesUtil.str2Asc(vin3);
|
||||
vin3ByteArr = BytesUtil.ensureLength(vin3ByteArr, 17);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user