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.查询关爱联络员信息及急救人员查询接口 * 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.批量更新员工关键信息接口 * 19.批量更新员工关键信息接口
@@ -18,9 +18,14 @@ public class DeptStatData {
/** /**
* 已分配设备数 * 已分配设备数
*/ */
@Excel(name = "分配设备数", width = 15,orderNum = "4") @Excel(name = "分配设备数", width = 15,orderNum = "4")
private Integer assignedDeviceNums; private Integer assignedDeviceNums;
/**
* 未分配设备数(入库设备数 - 已分配设备数,仅一、二级部门有值)
*/
@Excel(name = "未分配设备数", width = 15,orderNum = "5")
private Integer undistributedDeviceNums;
@Excel(name = "入库设备数", width = 15,orderNum = "3") @Excel(name = "入库设备数", width = 15,orderNum = "3")
private Integer totalAssignedDeviceNums; 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; private Integer assignedUserNums;
/** /**
* 未佩戴人员数 * 未佩戴人员数
*/ */
@Excel(name = "未佩戴人员数", width = 15,orderNum = "6") @Excel(name = "未佩戴人员数", width = 15,orderNum = "7")
private Integer undistributedUserNums; private Integer undistributedUserNums;
@Excel(name = "心率异常人数", width = 15,orderNum = "7") @Excel(name = "心率异常人数", width = 15,orderNum = "8")
private Integer heartRateNums; private Integer heartRateNums;
@Excel(name = "血氧异常人数", width = 15,orderNum = "8") @Excel(name = "血氧异常人数", width = 15,orderNum = "9")
private Integer spo2Nums; private Integer spo2Nums;
@Excel(name = "压力异常人数", width = 15,orderNum = "9") @Excel(name = "压力异常人数", width = 15,orderNum = "10")
private Integer stressNums; private Integer stressNums;
@Excel(name = "体温异常人数", width = 15,orderNum = "10") @Excel(name = "体温异常人数", width = 15,orderNum = "11")
private Integer tempNums; private Integer tempNums;
} }
@@ -439,9 +439,9 @@ public class WatchDeviceController extends JeecgController<WatchDevice, IWatchDe
return Result.error("已存在执行中的导入任务,请稍后导入或点击【查看导入任务】查看任务导出进度!"); return Result.error("已存在执行中的导入任务,请稍后导入或点击【查看导入任务】查看任务导出进度!");
} }
if (!StringUtils.hasLength(deptId) || "undefined".equals(deptId)) { if (!StringUtils.hasLength(deptId) || "undefined".equals(deptId)) {
// throw new JeecgBootException("部门不能为空"); throw new JeecgBootException("部门不能为空");
//可为空,空则算入新疆油田公司 //可为空,空则算入新疆油田公司
deptId = sysCache.getDepartIdByOrgCode("A01"); // deptId = sysCache.getDepartIdByOrgCode("A01");
} }
String sheetName = "设备导入"; String sheetName = "设备导入";
String fileName = sheetName + "_" + DateUtils.getDate("yyyyMMddHHmmss"); String fileName = sheetName + "_" + DateUtils.getDate("yyyyMMddHHmmss");
@@ -707,6 +707,12 @@ public class DeptStatisticDataServiceImpl extends ServiceImpl<DeptStatisticDataM
: :
transfer.departBindAndWearNumMap().getOrDefault(orgCode, new DepartDeviceNum()) transfer.departBindAndWearNumMap().getOrDefault(orgCode, new DepartDeviceNum())
); );
// 未分配设备数 = 入库设备数 - 已分配设备数,仅一、二级部门有入库数据
if (deptStatData.getTotalAssignedDeviceNums() != null) {
deptStatData.setUndistributedDeviceNums(
deptStatData.getTotalAssignedDeviceNums() - deptStatData.getAssignedDeviceNums()
);
}
fillWarningNums( fillWarningNums(
deptStatData, deptStatData,
(!allSecond && (isFirst || isSecond)) (!allSecond && (isFirst || isSecond))
@@ -301,11 +301,11 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
// 新增手表只能绑定给本单位的人 // 新增手表只能绑定给本单位的人
LoginUser userById = sysBaseAPI.getUserById(dto.getBindUserId()); LoginUser userById = sysBaseAPI.getUserById(dto.getBindUserId());
// if (userById.getOrgCode() == null || watchDevice.getOrgCode() == null || if (userById.getOrgCode() == null || watchDevice.getOrgCode() == null ||
// userById.getOrgCode().length() < 6 || watchDevice.getOrgCode().length() < 6 || userById.getOrgCode().length() < 6 || watchDevice.getOrgCode().length() < 6 ||
// !userById.getOrgCode().substring(0, 6).equals(watchDevice.getOrgCode().substring(0, 6))) { !userById.getOrgCode().substring(0, 6).equals(watchDevice.getOrgCode().substring(0, 6))) {
// return Result.error("手表只能绑定给本单位人员"); return Result.error("手表只能绑定给本单位人员");
// } }
if (isDeviceAlreadyBound(watchDevice, dto)) { if (isDeviceAlreadyBound(watchDevice, dto)) {
return Result.error("该设备已被绑定"); return Result.error("该设备已被绑定");