|
@ -44,15 +44,18 @@ import org.dromara.common.core.utils.MapstructUtils; |
|
|
import org.dromara.common.core.utils.StreamUtils; |
|
|
import org.dromara.common.core.utils.StreamUtils; |
|
|
import org.dromara.common.mybatis.core.page.PageQuery; |
|
|
import org.dromara.common.mybatis.core.page.PageQuery; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
|
|
|
import org.dromara.common.mybatis.enums.DataScopeType; |
|
|
import org.dromara.common.satoken.utils.LoginHelper; |
|
|
import org.dromara.common.satoken.utils.LoginHelper; |
|
|
import org.dromara.resource.api.RemoteMessageService; |
|
|
import org.dromara.resource.api.RemoteMessageService; |
|
|
import org.dromara.system.api.*; |
|
|
import org.dromara.system.api.*; |
|
|
import org.dromara.system.api.domain.bo.RemoteNoticeBo; |
|
|
import org.dromara.system.api.domain.bo.RemoteNoticeBo; |
|
|
import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo; |
|
|
import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo; |
|
|
import org.dromara.system.api.domain.vo.RemoteDeptVo; |
|
|
import org.dromara.system.api.domain.vo.RemoteDeptVo; |
|
|
|
|
|
import org.dromara.system.api.domain.vo.RemotePostVo; |
|
|
import org.dromara.system.api.domain.vo.RemoteUserVo; |
|
|
import org.dromara.system.api.domain.vo.RemoteUserVo; |
|
|
import org.dromara.business.domain.BusinessAlertConstructInfoOss; |
|
|
import org.dromara.business.domain.BusinessAlertConstructInfoOss; |
|
|
import org.dromara.business.mapper.BusinessAlertConstructInfoOssMapper; |
|
|
import org.dromara.business.mapper.BusinessAlertConstructInfoOssMapper; |
|
|
|
|
|
import org.dromara.system.api.model.RoleDTO; |
|
|
import org.dromara.workflow.api.RemoteWorkflowService; |
|
|
import org.dromara.workflow.api.RemoteWorkflowService; |
|
|
import org.dromara.workflow.api.domain.RemoteStartProcess; |
|
|
import org.dromara.workflow.api.domain.RemoteStartProcess; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
@ -131,6 +134,12 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
@DubboReference |
|
|
@DubboReference |
|
|
private RemoteDeptService remoteDeptService; |
|
|
private RemoteDeptService remoteDeptService; |
|
|
|
|
|
|
|
|
|
|
|
@DubboReference |
|
|
|
|
|
RemotePostService remotePostService; |
|
|
|
|
|
|
|
|
|
|
|
@DubboReference(timeout = 30000) |
|
|
|
|
|
RemoteDataScopeService remoteDataScopeService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 新增预警任务 |
|
|
* 新增预警任务 |
|
@ -724,8 +733,48 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void createPermissions(BusinessAlertBo businessAlertBo) { |
|
|
|
|
|
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())); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} 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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Map<String,Object> listAlert(BusinessAlertBo businessAlertBo) { |
|
|
public Map<String,Object> listAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
|
|
|
|
|
|
|
|
//构建查询数据权限 ()
|
|
|
|
|
|
createPermissions(businessAlertBo); |
|
|
|
|
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
//生成近一周开始时间、结束时间
|
|
|
//生成近一周开始时间、结束时间
|
|
|
List<String> dayList = getLastSixDays(); |
|
|
List<String> dayList = getLastSixDays(); |
|
|