手表绑定增加只能绑定本单位验证
This commit is contained in:
+11
-3
@@ -151,7 +151,6 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
|
||||
private AsyncTaskExecutor asyncTaskExecutor;
|
||||
|
||||
|
||||
|
||||
private RequestAttributes requestAttributes = null;
|
||||
private final ToolExportHandler toolExportHandler = new ToolExportHandler();
|
||||
@Autowired
|
||||
@@ -293,8 +292,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,7 +331,6 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
|
||||
// 初始化开关数据
|
||||
unbindUserAndInitDeviceSwitch(dto);
|
||||
}
|
||||
LoginUser userById = sysBaseAPI.getUserById(dto.getBindUserId());
|
||||
// 此处修改 只有是职工的是才赋值单位信息
|
||||
if (dto.getIsEmployee()) {
|
||||
SysDepart inDepart = sysCache.getDepartByOrgCode(userById.getOrgCode());
|
||||
|
||||
Reference in New Issue
Block a user