puzhibing
2024-09-02 c81e1267ee71da9bbf345ab2788deb3a65dbcd8c
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/EnhanceProduce.java
File was renamed from ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/rocket/produce/EnhanceProduceController.java
@@ -2,22 +2,22 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.integration.iotda.enums.SendTagMenu;
import com.ruoyi.integration.iotda.constant.SendTagConstant;
import com.ruoyi.integration.rocket.model.*;
import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;
@RestController
@RequestMapping("enhance")
@Slf4j
public class EnhanceProduceController {
@Component
public class EnhanceProduce {
    //注入增强后的模板,可以自动实现环境隔离,日志记录
    @Setter(onMethod_ = @Autowired)
@@ -33,8 +33,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.ONLINE.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.ONLINE.getValue(), message);
        message.setSource(SendTagConstant.ONLINE);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.ONLINE, message);
    }
    /**
@@ -45,8 +45,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.PING.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PING.getValue(), message);
        message.setSource(SendTagConstant.PING);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PING, message);
    }
    /**
@@ -57,8 +57,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.BILLING_MODE_VERIFY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BILLING_MODE_VERIFY.getValue(), message);
        message.setSource(SendTagConstant.BILLING_MODE_VERIFY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BILLING_MODE_VERIFY, message);
    }
    /**
@@ -69,8 +69,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.ACQUISITION_BILLING_MODE.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.ACQUISITION_BILLING_MODE.getValue(), message);
        message.setSource(SendTagConstant.ACQUISITION_BILLING_MODE);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.ACQUISITION_BILLING_MODE, message);
    }
    /**
@@ -81,8 +81,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.UPLOAD_REAL_TIME_MONITORING_DATA.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.UPLOAD_REAL_TIME_MONITORING_DATA.getValue(), message);
        message.setSource(SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA, message);
    }
    /**
@@ -93,8 +93,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.CHARGING_HANDSHAKE.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.CHARGING_HANDSHAKE.getValue(), message);
        message.setSource(SendTagConstant.CHARGING_HANDSHAKE);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CHARGING_HANDSHAKE, message);
    }
    /**
@@ -105,8 +105,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.BMS_ABORT.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BMS_ABORT.getValue(), message);
        message.setSource(SendTagConstant.BMS_ABORT);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BMS_ABORT, message);
    }
    /**
@@ -117,8 +117,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.MOTOR_ABORT.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.MOTOR_ABORT.getValue(), message);
        message.setSource(SendTagConstant.MOTOR_ABORT);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.MOTOR_ABORT, message);
    }
    /**
@@ -129,8 +129,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.BMS_DEMAND_AND_CHARGER_EXPORTATION.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BMS_DEMAND_AND_CHARGER_EXPORTATION.getValue(), message);
        message.setSource(SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BMS_DEMAND_AND_CHARGER_EXPORTATION, message);
    }
    /**
@@ -141,8 +141,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.BMS_INFORMATION.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.BMS_INFORMATION.getValue(), message);
        message.setSource(SendTagConstant.BMS_INFORMATION);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.BMS_INFORMATION, message);
    }
    /**
@@ -153,8 +153,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.CHARGING_PILE_STARTS_CHARGING.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.CHARGING_PILE_STARTS_CHARGING.getValue(), message);
        message.setSource(SendTagConstant.CHARGING_PILE_STARTS_CHARGING);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CHARGING_PILE_STARTS_CHARGING, message);
    }
    /**
@@ -165,8 +165,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.PLATFORM_START_CHARGING_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PLATFORM_START_CHARGING_REPLY.getValue(), message);
        message.setSource(SendTagConstant.PLATFORM_START_CHARGING_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_START_CHARGING_REPLY, message);
    }
    /**
@@ -177,8 +177,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.PLATFORM_STOP_CHARGING_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PLATFORM_STOP_CHARGING_REPLY.getValue(), message);
        message.setSource(SendTagConstant.PLATFORM_STOP_CHARGING_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_STOP_CHARGING_REPLY, message);
    }
    /**
@@ -189,8 +189,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.TRANSACTION_RECORD.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.TRANSACTION_RECORD.getValue(), message);
        message.setSource(SendTagConstant.TRANSACTION_RECORD);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.TRANSACTION_RECORD, message);
    }
    /**
@@ -201,8 +201,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.UPDATE_BALANCE_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.UPDATE_BALANCE_REPLY.getValue(), message);
        message.setSource(SendTagConstant.UPDATE_BALANCE_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.UPDATE_BALANCE_REPLY, message);
    }
    /**
@@ -213,8 +213,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.SYNCHRONIZE_OFFLINE_CARD_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.SYNCHRONIZE_OFFLINE_CARD_REPLY.getValue(), message);
        message.setSource(SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.SYNCHRONIZE_OFFLINE_CARD_REPLY, message);
    }
    /**
@@ -225,8 +225,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.CLEAR_OFFLINE_CARD_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.CLEAR_OFFLINE_CARD_REPLY.getValue(), message);
        message.setSource(SendTagConstant.CLEAR_OFFLINE_CARD_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CLEAR_OFFLINE_CARD_REPLY, message);
    }
    /**
@@ -237,8 +237,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.WORKING_PARAMETER_SETTING_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.WORKING_PARAMETER_SETTING_REPLY.getValue(), message);
        message.setSource(SendTagConstant.WORKING_PARAMETER_SETTING_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.WORKING_PARAMETER_SETTING_REPLY, message);
    }
    /**
@@ -249,8 +249,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.TIMING_SETTING_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.TIMING_SETTING_REPLY.getValue(), message);
        message.setSource(SendTagConstant.TIMING_SETTING_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.TIMING_SETTING_REPLY, message);
    }
    /**
@@ -261,8 +261,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.SETUP_BILLING_MODEL_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.SETUP_BILLING_MODEL_REPLY.getValue(), message);
        message.setSource(SendTagConstant.SETUP_BILLING_MODEL_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.SETUP_BILLING_MODEL_REPLY, message);
    }
    /**
@@ -273,8 +273,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.GROUND_LOCK_REAL_TIME_DATA.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.GROUND_LOCK_REAL_TIME_DATA.getValue(), message);
        message.setSource(SendTagConstant.GROUND_LOCK_REAL_TIME_DATA);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.GROUND_LOCK_REAL_TIME_DATA, message);
    }
    /**
@@ -285,8 +285,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA.getValue(), message);
        message.setSource(SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.CHARGING_PILE_RETURNS_GROUND_LOCK_DATA, message);
    }
    /**
@@ -297,8 +297,8 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.PLATFORM_RESTART_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PLATFORM_RESTART_REPLY.getValue(), message);
        message.setSource(SendTagConstant.PLATFORM_RESTART_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_RESTART_REPLY, message);
    }
    /**
@@ -309,7 +309,7 @@
        // 设置业务key
        message.setKey(UUID.randomUUID().toString());
        // 设置消息来源,便于查询
        message.setSource(SendTagMenu.PLATFORM_REMOTE_UPDATE_REPLY.getValue());
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagMenu.PLATFORM_REMOTE_UPDATE_REPLY.getValue(), message);
        message.setSource(SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY);
        return rocketMQEnhanceTemplate.send(TOPIC, SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY, message);
    }
}