无关风月
2024-08-22 53dcd3ccc566382ed04fe3c06974dfedd0fffef3
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
package com.ruoyi.integration.iotda.utils.tools;
 
 
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.integration.iotda.constant.ServiceIdConstant;
 
import java.util.HashMap;
import java.util.Map;
 
public class MessageUtil {
 
    /**
     * 登录认证应答
     * @param charging_pile_code  桩编码
     * @param online_result 登录结果(0:成功,1:失败)
     * @return
     */
    public static String onlineReply(String charging_pile_code,Integer online_result){
        Map<String,Object> map = new HashMap<>(3);
        map.put("service_id", ServiceIdConstant.ONLINE_REPLY);
        map.put("charging_pile_code",charging_pile_code);
        map.put("online_result",online_result);
        return JSONObject.toJSONString(map);
    }
 
    /**
     * 心跳包应答
     * @param charging_pile_code 桩编码
     * @param charging_gun_code 枪号
     * @param charging_gun_status 心跳应答(0)
     * @return
     */
    public static String pong(String charging_pile_code,String charging_gun_code,Integer charging_gun_status){
        Map<String,Object> map = new HashMap<>(3);
        map.put("service_id", ServiceIdConstant.ONLINE_REPLY);
        map.put("charging_pile_code",charging_pile_code);
        map.put("charging_gun_code",charging_gun_code);
        map.put("charging_gun_status",charging_gun_status);
        return JSONObject.toJSONString(map);
    }
 
}