通过交易流水号查询订单信息

This commit is contained in:
2023-03-13 16:06:18 +08:00
parent 9a0692a0f6
commit 6f74b99fb3
7 changed files with 50 additions and 8 deletions

View File

@@ -260,7 +260,7 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
// 交易流水号
byte[] orderCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
String orderCode = BytesUtil.bcd2Str(orderCodeByteArr);
String transactionCode = BytesUtil.bcd2Str(orderCodeByteArr);
// 桩编码
startIndex += length;
@@ -442,14 +442,15 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
"峰单价:{}, 峰电量:{}, 计损峰电量:{}, 峰金额:{}, 平单价:{}, 平电量:{}, 计损平电量:{}, 平金额:{}, " +
"谷单价:{}, 谷电量:{}, 计损谷电量:{}, 谷金额:{}, 电表总起值:{}, 电表总止值:{}, 总电量:{}, 计损总电量:{}, 消费金额:{}, " +
"电动汽车唯一标识:{}, 交易标识:{}, 交易日期、时间:{}, 停止原因码:{}, 停止原因描述:{}, 物理卡号:{}",
orderCode, pileSn, connectorCode, startTime, endTime, sharpPrice, sharpUsedElectricity, sharpPlanLossElectricity, sharpAmount,
transactionCode, pileSn, connectorCode, startTime, endTime, sharpPrice, sharpUsedElectricity, sharpPlanLossElectricity, sharpAmount,
peakPrice, peakUsedElectricity, peakPlanLossElectricity, peakAmount, flatPrice, flatUsedElectricity, flatPlanLossElectricity, flatAmount,
valleyPrice, valleyUsedElectricity, valleyPlanLossElectricity, valleyAmount, ammeterTotalStart, ammeterTotalEnd, totalElectricity, planLossTotalElectricity,
consumptionAmount, vinCode, transactionIdentifier, transactionTime, stopReason, stopReasonMsg, logicCard);
// 交易记录封装到对象里
TransactionRecordsData data = TransactionRecordsData.builder()
.orderCode(orderCode)
// .orderCode(transactionCode)
.transactionCode(transactionCode)
.pileSn(pileSn)
.connectorCode(connectorCode)
.startTime(startTime)
@@ -487,7 +488,7 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
pileMsgRecordService.save(pileSn, pileSn + connectorCode, type, jsonMsg, ykcDataProtocol.getHEXString());
// 处理订单加锁
String lockKey = "settle_order_" + orderCode;
String lockKey = "settle_order_" + transactionCode;
String uuid = IdUtils.fastUUID();
try {
// redis锁
@@ -517,9 +518,12 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
}
private void processOrder(TransactionRecordsData data) {
String orderCode = data.getOrderCode();
// String orderCode = data.getOrderCode();
String transactionCode = data.getTransactionCode();
// 根据订单号查询订单信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// 根据交易流水号查询订单信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
if (orderBasicInfo != null) {
// 平台存在订单
orderBasicInfo.setReason(data.getStopReasonMsg());