|
|
|
@ -251,8 +251,16 @@ public class ExternalServiceImpl implements ExternalService { |
|
|
|
// String wValue = matcher.group(1); // 提取 W 的数值部分
|
|
|
|
// String hValue = matcher.group(2); // 提取 H 的数值部分
|
|
|
|
// 提取ID部分(去掉开头的"RD")
|
|
|
|
String testId = input.substring(2, input.indexOf("W:")); |
|
|
|
HmsWeightHeight hmsWeightHeight = new HmsWeightHeight(); |
|
|
|
|
|
|
|
try { |
|
|
|
String testId = input.substring(2, input.indexOf("W:")); |
|
|
|
hmsWeightHeight.setTestId(testId); |
|
|
|
System.out.println("id: " + testId); |
|
|
|
}catch (Exception e) { |
|
|
|
hmsWeightHeight.setTestId(""); |
|
|
|
System.out.println("未找到testId"); |
|
|
|
} |
|
|
|
// 提取体重和身高
|
|
|
|
String width = input.substring(input.indexOf("W:") + 2, input.indexOf(" H:")); |
|
|
|
String height = input.substring(input.indexOf("H:") + 2); |
|
|
|
@ -261,17 +269,17 @@ public class ExternalServiceImpl implements ExternalService { |
|
|
|
// double width = Double.parseDouble(wValue);
|
|
|
|
// double height = Double.parseDouble(hValue);
|
|
|
|
|
|
|
|
HmsWeightHeight hmsWeightHeight = new HmsWeightHeight(); |
|
|
|
|
|
|
|
hmsWeightHeight.setHeight(new BigDecimal(height).toString()); |
|
|
|
hmsWeightHeight.setWeight(new BigDecimal(width) + ""); |
|
|
|
hmsWeightHeight.setId(IdUtil.getSnowflakeNextId()); |
|
|
|
hmsWeightHeight.setTestId(testId); |
|
|
|
|
|
|
|
hmsWeightHeightMapper.insertSelective(hmsWeightHeight); |
|
|
|
|
|
|
|
// 输出结果(或按需处理)
|
|
|
|
System.out.println("W: " + width); // 输出: W: 66.5
|
|
|
|
System.out.println("H: " + height); // 输出: H: 173.5
|
|
|
|
System.out.println("id: " + testId); |
|
|
|
|
|
|
|
// } else {
|
|
|
|
// System.out.println("未找到有效的 W 或 H 值");
|
|
|
|
// }
|
|
|
|
|