Commit 0b8b1652 by huangjy

fixbug:设备绑定问题

parent f0f061f7
...@@ -225,9 +225,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -225,9 +225,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
String id = null; String id = null;
if (db != null) { id = db.getId();
id = db.getId();
}
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda() PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, dto.getOriDeviceId())); .eq(PlatDeviceOther::getOriDeviceId, dto.getOriDeviceId()));
...@@ -241,7 +239,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -241,7 +239,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
BeanUtils.copyProperties(dto, db); BeanUtils.copyProperties(dto, db);
db.setId(id); db.setId(id);
db.setTenantId(tenantId); db.setTenantId(tenantId);
db.setOrgId(dto.getOrgId());
saveOrUpdate(db); saveOrUpdate(db);
id = db.getId(); id = db.getId();
......
...@@ -28,6 +28,7 @@ import com.makeit.utils.data.convert.PageUtil; ...@@ -28,6 +28,7 @@ import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.old.StringUtils; import com.makeit.utils.old.StringUtils;
import jodd.util.StringUtil; import jodd.util.StringUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -77,9 +78,19 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM ...@@ -77,9 +78,19 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
// 绑定床位不重复插入数据,直接绑定 // 绑定床位不重复插入数据,直接绑定
if (StringUtils.isNotEmpty(dto.getBedId())) { if (StringUtils.isNotEmpty(dto.getBedId())) {
List<PlatRoomBedDevice> platRoomBedDeviceList = list(new QueryWrapper<PlatRoomBedDevice>().lambda().in(PlatRoomBedDevice::getDeviceId, listEquipmentIds)); List<PlatRoomBedDevice> platRoomBedDeviceList = list(new QueryWrapper<PlatRoomBedDevice>().lambda().in(PlatRoomBedDevice::getDeviceId, listEquipmentIds));
for (PlatRoomBedDevice platRoomBedDevice : platRoomBedDeviceList) { if (CollectionUtils.isNotEmpty(platRoomBedDeviceList)) {
platRoomBedDevice.setBedId(dto.getBedId()); for (PlatRoomBedDevice platRoomBedDevice : platRoomBedDeviceList) {
updateById(platRoomBedDevice); platRoomBedDevice.setBedId(dto.getBedId());
updateById(platRoomBedDevice);
}
} else {
for (String listEquipmentId : listEquipmentIds) {
PlatRoomBedDevice data = new PlatRoomBedDevice();
data.setDeviceId(listEquipmentId);
data.setRoomId(dto.getRoomId());
data.setBedId(dto.getBedId());
save(data);
}
} }
return; return;
} }
......
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