无关风月
2024-09-05 a3aa8bd77b4a9a74601238cc467cfd115b0821b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
package com.ruoyi.integration.iotda.controller;
 
import com.ruoyi.integration.api.model.*;
import com.ruoyi.integration.iotda.enums.ServiceIdMenu;
import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce;
import com.ruoyi.integration.iotda.utils.tools.MessageUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@Slf4j
@RestController
@RequestMapping("/sendMessage")
public class SendMessageController {
 
    @Autowired
    private MessageUtil messageUtil;
    @Autowired
    private IotMessageProduce iotMessageProduce;
 
    /**
     * 登录认证应答
     * @param onlineReply  实体对象
     * @return
     */
    @PostMapping("/onlineReply")
    public String onlineReply(@RequestBody OnlineReply onlineReply){
        return  iotMessageProduce.sendMessage(onlineReply.getCharging_pile_code(), ServiceIdMenu.ONLINE_REPLY.getKey(),messageUtil.onlineReply(onlineReply));
    }
 
    /**
     * 心跳包应答
     * @param pong 实体对象
     * @return
     */
    @PostMapping("/pong")
    public String pong(@RequestBody Pong pong){
        return  iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(),messageUtil.pong(pong));
    }
 
    /**
     * 计费模型验证请求应答
     * @param billingModeVerifyReply 实体对象
     * @return
     */
    @PostMapping("/billingModeVerifyReply")
    public String billingModeVerifyReply(@RequestBody BillingModeVerifyReply billingModeVerifyReply){
        return  iotMessageProduce.sendMessage(billingModeVerifyReply.getCharging_pile_code(), ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply));
    }
 
    /**
     * 计费模型验证请求应答
     * @param acquisitionBillingModeReply 实体对象
     * @return
     */
    @PostMapping("/acquisitionBillingModeReply")
    public String acquisitionBillingModeReply(@RequestBody AcquisitionBillingModeReply acquisitionBillingModeReply){
        return  iotMessageProduce.sendMessage(acquisitionBillingModeReply.getCharging_pile_code(), ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply));
    }
 
    /**
     * 读取实时监测数据
     * @param readRealTimeMonitoringData 实体对象
     * @return
     */
    @PostMapping("/readRealTimeMonitoringData")
    public String readRealTimeMonitoringData(@RequestBody ReadRealTimeMonitoringData readRealTimeMonitoringData){
        return  iotMessageProduce.sendMessage(readRealTimeMonitoringData.getCharging_pile_code(), ServiceIdMenu.READ_REAL_TIME_MONITORING_DATA.getKey(),messageUtil.readRealTimeMonitoringData(readRealTimeMonitoringData));
    }
 
    /**
     * 充电结束
     * @param endCharge 实体对象
     * @return
     */
