测试希晓结算订单逻辑

This commit is contained in:
Guoqs
2025-03-31 13:41:09 +08:00
parent 82ffe5fb8a
commit 3a0493dca8
3 changed files with 36 additions and 12 deletions

View File

@@ -960,5 +960,34 @@ public class TempService {
rabbitTemplate.convertAndSend(RabbitConstants.YKC_EXCHANGE_NAME, RabbitConstants.QUEUE_CHARGE_ORDER_DATA, afterSettleOrderDTO);
}
public void testSettleOrderLogicNotDelay(String orderCode) {
// 查询订单主表
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
LocalDateTime localDateTime = DateUtils.date2LocalDateTime(orderBasicInfo.getSettlementTime());
// 开始时间为localDateTime减30秒
LocalDateTime startTime = localDateTime.minusSeconds(30);
// 结束时间为localDateTime加30秒
LocalDateTime endTime = localDateTime.plusSeconds(30);
// logger.info("testSettleOrderLogicV2, orderCode:{}, settlementTime:{}, startTime:{}, endTime:{}", orderCode, orderBasicInfo.getSettlementTime(), startTime, endTime);
// logger.info("转换为Date类型, settlementTime:{}, startTime:{}, endTime:{}", orderBasicInfo.getSettlementTime(), DateUtils.localDateTime2Date(startTime), DateUtils.localDateTime2Date(endTime));
// 查询这笔订单的交易记录原始数据
List<PileMsgRecord> pileFeedListV2 = pileMsgRecordService.getPileFeedListV2(orderBasicInfo.getPileSn(), "0x3B", startTime, endTime);
// logger.info("testSettleOrderLogicV2, orderCode:{}, pileSn:{}, startTime:{}, endTime:{}, pileFeedListV2:{}",
// orderCode, orderBasicInfo.getPileSn(), startTime, endTime, JSON.toJSONString(pileFeedListV2));
TransactionRecordsData data = null;
for (PileMsgRecord pileMsgRecord : pileFeedListV2) {
TransactionRecordsData parse = JSONObject.parseObject(pileMsgRecord.getJsonMsg(), TransactionRecordsData.class);
if (StringUtils.equals(parse.getTransactionCode(), orderBasicInfo.getTransactionCode())) {
data = parse;
}
}
logger.info("testSettleOrderLogicNotDelay, orderCode:{}, data:{}", orderCode, JSON.toJSONString(data));
if (data != null) {
AbstractProgramLogic programLogic = ProgramLogicFactory.getProgramLogic("1");
programLogic.settleOrder(data, orderBasicInfo);
}
}
}