fix(watch): 最近一次代码合并

This commit is contained in:
2026-05-09 20:23:20 +08:00
parent 86fa43c284
commit 270c9a52f9
5 changed files with 69 additions and 59 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;
}
@@ -212,7 +212,6 @@ public class WatchDeviceController extends JeecgController<WatchDevice, IWatchDe
// return watchDeviceService.unbundleDevice(watchNo);
}
/**
* 设置上传频次
*
@@ -440,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");
@@ -708,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))
@@ -2184,8 +2190,8 @@ public class DeptStatisticDataServiceImpl extends ServiceImpl<DeptStatisticDataM
? sysCache.getDepartByOrgCode(orgCodeLeaf).getDepartName()
: (
StrUtil.isNotBlank(orgCode)
? sysCache.getDepartByOrgCode(orgCode).getDepartName()
: "");
? sysCache.getDepartByOrgCode(orgCode).getDepartName()
: "");
LoginUser loginUser = GlobalUtils.getLoginUser();
Boolean flag = sysBaseAPI.getFinishFlagByCode(WATCH_DEPT_DATA_STAT_DETAIL, DOING);
if (!flag) {
@@ -152,6 +152,7 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
private AsyncTaskExecutor asyncTaskExecutor;
private RequestAttributes requestAttributes = null;
private final ToolExportHandler toolExportHandler = new ToolExportHandler();
@Autowired
@@ -300,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("该设备已被绑定");
@@ -415,7 +416,7 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result unbundleUser(BindUserDTO dto) {
public Result unbundleUser(BindUserDTO dto){
WatchDevice watchDevice = getDeviceByWatchNo(dto.getWatchNo());
if (watchDevice == null) {
return Result.error("该设备不存在");
@@ -441,12 +442,14 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
@Override
@Transactional(rollbackFor = Exception.class)
public Result unbundleDevice(String watchNo) {
BindUserDTO dto = new BindUserDTO();
dto.setBindUserId(GlobalUtils.getLoginUser().getId());
dto.setWatchNo(watchNo);
dto.setBindDate(new Date());
return unbundleUser(dto);
public Result unbundleDevice(String watchNo){
// BindUserDTO dto = new BindUserDTO();
// dto.setBindUserId(GlobalUtils.getLoginUser().getId());
// dto.setWatchNo(watchNo);
// dto.setBindDate(new Date());
// return unbundleUser(dto);
// 2026.04.09 说 不能从移动端解绑了
return Result.error("请联系管理员解绑");
}
/**
@@ -559,7 +562,7 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
watchBindHis.setBindUserId(dto.getBindUserId());
watchBindHis.setCreateDate(new Date());
watchBindHis.setUpdateDate(null);
if (dto.getIsEmployee()) {
if (dto.getIsEmployee()){
watchBindHis.setDeptId(dto.getDeptId());
watchBindHis.setOrgCode(dto.getOrgCode());
}
@@ -861,7 +864,7 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
binHisQueryWrapper.isNull(WatchBindHis::getBindEndDate);
binHisQueryWrapper.eq(WatchBindHis::getWatchNo, watchDevice.getWatchNo());
binHisQueryWrapper.orderByDesc(WatchBindHis::getCreateDate);
binHisQueryWrapper.last("FETCH FIRST 1 ROWS ONLY");
binHisQueryWrapper.last("limit 1");
WatchBindHis watchBindHis = watchBindHisService.getOne(binHisQueryWrapper);
if (watchBindHis == null) {
return false;
@@ -1639,26 +1642,26 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
vo.setSex(user.getSex());
vo.setAge(user.getAge());
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(user.getOrgCode()));
if (ObjUtil.isNotEmpty(secondDepart)) {
if (ObjUtil.isNotEmpty(secondDepart)){
vo.setUnitCode(secondDepart.getOrgCode());
vo.setUnitName(secondDepart.getDepartName());
}
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(user.getOrgCode()));
if (ObjUtil.isNotEmpty(thirdDepart)) {
if (ObjUtil.isNotEmpty(thirdDepart)){
vo.setOrgCode(thirdDepart.getOrgCode());
vo.setOrgName(thirdDepart.getDepartName());
}
EmployeeHeightWeight userWeightInfo = GlobalUtils.getCloudResultData(sysBaseAPI.appUserFindUserHeightWeight(userId));
if (null != userWeightInfo) {
vo.setHeight(StrUtil.isNotEmpty(userWeightInfo.getHeight()) ? Double.parseDouble(userWeightInfo.getHeight()) : null);
vo.setWeight(StrUtil.isNotEmpty(userWeightInfo.getWeight()) ? Double.parseDouble(userWeightInfo.getWeight()) : null);
if (null != userWeightInfo){
vo.setHeight(StrUtil.isNotEmpty(userWeightInfo.getHeight())?Double.parseDouble(userWeightInfo.getHeight()):null);
vo.setWeight(StrUtil.isNotEmpty(userWeightInfo.getWeight())?Double.parseDouble(userWeightInfo.getWeight()):null);
}
if (null != sdc) {
if (null != sdc){
vo.setWalkingSum(sdc.getStepValue());
vo.setWalkRunCalorie(sdc.getCalorieValue() / 1000);
}
if (null != workout) {
if (null != workout){
vo.setFitnessCalorie(workout.getCalorieTotalValue());
}
Page<UserDayCalorieInfoVo> resultPage = new Page<>();
@@ -1727,7 +1730,7 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
// 获取该用户消耗数据
List<WatchStatUserInfoDayWorkout> workoutList = workoutUserMap.get(userId);
if (CollUtil.isNotEmpty(workoutList)) {
if (CollUtil.isNotEmpty(workoutList)){
// 获取该用户当日消耗数据
WatchStatUserInfoDayWorkout dayWorkout = workoutList.stream().filter(item -> item.getDataDate().equals(cn.hutool.core.date.DateUtil.parse(date, "yyyy-MM-dd"))).findFirst().orElse(null);
if (dayWorkout != null) {
@@ -2280,20 +2283,20 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
healthFamilyVO.setIsSelf(familyMembersVO.getIsSelf());
}
// 获取心率周
int rateWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getRateTime()) - 1;
healthFamilyVO.setRateWeek(rateWeek == 0 ? 7 : rateWeek);
int rateWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getRateTime())-1;
healthFamilyVO.setRateWeek(rateWeek==0?7:rateWeek);
// 获取血氧周
int oxygenWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getBloodOxygenTime()) - 1;
healthFamilyVO.setBloodOxygenWeek(oxygenWeek == 0 ? 7 : oxygenWeek);
int oxygenWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getBloodOxygenTime())-1;
healthFamilyVO.setBloodOxygenWeek(oxygenWeek==0?7:oxygenWeek);
// 获取压力周
int pressureWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getPressureTime()) - 1;
healthFamilyVO.setPressureWeek(pressureWeek == 0 ? 7 : pressureWeek);
int pressureWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getPressureTime())-1;
healthFamilyVO.setPressureWeek(pressureWeek==0?7:pressureWeek);
// 获取体温周
int temperatureWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getTempTime()) - 1;
healthFamilyVO.setTempWeek(temperatureWeek == 0 ? 7 : temperatureWeek);
int temperatureWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getTempTime())-1;
healthFamilyVO.setTempWeek(temperatureWeek==0?7:temperatureWeek);
// 获取睡眠周
int sleepWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getSleepTime()) - 1;
healthFamilyVO.setSleepWeek(sleepWeek == 0 ? 7 : sleepWeek);
int sleepWeek = cn.hutool.core.date.DateUtil.dayOfWeek(healthFamilyVO.getSleepTime())-1;
healthFamilyVO.setSleepWeek(sleepWeek==0?7:sleepWeek);
}
return list;
}
@@ -2303,7 +2306,7 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
healthFamilyVO.setUserId(userId);
// 判断是否绑定手表
WatchDevice watchDevice = watchDeviceMapper.selectOne(new LambdaQueryWrapper<WatchDevice>()
.eq(WatchDevice::getBindUserId, userId), false);
.eq(WatchDevice::getBindUserId, userId),false);
if (ObjUtil.isEmpty(watchDevice)) {
return healthFamilyVO;
}
@@ -2317,7 +2320,7 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
Map<String, DictModel> exerciseType = watchExerciseType.stream().collect(Collectors.toMap(DictModel::getValue, Function.identity()));
for (HealthFamilyVO familyVO : list) {
DictModel dictModel = exerciseType.get(familyVO.getWorkoutType());
if (ObjUtil.isNotEmpty(dictModel)) {
if (ObjUtil.isNotEmpty(dictModel)){
familyVO.setDurationName(dictModel.getText());
}
}
@@ -2330,11 +2333,11 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
}
@Override
public void deleteKeyUser(String userId, String errorType) {
public void deleteKeyUser(String userId,String errorType) {
LambdaUpdateWrapper<WatchKeyUser> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(WatchKeyUser::getUserId, userId);
wrapper.eq(ObjUtil.isNotEmpty(errorType), WatchKeyUser::getErrorType, errorType);
wrapper.set(WatchKeyUser::getDelFlag, 1);
wrapper.eq(ObjUtil.isNotEmpty(errorType),WatchKeyUser::getErrorType, errorType);
wrapper.set(WatchKeyUser::getDelFlag,1);
keyUserMapper.update(wrapper);
}