Commit 9852247d by huangjy

fix:修复bug

parent 5248fa5c
......@@ -466,13 +466,23 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
}
@Override
@Transactional(rollbackFor = Exception.class)
public void batchEditProperties(PlatDeviceAttrDTO dto) {
if (CollectionUtils.isEmpty(dto.getDeviceIdList())) {
return;
}
Map<String, Object> map = getAttrMap(dto);
List<String> resultList = Lists.newArrayList();
for (String deviceId : dto.getDeviceIdList()) {
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, deviceId)
.last("limit 1"));
if (other != null) {
other.setAttribute(JSON.toJSONString(map));
platDeviceOtherService.updateById(other);
}
String result = devicePropertiesOperateService.deviceWriteAttr(deviceId, map);
if (StringUtils.isNotEmpty(result)) {
resultList.add(result);
......
......@@ -851,12 +851,38 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
}
List<PlatElderHealthInfo> healthInfoList = platElderHealthInfoService.list(new QueryWrapper<PlatElderHealthInfo>().lambda()
.in(PlatElderHealthInfo::getElderId, dto.getIdList()));
if (CollectionUtils.isNotEmpty(healthInfoList)) {
for (PlatElderHealthInfo elderHealthInfo : healthInfoList) {
BeanUtils.copyProperties(dto, elderHealthInfo);
buildHealthInfo(dto, elderHealthInfo);
platElderHealthInfoService.saveOrUpdate(elderHealthInfo);
}
} else {
for (String s : dto.getIdList()) {
PlatElderHealthInfo elderHealthInfo = new PlatElderHealthInfo();
buildHealthInfo(dto, elderHealthInfo);
elderHealthInfo.setElderId(s);
platElderHealthInfoService.saveOrUpdate(elderHealthInfo);
}
}
}
private static void buildHealthInfo(PlatElderBatchEditDTOVO dto, PlatElderHealthInfo elderHealthInfo) {
if (StringUtils.isNotEmpty(dto.getHeartRate())) {
elderHealthInfo.setHeartRate(dto.getHeartRate());
}
if (StringUtils.isNotEmpty(dto.getHeartExceptionTime())) {
elderHealthInfo.setHeartExceptionTime(dto.getHeartExceptionTime());
}
if (StringUtils.isNotEmpty(dto.getRespiratoryRate())) {
elderHealthInfo.setRespiratoryRate(dto.getRespiratoryRate());
}
if (StringUtils.isNotEmpty(dto.getRespiratoryExceptionTime())) {
elderHealthInfo.setRespiratoryExceptionTime(dto.getRespiratoryExceptionTime());
}
}
//@TenantIdIgnore
@Override
public PlatElderDTOVO view(String id) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment