|
|
@ -3,6 +3,7 @@ package org.dromara.business.service.impl; |
|
|
|
import cn.hutool.core.collection.ListUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.dubbo.config.annotation.DubboReference; |
|
|
|
import org.dromara.business.domain.BusinessAlert; |
|
|
|
import org.dromara.business.domain.bo.BusinessAlertBo; |
|
|
@ -45,6 +46,7 @@ import static org.dromara.common.core.constant.Constants.FLY_COUNT; |
|
|
|
* |
|
|
|
*预警统计Service业务层处理 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@RequiredArgsConstructor |
|
|
|
@Service |
|
|
|
public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatisticsService { |
|
|
@ -776,32 +778,37 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
} |
|
|
|
|
|
|
|
private void createPermissions(BusinessAlertBo businessAlertBo) { |
|
|
|
RoleDTO roleDTO = LoginHelper.getLoginUser().getRoles().getFirst(); |
|
|
|
try { |
|
|
|
RoleDTO roleDTO = LoginHelper.getLoginUser().getRoles().getFirst(); |
|
|
|
|
|
|
|
//自定义权限
|
|
|
|
if (roleDTO.getDataScope().equalsIgnoreCase(DataScopeType.CUSTOM.getCode())){ |
|
|
|
String roleCustom = remoteDataScopeService.getRoleCustom(roleDTO.getRoleId()); |
|
|
|
if (roleCustom.equalsIgnoreCase("-1")){ |
|
|
|
businessAlertBo.setDeptIdList(ListUtil.empty()); |
|
|
|
}else { |
|
|
|
businessAlertBo.setDeptIdList(Arrays.stream(roleCustom.split(",")) |
|
|
|
.map(Long::parseLong) |
|
|
|
.collect(Collectors.toList())); |
|
|
|
} |
|
|
|
} else if (roleDTO.getDataScope().equalsIgnoreCase(DataScopeType.DEPT_AND_CHILD.getCode())) { |
|
|
|
//部门及其以下
|
|
|
|
String deptAndChild = remoteDataScopeService.getDeptAndChild(LoginHelper.getDeptId()); |
|
|
|
if (deptAndChild.equalsIgnoreCase("-1")){ |
|
|
|
businessAlertBo.setDeptIdList(ListUtil.empty()); |
|
|
|
}else { |
|
|
|
businessAlertBo.setDeptIdList(Arrays.stream(deptAndChild.split(",")) |
|
|
|
.map(Long::parseLong) |
|
|
|
.collect(Collectors.toList())); |
|
|
|
} |
|
|
|
|
|
|
|
//自定义权限
|
|
|
|
if (roleDTO.getDataScope().equalsIgnoreCase(DataScopeType.CUSTOM.getCode())){ |
|
|
|
String roleCustom = remoteDataScopeService.getRoleCustom(roleDTO.getRoleId()); |
|
|
|
if (roleCustom.equalsIgnoreCase("-1")){ |
|
|
|
businessAlertBo.setDeptIdList(ListUtil.empty()); |
|
|
|
}else { |
|
|
|
businessAlertBo.setDeptIdList(Arrays.stream(roleCustom.split(",")) |
|
|
|
.map(Long::parseLong) |
|
|
|
.collect(Collectors.toList())); |
|
|
|
} |
|
|
|
} else if (roleDTO.getDataScope().equalsIgnoreCase(DataScopeType.DEPT_AND_CHILD.getCode())) { |
|
|
|
//部门及其以下
|
|
|
|
String deptAndChild = remoteDataScopeService.getDeptAndChild(LoginHelper.getDeptId()); |
|
|
|
if (deptAndChild.equalsIgnoreCase("-1")){ |
|
|
|
businessAlertBo.setDeptIdList(ListUtil.empty()); |
|
|
|
}else { |
|
|
|
businessAlertBo.setDeptIdList(Arrays.stream(deptAndChild.split(",")) |
|
|
|
.map(Long::parseLong) |
|
|
|
.collect(Collectors.toList())); |
|
|
|
} else if (roleDTO.getDataScope().equalsIgnoreCase(DataScopeType.DEPT.getCode())) { |
|
|
|
//本部门
|
|
|
|
businessAlertBo.setDeptIdList(List.of(LoginHelper.getDeptId())); |
|
|
|
} |
|
|
|
|
|
|
|
} else if (roleDTO.getDataScope().equalsIgnoreCase(DataScopeType.DEPT.getCode())) { |
|
|
|
//本部门
|
|
|
|
businessAlertBo.setDeptIdList(List.of(LoginHelper.getDeptId())); |
|
|
|
} catch (Exception e) { |
|
|
|
businessAlertBo.setDeptIdList(ListUtil.empty()); |
|
|
|
log.error(e.getMessage(),e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|