fix(手表设备): 手表绑定时校验只能绑定本单位人员
新增单位编码前6位匹配校验,禁止跨单位绑定手表; 同时将"该设备已绑定该员工"改为"该设备已被绑定" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a43806c4e9
commit
2e90ec71cc
+12
-3
@@ -293,8 +293,18 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
|
||||
if (watchDevice == null) {
|
||||
return Result.error("该监测工具不存在");
|
||||
}
|
||||
|
||||
// 新增手表只能绑定给本单位的人
|
||||
LoginUser userById = sysBaseAPI.getUserById(dto.getBindUserId());
|
||||
|
||||
if (userById.getOrgCode() == null || dto.getOrgCode() == null ||
|
||||
userById.getOrgCode().length() < 6 || dto.getOrgCode().length() < 6 ||
|
||||
!userById.getOrgCode().substring(0, 6).equals(dto.getOrgCode().substring(0, 6))) {
|
||||
return Result.error("手表只能绑定给本单位人员");
|
||||
}
|
||||
|
||||
if (isDeviceAlreadyBound(watchDevice, dto)) {
|
||||
return Result.error("该设备已绑定该员工");
|
||||
return Result.error("该设备已被绑定");
|
||||
}
|
||||
// 查询员工是否有绑定
|
||||
List<WatchDevice> deviceByUserIdList = getDeviceByUserId(dto.getBindUserId());
|
||||
@@ -322,9 +332,8 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
|
||||
// 初始化开关数据
|
||||
unbindUserAndInitDeviceSwitch(dto);
|
||||
}
|
||||
LoginUser userById = sysBaseAPI.getUserById(dto.getBindUserId());
|
||||
// 此处修改 只有是职工的是才赋值单位信息
|
||||
if (dto.getIsEmployee()){
|
||||
if (dto.getIsEmployee()) {
|
||||
SysDepart inDepart = sysCache.getDepartByOrgCode(userById.getOrgCode());
|
||||
dto.setOrgCode(inDepart.getOrgCode());
|
||||
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(userById.getOrgCode()));
|
||||
|
||||
Reference in New Issue
Block a user