|
|
@@ -1,24 +1,5 @@
|
|
|
package com.lc.ibps.org.provider;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-
|
|
|
-import com.lc.ibps.cloud.entity.*;
|
|
|
-import com.lc.ibps.org.party.persistence.entity.*;
|
|
|
-import com.lc.ibps.platform.service.PartyRoleProviderService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-
|
|
|
import com.lc.ibps.api.base.constants.StateEnum;
|
|
|
import com.lc.ibps.api.base.model.PartyEntity;
|
|
|
import com.lc.ibps.api.base.query.QueryFilter;
|
|
|
@@ -34,6 +15,7 @@ import com.lc.ibps.base.core.util.string.StringUtil;
|
|
|
import com.lc.ibps.base.framework.request.signature.annotation.Signature;
|
|
|
import com.lc.ibps.base.framework.utils.PageUtil;
|
|
|
import com.lc.ibps.base.web.context.ContextUtil;
|
|
|
+import com.lc.ibps.cloud.entity.*;
|
|
|
import com.lc.ibps.cloud.provider.GenericProvider;
|
|
|
import com.lc.ibps.cloud.utils.RequestUtil;
|
|
|
import com.lc.ibps.org.api.IPartyRoleMgrService;
|
|
|
@@ -44,17 +26,22 @@ import com.lc.ibps.org.auth.repository.RoleSystemRepository;
|
|
|
import com.lc.ibps.org.auth.repository.SubSystemRepository;
|
|
|
import com.lc.ibps.org.party.builder.PartyRoleBaseBuilder;
|
|
|
import com.lc.ibps.org.party.domain.PartyRole;
|
|
|
+import com.lc.ibps.org.party.persistence.entity.*;
|
|
|
import com.lc.ibps.org.party.repository.DefaultPartyRoleRepository;
|
|
|
import com.lc.ibps.org.party.repository.PartyEntityRepository;
|
|
|
import com.lc.ibps.org.party.repository.PartyRoleRepository;
|
|
|
import com.lc.ibps.org.util.PartyUtil;
|
|
|
import com.lc.ibps.org.vo.IdKeyVo;
|
|
|
+import com.lc.ibps.platform.service.PartyRoleProviderService;
|
|
|
+import io.swagger.annotations.*;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
-import io.swagger.annotations.Extension;
|
|
|
-import io.swagger.annotations.ExtensionProperty;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 角色管理
|
|
|
@@ -870,11 +857,13 @@ public class PartyRoleProvider extends GenericProvider implements IPartyRoleServ
|
|
|
case 0:// 没有传type参数默认查询所有
|
|
|
case 1:// 查询所有角色数据
|
|
|
roleList = partyRoleRepository.queryWithSys();
|
|
|
+ roleList = filterRole(roleList);
|
|
|
break;
|
|
|
|
|
|
case 2:// 查询所在角色数据
|
|
|
String userId = ContextUtil.getCurrentUserId();
|
|
|
roleList = partyRoleRepository.findUserRolesByUserId(userId);
|
|
|
+ roleList = filterRole(roleList);
|
|
|
deleteNullSystem(subSystemList, roleList);
|
|
|
break;
|
|
|
|
|
|
@@ -882,6 +871,7 @@ public class PartyRoleProvider extends GenericProvider implements IPartyRoleServ
|
|
|
String partyId = request.getParameter("partyId");
|
|
|
List<String> partyIdList = Arrays.asList(partyId.split(StringPool.COMMA));
|
|
|
roleList = partyRoleRepository.findByIds(partyIdList);
|
|
|
+ roleList = filterRole(roleList);
|
|
|
deleteNullSystem(subSystemList, roleList);
|
|
|
break;
|
|
|
|
|
|
@@ -897,5 +887,22 @@ public class PartyRoleProvider extends GenericProvider implements IPartyRoleServ
|
|
|
if(BeanUtils.isNotEmpty(_rs)) rst.addAll(_rs);
|
|
|
return rst;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 过滤废弃的角色
|
|
|
+ * @param roleList
|
|
|
+ * @return List<PartyRolePo>
|
|
|
+ */
|
|
|
+ private List<PartyRolePo> filterRole(List<PartyRolePo> roleList) {
|
|
|
+ if (roleList == null || roleList.isEmpty()) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ return roleList.stream()
|
|
|
+ .filter(Objects::nonNull) // 过滤掉列表中的 null 元素
|
|
|
+ .filter(partyRolePo -> partyRolePo.getName() != null) // 防止 name 为 null
|
|
|
+ .filter(partyRolePo -> !partyRolePo.getName().contains("弃用"))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|