fix(watch): 恢复设备导入校验和手表绑定单位限制,新增未分配设备数统计
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+8
-8
@@ -439,9 +439,9 @@ public class WatchDeviceController extends JeecgController<WatchDevice, IWatchDe
|
||||
return Result.error("已存在执行中的导入任务,请稍后导入或点击【查看导入任务】查看任务导出进度!");
|
||||
}
|
||||
if (!StringUtils.hasLength(deptId) || "undefined".equals(deptId)) {
|
||||
// throw new JeecgBootException("部门不能为空");
|
||||
throw new JeecgBootException("部门不能为空");
|
||||
//可为空,空则算入新疆油田公司
|
||||
deptId = sysCache.getDepartIdByOrgCode("A01");
|
||||
// deptId = sysCache.getDepartIdByOrgCode("A01");
|
||||
}
|
||||
String sheetName = "设备导入";
|
||||
String fileName = sheetName + "_" + DateUtils.getDate("yyyyMMddHHmmss");
|
||||
@@ -707,12 +707,12 @@ public class WatchDeviceController extends JeecgController<WatchDevice, IWatchDe
|
||||
@Operation(summary = "获取时间范围的走跑数据", description = "获取时间范围的走跑数据")
|
||||
@PostMapping("getSdcDataMapByUserIds")
|
||||
public Map<String,List<WatchStatUserInfoDaySdc>> getSdcDataMapByUserIds(@RequestBody List<String> userIds,
|
||||
@RequestParam(name = "startTime")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
|
||||
@RequestParam(name = "endTime")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
|
||||
@RequestParam(name = "startTime")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
|
||||
@RequestParam(name = "endTime")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
|
||||
return watchDeviceService.getSdcDataMapByUserIds(userIds, startTime, endTime);
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -707,6 +707,12 @@ public class DeptStatisticDataServiceImpl extends ServiceImpl<DeptStatisticDataM
|
||||
:
|
||||
transfer.departBindAndWearNumMap().getOrDefault(orgCode, new DepartDeviceNum())
|
||||
);
|
||||
// 未分配设备数 = 入库设备数 - 已分配设备数,仅一、二级部门有入库数据
|
||||
if (deptStatData.getTotalAssignedDeviceNums() != null) {
|
||||
deptStatData.setUndistributedDeviceNums(
|
||||
deptStatData.getTotalAssignedDeviceNums() - deptStatData.getAssignedDeviceNums()
|
||||
);
|
||||
}
|
||||
fillWarningNums(
|
||||
deptStatData,
|
||||
(!allSecond && (isFirst || isSecond))
|
||||
|
||||
+6
-6
@@ -301,11 +301,11 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
|
||||
// 新增手表只能绑定给本单位的人
|
||||
LoginUser userById = sysBaseAPI.getUserById(dto.getBindUserId());
|
||||
|
||||
// if (userById.getOrgCode() == null || watchDevice.getOrgCode() == null ||
|
||||
// userById.getOrgCode().length() < 6 || watchDevice.getOrgCode().length() < 6 ||
|
||||
// !userById.getOrgCode().substring(0, 6).equals(watchDevice.getOrgCode().substring(0, 6))) {
|
||||
// return Result.error("手表只能绑定给本单位人员");
|
||||
// }
|
||||
if (userById.getOrgCode() == null || watchDevice.getOrgCode() == null ||
|
||||
userById.getOrgCode().length() < 6 || watchDevice.getOrgCode().length() < 6 ||
|
||||
!userById.getOrgCode().substring(0, 6).equals(watchDevice.getOrgCode().substring(0, 6))) {
|
||||
return Result.error("手表只能绑定给本单位人员");
|
||||
}
|
||||
|
||||
if (isDeviceAlreadyBound(watchDevice, dto)) {
|
||||
return Result.error("该设备已被绑定");
|
||||
@@ -2261,7 +2261,7 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
|
||||
cloudResultData.add(user);
|
||||
// 判断是否绑定手表
|
||||
List<WatchDevice> watchDeviceList = watchDeviceMapper.selectList(new LambdaQueryWrapper<WatchDevice>()
|
||||
.in(WatchDevice::getBindUserId, cloudResultData.stream().map(FamilyMembersVO::getFamilyMembersId).collect(Collectors.toList())));
|
||||
.in(WatchDevice::getBindUserId, cloudResultData.stream().map(FamilyMembersVO::getFamilyMembersId).collect(Collectors.toList())));
|
||||
if (CollUtil.isEmpty(watchDeviceList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user