xuhy
2025-05-08 b89f1d3745044fec20c9cfe7a94bdb301d2ae645
ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/governmentCloud/UploadDataTaskUtil.java
@@ -83,11 +83,14 @@
    private QrCodeDeliveryReplyService qrCodeDeliveryReplyService;
    @Autowired
    private SecurityDetectionService securityDetectionService;
    @Autowired
    private MqttPushUtil mqttPushUtil;
    /**
     * 每天的9点执行的任务
     */
    @Scheduled(cron = "0 0 9 * * *")
//    @Scheduled(fixedRate = 60000)
    public void taskDay(){
        try {
            // 传输mongodb的硬件数据
@@ -161,144 +164,216 @@
            List<QrCodeDeliveryReply> qrCodeDeliveryReplyList = qrCodeDeliveryReplyService.getRangeTimeData(startTime, endTime);
            List<SecurityDetection> securityDetectionList = securityDetectionService.getRangeTimeData(startTime, endTime);
            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 (acquisitionBillingModeList != null && acquisitionBillingModeList.size() > 0) {
                    for (AcquisitionBillingMode acquisitionBillingMode : acquisitionBillingModeList) {
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", acquisitionBillingMode.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", acquisitionBillingMode.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", billingModeVerify.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", billingModeVerify.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", bmsAbort.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", bmsAbort.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", bmsDemandAndChargerExportation.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE",  bmsDemandAndChargerExportation.getCharging_pile_code()),  jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", online.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", online.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", endCharge.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", endCharge.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", errorMessageMessage.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", errorMessageMessage.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", uploadRealTimeMonitoringData.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", uploadRealTimeMonitoringData.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", chargingHandshake.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", chargingHandshake.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", parameterSetting.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", parameterSetting.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", motorAbort.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", motorAbort.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", bmsInformation.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", bmsInformation.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", chargingPileStartsCharging.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", chargingPileStartsCharging.getCharging_pile_code()),jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", platformStartChargingReply.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformStartChargingReply.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", platformStopChargingReply.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformStopChargingReply.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", transactionRecord.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", transactionRecord.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
//                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));
//                        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));
//                        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));
//                        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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", workingParameterSettingReply.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", workingParameterSettingReply.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", timingSetting.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", timingSetting.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
//                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));
//                        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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", groundLockRealTimeData.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", groundLockRealTimeData.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", chargingPileReturnsGroundLockData.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", chargingPileReturnsGroundLockData.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", platformRestartReply.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformRestartReply.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", platformRemoteUpdateReply.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", platformRemoteUpdateReply.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", qrCodeDeliveryReply.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", qrCodeDeliveryReply.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
                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));
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("device_code", securityDetection.getCharging_pile_code());
                        jsonObject.put("report_time", System.currentTimeMillis());
                        mqttPushUtil.pushChargePileData(TopicConstants.CHARGE_PILE_CODE.replace("CHARGE_PILE_CODE", securityDetection.getCharging_pile_code()), jsonObject.toJSONString());
                    }
                }
@@ -342,4 +417,8 @@
        }
    }
    public static void main(String[] args) {
        System.err.println(System.currentTimeMillis());
    }
}