|
|
@@ -19,6 +19,7 @@ import com.inspur.customer.object.org.*;
|
|
|
import com.inspur.device.client.core.manage.SmsbDeviceService;
|
|
|
import com.inspur.device.client.core.manage.SmsbUsersDeviceAttentionService;
|
|
|
import com.inspur.device.client.core.relation.DeviceAllocateService;
|
|
|
+import com.inspur.service.MinioDataProviderService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
@@ -55,6 +56,9 @@ public class SmsbDepartmentServiceImpl extends ServiceImpl<SmsbDepartmentMapper
|
|
|
@DubboReference
|
|
|
private SmsbDeviceService deviceService;
|
|
|
|
|
|
+ @DubboReference
|
|
|
+ private MinioDataProviderService minioDataProviderService;
|
|
|
+
|
|
|
@Override
|
|
|
public Response addDepartment(String userId , SmsbDepartmentAdd smsbDepartmentAdd) {
|
|
|
List<SmsbDepartmentDO> departments = this.list(new LambdaQueryWrapper<>(SmsbDepartmentDO.class)
|
|
|
@@ -80,6 +84,8 @@ public class SmsbDepartmentServiceImpl extends ServiceImpl<SmsbDepartmentMapper
|
|
|
deviceAllocateService.deleteRelatedOrg(department.getPath());
|
|
|
// 3、删除部门
|
|
|
removeDepartment(userId , Collections.singletonList(id));
|
|
|
+ // 删除媒资分享
|
|
|
+ minioDataProviderService.removeSharingByOrg(department.getPath());
|
|
|
}
|
|
|
|
|
|
private void removeDepartment(String userId, List<Long> ids){
|
|
|
@@ -356,15 +362,16 @@ public class SmsbDepartmentServiceImpl extends ServiceImpl<SmsbDepartmentMapper
|
|
|
// 1. 获取对应部门树
|
|
|
SmsbDepartmentCO department = this.queryDepartment(departmentCmd.getTenant() , departmentCmd.getOrg());
|
|
|
DeviceDepartmentSimpleDto deviceDepartmentSimpleDto = new DeviceDepartmentSimpleDto();
|
|
|
+ Integer orderFlag = departmentCmd.getOrderFlag();
|
|
|
// 2. 获取部门-List<设备id> map
|
|
|
if(StringUtils.isEmpty(departmentCmd.getOrg()) && department.getId() == null){
|
|
|
// 根节点为租户,该租户下未被分配的设备
|
|
|
- deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceUnboundSimple(departmentCmd.getTenant() , departmentCmd.getActivate()));
|
|
|
+ deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceUnboundSimple(departmentCmd.getTenant() , departmentCmd.getActivate(),orderFlag));
|
|
|
}else {
|
|
|
// 根节点为部门
|
|
|
- deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceBindSimple(department.getPath() , departmentCmd.getActivate()));
|
|
|
+ deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceBindSimple(department.getPath() , departmentCmd.getActivate(),orderFlag ));
|
|
|
}
|
|
|
- deviceDepartmentSimpleDto.setChildren(childRecurrenceHandleSimple(department.getChildren() , departmentCmd.getActivate()));
|
|
|
+ deviceDepartmentSimpleDto.setChildren(childRecurrenceHandleSimple(department.getChildren() , departmentCmd.getActivate(), orderFlag));
|
|
|
// 3. 组装设备信息并返回
|
|
|
deviceDepartmentSimpleDto.setTenant(department.getTenant());
|
|
|
return deviceDepartmentSimpleDto;
|
|
|
@@ -376,14 +383,14 @@ public class SmsbDepartmentServiceImpl extends ServiceImpl<SmsbDepartmentMapper
|
|
|
* @param activate
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<DeviceDepartmentSimpleDto> childRecurrenceHandleSimple(List<SmsbDepartmentCO> children , Boolean activate){
|
|
|
+ private List<DeviceDepartmentSimpleDto> childRecurrenceHandleSimple(List<SmsbDepartmentCO> children , Boolean activate, Integer orderFlag){
|
|
|
List<DeviceDepartmentSimpleDto> childrenList = Lists.newArrayList();
|
|
|
if(!CollectionUtils.isEmpty(children)){
|
|
|
children.forEach(child->{
|
|
|
DeviceDepartmentSimpleDto deviceDepartmentSimpleDto = new DeviceDepartmentSimpleDto();
|
|
|
BeanUtils.copyProperties(child , deviceDepartmentSimpleDto);
|
|
|
- deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceBind(child.getPath() , activate));
|
|
|
- deviceDepartmentSimpleDto.setChildren(childRecurrenceHandleSimple(child.getChildren() , activate));
|
|
|
+ deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceBindSimple(child.getPath() , activate,orderFlag));
|
|
|
+ deviceDepartmentSimpleDto.setChildren(childRecurrenceHandleSimple(child.getChildren() , activate,orderFlag));
|
|
|
childrenList.add(deviceDepartmentSimpleDto);
|
|
|
});
|
|
|
}
|