fix(健康监测): 修复手表绑定单位校验使用前端传入orgCode导致的校验失效问题

将绑定校验的orgCode来源从dto改为watchDevice实体,
避免前端未传orgCode时校验必定失败,同时消除伪造绕过风险

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
wanghao
2026-04-07 14:41:42 +08:00
co-authored by Claude Opus 4.6
parent c7041fa69e
commit 6d6920a2b3
@@ -301,9 +301,9 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
// 新增手表只能绑定给本单位的人 // 新增手表只能绑定给本单位的人
LoginUser userById = sysBaseAPI.getUserById(dto.getBindUserId()); LoginUser userById = sysBaseAPI.getUserById(dto.getBindUserId());
if (userById.getOrgCode() == null || dto.getOrgCode() == null || if (userById.getOrgCode() == null || watchDevice.getOrgCode() == null ||
userById.getOrgCode().length() < 6 || dto.getOrgCode().length() < 6 || userById.getOrgCode().length() < 6 || watchDevice.getOrgCode().length() < 6 ||
!userById.getOrgCode().substring(0, 6).equals(dto.getOrgCode().substring(0, 6))) { !userById.getOrgCode().substring(0, 6).equals(watchDevice.getOrgCode().substring(0, 6))) {
return Result.error("手表只能绑定给本单位人员"); return Result.error("手表只能绑定给本单位人员");
} }