فهرست منبع

feature(红白名单功能转移到auth-service): 红白名单功能转移到auth-service

红白名单功能转移到auth-service
mazq 3 سال پیش
والد
کامیت
96f8ba5a50
27فایلهای تغییر یافته به همراه1989 افزوده شده و 41 حذف شده
  1. 83 0
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/list/facade/IRedListFacade.java
  2. 68 0
      dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/list/facade/IWhiteListFacade.java
  3. 30 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/AppFunRedListAddDTO.java
  4. 38 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/AppFunRedListDTO.java
  5. 60 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/FunRedListTreeDTO.java
  6. 35 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/RedListOperateDTO.java
  7. 35 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/WhiteListOperateDTO.java
  8. 53 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/WhiteListUserDTO.java
  9. 90 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/entity/RedList.java
  10. 68 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/entity/RedListContent.java
  11. 89 0
      dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/entity/WhiteList.java
  12. 1 38
      dcuc-auth-service/pom.xml
  13. 76 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/facade/RedListFacade.java
  14. 56 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/facade/WhiteListFacade.java
  15. 46 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/repo/RedListContentRepository.java
  16. 14 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/repo/RedListRepository.java
  17. 28 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/repo/WhiteListRepository.java
  18. 21 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/repo/bo/FunCountDO.java
  19. 87 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/IRedListService.java
  20. 58 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/IWhiteListService.java
  21. 590 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/impl/RedListServiceImpl.java
  22. 218 0
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/impl/WhiteListServiceImpl.java
  23. 3 3
      dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/business/impl/AuthUserBusinessImpl.java
  24. 3 0
      dcuc-auth-service/src/main/resources/config/mysql/V4_3_0023__User_Org_Sync.sql
  25. 47 0
      dcuc-auth-service/src/main/resources/config/mysql/V4_3_0024__White_Red_List.sql
  26. 3 0
      dcuc-auth-service/src/main/resources/config/sql/V4_3_0023__User_Org_Sync.sql
  27. 89 0
      dcuc-auth-service/src/main/resources/config/sql/V4_3_0024__White_Red_List.sql

+ 83 - 0
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/list/facade/IRedListFacade.java

@@ -0,0 +1,83 @@
+package com.dragoninfo.dcuc.auth.list.facade;
+
+import com.dragoninfo.dcuc.auth.list.dto.AppFunRedListAddDTO;
+import com.dragoninfo.dcuc.auth.list.dto.AppFunRedListDTO;
+import com.dragoninfo.dcuc.auth.list.dto.FunRedListTreeDTO;
+import com.dragoninfo.dcuc.auth.list.dto.RedListOperateDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 红名单api
+ * @author mazq
+ * @date 2021/7/12
+ */
+@FeignClient(name = "dcuc-list", path = "/dcuc/list/redListFacade")
+public interface IRedListFacade {
+
+    /**
+     * 功能红名单添加
+     * @param collect
+     * @return
+     */
+    @PostMapping(value = "funRedListAdd")
+    Boolean funRedListAdd(@RequestBody List<AppFunRedListAddDTO> collect);
+
+    /**
+     * 红名单等级批量修改
+     * @param dto
+     * @return
+     */
+    @PostMapping(value = "funRedListUpdateLevel")
+    Boolean funRedListUpdateLevel(@RequestBody RedListOperateDTO dto);
+
+    /**
+     * 红名单批量删除
+     * @param dto
+     * @return
+     */
+    @PostMapping(value = "funRedListDel")
+    Boolean funRedListBatchDel(@RequestBody RedListOperateDTO dto);
+
+    /**
+     * 应用功能红名单单条记录移除
+     * @param resourceType
+     * @param resourceId
+     * @param isTreeNode
+     * @return
+     */
+    @DeleteMapping(value = "funRedListDel")
+    Boolean funRedListDel(@RequestParam("resourceType") String resourceType,
+                          @RequestParam("resourceId") String resourceId,
+                          @RequestParam("isTreeNode") Boolean isTreeNode);
+
+    /**
+     * 应用功能列表分页查询
+     * 返回结构内容为树节点
+     * @param searchDTO
+     * @return
+     */
+    @PostMapping(value = "funRedListPage")
+    Page<FunRedListTreeDTO> funRedListPage(@RequestBody SearchDTO searchDTO);
+
+    /**
+     * 查询已被添加为红名单的功能id
+     * @param appId 应用id
+     * @return
+     */
+    @GetMapping("funIdsInRedList")
+    List<String> funIdsInRedList(@RequestParam(value = "appId", required = false) String appId);
+
+    /**
+     * api接口功能红名单查询
+     * @param searchDTO
+     * @return
+     */
+    @PostMapping("apiFunSearch")
+    ResponseDTO<List<AppFunRedListDTO>> apiFunRedListSearch(@RequestBody SearchDTO searchDTO);
+}

+ 68 - 0
dcuc-auth-api/src/main/java/com/dragoninfo/dcuc/auth/list/facade/IWhiteListFacade.java

@@ -0,0 +1,68 @@
+package com.dragoninfo.dcuc.auth.list.facade;
+
+import com.dragoninfo.dcuc.auth.list.dto.WhiteListOperateDTO;
+import com.dragoninfo.dcuc.auth.list.dto.WhiteListUserDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+/**
+ * 白名单api
+ * @author mazq
+ * @date 2021/7/9
+ */
+@FeignClient(name = "dcuc-list", path = "/dcuc/list/whiteListFacade")
+public interface IWhiteListFacade {
+
+    /**
+     * 白名单用户分页列表
+     * @param searchDTO
+     * @return
+     */
+    @PostMapping("whiteListUserPage")
+    Page<WhiteListUserDTO> whiteListUserPage(@RequestBody SearchDTO searchDTO);
+
+    /**
+     * 白名单批量添加
+     * @param dto
+     * @return
+     */
+    @PostMapping("whiteListAdd")
+    Boolean whiteListAdd(@RequestBody WhiteListOperateDTO dto);
+
+    /**
+     * 白名单批量删除
+     * @param dto
+     * @return
+     */
+    @PostMapping("whiteListDel")
+    Boolean whiteListDel(@RequestBody WhiteListOperateDTO dto);
+
+    /**
+     * 白名单批量修改等级
+     * @param dto
+     * @return
+     */
+    @PostMapping("whiteListUpdateLevel")
+    Boolean whiteListUpdateLevel(@RequestBody WhiteListOperateDTO dto);
+
+    /**
+     * 获取所有用户白名单用户id
+     * @return
+     */
+    @PostMapping("getAllUser")
+    List<String> getAllUser();
+
+    /**
+     * api接口用户白名单查询
+     * @param searchDTO
+     * @return
+     */
+    @PostMapping("apiUserWhiteListSearch")
+    ResponseDTO<List<WhiteListUserDTO>> apiUserWhiteListSearch(@RequestBody SearchDTO searchDTO);
+}

+ 30 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/AppFunRedListAddDTO.java

@@ -0,0 +1,30 @@
+package com.dragoninfo.dcuc.auth.list.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 应用功能红名单添加DTO
+ * @author mazq
+ * @date 2021/7/12
+ */
+@Data
+public class AppFunRedListAddDTO {
+
+    /**
+     * 红名单等级
+     */
+    private String level;
+
+    /**
+     * 应用id
+     */
+    private String appId;
+
+    /**
+     * 功能id集合
+     */
+    private List<String> funIds;
+
+}

+ 38 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/AppFunRedListDTO.java

@@ -0,0 +1,38 @@
+package com.dragoninfo.dcuc.auth.list.dto;
+
+import lombok.Data;
+
+/**
+ * 应用功能菜单红名单DTO
+ * @author mazq
+ * @date 2021/7/20
+ */
+@Data
+public class AppFunRedListDTO {
+
+    /**
+     * 应用code
+     */
+    private String appCode;
+
+    /**
+     * 应用名称
+     */
+    private String appName;
+
+    /**
+     * 菜单功能code
+     */
+    private String funCode;
+
+    /**
+     * 菜单功能名称
+     */
+    private String funName;
+
+    /**
+     * 红白名单等级
+     */
+    private String level;
+
+}

+ 60 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/FunRedListTreeDTO.java

@@ -0,0 +1,60 @@
+package com.dragoninfo.dcuc.auth.list.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 功能红名单列表树结构DTO
+ * @author mazq
+ * @date 2021/7/13
+ */
+@Data
+public class FunRedListTreeDTO {
+
+    /**
+     * 主键id
+     */
+    private String id;
+
+    /**
+     * 父节点id
+     */
+    private String pid;
+
+    /**
+     * 节点名称
+     */
+    private String label;
+
+    /**
+     * 资源code
+     */
+    private String code;
+
+    /**
+     * 是否是树节点
+     */
+    private Boolean isTreeNode;
+
+    /**
+     * 红名单记录id
+     */
+    private String listId;
+
+    /**
+     * 节点类型
+     */
+    private String type;
+
+    /**
+     * 红名单等级
+     */
+    private String level;
+
+    /**
+     * 子节点集合
+     */
+    private List<FunRedListTreeDTO> child;
+
+}

+ 35 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/RedListOperateDTO.java

@@ -0,0 +1,35 @@
+package com.dragoninfo.dcuc.auth.list.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 功能红名单操作dto
+ * @author mazq
+ * @date 2021/7/9
+ */
+@Data
+public class RedListOperateDTO {
+
+    /**
+     * 红名单等级
+     */
+    private String level;
+
+    /**
+     * 客体类型
+     */
+    private String objType;
+
+    /**
+     * 主体id集合
+     */
+    private List<String> objIds;
+
+    /**
+     * 红名单记录id集合
+     */
+    private List<String> listIds;
+
+}

+ 35 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/WhiteListOperateDTO.java

