mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-04 05:58:00 +08:00
update
This commit is contained in:
@@ -319,6 +319,11 @@ public class OrderService {
|
|||||||
private String saveOrder2Database(GenerateOrderDTO dto) {
|
private String saveOrder2Database(GenerateOrderDTO dto) {
|
||||||
String orderCode = IdUtils.getOrderCode();
|
String orderCode = IdUtils.getOrderCode();
|
||||||
String transactionCode = IdUtils.generateTransactionCode(dto.getPileSn(), dto.getConnectorCode());
|
String transactionCode = IdUtils.generateTransactionCode(dto.getPileSn(), dto.getConnectorCode());
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(dto.getStartType())) {
|
||||||
|
dto.setStartType(StartTypeEnum.NOW.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
// 订单基本信息
|
// 订单基本信息
|
||||||
OrderBasicInfo orderBasicInfo = OrderBasicInfo.builder()
|
OrderBasicInfo orderBasicInfo = OrderBasicInfo.builder()
|
||||||
.orderCode(orderCode)
|
.orderCode(orderCode)
|
||||||
@@ -334,8 +339,8 @@ public class OrderService {
|
|||||||
.payAmount(dto.getChargeAmount())
|
.payAmount(dto.getChargeAmount())
|
||||||
.payMode(dto.getPayMode())
|
.payMode(dto.getPayMode())
|
||||||
.orderAmount(BigDecimal.ZERO)
|
.orderAmount(BigDecimal.ZERO)
|
||||||
.startType("appointment") // 测试代码用完删除
|
.startType(dto.getStartType())
|
||||||
.appointmentTime(DateUtils.addMinute(new Date(), 5))
|
.appointmentTime(dto.getAppointmentTime())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 订单详情
|
// 订单详情
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.jsowell.common.util;
|
|||||||
import com.google.common.primitives.Bytes;
|
import com.google.common.primitives.Bytes;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import javax.xml.bind.DatatypeConverter;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@@ -128,9 +127,22 @@ public class YKCUtils {
|
|||||||
// System.out.println(binary);
|
// System.out.println(binary);
|
||||||
// System.out.println(aaa);
|
// System.out.println(aaa);
|
||||||
|
|
||||||
String hexString = "680d3c4000038800000000002701001568";
|
String hexString = "4f";
|
||||||
byte[] bytes = BytesUtil.hexStringToByteArray(hexString);
|
byte[] bytes = new byte[]{0x4f};
|
||||||
System.out.println(checkMsg(bytes));
|
|
||||||
|
String s = transitionTemperature(bytes);
|
||||||
|
System.out.println(s);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换温度
|
||||||
|
* BIN 码 1 整形,偏移量-50;待机置零
|
||||||
|
*/
|
||||||
|
public static String transitionTemperature(byte[] bytes) {
|
||||||
|
String s = BytesUtil.binary(bytes, 10);
|
||||||
|
int i = Integer.parseInt(s);
|
||||||
|
i = i - 50;
|
||||||
|
return String.valueOf(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
|
|||||||
startIndex += length;
|
startIndex += length;
|
||||||
length = 1;
|
length = 1;
|
||||||
byte[] gunLineTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
byte[] gunLineTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
String gunLineTemperature = String.valueOf(gunLineTemperatureByteArr[0]);
|
String gunLineTemperature = YKCUtils.transitionTemperature(gunLineTemperatureByteArr);
|
||||||
realTimeMonitorData.setGunLineTemperature(gunLineTemperature);
|
realTimeMonitorData.setGunLineTemperature(gunLineTemperature);
|
||||||
|
|
||||||
// 枪线编码 没有置零
|
// 枪线编码 没有置零
|
||||||
@@ -138,7 +138,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
|
|||||||
startIndex += length;
|
startIndex += length;
|
||||||
length = 1;
|
length = 1;
|
||||||
byte[] batteryMaxTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
byte[] batteryMaxTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
String batteryMaxTemperature = String.valueOf(batteryMaxTemperatureByteArr[0]);
|
String batteryMaxTemperature = YKCUtils.transitionTemperature(batteryMaxTemperatureByteArr);
|
||||||
realTimeMonitorData.setBatteryMaxTemperature(batteryMaxTemperature);
|
realTimeMonitorData.setBatteryMaxTemperature(batteryMaxTemperature);
|
||||||
|
|
||||||
// 累计充电时间 单位: min;待机置零
|
// 累计充电时间 单位: min;待机置零
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成订单dto
|
* 生成订单dto
|
||||||
@@ -48,4 +49,15 @@ public class GenerateOrderDTO extends BasicPileDTO{
|
|||||||
* 计费模板相关信息
|
* 计费模板相关信息
|
||||||
*/
|
*/
|
||||||
private BillingTemplateVO billingTemplate;
|
private BillingTemplateVO billingTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动类型
|
||||||
|
* @see com.jsowell.common.enums.ykc.StartTypeEnum
|
||||||
|
*/
|
||||||
|
private String startType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约时间
|
||||||
|
*/
|
||||||
|
private Date appointmentTime;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user