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 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 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); } }