xuhy
2024-09-26 b765682e46bcb5e36618075ebf810db22b32dbc5
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java
@@ -2,8 +2,8 @@
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.integration.api.model.*;
import com.ruoyi.integration.iotda.enums.ServiceIdMenu;
import com.ruoyi.integration.mongodb.model.*;
import com.ruoyi.integration.mongodb.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +46,8 @@
    @Autowired
    private TimingSettingService timingSettingService;
    @Autowired
    private TimingSettingReplyService timingSettingReplyService;
    @Autowired
    private SetupBillingModelService setupBillingModelService;
    @Autowired
    private OpenOrCloseGroundLockService openOrCloseGroundLockService;
@@ -53,15 +55,13 @@
    private PlatformRestartService platformRestartService;
    @Autowired
    private PlatformRemoteUpdateService platformRemoteUpdateService;
    @Autowired
    private MessageConvertUtil messageConvertUtil;
    /**
     * 登录认证应答
     * @param onlineReply  实体对象
     * @return
     */
    public String onlineReply(OnlineReply onlineReply){
    public JSONObject onlineReply(OnlineReply onlineReply){
        onlineReplyService.create(onlineReply);
        return  getMessageJsonString(onlineReply, ServiceIdMenu.ONLINE_REPLY.getValue());
    }
@@ -71,7 +71,7 @@
     * @param pong 实体对象
     * @return
     */
    public String pong(Pong pong){
    public JSONObject pong(Pong pong){
        pongService.create(pong);
        return  getMessageJsonString(pong, ServiceIdMenu.PONG.getValue());
    }
@@ -81,7 +81,7 @@
     * @param billingModeVerifyReply 实体对象
     * @return
     */
    public String billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){
    public JSONObject billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){
        billingModeVerifyReplyService.create(billingModeVerifyReply);
        return  getMessageJsonString(billingModeVerifyReply, ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getValue());
    }
@@ -91,7 +91,7 @@
     * @param acquisitionBillingModeReply 实体对象
     * @return
     */
    public String acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply){
    public JSONObject acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply){
        acquisitionBillingModeReplyService.create(acquisitionBillingModeReply);
        return  getMessageJsonString(acquisitionBillingModeReply, ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getValue());
    }
@@ -101,7 +101,7 @@
     * @param readRealTimeMonitoringData 实体对象
     * @return
     */
    public String readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData){
    public JSONObject readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData){
        readRealTimeMonitoringDataService.create(readRealTimeMonitoringData);
        return  getMessageJsonString(readRealTimeMonitoringData, ServiceIdMenu.READ_REAL_TIME_MONITORING_DATA.getValue());
    }
@@ -111,17 +111,17 @@
     * @param endCharge 实体对象
     * @return
     */
    public String endCharge(EndCharge endCharge){
        endChargeService.create(endCharge);
        return  getMessageJsonString(endCharge, ServiceIdMenu.END_CHARGE.getValue());
    }
//    public String endCharge(EndCharge endCharge){
//        endChargeService.create(endCharge);
//        return  getMessageJsonString(endCharge, ServiceIdMenu.END_CHARGE.getValue());
//    }
    /**
     * 运营平台确认启动充电
     * @param platformConfirmationCharging 实体对象
     * @return
     */
    public String platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging){
    public JSONObject platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging){
        platformConfirmationChargingService.create(platformConfirmationCharging);
        return  getMessageJsonString(platformConfirmationCharging, ServiceIdMenu.PLATFORM_CONFIRMATION_CHARGING.getValue());
    }
