opt:修改远程码数值提取。

This commit is contained in:
2023-12-28 14:37:18 +08:00
parent cddc7ed726
commit 0c6e652c89

View File

@@ -61,18 +61,18 @@ public class DevelopServiceImpl implements DevelopService {
String teamViewerId = ""; String teamViewerId = "";
String serviceResponse = ""; String serviceResponse = "";
String rosStringOutput = ""; String rosStringOutput = "";
// ServiceResponse response = sendToAgvUtil.send("HMISettingGetRemoteID"); ServiceResponse response = sendToAgvUtil.send("HMISettingGetRemoteID");
// serviceResponse = response.toString(); serviceResponse = response.toString();
// rosStringOutput = JSONObject.parseObject(response.toString()).getString("ROS_String_Output"); rosStringOutput = JSONObject.parseObject(response.toString()).getString("ROS_String_Output");
String resultInfo = "GetRemotelD:1514937762 [1m TeamViewer ID:[Om 1469530530"; String resultInfo = "GetRemotelD:1514937762 [212m TeamViewer ID:[321m 1469530530";
if (StringUtils.isNotBlank(resultInfo)) { if (StringUtils.isNotBlank(rosStringOutput)) {
String regex = "GetRemotelD:(\\d+) \\[1m TeamViewer ID:\\[Om (\\d+)"; Pattern pattern = Pattern.compile("\\b(?!\\d+m)\\d+\\b");
Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(rosStringOutput);
Matcher matcher = pattern.matcher(resultInfo);
// 查找匹配项
if (matcher.find()) { if (matcher.find()) {
anyDeskId = matcher.group(1); anyDeskId = matcher.group(0);
teamViewerId = matcher.group(2); if (matcher.find()) {
teamViewerId = matcher.group(0);
}
} }
} }
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();