|
@@ -1,13 +1,21 @@
|
|
|
package com.dragoninfo.dcuc.auth.auth.facade;
|
|
|
|
|
|
+import com.dragoninfo.dcuc.app.entity.ApplyInfo;
|
|
|
+import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
|
|
|
import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthInfo;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.RoleOperateContent;
|
|
|
import com.dragoninfo.dcuc.auth.auth.service.IRoleAuthInfoService;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.service.IRoleInfoService;
|
|
|
import com.dragoninfo.dcuc.auth.auth.service.zerotrust.IRoleAuthApplyService;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.service.zerotrust.IRoleOperateApplyService;
|
|
|
import com.dragoninfo.dcuc.auth.auth.vo.RoleInfoVO;
|
|
|
import com.dragoninfo.dcuc.auth.auth.vo.TreeInfoVO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.vo.zerotrust.roleauthapply.ApplyRoleInVo;
|
|
|
import com.dragoninfo.dcuc.auth.auth.vo.zerotrust.roleauthapply.RoleAuthApplySaveVo;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
|
|
|
import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
@@ -16,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
* @Description:
|
|
@@ -31,14 +40,24 @@ public class RoleAuthInfoFacade implements IRoleAuthInfoFacade {
|
|
|
@Autowired
|
|
|
private IRoleAuthInfoService roleAuthInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IRoleInfoService roleInfoService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IRoleAuthApplyService roleAuthApplyService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IRoleOperateApplyService roleOperateApplyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IApplyInfoFacade applyInfoFacade;
|
|
|
+
|
|
|
@Override
|
|
|
public List<StaffAssignAuthInfo> getStaff(String roleId, String orgId) {
|
|
|
return roleAuthInfoService.getStaff(roleId, orgId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public Page<RoleInfoVO> getOrgRoleQuotaList(String appId, String orgId, SearchDTO searchDTO) {
|
|
|
return roleAuthInfoService.getOrgRoleQuotaList(appId, orgId, Searchable.toSearchable(searchDTO));
|
|
|
}
|
|
@@ -59,7 +78,7 @@ public class RoleAuthInfoFacade implements IRoleAuthInfoFacade {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> getRoleTjInfo(String appId,String orgCode) {
|
|
|
+ public Map<String, Object> getRoleTjInfo(String appId, String orgCode) {
|
|
|
return roleAuthInfoService.getRoleTjInfo(appId, orgCode);
|
|
|
}
|
|
|
|
|
@@ -73,4 +92,50 @@ public class RoleAuthInfoFacade implements IRoleAuthInfoFacade {
|
|
|
public ResponseStatus roleAuthApply(RoleAuthApplySaveVo saveVo) {
|
|
|
return roleAuthApplyService.roleAuthApply(saveVo);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ApplyRoleInVo> applyRoleList(SearchDTO searchDTO) {
|
|
|
+
|
|
|
+ List<RoleOperateContent> applyRolesContent = roleOperateApplyService.getApplyingRoleInfos();
|
|
|
+ List<ApplyRoleInVo> applyRoles = applyRolesContent.stream()
|
|
|
+ .map(e -> {
|
|
|
+ ApplyRoleInVo vo = new ApplyRoleInVo();
|
|
|
+ vo.setAppId(e.getAppId());
|
|
|
+ vo.setRoleName(e.getName());
|
|
|
+ vo.setRoleCode(e.getCode());
|
|
|
+ vo.setApply(BooleanEnum.TRUE.value);
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ List<RoleInfo> all = roleInfoService.findAll();
|
|
|
+ List<ApplyRoleInVo> collect = all.stream()
|
|
|
+ .filter(e -> BooleanEnum.TRUE.value.equals(e.getIsActive()))
|
|
|
+ .map(e -> {
|
|
|
+ ApplyRoleInVo vo = new ApplyRoleInVo();
|
|
|
+ vo.setAppId(e.getAppId());
|
|
|
+ vo.setRoleName(e.getName());
|
|
|
+ vo.setRoleCode(e.getCode());
|
|
|
+ vo.setApply(BooleanEnum.FALSE.value);
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ applyRoles.addAll(collect);
|
|
|
+
|
|
|
+
|
|
|
+ List<String> appIds = applyRoles.stream()
|
|
|
+ .map(ApplyRoleInVo::getAppId)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ApplyInfo> applyInfos = applyInfoFacade.getAppById(appIds);
|
|
|
+ Map<String, String> appInfoMap = applyInfos.stream()
|
|
|
+ .collect(Collectors.toMap(ApplyInfo::getId, ApplyInfo::getApplyName));
|
|
|
+ applyRoles.forEach(e-> {
|
|
|
+ String appId = e.getAppId();
|
|
|
+ String appName = appInfoMap.get(appId);
|
|
|
+ e.setAppName(appName);
|
|
|
+ });
|
|
|
+
|
|
|
+ return applyRoles;
|
|
|
+ }
|
|
|
}
|