@@ -131,7 +131,7 @@
     * @param platformStartCharging 实体对象
     * @return
     */
    public String platformConfirmationCharging(PlatformStartCharging platformStartCharging){
    public JSONObject platformStartCharging(PlatformStartCharging platformStartCharging){
        platformStartChargingService.create(platformStartCharging);
        return  getMessageJsonString(platformStartCharging, ServiceIdMenu.PLATFORM_START_CHARGING.getValue());
    }
@@ -141,7 +141,7 @@
     * @param platformStopCharging 实体对象
     * @return
     */
    public String platformStopCharging(PlatformStopCharging platformStopCharging){
    public JSONObject platformStopCharging(PlatformStopCharging platformStopCharging){
        platformStopChargingService.create(platformStopCharging);
        return  getMessageJsonString(platformStopCharging, ServiceIdMenu.PLATFORM_STOP_CHARGING.getValue());
    }
@@ -151,7 +151,7 @@
     * @param confirmTransactionRecord 实体对象
     * @return
     */
    public String confirmTransactionRecord(ConfirmTransactionRecord confirmTransactionRecord){
    public JSONObject confirmTransactionRecord(ConfirmTransactionRecord confirmTransactionRecord){
        confirmTransactionRecordService.create(confirmTransactionRecord);
        return  getMessageJsonString(confirmTransactionRecord, ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getValue());
    }
@@ -161,7 +161,7 @@
     * @param updateBalance 实体对象
     * @return
     */
    public String updateBalance(UpdateBalance updateBalance){
    public JSONObject updateBalance(UpdateBalance updateBalance){
        updateBalanceService.create(updateBalance);
        return  getMessageJsonString(updateBalance, ServiceIdMenu.UPDATE_BALANCE.getValue());
    }
@@ -171,7 +171,7 @@
     * @param synchronizeOfflineCard 实体对象
     * @return
     */
    public String synchronizeOfflineCard(SynchronizeOfflineCard synchronizeOfflineCard){
    public JSONObject synchronizeOfflineCard(SynchronizeOfflineCard synchronizeOfflineCard){
        synchronizeOfflineCardService.create(synchronizeOfflineCard);
        return  getMessageJsonString(synchronizeOfflineCard, ServiceIdMenu.SYNCHRONIZE_OFFLINE_CARD.getValue());
    }
@@ -181,7 +181,7 @@
     * @param clearOfflineCard 实体对象
     * @return
     */
    public String clearOfflineCard(ClearOfflineCard clearOfflineCard){
    public JSONObject clearOfflineCard(ClearOfflineCard clearOfflineCard){
        clearOfflineCardService.create(clearOfflineCard);
        return  getMessageJsonString(clearOfflineCard, ServiceIdMenu.CLEAR_OFFLINE_CARD.getValue());
    }
@@ -191,7 +191,7 @@
     * @param queryOfflineCard 实体对象
     * @return
     */
    public String queryOfflineCard(QueryOfflineCard queryOfflineCard){
    public JSONObject queryOfflineCard(QueryOfflineCard queryOfflineCard){
        queryOfflineCardService.create(queryOfflineCard);
        return  getMessageJsonString(queryOfflineCard, ServiceIdMenu.QUERY_OFFLINE_CARD.getValue());
    }
@@ -201,7 +201,7 @@
     * @param workingParameterSetting 实体对象
     * @return
     */
    public String workingParameterSetting(WorkingParameterSetting workingParameterSetting){
    public JSONObject workingParameterSetting(WorkingParameterSetting workingParameterSetting){
        workingParameterSettingService.create(workingParameterSetting);
        return  getMessageJsonString(workingParameterSetting, ServiceIdMenu.WORKING_PARAMETER_SETTING.getValue());
    }
@@ -211,9 +211,18 @@
     * @param timingSetting 实体对象
     * @return
     */
    public String timingSetting(TimingSetting timingSetting){
    public JSONObject timingSetting(TimingSetting timingSetting){
        timingSettingService.create(timingSetting);
        return  getMessageJsonString(timingSetting, ServiceIdMenu.TIMING_SETTING.getValue());
    }
    /**
     * 对时设置应答
     * @param timingSettingReply 实体对象
     * @return
     */
    public JSONObject timingSettingReply(TimingSettingReply timingSettingReply){
        timingSettingReplyService.create(timingSettingReply);
        return  getMessageJsonString(timingSettingReply, ServiceIdMenu.TIMING_SETTING_REPLY.getValue());
    }
    /**
@@ -221,7 +230,7 @@
     * @param setupBillingModel 实体对象
     * @return
     */
    public String setupBillingModel(SetupBillingModel setupBillingModel){
    public JSONObject setupBillingModel(SetupBillingModel setupBillingModel){
        setupBillingModelService.create(setupBillingModel);
        return  getMessageJsonString(setupBillingModel, ServiceIdMenu.SETUP_BILLING_MODEL.getValue());
    }
@@ -231,7 +240,7 @@
     * @param openOrCloseGroundLock 实体对象
     * @return
     */
    public String openOrCloseGroundLock(OpenOrCloseGroundLock openOrCloseGroundLock){
    public JSONObject openOrCloseGroundLock(OpenOrCloseGroundLock openOrCloseGroundLock){
        openOrCloseGroundLockService.create(openOrCloseGroundLock);
        return  getMessageJsonString(openOrCloseGroundLock, ServiceIdMenu.OPEN_OR_CLOSE_GROUND_LOCK.getValue());
    }
@@ -240,7 +249,7 @@
     * @param platformRestart 实体对象
     * @return
     */
    public String platformRestart(PlatformRestart platformRestart){
    public JSONObject platformRestart(PlatformRestart platformRestart){
        platformRestartService.create(platformRestart);
        return  getMessageJsonString(platformRestart, ServiceIdMenu.PLATFORM_RESTART.getValue());
    }
@@ -249,7 +258,7 @@
     * @param platformRemoteUpdate 实体对象
     * @return
     */
    public String platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate){
    public JSONObject platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate){
        platformRemoteUpdateService.create(platformRemoteUpdate);
        return  getMessageJsonString(platformRemoteUpdate, ServiceIdMenu.PLATFORM_REMOTE_UPDATE.getValue());
    }
@@ -260,9 +269,9 @@
     * @param serviceId 服务ID
     * @return
     */
    public String getMessageJsonString(Object object, String serviceId){
    public JSONObject getMessageJsonString(Object object, String serviceId){
        JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object));
        jsonObject.put("service_id", serviceId);
        return jsonObject.toJSONString();
        return jsonObject;
    }
}