Browse Source

debug 运维项目

tags/24080901
PoffyZhang 1 year ago
parent
commit
8cb4fb04c4
2 changed files with 21 additions and 2 deletions
  1. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java
  2. +19
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java View File

@@ -414,11 +414,11 @@ public class EarlyWarningInstanceNotStartTask {
for(ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects){
Project project = projectService.getProjectByCode(needToWaringProject.getProjectCode());
//去预警通知 发给区管
List<UserInfo> users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name());
List<UserInfo> users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name(),needToWaringProject.getRegionCode());
for(UserInfo user : users){
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,null,
needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project,
WarningRuleTypeEnum.OPERATION_WARNING.getCode());
WarningRuleTypeEnum.RENEWAL_FUND.getCode());
}
}
});


+ 19
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java View File

@@ -106,4 +106,23 @@ public class RoleManage {
.collect(Collectors.toList());
return userInfoService.listByIds(userIds);
}

public List<UserInfo> getUsersByRoleType(String roleType,String regionCode) {
Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class)
.eq(Role::getCode, roleType)
.last(BizConst.LIMIT_1));
if(Objects.isNull(regionRole)){
return Collections.emptyList();
}
List<UserRole> userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class)
.eq(UserRole::getRoleId, regionRole.getId()));
if(CollUtil.isEmpty(userRoles)){
return Collections.emptyList();
}
List<Long> userIds = userRoles.stream().map(UserRole::getUserId)
.collect(Collectors.toList());
return userInfoService.list(Wrappers.lambdaQuery(UserInfo.class)
.in(UserInfo::getId,userIds)
.eq(UserInfo::getRegionCode,regionCode));
}
}

Loading…
Cancel
Save