xuhy
2025-05-06 4ce9ac31e35aca8ebf075d0d9604ee5c6005c39a
政务云数据上传
3个文件已修改
1个文件已添加
315 ■■■■■ 已修改文件
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/governmentCloud/SiteController.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/governmentCloud/UploadDataTaskUtil.java 262 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/mqtt/callback/PushCallback.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/mqtt/util/MqttPushUtil.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/governmentCloud/SiteController.java
New file
@@ -0,0 +1,29 @@
package com.ruoyi.jianguan.governmentCloud;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.jianguan.mqtt.util.MqttPushUtil;
import com.ruoyi.jianguan.service.TChargingPileService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
 * @author zhibing.pu
 * @Date 2024/8/7 19:56
 */
@RestController
@RequestMapping("")
public class SiteController {
    @Resource
    private MqttPushUtil mqttPushUtil;
    @GetMapping("/jianguantest")
    public R<String> jianguantest(){
        mqttPushUtil.pushChargePileData("/cmt/IoT/pub/8/6700/status/silent","message消息123456");
        return R.ok();
    }
}
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/governmentCloud/UploadDataTaskUtil.java
@@ -88,6 +88,7 @@
     * 每天的9点执行的任务
     */
    @Scheduled(cron = "0 0 9 * * *")
//    @Scheduled(fixedRate = 60000)
    public void taskDay(){
        try {
            // 传输mongodb的硬件数据
@@ -131,6 +132,8 @@
            LocalDate localDate = LocalDate.now().minusDays(1);
            String startTime = localDate + " 00:00:00";
            String endTime = localDate + " 23:59:59";
            long l = System.currentTimeMillis();
            System.err.println("开始时间:"+l);
            // 查询所有的mango数据
            List<AcquisitionBillingMode> acquisitionBillingModeList = acquisitionBillingModeService.getRangeTimeData(startTime, endTime);
            List<BillingModeVerify> billingModeVerifyList = billingModeVerifyService.getRangeTimeData(startTime, endTime);
@@ -160,147 +163,148 @@
            List<PlatformRemoteUpdateReply> platformRemoteUpdateReplyList = platformRemoteUpdateReplyService.getRangeTimeData(startTime, endTime);
            List<QrCodeDeliveryReply> qrCodeDeliveryReplyList = qrCodeDeliveryReplyService.getRangeTimeData(startTime, endTime);
            List<SecurityDetection> securityDetectionList = securityDetectionService.getRangeTimeData(startTime, endTime);
            System.err.println("结束时间:"+(System.currentTimeMillis()-l));
            customthreadPoolExecutor.execute(() -> {
//                if (acquisitionBillingModeList != null && acquisitionBillingModeList.size() > 0) {
//                    for (AcquisitionBillingMode acquisitionBillingMode : acquisitionBillingModeList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", acquisitionBillingMode.getCharging_pile_code()), JSONObject.toJSONString(acquisitionBillingMode));
//                    }
//                }
                if (billingModeVerifyList != null && billingModeVerifyList.size() > 0) {
                    for (BillingModeVerify billingModeVerify : billingModeVerifyList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", billingModeVerify.getCharging_pile_code()), JSONObject.toJSONString(billingModeVerify));
                    }
                }
                if (bmsAbortList != null && bmsAbortList.size() > 0) {
                    for (BmsAbort bmsAbort : bmsAbortList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", bmsAbort.getCharging_pile_code()), JSONObject.toJSONString(bmsAbort));
                    }
                }
                if (bmsDemandAndChargerExportationList != null && bmsDemandAndChargerExportationList.size() > 0) {
                    for (BmsDemandAndChargerExportation bmsDemandAndChargerExportation : bmsDemandAndChargerExportationList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE",  bmsDemandAndChargerExportation.getCharging_pile_code()),  JSONObject.toJSONString(bmsDemandAndChargerExportation));
                    }
                }
                if (onlineList != null && onlineList.size() > 0) {
                    for (Online online : onlineList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", online.getCharging_pile_code()), JSONObject.toJSONString(online));
                    }
                }
                if (endChargeList != null && endChargeList.size() > 0) {
                    for (EndCharge endCharge : endChargeList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", endCharge.getCharging_pile_code()), JSONObject.toJSONString(endCharge));
                    }
                }
                if (errorMessageMessageList != null && errorMessageMessageList.size() > 0) {
                    for (ErrorMessageMessage errorMessageMessage : errorMessageMessageList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", errorMessageMessage.getCharging_pile_code()), JSONObject.toJSONString(errorMessageMessage));
                    }
                }
                if (uploadRealTimeMonitoringDataList != null && uploadRealTimeMonitoringDataList.size() > 0) {
                    for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : uploadRealTimeMonitoringDataList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", uploadRealTimeMonitoringData.getCharging_pile_code()), JSONObject.toJSONString(uploadRealTimeMonitoringData));
                    }
                }
                if (chargingHandshakeList != null && chargingHandshakeList.size() > 0) {
                    for (ChargingHandshake chargingHandshake : chargingHandshakeList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", chargingHandshake.getCharging_pile_code()), JSONObject.toJSONString(chargingHandshake));
                    }
                }
                if (parameterSettingList != null && parameterSettingList.size() > 0) {
                    for (ParameterSetting parameterSetting : parameterSettingList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", parameterSetting.getCharging_pile_code()), JSONObject.toJSONString(parameterSetting));
                    }
                }
                if (motorAbortList != null && motorAbortList.size() > 0) {
                    for (MotorAbort motorAbort : motorAbortList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", motorAbort.getCharging_pile_code()), JSONObject.toJSONString(motorAbort));
                    }
                }
                if (bmsInformationList != null && bmsInformationList.size() > 0) {
                    for (BmsInformation bmsInformation : bmsInformationList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", bmsInformation.getCharging_pile_code()), JSONObject.toJSONString(bmsInformation));
                    }
                }
                if (chargingPileStartsChargingList != null && chargingPileStartsChargingList.size() > 0) {
                    for (ChargingPileStartsCharging chargingPileStartsCharging : chargingPileStartsChargingList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", chargingPileStartsCharging.getCharging_pile_code()),JSONObject.toJSONString(chargingPileStartsCharging));
                    }
                }
                if (platformStartChargingReplyList != null && platformStartChargingReplyList.size() > 0) {
                    for (PlatformStartChargingReply platformStartChargingReply : platformStartChargingReplyList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformStartChargingReply.getCharging_pile_code()), JSONObject.toJSONString(platformStartChargingReply));
                    }
                }
                if (platformStopChargingReplyList != null && platformStopChargingReplyList.size() > 0) {
                    for (PlatformStopChargingReply platformStopChargingReply : platformStopChargingReplyList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformStopChargingReply.getCharging_pile_code()), JSONObject.toJSONString(platformStopChargingReply));
                    }
                }
                if (transactionRecordList != null && transactionRecordList.size() > 0) {
                    for (TransactionRecord transactionRecord : transactionRecordList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", transactionRecord.getCharging_pile_code()), JSONObject.toJSONString(transactionRecord));
                    }
                }
