fix(controller): 禁止移动端解绑手表设备并优化异步处理

- 移动端解绑设备接口返回错误提示,需联系健康管理员解绑
- 设备绑定流程中的警告开关设置改为异步执行
- 防止外部系统异常影响主业务流程
- 解绑操作中移除对数据中心的通知调用
This commit is contained in:
2026-04-10 10:28:06 +08:00
parent 4610ac4737
commit ae866f0791
2 changed files with 15 additions and 10 deletions
@@ -207,7 +207,9 @@ public class WatchDeviceController extends JeecgController<WatchDevice, IWatchDe
@Operation(summary = "移动端解绑设备(手表)", description = "移动端解绑设备(手表)")
@GetMapping("/app/unbundleDevice")
public Result unbundleDevice(@RequestParam(name = "watchNo") String watchNo) {
return watchDeviceService.unbundleDevice(watchNo);
//移动端暂不允许解绑手表
return Result.error("请联系健康管理员解绑");
// return watchDeviceService.unbundleDevice(watchNo);
}
/**
@@ -507,15 +507,18 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
switchUpdateWrapper.eq(WatchDeviceSwitch::getWatchNo, dto.getWatchNo());
watchDeviceSwitchService.update(switchUpdateWrapper);
String[] wdTypes = {"heart_rate", "spo2", "stress", "temperature"};
for (int i = 0; i < wdTypes.length; i++) {
WarnSwitch warnSwitch = new WarnSwitch();
warnSwitch.setWatchNo(dto.getWatchNo());
warnSwitch.setWdType(wdTypes[i]);
warnSwitch.setSwitchFlag("1");
dataCenterExecutor.saveWarnSwitch(warnSwitch);
}
//通知更新
dataCenterExecutor.cmdUpdateSwitch(dto.getWatchNo());
// 异步调用外部系统,防止外部系统异常导致功能异常,解绑这里非必要
asyncTaskExecutor.execute(() -> {
for (int i = 0; i < wdTypes.length; i++) {
WarnSwitch warnSwitch = new WarnSwitch();
warnSwitch.setWatchNo(dto.getWatchNo());
warnSwitch.setWdType(wdTypes[i]);
warnSwitch.setSwitchFlag("1");
dataCenterExecutor.saveWarnSwitch(warnSwitch);
}
//通知更新
dataCenterExecutor.cmdUpdateSwitch(dto.getWatchNo());
});
}
/**