puzhibing
2026-07-15 2dc923fd25ae80528ffb00e894e3424fa56559ad
修改bug
2个文件已修改
107 ■■■■■ 已修改文件
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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();
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java
@@ -154,6 +154,7 @@
    @Resource
    private RedissonClient redissonClient;
    ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10, 50, 1, TimeUnit.MINUTES, new LinkedBlockingDeque<>());
    /**
@@ -756,15 +757,12 @@
                    //推送三方平台
                    if (2 == order.getOrderSource() && 1 == site.getIsOpenSynchronization()) {
                        TChargingOrder finalChargingOrder = order;
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                tcecClient.notificationEquipChargeStatus(finalChargingOrder.getStartChargeSeq(), finalChargingOrder.getOperatorId());
                                tcecClient.notificationStopChargeResult(finalChargingOrder.getStartChargeSeq(), finalChargingOrder.getChargingGunId().toString(),
                                        finalChargingOrder.getOperatorId());
                                tcecClient.notificationChargeOrderInfo(finalChargingOrder.getStartChargeSeq(), finalChargingOrder.getOperatorId());
                            }
                        }).start();
                        threadPoolExecutor.execute(()->{
                            tcecClient.notificationEquipChargeStatus(finalChargingOrder.getStartChargeSeq(), finalChargingOrder.getOperatorId());
                            tcecClient.notificationStopChargeResult(finalChargingOrder.getStartChargeSeq(), finalChargingOrder.getChargingGunId().toString(),
                                    finalChargingOrder.getOperatorId());
                            tcecClient.notificationChargeOrderInfo(finalChargingOrder.getStartChargeSeq(), finalChargingOrder.getOperatorId());
                        });
                    }
                    //开始将优惠券优惠的金额添加到明细中
@@ -789,19 +787,26 @@
                    chargingGun.setChargingPower(BigDecimal.ZERO);
                    chargingGunClient.updateChargingGunById(chargingGun);
                    chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData();
                    //推送状态给三方平台
                    if (2 == order.getOrderSource() && 1 == site.getIsOpenSynchronization()) {
                        tcecClient.pushChargingGunStatus(chargingGun.getFullNumber(), 2);
                    }
                    ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingDeque<>());
                    TChargingOrder finalOrder = order;
                    TChargingGun finalChargingGun = chargingGun;
                    threadPoolExecutor.execute(()->{
                        //推送状态给三方平台
                        if (2 == finalOrder.getOrderSource() && 1 == site.getIsOpenSynchronization()) {
                            tcecClient.pushChargingGunStatus(finalChargingGun.getFullNumber(), 2);
                        }
                        //推送成都监管
                        NotificationConnectorChargeStatusVo statusVo = new NotificationConnectorChargeStatusVo();
                        statusVo.setOrderCode(finalOrder.getCode());
                        statusVo.setChargingGunId(finalOrder.getChargingGunId());
                        chengDuJianGuanClient.notificationConnectorChargeStatus(statusVo);
                        chengDuJianGuanClient.notificationOrderInfo(statusVo);
                        //推送监管平台订单状态和订单详情
                        ChargingOrderVo chargingOrderVo = new ChargingOrderVo();
                        BeanUtils.copyProperties(finalOrder, chargingOrderVo);
                        chargingMessageClient.pushOrderInfo(chargingOrderVo);
                        chargingMessageClient.pushOrderStatus(chargingOrderVo);
                    });
@@ -921,7 +926,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();
                                }
                            }
                            else if (2 == rechargePaymentType) {
@@ -1006,12 +1016,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(order, chargingOrderVo);
                    chargingMessageClient.pushOrderInfo(chargingOrderVo);
                    chargingMessageClient.pushOrderStatus(chargingOrderVo);
                }
            }
        }catch (Exception e){