//                if (updateBalanceReplyList != null && updateBalanceReplyList.size() > 0) {
//                    for (UpdateBalanceReply updateBalanceReply : updateBalanceReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", updateBalanceReply.getCharging_pile_code()), JSONObject.toJSONString(updateBalanceReply));
//                if (billingModeVerifyList != null && billingModeVerifyList.size() > 0) {
//                    for (BillingModeVerify billingModeVerify : billingModeVerifyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", billingModeVerify.getCharging_pile_code()), JSONObject.toJSONString(billingModeVerify));
//                    }
//                }
//                if (synchronizeOfflineCardReplyList != null && synchronizeOfflineCardReplyList.size() > 0) {
//                    for (SynchronizeOfflineCardReply synchronizeOfflineCardReply : synchronizeOfflineCardReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", synchronizeOfflineCardReply.getCharging_pile_code()), JSONObject.toJSONString(synchronizeOfflineCardReply));
//                if (bmsAbortList != null && bmsAbortList.size() > 0) {
//                    for (BmsAbort bmsAbort : bmsAbortList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", bmsAbort.getCharging_pile_code()), JSONObject.toJSONString(bmsAbort));
//                    }
//                }
//                if (clearOfflineCardReplyList != null && clearOfflineCardReplyList.size() > 0) {
//                    for (ClearOfflineCardReply clearOfflineCardReply : clearOfflineCardReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", clearOfflineCardReply.getCharging_pile_code()), JSONObject.toJSONString(clearOfflineCardReply));
//                   }
//                }
                if (workingParameterSettingReplyList != null && workingParameterSettingReplyList.size() > 0) {
                    for (WorkingParameterSettingReply workingParameterSettingReply : workingParameterSettingReplyList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", workingParameterSettingReply.getCharging_pile_code()), JSONObject.toJSONString(workingParameterSettingReply));
                    }
                }
                if (timingSettingList != null && timingSettingList.size() > 0) {
                    for (TimingSetting timingSetting : timingSettingList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", timingSetting.getCharging_pile_code()), JSONObject.toJSONString(timingSetting));
                    }
                }
