Skip to content

Commit

Permalink
⭐️: 远控步骤中断
Browse files Browse the repository at this point in the history
  • Loading branch information
JayWenStar committed Jan 24, 2022
1 parent b693fc8 commit aed1a6f
Showing 1 changed file with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,32 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
controllerFeignClient.saveResultDetail(jsonMsg);
break;
case "findSteps":
LinkedHashMap j = (LinkedHashMap) controllerFeignClient.findSteps(jsonMsg.getInteger("caseId")).getData();
if (j != null) {
JSONObject steps = new JSONObject();
steps.put("msg", "runStep");
steps.put("pf", j.get("pf"));
steps.put("steps", j.get("steps"));
steps.put("gp", j.get("gp"));
steps.put("sessionId", jsonMsg.getString("sessionId"));
steps.put("pwd", jsonMsg.getString("pwd"));
steps.put("udId", jsonMsg.getString("udId"));
NettyServer.getMap().get(jsonMsg.getInteger("agentId")).writeAndFlush(steps.toJSONString());
}
JSONObject steps = findSteps(jsonMsg, "runStep");
NettyServer.getMap().get(jsonMsg.getInteger("agentId")).writeAndFlush(steps.toJSONString());
break;
}
}

/**
* 查找 & 封装步骤对象
*
* @param jsonMsg websocket消息
* @return 步骤对象
*/
private JSONObject findSteps(JSONObject jsonMsg, String msg) {
LinkedHashMap j = (LinkedHashMap) controllerFeignClient.findSteps(jsonMsg.getInteger("caseId")).getData();
JSONObject steps = new JSONObject();
steps.put("cid", jsonMsg.getInteger("caseId"));
steps.put("msg", msg);
steps.put("pf", j.get("pf"));
steps.put("steps", j.get("steps"));
steps.put("gp", j.get("gp"));
steps.put("sessionId", jsonMsg.getString("sessionId"));
steps.put("pwd", jsonMsg.getString("pwd"));
steps.put("udId", jsonMsg.getString("udId"));
return steps;
}

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
logger.info("Agent: {} 发生异常 {}", ctx.channel().remoteAddress(), cause.fillInStackTrace());
Expand Down

0 comments on commit aed1a6f

Please sign in to comment.