@@ -0,0 +1,35 @@
+package com.dragoninfo.dcuc.auth.list.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 用户白名单操作dto
+ * @author mazq
+ * @date 2021/7/9
+ */
+@Data
+public class WhiteListOperateDTO {
+
+    /**
+     * 白名单等级
+     */
+    private String level;
+
+    /**
+     * 主体类型
+     */
+    private String subType;
+
+    /**
+     * 主体id集合
+     */
+    private List<String> subIds;
+
+    /**
+     * 白名单记录id集合
+     */
+    private List<String> listIds;
+
+}

+ 53 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/dto/WhiteListUserDTO.java

@@ -0,0 +1,53 @@
+package com.dragoninfo.dcuc.auth.list.dto;
+
+import lombok.Data;
+
+/**
+ * 人员白名单DTO
+ * @author mazq
+ * @date 2021/7/9
+ */
+@Data
+public class WhiteListUserDTO {
+
+    /**
+     * 人员id
+     */
+    private String userId;
+
+    /**
+     * 人员姓名
+     */
+    private String userName;
+
+    /**
+     * 人员所属机构id
+     */
+    private String orgId;
+
+    /**
+     * 人员所属机构code
+     */
+    private String orgCode;
+
+    /**
+     * 人员所属机构名称
+     */
+    private String orgName;
+
+    /**
+     * 人员身份证号
+     */
+    private String idcard;
+
+    /**
+     * 白名单权限级别
+     */
+    private String listLevel;
+
+    /**
+     * 白名单记录id
+     */
+    private String listId;
+
+}

+ 90 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/entity/RedList.java

@@ -0,0 +1,90 @@
+package com.dragoninfo.dcuc.auth.list.entity;
+
+import com.dragonsoft.duceap.base.annotations.audit.DeletedBy;
+import com.dragonsoft.duceap.base.annotations.audit.DeletedDate;
+import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
+import com.dragonsoft.duceap.base.entity.persistent.LogicDeleteable;
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
+import com.dragonsoft.duceap.core.persistent.audit.JpaAuditingEntityListener;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.annotations.Where;
+import org.springframework.data.annotation.CreatedBy;
+import org.springframework.data.annotation.CreatedDate;
+import org.springframework.data.annotation.LastModifiedBy;
+import org.springframework.data.annotation.LastModifiedDate;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * 红名单实体类
+ * @author mazq
+ * @date 2021/7/12
+ */
+@EntityListeners({JpaAuditingEntityListener.class})
+@Data
+@Entity
+@Table(name = "T_LIST_RED_LIST")
+@Where(clause = "deleted = '0'")
+public class RedList implements LogicDeleteable, IdEntity<String> {
+
+    /** 主键 */
+    @Id
+    @GeneratedValue(generator="idGenerator")
+    @GenericGenerator(name="idGenerator", strategy="uuid")
+    @Column(name = "ID")
+    private String id ;
+
+
+    /** 客体类型 */
+    @Column(name = "OBJ_TYPE")
+    private String objType ;
+
+    /** 客体id */
+    @Column(name = "OBJ_ID")
+    private String objId ;
+
+    /** 名单级别 */
+    @Column(name = "LEVEL")
+    private String level ;
+
+    /** 是否删除 */
+    @Column(name = "DELETED")
+    private String deleted ;
+
+    /** 创建时间 */
+    @CreatedDate
+    @Column(name = "CREATE_TIME")
+    private Date createTime;
+
+    /** 更新时间 */
+    @LastModifiedDate
+    @Column(name = "UPDATE_TIME")
+    private Date updateTime;
+
+    /** 删除时间 */
+    @DeletedDate
+    @Column(name = "DELETE_TIME")
+    private Date deleteTime;
+
+    /** 创建人 */
+    @CreatedBy
+    @Column(name = "CREATE_USER")
+    private String createUser;
+
+    /** 更新人 */
+    @LastModifiedBy
+    @Column(name = "UPDATE_USER")
+    private String updateUser;
+
+    /** 删除人 */
+    @DeletedBy
+    @Column(name = "DELETE_USER")
+    private String deleteUser;
+
+    @Override
+    public void markDeleted() {
+        this.setDeleted(BooleanEnum.TRUE.value);
+    }
+}

+ 68 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/entity/RedListContent.java

@@ -0,0 +1,68 @@
+package com.dragoninfo.dcuc.auth.list.entity;
+
+import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
+import com.dragonsoft.duceap.base.entity.persistent.LogicDeleteable;
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
+import com.dragonsoft.duceap.core.persistent.audit.JpaAuditingEntityListener;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.annotations.Where;
+
+import javax.persistence.*;
+
+/**
+ * 红名单内容实体类
+ * @author mazq
+ * @date 2021/7/12
+ */
+@EntityListeners({JpaAuditingEntityListener.class})
+@Data
+@Entity
+@Table(name = "T_LIST_RED_LIST_CONTENT")
+@Where(clause = "deleted = '0'")
+public class RedListContent implements LogicDeleteable, IdEntity<String> {
+
+    /** 主键 */
+    @Id
+    @GeneratedValue(generator="idGenerator")
+    @GenericGenerator(name="idGenerator", strategy="uuid")
+    @Column(name = "ID")
+    private String id;
+
+    /** 红名单记录表 */
+    @Column(name = "RED_LIST_ID")
+    private String redListId;
+
+    /** 应用id */
+    @Column(name = "APP_ID")
+    private String appId;
+
+    /** 应用code */
+    @Column(name = "APP_CODE")
+    private String appCode;
+
+    /** 功能id */
+    @Column(name = "FUN_ID")
+    private String funId;
+
+    /** 功能code */
+    @Column(name = "FUN_CODE")
+    private String funCode;
+
+    /** 功能红名单等级 */
+    @Column(name = "LEVEL")
+    private String level;
+
+    /** 是否删除 */
+    @Column(name = "DELETED")
+    private String deleted;
+
+    /** 类型 */
+    @Column(name = "CONTENT_TYPE")
+    private String contentType;
+
+    @Override
+    public void markDeleted() {
+        this.setDeleted(BooleanEnum.TRUE.value);
+    }
+}

+ 89 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/list/entity/WhiteList.java

@@ -0,0 +1,89 @@
+package com.dragoninfo.dcuc.auth.list.entity;
+
+import com.dragonsoft.duceap.base.annotations.audit.DeletedBy;
+import com.dragonsoft.duceap.base.annotations.audit.DeletedDate;
+import com.dragonsoft.duceap.base.entity.persistent.IdEntity;
+import com.dragonsoft.duceap.base.entity.persistent.LogicDeleteable;
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
+import com.dragonsoft.duceap.core.persistent.audit.JpaAuditingEntityListener;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.annotations.Where;
+import org.springframework.data.annotation.CreatedBy;
+import org.springframework.data.annotation.CreatedDate;
+import org.springframework.data.annotation.LastModifiedBy;
+import org.springframework.data.annotation.LastModifiedDate;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * 白名单实体类
+ * @author mazq
+ * @date 2021/7/9
+ */
+@EntityListeners({JpaAuditingEntityListener.class})
+@Data
+@Entity
+@Table(name = "T_LIST_WHITE_LIST")
+@Where(clause = "deleted = '0'")
+public class WhiteList implements LogicDeleteable,IdEntity<String> {
+
+    /** 主键 */
+    @Id
+    @GeneratedValue(generator="idGenerator")
+    @GenericGenerator(name="idGenerator", strategy="uuid")
+    @Column(name = "ID")
+    private String id;
+
+    /** 主体类型 */
+    @Column(name = "SUB_TYPE")
+    private String subType;
+
+    /** 主体id */
+    @Column(name = "SUB_ID")
+    private String subId;
+
+    /** 名单级别 */
+    @Column(name = "LEVEL")
+    private String level;
+
+    /** 是否删除 */
+    @Column(name = "DELETED")
+    private String deleted;
+
+    /** 创建时间 */
+    @CreatedDate
+    @Column(name = "CREATE_TIME")
+    private Date createTime;
+
+    /** 更新时间 */
+    @LastModifiedDate
+    @Column(name = "UPDATE_TIME")
+    private Date updateTime;
+
+    /** 删除时间 */
+    @DeletedDate
+    @Column(name = "DELETE_TIME")
+    private Date deleteTime;
+
+    /** 创建人 */
+    @CreatedBy
+    @Column(name = "CREATE_USER")
+    private String createUser;
+
+    /** 更新人 */
+    @LastModifiedBy
+    @Column(name = "UPDATE_USER")
+    private String updateUser;
+
+    /** 删除人 */
+    @DeletedBy
+    @Column(name = "DELETE_USER")
+    private String deleteUser;
+
+    @Override
+    public void markDeleted() {
+        this.setDeleted(BooleanEnum.TRUE.value);
+    }
+}

+ 1 - 38
dcuc-auth-service/pom.xml

@@ -37,17 +37,7 @@
             <groupId>com.dragonsoft</groupId>
             <artifactId>duceap-boot-starter</artifactId>
         </dependency>
-        <!--审计-->
-        <!--<dependency>
-            <groupId>com.dragonsoft</groupId>
-            <artifactId>duceap-boot-starter-auditlog</artifactId>
-            <exclusions>
-                <exclusion>
-                    <artifactId>duceap-core-repository-jpa</artifactId>
-                    <groupId>com.dragonsoft</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>-->
+
         <!--配置 duceap 结束-->
         <!--配置 dcuc 开始-->
         <dependency>
@@ -62,18 +52,6 @@
             <version>2.2.4-tjdsj-SNAPSHOT</version>
         </dependency>
 
-        <!--<dependency>
-            <groupId>com.dragoninfo</groupId>
-            <artifactId>dcuc-org-api</artifactId>
-            <version>2.0.3-tjdsj-SNAPSHOT</version>
-        </dependency>-->
-
-<!--        <dependency>-->
-<!--            <groupId>com.dragoninfo</groupId>-->
-<!--            <artifactId>dcuc-user-api</artifactId>-->
-<!--            <version>2.0.4-tjdsj-SNAPSHOT</version>-->
-<!--        </dependency>-->
-
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-common</artifactId>
@@ -85,12 +63,6 @@
             <artifactId>dcuc-duceap-api</artifactId>
             <version>2.1.2-SNAPSHOT</version>
         </dependency>