//                if (setupBillingModelReplyList != null && setupBillingModelReplyList.size() > 0) {
//                    for (SetupBillingModelReply setupBillingModelReply : setupBillingModelReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", setupBillingModelReply.getCharging_pile_code()), JSONObject.toJSONString(setupBillingModelReply));
//                if (bmsDemandAndChargerExportationList != null && bmsDemandAndChargerExportationList.size() > 0) {
//                    for (BmsDemandAndChargerExportation bmsDemandAndChargerExportation : bmsDemandAndChargerExportationList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE",  bmsDemandAndChargerExportation.getCharging_pile_code()),  JSONObject.toJSONString(bmsDemandAndChargerExportation));
//                    }
//                }
                if (groundLockRealTimeDataList != null && groundLockRealTimeDataList.size() > 0) {
                    for (GroundLockRealTimeData groundLockRealTimeData : groundLockRealTimeDataList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", groundLockRealTimeData.getCharging_pile_code()), JSONObject.toJSONString(groundLockRealTimeData));
                    }
                }
                if (chargingPileReturnsGroundLockDataList != null && chargingPileReturnsGroundLockDataList.size() > 0) {
                    for (ChargingPileReturnsGroundLockData chargingPileReturnsGroundLockData : chargingPileReturnsGroundLockDataList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", chargingPileReturnsGroundLockData.getCharging_pile_code()), JSONObject.toJSONString(chargingPileReturnsGroundLockData));
                    }
                }
                if (platformRestartReplyList != null && platformRestartReplyList.size() > 0) {
                    for (PlatformRestartReply platformRestartReply : platformRestartReplyList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformRestartReply.getCharging_pile_code()), JSONObject.toJSONString(platformRestartReply));
                    }
                }
                if (platformRemoteUpdateReplyList != null && platformRemoteUpdateReplyList.size() > 0) {
                    for (PlatformRemoteUpdateReply platformRemoteUpdateReply : platformRemoteUpdateReplyList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformRemoteUpdateReply.getCharging_pile_code()), JSONObject.toJSONString(platformRemoteUpdateReply));
                    }
                }
                if (qrCodeDeliveryReplyList != null && qrCodeDeliveryReplyList.size() > 0) {
                    for (QrCodeDeliveryReply qrCodeDeliveryReply : qrCodeDeliveryReplyList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", qrCodeDeliveryReply.getCharging_pile_code()), JSONObject.toJSONString(qrCodeDeliveryReply));
                    }
                }
                if (securityDetectionList != null && securityDetectionList.size() > 0) {
                    for (SecurityDetection securityDetection : securityDetectionList) {
                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", securityDetection.getCharging_pile_code()), JSONObject.toJSONString(securityDetection));
                    }
                }
