xuhy
2024-09-10 55c3b10c726509ed4b048c46d724d842c39d220d
mq修改
7个文件已修改
307 ■■■■■ 已修改文件
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java 170 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BillingModeVerifyMessageListener.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/OnlineMessageListener.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TimingSettingMessageListener.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TransactionRecordMessageListener.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/EnhanceProduce.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java
@@ -1,8 +1,19 @@
package com.ruoyi.integration.iotda.utils.listener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO;
import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient;
import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.integration.api.model.*;
import com.ruoyi.integration.iotda.constant.SendTagConstant;
import com.ruoyi.integration.iotda.enums.ServiceIdMenu;
import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce;
import com.ruoyi.integration.iotda.utils.tools.CP56Time2aConverter;
import com.ruoyi.integration.iotda.utils.tools.MessageUtil;
import com.ruoyi.integration.iotda.utils.tools.StrategyUtil;
import com.ruoyi.integration.rocket.model.*;
import com.ruoyi.integration.rocket.produce.EnhanceProduce;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendResult;
@@ -12,6 +23,9 @@
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * iotda消息监听
@@ -22,6 +36,12 @@
    @Autowired
    private EnhanceProduce enhanceProduce;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private IotMessageProduce iotMessageProduce;
    @Autowired
    private AccountingStrategyDetailClient accountingStrategyDetailClient;
    /**
     * 设备消息监听
     * @param jsonObject
@@ -36,81 +56,181 @@
        log.info("服务id:{}",service_id);
        SendResult sendResult;
        // 设备消息下发
        String result;
        switch (service_id){
            case SendTagConstant.ONLINE:
                sendResult = enhanceProduce.onlineMessage(content);
                OnlineMessage onlineMessage = JSON.parseObject(jsonObject.toJSONString(),OnlineMessage.class);
                sendResult = enhanceProduce.onlineMessage(onlineMessage);
                // 响应硬件
                // 业务处理 登录认证应答
                OnlineReply onlineReply = new OnlineReply();
                onlineReply.setCharging_pile_code(onlineMessage.getCharging_pile_code());
                onlineReply.setOnline_result(0);
                result = iotMessageProduce.sendMessage(onlineReply.getCharging_pile_code(), ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply));
                log.info("充电桩登录认证-返回结果:{}",result);
                break;
            case SendTagConstant.PING:
                sendResult = enhanceProduce.pingMessage(content);
                PingMessage pingMessage = JSON.parseObject(jsonObject.toJSONString(),PingMessage.class);
                sendResult = enhanceProduce.pingMessage(pingMessage);
                // 响应硬件
                Pong pong = new Pong();
                pong.setCharging_pile_code(pingMessage.getCharging_pile_code());
                pong.setCharging_gun_code(pingMessage.getCharging_gun_code());
                pong.setCharging_gun_status(0);
                result = iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong));
                log.info("充电桩心跳包-返回结果:{}",result);
                break;
            case SendTagConstant.END_CHARGE:
                sendResult = enhanceProduce.endChargeMessage(content);
                EndChargeMessage endChargeMessage = JSON.parseObject(jsonObject.toJSONString(),EndChargeMessage.class);
                sendResult = enhanceProduce.endChargeMessage(endChargeMessage);
                // 响应硬件
                break;
            case SendTagConstant.BILLING_MODE_VERIFY:
                sendResult = enhanceProduce.billingModeVerifyMessage(content);
                BillingModeVerifyMessage billingModeVerifyMessage = JSON.parseObject(jsonObject.toJSONString(),BillingModeVerifyMessage.class);
                sendResult = enhanceProduce.billingModeVerifyMessage(billingModeVerifyMessage);
                // 响应硬件
                BillingModeVerifyReply billingModeVerifyReply = new BillingModeVerifyReply();
                if(billingModeVerifyMessage.getBilling_model_code().equals("0")){
                    // 首次
                    billingModeVerifyReply.setCharging_pile_code(billingModeVerifyMessage.getCharging_pile_code());
                    billingModeVerifyReply.setBilling_model_code("0");
                    billingModeVerifyReply.setBilling_model_result(1);
                }else {
                    // 查询桩使用的模版
                    CheckChargingStrategyDTO dto = new CheckChargingStrategyDTO();
                    dto.setCode(billingModeVerifyMessage.getBilling_model_code());
                    dto.setStrategyDetailId(Integer.valueOf(billingModeVerifyMessage.getBilling_model_code()));
                    Boolean check = accountingStrategyDetailClient.checkChargingStrategy(dto).getData();
                    // 校验计费模版是否准确
                    billingModeVerifyReply.setCharging_pile_code(billingModeVerifyMessage.getCharging_pile_code());
                    billingModeVerifyReply.setBilling_model_code(billingModeVerifyMessage.getBilling_model_code());
                    if(check){
                        billingModeVerifyReply.setBilling_model_result(0);
                    }else {
                        billingModeVerifyReply.setBilling_model_result(1);
                    }
                }
                iotMessageProduce.sendMessage(billingModeVerifyReply.getCharging_pile_code(), ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply));
                break;
            case SendTagConstant.ACQUISITION_BILLING_MODE:
                sendResult = enhanceProduce.acquisitionBillingModeMessage(content);
                AcquisitionBillingModeMessage acquisitionBillingModeMessage = JSON.parseObject(jsonObject.toJSONString(),AcquisitionBillingModeMessage.class);
                sendResult = enhanceProduce.acquisitionBillingModeMessage(acquisitionBillingModeMessage);
                // 响应硬件   计费模型请求应答  1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段
                List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(acquisitionBillingModeMessage.getCharging_pile_code()).getData();
                Map<Integer, TAccountingStrategyDetail> strategyPrice = StrategyUtil.getStrategyPrice(accountingStrategyDetails);
                // 价格设置
                AcquisitionBillingModeReply acquisitionBillingModeReply = new AcquisitionBillingModeReply();
                StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply);
                // 时段设置
                StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply);
                iotMessageProduce.sendMessage(acquisitionBillingModeReply.getCharging_pile_code(), ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply));
                break;
            case SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA:
                sendResult = enhanceProduce.uploadRealTimeMonitoringDataMessage(content);
                UploadRealTimeMonitoringDataMessage uploadRealTimeMonitoringDataMessage = JSON.parseObject(jsonObject.toJSONString(),UploadRealTimeMonitoringDataMessage.class);
                sendResult = enhanceProduce.uploadRealTimeMonitoringDataMessage(uploadRealTimeMonitoringDataMessage);
                // 响应硬件
                break;
            case SendTagConstant.CHARGING_HANDSHAKE:
                sendResult = enhanceProduce.chargingHandshakeMessage(content);
                ChargingHandshakeMessage chargingHandshakeMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingHandshakeMessage.class);
                sendResult = enhanceProduce.chargingHandshakeMessage(chargingHandshakeMessage);
                // 响应硬件
                break;
            case SendTagConstant.BMS_ABORT:
                sendResult = enhanceProduce.bmsAbortMessage(content);
                BmsAbortMessage bmsAbortMessage = JSON.parseObject(jsonObject.toJSONString(),BmsAbortMessage.class);
                sendResult = enhanceProduce.bmsAbortMessage(bmsAbortMessage);
                // 响应硬件
                break;
            case SendTagConstant.MOTOR_ABORT:
                sendResult = enhanceProduce.motorAbortMessage(content);
                MotorAbortMessage motorAbortMessage = JSON.parseObject(jsonObject.toJSONString(),MotorAbortMessage.class);
                sendResult = enhanceProduce.motorAbortMessage(motorAbortMessage);
                break;
            case SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION:
                sendResult = enhanceProduce.bmsDemandAndChargerExportationMessage(content);
                BmsDemandAndChargerExportationMessage bmsDemandAndChargerExportationMessage = JSON.parseObject(jsonObject.toJSONString(),BmsDemandAndChargerExportationMessage.class);
                sendResult = enhanceProduce.bmsDemandAndChargerExportationMessage(bmsDemandAndChargerExportationMessage);
                // 响应硬件
                break;
            case SendTagConstant.BMS_INFORMATION:
                sendResult = enhanceProduce.bmsInformationMessage(content);
                BmsInformationMessage bmsInformationMessage = JSON.parseObject(jsonObject.toJSONString(),BmsInformationMessage.class);
                sendResult = enhanceProduce.bmsInformationMessage(bmsInformationMessage);
                // 响应硬件
                break;
            case SendTagConstant.CHARGING_PILE_STARTS_CHARGING:
                sendResult = enhanceProduce.chargingPileStartsChargingMessage(content);
                ChargingPileStartsChargingMessage chargingPileStartsChargingMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingPileStartsChargingMessage.class);
                sendResult = enhanceProduce.chargingPileStartsChargingMessage(chargingPileStartsChargingMessage);
                // 响应硬件
                break;
            case SendTagConstant.PLATFORM_START_CHARGING_REPLY:
                sendResult = enhanceProduce.platformStartChargingReplyMessage(content);
                PlatformStartChargingReplyMessage platformStartChargingReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformStartChargingReplyMessage.class);
                sendResult = enhanceProduce.platformStartChargingReplyMessage(platformStartChargingReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.PLATFORM_STOP_CHARGING_REPLY:
                sendResult = enhanceProduce.platformStopChargingReplyMessage(content);
                PlatformStopChargingReplyMessage platformStopChargingReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformStopChargingReplyMessage.class);
                sendResult = enhanceProduce.platformStopChargingReplyMessage(platformStopChargingReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.TRANSACTION_RECORD:
                sendResult = enhanceProduce.transactionRecordMessage(content);
                TransactionRecordMessage transactionRecordMessage = JSON.parseObject(jsonObject.toJSONString(),TransactionRecordMessage.class);
                sendResult = enhanceProduce.transactionRecordMessage(transactionRecordMessage);
                // 响应硬件
                ConfirmTransactionRecord confirmTransactionRecord = new ConfirmTransactionRecord();
                confirmTransactionRecord.setTransaction_serial_number(transactionRecordMessage.getTransaction_serial_number());
                confirmTransactionRecord.setConfirm_result(0);
                iotMessageProduce.sendMessage(confirmTransactionRecord.getTransaction_serial_number(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord));
                break;
            case SendTagConstant.UPDATE_BALANCE_REPLY:
                sendResult = enhanceProduce.updateBalanceReplyMessage(content);
                UpdateBalanceReplyMessage updateBalanceReplyMessage = JSON.parseObject(jsonObject.toJSONString(),UpdateBalanceReplyMessage.class);
                sendResult = enhanceProduce.updateBalanceReplyMessage(updateBalanceReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY:
                sendResult = enhanceProduce.synchronizeOfflineCardReplyMessage(content);
                SynchronizeOfflineCardReplyMessage synchronizeOfflineCardReplyMessage = JSON.parseObject(jsonObject.toJSONString(),SynchronizeOfflineCardReplyMessage.class);
                sendResult = enhanceProduce.synchronizeOfflineCardReplyMessage(synchronizeOfflineCardReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.CLEAR_OFFLINE_CARD_REPLY:
                sendResult = enhanceProduce.clearOfflineCardReplyMessage(content);
                ClearOfflineCardReplyMessage clearOfflineCardReplyMessage = JSON.parseObject(jsonObject.toJSONString(),ClearOfflineCardReplyMessage.class);
                sendResult = enhanceProduce.clearOfflineCardReplyMessage(clearOfflineCardReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.WORKING_PARAMETER_SETTING_REPLY:
                sendResult = enhanceProduce.workingParameterSettingReplyMessage(content);
                WorkingParameterSettingReplyMessage workingParameterSettingReplyMessage = JSON.parseObject(jsonObject.toJSONString(),WorkingParameterSettingReplyMessage.class);
                sendResult = enhanceProduce.workingParameterSettingReplyMessage(workingParameterSettingReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.TIMING_SETTING:
                sendResult = enhanceProduce.timingSettingMessage(content);
                TimingSettingMessage timingSettingMessage = JSON.parseObject(jsonObject.toJSONString(),TimingSettingMessage.class);
                sendResult = enhanceProduce.timingSettingMessage(timingSettingMessage);
                // 响应硬件 对时设置应答
                TimingSettingReply timingSettingReply = new TimingSettingReply();
                timingSettingReply.setCharging_pile_code(timingSettingMessage.getCharging_pile_code());
                timingSettingReply.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date()));
                iotMessageProduce.sendMessage(timingSettingReply.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply));
                break;
            case SendTagConstant.SETUP_BILLING_MODEL_REPLY:
                sendResult = enhanceProduce.setupBillingModelReplyMessage(content);
                SetupBillingModelReplyMessage setupBillingModelReplyMessage = JSON.parseObject(jsonObject.toJSONString(),SetupBillingModelReplyMessage.class);
                sendResult = enhanceProduce.setupBillingModelReplyMessage(setupBillingModelReplyMessage);
                // 响应硬件
                break;
            case SendTagConstant.GROUND_LOCK_REAL_TIME_DATA:
                sendResult = enhanceProduce.groundLockRealTimeDataMessage(content);
                GroundLockRealTimeDataMessage groundLockRealTimeDataMessage = JSON.parseObject(jsonObject.toJSONString(),GroundLockRealTimeDataMessage.class);
                sendResult = enhanceProduce.groundLockRealTimeDataMessage(groundLockRealTimeDataMessage);
                // 响应硬件
                break;
            case SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA:
                sendResult = enhanceProduce.chargingPileReturnsGroundLockDataMessage(content);
                ChargingPileReturnsGroundLockDataMessage chargingPileReturnsGroundLockDataMessage = JSON.parseObject(jsonObject.toJSONString(),ChargingPileReturnsGroundLockDataMessage.class);
                sendResult = enhanceProduce.chargingPileReturnsGroundLockDataMessage(chargingPileReturnsGroundLockDataMessage);
                // 响应硬件
                break;
            case SendTagConstant.PLATFORM_RESTART_REPLY:
                sendResult = enhanceProduce.platformRestartReplyMessage(content);
                PlatformRestartReplyMessage platformRestartReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformRestartReplyMessage.class);
                sendResult = enhanceProduce.platformRestartReplyMessage(platformRestartReplyMessage);
                // 响应硬件
                break;
            default:
                sendResult = enhanceProduce.platformRemoteUpdateReplyMessage(content);
                PlatformRemoteUpdateReplyMessage platformRemoteUpdateReplyMessage = JSON.parseObject(jsonObject.toJSONString(),PlatformRemoteUpdateReplyMessage.class);
                sendResult = enhanceProduce.platformRemoteUpdateReplyMessage(platformRemoteUpdateReplyMessage);
                // 响应硬件
                break;
        }
        log.info("rocketmq消息下发结果:{}",sendResult);
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/BillingModeVerifyMessageListener.java
@@ -34,12 +34,6 @@
    @Autowired
    private BillingModeVerifyService billingModeVerifyService;
    @Autowired
    private IotMessageProduce iotMessageProduce;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private AccountingStrategyDetailClient accountingStrategyDetailClient;
    @Override
    protected void handleMessage(BillingModeVerifyMessage message) throws Exception {
@@ -50,28 +44,6 @@
        BeanUtils.copyProperties(message,billingModeVerify);
        billingModeVerifyService.create(billingModeVerify);
        // 业务处理
        BillingModeVerifyReply billingModeVerifyReply = new BillingModeVerifyReply();
        if(message.getBilling_model_code().equals("0")){
            // 首次
            billingModeVerifyReply.setCharging_pile_code(billingModeVerify.getCharging_pile_code());
            billingModeVerifyReply.setBilling_model_code("0");
            billingModeVerifyReply.setBilling_model_result(1);
        }else {
            // 查询桩使用的模版
            CheckChargingStrategyDTO dto = new CheckChargingStrategyDTO();
            dto.setCode(message.getBilling_model_code());
            dto.setStrategyDetailId(Integer.valueOf(message.getBilling_model_code()));
            Boolean check = accountingStrategyDetailClient.checkChargingStrategy(dto).getData();
            // 校验计费模版是否准确
            billingModeVerifyReply.setCharging_pile_code(billingModeVerify.getCharging_pile_code());
            billingModeVerifyReply.setBilling_model_code(message.getBilling_model_code());
            if(check){
                billingModeVerifyReply.setBilling_model_result(0);
            }else {
                billingModeVerifyReply.setBilling_model_result(1);
            }
        }
        iotMessageProduce.sendMessage(billingModeVerifyReply.getCharging_pile_code(), ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply));
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/OnlineMessageListener.java
@@ -30,10 +30,6 @@
    @Autowired
    private OnlineService onlineService;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private IotMessageProduce iotMessageProduce;
    @Override
    protected void handleMessage(OnlineMessage message) throws Exception {
@@ -43,12 +39,7 @@
        Online online = new Online();
        BeanUtils.copyProperties(message,online);
        onlineService.create(online);
        // 业务处理 登录认证应答
        OnlineReply onlineReply = new OnlineReply();
        onlineReply.setCharging_pile_code(message.getCharging_pile_code());
        onlineReply.setOnline_result(0);
        String result = iotMessageProduce.sendMessage(onlineReply.getCharging_pile_code(), ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply));
        log.info("充电桩登录认证-返回结果:{}",result);
        // 业务处理
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/PingMessageListener.java
@@ -31,10 +31,6 @@
    @Autowired
    private PingService pingService;
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private IotMessageProduce iotMessageProduce;
    @Override
    protected void handleMessage(PingMessage message) throws Exception {
        // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试
@@ -44,12 +40,6 @@
        BeanUtils.copyProperties(message,ping);
        pingService.create(ping);
        // 业务处理
        Pong pong = new Pong();
        pong.setCharging_pile_code(message.getCharging_pile_code());
        pong.setCharging_gun_code(message.getCharging_gun_code());
        pong.setCharging_gun_status(0);
        String result = iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong));
        log.info("充电桩心跳包-返回结果:{}",result);
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TimingSettingMessageListener.java
@@ -45,11 +45,7 @@
        TimingSetting timingSetting = new TimingSetting();
        BeanUtils.copyProperties(message,timingSetting);
        timingSettingService.create(timingSetting);
        // 业务处理  对时设置应答
        TimingSettingReply timingSettingReply = new TimingSettingReply();
        timingSettingReply.setCharging_pile_code(message.getCharging_pile_code());
        timingSettingReply.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date()));
        iotMessageProduce.sendMessage(timingSettingReply.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply));
        // 业务处理
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/listener/TransactionRecordMessageListener.java
@@ -43,10 +43,6 @@
        BeanUtils.copyProperties(message,transactionRecord);
        transactionRecordService.create(transactionRecord);
        // 业务处理
        ConfirmTransactionRecord confirmTransactionRecord = new ConfirmTransactionRecord();
        confirmTransactionRecord.setTransaction_serial_number(message.getTransaction_serial_number());
        confirmTransactionRecord.setConfirm_result(0);
        iotMessageProduce.sendMessage(confirmTransactionRecord.getTransaction_serial_number(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord));
    }
    @Override
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/EnhanceProduce.java
@@ -7,10 +7,7 @@
import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -29,8 +26,7 @@
    /**
     * 充电桩登录认证
     */
    public SendResult onlineMessage(JSONObject jsonObject) {
        OnlineMessage message = JSON.parseObject(jsonObject.toJSONString(),OnlineMessage.class);
    public SendResult onlineMessage(OnlineMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -41,8 +37,7 @@
    /**
     * 充电桩心跳包
     */
    public SendResult pingMessage(JSONObject jsonObject) {
        PingMessage message = JSON.parseObject(jsonObject.toJSONString(),PingMessage.class);
    public SendResult pingMessage(PingMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -52,8 +47,7 @@
    /**
     * 充电结束
     */
    public SendResult endChargeMessage(JSONObject jsonObject) {
        PingMessage message = JSON.parseObject(jsonObject.toJSONString(),PingMessage.class);
    public SendResult endChargeMessage(EndChargeMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -64,8 +58,7 @@
    /**
     * 计费模型验证请求
     */
    public SendResult billingModeVerifyMessage(JSONObject jsonObject) {
        BillingModeVerifyMessage message = JSON.parseObject(jsonObject.toJSONString(),BillingModeVerifyMessage.class);
    public SendResult billingModeVerifyMessage(BillingModeVerifyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -76,8 +69,7 @@
    /**
     * 充电桩计费模型请求
     */
    public SendResult acquisitionBillingModeMessage(JSONObject jsonObject) {
        AcquisitionBillingModeMessage message = JSON.parseObject(jsonObject.toJSONString(),AcquisitionBillingModeMessage.class);
    public SendResult acquisitionBillingModeMessage(AcquisitionBillingModeMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -88,8 +80,7 @@
    /**
     * 上传实时监测数据
     */
    public SendResult uploadRealTimeMonitoringDataMessage(JSONObject jsonObject) {
        UploadRealTimeMonitoringDataMessage message = JSON.parseObject(jsonObject.toJSONString(),UploadRealTimeMonitoringDataMessage.class);
    public SendResult uploadRealTimeMonitoringDataMessage(UploadRealTimeMonitoringDataMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -100,8 +91,7 @@
    /**
     * 充电握手
     */
    public SendResult chargingHandshakeMessage(JSONObject jsonObject) {
        ChargingHandshakeMessage message = JSON.parseObject(jsonObject.toJSONString(),ChargingHandshakeMessage.class);
    public SendResult chargingHandshakeMessage(ChargingHandshakeMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -112,8 +102,7 @@
    /**
     * 充电阶段BMS中止
     */
    public SendResult bmsAbortMessage(JSONObject jsonObject) {
        BmsAbortMessage message = JSON.parseObject(jsonObject.toJSONString(),BmsAbortMessage.class);
    public SendResult bmsAbortMessage(BmsAbortMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -124,8 +113,7 @@
    /**
     * 充电阶段充电机中止
     */
    public SendResult motorAbortMessage(JSONObject jsonObject) {
        MotorAbortMessage message = JSON.parseObject(jsonObject.toJSONString(),MotorAbortMessage.class);
    public SendResult motorAbortMessage(MotorAbortMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -136,8 +124,7 @@
    /**
     * 充电过程BMS需求、充电机输出
     */
    public SendResult bmsDemandAndChargerExportationMessage(JSONObject jsonObject) {
        BmsDemandAndChargerExportationMessage message = JSON.parseObject(jsonObject.toJSONString(),BmsDemandAndChargerExportationMessage.class);
    public SendResult bmsDemandAndChargerExportationMessage(BmsDemandAndChargerExportationMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -148,8 +135,7 @@
    /**
     * 充电过程BMS信息
     */
    public SendResult bmsInformationMessage(JSONObject jsonObject) {
        BmsInformationMessage message = JSON.parseObject(jsonObject.toJSONString(),BmsInformationMessage.class);
    public SendResult bmsInformationMessage(BmsInformationMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -160,8 +146,7 @@
    /**
     * 充电桩主动申请启动充电
     */
    public SendResult chargingPileStartsChargingMessage(JSONObject jsonObject) {
        ChargingPileStartsChargingMessage message = JSON.parseObject(jsonObject.toJSONString(),ChargingPileStartsChargingMessage.class);
    public SendResult chargingPileStartsChargingMessage(ChargingPileStartsChargingMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -172,8 +157,7 @@
    /**
     * 远程启机命令回复
     */
    public SendResult platformStartChargingReplyMessage(JSONObject jsonObject) {
        PlatformStartChargingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformStartChargingReplyMessage.class);
    public SendResult platformStartChargingReplyMessage(PlatformStartChargingReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -184,8 +168,7 @@
    /**
     * 远程停机命令回复
     */
    public SendResult platformStopChargingReplyMessage(JSONObject jsonObject) {
        PlatformStopChargingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformStopChargingReplyMessage.class);
    public SendResult platformStopChargingReplyMessage(PlatformStopChargingReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -196,8 +179,7 @@
    /**
     * 交易记录
     */
    public SendResult transactionRecordMessage(JSONObject jsonObject) {
        TransactionRecordMessage message = JSON.parseObject(jsonObject.toJSONString(),TransactionRecordMessage.class);
    public SendResult transactionRecordMessage(TransactionRecordMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -208,8 +190,7 @@
    /**
     * 余额更新应答
     */
    public SendResult updateBalanceReplyMessage(JSONObject jsonObject) {
        UpdateBalanceReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),UpdateBalanceReplyMessage.class);
    public SendResult updateBalanceReplyMessage(UpdateBalanceReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -220,8 +201,7 @@
    /**
     * 卡数据同步应答
     */
    public SendResult synchronizeOfflineCardReplyMessage(JSONObject jsonObject) {
        SynchronizeOfflineCardReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),SynchronizeOfflineCardReplyMessage.class);
    public SendResult synchronizeOfflineCardReplyMessage(SynchronizeOfflineCardReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -232,8 +212,7 @@
    /**
     * 离线卡数据清除应答
     */
    public SendResult clearOfflineCardReplyMessage(JSONObject jsonObject) {
        ClearOfflineCardReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),ClearOfflineCardReplyMessage.class);
    public SendResult clearOfflineCardReplyMessage(ClearOfflineCardReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -244,8 +223,7 @@
    /**
     * 充电桩工作参数设置应答
     */
    public SendResult workingParameterSettingReplyMessage(JSONObject jsonObject) {
        WorkingParameterSettingReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),WorkingParameterSettingReplyMessage.class);
    public SendResult workingParameterSettingReplyMessage(WorkingParameterSettingReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -256,8 +234,7 @@
    /**
     * 对时设置
     */
    public SendResult timingSettingMessage(JSONObject jsonObject) {
        TimingSettingMessage message = JSON.parseObject(jsonObject.toJSONString(),TimingSettingMessage.class);
    public SendResult timingSettingMessage(TimingSettingMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -268,8 +245,7 @@
    /**
     * 计费模型应答
     */
    public SendResult setupBillingModelReplyMessage(JSONObject jsonObject) {
        SetupBillingModelReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),SetupBillingModelReplyMessage.class);
    public SendResult setupBillingModelReplyMessage(SetupBillingModelReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -280,8 +256,7 @@
    /**
     * 地锁数据上送(充电桩上送)
     */
    public SendResult groundLockRealTimeDataMessage(JSONObject jsonObject) {
        GroundLockRealTimeDataMessage message = JSON.parseObject(jsonObject.toJSONString(),GroundLockRealTimeDataMessage.class);
    public SendResult groundLockRealTimeDataMessage(GroundLockRealTimeDataMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -292,8 +267,7 @@
    /**
     * 充电桩返回数据(上行)
     */
    public SendResult chargingPileReturnsGroundLockDataMessage(JSONObject jsonObject) {
        ChargingPileReturnsGroundLockDataMessage message = JSON.parseObject(jsonObject.toJSONString(),ChargingPileReturnsGroundLockDataMessage.class);
    public SendResult chargingPileReturnsGroundLockDataMessage(ChargingPileReturnsGroundLockDataMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -304,8 +278,7 @@
    /**
     * 远程重启应答
     */
    public SendResult platformRestartReplyMessage(JSONObject jsonObject) {
        PlatformRestartReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformRestartReplyMessage.class);
    public SendResult platformRestartReplyMessage(PlatformRestartReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
@@ -316,8 +289,7 @@
    /**
     * 远程更新应答
     */
    public SendResult platformRemoteUpdateReplyMessage(JSONObject jsonObject) {
        PlatformRemoteUpdateReplyMessage message = JSON.parseObject(jsonObject.toJSONString(),PlatformRemoteUpdateReplyMessage.class);
    public SendResult platformRemoteUpdateReplyMessage(PlatformRemoteUpdateReplyMessage message) {
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询