-
-        <dependency>
-            <groupId>com.dragoninfo</groupId>
-            <artifactId>dcuc-list-api</artifactId>
-            <version>2.0.0-tjdsj-SNAPSHOT</version>
-        </dependency>
         <!--配置 dcuc 结束-->
 
         <!--redis-->
@@ -169,7 +141,6 @@
             <artifactId>spring-retry</artifactId>
         </dependency>
 
-
         <!--对接审计-->
         <dependency>
             <groupId>com.dragonsoft</groupId>
@@ -183,14 +154,6 @@
             </exclusions>
         </dependency>
 
-
-        <!--        <dependency>-->
-<!--            <groupId>com.dragonsoft</groupId>-->
-<!--            <artifactId>auditlog-qm-tj</artifactId>-->
-<!--            <version>1.0.0-SNAPSHOT</version>-->
-<!--        </dependency>-->
-
-
         <!--配置第三方组件结束-->
     </dependencies>
     <packaging>${project.packaging}</packaging>

+ 76 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/facade/RedListFacade.java

@@ -0,0 +1,76 @@
+package com.dragoninfo.dcuc.auth.list.facade;
+
+import com.dragoninfo.dcuc.auth.list.dto.AppFunRedListAddDTO;
+import com.dragoninfo.dcuc.auth.list.dto.AppFunRedListDTO;
+import com.dragoninfo.dcuc.auth.list.dto.FunRedListTreeDTO;
+import com.dragoninfo.dcuc.auth.list.dto.RedListOperateDTO;
+import com.dragoninfo.dcuc.auth.list.service.IRedListService;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+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 com.dragonsoft.duceap.core.search.enums.SearchOperator;
+import com.dragonsoft.duceap.core.search.filter.Condition;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/7/12
+ */
+@RestController
+@RequestMapping(value = "/dcuc/list/redListFacade")
+public class RedListFacade implements IRedListFacade {
+
+    @Autowired
+    IRedListService redListService;
+
+
+    @Override
+    public Boolean funRedListAdd(List<AppFunRedListAddDTO> dtos) {
+        return redListService.funRedListAdd(dtos);
+    }
+
+    @Override
+    public Boolean funRedListUpdateLevel(RedListOperateDTO dto) {
+        return redListService.funRedListUpdateLevel(dto);
+    }
+
+    @Override
+    public Boolean funRedListBatchDel(RedListOperateDTO dto) {
+        return redListService.funRedListBatchDel(dto);
+    }
+
+    @Override
+    public Boolean funRedListDel(String resourceType, String resourceId, Boolean isTreeNode) {
+        return redListService.funRedListDel(resourceType, resourceId, isTreeNode);
+    }
+
+    @Override
+    public Page<FunRedListTreeDTO> funRedListPage(SearchDTO searchDTO) {
+        return redListService.funRedListPage(searchDTO);
+    }
+
+    @Override
+    public List<String> funIdsInRedList(String appId) {
+        return redListService.funIdsInRedList(appId);
+    }
+
+    @Override
+    public ResponseDTO<List<AppFunRedListDTO>> apiFunRedListSearch(SearchDTO searchDTO) {
+        Searchable searchable = Searchable.toSearchable(searchDTO);
+        Condition appCodeEq = searchable.getSearchFilter("appCode", SearchOperator.eq);
+        Condition appCodeIn = searchable.getSearchFilter("appCode", SearchOperator.in);
+        if(null == appCodeEq && null == appCodeIn) {
+            return ResponseDTO.fail(ResponseStatus.FAIL_CODE,"appCode condition is null", null);
+        }
+        searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.value);
+        List<AppFunRedListDTO> funRedListDTOS = redListService.funRedListContentSearch(searchable);
+        return ResponseDTO.success("success", funRedListDTOS);
+    }
+}

+ 56 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/facade/WhiteListFacade.java

@@ -0,0 +1,56 @@
+package com.dragoninfo.dcuc.auth.list.facade;
+
+import com.dragoninfo.dcuc.auth.list.dto.WhiteListOperateDTO;
+import com.dragoninfo.dcuc.auth.list.dto.WhiteListUserDTO;
+import com.dragoninfo.dcuc.auth.list.service.IWhiteListService;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/7/9
+ */
+@RestController
+@RequestMapping(value = "/dcuc/list/whiteListFacade")
+public class WhiteListFacade implements IWhiteListFacade {
+
+    @Autowired
+    private IWhiteListService whiteListService;
+
+
+    @Override
+    public Page<WhiteListUserDTO> whiteListUserPage(SearchDTO searchDTO) {
+        return whiteListService.whiteListUserPage(searchDTO);
+    }
+
+    @Override
+    public Boolean whiteListAdd(WhiteListOperateDTO dto) {
+        return whiteListService.whiteListAdd(dto);
+    }
+
+    @Override
+    public Boolean whiteListDel(WhiteListOperateDTO dto) {
+        return whiteListService.whiteListDel(dto);
+    }
+
+    @Override
+    public Boolean whiteListUpdateLevel(WhiteListOperateDTO dto) {
+        return whiteListService.whiteListUpdateLevel(dto);
+    }
+
+    @Override
+    public List<String> getAllUser() {
+        return whiteListService.getAllUser();
+    }
+
+    @Override
+    public ResponseDTO<List<WhiteListUserDTO>> apiUserWhiteListSearch(SearchDTO searchDTO) {
+        return whiteListService.userWhiteListSearch(searchDTO);
+    }
+}

+ 46 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/repo/RedListContentRepository.java

@@ -0,0 +1,46 @@
+package com.dragoninfo.dcuc.auth.list.repo;
+
+import com.dragoninfo.dcuc.auth.list.entity.RedListContent;
+import com.dragoninfo.dcuc.auth.list.repo.bo.FunCountDO;
+import com.dragonsoft.duceap.core.persistent.repository.BaseRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/7/12
+ */
+@Repository
+public interface RedListContentRepository extends BaseRepository<RedListContent,String> {
+
+    /**
+     * 批量修改等级
+     * @param level
+     * @param ids
+     * @return
+     */
+    @Modifying
+    @Query(value = "update RedListContent set level = :level where id in :ids and deleted = '0'")
+    int updateLevelByIds(@Param("level") String level, @Param("ids") List<String> ids);
+
+    /**
+     * 分组计算功能菜单数量
+     * 一定要有redListId范围
+     * @param redListId
+     * @return
+     */
+    @Query(value = "select new com.dragoninfo.dcuc.list.repo.redwhitelist.bo.FunCountDO(redListId, count(1) as contentCount) from RedListContent where redListId in :redListId and deleted = '0' group by redListId")
+    List<FunCountDO> getCountByListIds(@Param("redListId") List<String> redListId);
+
+    /**
+     * 根据redListId删除内容
+     * @param listId
+     */
+    @Modifying
+    @Query(value = "delete from RedListContent where redListId =:redListId and deleted = '0'")
+    void delByRedListId(@Param("redListId") String listId);
+}

+ 14 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/repo/RedListRepository.java

@@ -0,0 +1,14 @@
+package com.dragoninfo.dcuc.auth.list.repo;
+
+import com.dragoninfo.dcuc.auth.list.entity.RedList;
+import com.dragonsoft.duceap.core.persistent.repository.BaseRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author mazq
+ * @date 2021/7/12
+ */
+@Repository
+public interface RedListRepository extends BaseRepository<RedList,String> {
+
+}

+ 28 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/repo/WhiteListRepository.java

@@ -0,0 +1,28 @@
+package com.dragoninfo.dcuc.auth.list.repo;
+
+import com.dragoninfo.dcuc.auth.list.entity.WhiteList;
+import com.dragonsoft.duceap.core.persistent.repository.BaseRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/7/9
+ */
+@Repository
+public interface WhiteListRepository extends BaseRepository<WhiteList, String> {
+
+    /**
+     * 批量修改等级
+     * @param level
+     * @param ids
+     * @return
+     */
+    @Modifying
+    @Query(value = "update WhiteList set level = :level where id in :ids and deleted = '0'")
+    int updateLevelByIds(@Param("level") String level, @Param("ids") List<String> ids);
+}

+ 21 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/repo/bo/FunCountDO.java

@@ -0,0 +1,21 @@
+package com.dragoninfo.dcuc.auth.list.repo.bo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 功能菜单统计对象
+ * @author mazq
+ * @date 2021/7/12
+ */
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class FunCountDO {
+
+    private String listId;
+
+    private Long contentCount;
+
+}

+ 87 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/IRedListService.java