//                if (onlineList != null && onlineList.size() > 0) {
//                    for (Online online : onlineList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", online.getCharging_pile_code()), JSONObject.toJSONString(online));
//                    }
//                }
//                if (endChargeList != null && endChargeList.size() > 0) {
//                    for (EndCharge endCharge : endChargeList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", endCharge.getCharging_pile_code()), JSONObject.toJSONString(endCharge));
//                    }
//                }
//                if (errorMessageMessageList != null && errorMessageMessageList.size() > 0) {
//                    for (ErrorMessageMessage errorMessageMessage : errorMessageMessageList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", errorMessageMessage.getCharging_pile_code()), JSONObject.toJSONString(errorMessageMessage));
//                    }
//                }
//                if (uploadRealTimeMonitoringDataList != null && uploadRealTimeMonitoringDataList.size() > 0) {
//                    for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : uploadRealTimeMonitoringDataList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", uploadRealTimeMonitoringData.getCharging_pile_code()), JSONObject.toJSONString(uploadRealTimeMonitoringData));
//                    }
//                }
//                if (chargingHandshakeList != null && chargingHandshakeList.size() > 0) {
//                    for (ChargingHandshake chargingHandshake : chargingHandshakeList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", chargingHandshake.getCharging_pile_code()), JSONObject.toJSONString(chargingHandshake));
//                    }
//                }
//                if (parameterSettingList != null && parameterSettingList.size() > 0) {
//                    for (ParameterSetting parameterSetting : parameterSettingList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", parameterSetting.getCharging_pile_code()), JSONObject.toJSONString(parameterSetting));
//                    }
//                }
//                if (motorAbortList != null && motorAbortList.size() > 0) {
//                    for (MotorAbort motorAbort : motorAbortList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", motorAbort.getCharging_pile_code()), JSONObject.toJSONString(motorAbort));
//                    }
//                }
//                if (bmsInformationList != null && bmsInformationList.size() > 0) {
//                    for (BmsInformation bmsInformation : bmsInformationList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", bmsInformation.getCharging_pile_code()), JSONObject.toJSONString(bmsInformation));
//                    }
//                }
//                if (chargingPileStartsChargingList != null && chargingPileStartsChargingList.size() > 0) {
//                    for (ChargingPileStartsCharging chargingPileStartsCharging : chargingPileStartsChargingList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", chargingPileStartsCharging.getCharging_pile_code()),JSONObject.toJSONString(chargingPileStartsCharging));
//                    }
//                }
//                if (platformStartChargingReplyList != null && platformStartChargingReplyList.size() > 0) {
//                    for (PlatformStartChargingReply platformStartChargingReply : platformStartChargingReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformStartChargingReply.getCharging_pile_code()), JSONObject.toJSONString(platformStartChargingReply));
//                    }
//                }
//                if (platformStopChargingReplyList != null && platformStopChargingReplyList.size() > 0) {
//                    for (PlatformStopChargingReply platformStopChargingReply : platformStopChargingReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformStopChargingReply.getCharging_pile_code()), JSONObject.toJSONString(platformStopChargingReply));
//                    }
//                }
//                if (transactionRecordList != null && transactionRecordList.size() > 0) {
//                    for (TransactionRecord transactionRecord : transactionRecordList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", transactionRecord.getCharging_pile_code()), JSONObject.toJSONString(transactionRecord));
//                    }
//                }
////                if (updateBalanceReplyList != null && updateBalanceReplyList.size() > 0) {
////                    for (UpdateBalanceReply updateBalanceReply : updateBalanceReplyList) {
////                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", updateBalanceReply.getCharging_pile_code()), JSONObject.toJSONString(updateBalanceReply));
////                    }
////                }
////                if (synchronizeOfflineCardReplyList != null && synchronizeOfflineCardReplyList.size() > 0) {
////                    for (SynchronizeOfflineCardReply synchronizeOfflineCardReply : synchronizeOfflineCardReplyList) {
////                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", synchronizeOfflineCardReply.getCharging_pile_code()), JSONObject.toJSONString(synchronizeOfflineCardReply));
////                    }
////                }
////                if (clearOfflineCardReplyList != null && clearOfflineCardReplyList.size() > 0) {
////                    for (ClearOfflineCardReply clearOfflineCardReply : clearOfflineCardReplyList) {
////                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", clearOfflineCardReply.getCharging_pile_code()), JSONObject.toJSONString(clearOfflineCardReply));
////                   }
////                }
//                if (workingParameterSettingReplyList != null && workingParameterSettingReplyList.size() > 0) {
//                    for (WorkingParameterSettingReply workingParameterSettingReply : workingParameterSettingReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", workingParameterSettingReply.getCharging_pile_code()), JSONObject.toJSONString(workingParameterSettingReply));
//                    }
//                }
//                if (timingSettingList != null && timingSettingList.size() > 0) {
//                    for (TimingSetting timingSetting : timingSettingList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", timingSetting.getCharging_pile_code()), JSONObject.toJSONString(timingSetting));
//                    }
//                }
////                if (setupBillingModelReplyList != null && setupBillingModelReplyList.size() > 0) {
////                    for (SetupBillingModelReply setupBillingModelReply : setupBillingModelReplyList) {
////                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", setupBillingModelReply.getCharging_pile_code()), JSONObject.toJSONString(setupBillingModelReply));
////                    }
////                }
//                if (groundLockRealTimeDataList != null && groundLockRealTimeDataList.size() > 0) {
//                    for (GroundLockRealTimeData groundLockRealTimeData : groundLockRealTimeDataList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", groundLockRealTimeData.getCharging_pile_code()), JSONObject.toJSONString(groundLockRealTimeData));
//                    }
//                }
//                if (chargingPileReturnsGroundLockDataList != null && chargingPileReturnsGroundLockDataList.size() > 0) {
//                    for (ChargingPileReturnsGroundLockData chargingPileReturnsGroundLockData : chargingPileReturnsGroundLockDataList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", chargingPileReturnsGroundLockData.getCharging_pile_code()), JSONObject.toJSONString(chargingPileReturnsGroundLockData));
//                    }
//                }
//                if (platformRestartReplyList != null && platformRestartReplyList.size() > 0) {
//                    for (PlatformRestartReply platformRestartReply : platformRestartReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformRestartReply.getCharging_pile_code()), JSONObject.toJSONString(platformRestartReply));
//                    }
//                }
//                if (platformRemoteUpdateReplyList != null && platformRemoteUpdateReplyList.size() > 0) {
//                    for (PlatformRemoteUpdateReply platformRemoteUpdateReply : platformRemoteUpdateReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformRemoteUpdateReply.getCharging_pile_code()), JSONObject.toJSONString(platformRemoteUpdateReply));
//                    }
//                }
//                if (qrCodeDeliveryReplyList != null && qrCodeDeliveryReplyList.size() > 0) {
//                    for (QrCodeDeliveryReply qrCodeDeliveryReply : qrCodeDeliveryReplyList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", qrCodeDeliveryReply.getCharging_pile_code()), JSONObject.toJSONString(qrCodeDeliveryReply));
//                    }
//                }
//                if (securityDetectionList != null && securityDetectionList.size() > 0) {
//                    for (SecurityDetection securityDetection : securityDetectionList) {
//                        MqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", securityDetection.getCharging_pile_code()), JSONObject.toJSONString(securityDetection));
//                    }
//                }
            });
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/mqtt/callback/PushCallback.java
@@ -36,7 +36,7 @@
        if (client == null || !client.isConnected()) {
            System.out.println("连接断开,正在重连....");
            int[] Qos  = {0};
            String[] topic1 = {TopicConstants.GPS_LOCATION};
            String[] topic1 = {TopicConstants.CHARGE_PILE_CODE};
            try {
                client.connect(options);
                client.subscribe(topic1, Qos);
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/mqtt/util/MqttPushUtil.java
@@ -11,6 +11,7 @@
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class MqttPushUtil {
    private final static String HOST = "tcp://127.0.0.1:9882";
@@ -27,12 +28,12 @@
     * @param message
     * @return
     */
    public static R<String> pushChargePileData(String topic, String message){
    public R<String> pushChargePileData(String topic, String message){
        try {
            MqttPushUtil mqttConnect = new MqttPushUtil();
            mqttConnect.start();
//            MqttPushUtil mqttConnect = new MqttPushUtil();
//            mqttConnect.start();
            //发布消息
            mqttConnect.publish(topic,message);
            this.publish(topic,message);
            return R.ok("["+topic+"]-推送成功;内容为:["+message+"]");
        } catch (MqttException e) {
            return R.fail("推送失败:["+e.getMessage()+"]");
@@ -49,12 +50,13 @@
        mqttConnect.publish("/cmt/IoT/pub/8/6700/status/silent","message11消息");
    }
//    @Bean
//    public MqttPushUtil getMqttPushClient() {
//        //连接至mqtt服务器,获取mqtt连接
//        this.start();
//        return this;
//    }
    @Bean
    public MqttPushUtil getMqttPushClient() {
        //连接至mqtt服务器,获取mqtt连接
        MqttPushUtil mqttConnect = new MqttPushUtil();
        mqttConnect.start();
        return this;
    }
    /**
     * 初始化mqtt链接
     * @throws MqttException