fix(watch): 恢复设备导入校验和手表绑定单位限制,新增未分配设备数统计

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 11:05:33 +08:00
co-authored by Claude Opus 4.7
parent 0e8f5e7b14
commit ffee8611fe
5 changed files with 33 additions and 25 deletions
@@ -99,7 +99,7 @@ public enum AnYanApiEnum {
/**
* 18.查询关爱联络员信息及急救人员查询接口
*/
QUERY_EMPLOYEE_CARE_PERSON("/aygc-znhpt-sys/0/api/empCareEmp/findPageByIdNo", "", HttpMethod.POST),
QUERY_EMPLOYEE_CARE_PERSON("/aygc-znhpt-sys/0/api/empCareEmp/findPage", "", HttpMethod.POST),
/**
* 19.批量更新员工关键信息接口
@@ -18,9 +18,14 @@ public class DeptStatData {
/**
* 已分配设备数
*/
@Excel(name = "分配设备数", width = 15,orderNum = "4")
@Excel(name = "分配设备数", width = 15,orderNum = "4")
private Integer assignedDeviceNums;
/**
* 未分配设备数(入库设备数 - 已分配设备数,仅一、二级部门有值)
*/
@Excel(name = "未分配设备数", width = 15,orderNum = "5")
private Integer undistributedDeviceNums;
@Excel(name = "入库设备数", width = 15,orderNum = "3")
private Integer totalAssignedDeviceNums;
@@ -28,25 +33,22 @@ public class DeptStatData {
/**
* 佩戴人员数
*/
@Excel(name = "佩戴人员数", width = 15,orderNum = "5")
@Excel(name = "佩戴人员数", width = 15,orderNum = "6")
private Integer assignedUserNums;
/**
* 未佩戴人员数
*/
@Excel(name = "未佩戴人员数", width = 15,orderNum = "6")
@Excel(name = "未佩戴人员数", width = 15,orderNum = "7")
private Integer undistributedUserNums;
@Excel(name = "心率异常人数", width = 15,orderNum = "7")
@Excel(name = "心率异常人数", width = 15,orderNum = "8")
private Integer heartRateNums;
@Excel(name = "血氧异常人数", width = 15,orderNum = "8")
@Excel(name = "血氧异常人数", width = 15,orderNum = "9")
private Integer spo2Nums;
@Excel(name = "压力异常人数", width = 15,orderNum = "9")
@Excel(name = "压力异常人数", width = 15,orderNum = "10")
private Integer stressNums;
@Excel(name = "体温异常人数", width = 15,orderNum = "10")
@Excel(name = "体温异常人数", width = 15,orderNum = "11")
private Integer tempNums;
}
@@ -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);
}
@@ -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))
@@ -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<>();
}