@@ -0,0 +1,87 @@
+package com.dragoninfo.dcuc.auth.list.service;
+
+
+import com.dragoninfo.dcuc.auth.list.dto.AppFunRedListAddDTO;
+import com.dragoninfo.dcuc.auth.list.dto.AppFunRedListDTO;
+import com.dragoninfo.dcuc.auth.list.dto.FunRedListTreeDTO;
+import com.dragoninfo.dcuc.auth.list.dto.RedListOperateDTO;
+import com.dragoninfo.dcuc.auth.list.entity.RedList;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import com.dragonsoft.duceap.core.search.Searchable;
+import org.springframework.data.domain.Page;
+
+import java.util.List;
+
+/**
+ * 红名单业务类
+ * @author mazq
+ * @date 2021/7/12
+ */
+public interface IRedListService {
+
+    /**
+     * 功能红名单添加
+     * @param dtos
+     * @return
+     */
+    Boolean funRedListAdd(List<AppFunRedListAddDTO> dtos);
+
+    /**
+     * 根据客体id批量获取红名单记录
+     * @param objIds
+     * @return
+     */
+    List<RedList> getRedListByObjIds(List<String> objIds);
+
+    /**
+     * 红名单等级批量修改
+     * @param dto
+     * @return
+     */
+    Boolean funRedListUpdateLevel(RedListOperateDTO dto);
+
+    /**
+     * 红名单批量删除
+     * @param dto
+     * @return
+     */
+    Boolean funRedListBatchDel(RedListOperateDTO dto);
+
+    /**
+     * 根据id批量删除
+     * @param appIds
+     * @return
+     */
+    Boolean delRedListByIds(List<String> appIds);
+
+    /**
+     * 应用功能红名单单条记录移除
+     * @param resourceType
+     * @param resourceId
+     * @param isTreeNode
+     * @return
+     */
+    Boolean funRedListDel(String resourceType, String resourceId, Boolean isTreeNode);
+
+    /**
+     * 应用功能列表分页查询
+     * 返回结构内容为树节点
+     * @param searchDTO
+     * @return
+     */
+    Page<FunRedListTreeDTO> funRedListPage(SearchDTO searchDTO);
+
+    /**
+     * 查询已被添加为红名单的功能id
+     * @param appId
+     * @return
+     */
+    List<String> funIdsInRedList(String appId);
+
+    /**
+     * 查询菜单功能红名单记录
+     * @param searchable
+     * @return
+     */
+    List<AppFunRedListDTO> funRedListContentSearch(Searchable searchable);
+}

+ 58 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/IWhiteListService.java

@@ -0,0 +1,58 @@
+package com.dragoninfo.dcuc.auth.list.service;
+
+import com.dragoninfo.dcuc.auth.list.dto.WhiteListOperateDTO;
+import com.dragoninfo.dcuc.auth.list.dto.WhiteListUserDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import org.springframework.data.domain.Page;
+
+import java.util.List;
+
+/**
+ * 白名单业务类
+ * @author mazq
+ * @date 2021/7/9
+ */
+public interface IWhiteListService {
+
+    /**
+     * 用户白名单分页列表
+     * @param searchDTO
+     * @return
+     */
+    Page<WhiteListUserDTO> whiteListUserPage(SearchDTO searchDTO);
+
+    /**
+     * 用户白名单添加
+     * @param dto
+     * @return
+     */
+    Boolean whiteListAdd(WhiteListOperateDTO dto);
+
+    /**
+     * 白名单批量删除
+     * @param dto
+     * @return
+     */
+    Boolean whiteListDel(WhiteListOperateDTO dto);
+
+    /**
+     * 白名单批量修改等级
+     * @param dto
+     * @return
+     */
+    Boolean whiteListUpdateLevel(WhiteListOperateDTO dto);
+
+    /**
+     * 获取所有用户白名单用户id
+     * @return
+     */
+    List<String> getAllUser();
+
+    /**
+     * 用户白名单查询
+     * @param searchDTO
+     * @return
+     */
+    ResponseDTO<List<WhiteListUserDTO>> userWhiteListSearch(SearchDTO searchDTO);
+}

+ 590 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/impl/RedListServiceImpl.java