//    @PostMapping("/endCharge")
//    public String endCharge(@RequestBody EndCharge endCharge){
//        return  iotMessageProduce.sendMessage(endCharge.getCharging_pile_code(), ServiceIdMenu.END_CHARGE.getKey(),messageUtil.endCharge(endCharge));
//    }
 
    /**
     * 运营平台确认启动充电
     * @param platformConfirmationCharging 实体对象
     * @return
     */
    @PostMapping("/platformConfirmationCharging")
    public String platformConfirmationCharging(@RequestBody PlatformConfirmationCharging platformConfirmationCharging){
        return  iotMessageProduce.sendMessage(platformConfirmationCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_CONFIRMATION_CHARGING.getKey(),messageUtil.platformConfirmationCharging(platformConfirmationCharging));
    }
 
    /**
     * 运营平台远程控制启机
     * @param platformStartCharging 实体对象
     * @return
     */
    @PostMapping("/platformStartCharging")
    public String platformStartCharging(@RequestBody PlatformStartCharging platformStartCharging){
        return  iotMessageProduce.sendMessage(platformStartCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_START_CHARGING.getKey(),messageUtil.platformStartCharging(platformStartCharging));
    }
 
    /**
     * 运营平台远程停机
     * @param platformStopCharging 实体对象
     * @return
     */
    @PostMapping("/platformStopCharging")
    public String platformStopCharging(@RequestBody PlatformStopCharging platformStopCharging){
        return  iotMessageProduce.sendMessage(platformStopCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_STOP_CHARGING.getKey(),messageUtil.platformStopCharging(platformStopCharging));
    }
 
    /**
     * 交易记录确认
     * @param confirmTransactionRecord 实体对象
     * @return
     */
    @PostMapping("/confirmTransactionRecord")
    public String confirmTransactionRecord(@RequestBody ConfirmTransactionRecord confirmTransactionRecord){
        return  iotMessageProduce.sendMessage(confirmTransactionRecord.getTransaction_serial_number(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord));
    }
 
    /**
     * 远程账户余额更新
     * @param updateBalance 实体对象
     * @return
     */
    @PostMapping("/updateBalance")
    public String updateBalance(@RequestBody UpdateBalance updateBalance){
        return  iotMessageProduce.sendMessage(updateBalance.getCharging_pile_code(), ServiceIdMenu.UPDATE_BALANCE.getKey(),messageUtil.updateBalance(updateBalance));
    }
 
    /**
     * 离线卡数据同步
     * @param synchronizeOfflineCard 实体对象
     * @return
     */
    @PostMapping("/synchronizeOfflineCard")
    public String synchronizeOfflineCard(@RequestBody SynchronizeOfflineCard synchronizeOfflineCard){
        return  iotMessageProduce.sendMessage(synchronizeOfflineCard.getCharging_pile_code(), ServiceIdMenu.SYNCHRONIZE_OFFLINE_CARD.getKey(),messageUtil.synchronizeOfflineCard(synchronizeOfflineCard));
    }
 
    /**
     * 离线卡数据清除
     * @param clearOfflineCard 实体对象
     * @return
     */
    @PostMapping("/clearOfflineCard")
    public String clearOfflineCard(@RequestBody ClearOfflineCard clearOfflineCard){
        return  iotMessageProduce.sendMessage(clearOfflineCard.getCharging_pile_code(), ServiceIdMenu.CLEAR_OFFLINE_CARD.getKey(),messageUtil.clearOfflineCard(clearOfflineCard));
    }
 
    /**
     * 离线卡数据查询
     * @param queryOfflineCard 实体对象
     * @return
     */
    @PostMapping("/queryOfflineCard")
    public String queryOfflineCard(@RequestBody QueryOfflineCard queryOfflineCard){
        return iotMessageProduce.sendMessage(queryOfflineCard.getCharging_pile_code(), ServiceIdMenu.QUERY_OFFLINE_CARD.getKey(),messageUtil.queryOfflineCard(queryOfflineCard));
    }
 
    /**
     * 充电桩工作参数设置
     * @param workingParameterSetting 实体对象
     * @return
     */
    @PostMapping("/workingParameterSetting")
    public String workingParameterSetting(@RequestBody WorkingParameterSetting workingParameterSetting){
        return  iotMessageProduce.sendMessage(workingParameterSetting.getCharging_pile_code(), ServiceIdMenu.WORKING_PARAMETER_SETTING.getKey(),messageUtil.workingParameterSetting(workingParameterSetting));
    }
 
    /**
     * 对时设置应答
     * @param timingSettingReply 实体对象
     * @return
     */
    @PostMapping("/timingSettingReply")
    public String timingSettingReply(@RequestBody TimingSettingReply timingSettingReply){
        return  iotMessageProduce.sendMessage(timingSettingReply.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply));
    }
 
    /**
     * 计费模型设置
     * @param setupBillingModel 实体对象
     * @return
     */
    @PostMapping("/setupBillingModel")
    public String setupBillingModel(@RequestBody SetupBillingModel setupBillingModel){
        return  iotMessageProduce.sendMessage(setupBillingModel.getCharging_pile_code(), ServiceIdMenu.SETUP_BILLING_MODEL.getKey(),messageUtil.setupBillingModel(setupBillingModel));
    }
 
    /**
     * 遥控地锁升锁与降锁命令 (下行)
     * @param openOrCloseGroundLock 实体对象
     * @return
     */
    @PostMapping("/openOrCloseGroundLock")
    public String openOrCloseGroundLock(@RequestBody OpenOrCloseGroundLock openOrCloseGroundLock){
        return  iotMessageProduce.sendMessage(openOrCloseGroundLock.getCharging_pile_code(), ServiceIdMenu.OPEN_OR_CLOSE_GROUND_LOCK.getKey(),messageUtil.openOrCloseGroundLock(openOrCloseGroundLock));
    }
    /**
     * 远程重启
     * @param platformRestart 实体对象
     * @return
     */
    @PostMapping("/platformRestart")
    public String platformRestart(@RequestBody PlatformRestart platformRestart){
        return  iotMessageProduce.sendMessage(platformRestart.getCharging_pile_code(), ServiceIdMenu.PLATFORM_RESTART.getKey(),messageUtil.platformRestart(platformRestart));
    }
    /**
     * 远程更新
     * @param platformRemoteUpdate 实体对象
     * @return
     */
    @PostMapping("/platformRemoteUpdate")
    public String platformRemoteUpdate(@RequestBody PlatformRemoteUpdate platformRemoteUpdate){
        return  iotMessageProduce.sendMessage(platformRemoteUpdate.getCharging_pile_code(), ServiceIdMenu.PLATFORM_REMOTE_UPDATE.getKey(),messageUtil.platformRemoteUpdate(platformRemoteUpdate));
    }
 
}