Browse Source

[feat]

1、修改设备组管理相关问题④
wuyuan
杨威 1 month ago
parent
commit
82903e136a
  1. 15
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceProServiceImpl.java

15
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceProServiceImpl.java

@ -58,6 +58,7 @@ import org.dromara.sample.manage.model.param.DeviceQueryParam;
import org.dromara.sample.manage.model.receiver.BasicDeviceProperty; import org.dromara.sample.manage.model.receiver.BasicDeviceProperty;
import org.dromara.sample.manage.service.*; import org.dromara.sample.manage.service.*;
import org.dromara.sample.websocket.service.IWebSocketMessageService; import org.dromara.sample.websocket.service.IWebSocketMessageService;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import org.dromara.system.api.model.LoginUser; import org.dromara.system.api.model.LoginUser;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -129,8 +130,18 @@ public class DeviceProServiceImpl implements IDeviceProService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean updateDeviceProUser(List<DeviceProUserEntity> userEntity,Integer proId) { public Boolean updateDeviceProUser(List<DeviceProUserEntity> userEntity,Integer proId) {
try { try {
//添加新的项目组成员 List<DeviceProUserEntity> proUserEntityList = deviceProUserMapper.selectList(new LambdaQueryWrapper<DeviceProUserEntity>().eq(DeviceProUserEntity::getDeviceProId, proId));
deviceProUserMapper.insert(userEntity);
List<DeviceProUserEntity> different = userEntity.stream()
.filter(user -> proUserEntityList.stream().noneMatch(u -> u.getUserId().equals(user.getUserId())))
.toList();
if (ObjectUtil.isNotEmpty(different)){
//添加新的项目组成员
deviceProUserMapper.insert(different);
}
return true; return true;
} catch (ServiceException e) { } catch (ServiceException e) {
log.error(e.getMessage(),e); log.error(e.getMessage(),e);

Loading…
Cancel
Save