@@ -0,0 +1,590 @@
+package com.dragoninfo.dcuc.auth.list.service.impl;
+
+import com.dragoninfo.dcuc.app.entity.ApplyInfo;
+import com.dragoninfo.dcuc.app.enumresources.ResourceTypeEnum;
+import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
+import com.dragoninfo.dcuc.auth.auth.service.IAppFunInfoService;
+import com.dragoninfo.dcuc.auth.auth.vo.AppFunInfoVo;
+import com.dragoninfo.dcuc.auth.list.dto.AppFunRedListAddDTO;
+import com.dragoninfo.dcuc.auth.list.dto.AppFunRedListDTO;
+import com.dragoninfo.dcuc.auth.list.dto.FunRedListTreeDTO;
+import com.dragoninfo.dcuc.auth.list.dto.RedListOperateDTO;
+import com.dragoninfo.dcuc.auth.list.entity.RedList;
+import com.dragoninfo.dcuc.auth.list.entity.RedListContent;
+import com.dragoninfo.dcuc.auth.list.repo.RedListContentRepository;
+import com.dragoninfo.dcuc.auth.list.repo.RedListRepository;
+import com.dragoninfo.dcuc.auth.list.repo.bo.FunCountDO;
+import com.dragoninfo.dcuc.auth.list.service.IRedListService;
+import com.dragoninfo.dcuc.auth.sub.enumresource.SubObjTypeEnum;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
+import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
+import com.dragonsoft.duceap.commons.util.string.StringUtils;
+import com.dragonsoft.duceap.core.search.Searchable;
+import com.dragonsoft.duceap.core.search.enums.SearchOperator;
+import com.dragonsoft.duceap.core.search.filter.Condition;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Example;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.Path;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author mazq
+ * @date 2021/7/12
+ */
+@Service
+public class RedListServiceImpl implements IRedListService {
+
+
+    @Autowired
+    RedListRepository redListRepository;
+
+    @Autowired
+    RedListContentRepository contentRepository;
+
+    @Autowired
+    private IAppFunInfoService appFunInfoService;
+
+    @Autowired
+    private IApplyInfoFacade applyInfoFacade;
+
+
+
+    @Override
+    public Boolean funRedListAdd(List<AppFunRedListAddDTO> dtos) {
+        if(CollectionUtils.isEmpty(dtos)) {
+            return false;
+        }
+        List<String> appIds = dtos.stream()
+                .map(AppFunRedListAddDTO::getAppId)
+                .collect(Collectors.toList());
+        //获取已经添加过的应用红名单
+        List<RedList> redLists = getRedListByObjIds(appIds);
+        Map<String, RedList> redListMap = redLists.stream()
+                .collect(Collectors.toMap(RedList::getObjId, item -> item));
+        //批量获取应用和功能
+        List<ApplyInfo> appInfos = applyInfoFacade.getAppById(appIds);
+        List<AppFunInfo> funInfos = appFunInfoService.getByAppIds(appIds);
+        Map<String, ApplyInfo> appInfoMap = appInfos
+                .stream()
+                .collect(Collectors.toMap(ApplyInfo::getId, item -> item, (old, last) -> last));
+        Map<String, AppFunInfo> funInfoMap = funInfos
+                .stream()
+                .collect(Collectors.toMap(AppFunInfo::getId, item -> item, (old, last) -> last));
+        for (AppFunRedListAddDTO dto : dtos) {
+            //应用是否已经添加过
+            String appId = dto.getAppId();
+            RedList exist = redListMap.get(appId);
+            RedList redList;
+            if(null == exist) {
+                redList = new RedList();
+                redList.setObjId(appId);
+                redList.setObjType(SubObjTypeEnum.OBJ_APP_FUN.getCode());
+                redList.setDeleted(BooleanEnum.FALSE.value);
+                redListRepository.save(redList);
+            } else {
+                redList = exist;
+            }
+            saveFunRedListContent(redList, dto, appInfoMap, funInfoMap);
+        }
+        return true;
+    }
+
+    @Override
+    public List<RedList> getRedListByObjIds(List<String> appIds) {
+        if(CollectionUtils.isEmpty(appIds)) {
+            return new ArrayList<>();
+        }
+        Specification<RedList> specification =  (root, query, criteriaBuilder) -> {
+            Path<String> objId = root.get("objId");
+            CriteriaBuilder.In<String> in = criteriaBuilder.in(objId);
+            appIds.forEach(in::value);
+            return in;
+        };
+        return redListRepository.findAll(specification);
+    }
+
+    @Transactional(rollbackFor = RuntimeException.class)
+    @Override
+    public Boolean funRedListUpdateLevel(RedListOperateDTO dto) {
+        List<String> contentIds = dto.getListIds();
+        if(CollectionUtils.isEmpty(contentIds)) {
+            return false;
+        }
+        String level = dto.getLevel();
+        contentRepository.updateLevelByIds(level, contentIds);
+        return true;
+    }
+
+    @Transactional(rollbackFor = RuntimeException.class)
+    @Override
+    public Boolean funRedListBatchDel(RedListOperateDTO dto) {
+        List<String> contentIds = dto.getListIds();
+        if(CollectionUtils.isEmpty(contentIds)) {
+            return false;
+        }
+        //判断哪些应用在客体红名单表中需要删除
+        List<String> delListIds = getDelRedList(contentIds);
+        for (String contentId : contentIds) {
+            contentRepository.deleteById(contentId);
+        }
+        delRedListByIds(delListIds);
+        return true;
+    }
+
+    /**
+     * 传入需要删除的红名单内容记录id集合
+     * 获取需要删除的红名单id
+     * @param delContentIds 要删除的红名单详细内容id集合
+     * @return
+     */
+    private List<String> getDelRedList(List<String> delContentIds) {
+        Searchable searchable = Searchable.newSearchable();
+        searchable.addSearchFilter("id", SearchOperator.in, delContentIds);
+        List<RedListContent> delContentList = contentRepository.findAll(searchable);
+        Map<String, Long> delFunCountMap = delContentList
+                .stream()
+                .collect(Collectors.groupingBy(RedListContent::getRedListId, Collectors.counting()));
+        List<String> listIds = delContentList
+                .stream()
+                .map(RedListContent::getRedListId)
+                .collect(Collectors.toList());
+        List<FunCountDO> allCountList = contentRepository.getCountByListIds(listIds);
+        return allCountList.stream().filter(item -> {
+            String listId = item.getListId();
+            Long funNum = item.getContentCount();
+            Long count = delFunCountMap.get(listId);
+            if(null == funNum) {
+                return false;
+            }
+            return funNum.equals(count);
+        }).map(FunCountDO::getListId).distinct().collect(Collectors.toList());
+    }
+
+    @Transactional(rollbackFor = RuntimeException.class)
+    @Override
+    public Boolean delRedListByIds(List<String> ids) {
+        if(CollectionUtils.isEmpty(ids)) {
+            return false;
+        }
+        for (String id : ids) {
+            redListRepository.deleteById(id);
+        }
+        return true;
+    }
+
+    @Transactional(rollbackFor = RuntimeException.class)
+    @Override
+    public Boolean funRedListDel(String resourceType, String resourceId, Boolean isTreeNode) {
+        if(ResourceTypeEnum.TJ_APP.getResourceType().equals(resourceType)) {
+            RedList r = new RedList();
+            r.setObjId(resourceId);
+            Example<RedList> example = Example.of(r);
+            RedList redList = redListRepository.findOne(example).orElse(null);
+            if(null == redList) {
+                return false;
+            }
+            String listId = redList.getId();
+            redListRepository.deleteById(listId);
+            contentRepository.delByRedListId(listId);
+            return true;
+        } else if(ResourceTypeEnum.TJ_APP_MENU.getResourceType().equals(resourceType)) {
+
+            RedListOperateDTO operateDTO = new RedListOperateDTO();
+            List<String> contentIds = new ArrayList<>();
+            if(isTreeNode) {
+                //查询节点下有多少子节点
+                AppFunInfoVo appFunInfoVo = appFunInfoService.getById(resourceId);
+                List<AppFunInfo> funInfos = appFunInfoService.getByAppId(appFunInfoVo.getAppId());
+                Map<String, List<AppFunInfo>> pIdMap = funInfos
+                        .stream()
+                        .filter(item -> StringUtils.isNotBlank(item.getParentId()))
+                        .collect(Collectors.groupingBy(AppFunInfo::getParentId));
+                List<AppFunInfo> delList = new ArrayList<>();
+                AppFunInfo appFunInfoDTO = new AppFunInfo();
+                BeanUtils.copyProperties(appFunInfoVo, appFunInfoDTO);
+                delList.add(appFunInfoDTO);
+                List<String> pIdList = new ArrayList<>();
+                pIdList.add(appFunInfoVo.getCode());
+                getChildFunList(pIdMap, delList, pIdList);
+                //节点下的所有菜单功能id
+                List<String> allFunIds = delList
+                        .stream()
+                        .map(AppFunInfo::getId)
+                        .distinct()
+                        .collect(Collectors.toList());
+                //查询需要删除的contentId
+                List<RedListContent> contents = getRedListContentByFunIds(allFunIds);
+                contentIds = contents.stream().map(RedListContent::getId).distinct().collect(Collectors.toList());
+
+            } else {
+                RedListContent redListContent = getRedListContentByFunId(resourceId);
+                if(null == redListContent) {
+                    return false;
+                }
+                contentIds.add(redListContent.getId());
+            }
+            //批量删除功能红名单
+            operateDTO.setListIds(contentIds);
+            return funRedListBatchDel(operateDTO);
+        }
+        return false;
+    }
+
+    @Override
+    public Page<FunRedListTreeDTO> funRedListPage(SearchDTO searchDTO) {
+        Searchable searchable = Searchable.toSearchable(searchDTO);
+        Condition appNameCondition = searchable.getSearchFilter("appName", SearchOperator.like);
+        Condition appCodeCondition = searchable.getSearchFilter("appCode", SearchOperator.like);
+        List<ApplyInfo> applyInfos = null;
+        //应用条件查询
+        if(appCodeCondition != null || appNameCondition != null) {
+            applyInfos = getApplyInfos(searchable, appNameCondition, appCodeCondition);
+            if (applyInfos == null) {
+                return new PageImpl<>(new ArrayList<>(), searchable.getPage(), 0L);
+            }
+        }
+        Page<RedList> redListPage = redListRepository.paging(searchable);
+        List<RedList> pageContent = redListPage.getContent();
+        if(CollectionUtils.isEmpty(pageContent)) {
+            return new PageImpl<>(new ArrayList<>(), searchable.getPage(), 0L);
+        }
+        //组装成列表树
+        List<FunRedListTreeDTO> treeDTOS = convertRedListToTree(applyInfos, pageContent);
+        return new PageImpl<>(treeDTOS, searchable.getPage(), redListPage.getTotalElements());
+    }
+
+    @Override
+    public List<String> funIdsInRedList(String appId) {
+        List<RedListContent> all = contentRepository.findAll();
+        if(StringUtils.isNotBlank(appId)) {
+            all = all.stream()
+                    .filter(item->appId.equals(item.getAppId()))
+                    .collect(Collectors.toList());
+        }
+        return all.stream().map(RedListContent::getFunId).distinct().collect(Collectors.toList());
+    }
+
+    @Override
+    public List<AppFunRedListDTO> funRedListContentSearch(Searchable searchable) {
+        List<AppFunRedListDTO> list = new ArrayList<>();
+        List<RedListContent> all = contentRepository.findAll(searchable);
+        if(CollectionUtils.isEmpty(all)) {
+            return list;
+        }
+        List<String> appIds = all
+                .stream()
+                .map(RedListContent::getAppId)
+                .distinct()
+                .collect(Collectors.toList());
+        List<ApplyInfo> applyInfos = applyInfoFacade.getAppById(appIds);
+        List<AppFunInfo> funInfos = appFunInfoService.getByAppIds(appIds);
+        Map<String, ApplyInfo> appIdMap = applyInfos
+                .stream()
+                .collect(Collectors.toMap(ApplyInfo::getId, item -> item));
+        Map<String, AppFunInfo> funIdMap = funInfos
+                .stream()
+                .collect(Collectors.toMap(AppFunInfo::getId, item -> item));
+        for (RedListContent redListContent : all) {
+            String funId = redListContent.getFunId();
+            String appId = redListContent.getAppId();
+            ApplyInfo applyInfo = appIdMap.get(appId);
+            if(null == applyInfo) {
+                continue;
+            }
+            AppFunInfo appFunInfo = funIdMap.get(funId);
+            if(null == appFunInfo) {
+                continue;
+            }
+            AppFunRedListDTO dto = new AppFunRedListDTO();
+            dto.setAppCode(applyInfo.getApplyCode());
+            dto.setAppName(applyInfo.getApplyName());
+            dto.setFunCode(appFunInfo.getCode());
+            dto.setFunName(appFunInfo.getName());
+            dto.setLevel(redListContent.getLevel());
+            list.add(dto);
+        }
+        return list;
+    }
+
+    /**
+     * 将查询到的功能列表组装成树结构
+     * @param applyInfos
+     * @param pageContent
+     * @return
+     */
+    private List<FunRedListTreeDTO> convertRedListToTree(List<ApplyInfo> applyInfos, List<RedList> pageContent) {
+        List<String> appIds = pageContent.stream()
+                .map(RedList::getObjId)
+                .distinct()
+                .collect(Collectors.toList());
+        List<RedListContent> redListContents = getRedListContentByAppIds(appIds);
+        Map<String, List<RedListContent>> listContentMap = redListContents
+                .stream()
+                .collect(Collectors.groupingBy(RedListContent::getAppId));
+        if(null == applyInfos) {
+            applyInfos = applyInfoFacade.getAppById(appIds);
+        }
+        Map<String, ApplyInfo> appInfoMap = applyInfos
+                .stream()
+                .collect(Collectors.toMap(ApplyInfo::getId, item -> item, (old, last) -> last));
+        List<AppFunInfo> funInfos = appFunInfoService.getByAppIds(appIds);
+        Map<String, List<AppFunInfo>> funMap = funInfos
+                .stream()
+                .collect(Collectors.groupingBy(AppFunInfo::getAppId));
+        List<FunRedListTreeDTO> treeDTOS = new ArrayList<>();
+        for (RedList redList : pageContent) {
+            String appId = redList.getObjId();
+            ApplyInfo applyInfo = appInfoMap.get(appId);
+            if(null == applyInfo) {
+                continue;
+            }
+            FunRedListTreeDTO treeDTO = new FunRedListTreeDTO();
+            treeDTO.setId(appId);
+            treeDTO.setCode(applyInfo.getApplyCode());
+            treeDTO.setLabel(applyInfo.getApplyName());
+            treeDTO.setIsTreeNode(true);
+            treeDTO.setListId(redList.getId());
+            List<FunRedListTreeDTO> childTree = getChildTreeDTO(listContentMap.get(appId), funMap.get(appId));
+            childTree.forEach(item->item.setPid(appId));
+            treeDTO.setChild(childTree);
+            treeDTO.setType(ResourceTypeEnum.TJ_APP.getResourceType());
+            treeDTOS.add(treeDTO);
+        }
+        return treeDTOS;
+    }
+
+    /**
+     * 将红名单中的应用功能菜单组装成树结构
+     * @param contentList 红名单中的功能菜单,只有最底层的功能和菜单
+     * @param funList 应用下的所有功能和菜单
+     * @return
+     */
+    private List<FunRedListTreeDTO> getChildTreeDTO(List<RedListContent> contentList, List<AppFunInfo> funList) {
+        List<FunRedListTreeDTO> treeList = new ArrayList<>();
+        if(CollectionUtils.isEmpty(contentList)) {
+            return treeList;
+        }
+        if(CollectionUtils.isEmpty(funList)) {
+            return treeList;
+        }
+        Map<String, AppFunInfo> funCodeMap = funList
+                .stream()
+                .collect(Collectors.toMap(AppFunInfo::getCode, item -> item, (old, last) -> last));
+
+        //红名单中的功能转为树节点对象
+        List<FunRedListTreeDTO> redListTreeNodes = contentList.stream().map(item -> {
+            String funCode = item.getFunCode();
+            AppFunInfo funInfo = funCodeMap.get(funCode);
+            if (null == funInfo) {
+                return null;
+            }
+            FunRedListTreeDTO treeDTO = new FunRedListTreeDTO();
+            treeDTO.setId(item.getFunId());
+            treeDTO.setCode(funCode);
+            treeDTO.setLabel(funInfo.getName());
+            treeDTO.setListId(item.getId());
+            treeDTO.setLevel(item.getLevel());
+            changePid(funCodeMap, funInfo, treeDTO);
+            treeDTO.setType(ResourceTypeEnum.TJ_APP_MENU.getResourceType());
+            return treeDTO;
+        }).filter(item -> !Objects.isNull(item)).collect(Collectors.toList());
+        //组装成树结构
+        treeList = convertNodeToTree(redListTreeNodes);
+        return treeList;
+    }
+
+
+    /**
+     * 将节点转为树结构
+     * @param treeNodes
+     * @return
+     */
+    private List<FunRedListTreeDTO> convertNodeToTree(List<FunRedListTreeDTO> treeNodes) {
+        Map<Boolean, List<FunRedListTreeDTO>> collect = treeNodes.stream()
+                .collect(Collectors.partitioningBy(item -> StringUtils.isBlank(item.getPid())));
+        List<FunRedListTreeDTO> topNodes = collect.get(Boolean.TRUE);
+        List<FunRedListTreeDTO> underNodes = collect.get(Boolean.FALSE);
+        Map<String, List<FunRedListTreeDTO>> pidMap = underNodes.stream()
+                .collect(Collectors.groupingBy(FunRedListTreeDTO::getPid));
+        innerConvertToTree(topNodes, pidMap);
+        return topNodes;
+    }
+
+    /**
+     * 递归将子节点转为树结构
+     * @param topNodes
+     * @param pidMap
+     */
+    private void innerConvertToTree(List<FunRedListTreeDTO> topNodes, Map<String, List<FunRedListTreeDTO>> pidMap) {
+        for (FunRedListTreeDTO topNode : topNodes) {
+            String topNodeId = topNode.getId();
+            List<FunRedListTreeDTO> childList = pidMap.get(topNodeId);
+            if(CollectionUtils.isNotEmpty(childList)) {
+                innerConvertToTree(childList, pidMap);
+                topNode.setChild(childList);
+                topNode.setIsTreeNode(true);
+            }else {
+                topNode.setIsTreeNode(false);
+                //前端要求放入空集合,不能是null
+                topNode.setChild(new ArrayList<>());
+            }
+        }
+    }
+
+    private void changePid(Map<String, AppFunInfo> funCodeMap, AppFunInfo funInfo, FunRedListTreeDTO treeDTO) {
+        String parentId = funInfo.getParentId();
+        if (StringUtils.isNotBlank(parentId)) {
+            AppFunInfo parentFun = funCodeMap.get(parentId);
+            if (null != parentFun) {
+                treeDTO.setPid(parentFun.getId());
+            }
+        }
+    }
+
+
+    private List<ApplyInfo> getApplyInfos(Searchable searchable, Condition appNameCondition, Condition appCodeCondition) {
+        Searchable appSearch = Searchable.newSearchable();
+        if(appCodeCondition != null) {
+            appSearch.addSearchFilter("apply_code", SearchOperator.like, appNameCondition.getValue().toString());
+            searchable.removeSearchFilter("appCode", SearchOperator.like);
+        }
+        if(appNameCondition != null) {
+            appSearch.addSearchFilter("apply_name", SearchOperator.like, appNameCondition.getValue().toString());
+            searchable.removeSearchFilter("appName", SearchOperator.like);
+        }
+        List<ApplyInfo> applyInfos = applyInfoFacade.appInfoSearch(appSearch.toSearchDTO());
+        if(CollectionUtils.isEmpty(applyInfos)) {
+            return null;
+        }
+        List<String> appIds = applyInfos
+                .stream()
+                .map(ApplyInfo::getId)
+                .distinct()
+                .collect(Collectors.toList());
+        searchable.addSearchFilter("objId", SearchOperator.in, appIds);
+        return applyInfos;
+    }
+
+    /**
+     * 根据功能id获取记录
+     * @param funId
+     * @return
+     */
+    private RedListContent getRedListContentByFunId(String funId) {
+        RedListContent redListContent = new RedListContent();
+        redListContent.setFunId(funId);
+        Example<RedListContent> ex = Example.of(redListContent);
+        return contentRepository.findOne(ex).orElse(null);
+    }
+
+    /**
+     * 批量
+     * 根据功能id获取记录
+     * @param funIds
+     * @return
+     */
+    private List<RedListContent> getRedListContentByFunIds(List<String> funIds) {
+        Searchable searchable = Searchable.newSearchable();
+        searchable.addSearchFilter("funId", SearchOperator.in, funIds);
+        searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.value);
+        List<RedListContent> list = contentRepository.findAll(searchable);
+        return list;
+    }
+
+    /**
+     * 批量
+     * 根据应用id获取记录
+     * @param appIds
+     * @return
+     */
+    private List<RedListContent> getRedListContentByAppIds(List<String> appIds) {
+        Searchable searchable = Searchable.newSearchable();
+        searchable.addSearchFilter("appId", SearchOperator.in, appIds);
+        List<RedListContent> list = contentRepository.findAll(searchable);
+        return list;
+    }
+
+    /**
+     * 将pIdList下所有子节点功能放入nodeList
+     * @param pIdMap 以pid分组的map
+     * @param nodeList
+     * @param pIdList
+     */
+    private void getChildFunList(Map<String, List<AppFunInfo>> pIdMap, List<AppFunInfo> nodeList, List<String> pIdList) {
+        ArrayList<String> childIdList = new ArrayList<>();
+        for (String pid : pIdList) {
+            List<AppFunInfo> childList = pIdMap.get(pid);
+            if(CollectionUtils.isNotEmpty(childList)) {
+                nodeList.addAll(childList);
+                List<String> collect = childList.stream().map(AppFunInfo::getCode).distinct().collect(Collectors.toList());
+                childIdList.addAll(collect);
+            }
+        }
+        if(CollectionUtils.isNotEmpty(childIdList)) {
+            getChildFunList(pIdMap, nodeList, childIdList);
+        }
+    }
+
+    /**
+     * 保存菜单功能红名单详细内容
+     * @param redList
+     * @param dto
+     * @param appInfoMap
+     * @param funInfoMap
+     */
+    private void saveFunRedListContent(RedList redList, AppFunRedListAddDTO dto,
+                                Map<String, ApplyInfo> appInfoMap,
+                                Map<String, AppFunInfo> funInfoMap) {
+        String listId = redList.getId();
+        //查询已经存在的功能和菜单
+        List<RedListContent> existContent = getRedListContentByRedListId(listId);
+        Set<String> existFunIds = existContent
+                .stream()
+                .map(RedListContent::getFunId)
+                .collect(Collectors.toSet());
+        for (String funId : dto.getFunIds()) {
+            //已添加的菜单不更新也不保存
+            if(existFunIds.contains(funId)) {
+                continue;
+            }
+            AppFunInfo appFunInfo = funInfoMap.get(funId);
+            if(null == appFunInfo) {
+                continue;
+            }
+            String appId = appFunInfo.getAppId();
+            ApplyInfo applyInfo = appInfoMap.get(appId);
+            if(null == applyInfo) {
+                continue;
+            }
+            RedListContent redListContent = new RedListContent();
+            redListContent.setRedListId(listId);
+            redListContent.setAppId(appId);
+            redListContent.setAppCode(applyInfo.getApplyCode());
+            redListContent.setFunId(funId);
+            redListContent.setFunCode(appFunInfo.getCode());
+            redListContent.setLevel(dto.getLevel());
+            redListContent.setDeleted(BooleanEnum.FALSE.value);
+            redListContent.setContentType(redList.getObjType());
+            contentRepository.save(redListContent);
+        }
+    }
+
+    private List<RedListContent> getRedListContentByRedListId(String listId) {
+        RedListContent redListContent = new RedListContent();
+        redListContent.setRedListId(listId);
+        Example<RedListContent> example = Example.of(redListContent);
+        return contentRepository.findAll(example);
+    }
+
+}

+ 218 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/list/service/impl/WhiteListServiceImpl.java

@@ -0,0 +1,218 @@
+package com.dragoninfo.dcuc.auth.list.service.impl;
+
+import com.dragoninfo.dcuc.auth.list.dto.WhiteListOperateDTO;
+import com.dragoninfo.dcuc.auth.list.dto.WhiteListUserDTO;
+import com.dragoninfo.dcuc.auth.list.entity.WhiteList;
+import com.dragoninfo.dcuc.auth.list.repo.WhiteListRepository;
+import com.dragoninfo.dcuc.auth.list.service.IWhiteListService;
+import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
+import com.dragoninfo.dcuc.auth.sub.enumresource.SubObjTypeEnum;
+import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+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.commons.util.collections.CollectionUtils;
+import com.dragonsoft.duceap.core.search.Searchable;
+import com.dragonsoft.duceap.core.search.enums.SearchOperator;
+import com.dragonsoft.duceap.core.search.filter.Condition;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author mazq
+ * @date 2021/7/9
+ */
+@Service
+public class WhiteListServiceImpl implements IWhiteListService {
+
+    @Autowired
+    private WhiteListRepository whiteListRepository;
+
+    @Autowired
+    private IAuthUserInfoService authUserInfoService;
+
+    @Override
+    public Page<WhiteListUserDTO> whiteListUserPage(SearchDTO searchDTO) {
+        List<AuthUserInfo> userList = null;
+        Searchable searchable = Searchable.toSearchable(searchDTO);
+        Pageable page = searchable.getPage();
+
+        //查询人员
+        Condition nameLike = searchable.getSearchFilter("name", SearchOperator.like);
+        Condition idcardLike = searchable.getSearchFilter("idcard", SearchOperator.like);
+        Condition orgIdEq = searchable.getSearchFilter("orgId", SearchOperator.eq);
+        if(nameLike != null || idcardLike != null || orgIdEq != null) {
+            Searchable userSearch = Searchable.newSearchable();
+            if(null != nameLike) {
+                userSearch.addSearchFilter(nameLike);
+                searchable.removeSearchFilter("name", SearchOperator.like);
+            }
+            if(null != idcardLike) {
+                userSearch.addSearchFilter(idcardLike);
+                searchable.removeSearchFilter("idcard", SearchOperator.like);
+            }
+            if(null != orgIdEq) {
+                userSearch.addSearchFilter(orgIdEq);
+                searchable.removeSearchFilter("orgId", SearchOperator.eq);
+            }
+            userList = authUserInfoService.findList(userSearch.toSearchDTO());
+            if(CollectionUtils.isEmpty(userList)) {
+                return new PageImpl<>(new ArrayList<>(), page, 0L);
+            }
+            List<String> userIds = userList
+                    .stream()
+                    .map(AuthUserInfo::getId)
+                    .collect(Collectors.toList());
+            searchable.addSearchFilter("subId", SearchOperator.in, userIds);
+        }
+
+        //查询白名单
+        searchable.addSearchFilter("subType", SearchOperator.eq, SubObjTypeEnum.SUB_USER.getCode());
+        Page<WhiteList> whiteListPage = whiteListRepository.paging(searchable);
+
+        //组装用户数据
+        List<WhiteList> content = whiteListPage.getContent();
+        if(CollectionUtils.isEmpty(content)) {
+            return new PageImpl<>(new ArrayList<>(), page, 0L);
+        }
+        if(CollectionUtils.isEmpty(userList)) {
+            List<String> userIds = content.stream().map(WhiteList::getSubId).collect(Collectors.toList());
+            userList = authUserInfoService.findByIds(userIds);
+        }
+        List<WhiteListUserDTO> whiteListUsers = getWhiteListUsers(userList, content);
+        return new PageImpl<>(whiteListUsers,whiteListPage.getPageable(),whiteListPage.getTotalElements());
+    }
+
+    private List<WhiteListUserDTO> getWhiteListUsers(List<AuthUserInfo> userList, List<WhiteList> content) {
+        Map<String, AuthUserInfo> userInfoMap = userList
+                .stream()
+                .collect(Collectors.toMap(AuthUserInfo::getId, item -> item, (old, last) -> last));
+        List<WhiteListUserDTO> whiteListUser = new ArrayList<>();
+        for (WhiteList whiteList : content) {
+            WhiteListUserDTO whiteListUserDTO = new WhiteListUserDTO();
+            whiteListUserDTO.setListId(whiteList.getId());
+            whiteListUserDTO.setListLevel(whiteList.getLevel());
+            String userId = whiteList.getSubId();
+            whiteListUserDTO.setUserId(userId);
+            AuthUserInfo authUserInfo = userInfoMap.get(userId);
+            if(null != authUserInfo) {
+                whiteListUserDTO.setIdcard(authUserInfo.getIdcard());
+                whiteListUserDTO.setUserName(authUserInfo.getName());
+                whiteListUserDTO.setOrgId(authUserInfo.getOrgId());
+                whiteListUserDTO.setOrgName(authUserInfo.getOrgName());
+                whiteListUserDTO.setOrgCode(authUserInfo.getOrgCode());
+            }
+            whiteListUser.add(whiteListUserDTO);
+        }
+        return whiteListUser;
+    }
+
+
+    @Override
+    public Boolean whiteListAdd(WhiteListOperateDTO dto) {
+        List<String> subIds = dto.getSubIds();
+        if(CollectionUtils.isEmpty(subIds)) {
+            return false;
+        }
+        for (String subId : subIds) {
+            WhiteList whiteList = new WhiteList();
+            whiteList.setSubId(subId);
+            whiteList.setSubType(dto.getSubType());
+            whiteList.setLevel(dto.getLevel());
+            whiteList.setDeleted(BooleanEnum.FALSE.value);
+            whiteListRepository.save(whiteList);
+        }
+        return true;
+    }
+
+    @Transactional(rollbackFor = RuntimeException.class)
+    @Override
+    public Boolean whiteListDel(WhiteListOperateDTO dto) {
+        List<String> listIds = dto.getListIds();
+        if(CollectionUtils.isEmpty(listIds)) {
+            return false;
+        }
+        for (String listId : listIds) {
+            whiteListRepository.deleteById(listId);
+        }
+        return true;
+    }
+
+    @Transactional(rollbackFor = RuntimeException.class)
+    @Override
+    public Boolean whiteListUpdateLevel(WhiteListOperateDTO dto) {
+        List<String> listIds = dto.getListIds();
+        if(CollectionUtils.isEmpty(listIds)) {
+            return false;
+        }
+        String level = dto.getLevel();
+        whiteListRepository.updateLevelByIds(level,listIds);
+        return true;
+    }
+
+    @Override
+    public List<String> getAllUser() {
+        Searchable searchable = Searchable.newSearchable();
+        searchable.addSearchFilter("subType", SearchOperator.eq, SubObjTypeEnum.SUB_USER.getCode());
+        List<WhiteList> allUsers = whiteListRepository.findAll(searchable);
+        return allUsers.stream().map(WhiteList::getSubId).distinct().collect(Collectors.toList());
+    }
+
+    @Override
+    public ResponseDTO<List<WhiteListUserDTO>> userWhiteListSearch(SearchDTO searchDTO) {
+        List<WhiteListUserDTO> list = new ArrayList<>();
+        List<AuthUserInfo> authUserInfos = new ArrayList<>();
+        Searchable searchable = Searchable.toSearchable(searchDTO);
+        searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.value);
+
+        Condition idcardEq = searchable.getSearchFilter("idcard", SearchOperator.eq);
+        Condition idcardIn = searchable.getSearchFilter("idcard", SearchOperator.in);
+        if(null == idcardEq && null == idcardIn) {
+            return ResponseDTO.fail(ResponseStatus.FAIL_CODE,"idcard condition is null", null);
+        }
+        if(null != idcardEq) {
+            searchable.removeSearchFilter("idcard", SearchOperator.eq);
+            AuthUserInfo authUserInfo = authUserInfoService.findByIdcard(idcardEq.getValue().toString());
+            if(null == authUserInfo) {
+                return ResponseDTO.success("success", list);
+            }
+            searchable.addSearchFilter("subId", SearchOperator.eq, authUserInfo.getId());
+            authUserInfos.add(authUserInfo);
+        }
+
+        if(null != idcardIn) {
+            searchable.removeSearchFilter("idcard", SearchOperator.in);
+            List<String> idcards = (List<String>) idcardIn.getValue();
+            List<AuthUserInfo> findByIdcards = authUserInfoService.findByIdcards(idcards);
+            if(CollectionUtils.isEmpty(findByIdcards)) {
+                return ResponseDTO.success("success", list);
+            }
+            List<String> collect = findByIdcards.stream().map(AuthUserInfo::getId).distinct().collect(Collectors.toList());
+            searchable.addSearchFilter("subId", SearchOperator.in, collect);
+            authUserInfos = findByIdcards;
+        }
+
+
+        searchable.addSearchFilter("subType", SearchOperator.eq, SubObjTypeEnum.SUB_USER.getCode());
+        List<WhiteList> all = whiteListRepository.findAll(searchable);
+        if(CollectionUtils.isEmpty(all)) {
+            return ResponseDTO.success("success", list);
+        }
+        List<String> userIds = all.stream().map(WhiteList::getSubId).collect(Collectors.toList());
+        if(authUserInfos.size() == 0) {
+            authUserInfos  = authUserInfoService.findByIds(userIds);
+        }
+        list = getWhiteListUsers(authUserInfos, all);
+        return ResponseDTO.success("success", list);
+    }
+}

