|  |  | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.zy.common.model.NavigateNode; | 
 |  |  | import com.zy.core.model.command.NyShuttleHttpCommand; | 
 |  |  | import com.zy.core.model.protocol.NyShuttleProtocol; | 
 |  |  |  | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |         HashMap<String, Object> body = new HashMap<>(); | 
 |  |  |         body.put("requestType", "move");//移动命令 | 
 |  |  |         body.put("taskId", wrkNo);//任务号 | 
 |  |  |         body.put("start", start);//起点 | 
 |  |  |         body.put("target", target);//终点 | 
 |  |  |         body.put("start", navigateNodeToNyPointNode(start));//起点 | 
 |  |  |         body.put("target", navigateNodeToNyPointNode(target));//终点 | 
 |  |  |         request.setBody(body); | 
 |  |  |  | 
 |  |  |         httpStandard.setRequest(request); | 
 |  |  | 
 |  |  |         HashMap<String, Object> body = new HashMap<>(); | 
 |  |  |         body.put("requestType", in ? "intoLift" : "outLift");//进出提升机 | 
 |  |  |         body.put("taskId", wrkNo);//任务号 | 
 |  |  |         body.put("start", start);//起点 | 
 |  |  |         body.put("target", target);//终点 | 
 |  |  |         body.put("start", navigateNodeToNyPointNode(start));//起点 | 
 |  |  |         body.put("target", navigateNodeToNyPointNode(target));//终点 | 
 |  |  |         request.setBody(body); | 
 |  |  |  | 
 |  |  |         httpStandard.setRequest(request); | 
 |  |  | 
 |  |  |         try { | 
 |  |  |             String response = new HttpHandler.Builder() | 
 |  |  |                     .setUri(requestUrl) | 
 |  |  |                     .setPath("/test") | 
 |  |  |                     .setPath("/static/readStatus.json") | 
 |  |  |                     .setJson(JSON.toJSONString(httpCommand)) | 
 |  |  |                     .build() | 
 |  |  |                     .doPost(); | 
 |  |  |                     .doGet(); | 
 |  |  |             JSONObject jsonObject = JSON.parseObject(response); | 
 |  |  |             JSONObject request = jsonObject.getJSONObject("request"); | 
 |  |  |             JSONObject body = request.getJSONObject("body"); | 
 |  |  |             if (body.get("result").equals("success")) { | 
 |  |  |             JSONObject response2 = jsonObject.getJSONObject("response"); | 
 |  |  |             JSONObject body = response2.getJSONObject("body"); | 
 |  |  |  | 
 |  |  |             if (body.get("responseType").equals("state")) {//读取状态,不需要判断success | 
 |  |  |                 return body; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (body.get("result").equals("success")) { | 
 |  |  |                 return body; | 
 |  |  |             } | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  | //            e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     //地图节点转换牛眼节点 | 
 |  |  |     public static NyShuttleProtocol.NyShuttlePointClass navigateNodeToNyPointNode(NavigateNode node) { | 
 |  |  |         int[] NyPosition = NavigatePositionConvert.WCSXyzToNyXyz(node.getX(), node.getY(), node.getZ());//WCS系统坐标转牛眼坐标 | 
 |  |  |         NyShuttleProtocol.NyShuttlePointClass point = new NyShuttleProtocol.NyShuttlePointClass(); | 
 |  |  |         point.setX(NyPosition[0]); | 
 |  |  |         point.setY(NyPosition[1]); | 
 |  |  |         point.setZ(NyPosition[2]); | 
 |  |  |         return point; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |