update 预约充电记录

This commit is contained in:
Guoqs
2024-08-02 15:45:15 +08:00
parent 42f344f71e
commit ea0233fa9f
7 changed files with 52 additions and 26 deletions

View File

@@ -145,4 +145,11 @@ public class YKCUtils {
} }
return ""; return "";
} }
/**
* 解析vin
*/
public static String parseVin(byte[] vinCodeByteArr) {
return BytesUtil.ascii2Str(vinCodeByteArr);
}
} }

View File

@@ -65,7 +65,7 @@ public class ReservationChargingStartupResultHandler extends AbstractHandler{
startIndex += length; startIndex += length;
length = 17; length = 17;
byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length); byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String vinCode = BytesUtil.bcd2Str(vinCodeByteArr); String vinCode = YKCUtils.parseVin(vinCodeByteArr); // 解析vin
// 启动结果 0x00失败 0x01成功 // 启动结果 0x00失败 0x01成功
startIndex += length; startIndex += length;

View File

@@ -475,7 +475,7 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
startIndex += length; startIndex += length;
length = 17; length = 17;
byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length); byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String vinCode = BytesUtil.ascii2Str(vinCodeByteArr); String vinCode = YKCUtils.parseVin(vinCodeByteArr); // 解析vin
/** /**
* 交易标识 * 交易标识

View File

@@ -16,6 +16,11 @@ public class StartPersonPileDTO extends BaseDTO {
*/ */
private String merchantId; private String merchantId;
/**
* 充电桩所属站点id
*/
private String stationId;
/** /**
* 启动类型 * 启动类型
* @see com.jsowell.common.enums.ykc.StartTypeEnum * @see com.jsowell.common.enums.ykc.StartTypeEnum

View File

@@ -3596,33 +3596,40 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
// 订单详情 // 订单详情
BillingTemplateVO billingTemplate = dto.getBillingTemplate(); BillingTemplateVO billingTemplate = dto.getBillingTemplate();
logger.info("订单使用的计费模板-orderCode:{}, billingTemplate:{}", orderCode, JSON.toJSONString(billingTemplate)); logger.info("订单使用的计费模板-orderCode:{}, billingTemplate:{}", orderCode, JSON.toJSONString(billingTemplate));
OrderDetail orderDetail = null; BigDecimal sharpElectricityPrice = BigDecimal.ZERO; // 尖时段电费单价
BigDecimal sharpServicePrice = BigDecimal.ZERO; // 尖时段服务费单价
BigDecimal peakElectricityPrice = BigDecimal.ZERO; // 峰时段电费单价
BigDecimal peakServicePrice = BigDecimal.ZERO; // 峰时段服务费单价
BigDecimal flatElectricityPrice = BigDecimal.ZERO; // 平时段电费单价
BigDecimal flatServicePrice = BigDecimal.ZERO; // 平时段服务费单价
BigDecimal valleyElectricityPrice = BigDecimal.ZERO; // 谷时段电费单价
BigDecimal valleyServicePrice = BigDecimal.ZERO; // 谷时段服务费单价
if (billingTemplate != null) { if (billingTemplate != null) {
BigDecimal sharpElectricityPrice = billingTemplate.getSharpElectricityPrice() != null ? billingTemplate.getSharpElectricityPrice() : BigDecimal.ZERO; sharpElectricityPrice = billingTemplate.getSharpElectricityPrice() != null ? billingTemplate.getSharpElectricityPrice() : BigDecimal.ZERO;
BigDecimal sharpServicePrice = billingTemplate.getSharpServicePrice() != null ? billingTemplate.getSharpServicePrice() : BigDecimal.ZERO; sharpServicePrice = billingTemplate.getSharpServicePrice() != null ? billingTemplate.getSharpServicePrice() : BigDecimal.ZERO;
BigDecimal peakElectricityPrice = billingTemplate.getPeakElectricityPrice() != null ? billingTemplate.getPeakElectricityPrice() : BigDecimal.ZERO; peakElectricityPrice = billingTemplate.getPeakElectricityPrice() != null ? billingTemplate.getPeakElectricityPrice() : BigDecimal.ZERO;
BigDecimal peakServicePrice = billingTemplate.getPeakServicePrice() != null ? billingTemplate.getPeakServicePrice() : BigDecimal.ZERO; peakServicePrice = billingTemplate.getPeakServicePrice() != null ? billingTemplate.getPeakServicePrice() : BigDecimal.ZERO;
BigDecimal flatElectricityPrice = billingTemplate.getFlatElectricityPrice() != null ? billingTemplate.getFlatElectricityPrice() : BigDecimal.ZERO; flatElectricityPrice = billingTemplate.getFlatElectricityPrice() != null ? billingTemplate.getFlatElectricityPrice() : BigDecimal.ZERO;
BigDecimal flatServicePrice = billingTemplate.getFlatServicePrice() != null ? billingTemplate.getFlatServicePrice() : BigDecimal.ZERO; flatServicePrice = billingTemplate.getFlatServicePrice() != null ? billingTemplate.getFlatServicePrice() : BigDecimal.ZERO;
BigDecimal valleyElectricityPrice = billingTemplate.getValleyElectricityPrice() != null ? billingTemplate.getValleyElectricityPrice() : BigDecimal.ZERO; valleyElectricityPrice = billingTemplate.getValleyElectricityPrice() != null ? billingTemplate.getValleyElectricityPrice() : BigDecimal.ZERO;
BigDecimal valleyServicePrice = billingTemplate.getValleyServicePrice() != null ? billingTemplate.getValleyServicePrice() : BigDecimal.ZERO; valleyServicePrice = billingTemplate.getValleyServicePrice() != null ? billingTemplate.getValleyServicePrice() : BigDecimal.ZERO;
orderDetail = OrderDetail.builder()
.orderCode(orderCode)
.sharpPrice(sharpElectricityPrice.add(sharpServicePrice))
.sharpElectricityPrice(sharpElectricityPrice)
.sharpServicePrice(sharpServicePrice)
.peakPrice(peakElectricityPrice.add(peakServicePrice))
.peakElectricityPrice(peakElectricityPrice)
.peakServicePrice(peakServicePrice)
.flatPrice(flatElectricityPrice.add(flatServicePrice))
.flatElectricityPrice(flatElectricityPrice)
.flatServicePrice(flatServicePrice)
.valleyPrice(valleyElectricityPrice.add(valleyServicePrice))
.valleyElectricityPrice(valleyElectricityPrice)
.valleyServicePrice(valleyServicePrice)
.build();
} }
OrderDetail orderDetail = OrderDetail.builder()
.orderCode(orderCode)
.sharpPrice(sharpElectricityPrice.add(sharpServicePrice))
.sharpElectricityPrice(sharpElectricityPrice)
.sharpServicePrice(sharpServicePrice)
.peakPrice(peakElectricityPrice.add(peakServicePrice))
.peakElectricityPrice(peakElectricityPrice)
.peakServicePrice(peakServicePrice)
.flatPrice(flatElectricityPrice.add(flatServicePrice))
.flatElectricityPrice(flatElectricityPrice)
.flatServicePrice(flatServicePrice)
.valleyPrice(valleyElectricityPrice.add(valleyServicePrice))
.valleyElectricityPrice(valleyElectricityPrice)
.valleyServicePrice(valleyServicePrice)
.build();
// 保存到数据库 // 保存到数据库
OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO.builder() OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO.builder()

View File

@@ -1208,6 +1208,8 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
if (pileConnectorDetailVO == null) { if (pileConnectorDetailVO == null) {
throw new BusinessException("", ""); throw new BusinessException("", "");
} }
dto.setMerchantId(pileConnectorDetailVO.getMerchantId());
dto.setStationId(pileConnectorDetailVO.getStationId());
// 获取处理逻辑 // 获取处理逻辑
// String mode = pileMerchantInfoService.getDelayModeByAppIdAndRequestSource(dto.getAppId(), dto.getRequestSource()); // String mode = pileMerchantInfoService.getDelayModeByAppIdAndRequestSource(dto.getAppId(), dto.getRequestSource());
String mode = pileMerchantInfoService.getDelayModeByMerchantId(pileConnectorDetailVO.getMerchantId()); String mode = pileMerchantInfoService.getDelayModeByMerchantId(pileConnectorDetailVO.getMerchantId());

View File

@@ -31,6 +31,7 @@ import com.jsowell.pile.dto.*;
import com.jsowell.pile.transaction.dto.OrderTransactionDTO; import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
import com.jsowell.pile.vo.uniapp.customer.MemberVO; import com.jsowell.pile.vo.uniapp.customer.MemberVO;
import com.jsowell.pile.vo.web.BalanceDeductionAmountVO; import com.jsowell.pile.vo.web.BalanceDeductionAmountVO;
import com.jsowell.pile.vo.web.BillingTemplateVO;
import com.jsowell.pile.vo.web.OrderDetailInfoVO; import com.jsowell.pile.vo.web.OrderDetailInfoVO;
import com.jsowell.pile.vo.web.UpdateMemberBalanceDTO; import com.jsowell.pile.vo.web.UpdateMemberBalanceDTO;
import com.jsowell.wxpay.dto.WechatSendMsgDTO; import com.jsowell.wxpay.dto.WechatSendMsgDTO;
@@ -858,6 +859,10 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic {
generateOrderDTO.setPileSn(pileSn); generateOrderDTO.setPileSn(pileSn);
generateOrderDTO.setConnectorCode(connectorCode); generateOrderDTO.setConnectorCode(connectorCode);
// 通过站点id查询计费模板
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.queryUsedBillingTemplate(dto.getStationId());
generateOrderDTO.setBillingTemplate(billingTemplateVO);
OrderBasicInfo orderBasicInfo; OrderBasicInfo orderBasicInfo;
try { try {
orderBasicInfo = generateOrder(generateOrderDTO); orderBasicInfo = generateOrder(generateOrderDTO);