+ 3 - 3
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/business/impl/AuthUserBusinessImpl.java

@@ -5,6 +5,7 @@ import com.dragoninfo.dcuc.auth.auth.constance.CommonCons;
 import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
 import com.dragoninfo.dcuc.auth.auth.service.IRoleInfoService;
 import com.dragoninfo.dcuc.auth.config.DcucAuthConfig;
+import com.dragoninfo.dcuc.auth.list.service.IWhiteListService;
 import com.dragoninfo.dcuc.auth.sub.business.IAuthUserBusiness;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthUserContactDTO;
 import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
@@ -22,7 +23,6 @@ import com.dragoninfo.dcuc.duceap.enums.UserTypeEnum;
 import com.dragoninfo.dcuc.duceap.facade.ICodeListResourceFacade;
 import com.dragoninfo.dcuc.duceap.facade.IDuceapUploadFacade;
 import com.dragoninfo.dcuc.duceap.upload.dto.DocContentDTO;
-import com.dragoninfo.dcuc.list.facade.IWhiteListFacade;
 import com.dragoninfo.duceap.core.enums.RoleLevelEnum;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.base.entity.metadata.CodeRecord;
@@ -118,7 +118,7 @@ public class AuthUserBusinessImpl implements IAuthUserBusiness {
     private ICodeListResourceFacade codeFacade;
 
     @Autowired
-    private IWhiteListFacade whiteListFacade;
+    private IWhiteListService whiteListService;
 
     @Autowired
     private IAppMtAuthService appMtAuthService;
@@ -243,7 +243,7 @@ public class AuthUserBusinessImpl implements IAuthUserBusiness {
 
     @Override
     public Page<AuthUserDTO> notInWhiteListUserPage(SearchDTO searchDTO) {
-        List<String> userIds = whiteListFacade.getAllUser();
+        List<String> userIds = whiteListService.getAllUser();
         Searchable searchable = Searchable.toSearchable(searchDTO);
         searchable.addSearchFilter("id", SearchOperator.notIn, userIds);
         Page<AuthUserInfo> userPage = authUserInfoService.page(searchable);

+ 3 - 0
dcuc-auth-service/src/main/resources/config/mysql/V4_3_0023__User_Org_Sync.sql

@@ -0,0 +1,3 @@
+ALTER TABLE T_AUTH_USER_ORIGINAL_DATA ADD COLUMN `USER_TYPE` VARCHAR(10) COMMENT '人员类型' AFTER `IDCARD`;
+ALTER TABLE T_AUTH_USER_ORIGINAL_DATA ADD COLUMN `CONTACT_DATA` VARCHAR(1000) COMMENT '联系方式json数据' AFTER `JSON_DATA`;
+ALTER TABLE T_AUTH_USER_ORIGINAL_DATA ADD COLUMN `ORG_REL_DATA` VARCHAR(1000) COMMENT '联系方式json数据' AFTER `CONTACT_DATA`;

+ 47 - 0
dcuc-auth-service/src/main/resources/config/mysql/V4_3_0024__White_Red_List.sql

@@ -0,0 +1,47 @@
+CREATE TABLE T_LIST_WHITE_LIST(
+    ID VARCHAR(32)    COMMENT '主键' ,
+    SUB_TYPE VARCHAR(32)    COMMENT '主体类型' ,
+    SUB_ID VARCHAR(32)    COMMENT '主体id' ,
+    LEVEL VARCHAR(32)    COMMENT '名单级别' ,
+    DELETED VARCHAR(32)    COMMENT '是否删除' ,
+    CREATE_TIME DATETIME    COMMENT '创建时间' ,
+    UPDATE_TIME DATETIME    COMMENT '更新时间' ,
+    DELETE_TIME DATETIME    COMMENT '删除时间' ,
+    CREATE_USER VARCHAR(32)    COMMENT '创建人' ,
+    UPDATE_USER VARCHAR(32)    COMMENT '更新人' ,
+    DELETE_USER VARCHAR(32)    COMMENT '删除人'
+) COMMENT = '主体白名单表 ';
+
+ALTER TABLE T_LIST_WHITE_LIST ADD INDEX IDX_LIST_WHITE_LIST_SUB_ID(SUB_ID);
+
+CREATE TABLE T_LIST_RED_LIST_CONTENT(
+    ID VARCHAR(32)    COMMENT '主键' ,
+    RED_LIST_ID VARCHAR(32)    COMMENT '红名单记录表' ,
+    APP_ID VARCHAR(32)    COMMENT '应用id' ,
+    APP_CODE VARCHAR(64)    COMMENT '应用code' ,
+    FUN_ID VARCHAR(32)    COMMENT '功能id' ,
+    FUN_CODE VARCHAR(64)    COMMENT '功能code' ,
+    LEVEL VARCHAR(32)    COMMENT '功能红名单等级' ,
+    DELETED VARCHAR(32)    COMMENT '是否删除' ,
+    CONTENT_TYPE VARCHAR(32)    COMMENT '类型'
+) COMMENT = '红名单资源信息表 ';
+
+ALTER TABLE T_LIST_RED_LIST_CONTENT ADD INDEX IDX_RED_LIST_CONTENT_LIST_ID(RED_LIST_ID);
+ALTER TABLE T_LIST_RED_LIST_CONTENT ADD INDEX IDX_RED_LIST_CONTENT_APP_ID(APP_ID);
+
+
+CREATE TABLE T_LIST_RED_LIST(
+    ID VARCHAR(32)    COMMENT '主键' ,
+    OBJ_TYPE VARCHAR(32)    COMMENT '客体类型' ,
+    OBJ_ID VARCHAR(32)    COMMENT '客体id' ,
+    LEVEL VARCHAR(32)    COMMENT '名单级别' ,
+    DELETED VARCHAR(32)    COMMENT '是否删除' ,
+    CREATE_TIME DATETIME    COMMENT '创建时间' ,
+    UPDATE_TIME DATETIME    COMMENT '更新时间' ,
+    DELETE_TIME DATETIME    COMMENT '删除时间' ,
+    CREATE_USER VARCHAR(32)    COMMENT '创建人' ,
+    UPDATE_USER VARCHAR(32)    COMMENT '更新人' ,
+    DELETE_USER VARCHAR(32)    COMMENT '删除人'
+) COMMENT = '客体红名单表 ';
+
+ALTER TABLE T_LIST_RED_LIST ADD INDEX IDX_RED_LIST_OBJ_ID(OBJ_ID);

+ 3 - 0
dcuc-auth-service/src/main/resources/config/sql/V4_3_0023__User_Org_Sync.sql

@@ -0,0 +1,3 @@
+ALTER TABLE T_AUTH_USER_ORIGINAL_DATA ADD COLUMN "USER_TYPE" VARCHAR2(10);
+ALTER TABLE T_AUTH_USER_ORIGINAL_DATA ADD COLUMN "CONTACT_DATA" VARCHAR2(1000);
+ALTER TABLE T_AUTH_USER_ORIGINAL_DATA ADD COLUMN "ORG_REL_DATA" VARCHAR2(1000);

+ 89 - 0
dcuc-auth-service/src/main/resources/config/sql/V4_3_0024__White_Red_List.sql

@@ -0,0 +1,89 @@
+CREATE TABLE T_LIST_RED_LIST(
+    ID VARCHAR2(32),
+    OBJ_TYPE NVARCHAR2(32),
+    OBJ_ID VARCHAR2(32),
+    LEVEL NVARCHAR2(32),
+    DELETED NVARCHAR2(32),
+    CREATE_TIME DATE,
+    UPDATE_TIME DATE,
+    DELETE_TIME DATE,
+    CREATE_USER VARCHAR2(32),
+    UPDATE_USER VARCHAR2(32),
+    DELETE_USER VARCHAR2(32)
+);
+
+COMMENT ON TABLE T_LIST_RED_LIST IS '客体红名单表';
+COMMENT ON COLUMN T_LIST_RED_LIST.ID IS '主键';
+COMMENT ON COLUMN T_LIST_RED_LIST.OBJ_TYPE IS '客体类型';
+COMMENT ON COLUMN T_LIST_RED_LIST.OBJ_ID IS '客体id';
+COMMENT ON COLUMN T_LIST_RED_LIST.LEVEL IS '名单级别';
+COMMENT ON COLUMN T_LIST_RED_LIST.DELETED IS '是否删除';
+COMMENT ON COLUMN T_LIST_RED_LIST.CREATE_TIME IS '创建时间';
+COMMENT ON COLUMN T_LIST_RED_LIST.UPDATE_TIME IS '更新时间';
+COMMENT ON COLUMN T_LIST_RED_LIST.DELETE_TIME IS '删除时间';
+COMMENT ON COLUMN T_LIST_RED_LIST.CREATE_USER IS '创建人';
+COMMENT ON COLUMN T_LIST_RED_LIST.UPDATE_USER IS '更新人';
+COMMENT ON COLUMN T_LIST_RED_LIST.DELETE_USER IS '删除人';
+
+
+CREATE INDEX IDX_RED_LIST_OBJ_ID ON T_LIST_RED_LIST(OBJ_ID);
+
+
+
+CREATE TABLE T_LIST_RED_LIST_CONTENT(
+    ID VARCHAR2(32),
+    RED_LIST_ID VARCHAR2(32),
+    APP_ID VARCHAR2(32),
+    APP_CODE VARCHAR2(64),
+    FUN_ID VARCHAR2(32),
+    FUN_CODE VARCHAR2(64),
+    LEVEL NVARCHAR2(32),
+    DELETED NVARCHAR2(32),
+    CONTENT_TYPE NVARCHAR2(32)
+);
+
+COMMENT ON TABLE T_LIST_RED_LIST_CONTENT IS '红名单资源信息表';
+COMMENT ON COLUMN T_LIST_RED_LIST_CONTENT.ID IS '主键';
+COMMENT ON COLUMN T_LIST_RED_LIST_CONTENT.RED_LIST_ID IS '红名单记录表';
+COMMENT ON COLUMN T_LIST_RED_LIST_CONTENT.APP_ID IS '应用id';
+COMMENT ON COLUMN T_LIST_RED_LIST_CONTENT.APP_CODE IS '应用code';
+COMMENT ON COLUMN T_LIST_RED_LIST_CONTENT.FUN_ID IS '功能id';
+COMMENT ON COLUMN T_LIST_RED_LIST_CONTENT.FUN_CODE IS '功能code';
+COMMENT ON COLUMN T_LIST_RED_LIST_CONTENT.LEVEL IS '功能红名单等级';
+COMMENT ON COLUMN T_LIST_RED_LIST_CONTENT.DELETED IS '是否删除';
+COMMENT ON COLUMN T_LIST_RED_LIST_CONTENT.CONTENT_TYPE IS '类型';
+
+
+CREATE INDEX IDX_RED_LIST_CONTENT_LIST_ID ON T_LIST_RED_LIST_CONTENT(RED_LIST_ID);
+
+CREATE INDEX IDX_RED_LIST_CONTENT_APP_ID ON T_LIST_RED_LIST_CONTENT(APP_ID);
+
+
+CREATE TABLE T_LIST_WHITE_LIST(
+    ID VARCHAR2(32),
+    SUB_TYPE NVARCHAR2(32),
+    SUB_ID VARCHAR2(32),
+    LEVEL NVARCHAR2(32),
+    DELETED NVARCHAR2(32),
+    CREATE_TIME DATE,
+    UPDATE_TIME DATE,
+    DELETE_TIME DATE,
+    CREATE_USER VARCHAR2(32),
+    UPDATE_USER VARCHAR2(32),
+    DELETE_USER VARCHAR2(32)
+);
+
+COMMENT ON TABLE T_LIST_WHITE_LIST IS '主体白名单表';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.ID IS '主键';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.SUB_TYPE IS '主体类型';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.SUB_ID IS '主体id';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.LEVEL IS '名单级别';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.DELETED IS '是否删除';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.CREATE_TIME IS '创建时间';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.UPDATE_TIME IS '更新时间';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.DELETE_TIME IS '删除时间';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.CREATE_USER IS '创建人';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.UPDATE_USER IS '更新人';
+COMMENT ON COLUMN T_LIST_WHITE_LIST.DELETE_USER IS '删除人';
+
+CREATE INDEX IDX_LIST_WHITE_LIST_SUB_ID ON T_LIST_WHITE_LIST(SUB_ID);