From 2dc923fd25ae80528ffb00e894e3424fa56559ad Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期三, 15 七月 2026 19:16:02 +0800
Subject: [PATCH] 修改bug
---
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 61 ++++++++++++++++++------------
1 files changed, 37 insertions(+), 24 deletions(-)
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
index 346a653..f6e0a6b 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -246,6 +246,8 @@
@Resource
private ChengDuJianGuanClient chengDuJianGuanClient;
+
+ ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10, 100, 1, TimeUnit.MINUTES, new LinkedBlockingDeque<>());
/**
@@ -1020,7 +1022,6 @@
log.info(chargingOrder.getCode() + ":-------------------远程调起开始充电请求-------------------" + platformStartCharging.toString());
sendMessageClient.platformStartCharging(platformStartCharging);
- ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
threadPoolExecutor.execute(()->{
//推送成都监管
NotificationConnectorChargeStatusVo vo = new NotificationConnectorChargeStatusVo();
@@ -1107,7 +1108,6 @@
if (2 == chargingOrder.getOrderSource() && 1 == site.getIsOpenSynchronization()) {
tcecClient.notificationEquipChargeStatus(chargingOrder.getStartChargeSeq(), chargingOrder.getOperatorId());
}
- ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
threadPoolExecutor.execute(()->{
if (chargingOrder.getStatus() == 3) {
//推送监管平台订单状态
@@ -1139,7 +1139,6 @@
if (2 == chargingOrder.getOrderSource() && 1 == site.getIsOpenSynchronization()) {
tcecClient.notificationEquipChargeStatus(chargingOrder.getStartChargeSeq(), chargingOrder.getOperatorId());
}
- ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
threadPoolExecutor.execute(()->{
if (chargingOrder.getStatus() == 3) {
//推送监管平台订单状态
@@ -1191,7 +1190,6 @@
if (2 == chargingOrder.getOrderSource() && 1 == site.getIsOpenSynchronization()) {
tcecClient.notificationEquipChargeStatus(chargingOrder.getStartChargeSeq(), chargingOrder.getOperatorId());
}
- ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
threadPoolExecutor.execute(()->{
//推送成都监管
NotificationConnectorChargeStatusVo vo = new NotificationConnectorChargeStatusVo();
@@ -1387,7 +1385,12 @@
Object refund_fee1 = amount1.get("refund_fee");
BigDecimal refund_fee = new BigDecimal(null == refund_fee1 ? "0" : refund_fee1.toString()).divide(new BigDecimal(100));
chargingOrderRefund.setRefundFee(refund_fee);
- chargingOrderRefundService.updateById(chargingOrderRefund);
+ chargingOrderRefundService.lambdaUpdate()
+ .eq(TChargingOrderRefund::getId, chargingOrderRefund.getId())
+ .eq(TChargingOrderRefund::getChargingOrderId, chargingOrderRefund.getChargingOrderId())
+ .set(TChargingOrderRefund::getRefundFee, refund_fee)
+ .update();
+
//回退会员折扣次数
if (chargingOrder.getVipDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData();
@@ -1538,7 +1541,11 @@
Object refund_fee1 = amount1.get("refund_fee");
BigDecimal refund_fee = new BigDecimal(null == refund_fee1 ? "0" : refund_fee1.toString()).divide(new BigDecimal(100));
chargingOrderRefund.setRefundFee(refund_fee);
- chargingOrderRefundService.updateById(chargingOrderRefund);
+ chargingOrderRefundService.lambdaUpdate()
+ .eq(TChargingOrderRefund::getChargingOrderId, chargingOrderRefund.getChargingOrderId())
+ .eq(TChargingOrderRefund::getId, chargingOrderRefund.getId())
+ .set(TChargingOrderRefund::getRefundFee, refund_fee)
+ .update();
}
}
if (2 == rechargePaymentType) {
@@ -1610,7 +1617,10 @@
one.setRefundSerialNumber(refund_id);
one.setRefundStatus(2);
one.setRefundTime(LocalDateTime.now());
- chargingOrderRefundService.updateById(one);
+
+ chargingOrderRefundService.update(one, new LambdaUpdateWrapper<TChargingOrderRefund>()
+ .eq(TChargingOrderRefund::getChargingOrderId, one.getChargingOrderId())
+ .eq(TChargingOrderRefund::getId, one.getId()));
if (money(one.getBalanceRefundAmount()).compareTo(BigDecimal.ZERO) > 0) {
changeUserBalance(order.getAppUserId(), money(one.getBalanceRefundAmount()));
@@ -1728,12 +1738,11 @@
log.info(platformStopCharging.toString());
});
Site site = siteClient.getSiteByIds(Arrays.asList(order.getSiteId())).getData().get(0);
- //推送三方平台
- if (2 == order.getOrderSource() && 1 == site.getIsOpenSynchronization()) {
- tcecClient.notificationEquipChargeStatus(order.getStartChargeSeq(), order.getOperatorId());
- }
- ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
threadPoolExecutor.execute(()->{
+ //推送三方平台
+ if (2 == order.getOrderSource() && 1 == site.getIsOpenSynchronization()) {
+ tcecClient.notificationEquipChargeStatus(order.getStartChargeSeq(), order.getOperatorId());
+ }
//推送成都监管
NotificationConnectorChargeStatusVo vo = new NotificationConnectorChargeStatusVo();
vo.setOrderCode(order.getCode());
@@ -3427,7 +3436,6 @@
}
}).start();
}
- ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
TChargingOrder finalChargingOrder1 = chargingOrder;
threadPoolExecutor.execute(()->{
//推送成都监管
@@ -3436,6 +3444,12 @@
statusVo.setChargingGunId(finalChargingOrder1.getChargingGunId());
chengDuJianGuanClient.notificationConnectorChargeStatus(statusVo);
chengDuJianGuanClient.notificationOrderInfo(statusVo);
+
+ //推送监管平台订单状态和订单详情
+ ChargingOrderVo chargingOrderVo = new ChargingOrderVo();
+ BeanUtils.copyProperties(finalChargingOrder1, chargingOrderVo);
+ chargingMessageClient.pushOrderInfo(chargingOrderVo);
+ chargingMessageClient.pushOrderStatus(chargingOrderVo);
});
//开始将优惠券优惠的金额添加到明细中
@@ -3462,7 +3476,10 @@
chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData();
//推送状态给三方平台
if (2 == chargingOrder.getOrderSource() && 1 == site.getIsOpenSynchronization()) {
- tcecClient.pushChargingGunStatus(chargingGun.getFullNumber(), 2);
+ TChargingGun finalChargingGun = chargingGun;
+ threadPoolExecutor.execute(()->{
+ tcecClient.pushChargingGunStatus(finalChargingGun.getFullNumber(), 2);
+ });
}
//添加积分
@@ -3670,12 +3687,6 @@
summaryData.setElectricPrice(electronic_reduce.setScale(2, BigDecimal.ROUND_HALF_EVEN));
summaryData.setServicePrice(serviceMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN));
chargingOrderSummaryDataService.save(summaryData);
-
- //推送监管平台订单状态和订单详情
- ChargingOrderVo chargingOrderVo = new ChargingOrderVo();
- BeanUtils.copyProperties(chargingOrder, chargingOrderVo);
- chargingMessageClient.pushOrderInfo(chargingOrderVo);
- chargingMessageClient.pushOrderStatus(chargingOrderVo);
}
} catch (Exception e) {
e.printStackTrace();
@@ -3842,7 +3853,12 @@
Object refund_fee1 = amount1.get("refund_fee");
BigDecimal refund_fee = new BigDecimal(null == refund_fee1 ? "0" : refund_fee1.toString()).divide(new BigDecimal(100));
chargingOrderRefund.setRefundFee(refund_fee);
- chargingOrderRefundService.updateById(chargingOrderRefund);
+
+ chargingOrderRefundService.lambdaUpdate()
+ .eq(TChargingOrderRefund::getId, chargingOrderRefund.getId())
+ .eq(TChargingOrderRefund::getChargingOrderId, chargingOrderRefund.getChargingOrderId())
+ .set(TChargingOrderRefund::getRefundFee, refund_fee)
+ .update();
}
}
@@ -3872,7 +3888,6 @@
}
if(5 == tChargingOrder.getStatus()){
- ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
threadPoolExecutor.execute(()->{
//推送成都监管
NotificationConnectorChargeStatusVo statusVo = new NotificationConnectorChargeStatusVo();
@@ -5047,7 +5062,6 @@
//推送三方平台订单状态
tcecClient.notificationEquipChargeStatus(chargingOrder.getStartChargeSeq(), chargingOrder.getOperatorId());
}
- ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
threadPoolExecutor.execute(()->{
//推送成都监管
NotificationConnectorChargeStatusVo statusVo = new NotificationConnectorChargeStatusVo();
@@ -5106,7 +5120,6 @@
log.info("【" + code1 + "】三方平台请求停止充电发起消息结束");
log.info(platformStopCharging.toString());
});
- ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
threadPoolExecutor.execute(()->{
//推送成都监管
NotificationConnectorChargeStatusVo statusVo = new NotificationConnectorChargeStatusVo();
--
Gitblit v1.7.1