Browse Source

Merge branch 'develop' of 192.168.0.144:dcuc-tjdsj/auth-back into develop

fuzq 4 years ago
parent
commit
c8b2f88ab5
74 changed files with 2033 additions and 1351 deletions
  1. 31 4
      Jenkinsfile
  2. 10 0
      README.md
  3. 24 8
      pom.xml
  4. 0 128
      src/main/java/com/dragoninfo/dcuc/authweb/business/HwIdentityBusiness.java
  5. 1 10
      src/main/java/com/dragoninfo/dcuc/authweb/config/DcucAuthWebConfig.java
  6. 5 0
      src/main/java/com/dragoninfo/dcuc/authweb/enums/CheckTypeEnum.java
  7. 0 35
      src/main/java/com/dragoninfo/dcuc/authweb/enums/HwTokenResultEnum.java
  8. 23 8
      src/main/java/com/dragoninfo/dcuc/authweb/exception/RespExceptionHandler.java
  9. 9 6
      src/main/java/com/dragoninfo/dcuc/authweb/interceptor/AuthBeforeResInterceptor.java
  10. 113 0
      src/main/java/com/dragoninfo/dcuc/authweb/interceptor/SecurityAccessTokenResolver.java
  11. 0 61
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/appservice/ahfk/AhfkAppController.java
  12. 0 185
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/ahfk/AhfkAuthorityStatistics.java
  13. 0 84
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/ahfk/AhfkFunctionController.java
  14. 0 97
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/ahfk/AhfkRoleController.java
  15. 79 15
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/controller/AuthServiceController.java
  16. 55 32
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/controller/WorkFlowApiController.java
  17. 24 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/vo/AuthFlowRepeatCheckVo.java
  18. 12 2
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/vo/ServiceAuthFlowAcceptVo.java
  19. 49 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/vo/ServiceAuthResultVo.java
  20. 51 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v2/controller/AuthServiceV2Controller.java
  21. 97 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v2/controller/WorkFlowApiV2Controller.java
  22. 25 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v2/vo/AuthResultDelVO.java
  23. 2 2
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v3/controller/AuthV3ApiController.java
  24. 107 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v3/controller/WorkFlowApiV3Controller.java
  25. 0 193
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/ApiController.java
  26. 90 45
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/AuthApiController.java
  27. 62 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/DataAuthApiController.java
  28. 34 14
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/RestAuthController.java
  29. 0 73
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/RestLoginController.java
  30. 18 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/pojo/FunAppovalParamVo.java
  31. 15 3
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/pojo/RoleApiParamVo.java
  32. 14 2
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/pojo/UpdataAppFunVO.java
  33. 9 4
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/AppController.java
  34. 82 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/DataResourceController.java
  35. 5 2
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/ManufacturerInfoController.java
  36. 3 3
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/ResourceAuthController.java
  37. 4 4
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/ResourceListingController.java
  38. 40 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/vo/AuthDataClassifyVo.java
  39. 27 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/vo/AuthDataFieldClassifyVo.java
  40. 23 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/vo/AuthDataLevelVo.java
  41. 16 16
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/approval/ApprovalController.java
  42. 2 1
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/audit/MgeAuditRptController.java
  43. 53 51
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/audit/UserAuditRptController.java
  44. 15 11
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/AppFunInfoController.java
  45. 226 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/DataAuthController.java
  46. 46 35
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/RoleInfoController.java
  47. 3 1
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/ServiceAuthResultController.java
  48. 32 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataAuthAcceptVo.java
  49. 26 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataClassifyVo.java
  50. 27 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataDetailConditionVo.java
  51. 27 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataDetailQueryVo.java
  52. 37 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataResourceTreeVo.java
  53. 26 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/LabelDataAuthAcceptVo.java
  54. 26 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/OrgDataAuthAcceptVo.java
  55. 25 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/ResourceTypeQueryVo.java
  56. 23 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/SubDataAuthQueryVo.java
  57. 27 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/SubDataVo.java
  58. 25 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/UserDataAuthAcceptVo.java
  59. 16 9
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/login/DcucLoginController.java
  60. 51 43
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/GovernmentInfoController.java
  61. 39 17
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/OrgInfoController.java
  62. 8 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/resource/DataSourceController.java
  63. 4 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/resource/DuceapUploadController.java
  64. 5 2
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/resource/MdDynCodeDicController.java
  65. 6 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/resource/MdDynCodeDicSonController.java
  66. 5 2
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/ManageStatisicsController.java
  67. 4 0
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/UserStatisicsController.java
  68. 47 45
      src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/user/PoliceManagementController.java
  69. 0 32
      src/main/java/com/dragoninfo/dcuc/authweb/vo/hwtoken/HwTokenCheckReqContentVO.java
  70. 0 16
      src/main/java/com/dragoninfo/dcuc/authweb/vo/hwtoken/HwTokenCheckReqVO.java
  71. 0 26
      src/main/java/com/dragoninfo/dcuc/authweb/vo/hwtoken/HwTokenCheckRespContentVO.java
  72. 0 17
      src/main/java/com/dragoninfo/dcuc/authweb/vo/hwtoken/HwTokenCheckRespVO.java
  73. 9 7
      src/main/resources/application-base.yml
  74. 34 0
      src/test/java/GenerateToken.java

+ 31 - 4
Jenkinsfile

@@ -3,9 +3,11 @@
 
 def build = new org.devops.build()
 def color = new org.devops.color()
+def systemtime = new org.devops.systemtime()
 
-String cpu = "${env.cpu}"
-String imagePrefix = "${env.imagePrefix}"
+def String cpu = "${env.cpu}"
+def String imagePrefix = "${env.imagePrefix}"
+def String buildImage = "${env.buildImage}"
 
 pipeline {
     agent {
@@ -20,14 +22,15 @@ pipeline {
 
     //设定2个参数,根据项目类型不同,修改对应的description name value visibleItemCount  defaultValue 即可
     parameters {
-        extendedChoice description: '请选择CPU架构.可单选/多选/全选', multiSelectDelimiter: ',', name: 'cpu',
+        choice choices: ['false', 'true'], description: '是否需要打镜像包,默认为否', name: 'buildImage'
+        extendedChoice description: '只有在需要打镜像包的情况下,才需要选择CPU架构。可单选/多选/全选', multiSelectDelimiter: ',', name: 'cpu',
                 quoteValue: true,
                 saveJSONParameterToFile: false,
                 type: 'PT_CHECKBOX',
                 value: 'x86,arm64',
                 visibleItemCount: 5
         // 需修改对应的镜像名称
-        string defaultValue: 'bus.ga/jzywb/dcuc/', description: '请填写打的镜像通用前缀名称,注意最后面要加 / ', name: 'imagePrefix', trim: false
+        string defaultValue: 'bus.ga/jzywb/dcuc/', description: '只有在需要打镜像包的情况下,才需要填写要打镜像通用前缀名称,注意最后面要加 / ', name: 'imagePrefix', trim: false
     }
     stages {
         stage('MAVEN-BUILD') {
@@ -38,8 +41,32 @@ pipeline {
                     build.Build('mvn', 'mvn clean deploy -DskipTests=true', 'master')
                 }
             }
+            post {
+                success {
+                    script {
+                        version = build.GetMvnParentVersion()
+                        systime = systemtime.GetSysTime('yyMMdd')
+                        //将打出来的tar包,按照命名规范命名。根据实际情况,修改对应的系统简称和区域标识(DCUC-AUTH-BACK-TJDSJ)
+                        //如果是单模块项目,则直接cd target;如果是多模块项目,则是cd 模块名称/target
+                        sh """cd target
+                            cp dcuc-auth-back-*.tar.gz DCUC-AUTH-BACK-TJDSJ-${version}-${env.GIT_COMMIT.take(8)}-BETA-${systime}.tar.gz
+                        """
+                        //将复制的按照命名规范的tar包提取到Jenkins的面板,方便下载。根据实际情况,修改对应的系统简称和区域标识(DCUC-AUTH-BACK-TJDSJ)
+                        //如果是单模块项目,则直接target/xxxxx;如果是多模块项目,则是模块名称/target/xxxx
+                        //多模块写法:archiveArtifacts artifacts: 'dcuc-auth-back/target/DCUC-AUTH-BACK-TJDSJ-*.tar.gz'
+                        //单模块写法:
+                        archiveArtifacts artifacts: 'target/DCUC-AUTH-BACK-TJDSJ-*.tar.gz'
+                    }
+                }
+            }
+
         }
         stage('DOCKER-BUILD') {
+            when {
+                expression {
+                    return (buildImage  == 'true')
+                }
+            }
             steps {
                 script {
                     //将cpu架构和模块名称传入方法打镜像包.若在上面定义的参数名称没变,可不修改

+ 10 - 0
README.md

@@ -0,0 +1,10 @@
+# 权限服务
+## 更新日志
+### 2.1.0
+  - 新增服务授权
+### 2.1.1
+  - 对接华为认证
+### 2.2.0
+  - 数据授权
+### 2.2.1
+  - 整合数据域、GAW版本  

+ 24 - 8
pom.xml

@@ -5,14 +5,14 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.dragoninfo</groupId>
     <artifactId>dcuc-auth-back</artifactId>
-    <version>2.1.0-tjdsj-SNAPSHOT</version>
+    <version>2.2.1-tjdsj-SNAPSHOT</version>
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <!--revisions需写死,用于标识打包的版本号,不可删除-->
-        <revision>2.1.0-tjdsj-SNAPSHOT</revision>
+        <revision>2.2.1-tjdsj-SNAPSHOT</revision>
         <duceap.version>2.1.0-SNAPSHOT</duceap.version>
         <lombok.version>1.18.2</lombok.version>
         <jwt.version>3.10.3</jwt.version>
@@ -39,7 +39,11 @@
             <artifactId>spring-boot-configuration-processor</artifactId>
             <optional>true</optional>
         </dependency>
-
+        <dependency>
+            <groupId>com.dragoninfo</groupId>
+            <artifactId>dcuc-user-api</artifactId>
+            <version>2.0.1-tjdsj-SNAPSHOT</version>
+        </dependency>
         <!--监控配置-->
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -108,7 +112,7 @@
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-auth-api</artifactId>
-            <version>2.1.0-tjdsj-SNAPSHOT</version>
+            <version>2.2.1-tjdsj-SNAPSHOT</version>
         </dependency>
         <!--redis缓存-->
         <dependency>
@@ -132,7 +136,7 @@
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-user-api</artifactId>
-            <version>2.0.1-SNAPSHOT</version>
+            <version>2.0.1-tjdsj-SNAPSHOT</version>
         </dependency>
 
         <dependency>
@@ -144,13 +148,13 @@
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-coder-api</artifactId>
-            <version>2.0.0-tjdsj-SNAPSHOT</version>
+            <version>2.0.0-SNAPSHOT</version>
         </dependency>
 
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-duceap-api</artifactId>
-            <version>2.0.0-tjdsj-SNAPSHOT</version>
+            <version>2.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -209,6 +213,18 @@
             <artifactId>duceap-security-dids</artifactId>
         </dependency>
 
+        <!--测试-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.dragonsoft</groupId>
+            <artifactId>duceap-security-jwt</artifactId>
+        </dependency>
+
     </dependencies>
     <!--指定仓库地址-->
     <repositories>
@@ -322,7 +338,7 @@
                                 <configuration>
                                     <!--排除licenseignore包,用来禁用许可开关,防止生产环境通过关闭开关,绕过许可-->
                                     <excludeArtifactIds>duceap-support-licenseignore</excludeArtifactIds>
-                                    <!--<excludeScope>provided</excludeScope>-->
+                                    <excludeScope>provided</excludeScope>
                                     <outputDirectory>${project.build.directory}/lib</outputDirectory>
                                     <!--取消依赖包的时间戳-->
                                     <useBaseVersion>true</useBaseVersion>

+ 0 - 128
src/main/java/com/dragoninfo/dcuc/authweb/business/HwIdentityBusiness.java

@@ -1,128 +0,0 @@
-package com.dragoninfo.dcuc.authweb.business;
-
-import cn.hutool.http.HttpRequest;
-import com.dragoninfo.dcuc.authweb.config.DcucAuthWebConfig;
-import com.dragoninfo.dcuc.authweb.enums.HwTokenResultEnum;
-import com.dragoninfo.dcuc.authweb.vo.hwtoken.HwTokenCheckReqContentVO;
-import com.dragoninfo.dcuc.authweb.vo.hwtoken.HwTokenCheckReqVO;
-import com.dragoninfo.dcuc.authweb.vo.hwtoken.HwTokenCheckRespContentVO;
-import com.dragoninfo.dcuc.authweb.vo.hwtoken.HwTokenCheckRespVO;
-import com.dragonsoft.duceap.commons.util.date.DateConst;
-import com.dragonsoft.duceap.commons.util.date.DateUtils;
-import com.dragonsoft.duceap.commons.util.json.JsonUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author huangzqa
- * @date 2021/3/30
- **/
-@Slf4j
-@Service
-public class HwIdentityBusiness {
-
-    @Autowired
-    private DcucAuthWebConfig dcucAuthWebConfig;
-
-    /**
-     * 校验令牌
-     *
-     * @param userToken 用户令牌
-     * @param appToken  应用令牌
-     * @return 是否有效
-     */
-    public boolean checkToken(String userToken, String appToken) {
-
-        HwTokenCheckReqVO hwTokenCheckReqVO = new HwTokenCheckReqVO();
-
-        HwTokenCheckReqContentVO hwTokenCheckReqContentVO = new HwTokenCheckReqContentVO();
-        hwTokenCheckReqContentVO.setAppToken(appToken);
-        hwTokenCheckReqContentVO.setUserToken(userToken);
-        hwTokenCheckReqContentVO.setMessageId(DateUtils.getDateFormat(DateConst.DB_STORE_DATE));
-        hwTokenCheckReqContentVO.setEsn(dcucAuthWebConfig.getHwIdentityEsn());
-
-        hwTokenCheckReqVO.setContent(Collections.singletonList(hwTokenCheckReqContentVO));
-
-        HwTokenCheckRespVO hwTokenCheckRespVO = sendRequest(hwTokenCheckReqVO);
-
-        List<HwTokenCheckRespContentVO> content = hwTokenCheckRespVO.getContent();
-
-        String validValue = HwTokenResultEnum.VALID.getValue();
-        for (HwTokenCheckRespContentVO hwTokenCheckRespContentVO : content) {
-            String usercheckResult = hwTokenCheckRespContentVO.getUsercheckResult();
-            String appcheckResult = hwTokenCheckRespContentVO.getAppcheckResult();
-
-            if (!usercheckResult.equals(validValue)) {
-                return false;
-            }
-
-            if (!appcheckResult.equals(validValue)) {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * 校验用户令牌
-     *
-     * @param userToken 用户令牌
-     * @return 是否有效
-     */
-    public boolean checkUserToken(String userToken) {
-
-        HwTokenCheckReqVO hwTokenCheckReqVO = new HwTokenCheckReqVO();
-
-        HwTokenCheckReqContentVO hwTokenCheckReqContentVO = new HwTokenCheckReqContentVO();
-        hwTokenCheckReqContentVO.setAppToken("");
-        hwTokenCheckReqContentVO.setUserToken(userToken);
-        hwTokenCheckReqContentVO.setMessageId(DateUtils.getDateFormat(DateConst.DB_STORE_DATE));
-        hwTokenCheckReqContentVO.setEsn(dcucAuthWebConfig.getHwIdentityEsn());
-
-        hwTokenCheckReqVO.setContent(Collections.singletonList(hwTokenCheckReqContentVO));
-
-        HwTokenCheckRespVO hwTokenCheckRespVO = sendRequest(hwTokenCheckReqVO);
-
-        List<HwTokenCheckRespContentVO> content = hwTokenCheckRespVO.getContent();
-
-        String validValue = HwTokenResultEnum.VALID.getValue();
-        for (HwTokenCheckRespContentVO hwTokenCheckRespContentVO : content) {
-            String usercheckResult = hwTokenCheckRespContentVO.getUsercheckResult();
-
-            if (!usercheckResult.equals(validValue)) {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * 发送请求
-     *
-     * @param hwTokenCheckReqVO 请求
-     * @return 返回值
-     */
-    private HwTokenCheckRespVO sendRequest(HwTokenCheckReqVO hwTokenCheckReqVO) {
-        String reqJson = JsonUtils.toJSONString(hwTokenCheckReqVO);
-
-        log.info("Token check req :{}", reqJson);
-
-        String url = dcucAuthWebConfig.getHwIdentityUrl() + "/tacs/tokencheck";
-
-        log.info("Token check req url:{}", reqJson);
-        String postResp = HttpRequest.post(url)
-                .body(reqJson)
-                .header("Message-Type", "tokencheck")
-                .execute()
-                .body();
-        log.info("Token check resp :{}", postResp);
-
-        return JsonUtils.parseObject(postResp, HwTokenCheckRespVO.class);
-    }
-}

+ 1 - 10
src/main/java/com/dragoninfo/dcuc/authweb/config/DcucAuthWebConfig.java

@@ -24,18 +24,9 @@ public class DcucAuthWebConfig {
      */
     private boolean authAccess;
 
-    /**
-     * 华为认证地址
-     */
-    private String hwIdentityUrl;
-
-    /**
-     * 注册在华为认证,权限的唯一标识,与注册接口保持一致,不能为其他值
-     */
-    private String hwIdentityEsn;
-
     /**
      * 凭据鉴权类型
      */
     private CheckTypeEnum checkTypeEnum = CheckTypeEnum.TOKEN;
+
 }

+ 5 - 0
src/main/java/com/dragoninfo/dcuc/authweb/enums/CheckTypeEnum.java

@@ -7,6 +7,11 @@ import com.dragonsoft.duceap.base.enums.ICodeEnum;
  * @date 2021/4/6
  **/
 public enum CheckTypeEnum implements ICodeEnum {
+    /**
+     * 无凭据
+     */
+    NONE("none", "无凭据"),
+
     /**
      * 基本凭据
      */

+ 0 - 35
src/main/java/com/dragoninfo/dcuc/authweb/enums/HwTokenResultEnum.java

@@ -1,35 +0,0 @@
-package com.dragoninfo.dcuc.authweb.enums;
-
-import com.dragonsoft.duceap.base.enums.ICodeEnum;
-
-/**
- * @author huangzqa
- * @date 2021/3/30
- **/
-public enum HwTokenResultEnum implements ICodeEnum {
-
-    /**
-     * 有效
-     */
-    VALID("valid", "有效");
-
-    private String value;
-
-    private String label;
-
-
-    HwTokenResultEnum(String value, String label) {
-        this.value = value;
-        this.label = label;
-    }
-
-    @Override
-    public String getValue() {
-        return this.value;
-    }
-
-    @Override
-    public String getLabel() {
-        return this.label;
-    }
-}

+ 23 - 8
src/main/java/com/dragoninfo/dcuc/authweb/exception/RespExceptionHandler.java

@@ -1,13 +1,17 @@
 package com.dragoninfo.dcuc.authweb.exception;
 
 
-import com.dragoninfo.dcuc.common.enums.ErrorCode;
-import com.dragoninfo.dcuc.common.enums.HttpCode;
+import com.dragoninfo.dcuc.common.enums.ErrorCodeEnum;
+import com.dragoninfo.dcuc.common.exception.GmConfidentialityException;
+import com.dragoninfo.dcuc.common.exception.GmIntegrityException;
+import com.dragoninfo.dcuc.common.exception.GmNonRepudiationException;
 import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
 import com.dragonsoft.duceap.commons.util.json.JsonUtils;
+import feign.FeignException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.core.annotation.Order;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Component;
 import org.springframework.validation.BindException;
 import org.springframework.validation.FieldError;
@@ -45,16 +49,27 @@ public class RespExceptionHandler implements HandlerExceptionResolver {
             PrintWriter writer = response.getWriter();
             ResponseStatus fail = null;
             if (ex instanceof ConstraintViolationException) {
-                response.setStatus(HttpCode.PARAM_VERIFY_ERROR.getCode());
-                fail = new ResponseStatus(String.valueOf(ErrorCode.ERROR_PARAMS_VERIFY.getCode()), String.format(ErrorCode.ERROR_PARAMS_VERIFY.getMsg(), ex.getMessage()));
+                response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
+                fail = new ResponseStatus(String.valueOf(ErrorCodeEnum.REQUEST_PARAM.getValue()), String.format(ErrorCodeEnum.REQUEST_PARAM.getLabel(), ex.getMessage()));
             } else if (ex instanceof MethodArgumentNotValidException) {
-                response.setStatus(HttpCode.PARAM_VERIFY_ERROR.getCode());
+                response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
                 String msg = getValidMessage((MethodArgumentNotValidException) ex);
-                fail = new ResponseStatus(String.valueOf(ErrorCode.ERROR_PARAMS_VERIFY.getCode()), String.format(ErrorCode.ERROR_PARAMS_VERIFY.getMsg(), msg));
+                fail = new ResponseStatus(String.valueOf(ErrorCodeEnum.REQUEST_PARAM.getValue()), String.format(ErrorCodeEnum.REQUEST_PARAM.getLabel(), msg));
             } else if (ex instanceof BindException) {
-                response.setStatus(HttpCode.PARAM_VERIFY_ERROR.getCode());
+                response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
                 String message = Objects.requireNonNull(((BindException) ex).getFieldError()).getDefaultMessage();
-                fail = new ResponseStatus(String.valueOf(ErrorCode.ERROR_PARAMS_VERIFY.getCode()), String.format(ErrorCode.ERROR_PARAMS_VERIFY.getMsg(), message));
+                fail = new ResponseStatus(String.valueOf(ErrorCodeEnum.REQUEST_PARAM.getValue()), String.format(ErrorCodeEnum.REQUEST_PARAM.getLabel(), message));
+            } else if (ex instanceof FeignException) {
+                String message = ex.getMessage();
+                if (message.contains(GmConfidentialityException.ERROR_MESSAGE)) {
+                    fail = ResponseStatus.fail(String.valueOf(HttpStatus.NOT_ACCEPTABLE.value()), GmConfidentialityException.ERROR_MESSAGE);
+                } else if (message.contains(GmIntegrityException.ERROR_MESSAGE)) {
+                    fail = ResponseStatus.fail(String.valueOf(HttpStatus.NOT_ACCEPTABLE.value()), GmIntegrityException.ERROR_MESSAGE);
+                } else if (message.contains(GmNonRepudiationException.ERROR_MESSAGE)) {
+                    fail = ResponseStatus.fail(String.valueOf(HttpStatus.NOT_ACCEPTABLE.value()), GmNonRepudiationException.ERROR_MESSAGE);
+                } else {
+                    fail = ResponseStatus.fail("500", "未知异常[" + ex.getMessage() + "]");
+                }
             } else {
                 fail = ResponseStatus.fail("500", "未知异常[" + ex.getMessage() + "]");
             }

+ 9 - 6
src/main/java/com/dragoninfo/dcuc/authweb/interceptor/AuthBeforeResInterceptor.java

@@ -2,7 +2,7 @@ package com.dragoninfo.dcuc.authweb.interceptor;
 
 import cn.hutool.core.util.StrUtil;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
-import com.dragoninfo.dcuc.authweb.business.HwIdentityBusiness;
+import com.dragoninfo.dcuc.auth.auth.facade.IBimBusinessFacade;
 import com.dragoninfo.dcuc.authweb.config.DcucAuthWebConfig;
 import com.dragoninfo.dcuc.authweb.enums.CheckTypeEnum;
 import com.dragoninfo.dcuc.authweb.exception.EvidenceException;
@@ -35,7 +35,7 @@ public class AuthBeforeResInterceptor implements HandlerInterceptor {
     private IApplyInfoFacade applyInfoFacade;
 
     @Autowired
-    private HwIdentityBusiness hwIdentityBusiness;
+    private IBimBusinessFacade bimBusinessFacade;
 
     @Autowired
     private DcucAuthWebConfig dcucAuthWebConfig;
@@ -76,11 +76,9 @@ public class AuthBeforeResInterceptor implements HandlerInterceptor {
                     throw new EvidenceException(HttpStatus.MULTIPLE_CHOICES.value(), "header参数:appCode无权限,或appCode错误");
                 }
 
-                request.setAttribute("idcard", idcard);
-                request.setAttribute("appCode", appCode);
-
                 return true;
             }
+            throw new EvidenceException(HttpStatus.MULTIPLE_CHOICES.value(), "基础凭据校验失败");
 
         } else if (checkTypeEnum.equals(CheckTypeEnum.TOKEN)) {
 
@@ -93,8 +91,13 @@ public class AuthBeforeResInterceptor implements HandlerInterceptor {
                     throw new EvidenceException(HttpStatus.MULTIPLE_CHOICES.value(), "header参数不能为空");
                 }
 
-                return hwIdentityBusiness.checkToken(userToken, appToken);
+                return bimBusinessFacade.checkToken(userToken, appToken);
             }
+
+            throw new EvidenceException(HttpStatus.MULTIPLE_CHOICES.value(), "令牌凭据校验失败");
+
+        } else if (checkTypeEnum.equals(CheckTypeEnum.NONE)) {
+            return true;
         }
 
         throw new EvidenceException(HttpStatus.MULTIPLE_CHOICES.value(), "请传入凭据");

+ 113 - 0
src/main/java/com/dragoninfo/dcuc/authweb/interceptor/SecurityAccessTokenResolver.java

@@ -0,0 +1,113 @@
+package com.dragoninfo.dcuc.authweb.interceptor;
+
+import cn.hutool.core.util.StrUtil;
+import com.dragoninfo.dcuc.auth.auth.facade.IBimBusinessFacade;
+import com.dragoninfo.dcuc.auth.auth.vo.bim.BimUserInfoItemRespVO;
+import com.dragoninfo.dcuc.common.Constants;
+import com.dragoninfo.dcuc.user.user.entity.UserInfo;
+import com.dragoninfo.dcuc.user.user.facade.IUserFacade;
+import com.dragonsoft.duceap.base.api.security.ISecurityAccessTokenResolver;
+import com.dragonsoft.duceap.base.entity.security.BaseSecurityUser;
+import com.dragonsoft.duceap.base.entity.security.SecurityUser;
+import com.dragonsoft.duceap.commons.util.UrlMatcher;
+import com.dragonsoft.duceap.commons.util.json.JsonUtils;
+import com.dragonsoft.duceap.security.jwt.securityaccess.SecurityAccessTokenProperties;
+import com.dragonsoft.duceap.security.jwt.securityaccess.SecurityAccessUserCacheResolver;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.web.ServerProperties;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author huangzqa
+ * @date 2021/4/15
+ **/
+@Slf4j
+@Component
+public class SecurityAccessTokenResolver implements ISecurityAccessTokenResolver {
+
+    @Autowired
+    private SecurityAccessTokenProperties secAccessProp;
+
+    @Autowired(required = false)
+    private SecurityAccessUserCacheResolver cacheResolver;
+
+    @Autowired
+    private IBimBusinessFacade bimBusinessFacade;
+
+    @Autowired
+    private IUserFacade userFacade;
+
+    @Autowired
+    private ServerProperties serverProperties;
+
+    public static final String FILTER_URL = "/js/*|/img/*|/css/*|/api/*|/*.png|/rest/*|/webSocket/*|" +
+            "/oauthLogin/*|/authorizationPage.html|/importAuthorizationFile.html|/license/LicenseManagerServlet|" +
+            "/authorizationFile/";
+
+    @Override
+    public BaseSecurityUser resolve(HttpServletRequest request) {
+        String contextPath = serverProperties.getServlet().getContextPath();
+        String requestUri = request.getRequestURI();
+        log.debug("Security filter origin uri:{}", requestUri);
+
+        // 去除上下文
+        requestUri = requestUri.substring(contextPath.length());
+
+        log.debug("Security filter not context uri:{}", requestUri);
+
+        String[] splitUrls = FILTER_URL.split("/|");
+
+        if (UrlMatcher.matches(requestUri, splitUrls)) {
+            log.debug("URI:{} Not need get user info.", requestUri);
+            return null;
+        }
+
+        String userToken = request.getHeader(secAccessProp.getUserTokenHeaderName());
+        String appToken = request.getHeader(Constants.APP_TOKEN);
+
+        log.info("userToken:{},appToken:{}", userToken, appToken);
+
+        if (cacheResolver != null) {
+            //从缓存中取
+            SecurityUser securityUserCache = (SecurityUser) cacheResolver.getIfPresent(cacheResolver.cacheKey(userToken));
+
+            if (securityUserCache != null) {
+                log.info("Cache securityUserCache:{}", JsonUtils.toJSONString(securityUserCache));
+
+                return securityUserCache;
+            }
+        }
+
+        if (StrUtil.isBlank(userToken)) {
+            return null;
+        }
+
+        BimUserInfoItemRespVO userInfoItemRespVO = bimBusinessFacade.getUserInfoByUserToken(userToken);
+        String sfzh = userInfoItemRespVO.getSfzh();
+
+        UserInfo userInfo = userFacade.detailBySfzh(sfzh);
+        log.info("idcard:{}, userInfo :{}", sfzh, JsonUtils.toJSONString(userInfo));
+
+        SecurityUser securityUser = new SecurityUser();
+        securityUser.setId(userInfo.getId());
+        securityUser.setName(userInfo.getName());
+        securityUser.setUserName(userInfo.getIdcard());
+        securityUser.setPoliceNo(userInfo.getPoliceNumber());
+        securityUser.setIdcard(userInfo.getIdcard());
+        securityUser.setSecurityOrg(userInfo.getOrgCode());
+        securityUser.setSecurityOrgName(userInfo.getOrgName());
+
+        //放入缓存
+        if (cacheResolver != null) {
+            cacheResolver.put(cacheResolver.cacheKey(userToken), securityUser);
+        }
+
+        log.info("return idcard:{}, securityUser :{}", sfzh, JsonUtils.toJSONString(securityUser));
+
+        return securityUser;
+    }
+
+}

+ 0 - 61
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/appservice/ahfk/AhfkAppController.java

@@ -1,61 +0,0 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.api.appservice.ahfk;
-
-import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
-import com.dragoninfo.dcuc.authweb.vo.ahfk.AhfkAppResultVo;
-import com.dragoninfo.dcuc.common.entity.ApiPageReq;
-import com.dragoninfo.dcuc.common.entity.ApiResult;
-import com.dragoninfo.dcuc.common.entity.ApiSearchReq;
-import com.dragoninfo.dcuc.common.utils.SearchableUtil;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 安徽FK应用接口
- *
- * @author huangzqa
- * @date 2021/1/22
- **/
-@RestController
-@RequestMapping("/api/app-service/ah-fk/apps/")
-public class AhfkAppController {
-
-    @Autowired
-    private IApplyInfoFacade applyInfoFacade;
-
-    @PostMapping("search")
-    public ApiResult search(@RequestBody ApiSearchReq apiSearchReq) {
-
-        Searchable searchable;
-        try {
-            ApiPageReq apiPageReq = apiSearchReq.getPage();
-            searchable = Searchable.newSearchable();
-            searchable = SearchableUtil.parseApiPageReq(searchable, apiPageReq, 1000);
-        } catch (IllegalArgumentException e) {
-            String message = e.getMessage();
-            return ApiResult.setFailMessage(message);
-        }
-
-        Page<ApplyInfo> page = applyInfoFacade.applyInfoPage(searchable.toSearchDTO());
-        List<ApplyInfo> content = page.getContent();
-
-        List<AhfkAppResultVo> appResultVoList = new ArrayList<>(content.size());
-        for (ApplyInfo applyInfo : content) {
-            AhfkAppResultVo ahfkAppResultVo = new AhfkAppResultVo();
-            ahfkAppResultVo.setAppName(applyInfo.getApplyName());
-            ahfkAppResultVo.setAppCode(applyInfo.getApplyCode());
-            appResultVoList.add(ahfkAppResultVo);
-        }
-
-        return ApiResult.setSuccessPage(page.getTotalElements(), appResultVoList);
-    }
-
-}

+ 0 - 185
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/ahfk/AhfkAuthorityStatistics.java

@@ -1,185 +0,0 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.ahfk;
-
-import cn.hutool.core.util.StrUtil;
-import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
-import com.dragoninfo.dcuc.auth.auth.facade.IRoleInfoFacade;
-import com.dragoninfo.dcuc.auth.auth.facade.IStaffAssignAuthInfoFacade;
-import com.dragoninfo.dcuc.auth.power.facade.IAppFunInfoFacade;
-import com.dragoninfo.dcuc.authweb.vo.ahfk.*;
-import com.dragoninfo.dcuc.common.entity.ApiResult;
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author huangzqa
- * @date 2021/1/25
- **/
-@RestController
-@RequestMapping("/api/auth-service/ah-fk/authority-statistics/")
-public class AhfkAuthorityStatistics {
-
-    /**
-     * 最大传入数量
-     */
-    private static final int MAX_REQUEST_LIMIT = 10;
-    @Autowired
-    private IStaffAssignAuthInfoFacade assignAuthInfoFacade;
-
-    @Autowired
-    private IApplyInfoFacade applyInfoFacade;
-
-    @Autowired
-    private IOrgInfoFacade orgInfoFacade;
-
-    @Autowired
-    private IRoleInfoFacade roleInfoFacade;
-
-    @Autowired
-    private IAppFunInfoFacade appFunInfoFacade;
-
-    @PostMapping("apps")
-    public ApiResult apps(@RequestBody AhfkStatisticsAppReqVo ahfkStatisticsAppReqVo) {
-
-        if (ahfkStatisticsAppReqVo == null
-                || ahfkStatisticsAppReqVo.getAppCode() == null
-                || ahfkStatisticsAppReqVo.getAppCode().isEmpty()
-        ) {
-            return ApiResult.setFailMessage("请传入正确的应用代码");
-        }
-
-        List<String> appCodeList = ahfkStatisticsAppReqVo.getAppCode();
-
-        if (appCodeList.size() > MAX_REQUEST_LIMIT) {
-            return ApiResult.setFailMessage(String.format("单次最大传入%s个", MAX_REQUEST_LIMIT));
-        }
-
-        List<AhfkStatisticsAppRespVo> appRespVoList = new ArrayList<>(appCodeList.size());
-
-        for (String appCode : appCodeList) {
-            String appId = applyInfoFacade.codeConvertToId(appCode);
-            if (StrUtil.isBlank(appId)) {
-                return ApiResult.setFailMessage(String.format("应用代码 %s 不存在", appCode));
-            }
-
-            Integer number = assignAuthInfoFacade.getAppIdNumber(appId);
-            AhfkStatisticsAppRespVo ahfkStatisticsAppRespVo = new AhfkStatisticsAppRespVo();
-            ahfkStatisticsAppRespVo.setAppCode(appCode);
-            ahfkStatisticsAppRespVo.setNumber(number);
-
-            appRespVoList.add(ahfkStatisticsAppRespVo);
-        }
-
-        return ApiResult.setSuccessResult(appRespVoList);
-    }
-
-    @PostMapping("functions")
-    public ApiResult functions(@RequestBody AhfkStatisticsFuncReqVo reqVo) {
-
-        if (reqVo == null
-                || reqVo.getResourceCode() == null
-                || reqVo.getResourceCode().isEmpty()
-        ) {
-            return ApiResult.setFailMessage("请传入正确的资源代码");
-        }
-
-        List<String> reqCodeList = reqVo.getResourceCode();
-        if (reqCodeList.size() > MAX_REQUEST_LIMIT) {
-            return ApiResult.setFailMessage(String.format("单次最大传入%s个", MAX_REQUEST_LIMIT));
-        }
-
-        String appCode = reqVo.getAppCode();
-        if (StrUtil.isBlank(appCode)) {
-            return ApiResult.setFailMessage("请传入正确的应用代码");
-        }
-
-        String appId = applyInfoFacade.codeConvertToId(appCode);
-
-        if (StrUtil.isBlank(appId)) {
-            return ApiResult.setFailMessage("请传入正确的应用代码");
-        }
-
-        List<AhfkStatisticsFuncRespVo> respVoList = new ArrayList<>(reqCodeList.size());
-
-        for (String reqCode : reqCodeList) {
-            AppFunInfo appFunInfo = appFunInfoFacade.getByAppAndFuncCode(appId, reqCode);
-            if (appFunInfo == null || StrUtil.isBlank(appFunInfo.getId())) {
-                return ApiResult.setFailMessage(String.format("资源代码 %s 不存在", reqCode));
-            }
-
-            String appFunInfoId = appFunInfo.getId();
-            Integer funcNumber = assignAuthInfoFacade.getFuncNumber(appId, appFunInfoId);
-
-            AhfkStatisticsFuncRespVo respVo = new AhfkStatisticsFuncRespVo();
-            respVo.setAppCode(appCode);
-            respVo.setResourceCode(reqCode);
-            respVo.setNumber(funcNumber);
-
-            respVoList.add(respVo);
-        }
-
-        return ApiResult.setSuccessResult(respVoList);
-    }
-
-    @PostMapping("orgs/roles")
-    public ApiResult orgsRoles(@RequestBody AhfkStatisticsOrgRoleReqVo reqVo) {
-
-        if (reqVo == null
-                || reqVo.getOrgCode() == null
-                || reqVo.getOrgCode().isEmpty()
-                || reqVo.getRoleCode() == null
-                || reqVo.getRoleCode().isEmpty()
-        ) {
-            return ApiResult.setFailMessage("请传入正确的机构、角色代码");
-        }
-
-        List<String> orgCodeList = reqVo.getOrgCode();
-        List<String> roleCodeList = reqVo.getRoleCode();
-
-        if ((orgCodeList.size() > MAX_REQUEST_LIMIT)
-                || (roleCodeList.size() > MAX_REQUEST_LIMIT)) {
-            return ApiResult.setFailMessage(String.format("单次最大传入%s个", MAX_REQUEST_LIMIT));
-        }
-
-        List<AhfkStatisticsOrgRoleRespVo> respVoList = new ArrayList<>();
-
-        for (String orgCode : orgCodeList) {
-            OrgInfo orgInfo = orgInfoFacade.getOrgInfoByCode(orgCode);
-            if (orgInfo == null || StrUtil.isBlank(orgInfo.getId())) {
-                return ApiResult.setFailMessage(String.format("机构代码 %s 不存在", orgCode));
-            }
-            String orgId = orgInfo.getId();
-
-            for (String roleCode : roleCodeList) {
-                RoleInfo roleInfo = roleInfoFacade.getRoleInfoByCode(roleCode);
-                if (roleInfo == null || StrUtil.isBlank(roleInfo.getId())) {
-                    return ApiResult.setFailMessage(String.format("角色代码 %s 不存在", roleCode));
-                }
-
-                String roleId = roleInfo.getId();
-
-                Integer number = assignAuthInfoFacade.getOrgIdRoleIdNumber(orgId, roleId);
-                ApplyInfo applyInfo = applyInfoFacade.applyDetail(roleInfo.getAppId());
-                AhfkStatisticsOrgRoleRespVo respVo = new AhfkStatisticsOrgRoleRespVo();
-                respVo.setOrgCode(orgCode);
-                respVo.setRoleCode(roleCode);
-                respVo.setNumber(number);
-                respVo.setAppName(applyInfo.getApplyName());
-                respVo.setRoleName(roleInfo.getName());
-                respVoList.add(respVo);
-            }
-        }
-
-        return ApiResult.setSuccessResult(respVoList);
-    }
-}

+ 0 - 84
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/ahfk/AhfkFunctionController.java

@@ -1,84 +0,0 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.ahfk;
-
-import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
-import com.dragoninfo.dcuc.auth.power.facade.IAppFunInfoFacade;
-import com.dragoninfo.dcuc.authweb.vo.ahfk.AhfkFunctionResultVo;
-import com.dragoninfo.dcuc.common.entity.ApiResult;
-import com.dragoninfo.dcuc.common.entity.ApiSearchReq;
-import com.dragoninfo.dcuc.common.utils.SearchableUtil;
-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.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author huangzqa
- * @date 2021/1/22
- **/
-@RestController
-@RequestMapping("/api/auth-service/ah-fk/functions/")
-public class AhfkFunctionController {
-
-    @Autowired
-    private IAppFunInfoFacade appFunInfoFacade;
-
-    @Autowired
-    private IApplyInfoFacade applyInfoFacade;
-
-    @PostMapping("search")
-    public ApiResult search(@RequestBody ApiSearchReq apiSearchReq) {
-        Map<String, SearchOperator[]> requestMap = new HashMap<>();
-        requestMap.put("appCode", new SearchOperator[]{SearchOperator.eq});
-
-        Searchable searchable;
-        try {
-            searchable = SearchableUtil.parseApiSearchReqToSearchable(apiSearchReq, requestMap, 1000);
-            Condition appCode = searchable.getSearchFilterByKey("appCode_eq");
-            if (appCode!=null){
-                searchable.removeSearchFilter("appCode_eq");
-                ApplyInfo applyInfo = applyInfoFacade.getAppByCode((String) appCode.getValue());
-                if (applyInfo==null){
-                    return ApiResult.setFailMessage(String.format("应用代码 %s 不存在", appCode.getValue()));
-                }
-                searchable.addSearchFilter("appId",SearchOperator.eq,applyInfo.getId());
-            }
-        } catch (IllegalArgumentException e) {
-            String message = e.getMessage();
-            return ApiResult.setFailMessage(message);
-        }
-
-        Page<AppFunInfo> page = appFunInfoFacade.page(searchable.toSearchDTO());
-        List<AppFunInfo> content = page.getContent();
-        List<AhfkFunctionResultVo> resultVoList = new ArrayList<>(content.size());
-        for (AppFunInfo appFunInfo : content) {
-            String code = appFunInfo.getCode();
-            String name = appFunInfo.getName();
-            String parentId = appFunInfo.getParentId();
-
-            String appId = appFunInfo.getAppId();
-            ApplyInfo applyDetail = applyInfoFacade.applyDetail(appId);
-
-            AhfkFunctionResultVo functionResultVo = new AhfkFunctionResultVo();
-            functionResultVo.setAppCode(applyDetail.getApplyCode());
-            functionResultVo.setResourceCode(code);
-            functionResultVo.setResourceName(name);
-            functionResultVo.setUpResourceCode(parentId);
-            resultVoList.add(functionResultVo);
-        }
-
-        return ApiResult.setSuccessPage(page.getTotalElements(), resultVoList);
-    }
-
-}

+ 0 - 97
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/ahfk/AhfkRoleController.java

@@ -1,97 +0,0 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.ahfk;
-
-import cn.hutool.core.util.StrUtil;
-import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
-import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthInfo;
-import com.dragoninfo.dcuc.auth.auth.facade.IRoleInfoFacade;
-import com.dragoninfo.dcuc.auth.auth.facade.IStaffAssignAuthInfoFacade;
-import com.dragoninfo.dcuc.auth.auth.vo.RoleInfoVO;
-import com.dragoninfo.dcuc.authweb.vo.ahfk.AhfkRoleResultVo;
-import com.dragoninfo.dcuc.common.entity.ApiPageReq;
-import com.dragoninfo.dcuc.common.entity.ApiResult;
-import com.dragoninfo.dcuc.common.entity.ApiSearchReq;
-import com.dragoninfo.dcuc.common.utils.SearchableUtil;
-import com.dragoninfo.dcuc.user.user.entity.UserInfo;
-import com.dragoninfo.dcuc.user.user.facade.IUserFacade;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.core.search.Searchable;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author huangzqa
- * @date 2021/1/25
- **/
-@RestController
-@RequestMapping("/api/auth-service/ah-fk/roles/")
-public class AhfkRoleController {
-
-    @Autowired
-    private IRoleInfoFacade roleInfoFacade;
-
-    @Autowired
-    private IUserFacade userFacade;
-
-    @Autowired
-    private IStaffAssignAuthInfoFacade staffAssignAuthInfoFacade;
-
-
-    @PostMapping("search")
-    public ApiResult search(@RequestBody ApiSearchReq apiSearchReq) {
-        Searchable searchable;
-        try {
-            ApiPageReq apiPageReq = apiSearchReq.getPage();
-            searchable = Searchable.newSearchable();
-            searchable = SearchableUtil.parseApiPageReq(searchable, apiPageReq, 1000);
-        } catch (IllegalArgumentException e) {
-            String message = e.getMessage();
-            return ApiResult.setFailMessage(message);
-        }
-
-        SearchDTO searchDTO = searchable.toSearchDTO();
-        Page<RoleInfoVO> page = roleInfoFacade.page(searchDTO);
-
-        List<RoleInfoVO> content = page.getContent();
-        List<AhfkRoleResultVo> ahfkRoleResultVoList = new ArrayList<>(content.size());
-        for (RoleInfoVO roleInfoVO : content) {
-            String code = roleInfoVO.getCode();
-            String name = roleInfoVO.getName();
-            AhfkRoleResultVo ahfkRoleResultVo = new AhfkRoleResultVo();
-            ahfkRoleResultVo.setRoleCode(code);
-            ahfkRoleResultVo.setRoleName(name);
-            ahfkRoleResultVoList.add(ahfkRoleResultVo);
-        }
-        return ApiResult.setSuccessPage(page.getTotalElements(), ahfkRoleResultVoList);
-    }
-
-    @GetMapping("{idcard}")
-    public ApiResult search(@PathVariable("idcard") String idcard) {
-        if (StrUtil.isBlank(idcard)) {
-            return ApiResult.setFailMessage("请传入身份证号");
-        }
-
-        UserInfo userInfo = userFacade.detailBySfzh(idcard);
-        if (userInfo == null) {
-            return ApiResult.setFailMessage("用户不存在");
-        }
-
-        String userInfoId = userInfo.getId();
-        List<StaffAssignAuthInfo> staffAssignAuthInfos = staffAssignAuthInfoFacade.getByStaffId(userInfoId);
-        List<AhfkRoleResultVo> ahfkRoleResultVoList = new ArrayList<>(staffAssignAuthInfos.size());
-        for (StaffAssignAuthInfo staffAssignAuthInfo : staffAssignAuthInfos) {
-            String roleId = staffAssignAuthInfo.getRoleId();
-            RoleInfo roleInfo = roleInfoFacade.get(roleId);
-            String roleInfoCode = roleInfo.getCode();
-            String roleName = roleInfo.getName();
-            AhfkRoleResultVo ahfkRoleResultVo = new AhfkRoleResultVo();
-            ahfkRoleResultVo.setRoleCode(roleInfoCode);
-            ahfkRoleResultVo.setRoleName(roleName);
-            ahfkRoleResultVoList.add(ahfkRoleResultVo);
-        }
-        return ApiResult.setSuccessResult(ahfkRoleResultVoList);
-    }
-}

+ 79 - 15
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/controller/AuthServiceController.java

@@ -7,10 +7,11 @@ import com.dragoninfo.dcuc.app.entity.ApplyInfo;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.dto.AppDataSensitiveLevelDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
-import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFacade;
+import com.dragoninfo.dcuc.auth.auth.facade.IBimBusinessFacade;
+import com.dragoninfo.dcuc.auth.auth.facade.IBimBusinessFacade;
+import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFlowFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthResultFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IStaffAssignAuthInfoFacade;
-import com.dragoninfo.dcuc.authweb.business.HwIdentityBusiness;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.AppAuthRespVO;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ServiceAuthResultVo;
 import com.dragoninfo.dcuc.authweb.util.VersionUtils;
@@ -51,7 +52,7 @@ import java.util.stream.Collectors;
 public class AuthServiceController {
 
     @Autowired
-    private IServiceAuthFacade serviceAuthFacade;
+    private IServiceAuthFlowFacade serviceAuthFlowFacade;
 
     @Autowired
     private IServiceAuthResultFacade serviceAuthResultFacade;
@@ -66,30 +67,46 @@ public class AuthServiceController {
     private IUserFacade userFacade;
 
     @Autowired
-    private HwIdentityBusiness hwIdentityBusiness;
+    private IBimBusinessFacade bimBusinessFacade;
 
-    @PostMapping(value = "apps/authentication")
+    @GetMapping(value = "apps/authentication")
     @ApiOperation(value = "应用级鉴权")
     @ApiImplicitParams({@ApiImplicitParam(name = "appsAuthenticationReq", value = "应用级鉴权VO")})
     public ApiResult appsAuthentication(@RequestHeader(Constants.DCUC_USER_TOKEN) String userToken) {
 
-        boolean checkUserToken = hwIdentityBusiness.checkUserToken(userToken);
+        if (StrUtil.isBlank(userToken)) {
+            return ApiResult.setFailMessage("请传入用户令牌");
+        }
+
+        boolean checkUserToken = bimBusinessFacade.checkUserToken(userToken);
 
         if (!checkUserToken) {
             return ApiResult.setFailMessage("用户令牌无效");
         }
 
         DecodedJWT decode = JWT.decode(userToken);
-        String idcard = decode.getClaim("idcard").asString();
+        String idcard = decode.getClaim("idCard").asString();
+        int exp = decode.getClaim("exp").asInt();
+        int current = (int) (System.currentTimeMillis() / 1000);
+
+        int expAt = exp - current;
+
+        log.info("UserToken:{} , idcard:{}, expAt:{}", userToken, idcard, expAt);
 
-        log.info("UserToken:{} , idcard:{}", userToken, idcard);
+        if (expAt < 0) {
+            return ApiResult.setFailMessage("令牌已失效");
+        }
 
         UserInfo userInfo = userFacade.detailBySfzh(idcard);
         if (userInfo == null) {
             return ApiResult.setFailMessage("用户不存在");
         }
+
+        bimBusinessFacade.cacheUserToken(idcard, userToken, expAt);
+
         String userId = userInfo.getId();
         List<AppDataSensitiveLevelDTO> appList = staffAssignAuthInfoFacade.getAppLitByUserId(userId);
+
         List<AppAuthRespVO> respVOList = appList.stream().map(AppAuthRespVO::parseDto)
                 .collect(Collectors.toList());
         return ApiResult.setSuccessResult(respVOList);
@@ -113,7 +130,7 @@ public class AuthServiceController {
         if (applyInfo == null || BooleanEnum.TRUE.value.equals(applyInfo.getApplyStatus())) {
             return ApiResult.setFailMessage("app is not enabled");
         }
-        Object o = serviceAuthFacade.serviceAuthentication(appCode);
+        Object o = serviceAuthFlowFacade.serviceAuthentication(appCode);
         return ApiResult.setSuccessResult(o);
     }
 
@@ -125,6 +142,7 @@ public class AuthServiceController {
         Map<String, SearchOperator[]> requestMap = new HashMap<>();
         requestMap.put("appCode", new SearchOperator[]{SearchOperator.eq});
         requestMap.put("serviceCode", new SearchOperator[]{SearchOperator.eq});
+        requestMap.put("serviceStatus", new SearchOperator[]{SearchOperator.ne,SearchOperator.eq,SearchOperator.in});
         Searchable searchable;
         try {
             searchable = SearchableUtil.parseApiSearchReqToSearchable(apiSearchReq, requestMap, 1000);
@@ -147,19 +165,65 @@ public class AuthServiceController {
     }
 
     @ApiOperation(value = "服务授权撤销")
-    @ApiImplicitParams({@ApiImplicitParam(name = "appCode", value = "应用编码"),
-            @ApiImplicitParam(name = "serviceCode", value = "服务编码")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "appCode", value = "应用编码"),
+            @ApiImplicitParam(paramType = "path", name = "serviceCode", value = "服务编码")
     })
     @DeleteMapping("service/{appCode}/{serviceCode}")
-    public ApiResult delService(@PathVariable String appCode, @PathVariable String serviceCode)  {
+    public ApiResult delService(@PathVariable String appCode, @PathVariable String serviceCode) {
         try {
-            ServiceAuthResultDTO authDto = serviceAuthResultFacade.getDetailByAppAndService(appCode,serviceCode);
-            serviceAuthResultFacade.delServiceAuthResult(authDto.getId());
+            ServiceAuthResultDTO authDto = serviceAuthResultFacade.getDetailByAppAndService(appCode, serviceCode);
+            serviceAuthResultFacade.delServiceAuthResult(authDto);
             return ApiResult.setSuccess();
-        } catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
             return ApiResult.setFailMessage("服务授权撤销失败");
         }
+    }
+
+
+
+    /**
+     * 提供给服务方查询
+     * @param apiSearchReq
+     * @return
+     */
+    //TODO
+    // 授权结果查询需要用到app服务,后期需要将连接查询拆分
+    // 并且需要添加授权申请详情表,与申请表是一对多的关系。
+    @ApiOperation(value = "服务授权结果列表")
+    @ApiImplicitParams({@ApiImplicitParam(name = "ApiSearchReq", value = "授权服务列表查询vo")})
+    @PostMapping("result/search")
+    public ApiResult serviceResultSearch(@RequestBody ApiSearchReq apiSearchReq) {
+        Map<String, SearchOperator[]> requestMap = new HashMap<>();
+        requestMap.put("appName", new SearchOperator[]{SearchOperator.eq, SearchOperator.like});
+        requestMap.put("appOrgName", new SearchOperator[]{SearchOperator.eq, SearchOperator.like});
+        requestMap.put("appOrgCode", new SearchOperator[]{SearchOperator.eq});
+        requestMap.put("appManagerOrgName", new SearchOperator[]{SearchOperator.eq, SearchOperator.like});
+        requestMap.put("applicantName", new SearchOperator[]{SearchOperator.eq, SearchOperator.like});
+        requestMap.put("serviceName", new SearchOperator[]{SearchOperator.eq, SearchOperator.like});
+        requestMap.put("serviceManagerOrgCode", new SearchOperator[]{SearchOperator.eq});
+        requestMap.put("serviceManagerOrgName", new SearchOperator[]{SearchOperator.eq, SearchOperator.like});
+        requestMap.put("serviceStatus", new SearchOperator[]{SearchOperator.ne,SearchOperator.eq,SearchOperator.in});
+        requestMap.put("appStatus", new SearchOperator[]{SearchOperator.ne,SearchOperator.eq,SearchOperator.in});
+        Searchable searchable;
+        try {
+            searchable = SearchableUtil.parseApiSearchReqToSearchable(apiSearchReq, requestMap, 1000);
+        } catch (IllegalArgumentException e) {
+            String message = e.getMessage();
+            return ApiResult.setFailMessage(message);
+        }
+        Page<ServiceAuthResultDTO> serviceAuthResultDTOS = serviceAuthResultFacade.serviceResultPageJoinFlow(searchable.toSearchDTO());
+        List<ServiceAuthResultDTO> content = serviceAuthResultDTOS.getContent();
+        List<ServiceAuthResultVo> voList = new ArrayList<>(content.size());
 
+        content.forEach(item -> {
+            ServiceAuthResultVo vo = new ServiceAuthResultVo();
+            BeanUtils.copyProperties(item, vo);
+            vo.setServiceStatus(item.getAuthStatus());
+            vo.setPrivilegedTime(item.getAuthTime());
+            voList.add(vo);
+        });
+        return ApiResult.setSuccessPage(serviceAuthResultDTOS.getTotalElements(), voList);
     }
+
 }

+ 55 - 32
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/controller/WorkFlowApiController.java

@@ -1,14 +1,10 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.controller;
 
-import cn.hutool.core.util.StrUtil;
-import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-import com.dragoninfo.dcuc.app.entity.ServiceResource;
-import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
-import com.dragoninfo.dcuc.app.facade.IServiceResourceFacade;
 import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthFlowDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.WorkFlowResutlAcceptDTO;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
-import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFacade;
+import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFlowFacade;
+import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.AuthFlowRepeatCheckVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ResourceAuthInfoVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ServiceAuthFlowAcceptVo;
 import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.WorkFlowResutlAcceptVo;
@@ -32,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 
 /**
  * @author mazq
@@ -43,13 +40,7 @@ import javax.servlet.http.HttpServletRequest;
 public class WorkFlowApiController {
 
     @Autowired
-    private IServiceAuthFacade serviceAuthFacade;
-
-    @Autowired
-    private IApplyInfoFacade applyInfoFacade;
-
-    @Autowired
-    private IServiceResourceFacade serviceResourceFacade;
+    private IServiceAuthFlowFacade serviceAuthFlowFacade;
 
     /**
      * 服务授权工作单保存
@@ -62,35 +53,66 @@ public class WorkFlowApiController {
         String idcard = request.getHeader(Constants.IDCARD);
         String tonken = request.getHeader(Constants.DCUC_USER_TOKEN);
         String user = StringUtils.isNotBlank(idcard) ? idcard : tonken;
-        ResourceAuthInfoVo resourceInfo = serviceAuthFlowVo.getResourceInfo();
-        String visitorCode = resourceInfo.getVisitorCode();
-        ApplyInfo applyInfo = applyInfoFacade.getAppByCode(visitorCode);
-        if (applyInfo == null) {
-            return ApiResult.setFailMessage(String.format("应用代码 %s 不存在", visitorCode));
-        }
-
-        String visitResourceCode = resourceInfo.getVisitResourceCode();
-        String[] resourceCodArray = visitResourceCode.split(StrUtil.COMMA);
-        for (String resourceCode : resourceCodArray) {
-            ServiceResource serviceResource = serviceResourceFacade.detailByCode(resourceCode);
-            if (serviceResource == null) {
-                return ApiResult.setFailMessage(String.format("服务代码 %s 不存在", resourceCode));
-            }
-        }
-
         ServiceAuthFlowDTO dto = new ServiceAuthFlowDTO();
         setAppServiceInfo(dto, serviceAuthFlowVo);
         BeanUtils.copyProperties(serviceAuthFlowVo, dto, "serviceCodes", "serviceNames");
         dto.setUser(user);
-        ResponseDTO responseDTO = serviceAuthFacade.serviceAuthFlowSave(dto);
+        ResponseDTO responseDTO = serviceAuthFlowFacade.serviceAuthFlowSave(dto);
+        String statusCode = responseDTO.getStatusCode();
+        if (ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
+            return ApiResult.setSuccess();
+        } else {
+            ApiResult apiResult = ApiResult.setFailMessage(responseDTO.getMessage());
+            apiResult.setResult(responseDTO.getResult());
+            return apiResult;
+        }
+    }
+
+    /**
+     * 服务授权申请是否存在重复申请
+     */
+    @ApiOperation(value = "服务授权申请是否存在重复申请")
+    @ApiImplicitParams({@ApiImplicitParam(name = "authFlowRepeatCheckVo", value = "服务授权重复校验Vo")})
+    @PostMapping("auth-repeat-check")
+    @ResponseBody
+    public ApiResult authFlowRepeatCheck(@RequestBody AuthFlowRepeatCheckVo authFlowRepeatCheckVo){
+        String appCode = authFlowRepeatCheckVo.getAppCode();
+        List<String> serviceCodes = authFlowRepeatCheckVo.getServiceCodes();
+        ResponseDTO responseDTO = serviceAuthFlowFacade.authApplyCheck(appCode,serviceCodes);
+        String statusCode = responseDTO.getStatusCode();
+        if (ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
+            return ApiResult.setSuccess();
+        } else {
+            ApiResult apiResult = ApiResult.setFailMessage(responseDTO.getMessage());
+            apiResult.setResult(responseDTO.getResult());
+            return apiResult;
+        }
+    }
+
+
+    /**
+     * 服务授权撤销是否存在授权结果
+     */
+    @ApiOperation(value = "服务授权撤销是否存在授权结果")
+    @ApiImplicitParams({@ApiImplicitParam(name = "authFlowRepeatCheckVo", value = "服务授权重复校验Vo")})
+    @PostMapping("auth-cancel-check")
+    @ResponseBody
+    public ApiResult authCancelCheck(@RequestBody AuthFlowRepeatCheckVo authFlowRepeatCheckVo){
+        String appCode = authFlowRepeatCheckVo.getAppCode();
+        List<String> serviceCodes = authFlowRepeatCheckVo.getServiceCodes();
+        ResponseDTO responseDTO = serviceAuthFlowFacade.authCancelCheck(appCode,serviceCodes);
         String statusCode = responseDTO.getStatusCode();
         if (ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
             return ApiResult.setSuccess();
         } else {
-            return ApiResult.setFailMessage(responseDTO.getMessage());
+            ApiResult apiResult = ApiResult.setFailMessage(responseDTO.getMessage());
+            apiResult.setResult(responseDTO.getResult());
+            return apiResult;
         }
     }
 
+
+
     /**
      * 服务授权工作单审批结果处理
      * 提供接口
@@ -107,7 +129,7 @@ public class WorkFlowApiController {
         dto.setProcessInstanceId(flowResutlVo.getProcessInstanceId());
         dto.setRemark(flowResutlVo.getDesc());
         dto.setMessageId(flowResutlVo.getMessageId());
-        serviceAuthFacade.dealAuthFlowResult(dto);
+        serviceAuthFlowFacade.dealAuthFlowResult(dto);
         return ApiResult.setSuccess();
     }
 
@@ -122,4 +144,5 @@ public class WorkFlowApiController {
         dto.setServiceCodes(resourceInfo.getVisitResourceCode());
         dto.setServiceNames(resourceInfo.getVisitResourceName());
     }
+    
 }

+ 24 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/vo/AuthFlowRepeatCheckVo.java

@@ -0,0 +1,24 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/5/13
+ */
+@ApiModel(value = "服务授权申请重复校验参数Vo")
+@Data
+public class AuthFlowRepeatCheckVo {
+
+    @ApiModelProperty(value = "申请方编码(应用编码)")
+    private String appCode;
+
+    @ApiModelProperty(value = "访问资源编码集合(服务编码集合)")
+    private List<String> serviceCodes;
+
+
+}

+ 12 - 2
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/vo/ServiceAuthFlowAcceptVo.java

@@ -25,14 +25,18 @@ public class ServiceAuthFlowAcceptVo {
      * 流程类型
      */
     @ApiModelProperty(value = "流程类型")
-    @NotBlank
     private String processType;
+    /**
+     * 工单号
+     */
+    @ApiModelProperty(value = "申请单号")
+    private String applicantId;
+
 
     /**
      * 流程标识码
      */
     @ApiModelProperty(value = "流程标识码")
-    @NotBlank
     private String businessCode;
 
     /**
@@ -100,4 +104,10 @@ public class ServiceAuthFlowAcceptVo {
     @NotNull
     private ResourceAuthInfoVo resourceInfo;
 
+    /**
+     * 工作单类型
+     * SERVICE_AUTH-服务授权工作单 SERVICE_CANCEL-服务权限撤销工作单
+     */
+    @ApiModelProperty(value = "工作单类型 SERVICE_AUTH-服务授权工作单 SERVICE_CANCEL-服务权限撤销工作单")
+    private String flowType;
 }

+ 49 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/vo/ServiceAuthResultVo.java

@@ -20,6 +20,9 @@ public class ServiceAuthResultVo {
     @ApiModelProperty(value = "应用appName", required = true)
     private String appName;
 
+    @ApiModelProperty(value = "应用状态", required = true)
+    private String appStatus;
+
     @ApiModelProperty(value = "服务code", required = true)
     private String serviceCode;
 
@@ -29,7 +32,53 @@ public class ServiceAuthResultVo {
     @ApiModelProperty(value = "服务状态", required = true)
     private String serviceStatus;
 
+    @ApiModelProperty(value = "服务事权单位", required = true)
+    private String serviceOrgName;
+
+    @ApiModelProperty(value = "服务事权单位code", required = true)
+    private String serviceOrgCode;
+
+    @ApiModelProperty(value = "服务管理单位code", required = true)
+    private String serviceManagerOrgCode;
+
+    @ApiModelProperty(value = "服务管理单位", required = true)
+    private String serviceManagerOrgName;
+
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "授权时间", required = true)
     private Date privilegedTime;
+
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "授权申请时间", required = true)
+    private Date applyTime;
+
+    @ApiModelProperty(value = "申请人名字")
+    private String applicantName;
+
+    @ApiModelProperty(value = "申请人身份证")
+    private String applicantIdcard;
+
+    @ApiModelProperty(value = "申请人电话")
+    private String applicantPhoneNo;
+
+    @ApiModelProperty(value = "申请人机构名称")
+    private String applicantOrgName;
+
+    @ApiModelProperty(value = "申请人机构Code")
+    private String applicantOrgCode;
+
+    @ApiModelProperty(value = "应用管理单位名称")
+    private String appManagerOrgName;
+
+    @ApiModelProperty(value = "应用管理单位code")
+    private String appManagerOrgCode;
+
+    @ApiModelProperty(value = "应用事权单位名称")
+    private String appOrgName;
+
+    @ApiModelProperty(value = "应用事权单位名称")
+    private String appOrgCode;
+
+    @ApiModelProperty(value = "服务授权状态")
+    private String authStatus;
 }

+ 51 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v2/controller/AuthServiceV2Controller.java

@@ -0,0 +1,51 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v2.controller;
+
+import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
+import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthResultFacade;
+import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v2.vo.AuthResultDelVO;
+import com.dragoninfo.dcuc.authweb.util.VersionUtils;
+import com.dragoninfo.dcuc.common.entity.ApiResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Author yica
+ * @Date 2021/2/24 19:11
+ **/
+@RestController
+@Api(tags = {"权限管理对外开放接口"})
+@RequestMapping(value = "/api/auth-service/" + VersionUtils.VERSION_UID + "/")
+public class AuthServiceV2Controller {
+
+
+    @Autowired
+    private IServiceAuthResultFacade serviceAuthResultFacade;
+
+
+    @ApiOperation(value = "服务授权撤销")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "appCode", value = "应用编码"),
+            @ApiImplicitParam(paramType = "path", name = "serviceCode", value = "服务编码")
+    })
+    @PostMapping("service/del")
+    public ApiResult delService(@RequestBody AuthResultDelVO authResultDelVO) {
+        try {
+            ServiceAuthResultDTO authDto = serviceAuthResultFacade.
+                    getDetailByAppAndService(authResultDelVO.getAppCode(),authResultDelVO.getServiceCode());
+            authDto.setReason(authResultDelVO.getReason());
+            serviceAuthResultFacade.delServiceAuthResult(authDto);
+            return ApiResult.setSuccess();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return ApiResult.setFailMessage("服务授权撤销失败");
+        }
+    }
+
+
+}

+ 97 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v2/controller/WorkFlowApiV2Controller.java

@@ -0,0 +1,97 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v2.controller;
+
+import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
+import com.dragoninfo.dcuc.app.facade.IServiceResourceFacade;
+import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthFlowDTO;
+import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFlowFacade;
+import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ResourceAuthInfoVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ServiceAuthFlowAcceptVo;
+import com.dragoninfo.dcuc.common.Constants;
+import com.dragoninfo.dcuc.common.entity.ApiResult;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.commons.util.string.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author mazq
+ * @date 2021/2/24
+ */
+@Api(tags = {"服务授权审批工单处理接口"})
+@Controller
+@RequestMapping(value = "/api/auth-service/v2/workflow/")
+public class WorkFlowApiV2Controller {
+
+    @Autowired
+    private IServiceAuthFlowFacade serviceAuthFlowFacade;
+
+    @Autowired
+    private IApplyInfoFacade applyInfoFacade;
+
+    @Autowired
+    private IServiceResourceFacade serviceResourceFacade;
+   //流程code
+    private  final static String BS_CODE="service-auth-apply";
+    //名称(名称随便)
+    private  final static String BS_NAME="processName";
+    //流程业务类型
+    private  final static String BS_TYPE="auth-update";
+    /**
+     * 服务授权工作单保存
+     */
+    @ApiOperation(value = "服务授权工单保存")
+    @ApiImplicitParams({@ApiImplicitParam(name = "serviceAuthFlowVo", value = "服务授权工单保存Vo")})
+    @PostMapping("service")
+    @ResponseBody
+    public ApiResult serviceAuthFlowSave(@RequestBody @Validated ServiceAuthFlowAcceptVo serviceAuthFlowVo, HttpServletRequest request) {
+        String idcard = request.getHeader(Constants.IDCARD);
+        String tonken = request.getHeader(Constants.DCUC_USER_TOKEN);
+        String user = StringUtils.isNotBlank(idcard) ? idcard : tonken;
+        //放入流程标识码
+        if (serviceAuthFlowFacade.checkApplicantId(serviceAuthFlowVo.getApplicantId())) {
+            return ApiResult.setFailMessage(String.format("申请单号 %s 不是唯一", serviceAuthFlowVo.getApplicantId()));
+        }
+        serviceAuthFlowVo.setProcessType(BS_TYPE);
+        serviceAuthFlowVo.setBusinessCode(BS_CODE);
+        ServiceAuthFlowDTO dto = new ServiceAuthFlowDTO();
+        setAppServiceInfo(dto, serviceAuthFlowVo);
+        dto.setProcessName(BS_NAME);
+        BeanUtils.copyProperties(serviceAuthFlowVo, dto, "serviceCodes", "serviceNames");
+        dto.setUser(user);
+        ResponseDTO responseDTO = serviceAuthFlowFacade.serviceAuthFlowSave(dto);
+        String statusCode = responseDTO.getStatusCode();
+        if (ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
+            return ApiResult.setSuccess();
+        } else {
+            ApiResult apiResult = ApiResult.setFailMessage(responseDTO.getMessage());
+            apiResult.setResult(responseDTO.getResult());
+            return apiResult;
+        }
+    }
+
+
+    /**
+     * 设置申请单appCode和serviceCode信息
+     */
+    private void setAppServiceInfo(ServiceAuthFlowDTO dto, ServiceAuthFlowAcceptVo serviceAuthFlowVo) {
+        ResourceAuthInfoVo resourceInfo = serviceAuthFlowVo.getResourceInfo();
+        dto.setAppName(resourceInfo.getVisitorName());
+        dto.setAppCode(resourceInfo.getVisitorCode());
+        dto.setServiceCodes(resourceInfo.getVisitResourceCode());
+        dto.setServiceNames(resourceInfo.getVisitResourceName());
+    }
+
+}

+ 25 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v2/vo/AuthResultDelVO.java

@@ -0,0 +1,25 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v2.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author yica
+ * @Date 2021/5/13 10:27
+ **/
+@ApiModel(value = "资源信息")
+@Data
+public class AuthResultDelVO {
+
+    @ApiModelProperty(value = "应用code")
+    private String appCode;
+
+    @ApiModelProperty(value = "服务code")
+    private String serviceCode;
+
+    @ApiModelProperty(value = "理由")
+    private String reason;
+
+
+}

+ 2 - 2
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v3/controller/AuthV3ApiController.java

@@ -89,8 +89,8 @@ public class AuthV3ApiController {
     @DeleteMapping(value = "functions/{appCode}/{functionCode}")
 
     @ApiOperation(value = "推送资源")
-    @ApiImplicitParams({@ApiImplicitParam(name = "functionCode", value = "资源code"),
-            @ApiImplicitParam(name = "appCode", value = "应用code")})
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "appCode", value = "应用code"),
+            @ApiImplicitParam(paramType = "path", name = "functionCode", value = "资源code")})
     public ApiResult delFunctions(@PathVariable("functionCode") String functionCode,
                                   @PathVariable("appCode") String appCode) {
         if (StringUtils.isEmpty(functionCode)) {

+ 107 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v3/controller/WorkFlowApiV3Controller.java

@@ -0,0 +1,107 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v3.controller;
+
+import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthFlowDTO;
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowApplyTypeEnum;
+import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowTypeEnum;
+import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFlowFacade;
+import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ResourceAuthInfoVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.vo.ServiceAuthFlowAcceptVo;
+import com.dragoninfo.dcuc.common.Constants;
+import com.dragoninfo.dcuc.common.entity.ApiResult;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.commons.util.string.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author mazq
+ * @date 2021/2/24
+ */
+@Api(tags = {"服务授权审批工单处理接口"})
+@Controller
+@RequestMapping(value = "/api/auth-service/v3/workflow/")
+public class WorkFlowApiV3Controller {
+
+    @Autowired
+    private IServiceAuthFlowFacade serviceAuthFacade;
+
+   //流程code
+    private  final static String BS_CODE="service-auth-apply";
+    //名称(名称随便)
+    private  final static String BS_NAME="权限新增";
+    //流程业务类型
+    private  final static String BS_TYPE="auth-update";
+    //权限移除流程code
+    private  final static String BS_REMOVE_CODE="service-auth-remove";
+    //权限移除流程业务类型
+    private  final static String BS_REMOVE_TYPE="auth-update";
+    //权限移除流程业务类型
+    private  final static String BS_REMOVE_NAME="权限移除";
+
+    /**
+     * 服务授权工作单保存
+     */
+    @ApiOperation(value = "服务授权工单保存")
+    @ApiImplicitParams({@ApiImplicitParam(name = "serviceAuthFlowVo", value = "服务授权工单保存Vo")})
+    @PostMapping("service")
+    @ResponseBody
+    public ApiResult serviceAuthFlowSave(@RequestBody ServiceAuthFlowAcceptVo serviceAuthFlowVo, HttpServletRequest request) {
+        String idcard = request.getHeader(Constants.IDCARD);
+        String tonken = request.getHeader(Constants.DCUC_USER_TOKEN);
+        String user = StringUtils.isNotBlank(idcard) ? idcard : tonken;
+        if (StringUtils.isEmpty(serviceAuthFlowVo.getFlowType())){
+            return ApiResult.setFailMessage("工作单类型不能为空");
+        }
+        //放入流程标识码
+        if (serviceAuthFacade.checkApplicantId(serviceAuthFlowVo.getApplicantId())) {
+            return ApiResult.setFailMessage(String.format("申请单号 %s 不是唯一", serviceAuthFlowVo.getApplicantId()));
+        }
+        ServiceAuthFlowDTO dto = new ServiceAuthFlowDTO();
+        setAppServiceInfo(dto, serviceAuthFlowVo);
+        //销权
+//        if (WorkFlowTypeEnum.SERVICE_AUTH_CANCEL.getValue().equals(serviceAuthFlowVo.getFlowType())){
+//            dto.setProcessName(BS_REMOVE_NAME);
+//            dto.setProcessType(BS_REMOVE_TYPE);
+//            dto.setBusinessCode(BS_REMOVE_CODE);
+//        }else {
+            //授权
+            dto.setProcessName(BS_NAME);
+            dto.setProcessType(BS_TYPE);
+            dto.setBusinessCode(BS_CODE);
+//        }
+        BeanUtils.copyProperties(serviceAuthFlowVo, dto, "serviceCodes", "serviceNames");
+        dto.setUser(user);
+        ResponseDTO responseDTO = serviceAuthFacade.serviceAuthFlowSave(dto);
+        String statusCode = responseDTO.getStatusCode();
+        if (ResponseStatus.SUCCESS_CODE.equals(statusCode)) {
+            return ApiResult.setSuccess();
+        } else {
+            return ApiResult.setFailMessage(responseDTO.getMessage());
+        }
+    }
+
+
+    /**
+     * 设置申请单appCode和serviceCode信息
+     */
+    private void setAppServiceInfo(ServiceAuthFlowDTO dto, ServiceAuthFlowAcceptVo serviceAuthFlowVo) {
+        ResourceAuthInfoVo resourceInfo = serviceAuthFlowVo.getResourceInfo();
+        dto.setAppName(resourceInfo.getVisitorName());
+        dto.setAppCode(resourceInfo.getVisitorCode());
+        dto.setServiceCodes(resourceInfo.getVisitResourceCode());
+        dto.setServiceNames(resourceInfo.getVisitResourceName());
+    }
+
+}

+ 0 - 193
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/ApiController.java

@@ -1,193 +0,0 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.api.controller;
-
-import com.dragoninfo.dcuc.app.entity.ApplyInfo;
-import com.dragoninfo.dcuc.app.entity.ManufacturerInfo;
-import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
-import com.dragoninfo.dcuc.app.facade.IManufacturerInfoFacade;
-import com.dragoninfo.dcuc.user.user.entity.PostInfo;
-import com.dragoninfo.dcuc.user.user.entity.UserInfo;
-import com.dragoninfo.dcuc.user.user.enumresources.UserTypeEnum;
-import com.dragoninfo.dcuc.user.user.enumresources.YesNotEnum;
-import com.dragoninfo.dcuc.user.user.facade.IAccountFacade;
-import com.dragoninfo.dcuc.user.user.facade.IPostInfoFacade;
-import com.dragoninfo.dcuc.user.user.facade.IUserFacade;
-import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
-import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.entity.search.SearchDTO;
-import com.dragonsoft.duceap.commons.util.ObjectUtils;
-import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
-import com.dragonsoft.duceap.core.search.Searchable;
-import com.dragonsoft.duceap.core.search.enums.SearchOperator;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import java.lang.reflect.Field;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Administrator
- * @date 2018/6/25
- */
-@Controller
-@RequestMapping(value = "/api/")
-public class ApiController {
-
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    private static final String SERIAL_VERSION_UID = "serialVersionUID";
-    private static final String ALIAS = "ALIAS";
-
-    @Autowired
-    private IUserFacade userFacade;
-
-    @Autowired
-    private IAccountFacade accountFacade;
-
-
-    @Autowired
-    private IManufacturerInfoFacade manufacturerInfoFacade;
-
-    @Autowired
-    private IApplyInfoFacade applyInfoFacade;
-
-    @Autowired
-    private IUserInfoFacade userInfoFacade;
-
-    @Autowired
-    private IPostInfoFacade postInfoFacade;
-
-
-
-
-    /**
-     * 查询用户
-     * DcucLoginService 调用
-     * @param id
-     * @return
-     */
-    @RequestMapping(value = "users/id/{id}", method = RequestMethod.GET)
-    @ResponseBody
-    public Map userbyid(@PathVariable("id") String id) {
-        UserInfo userInfo = userFacade.detailById(id);
-        if (userInfo == null) {
-            return null;
-        }
-        if (StringUtils.isBlank(userInfo.getId())) {
-            return new HashMap();
-        }
-        String pSortNo = "0";
-        if (StringUtils.equals(userInfo.getUserType(), "10")) {
-            pSortNo = this.getPSortNo(userInfo.getId());
-        }
-        userInfo.setPSortNo(pSortNo);
-        UserInfo user = userInfoFacade.userDetail(userInfo.getId());
-        if (StringUtils.isNotEmpty(userInfo.getOrgId()) &&
-                (UserTypeEnum.POLICE.getValue().equals(user.getUserType()) || userInfoFacade.getRootUser().equals(userInfo.getName()))) {
-            SearchDTO searchDTO = new SearchDTO();
-            Searchable searchable = Searchable.toSearchable(searchDTO);
-            searchable.addSearchFilter("org_id", SearchOperator.eq, userInfo.getOrgId());
-            searchDTO = searchable.toSearchDTO();
-            searchDTO.setPage("1");
-            searchDTO.setSize("2");
-            Page<ApplyInfo> appPage = applyInfoFacade.applyInfoPage(searchDTO);
-            userInfo.setCompany(CollectionUtils.isNotEmpty(appPage.getContent()) ? appPage.getContent().get(0).getManufacturerId() : "");
-            ManufacturerInfo manufacturerInfo = manufacturerInfoFacade.manufacturerInfoDetail(userInfo.getCompany());
-            userInfo.setCompanyCode(manufacturerInfo != null ? manufacturerInfo.getCode() : "");
-        }
-        Map map = resultMap(userInfo, user);
-        return map;
-    }
-
-
-    /**
-     * 校验登录
-     * DcucLoginService.class 调用
-     * @param account
-     * @param password
-     * @return
-     */
-    @RequestMapping(value = "/checklogin", method = RequestMethod.POST)
-    @ResponseBody
-    public ResponseDTO checklogin(String account, String password) {
-        return accountFacade.checkLogin(account, password);
-    }
-
-
-    private String getPSortNo(String userId) {
-        //获取t_post_info中的sortNo
-        if (StringUtils.isEmpty(userId)){
-            return "";
-        }
-        List<PostInfo> postInfos = postInfoFacade.postInfos(userId);
-        if (postInfos != null && postInfos.size() > 0) {
-            return postInfos.get(0).getSortNo().toString();
-        } else {
-            return "";
-        }
-    }
-
-
-    private Map<String, Object> resultMap(UserInfo userInfo, UserInfo user) {
-        Map<String, Object> map = this.beanToMapGD(userInfo);
-        if (isParentOrg(userInfo, user)) {
-            map.put("isParentOrg", YesNotEnum.YES.getValue());
-        } else if (isParentOrg(userInfo, user) && !UserTypeEnum.POLICE.getValue().equals(userInfo.getUserType())) {
-            map.put("isParentOrg", null);
-        } else {
-            map.put("isParentOrg", YesNotEnum.NO.getValue());
-        }
-        if (!ObjectUtils.isNullOrEmptyString(map.get("birth"))) {
-            String birth = userInfo.getBirth();
-            map.put("birth", birth);
-        }
-        if (!ObjectUtils.isNullOrEmptyString(map.get("createTime"))) {
-            DateFormat bf = new SimpleDateFormat("yyyyMMdd");
-            Date createTime = userInfo.getCreateTime();
-            map.put("createTime", bf.format(createTime));
-        }
-        return map;
-    }
-
-    private boolean isParentOrg(UserInfo userInfo, UserInfo user) {
-        return StringUtils.isNotEmpty(userInfo.getOrgId()) && userInfo.getOrgId().equals(user.getOrgId());
-    }
-
-
-
-    /**
-     * api返回值为null时不转为""
-     * @param obj
-     * @param <T>
-     * @return
-     */
-    public  <T> Map<String,Object> beanToMapGD(T obj){
-        Map<String, Object> map = new HashMap<String, Object>();
-        try {
-            Class<?> clazz = obj.getClass();
-            for (Field field : clazz.getDeclaredFields()) {
-                field.setAccessible(true);
-                String fieldName = field.getName();
-                Object value = field.get(obj);
-                if (!SERIAL_VERSION_UID.equals(fieldName) && !fieldName.startsWith(ALIAS) && !fieldName.endsWith(ALIAS)){
-                    map.put(fieldName, (value != null) ? String.valueOf(value) : null);
-                }
-            }
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-        }
-        return map;
-    }
-}

+ 90 - 45
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/AuthApiController.java

@@ -15,26 +15,26 @@ import com.dragoninfo.dcuc.user.user.entity.UserInfo;
 import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
 import com.dragoninfo.duceap.core.enums.ResultEnum;
 import com.dragoninfo.duceap.core.response.Result;
-import com.dragonsoft.duceap.base.entity.http.HttpStatus;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
-import com.dragonsoft.duceap.base.exception.ApplicationException;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 /**
- *
  * @author Administrator
  * @date 2018/10/29
  */
-@Controller
+@Api(tags = {"权限管理接口"})
+@RestController
 @RequestMapping(value = "/api")
 public class AuthApiController {
 
@@ -51,15 +51,19 @@ public class AuthApiController {
     @Autowired
     private IUserInfoFacade userInfoFacade;
 
-
-    @RequestMapping(value = "/auth/getUserAuths", method = RequestMethod.GET)
+    @ApiOperation(value = "获取用户权限")
+    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户ID"),
+            @ApiImplicitParam(name = "appCode", value = "应用代码")})
+    @GetMapping(value = "/auth/getUserAuths")
     @ResponseBody
     public List<String> getAuthByUserIdAndAppCode(@RequestParam(value = "userId", required = true) String userId, @RequestParam(value = "appCode", required = true) String appCode) {
         return roleFacade.getAuthByUserIdAndAppCode(userId, appCode);
     }
 
-
-    @RequestMapping(value = "/auth/user/{userId}/appCode/{appCode}", method = RequestMethod.GET)
+    @ApiOperation(value = "获取应用权限")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "userId", value = "用户ID"),
+            @ApiImplicitParam(paramType = "path", name = "appCode", value = "应用代码")})
+    @GetMapping(value = "/auth/user/{userId}/appCode/{appCode}")
     @ResponseBody
     public List<Map<String, String>> getAppAuthByUserIdAndAppCode(@PathVariable(value = "userId") String userId, @PathVariable(value = "appCode") String appCode) {
         return roleFacade.getAppAuthByUserIdAndAppCode(userId, appCode);
@@ -70,13 +74,17 @@ public class AuthApiController {
      *
      * @return
      */
-    @RequestMapping(value = "/auth/applications", method = RequestMethod.GET)
+    @ApiOperation(value = "获取所有应用")
+    @GetMapping(value = "/auth/applications")
     @ResponseBody
     public List<ApplyInfo> applications() {
         return applyInfoFacade.getAllList();
     }
 
-    @RequestMapping(value = "/roles/{appCode}/{userId}", method = RequestMethod.GET)
+    @ApiOperation(value = "获取角色")
+    @ApiImplicitParams({@ApiImplicitParam(name = "appCode", value = "应用代码", required = true, example = "11111"),
+            @ApiImplicitParam(name = "userId", value = "用户身份证号", required = true)})
+    @GetMapping(value = "/roles/{appCode}/{userId}")
     @ResponseBody
     public ResponseDTO getRolesByAppCodeAndUserId(@PathVariable(value = "appCode") String appCode, @PathVariable(value = "userId") String userId) {
         return roleFacade.getRolesByAppCodeAndUserId(appCode, userId);
@@ -92,7 +100,14 @@ public class AuthApiController {
      * @param reason         申请事由
      * @return
      */
-    @RequestMapping(value = "/auth/apply", method = RequestMethod.GET)
+    @ApiOperation(value = "动态授权申请")
+    @ApiImplicitParams({@ApiImplicitParam(name = "appCode", value = "应用代码", required = true
+            , example = "11111"), @ApiImplicitParam(name = "roleCode", value = "角色代码", required = true
+            , example = "11111"), @ApiImplicitParam(name = "userIdCard", value = "用户身份证号", required = true
+            , example = "340111197810194754"), @ApiImplicitParam(name = "approvalIdCard", value = "审批人身份证", required = true
+            , example = "340111197810194754"), @ApiImplicitParam(name = "reason", value = "申请事由", required = true
+            , example = "340111197810194754")})
+    @GetMapping(value = "/auth/apply")
     @ResponseBody
     public ResponseDTO proposer(
             @RequestParam(value = "appCode", required = true) String appCode,
@@ -112,13 +127,18 @@ public class AuthApiController {
      * @param userIdCard 申请批人身份证
      * @return
      */
-    @RequestMapping(value = "/auth/applyResult", method = RequestMethod.GET)
+    @ApiOperation(value = "动态授权的角色功能获取")
+    @ApiImplicitParams({@ApiImplicitParam(name = "appCode", value = "应用代码", required = true
+            , example = "11111"), @ApiImplicitParam(name = "roleCode", value = "角色代码", required = true
+            , example = "11111"), @ApiImplicitParam(name = "userIdCard", value = "用户身份证号", required = true
+            , example = "340111197810194754")})
+    @GetMapping(value = "/auth/applyResult")
     @ResponseBody
     public ResponseDTO getProposerFuns(
             @RequestParam(value = "appCode", required = true) String appCode,
             @RequestParam(value = "roleCode", required = true) String roleCode,
             @RequestParam(value = "userIdCard", required = true) String userIdCard) {
-        ApprovalDto approvalDto=new ApprovalDto();
+        ApprovalDto approvalDto = new ApprovalDto();
         approvalDto.setAppCode(appCode);
         approvalDto.setRoleCode(roleCode);
         approvalDto.setUserIdCard(userIdCard);
@@ -126,16 +146,21 @@ public class AuthApiController {
         return iApprovalFacade.applyResult(approvalDto);
     }
 
-    /**1.1
+    /**
+     * 1.1
      * 授权管理服务 获取用户菜单权限列表
+     *
      * @param appCode
      * @return
      */
-    @RequestMapping(value = "/getResources/{appCode}", method = RequestMethod.GET)
+    @ApiOperation(value = "获取用户菜单权限列表")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "appCode", value = "应用代码", required = true
+            , example = "11111")})
+    @GetMapping(value = "/getResources/{appCode}")
     @ResponseBody
     public Result getMenus(@PathVariable(value = "appCode") String appCode) {
         try {
-            RoleApiDto dto=new RoleApiDto();
+            RoleApiDto dto = new RoleApiDto();
             dto.setAppCode(appCode);
             List<Map<String, Object>> menus = roleFacade.getMenus(dto);
             return Result.success(menus);
@@ -143,50 +168,63 @@ public class AuthApiController {
             return Result.fail("获取失败");
         }
     }
-    /**1.2
+
+    /**
+     * 1.2
      * 推送应用功能资源
+     *
      * @return
      */
-    @RequestMapping(value = "/setResources", method = RequestMethod.POST)
+    @ApiOperation(value = "推送应用功能资源")
+    @ApiImplicitParams({@ApiImplicitParam(name = "UpdataAppFunVO", value = "推送应用功能资源")})
+    @PostMapping(value = "/setResources")
     @ResponseBody
     public Result updateAppFun(@RequestBody UpdataAppFunVO updataAppFunVO) {
-        AppResourcesDto appResourcesDto=new AppResourcesDto(updataAppFunVO.getAppCode(),updataAppFunVO.getResources());
+        AppResourcesDto appResourcesDto = new AppResourcesDto(updataAppFunVO.getAppCode(), updataAppFunVO.getResources());
         try {
             ResponseDTO responseDTO = iAppFunInfoFacade.updateAppFun(appResourcesDto);
-            if (ResponseDTO.FAIL_CODE.equals(responseDTO.getStatusCode())){
-               return Result.fail(responseDTO.getMessage());
+            if (ResponseDTO.FAIL_CODE.equals(responseDTO.getStatusCode())) {
+                return Result.fail(responseDTO.getMessage());
             }
-            return  Result.success();
+            return Result.success();
         } catch (Exception e) {
             logger.error("资源更新失败[{}]", e.getMessage());
             return Result.fail("资源更新失败", e.getMessage());
         }
     }
 
-    /**1.3
+    /**
+     * 1.3
      * 授权管理服务 获取用户角色权限列表
+     *
      * @return
      */
-    @RequestMapping(value = "/getRoles", method = RequestMethod.POST)
+    @ApiOperation(value = "获取用户角色权限列表")
+    @ApiImplicitParams({@ApiImplicitParam(name = "RoleApiParamVo", value = "用户角色权限")})
+    @PostMapping(value = "/getRoles")
     @ResponseBody
     public Result getRoles(@RequestBody RoleApiParamVo vo) {
-        if(StringUtils.isEmpty(vo.getAppCode())){
+        if (StringUtils.isEmpty(vo.getAppCode())) {
             return Result.fail("appCode不能为空");
         }
         try {
-            RoleApiDto dto=new RoleApiDto(vo.getAppCode(),vo.getIdcard(),vo.getRoleCode());
-            return Result.success( roleFacade.getRoleByAppCodeAndUserId(dto));
+            RoleApiDto dto = new RoleApiDto(vo.getAppCode(), vo.getIdcard(), vo.getRoleCode());
+            return Result.success(roleFacade.getRoleByAppCodeAndUserId(dto));
         } catch (Exception e) {
-            return Result.fail(ResultEnum.FAIL.getKey(),e.getMessage());
+            return Result.fail(ResultEnum.FAIL.getKey(), e.getMessage());
         }
     }
 
 
-    /** 1.4
+    /**
+     * 1.4
      * 动态授权
+     *
      * @param vo
      * @return
      */
+    @ApiOperation(value = "动态授权")
+    @ApiImplicitParams({@ApiImplicitParam(name = "FunAppovalParamVo", value = "动态授权")})
     @RequestMapping("/pushData")
     @ResponseBody
     public Result pushData(@RequestBody FunAppovalParamVo vo) {
@@ -194,38 +232,41 @@ public class AuthApiController {
         String roleCode = vo.getRoleCode();
         String userIdCard = vo.getProposerIdcard();
         String approvalIdCard = vo.getApprpvalIdcard();
-        String reason =vo.getProposerReason();
+        String reason = vo.getProposerReason();
         if (StringUtils.isEmpty(appCode) || StringUtils.isEmpty(roleCode)
                 || StringUtils.isEmpty(approvalIdCard) || StringUtils.isEmpty(userIdCard)
-                ||StringUtils.isEmpty(vo.getVerifiy())||StringUtils.isEmpty(vo.getProposerOrg())) {
+                || StringUtils.isEmpty(vo.getVerifiy()) || StringUtils.isEmpty(vo.getProposerOrg())) {
             return Result.fail("必填参数不能为空");
         }
         UserInfo proposerUserInfo = userInfoFacade.userDetail("idcard", userIdCard);
-        if (proposerUserInfo==null||!proposerUserInfo.getOrgId().equals(vo.getProposerOrg())){
+        if (proposerUserInfo == null || !proposerUserInfo.getOrgId().equals(vo.getProposerOrg())) {
             return Result.fail("申请人不存在或机构错误");
         }
         ResponseDTO responseDTO = iApprovalFacade.authApply(appCode, roleCode, userIdCard, approvalIdCard, reason);
-        if (ResponseDTO.FAIL_CODE.equals(responseDTO.getStatusCode())){
+        if (ResponseDTO.FAIL_CODE.equals(responseDTO.getStatusCode())) {
             return Result.fail(responseDTO.getMessage());
         }
         return Result.success();
     }
 
 
-
-    /**1.5
+    /**
+     * 1.5
      * 获取权限列表成功
+     *
      * @return
      */
-    @RequestMapping(value = "/getRoleRight", method = RequestMethod.POST)
+    @ApiOperation(value = "获取权限列表")
+    @ApiImplicitParams({@ApiImplicitParam(name = "RoleApiParamVo", value = "获取权限列表参数")})
+    @PostMapping(value = "/getRoleRight")
     @ResponseBody
     public Result getRoleRight(@RequestBody RoleApiParamVo vo) {
 
-        if(StringUtils.isEmpty(vo.getAppCode())){
+        if (StringUtils.isEmpty(vo.getAppCode())) {
             return Result.fail("appCode不能为空");
         }
         try {
-            RoleApiDto dto=new RoleApiDto(vo.getAppCode(),vo.getIdcard(),vo.getRoleCode());
+            RoleApiDto dto = new RoleApiDto(vo.getAppCode(), vo.getIdcard(), vo.getRoleCode());
             return Result.success(roleFacade.getRoleRight(dto));
         } catch (Exception e) {
 
@@ -233,17 +274,21 @@ public class AuthApiController {
         }
     }
 
-    /**公共资源
+    /**
+     * 公共资源
      * 根据身份证ID找到这个赋予的应用
+     *
      * @param idcard
      * @return
      */
-
-    @RequestMapping(value = "/apps/{idcard}", method = RequestMethod.GET)
+    @ApiOperation(value = "根据身份证ID找到这个赋予的应用")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "idcard", value = "身份证号", required = true
+            , example = "340102192904207238")})
+    @GetMapping(value = "/apps/{idcard}")
     @ResponseBody
-    public Result  appListByIdcard(@PathVariable("idcard") String idcard){
+    public Result appListByIdcard(@PathVariable("idcard") String idcard) {
         try {
-            return Result.success( roleFacade.appListByIdcard(idcard));
+            return Result.success(roleFacade.appListByIdcard(idcard));
         } catch (Exception e) {
             return Result.fail("获取失败");
         }

+ 62 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/DataAuthApiController.java

@@ -0,0 +1,62 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.api.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.interfaces.DecodedJWT;
+import com.dragoninfo.dcuc.auth.auth.api.IApiDataAuthFacade;
+import com.dragoninfo.dcuc.auth.auth.dto.DataItemsCheckDto;
+import com.dragoninfo.dcuc.auth.auth.dto.DataItemsDto;
+import com.dragoninfo.dcuc.auth.auth.facade.IBimBusinessFacade;
+import com.dragoninfo.dcuc.authweb.util.VersionUtils;
+import com.dragoninfo.dcuc.common.Constants;
+import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
+import com.dragonsoft.duceap.commons.util.string.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 代码千万行,注释第一行,编码不规范,同事两行泪
+ *
+ * @author huang(jy)
+ * @version 1.0
+ * @date 2021/5/7 9:09
+ */
+@Api(tags = {"数据鉴权"})
+@RestController
+@RequestMapping(value = "/api/auth-service/" + VersionUtils.VERSION_UID_V1 + "/")
+public class DataAuthApiController {
+
+    @Autowired
+    private IApiDataAuthFacade apiDataAuthFacade;
+
+    @Autowired
+    private IBimBusinessFacade bimBusinessFacade;
+
+
+    @ApiOperation(value = "查询是否拥有数据项权限接口")
+    @ApiImplicitParams({@ApiImplicitParam(name = "DataItemsCheckDto", value = "数据资源对象")})
+    @PostMapping(value = "data-auth/data-items/check")
+    public ResponseDTO checkDataItems(@RequestBody DataItemsCheckDto checkDto,
+                                      @RequestHeader(value = Constants.DCUC_USER_TOKEN, required = false) String headerUserToken,
+                                      @RequestHeader(value = Constants.IDCARD, required =  false) String headerIdcard) {
+        String currentIdcard = null;
+        if (StrUtil.isBlank(headerUserToken)) {
+            currentIdcard = headerIdcard;
+        }else{
+            DecodedJWT decode = JWT.decode(headerUserToken);
+            currentIdcard = decode.getClaim("idCard").asString();
+        }
+        if (StringUtils.isBlank(currentIdcard)){
+            return  ResponseDTO.fail("当前登录人身份证号不允许为空", (Object) null);
+        }
+        checkDto.setCurrentIdcard(currentIdcard);
+        checkDto.setIdcard(currentIdcard);
+        return apiDataAuthFacade.dataItemsCheck(checkDto);
+    }
+}

+ 34 - 14
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/RestAuthController.java

@@ -2,52 +2,72 @@ package com.dragoninfo.dcuc.authweb.restcontroller.api.controller;
 
 import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
 import com.dragoninfo.dcuc.auth.auth.facade.IRoleFacade;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
-@Controller
+/**
+ * @author huangzqa
+ */
+@Api(tags = {"角色管理接口"})
+@RestController
 @RequestMapping(value = "/rest/authmanage/")
 public class RestAuthController {
 
     @Autowired
     private IRoleFacade roleFacade;
 
-    @RequestMapping(value = "v1/role/{roleId}", method = RequestMethod.GET)
+    @ApiOperation(value = "查询角色信息")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "roleId", value = "角色ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
+    @GetMapping(value = "v1/role/{roleId}")
     @ResponseBody
     public RoleInfo role(@PathVariable(value = "roleId") String roleId) {
         return roleFacade.detail(roleId);
     }
 
-    @RequestMapping(value = "v1/roles/{userId}", method = RequestMethod.GET)
+    @ApiOperation(value = "查询角色列表")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "userId", value = "用户ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
+    @GetMapping(value = "v1/roles/{userId}")
     @ResponseBody
     public List<RoleInfo> roles(@PathVariable(value = "userId") String userId) {
         return roleFacade.rolesByUserId(userId);
     }
 
-    @RequestMapping(value = "v1/users/{roleId}", method = RequestMethod.GET)
+    @ApiOperation(value = "查询用户列表")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "roleId", value = "角色ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
+    @GetMapping(value = "v1/users/{roleId}")
     @ResponseBody
     public List<String> users(@PathVariable(value = "roleId") String roleId) {
         return roleFacade.getUserIds(roleId);
     }
 
-    @RequestMapping(value = "v1/roles/app/{appId}", method = RequestMethod.GET)
+    @ApiOperation(value = "查询角色列表")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "appId", value = "应用ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
+    @GetMapping(value = "v1/roles/app/{appId}")
     @ResponseBody
     public List<RoleInfo> rolesbyappid(@PathVariable(value = "appId") String appId) {
         return roleFacade.getRolesByAppId(appId);
     }
 
-    @RequestMapping(value="v1/roles/{userId}/{appCode}",method = RequestMethod.GET)
+    @ApiOperation(value = "查询角色列表")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "userId", value = "用户ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000"),
+            @ApiImplicitParam(paramType = "path", name = "appCode", value = "应用代码", required = true
+                    , example = "40288a8b699fc2500169a33b20540000")})
+    @GetMapping(value = "v1/roles/{userId}/{appCode}")
     @ResponseBody
-    public List<RoleInfo> rolesByUserIdAndAppCode(@PathVariable(value = "userId") String userId,@PathVariable(value = "appCode") String appCode){
-        return roleFacade.getRolesByUserIdAndAppCode(userId,appCode);
+    public List<RoleInfo> rolesByUserIdAndAppCode(@PathVariable(value = "userId") String userId, @PathVariable(value = "appCode") String appCode) {
+        return roleFacade.getRolesByUserIdAndAppCode(userId, appCode);
     }
 
 
-
 }

+ 0 - 73
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/RestLoginController.java

@@ -1,73 +0,0 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.api.controller;
-
-import com.dragonsoft.duceap.commons.util.string.StringUtils;
-import com.google.common.collect.Lists;
-import org.apache.http.HttpResponse;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.util.EntityUtils;
-import org.jasig.cas.client.util.XmlUtils;
-import org.jasig.cas.client.validation.Assertion;
-import org.jasig.cas.client.validation.Cas20ServiceTicketValidator;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- *
- * @author Administrator
- * @date 2019/3/5
- */
-@Controller
-@RequestMapping(value = "/api/")
-public class RestLoginController {
-    @RequestMapping(value = "login")
-    public void login(@RequestParam(value = "ticket", required = false) String ticket,
-                      HttpServletRequest request,
-                      HttpServletResponse response) {
-        //判断是否是单点登录服务器发出的退出请求
-        if (StringUtils.isNotEmpty(request.getParameter("logoutRequest"))) {
-            String logoutMessage = request.getParameter("logoutRequest");
-            final String key = XmlUtils.getTextForElement(logoutMessage, "SessionIndex");
-            //获取key后,从登录时保存的key与登录状态的映射对中获取登录状态并销毁,并处理退出逻辑
-            return;
-        }
-        //验证票据获取用户信息
-        if (StringUtils.isEmpty(ticket)) {
-            return;
-        }
-        HttpClient httpclient = HttpClientBuilder.create().build();
-        String casTicketValidateUrl = "http://54.179.163.62:8080/dcucserver/serviceValidate";
-        URIBuilder uriBuilder = null;
-        try {
-            uriBuilder = new URIBuilder(casTicketValidateUrl);
-            List<NameValuePair> params = Lists.newArrayList();
-            params.add(new BasicNameValuePair("ticket", ticket));
-            params.add(new BasicNameValuePair("service", "http://172.16.105.196:8888/dcuc/api/login"));
-            uriBuilder.addParameters(params);
-            HttpGet httpGet = new HttpGet(uriBuilder.build());
-            httpGet.addHeader("Content-Type", "application/x-www-form-urlencoded");
-            HttpResponse httpResponse = httpclient.execute(httpGet);
-            String tokenResponse = EntityUtils.toString(httpResponse.getEntity());
-            //解析响应的报文获取用户ID
-            Cas20ServiceTicketValidator cas20ServiceTicketValidator = new Cas20ServiceTicketValidator("");
-            Assertion assertion = cas20ServiceTicketValidator.parseResponse(tokenResponse);
-            String userId = assertion.getPrincipal().getName();
-            //获取userId后再调统一用户的相关接口获取更详细的用户信息,并实现系统的登录逻辑
-            //再以登录状态(如session)为value,以ticket为key,保存一份key与登录状态的映射对,用于单点退出
-
-            //最后重定向到登录后的页面
-            response.sendRedirect(request.getContextPath() + "/index");
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 18 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/pojo/FunAppovalParamVo.java

@@ -1,16 +1,34 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.api.controller.pojo;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
 /**
  * @Author wangrs
  * @Date 2020/11/18 10:44
  **/
+@ApiModel(value = "搜索接口请求参数")
 public class FunAppovalParamVo {
+
+    @ApiModelProperty(value = "应用代码")
     private String appCode;
+
+    @ApiModelProperty(value = "角色代码")
     private String roleCode;
+
+    @ApiModelProperty(value = "校验")
     private String verifiy;
+
+    @ApiModelProperty(value = "申请人身份证号")
     private String proposerIdcard;
+
+    @ApiModelProperty(value = "申请人机构")
     private String proposerOrg;
+
+    @ApiModelProperty(value = "申请原因")
     private String proposerReason;
+
+    @ApiModelProperty(value = "审批人身份证号")
     private String apprpvalIdcard;
 
 

+ 15 - 3
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/pojo/RoleApiParamVo.java

@@ -1,17 +1,29 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.api.controller.pojo;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
  * @Author yica
  * @Date 2020/11/24 14:06
  **/
+@ApiModel(value = "角色参数vo")
 @Data
 public class RoleApiParamVo {
-    //应用代码
+    /**
+     * 应用代码
+     */
+    @ApiModelProperty(value = "应用代码")
     private String appCode;
-    //用户身份证
+    /**
+     * 用户身份证
+     */
+    @ApiModelProperty(value = "用户身份证")
     private String idcard;
-    //角色代码
+    /**
+     * 角色代码
+     */
+    @ApiModelProperty(value = "角色代码")
     private String roleCode;
 }

+ 14 - 2
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/pojo/UpdataAppFunVO.java

@@ -1,6 +1,8 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.api.controller.pojo;
 
 import com.dragoninfo.dcuc.auth.auth.vo.AppFunVO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 import java.util.List;
@@ -8,11 +10,21 @@ import java.util.List;
 /**
  * 接口更新同步应用资源
  * 接收参数
+ *
+ * @author huangzqa
  */
+@ApiModel(value = "同步应用资源")
 public class UpdataAppFunVO implements Serializable {
-    //同步的应用代码
+    /**
+     * 同步的应用代码
+     */
+    @ApiModelProperty(value = "同步的应用代码")
+
     private String appCode;
-    //同步的应用资源信息
+    /**
+     * 同步的应用资源信息
+     */
+    @ApiModelProperty(value = "同步的应用资源信息")
     private List<AppFunVO> resources;
 
     public String getAppCode() {

+ 9 - 4
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/AppController.java

@@ -34,6 +34,7 @@ import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.search.enums.SearchOperator;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -126,7 +127,8 @@ public class AppController {
     }
 
     @ApiOperation(value = "删除应用")
-    @ApiImplicitParam(name = "id", value = "id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "应用ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @DeleteMapping(value = "/app/{id}")
     public Result<Object> del(@PathVariable("id") String id) {
         try {
@@ -149,7 +151,8 @@ public class AppController {
      * @return
      */
     @ApiOperation(value = "查询应用")
-    @ApiImplicitParam(name = "id", value = "id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "应用ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "/app/{id}")
     public Result<AppVo> toDetail(@PathVariable("id") String id) {
         //查询应用信息
@@ -163,7 +166,8 @@ public class AppController {
     }
 
     @ApiOperation(value = "开启停止应用")
-    @ApiImplicitParam(name = "id", value = "id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "应用ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @PutMapping(value = "/app/status/{id}")
     public Result<Object> startOrStop(@PathVariable String id) {
         String message = "";
@@ -178,7 +182,8 @@ public class AppController {
 
 
     @ApiOperation(value = "根据厂商ID,获取厂商所有的应用")
-    @ApiImplicitParam(value = "mfrId", name = "厂商Id", required = true)
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "厂商ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "app/manufacturer/{mfrId}")
     public Result<List<Map<String, String>>> getAppByMfr(@PathVariable String mfrId) {
         if (StrUtil.isBlank(mfrId)) {

+ 82 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/DataResourceController.java

@@ -0,0 +1,82 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.app;
+
+import com.dragoninfo.dcuc.app.facade.IDataResourceFacade;
+import com.dragoninfo.dcuc.app.vo.DataClassifyVo;
+import com.dragoninfo.dcuc.app.vo.DataFieldClassifyVo;
+import com.dragoninfo.dcuc.app.vo.DataLevelVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.app.vo.AuthDataClassifyVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.app.vo.AuthDataFieldClassifyVo;
+import com.dragoninfo.dcuc.authweb.restcontroller.app.vo.AuthDataLevelVo;
+import com.dragoninfo.duceap.core.response.Result;
+import com.google.common.collect.Lists;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Author: qiuyu
+ * @Date: 2021/4/15 17:29
+ * @Description:
+ */
+@Api(tags = {"数据资源分级分类表码管理"})
+@RestController
+@RequestMapping(value = "dataresourcesrv/v1")
+public class DataResourceController {
+
+    @Autowired
+    private IDataResourceFacade dataResourceFacade;
+
+    @ApiOperation(value = "数据分级表码列表")
+    @GetMapping(value = "datalevels")
+    public Result<List<AuthDataLevelVo>> getDataLevelList() {
+        List<AuthDataLevelVo> result = Lists.newArrayList();
+        for (DataLevelVo dataLevelVo : dataResourceFacade.getDataLevelList()) {
+            AuthDataLevelVo authDataLevelVo = new AuthDataLevelVo();
+            BeanUtils.copyProperties(dataLevelVo, authDataLevelVo);
+            result.add(authDataLevelVo);
+        }
+        return Result.success(result);
+    }
+
+    @ApiOperation(value = "安全等级表码列表")
+    @GetMapping(value = "securitylevels")
+    Result<List<AuthDataLevelVo>> getSecurityLevelList() {
+        List<AuthDataLevelVo> result = Lists.newArrayList();
+        for (DataLevelVo dataLevelVo : dataResourceFacade.getSecurityLevelList()) {
+            AuthDataLevelVo authDataLevelVo = new AuthDataLevelVo();
+            BeanUtils.copyProperties(dataLevelVo, authDataLevelVo);
+            result.add(authDataLevelVo);
+        }
+        return Result.success(result);
+    }
+
+    @ApiOperation(value = "数据资源分类表码列表")
+    @GetMapping(value = "dataclassifys")
+    Result<List<AuthDataClassifyVo>> getDataClassifyList() {
+        List<AuthDataClassifyVo> result = Lists.newArrayList();
+        for (DataClassifyVo dataClassifyVo : dataResourceFacade.getDataClassifyList()) {
+            AuthDataClassifyVo authDataClassifyVo = new AuthDataClassifyVo();
+            BeanUtils.copyProperties(dataClassifyVo, authDataClassifyVo);
+            result.add(authDataClassifyVo);
+        }
+        return Result.success(result);
+    }
+
+    @ApiOperation(value = "字段分类表码列表")
+    @GetMapping(value = "fieldclassifys")
+    Result<List<AuthDataFieldClassifyVo>> getFieldClassifyList() {
+        List<AuthDataFieldClassifyVo> result = Lists.newArrayList();
+        for (DataFieldClassifyVo dataFieldClassifyVo : dataResourceFacade.getFieldClassifyList()) {
+            AuthDataFieldClassifyVo authDataClassifyVo = new AuthDataFieldClassifyVo();
+            BeanUtils.copyProperties(dataFieldClassifyVo, authDataClassifyVo);
+            result.add(authDataClassifyVo);
+        }
+        return Result.success(result);
+    }
+}

+ 5 - 2
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/ManufacturerInfoController.java

@@ -24,6 +24,7 @@ import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.web.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -62,7 +63,8 @@ public class ManufacturerInfoController extends BaseController<ManufacturerInfo,
     }
 
     @ApiOperation(value = "获取厂商")
-    @ApiImplicitParam(name = "id", value = "id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "厂商ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "manufacturer/{id}")
     public Result<ManufacturerVo> detail(@PathVariable("id") String id) {
         ManufacturerVo manufacturerVo = new ManufacturerVo();
@@ -129,7 +131,8 @@ public class ManufacturerInfoController extends BaseController<ManufacturerInfo,
     }
 
     @ApiOperation(value = "删除厂商")
-    @ApiImplicitParam(name = "id", value = "id", required = true)
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "厂商ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @DeleteMapping(value = "manufacturer/{id}")
     public Result<Object> del(@PathVariable("id") String id) {
         List<ApplyInfo> appList = applyInfoFacade.getAppListByManufacturerId(id);

+ 3 - 3
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/ResourceAuthController.java

@@ -1,7 +1,7 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.app;
 
 import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthFlowDTO;
-import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFacade;
+import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthFlowFacade;
 import com.dragoninfo.dcuc.authweb.restcontroller.app.vo.ServiceAuthFlowVo;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.core.entity.page.PageImpl;
@@ -33,7 +33,7 @@ import java.util.List;
 public class ResourceAuthController {
 
     @Autowired
-    private IServiceAuthFacade iServiceAuthFacade;
+    private IServiceAuthFlowFacade serviceAuthFlowFacade;
 
     /**
      * 服务授权工单列表
@@ -43,7 +43,7 @@ public class ResourceAuthController {
     @ApiImplicitParam(name = "searchable", value = "查询条件")
     @PostMapping(value = "serviceAuthFlow/search", produces = MediaType.APPLICATION_JSON_VALUE)
     public Result<Page<ServiceAuthFlowVo>> serviceAuthFlowPage(Searchable searchable) {
-        Page<ServiceAuthFlowDTO> page = iServiceAuthFacade.serviceAuthFlowPage(searchable.toSearchDTO());
+        Page<ServiceAuthFlowDTO> page = serviceAuthFlowFacade.serviceAuthFlowPage(searchable.toSearchDTO());
         List<ServiceAuthFlowDTO> content = page.getContent();
         List<ServiceAuthFlowVo> vos = new ArrayList<>();
         for (ServiceAuthFlowDTO dto : content) {

+ 4 - 4
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/ResourceListingController.java

@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
 public class ResourceListingController {
 
     @Autowired
-    private IResourceFacade iResourceFacade;
+    private IResourceFacade resourceFacade;
 
     /**
      * 获取应用和服务资源列表
@@ -37,7 +37,7 @@ public class ResourceListingController {
     public Result<List<ResourceRequestResult>> getResourceListing(@RequestBody ResourceRequestParam requestParam) {
         ResourceRequestParamDTO paramDTO = new ResourceRequestParamDTO();
         BeanUtils.copyProperties(requestParam,paramDTO);
-        List<ResourceRequestResultDTO> results = iResourceFacade.getResourceRequestResults(paramDTO);
+        List<ResourceRequestResultDTO> results = resourceFacade.getResourceRequestResults(paramDTO);
         List<ResourceRequestResult> list = results.stream().map(item -> {
             ResourceRequestResult vo = new ResourceRequestResult();
             BeanUtils.copyProperties(item, vo);
@@ -52,8 +52,8 @@ public class ResourceListingController {
      */
     @ApiOperation(value = "资源同步表与应用、服务资源同步")
     @GetMapping(value = "sync")
-    public Result ResourceSync() {
-        iResourceFacade.resourceSync();
+    public Result resourceSync() {
+        resourceFacade.resourceSync();
         return Result.success();
     }
 

+ 40 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/vo/AuthDataClassifyVo.java

@@ -0,0 +1,40 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.app.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+/**
+ * @Author: qiuyu
+ * @Date: 2021/4/15 14:17
+ * @Description:
+ */
+@Data
+@ApiModel(value = "字段分类")
+public class AuthDataClassifyVo {
+
+    @ApiModelProperty(value = "一级代码")
+    private String firstLevelCode;
+
+    @ApiModelProperty(value = "一级名称")
+    private String firstLevelName;
+
+    @ApiModelProperty(value = "二级代码")
+    private String secondLevelCode;
+
+    @ApiModelProperty(value = "二级名称")
+    private String secondLevelName;
+
+    @ApiModelProperty(value = "标签分类代码")
+    private String labelClassifyCode;
+
+    @ApiModelProperty(value = "标签分类名称")
+    private String labelClassifyName;
+
+    @ApiModelProperty(value = "标签代码")
+    private String labelCode;
+
+    @ApiModelProperty(value = "标签名称")
+    private String labelName;
+}

+ 27 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/vo/AuthDataFieldClassifyVo.java

@@ -0,0 +1,27 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.app.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author: qiuyu
+ * @Date: 2021/4/15 14:17
+ * @Description:
+ */
+@Data
+@ApiModel(value = "字段分类")
+public class AuthDataFieldClassifyVo {
+    @ApiModelProperty(value = "一级等级代码")
+    private String firstLevelCode;
+
+    @ApiModelProperty(value = "一级等级名称")
+    private String firstLevelName;
+
+    @ApiModelProperty(value = "二级等级代码")
+    private String secondLevelCode;
+
+    @ApiModelProperty(value = "二级等级名称")
+    private String secondLevelName;
+
+}

+ 23 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/app/vo/AuthDataLevelVo.java

@@ -0,0 +1,23 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.app.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+/**
+ * @Author: qiuyu
+ * @Date: 2021/4/15 14:17
+ * @Description:
+ */
+@Data
+@ApiModel(value = "等级分类")
+public class AuthDataLevelVo {
+
+    @ApiModelProperty(value = "等级代码")
+    private String levelCode;
+
+    @ApiModelProperty(value = "等级名称")
+    private String levelName;
+
+}

+ 16 - 16
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/approval/ApprovalController.java

@@ -23,7 +23,7 @@ import java.text.SimpleDateFormat;
 import java.util.List;
 
 @Api(tags = {"动态授权管理接口"})
-@Permission(value="power_config")
+@Permission(value = "power_config")
 @RestController
 @RequestMapping(value = "approsvr/v2/approval/")
 public class ApprovalController {
@@ -35,17 +35,17 @@ public class ApprovalController {
     private IUserInfoFacade iUserInfoFacade;
 
     @ApiOperation(value = "获取动态授权信息列表")
-    @ApiImplicitParam(name = "searchDTO" , value = "查询条件",paramType = "body",
+    @ApiImplicitParam(name = "searchDTO", value = "查询条件", paramType = "body",
             examples = @Example({
-            @ExampleProperty(value = "{'appName_like':'应用名称','roleName_like':'角色名称','proposerName_like':'申请人'," +
-                    "'proposerOrg_eq':'id申请机构id','approvalStatus_eq':'申请状态'}",
-                    mediaType = "application/json")
-    }))
+                    @ExampleProperty(value = "{'appName_like':'应用名称','roleName_like':'角色名称','proposerName_like':'申请人'," +
+                            "'proposerOrg_eq':'id申请机构id','approvalStatus_eq':'申请状态'}",
+                            mediaType = "application/json")
+            }))
     @PostMapping(value = "_search")
     public Result<List<FuncApproval>> approvalPage(SearchDTO searchDTO) {
         Page<FuncApproval> page = iApprovalFacade.approvalPage(searchDTO);
         page.getContent().stream().forEach(this::setValues);
-        return Result.success(page.getTotalElements(),page.getContent());
+        return Result.success(page.getTotalElements(), page.getContent());
     }
 
 
@@ -53,12 +53,12 @@ public class ApprovalController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "id"),
             @ApiImplicitParam(name = "hasTime", value = "hasTime,0:不存在时间限制 1:存在时间限制。"),
-            @ApiImplicitParam(name = "validTime", value = "授权截止时间 格式:yyyyMMddHHmmss",paramType = "string")
+            @ApiImplicitParam(name = "validTime", value = "授权截止时间 格式:yyyyMMddHHmmss", paramType = "string")
     })
     @PutMapping(value = "agree")
     public Result agree(@RequestBody FuncApprovalVo funcApprovalVo) {
-        ApprovalDto approvalDto=new ApprovalDto();
-        BeanUtils.copyProperties(funcApprovalVo,approvalDto);
+        ApprovalDto approvalDto = new ApprovalDto();
+        BeanUtils.copyProperties(funcApprovalVo, approvalDto);
         ResponseStatus responseStatus = iApprovalFacade.agree(approvalDto);
         Result result = dealResponseStatus(responseStatus);
         return result;
@@ -71,8 +71,8 @@ public class ApprovalController {
     })
     @PutMapping(value = "disagree")
     public Result disagree(@RequestBody FuncApprovalVo funcApprovalVo) {
-        ApprovalDto approvalDto=new ApprovalDto();
-        BeanUtils.copyProperties(funcApprovalVo,approvalDto);
+        ApprovalDto approvalDto = new ApprovalDto();
+        BeanUtils.copyProperties(funcApprovalVo, approvalDto);
         ResponseStatus responseStatus = iApprovalFacade.disagree(approvalDto);
         Result result = dealResponseStatus(responseStatus);
         return result;
@@ -80,14 +80,15 @@ public class ApprovalController {
     }
 
     @ApiOperation(value = "获取详情")
-    @ApiImplicitParam(name = "id", value = "id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "授权ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "detail/{id}")
     public Result<FuncApprovalVo> toDetail(@PathVariable("id") String id) {
         FuncApproval approval = iApprovalFacade.detail(id);
         setValues(approval);
         FuncApprovalVo vo = new FuncApprovalVo();
-        BeanUtils.copyProperties(approval,vo);
-        if (approval.getValidTime()!=null){
+        BeanUtils.copyProperties(approval, vo);
+        if (approval.getValidTime() != null) {
             SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             vo.setValidTime(format.format(approval.getValidTime()));
         }
@@ -108,7 +109,6 @@ public class ApprovalController {
     }
 
 
-
     private Result dealResponseStatus(ResponseStatus responseStatus) {
         if (ResponseStatus.SUCCESS_CODE.equals(responseStatus.getStatusCode())) {
             return Result.success(responseStatus.getMessage());

+ 2 - 1
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/audit/MgeAuditRptController.java

@@ -56,7 +56,8 @@ public class MgeAuditRptController {
     }
 
     @ApiOperation(value = "查询管理员审计详情")
-    @ApiImplicitParam(name = "id", value = "id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "审计详情ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "/detail/{id}")
     public Result<MgeLogVo> orgAuditDetail(@PathVariable("id") String id) {
         MgeLog mgeLog = iMgeLogFacade.getMgeLog(id);

+ 53 - 51
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/audit/UserAuditRptController.java

@@ -22,6 +22,7 @@ import com.dragonsoft.duceap.commons.util.ObjectUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -57,36 +58,37 @@ public class UserAuditRptController {
     private ICodeListResourceFacade codeListResourceFacade;
 
 
-    private Map<String,String> codeMap = new HashMap<String, String>(){{
-        put("UserType","DM_USER_TYPE");             //人员类型
-        put("Area","DM_AREA_CODE");                 //地区
-        put("UserStatus","DM_USER_STATUS");         //人员状态
-        put("AuxiliaryType","DM_AUXILIARY_TYPE");   //辅警类型
-        put("PoliceCategory","T_MD_POLICE_TYPE");   //警钟
-        put("Sex","DM_SEX");                        //性别
-        put("Nation","DM_NATION_CODE");             //民族
-        put("Title","DM_CERT_DUTY_LEVEL");          //职级
-        put("Rank","DM_POLICE_RANK");               //警衔
+    private Map<String, String> codeMap = new HashMap<String, String>() {{
+        put("UserType", "DM_USER_TYPE");             //人员类型
+        put("Area", "DM_AREA_CODE");                 //地区
+        put("UserStatus", "DM_USER_STATUS");         //人员状态
+        put("AuxiliaryType", "DM_AUXILIARY_TYPE");   //辅警类型
+        put("PoliceCategory", "T_MD_POLICE_TYPE");   //警钟
+        put("Sex", "DM_SEX");                        //性别
+        put("Nation", "DM_NATION_CODE");             //民族
+        put("Title", "DM_CERT_DUTY_LEVEL");          //职级
+        put("Rank", "DM_POLICE_RANK");               //警衔
     }};
 
     @ApiOperation(value = "查询用户审计报表")
     @ApiImplicitParam(name = "SearchDTO", value = "查询条件,默认带一个IDCARD")
     @PostMapping(value = "users")
-    public Result getUserAuditRpt(SearchDTO searchDTO){
+    public Result getUserAuditRpt(SearchDTO searchDTO) {
         searchDTO.setSort("");
         Page<UserLogVo> page = iUserLogFacade.findUserLogRpt(searchDTO);
-        for(UserLogVo vo:page.getContent()) {
+        for (UserLogVo vo : page.getContent()) {
             List<CompareVo> dftMap = getCompareVos(vo);
             vo.setDftList(dftMap);
             continue;
         }
-        return Result.success(page.getTotalElements(),page.getContent());
+        return Result.success(page.getTotalElements(), page.getContent());
     }
 
     @ApiOperation(value = "查询用户审计详情")
-    @ApiImplicitParam(name = "id", value = "主键ID")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "主键ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "user/{id}")
-    public Result<UserLogVo> userAuditDetail(@PathVariable("id") String id){
+    public Result<UserLogVo> userAuditDetail(@PathVariable("id") String id) {
         UserLogVo userLogVo = iUserLogFacade.userLogVoDetail(id);
         List<CompareVo> dftMap = getCompareVos(userLogVo);
         userLogVo.setDftList(dftMap);
@@ -98,23 +100,24 @@ public class UserAuditRptController {
     @PostMapping(value = "/audit/users")
     public Result getUserWithDeleted(SearchDTO searchDTO) {
         Page<UserInfo> page = iUserInfoFacade.userList(searchDTO);
-        Map<String,String> auxiliaryTypeList =getCodes("DM_AUXILIARY_TYPE");
-        Map<String,String> policeUserTypeList = getCodes( "DM_MAN_TYPE");
-        page.forEach(item->{
-            if (UserTypeEnum.POLICE.getValue().equals(item.getUserType())){
+        Map<String, String> auxiliaryTypeList = getCodes("DM_AUXILIARY_TYPE");
+        Map<String, String> policeUserTypeList = getCodes("DM_MAN_TYPE");
+        page.forEach(item -> {
+            if (UserTypeEnum.POLICE.getValue().equals(item.getUserType())) {
                 item.setManType(policeUserTypeList.get(item.getManType()));
             }
-            if (UserTypeEnum.HELPER.getValue().equals(item.getUserType())){
+            if (UserTypeEnum.HELPER.getValue().equals(item.getUserType())) {
                 item.setManType(auxiliaryTypeList.get(item.getAuxiliaryType()));
             }
         });
-        return  Result.success(page.getTotalElements(),page.getContent());
+        return Result.success(page.getTotalElements(), page.getContent());
     }
-    private Map<String,String> getCodes(String codeName){
+
+    private Map<String, String> getCodes(String codeName) {
         List<CodeRecord> codeRecordList = codeListResourceFacade.listCode("code", codeName);
-        Map<String,String> map=new HashMap<>();
-        codeRecordList.forEach(item->{
-            map.put(item.getValue(),item.getLabel());
+        Map<String, String> map = new HashMap<>();
+        codeRecordList.forEach(item -> {
+            map.put(item.getValue(), item.getLabel());
         });
         return map;
     }
@@ -123,7 +126,7 @@ public class UserAuditRptController {
         List<CompareVo> dftMap = new ArrayList<CompareVo>();
         if (ObjectTypeEnum.USER.getValue().equals(vo.getObjectType())) {
             //用户信息
-            try{
+            try {
                 UserInfo oldUser = JSON.parseObject(vo.getPreviousData(), UserInfo.class);
                 UserInfo newUser = JSON.parseObject(vo.getJsonData(), UserInfo.class);
                 if (vo.getOperateType().equals(OperateTypeEnum.UPDATE.getValue())) {
@@ -135,12 +138,12 @@ public class UserAuditRptController {
                     }
                     vo.setDftList(dftMap);
                 }
-            }catch (Exception e){
-                logger.error("userInfo-getUserAuditRpt:id:"+vo.getId());
-                logger.error("",e);
+            } catch (Exception e) {
+                logger.error("userInfo-getUserAuditRpt:id:" + vo.getId());
+                logger.error("", e);
             }
-        }else if(ObjectTypeEnum.POSTINFO.getValue().equals(vo.getObjectType())){
-            try{
+        } else if (ObjectTypeEnum.POSTINFO.getValue().equals(vo.getObjectType())) {
+            try {
                 //职位信息
                 PostInfo newPost = JSON.parseObject(vo.getCurrentData(), PostInfo.class);
                 PostInfo oldPost = new PostInfo();
@@ -152,18 +155,18 @@ public class UserAuditRptController {
                     //放入对应枚举值
                     setEunm(compareVo);
                 }
-            }catch (Exception e){
-                logger.error("postInfo-getUserAuditRpt:id:"+vo.getId());
-                logger.error("",e);
+            } catch (Exception e) {
+                logger.error("postInfo-getUserAuditRpt:id:" + vo.getId());
+                logger.error("", e);
             }
-        }else if(ObjectTypeEnum.ACCOUNT.getValue().equals(vo.getObjectType())){
+        } else if (ObjectTypeEnum.ACCOUNT.getValue().equals(vo.getObjectType())) {
             //账号信息
-            try{
+            try {
                 AccountInfo newAccount = JSON.parseObject(vo.getCurrentData(), AccountInfo.class);
                 if (vo.getOperateType().equals(OperateTypeEnum.UPDATE.getValue())) {
                     if (StringUtils.isNotEmpty(vo.getPreviousData())) {
                         AccountInfo oldAccount = JSON.parseObject(vo.getPreviousData(), AccountInfo.class);
-                        dftMap = CompareUtils.compareVos(oldAccount, newAccount,"endDate","ipAddress","isAtive","password");
+                        dftMap = CompareUtils.compareVos(oldAccount, newAccount, "endDate", "ipAddress", "isAtive", "password");
                         for (CompareVo compareVo : dftMap) {
                             //放入对应枚举值
                             setEunm(compareVo);
@@ -171,10 +174,10 @@ public class UserAuditRptController {
                     }
                 }
 
-            }catch (Exception e){
-                logger.error("accountInfo-getUserAuditRpt:id:"+vo.getId());
-                logger.error("getUserAuditRpt:json:"+vo.toString());
-                logger.error("",e);
+            } catch (Exception e) {
+                logger.error("accountInfo-getUserAuditRpt:id:" + vo.getId());
+                logger.error("getUserAuditRpt:json:" + vo.toString());
+                logger.error("", e);
             }
         }
         return dftMap;
@@ -217,7 +220,7 @@ public class UserAuditRptController {
             beVal = "1".equals(beVal) ? "启用" : "停用";
             compareVo.setAfterVal(afterVal);
             compareVo.setBeforeVal(beVal);
-        } else if(name.equals("Password")){
+        } else if (name.equals("Password")) {
             afterVal = "******";
             beVal = "******";
             compareVo.setAfterVal(afterVal);
@@ -233,7 +236,7 @@ public class UserAuditRptController {
             }
             compareVo.setAfterVal(afterVal);
             compareVo.setBeforeVal(beVal);
-        }  else if (name.equals("PoliceBusiness")) {
+        } else if (name.equals("PoliceBusiness")) {
             String[] business = (StringUtils.isEmpty(compareVo.getAfterVal()) ? "" : compareVo.getAfterVal()).split(",");
             HashMap<String, String> map = getCodeVLMap(name);
             for (String b : business) {
@@ -262,7 +265,7 @@ public class UserAuditRptController {
             }
             compareVo.setAfterVal(afterVal.length() > 0 ? afterVal.substring(0, afterVal.length() - 1) : "");
             compareVo.setBeforeVal(beVal.length() > 0 ? beVal.substring(0, beVal.length() - 1) : "");
-        }  else if ("Company".equals(name)) {
+        } else if ("Company".equals(name)) {
             if (StringUtils.isNotBlank(compareVo.getAfterVal())) {
                 afterVal = iManufacturerInfoFacade.manufacturerInfoDetail(compareVo.getAfterVal()).getManufacturerName();
                 compareVo.setAfterVal(afterVal);
@@ -271,7 +274,7 @@ public class UserAuditRptController {
                 beVal = iManufacturerInfoFacade.manufacturerInfoDetail(compareVo.getBeforeVal()).getManufacturerName();
                 compareVo.setBeforeVal(beVal);
             }
-        }else if(codeMap.containsKey(name)){
+        } else if (codeMap.containsKey(name)) {
             HashMap<String, String> map = getCodeVLMap(name);
             compareVo.setAfterVal(map.get(compareVo.getAfterVal()));
             compareVo.setBeforeVal(map.get(compareVo.getBeforeVal()));
@@ -283,16 +286,16 @@ public class UserAuditRptController {
         HashMap<String, String> map = new HashMap<String, String>();
         String codeId = codeMap.get(name);
         List<Map<String, Object>> codeResource = iDuceapCodeFacade.getCodeResource(codeId);
-        codeResource.forEach(item->{
+        codeResource.forEach(item -> {
             String lable = item.get("NAME").toString();
             String value = item.get("CODE").toString();
-            map.put(value,lable);
+            map.put(value, lable);
         });
         return map;
     }
 
     public String getDate(String time) {
-        if(time.length() == 8) {
+        if (time.length() == 8) {
             SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.US);
             Date d = null;
             try {
@@ -303,10 +306,9 @@ public class UserAuditRptController {
                 e.printStackTrace();
             }
         }
-        if(time.length() == 10){
+        if (time.length() == 10) {
             return time;
-        }
-        else{
+        } else {
             SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy", Locale.US);
             Date d;
             String date = "";

+ 15 - 11
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/AppFunInfoController.java

@@ -14,6 +14,7 @@ import com.dragonsoft.duceap.commons.util.tree.TreeNodeUtils;
 import com.dragonsoft.duceap.web.annotation.Permission;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -32,10 +33,10 @@ import java.util.Map;
  * @author Administrator
  */
 @Api(tags = {"授权模块-菜单管理接口"})
-@Permission(value="power_config")
+@Permission(value = "power_config")
 @RestController
 @RequestMapping(value = "authsvr/v2/appfuninfo")
-public class AppFunInfoController  {
+public class AppFunInfoController {
 
     public static Logger logger = LoggerFactory.getLogger(AppFunInfoController.class);
 
@@ -47,32 +48,34 @@ public class AppFunInfoController  {
 
     /**
      * 获取所有菜单信息列表
+     *
      * @return
      */
     @ApiOperation(value = "获取所有菜单信息列表")
     @ApiImplicitParam(name = "appId", value = "应用id")
     @GetMapping(value = "/menuTreeList")
     public Result<List<Map<String, Object>>> getMenuTreeList(@RequestParam(value = "appId") String appId) {
-        List<TreeInfoVO>  funList = iAppFunInfoFacade.getAllTreeList(appId);
+        List<TreeInfoVO> funList = iAppFunInfoFacade.getAllTreeList(appId);
         List<Map<String, Object>> maps = TreeNodeUtils.generateTree(funList, new SimpleTreeNodeItemResolver("code", "pid"));
         for (Map<String, Object> map : maps) {
             List children = (List) map.get("children");
-            if(CollectionUtils.isNotEmpty(children)){
-                map.put("isParent",true);
+            if (CollectionUtils.isNotEmpty(children)) {
+                map.put("isParent", true);
             }
         }
         return Result.success(maps);
     }
 
     @ApiOperation(value = "根据id获取应用的菜单")
-    @ApiImplicitParam(name = "id", value = "菜单id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "菜单ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "/menuCode/{id}")
-    public Result<List<AppFunInfoVo>> getMenuCode(@PathVariable("id") String codeId){
-        List<AppFunInfo> resultList=iAppFunInfoFacade.getCode(codeId);
+    public Result<List<AppFunInfoVo>> getMenuCode(@PathVariable("id") String codeId) {
+        List<AppFunInfo> resultList = iAppFunInfoFacade.getCode(codeId);
         List<AppFunInfoVo> vos = new ArrayList<>();
         for (AppFunInfo source : resultList) {
             AppFunInfoVo vo = new AppFunInfoVo();
-            BeanUtils.copyProperties(source,vo);
+            BeanUtils.copyProperties(source, vo);
             vos.add(vo);
         }
         return Result.success(vos);
@@ -80,6 +83,7 @@ public class AppFunInfoController  {
 
     /**
      * 获取菜单、功能初始化
+     *
      * @param
      * @return
      */
@@ -95,8 +99,8 @@ public class AppFunInfoController  {
         List<Map<String, Object>> maps = TreeNodeUtils.generateTree(appAllTreeList, new SimpleTreeNodeItemResolver("code", "pid"));
         for (Map<String, Object> map : maps) {
             List children = (List) map.get("children");
-            if(CollectionUtils.isNotEmpty(children)){
-                   map.put("isParent",true);
+            if (CollectionUtils.isNotEmpty(children)) {
+                map.put("isParent", true);
             }
         }
         return Result.success(maps);

+ 226 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/DataAuthController.java

@@ -0,0 +1,226 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.TypeReference;
+import com.dragoninfo.dcuc.app.facade.IDataResourceFacade;
+import com.dragoninfo.dcuc.app.vo.DataResourceClassifyVo;
+import com.dragoninfo.dcuc.auth.auth.dto.data.*;
+import com.dragoninfo.dcuc.auth.auth.enumresources.SubDataAuthTypeEnum;
+import com.dragoninfo.dcuc.auth.auth.facade.IDataAuthFacade;
+import com.dragoninfo.dcuc.auth.auth.vo.BusResultVO;
+import com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data.*;
+import com.dragoninfo.dcuc.authweb.util.VersionUtils;
+import com.dragoninfo.dcuc.user.label.ILabelFacade;
+import com.dragoninfo.dcuc.user.label.dto.LabelSearchDto;
+import com.dragoninfo.dcuc.user.label.vo.LabelTreeVO;
+import com.dragoninfo.duceap.core.response.Result;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author mazq
+ * @date 2021/4/6
+ */
+@Slf4j
+@Api(tags ="数据授权API")
+@RestController
+@RequestMapping("authsvr/"+ VersionUtils.VERSION_UID +"/dataauth")
+public class DataAuthController {
+
+    public static final String idJoin = "|";
+
+    @Autowired
+    IDataAuthFacade dataAuthFacade;
+
+    @Autowired
+    ILabelFacade labelFacade;
+
+    @Autowired
+    IDataResourceFacade dataResourceFacade;
+
+
+
+    @ApiOperation(value = "获取属性列表,树形结构:警种1-业务域N")
+    @ApiImplicitParam(name = "name", value = "查询条件")
+    @RequestMapping(value = "businessTreeList", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
+    public Result<List<LabelTreeVO>> businessTreeList(@RequestBody LabelSearchDto labelSearchDto){
+        List<LabelTreeVO> labelTreeList = labelFacade.labelTreeList(labelSearchDto);
+        return Result.success(labelTreeList);
+    }
+
+
+    @ApiOperation(value = "获取所有数据资源,返回树结构")
+    @ApiImplicitParam(name = "attrType",value = "数据属性类型 TABLE:表 COLUMN:列")
+    @GetMapping(value = "allDataTree", produces = "application/json;charset=UTF-8")
+    public Result<List<DataResourceClassifyVo>> getAllDataResource(@RequestParam("attrType") String attrType){
+        log.info("allDataTree >> attrType:{}", attrType);
+        List<DataResourceClassifyVo> dataResourceTree = dataResourceFacade.getAllDataResourceTree(attrType);
+        return Result.success(dataResourceTree);
+    }
+
+    @ApiOperation(value = "获取数据资源,返回树结构")
+    @ApiImplicitParam(name = "typeCode",value = "typeCode类型(数据分级:DATA_CLASSIFY;数据资源分类:DATA_RESOURCE_CLASSIFY;数据安全级别:DATA_SECURITY_LEVEL;字段分类:COLUMN_CLASSIFY)")
+    @GetMapping(value = "getDataResourceTree")
+    public Result<DataResourceClassifyVo> getDataResource(@RequestParam("typeCode") String typeCode){
+        log.info("dataTree >> typeCode:{}", typeCode);
+        DataResourceClassifyVo dataResourceTree = dataResourceFacade.getDataResourceTree(typeCode);
+        return Result.success(dataResourceTree);
+    }
+
+    @ApiOperation(value = "人员数据授权接口")
+    @PostMapping(value = "userDataAuth", produces = "application/json;charset=UTF-8")
+    public Result<Boolean> userDataAuth(@RequestBody UserDataAuthAcceptVo vo){
+        List<DataAuthAcceptVo> authVoList = vo.getAuthVoList();
+        log.info("userDataAuth >> userDataAuthAcceptVo:{}",JSON.toJSONString(vo));
+        SubDataAuthDTO subDataAuthDTO = convertToSubAuthDTO(vo.getIdcard(), SubDataAuthTypeEnum.SUB_DATA_AUTH_USER.getValue(), vo.getAuthType(), authVoList);
+        dataAuthFacade.subDataAuthAdd(subDataAuthDTO);
+        return Result.success(true);
+    }
+
+
+    @ApiOperation(value = "机构数据授权接口")
+    @PostMapping(value = "orgDataAuth", produces = "application/json;charset=UTF-8")
+    public Result<Boolean> orgDataAuth(@RequestBody OrgDataAuthAcceptVo vo){
+        List<DataAuthAcceptVo> authVoList = vo.getAuthVoList();
+        log.info("orgDataAuth>>orgDataAuthAcceptVo:{}",JSON.toJSONString(vo));
+        SubDataAuthDTO subDataAuthDTO = convertToSubAuthDTO(vo.getOrgCode(), SubDataAuthTypeEnum.SUB_DATA_AUTH_ORG.getValue(), vo.getAuthType(), authVoList);
+        dataAuthFacade.subDataAuthAdd(subDataAuthDTO);
+        return Result.success(true);
+    }
+
+
+    @ApiOperation(value = "业务域标签数据授权接口")
+    @PostMapping(value = "labelDataAuth", produces = "application/json;charset=UTF-8")
+    public Result<Boolean> labelDataAuth(@RequestBody LabelDataAuthAcceptVo vo){
+        List<DataAuthAcceptVo> authVoList = vo.getAuthVoList();
+        log.info("labelDataAuth >> labelDataAuthAcceptVo:{}",JSON.toJSONString(vo));
+        SubDataAuthDTO subDataAuthDTO = convertToSubAuthDTO(vo.getBusinessCode(), SubDataAuthTypeEnum.SUB_DATA_AUTH_BUSINESS.getValue(), vo.getAuthType(), authVoList);
+        dataAuthFacade.subDataAuthAdd(subDataAuthDTO);
+        return Result.success(true);
+    }
+
+    @ApiOperation(value = "查询多个主体相关数据权限")
+    @PostMapping(value = "subListDataAuth", produces = "application/json;charset=UTF-8")
+    public Result subDataAuthList(@RequestBody List<SubDataAuthQueryVo> queryVoList) {
+        List<SubDataAuthQueryDTO> dtos = new ArrayList<>();
+        for (SubDataAuthQueryVo vo : queryVoList) {
+            SubDataAuthQueryDTO dto = new SubDataAuthQueryDTO();
+            BeanUtils.copyProperties(vo,dto);
+        }
+        List<DataClassifyDTO> classifyDTOS = dataAuthFacade.subDataAuthList(dtos);
+        List<DataClassifyVo> vos = convertToVos(classifyDTOS);
+        return Result.success(vos);
+    }
+
+    @ApiOperation(value = "查询单个主体数据权限")
+    @PostMapping(value = "getSubDataAuth" , produces = "application/json;charset=UTF-8")
+    public Result<List<DataClassifyVo>> getSubDataAuth(@RequestBody SubDataAuthQueryVo queryVo){
+        log.info("getSubDataAuth >> vo:{}",JSON.toJSONString(queryVo));
+        SubDataAuthQueryDTO queryDTO = new SubDataAuthQueryDTO();
+        BeanUtils.copyProperties(queryVo,queryDTO);
+        List<DataClassifyDTO> dtos = dataAuthFacade.getSubDataAuth(queryDTO);
+        List<DataClassifyVo> vos = convertToVos(dtos);
+        return Result.success(vos);
+    }
+
+
+    @ApiOperation(value = "人员视角数据权限查询-根据人员id查询")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "userId",value = "人员id"),
+            @ApiImplicitParam(name = "authType",value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
+    })
+    @GetMapping(value = "dataAuthInfoByUserId" , produces = "application/json;charset=UTF-8")
+    public Result<List<DataClassifyVo>> userDataAuthInfoById(@RequestParam("userId") String userId,
+                                   @RequestParam(value = "authType", required = false) String authType){
+        log.info("dataAuthInfoByUserId >> userId:{},authType:{}", userId, authType);
+        List<DataClassifyDTO> dtos = dataAuthFacade.userDataAuthInfoByUserId(userId, authType);
+        List<DataClassifyVo> vos = convertToVos(dtos);
+        return Result.success(vos);
+    }
+
+    @ApiOperation(value = "人员视角数据权限查询-根据人员身份证号查询")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "idcard",value = "身份证号"),
+            @ApiImplicitParam(name = "authType",value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
+    })
+    @GetMapping(value = "dataAuthInfoByIdcard" , produces = "application/json;charset=UTF-8")
+    public Result<List<DataClassifyVo>> userDataAuthInfoByIdcard(@RequestParam("idcard") String idcard,
+                                   @RequestParam(value = "authType",required = false) String authType){
+        List<DataClassifyDTO> dtos = dataAuthFacade.userDataAuthInfoByIdcard(idcard, authType);
+        List<DataClassifyVo> vos = convertToVos(dtos);
+        return Result.success(vos);
+    }
+
+    @ApiOperation(value = "人员视角-有权限的数据资源查询(树结构)-根据身份证号查询")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "idcard",value = "身份证号"),
+            @ApiImplicitParam(name = "authType",value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
+    })
+    @GetMapping(value = "userDataTreeByIdcard" , produces = "application/json;charset=UTF-8")
+    public Result<List<DataResourceClassifyVo>> userDataAuthTreeByIdcard(@RequestParam("idcard") String idcard, @RequestParam(value = "authType",required = false) String authType){
+        List<DataResourceDTO> dtos = dataAuthFacade.userDataTreeByIdcard(idcard, authType);
+        //树节点dto转vo多层次拷贝,使用JSONString序列化
+        //字段key值要能对应上
+        String dtoStr = JSON.toJSONString(dtos);
+        List<DataResourceClassifyVo> vos = JSON.parseObject(dtoStr, new TypeReference<List<DataResourceClassifyVo>>() {{
+        }});
+        return Result.success(vos);
+    }
+
+    @ApiOperation(value = "分级分类清单数据")
+    @PostMapping(value = "dataDetailList")
+    public Result dataDetailList(SearchDTO searchDTO){
+        BusResultVO busResultVO = dataAuthFacade.dataDetailList(searchDTO);
+        return Result.success((long) busResultVO.getResultData().getTotalCount(),busResultVO.getResultData().getDataList());
+    }
+
+    private List<DataClassifyVo> convertToVos(List<DataClassifyDTO> classifyDTOS) {
+        return classifyDTOS.stream().map(item -> {
+            DataClassifyVo vo = new DataClassifyVo();
+            BeanUtils.copyProperties(item, vo,"tickedDatas");
+            List<SubDataDTO> tickedDatas = item.getTickedDatas();
+            List<SubDataVo> dataVoList = tickedDatas.stream()
+                    .map(dto->{
+                        //拼接dataId给前端使用,保证dataId是唯一值
+                        dto.setDataId(dto.getClassifyCode()+ idJoin + dto.getDataId());
+                        SubDataVo subDataVo = new SubDataVo();
+                        BeanUtils.copyProperties(dto,subDataVo);
+                        return subDataVo;
+                    }).collect(Collectors.toList());
+            vo.setTickedDatas(dataVoList);
+            return vo;
+        }).collect(Collectors.toList());
+    }
+
+    private SubDataAuthDTO convertToSubAuthDTO(String subId, String subType, String authType,List<DataAuthAcceptVo> authVoList) {
+        SubDataAuthDTO subDataAuthDTO = new SubDataAuthDTO(subId,subType,authType);
+        List<SubDataDTO> dataDTOList = new ArrayList<>();
+        for (DataAuthAcceptVo vo : authVoList) {
+            SubDataDTO subDataDTO = new SubDataDTO();
+            subDataDTO.setDataType(vo.getDataType());
+            String dataId = vo.getDataId();
+            //除去分级分类标签的code
+            int index = dataId.indexOf(idJoin);
+            //从dataId截取拼接各种参数
+            int lastIndex = dataId.lastIndexOf(idJoin);
+            subDataDTO.setDataId(dataId.substring(index+1));
+            subDataDTO.setClassifyCode(dataId.substring(0,index));
+            subDataDTO.setDataCode(dataId.substring(lastIndex+1));
+            dataDTOList.add(subDataDTO);
+        }
+        subDataAuthDTO.setDataAuthList(dataDTOList);
+        return subDataAuthDTO;
+    }
+}

+ 46 - 35
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/RoleInfoController.java

@@ -16,6 +16,7 @@ import com.dragoninfo.dcuc.user.user.enumresources.YesNotEnum;
 import com.dragoninfo.duceap.core.response.Result;
 import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.base.entity.security.SecurityUser;
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.core.context.ContextUtils;
 import com.dragonsoft.duceap.core.search.Searchable;
@@ -24,6 +25,7 @@ import com.dragonsoft.duceap.core.search.filter.Condition;
 import com.dragonsoft.duceap.web.annotation.Permission;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,6 +55,7 @@ public class RoleInfoController {
 
     /**
      * 角色列表
+     *
      * @param searchDTO
      * @return
      */
@@ -71,7 +74,7 @@ public class RoleInfoController {
      */
     @ApiOperation(value = "保存菜单")
     @Permission(value = "power_config")
-    @PostMapping(value = "/rsGrid",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @PostMapping(value = "/rsGrid", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Result saveRsGrid(@RequestBody RoleFunRsRlVo roleFunRsRlVo) {
         Result result;
         try {
@@ -82,7 +85,7 @@ public class RoleInfoController {
             iRoleInfoFacade.saveRsGrid(rsGridList, roleId);
             result = Result.success("保存成功");
         } catch (Exception e) {
-            logger.error("saveRsGrid error:{}",e);
+            logger.error("saveRsGrid error:{}", e);
             result = Result.fail("保存异常");
 
         }
@@ -96,23 +99,25 @@ public class RoleInfoController {
      * @return
      */
     @ApiOperation(value = "查看角色信息")
-    @ApiImplicitParam(name = "id", value = "角色id")
-    @GetMapping(value = "/role/{id}",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "角色ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
+    @GetMapping(value = "/role/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Result<RoleInfoVo> roleInfo(@PathVariable("id") String id) {
         RoleInfo roleInfo = iRoleInfoFacade.get(id);
         RoleInfoVo vo = new RoleInfoVo();
-        BeanUtils.copyProperties(roleInfo,vo);
+        BeanUtils.copyProperties(roleInfo, vo);
         return Result.success(vo);
     }
 
     /**
      * 保存角色
+     *
      * @param roleInfoVo
      * @return
      */
     @ApiOperation(value = "保存角色信息")
     @Permission(value = "power_config")
-    @PostMapping(value = "/role",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @PostMapping(value = "/role", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Result saveRole(@RequestBody RoleInfoVo roleInfoVo) {
 
         Result result;
@@ -122,9 +127,9 @@ public class RoleInfoController {
                 return result;
             }
             Searchable searchable = Searchable.newSearchable();
-            searchable.addSearchFilter("code", SearchOperator.eq,roleInfoVo.getCode());
+            searchable.addSearchFilter("code", SearchOperator.eq, roleInfoVo.getCode());
             if (StringUtils.isNotEmpty(roleInfoVo.getId()))
-                searchable.addSearchFilter("id",SearchOperator.ne,roleInfoVo.getId());
+                searchable.addSearchFilter("id", SearchOperator.ne, roleInfoVo.getId());
             List<RoleInfo> list = iRoleInfoFacade.roleList(searchable.toSearchDTO());
             if (list != null && list.size() > 0)
                 return Result.fail("角色代码已被使用");
@@ -132,17 +137,17 @@ public class RoleInfoController {
             roleInfoVo.setInitNumber(0);
             roleInfoVo.setCreator(user.getId());
             roleInfoVo.setIsActive(YesNotEnum.YES.getValue());
-            roleInfoVo.setPoliceCategory(StringUtils.isEmpty(roleInfoVo.getPoliceCategory())?null:roleInfoVo.getPoliceCategory());
+            roleInfoVo.setPoliceCategory(StringUtils.isEmpty(roleInfoVo.getPoliceCategory()) ? null : roleInfoVo.getPoliceCategory());
             roleInfoVo.setCreateTime(new Date());
             //TODO
             //DTO暂未设计,沿用原来的接口参数,后期修改
             RoleInfo roleInfo = new RoleInfo();
-            BeanUtils.copyProperties(roleInfoVo,roleInfo);
+            BeanUtils.copyProperties(roleInfoVo, roleInfo);
             iRoleInfoFacade.save(roleInfo);
             result = Result.success("保存成功");
 
         } catch (Exception e) {
-            logger.error("",e);
+            logger.error("", e);
             result = Result.fail("保存失败");
 
         }
@@ -158,7 +163,7 @@ public class RoleInfoController {
      */
     @ApiOperation(value = "修改角色信息")
     @Permission(value = "power_config")
-    @PutMapping(value = "/role",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @PutMapping(value = "/role", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Result updateRole(@RequestBody RoleInfoVo roleInfoVo) {
         Result result;
         try {
@@ -167,9 +172,9 @@ public class RoleInfoController {
                 return result;
             }
             Searchable searchable = Searchable.newSearchable();
-            searchable.addSearchFilter("code", SearchOperator.eq,roleInfoVo.getCode());
+            searchable.addSearchFilter("code", SearchOperator.eq, roleInfoVo.getCode());
             if (StringUtils.isNotEmpty(roleInfoVo.getId()))
-                searchable.addSearchFilter("id",SearchOperator.ne,roleInfoVo.getId());
+                searchable.addSearchFilter("id", SearchOperator.ne, roleInfoVo.getId());
             List<RoleInfo> list = iRoleInfoFacade.roleList(searchable.toSearchDTO());
             if (list != null && list.size() > 0)
                 return Result.fail("角色代码已被使用");
@@ -180,14 +185,14 @@ public class RoleInfoController {
             role_info.setDetail(roleInfoVo.getDetail());
             role_info.setModifier(ContextUtils.getUserInfo().getName());
             role_info.setModifiedTime(new Date());
-            role_info.setPoliceCategory(StringUtils.isEmpty(roleInfoVo.getPoliceCategory())?null:roleInfoVo.getPoliceCategory());
+            role_info.setPoliceCategory(StringUtils.isEmpty(roleInfoVo.getPoliceCategory()) ? null : roleInfoVo.getPoliceCategory());
             role_info.setRoleBusiness(roleInfoVo.getRoleBusiness());
             role_info.setIsNotLimitCount(roleInfoVo.getIsNotLimitCount());
             iRoleInfoFacade.update(role_info);
             result = Result.success("保存成功");
 
         } catch (Exception e) {
-            logger.error("",e);
+            logger.error("", e);
             result = Result.fail("保存失败");
 
         }
@@ -202,9 +207,10 @@ public class RoleInfoController {
      * @return
      */
     @ApiOperation(value = "删除角色信息")
-    @ApiImplicitParam(name = "id", value = "角色id",required = true)
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "角色ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @Permission(value = "power_config")
-    @DeleteMapping(value = "/role/{id}",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @DeleteMapping(value = "/role/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Result deleteRole(@PathVariable("id") String id) {
         Result result;
         try {
@@ -214,7 +220,7 @@ public class RoleInfoController {
             iRoleInfoFacade.delAllRolesInfo(id);
             result = Result.success("删除成功");
         } catch (Exception e) {
-            logger.error("delete role error:{}",e);
+            logger.error("delete role error:{}", e);
             result = Result.fail("删除异常");
 
         }
@@ -224,11 +230,12 @@ public class RoleInfoController {
 
     /**
      * 根据角色获取选中菜单、功能
+     *
      * @param roleId 角色id
      * @return
      */
     @ApiOperation(value = "根据角色获取选中菜单、功能")
-    @ApiImplicitParam(name = "roleId", value = "角色id",required = true)
+    @ApiImplicitParam(name = "roleId", value = "角色id", required = true)
     @GetMapping(value = "/checked/{roleId}")
     public Result<List<RsGridCheckedVO>> checked(@PathVariable("roleId") String roleId) {
         List<RsGridCheckedVO> rsGridCheckedVOList = iRoleInfoFacade.getRsGridChecked(roleId);
@@ -238,45 +245,48 @@ public class RoleInfoController {
 
     /**
      * 获取角色配额授权情况列表
+     *
      * @param searchDTO
      * @return
      */
     @ApiOperation(value = "获取角色配额授权情况列表")
-    @ApiImplicitParam(name = "searchDTO", value = "查询条件,applicationId不能为空",required = true)
+    @ApiImplicitParam(name = "searchDTO", value = "查询条件,applicationId不能为空", required = true)
     @PostMapping(value = "/roleQuotaList/_search")
     public Result<List<RoleInfoVO>> getRoleQuotaList(SearchDTO searchDTO) {
         Searchable searchable = Searchable.toSearchable(searchDTO);
         Condition condition = searchable.getSearchFilterByKey("applicationId_eq");
-        if(null == condition) return Result.fail("400","applicationId 不能为空");
+        if (null == condition) return Result.fail("400", "applicationId 不能为空");
         String applicationId = (String) condition.getValue();
-        if(StringUtils.isBlank(applicationId)) return Result.fail("400","applicationId 不能为空");
+        if (StringUtils.isBlank(applicationId)) return Result.fail("400", "applicationId 不能为空");
         Page<RoleInfoVO> page = iRoleInfoFacade.getRoleQuotaList(searchDTO);
         return Result.success(page.getTotalElements(), page.getContent());
     }
 
     /**
      * 获取应用有限配额的角色列表
+     *
      * @param searchDTO
      * @return
      */
     @ApiOperation(value = "获取应用有限配额的角色列表")
-    @ApiImplicitParam(name = "searchDTO", value = "查询条件,applicationId不能为空",required = true)
+    @ApiImplicitParam(name = "searchDTO", value = "查询条件,applicationId不能为空", required = true)
     @PostMapping(value = "/orgQuotoAuthInfo/_search")
     public Result<List<RoleInfoVO>> getOrgQuotoAuthInfo(SearchDTO searchDTO) {
         Searchable searchable = Searchable.toSearchable(searchDTO);
         Condition condition = searchable.getSearchFilterByKey("applicationId_eq");
-        if(null == condition){
-            return Result.fail("400","applicationId 不能为空");
+        if (null == condition) {
+            return Result.fail("400", "applicationId 不能为空");
         }
         String applicationId = (String) condition.getValue();
-        if(StringUtils.isBlank(applicationId)){
-            return Result.fail("400","applicationId 不能为空");
+        if (StringUtils.isBlank(applicationId)) {
+            return Result.fail("400", "applicationId 不能为空");
         }
         Condition roleLevel_eq = searchable.getSearchFilterByKey("roleLevel_eq");
-        if (roleLevel_eq!=null){
+        if (roleLevel_eq != null) {
             searchable.removeSearchFilter("roleLevel_eq");
-            searchable.addSearchFilter("role_level",SearchOperator.eq,roleLevel_eq.getValue());
+            searchable.addSearchFilter("role_level", SearchOperator.eq, roleLevel_eq.getValue());
         }
+        searchable.addSearchFilter("is_not_limit_count", SearchOperator.eq, BooleanEnum.FALSE.value);
         Page<RoleInfoVO> page = iRoleInfoFacade.getQuotoRoles(searchable.toSearchDTO());
         return Result.success(page.getTotalElements(), page.getContent());
     }
@@ -289,7 +299,7 @@ public class RoleInfoController {
      */
     @ApiOperation(value = "角色初始配额信息保存")
     @Permission(value = "quota_init")
-    @PostMapping(value = "/roleQuota",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @PostMapping(value = "/roleQuota", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public Result roleQuotaSave(@RequestBody List<RoleQuotaVo> roleQuotaList) {
         Result result;
         try {
@@ -297,7 +307,7 @@ public class RoleInfoController {
             iRoleInfoFacade.roleQuotaSave(listStr);
             result = Result.success("保存成功");
         } catch (Exception e) {
-            logger.error("role quota save error:{}",e);
+            logger.error("role quota save error:{}", e);
             result = Result.fail(e.getMessage());
         }
         return result;
@@ -305,21 +315,22 @@ public class RoleInfoController {
 
     /**
      * 用户角色列表
+     *
      * @param searchDTO
      * @return
      */
     @ApiOperation(value = "用户角色列表")
-    @ApiImplicitParam(name = "searchDTO", value = "查询条件,staffId不能为空 ",required = true)
+    @ApiImplicitParam(name = "searchDTO", value = "查询条件,staffId不能为空 ", required = true)
     @PostMapping(value = "/userRole/_search")
     public Result<List<StaffAssignAuthInfoVo>> userRole(SearchDTO searchDTO) {
         Searchable searchable = Searchable.toSearchable(searchDTO);
         String staffId = (String) searchable.getSearchFilterByKey("staffId_eq").getValue();
-        if(StringUtils.isBlank(staffId)) return Result.fail("300","staffId 不能为空");
+        if (StringUtils.isBlank(staffId)) return Result.fail("300", "staffId 不能为空");
         Page<StaffAssignAuthInfo> page = iStaffAssignAuthInfoFacade.findForPage(searchable.toSearchDTO());
         List<StaffAssignAuthInfoVo> vos = new ArrayList<>();
         for (StaffAssignAuthInfo source : page.getContent()) {
             StaffAssignAuthInfoVo vo = new StaffAssignAuthInfoVo();
-            BeanUtils.copyProperties(source,vo);
+            BeanUtils.copyProperties(source, vo);
         }
         return Result.success(page.getTotalElements(), vos);
     }

+ 3 - 1
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/ServiceAuthResultController.java

@@ -89,7 +89,9 @@ public class ServiceAuthResultController {
     @ApiImplicitParam(name = "searchDTO", value = "服务授权vo")
     @DeleteMapping(value = "auth/{id}")
     public Result delService(@PathVariable("id") String id) {
-        ResponseDTO responseDTO = serviceAuthResultFacade.delServiceAuthResult(id);
+        ServiceAuthResultDTO serviceAuthResultDTO=new ServiceAuthResultDTO();
+        serviceAuthResultDTO.setId(id);
+        ResponseDTO responseDTO = serviceAuthResultFacade.delServiceAuthResult(serviceAuthResultDTO);
         if (ResponseDTO.SUCCESS_CODE.equals(responseDTO.getStatusCode())) {
             return Result.success(responseDTO.getMessage());
         }

+ 32 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataAuthAcceptVo.java

@@ -0,0 +1,32 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author mazq
+ * @date 2021/4/8
+ */
+@ApiModel(value = "同一类别数据授权对象")
+@Data
+public class DataAuthAcceptVo {
+
+    @ApiModelProperty(value = "数据资源唯一标识")
+    private String dataId;
+
+    @ApiModelProperty(value = "数据资源类型,对应类型码值" +
+            "DATA_SECURITY_LEVEL:数据安全级别;" +
+            "LEVEL_1_COLUMN_CLASSIFY:字段一级分类;" +
+            "LEVEL_2_COLUMN_CLASSIFY:字段二级分类;" +
+            "DATA_CLASSIFY:数据分级", dataType = "string")
+    private String dataType;
+
+    @ApiModelProperty(value = "数据资源code")
+    private String dataCode;
+
+    @ApiModelProperty(value = "数据对应的分级分类标签code")
+    private String classifyCode;
+
+
+}

+ 26 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataClassifyVo.java

@@ -0,0 +1,26 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/4/15
+ */
+@Data
+@ApiModel(value = "拥有的数据权限Vo")
+public class DataClassifyVo {
+    @ApiModelProperty(value = "id,分级分类唯一标识")
+    private String id;
+    @ApiModelProperty(value = "分级分类名称")
+    private String label;
+    @ApiModelProperty(value = "分级分类code值")
+    private String code;
+    @ApiModelProperty(value = "数据属性类型 TABLE:表 COLUMN:列")
+    private String attrType;
+    @ApiModelProperty(value = "分级分类下被勾选的叶子节点对象集合")
+    private List<SubDataVo> tickedDatas;
+}

+ 27 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataDetailConditionVo.java

@@ -0,0 +1,27 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/4/19
+ */
+@ApiModel(value = "查询条件")
+@Data
+@NoArgsConstructor
+public class DataDetailConditionVo {
+
+    @ApiModelProperty(value = "目录名称,模糊查询")
+    private String resourceName;
+
+    @ApiModelProperty(value = "规范数据项集名称和数据对象中文名称模糊查询")
+    private String keyword;
+
+    @ApiModelProperty(value = "表级数据类别,精确查询,多个条件间关系为AND")
+    private List<ResourceTypeQueryVo> resourceTypes;
+}

+ 27 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataDetailQueryVo.java

@@ -0,0 +1,27 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author mazq
+ * @date 2021/4/19
+ */
+@ApiModel(value = "数据清单查询Vo")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class DataDetailQueryVo {
+
+    @ApiModelProperty(value = "页码")
+    private Integer page;
+
+    @ApiModelProperty(value = "页面数量")
+    private Integer pageSize;
+
+    @ApiModelProperty(value = "查询条件")
+    private DataDetailConditionVo condition;
+}

+ 37 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/DataResourceTreeVo.java

@@ -0,0 +1,37 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/4/13
+ */
+@Data
+@ApiModel(value = "数据资源树对象")
+public class DataResourceTreeVo {
+
+    @ApiModelProperty(value = "节点id")
+    private String id;
+    @ApiModelProperty(value = "数据资源code")
+    private String code;
+    @ApiModelProperty(value = "节点名称")
+    private String label;
+    @ApiModelProperty(value = "节点详细说明")
+    private String desc;
+    @ApiModelProperty(value = "数据资源类型" +
+            "数据安全级别:DATA_SECURITY_LEVEL " +
+            "字段一级分类:LEVEL_1_COLUMN_CLASSIFY" +
+            "字段二级分类:LEVEL_2_COLUMN_CLASSIFY" +
+            "数据分级:DATA_CLASSIFY")
+    private String dataType;
+    @ApiModelProperty(value = "子节点集合")
+    private List<DataResourceTreeVo> child;
+    @ApiModelProperty(value = "是否是树节点 true:是树节点,child不为空。false:非树节点,child为空。")
+    private Boolean treeNode;
+    @ApiModelProperty(value = "父节点id")
+    private String pId;
+}

+ 26 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/LabelDataAuthAcceptVo.java

@@ -0,0 +1,26 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/4/8
+ */
+@ApiModel("业务域数据授权接收对象")
+@Data
+public class LabelDataAuthAcceptVo {
+
+    @ApiModelProperty(value = "业务域表码code值")
+    private String businessCode;
+
+    @ApiModelProperty(value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
+    private String authType;
+
+    @ApiModelProperty(value = "需要授权的数据对象",dataType = "object[]")
+    private List<DataAuthAcceptVo> authVoList;
+
+}

+ 26 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/OrgDataAuthAcceptVo.java

@@ -0,0 +1,26 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/4/8
+ */
+@ApiModel(value = "机构数据授权接收对象")
+@Data
+public class OrgDataAuthAcceptVo {
+
+    @ApiModelProperty(value = "机构code")
+    private String orgCode;
+
+    @ApiModelProperty(value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
+    private String authType;
+
+    @ApiModelProperty(value = "需要授权的数据对象",dataType = "object[]")
+    private List<DataAuthAcceptVo> authVoList;
+
+}

+ 25 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/ResourceTypeQueryVo.java

@@ -0,0 +1,25 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author mazq
+ * @date 2021/4/19
+ */
+@ApiModel(value = "查询条件")
+@Data
+@NoArgsConstructor
+public class ResourceTypeQueryVo {
+
+    @ApiModelProperty(value = "数据资源类型code值")
+    private String typeCode;
+
+    @ApiModelProperty(value = "数据资源code值")
+    private String codeValue;
+
+
+
+}

+ 23 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/SubDataAuthQueryVo.java

@@ -0,0 +1,23 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author mazq
+ * @date 2021/4/13
+ */
+@Data
+@ApiModel("主体数据权限查询参数封装对象")
+public class SubDataAuthQueryVo {
+
+    @ApiModelProperty(value = "主体id: 人员|机构id/业务域code")
+    private String subId;
+
+    @ApiModelProperty(value = "主体类型:机构:ORG|人员:USER|业务域:BUSINESS")
+    private String subType;
+
+    @ApiModelProperty(value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
+    private String authType;
+}

+ 27 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/SubDataVo.java

@@ -0,0 +1,27 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author mazq
+ * @date 2021/4/16
+ */
+@ApiModel(value = "主体授权的数据资源")
+@Data
+public class SubDataVo {
+
+    @ApiModelProperty(value = "数据资源唯一标识")
+    private String dataId;
+
+    @ApiModelProperty(value = "数据类型")
+    private String dataType;
+
+    @ApiModelProperty(value = "数据资源code集合")
+    private String dataCode;
+
+    @ApiModelProperty(value = "数据对应的分级分类标签code")
+    private String classifyCode;
+
+}

+ 25 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/vo/data/UserDataAuthAcceptVo.java

@@ -0,0 +1,25 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth.vo.data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2021/4/8
+ */
+@ApiModel(value = "人员数据授权接对象")
+@Data
+public class UserDataAuthAcceptVo {
+
+    @ApiModelProperty(value = "人员idcard")
+    private String idcard;
+
+    @ApiModelProperty(value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
+    private String authType;
+
+    @ApiModelProperty(value = "需要授权的数据对象",dataType = "object[]")
+    private List<DataAuthAcceptVo> authVoList;
+}

+ 16 - 9
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/login/DcucLoginController.java

@@ -1,6 +1,7 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.login;
 
 
+import cn.hutool.core.util.StrUtil;
 import com.dragoninfo.dcuc.auth.auth.facade.IRoleFacade;
 import com.dragoninfo.dcuc.authweb.config.DcucAuthWebConfig;
 import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
@@ -13,12 +14,14 @@ import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
 import com.dragonsoft.duceap.base.entity.security.SecurityRight;
 import com.dragonsoft.duceap.base.entity.security.SecurityUser;
 import com.dragonsoft.duceap.base.utils.UserContextUtils;
+import com.dragonsoft.duceap.commons.util.json.JsonUtils;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.web.SecurityProperties;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -52,35 +55,39 @@ public class DcucLoginController {
     }
 
     @GetMapping(value = "/info")
-    public SecurityUser info() {
-        UserInfo userInfo = new UserInfo();
+    public SecurityUser info(@RequestHeader(value = "userToken",required = false) String userToken,
+                             @RequestHeader(value = "appToken", required = false) String appToken) {
+        logger.info("UserToken:{},appToken:{}", userToken, appToken);
+
+        UserInfo userInfo;
         try {
             SecurityUser securityUser = (SecurityUser) UserContextUtils.getCurrentUser();
-            if("dids".equals(securityProperties.getType())){
+            if ("dids".equals(securityProperties.getType())) {
                 userInfo = userFacade.detailBySfzh(securityUser.getIdcard());
                 securityUser.setName(userInfo.getName());
                 securityUser.setUserName(userInfo.getName());
-            }
-            if("dcuc".equals(securityProperties.getType())){
+            } else {
                 userInfo = iUserInfoFacade.userDetail(securityUser.getId());
             }
-            securityUser.setId(userInfo.getId());
+                securityUser.setId(userInfo.getId());
             List<SecurityRight> authmenu = getAuthmenu(securityUser, userInfo);
             securityUser.setSecurityRightList(authmenu);
-            //todo 因为数据库不同  后续不需要下面代码
-            securityUser.setIdcard(userInfo.getIdcard());
-            securityUser.setName(userInfo.getName());
             //ADMIN管理员
             String rootOrgid = userInfo.getOrgId();
             if (iUserInfoFacade.isRootUser(securityUser.getId()) && StringUtils.isEmpty(rootOrgid)) {
                 rootOrgid = iOrgInfoFacade.getRootOrgId();
             }
+
             securityUser.setSecurityOrg(rootOrgid);
+
+            logger.info("securityUser:{}", JsonUtils.toJSONString(securityUser));
+
             return securityUser;
         } catch (Exception var3) {
             logger.error("获取用户信息异常", var3);
             throw new SecurityException("获取用户信息异常", var3);
         }
+
     }
 
 

+ 51 - 43
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/GovernmentInfoController.java

@@ -50,90 +50,98 @@ public class GovernmentInfoController {
     @Autowired
     private IGovUserInfoFacade iGovUserInfoFacade;
 
-    @ApiOperation(value="政务机构新增")
+    @ApiOperation(value = "政务机构新增")
     @PostMapping("govOrg")
-    public Result save(@RequestBody GovOrgVo vo){
-        try{
+    public Result save(@RequestBody GovOrgVo vo) {
+        try {
             GovInfo government = new GovInfo();
-            BeanUtils.copyProperties(government,vo);
-            if(StringUtils.isBlank(government.getUpGovId())){
+            BeanUtils.copyProperties(government, vo);
+            if (StringUtils.isBlank(government.getUpGovId())) {
                 government.setIsRoot("0");
-            }else{
+            } else {
                 government.setIsRoot("1");
             }
             SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
-            if (iGovInfoFacade.checkCode("", government.getCode()))
+            if (iGovInfoFacade.checkCode("", government.getCode())) {
                 return Result.fail(ResultEnum.FAIL.getKey(), "政务机构代码已存在");
-            if (iGovInfoFacade.checkName("", government.getFullName(), ""))
+            }
+            if (iGovInfoFacade.checkName("", government.getFullName(), "")) {
                 return Result.fail(ResultEnum.FAIL.getKey(), "政务机构名称已存在");
-            if (!iUserInfoFacade.getRootUser().equals(user.getUserName()) && StringUtils.isEmpty(government.getUpGovId()))
+            }
+            if (!iUserInfoFacade.getRootUser().equals(user.getUserName()) && StringUtils.isEmpty(government.getUpGovId())) {
                 return Result.fail(ResultEnum.FAIL.getKey(), "请选择机构后再新增!");
+            }
             iGovInfoFacade.addGov(government);
-        }catch (Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
-            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"新增异常");
+            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "新增异常");
         }
         return Result.success();
     }
 
-    @ApiOperation(value="政务机构修改")
+    @ApiOperation(value = "政务机构修改")
     @PutMapping("govOrg/{id}")
-    public Result update(@RequestBody GovOrgVo vo){
-        try{
+    public Result update(@RequestBody GovOrgVo vo) {
+        try {
             GovInfo government = new GovInfo();
-            BeanUtils.copyProperties(government,vo);
+            BeanUtils.copyProperties(government, vo);
             government = setUpdateProperties(government);
             iGovInfoFacade.updateGov(government);
-        }catch(Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
-            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"修改异常");
+            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "修改异常");
         }
         return Result.success();
     }
 
     @ApiOperation(value = "删除政务机构")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @DeleteMapping("govOrg/{id}")
-    public Result delete(@PathVariable("id") String id){
+    public Result delete(@PathVariable("id") String id) {
         Searchable searchable = Searchable.newSearchable();
-        searchable.addSearchFilter("gov_id", SearchOperator.eq,id);
-        searchable.addSearchFilter("deleted",SearchOperator.eq, YesNotEnum.NO.getValue());
+        searchable.addSearchFilter("gov_id", SearchOperator.eq, id);
+        searchable.addSearchFilter("deleted", SearchOperator.eq, YesNotEnum.NO.getValue());
         SearchDTO searchDTO = searchable.toSearchDTO();
         Page<GovUserInfo> page = iGovUserInfoFacade.govUserInfoPage(searchDTO);
-        if (page.getContent().size() > 0)
+        if (page.getContent().size() > 0) {
             return Result.fail("该机构有人员存在,不可删除");
+        }
         iGovInfoFacade.deleteOrg(id);
         return Result.success();
     }
 
-    @ApiOperation(value="获取政务机构")
+    @ApiOperation(value = "获取政务机构")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "govOrg/{id}")
-    public Result get(@PathVariable("id") String id){
+    public Result get(@PathVariable("id") String id) {
         GovInfo government = new GovInfo();
         government = iGovInfoFacade.getGovInfoById(id);
         GovOrgVo vo = new GovOrgVo();
         try {
-            BeanUtils.copyProperties(vo,government);
+            BeanUtils.copyProperties(vo, government);
         } catch (Exception e) {
-            logger.error(e.getMessage(),e);
+            logger.error(e.getMessage(), e);
             return Result.fail("属性复制异常");
         }
         return Result.success(vo);
     }
 
 
-    @ApiOperation(value="政务机构树")
-    @ApiImplicitParam(name = "id",value = "id")
+    @ApiOperation(value = "政务机构树")
+    @ApiImplicitParam(name = "id", value = "id")
     @PostMapping(value = "govOrg/tree/full")
     public Result fullGovTree(@RequestBody Map params) {
         String id = (String) params.get("id");
-        if (StringUtils.isEmpty(id)){
+        if (StringUtils.isEmpty(id)) {
             //根节点
             GovInfo root = iGovInfoFacade.getRootGov();
             List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
-            resultList.add(treeMapFilter(root,null,""));
+            resultList.add(treeMapFilter(root, null, ""));
             return Result.success(resultList);
         }
-        return  Result.success(getChildTreeNode(id, YesNotEnum.NO.getValue()));
+        return Result.success(getChildTreeNode(id, YesNotEnum.NO.getValue()));
     }
 
     @ApiOperation(value = "政务机构拖动排序")
@@ -143,12 +151,12 @@ public class GovernmentInfoController {
             @ApiImplicitParam(name = "moveType", value = "prev:目标机构前,next: 目标机构后", required = true)
     })
     @PostMapping(value = "govOrg/sort")
-    public Result reSort(@RequestBody SortVo sortVo){
-        try{
+    public Result reSort(@RequestBody SortVo sortVo) {
+        try {
             iGovInfoFacade.reSort(sortVo.getStartId(), sortVo.getEndId(), sortVo.getMoveType());
-        }catch (Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
-            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"排序异常");
+            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "排序异常");
         }
 
         return Result.success();
@@ -160,16 +168,16 @@ public class GovernmentInfoController {
             @ApiImplicitParam(name = "pageSize", value = "页数", required = true)
     })
     @PostMapping(value = "govOrg/tree/match")
-    public Result govMatch( @RequestBody Map map){
-        String name =map.get("name").toString();
-        Integer pageNum =Integer.valueOf(map.get("pageNum").toString());
-        Integer pageSize =Integer.valueOf(map.get("pageSize").toString());
-        return Result.success(iGovInfoFacade.govMatch(name,pageNum,pageSize).getResult());
+    public Result govMatch(@RequestBody Map map) {
+        String name = map.get("name").toString();
+        Integer pageNum = Integer.valueOf(map.get("pageNum").toString());
+        Integer pageSize = Integer.valueOf(map.get("pageSize").toString());
+        return Result.success(iGovInfoFacade.govMatch(name, pageNum, pageSize).getResult());
     }
 
-    private GovInfo setUpdateProperties(GovInfo government){
+    private GovInfo setUpdateProperties(GovInfo government) {
         GovInfo oldGov = new GovInfo();
-        if(StringUtils.isNotBlank(government.getId())){
+        if (StringUtils.isNotBlank(government.getId())) {
             oldGov = iGovInfoFacade.getGovInfoById(government.getId());
         }
         oldGov.setId(government.getId());
@@ -186,7 +194,7 @@ public class GovernmentInfoController {
      *
      * @param government
      * @param orgNums
-     * @param state   节点勾选状态
+     * @param state      节点勾选状态
      * @return
      */
     private Map<String, Object> treeMapFilter(GovInfo government, Map<String, Long> orgNums, String state) {
@@ -196,7 +204,7 @@ public class GovernmentInfoController {
         map.put("name", StringEscapeUtils.unescapeHtml4(government.getFullName()));
         map.put("pid", government.getUpGovId());
         map.put("isParent", true);
-        if (null == orgNums){
+        if (null == orgNums) {
             map.put("isParent", true);
             return map;
         }

+ 39 - 17
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/org/OrgInfoController.java

@@ -55,7 +55,7 @@ import java.util.*;
 
 @Api(tags = {"机构管理接口"})
 @RestController
-@RequestMapping(value = "/orgsvr/"+ VersionUtils.VERSION_UID+"/")
+@RequestMapping(value = "/orgsvr/" + VersionUtils.VERSION_UID + "/")
 public class OrgInfoController {
     @Autowired
     private IOrgInfoFacade iOrgInfoFacade;
@@ -80,6 +80,7 @@ public class OrgInfoController {
 
     /**
      * 当前用户的管理范围机构树
+     *
      * @param params type:机构树类型 (ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围 ), id:异步加载的树节点
      * @return
      */
@@ -108,12 +109,13 @@ public class OrgInfoController {
      * 获取单个树节点机构信息
      */
     @ApiOperation(value = "单个树节点信息")
-    @ApiImplicitParam(name = "id", value = "id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "org/tree/node/{id}")
-    public Result<OrgTreeNodeVo> orgTreeNode(@PathVariable("id")String id) {
+    public Result<OrgTreeNodeVo> orgTreeNode(@PathVariable("id") String id) {
         OrgTreeNode orgTreeNode = iOrgInfoFacade.getOrgTreeNode(id);
         OrgTreeNodeVo vo = new OrgTreeNodeVo();
-        BeanUtils.copyProperties(orgTreeNode,vo);
+        BeanUtils.copyProperties(orgTreeNode, vo);
         vo.setName(orgTreeNode.getLabel());
         return Result.success(vo);
     }
@@ -121,6 +123,7 @@ public class OrgInfoController {
 
     /**
      * 管理员管理—管理范围—分配树
+     *
      * @return
      */
     @ApiOperation(value = "管理员管理—管理范围—分配树")
@@ -138,8 +141,8 @@ public class OrgInfoController {
         SecurityUser curUser = (SecurityUser) ContextUtils.getUserInfo();
         String mtAuthIds = mtAuthBusiness.getMtAuth(curUser.getId(), mtType);
         //当临时表没有数据时候,获取登录人的权限范围
-        if (StringUtils.isEmpty(mtAuthIds)&&SysConstants.MT_TEMP.equals(orgRangeVo.getMtType())){
-            mtAuthIds=iAppMtAuthFacade.mgeAppRightRangeStr(ContextUtils.getUserInfo().getId());
+        if (StringUtils.isEmpty(mtAuthIds) && SysConstants.MT_TEMP.equals(orgRangeVo.getMtType())) {
+            mtAuthIds = iAppMtAuthFacade.mgeAppRightRangeStr(ContextUtils.getUserInfo().getId());
         }
         if (StringUtils.isEmpty(id)) {
             //获取机构树根节点列表
@@ -153,6 +156,7 @@ public class OrgInfoController {
 
     /**
      * 、机构新增
+     *
      * @return
      */
     @ApiOperation(value = "机构新增")
@@ -163,13 +167,16 @@ public class OrgInfoController {
             UserUtils.copyObject(orgInfo, vo);
             SecurityUser user = (SecurityUser) ContextUtils.getUserInfo();
             orgInfo = this.upSetOrg(orgInfo);
-            if (iOrgInfoFacade.checkCode("", orgInfo.getCode()) != null)
+            if (iOrgInfoFacade.checkCode("", orgInfo.getCode()) != null) {
                 return Result.fail(ResultEnum.FAIL.getKey(), "机构代码已存在");
-            if (iOrgInfoFacade.checkName("", orgInfo.getFullName(), "") != null)
+            }
+            if (iOrgInfoFacade.checkName("", orgInfo.getFullName(), "") != null) {
                 return Result.fail(ResultEnum.FAIL.getKey(), "机构名称已存在");
+            }
 
-            if (!iUserInfoFacade.getRootUser().equals(user.getUserName()) && StringUtils.isEmpty(orgInfo.getUpGovId()))
+            if (!iUserInfoFacade.getRootUser().equals(user.getUserName()) && StringUtils.isEmpty(orgInfo.getUpGovId())) {
                 return Result.fail(ResultEnum.FAIL.getKey(), "请选择机构后再新增!");
+            }
             //保存机构在这
             orgInfo = iOrgInfoFacade.addOrg(orgInfo);
             // TODO: 2019/1/30
@@ -201,10 +208,12 @@ public class OrgInfoController {
     @PutMapping(value = "org/{id}")
     public Result update(@RequestBody OrgVo vo) {
         try {
-            if (iOrgInfoFacade.checkCode(vo.getId(), vo.getCode()) != null)
+            if (iOrgInfoFacade.checkCode(vo.getId(), vo.getCode()) != null) {
                 return Result.fail(ResultEnum.FAIL.getKey(), "机构代码已存在");
-            if (iOrgInfoFacade.checkName(vo.getId(), vo.getFullName(), "") != null)
+            }
+            if (iOrgInfoFacade.checkName(vo.getId(), vo.getFullName(), "") != null) {
                 return Result.fail(ResultEnum.FAIL.getKey(), "机构名称已存在");
+            }
             OrgInfo orgInfo = iOrgInfoFacade.detail(vo.getId());
             Date date = orgInfo.getOrgEndDate();
             UserUtils.copyObject(orgInfo, vo);
@@ -219,6 +228,7 @@ public class OrgInfoController {
 
     /**
      * 设置org更新值
+     *
      * @param orgInfo
      */
 
@@ -248,10 +258,12 @@ public class OrgInfoController {
 
     /**
      * 机构删除
+     *
      * @return
      */
     @ApiOperation(value = "机构删除")
-    @ApiImplicitParam(name = "id", value = "id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @DeleteMapping(value = "org/{id}")
     public Result deleteOrg(@PathVariable("id") String id) {
         logger.info(id);
@@ -260,11 +272,13 @@ public class OrgInfoController {
         searchable.addSearchFilter("deleted", SearchOperator.eq, YesNotEnum.NO.getValue());
         SearchDTO searchDTO = searchable.toSearchDTO();
         Page<UserInfo> page = iUserInfoFacade.userList(searchDTO);
-        if (page.getContent().size() > 0)
+        if (page.getContent().size() > 0) {
             return Result.fail(ResultEnum.FAIL.getKey(), "该机构有人员存在,不可删除");
+        }
         Page<ApplyInfo> appPage = applyInfoFacade.applyInfoPage(searchDTO);
-        if (appPage.getContent().size() > 0)
+        if (appPage.getContent().size() > 0) {
             return Result.fail(ResultEnum.FAIL.getKey(), "该机构有应用存在,不可删除");
+        }
 //        searchable = Searchable.newSearchable();
 //        searchable.addSearchFilter("orgId", SearchOperator.eq, id);
 //        searchDTO = searchable.toSearchDTO();
@@ -306,6 +320,7 @@ public class OrgInfoController {
 
     /**
      * 机构合并
+     *
      * @param mergersVo
      * @return
      */
@@ -328,7 +343,7 @@ public class OrgInfoController {
                     iAppMtAuthFacade.save("", note.getUserId());
                     iUserMtAuthFacade.save("", note.getUserId());
                     iOrgMtAuthFacade.save("", note.getUserId());
-                    iManageInfoFacade.deleteAdmin(note.getUserId(),"");
+                    iManageInfoFacade.deleteAdmin(note.getUserId(), "");
                 }
             }
         }
@@ -353,12 +368,14 @@ public class OrgInfoController {
 
     /**
      * 机构详情
+     *
      * @param orgId
      * @return
      */
     @GetMapping(value = "org/{id}")
     @ApiOperation(value = "获取单个机构")
-    @ApiImplicitParam(name = "id", value = "id", required = true)
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     public Result<OrgVo> orgInfoDetail(@PathVariable(value = "id") String orgId) {
         OrgInfo detail = iOrgInfoFacade.detail(orgId);
         OrgVo org = new OrgVo();
@@ -370,6 +387,7 @@ public class OrgInfoController {
 
     /**
      * orginfo转map
+     *
      * @param orgInfosList
      * @param orgNums
      * @return
@@ -575,6 +593,7 @@ public class OrgInfoController {
 
     /**
      * 根据ids获取初始树根节点
+     *
      * @param mtAuthIds:管理范围ids
      * @return
      */
@@ -599,6 +618,7 @@ public class OrgInfoController {
 
     /**
      * 异步获取子节点
+     *
      * @param parentId  父节点id
      * @param state     机构状态:0:未删除,1:已删除,null:全部
      * @param mtAuthIds 管理范围,为""或null时不过滤
@@ -623,6 +643,7 @@ public class OrgInfoController {
 
     /**
      * 管理员管理-管理范围-节点状态勾选
+     *
      * @param treeNodes
      * @param type         机构树类型
      * @param targetUserId
@@ -704,6 +725,7 @@ public class OrgInfoController {
 
     /**
      * 审计管理—机构树
+     *
      * @param type 机构树类型 ORG:机构管理范围 USER:用户管理范围 APP:权限管理范围 MGE:管理员管理范围
      * @param id   异步加载的树节点
      * @return
@@ -756,7 +778,7 @@ public class OrgInfoController {
             return Result.success();
         }
         ResponseDTO responseDTO = iOrgInfoFacade.orgMatch(name, mts, pageNum, pageSize);
-        return Result.success(StringUtils.getLong(responseDTO.getMessage()),responseDTO.getResult());
+        return Result.success(StringUtils.getLong(responseDTO.getMessage()), responseDTO.getResult());
     }
 
     @ApiOperation(value = "获取过滤后的父节点")

+ 8 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/resource/DataSourceController.java

@@ -11,6 +11,8 @@ import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.core.entity.response.ResponseResult;
 import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.web.controller.BaseController;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -54,6 +56,8 @@ public class DataSourceController extends BaseController {
         return ResponseResult.newInstance(ResponseResult.toConvert(objects, searchable));
     }
 
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "表码ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @RequestMapping(value = "editRow/{id}")
     public String editRow(@PathVariable("id") String id, Model model) {
         MdDatasourceDTO mdDataSource = iDuceapMdDataSourceFacade.get(id);
@@ -61,6 +65,8 @@ public class DataSourceController extends BaseController {
         return "resourceManagement/datasource/dataSourceEdit";
     }
 
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "表码ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @RequestMapping(value = "viewRow/{id}")
     public String viewRow(@PathVariable("id") String id, Model model) {
         MdDatasourceDTO mdDataSource = iDuceapMdDataSourceFacade.get(id);
@@ -73,6 +79,8 @@ public class DataSourceController extends BaseController {
         return "resourceManagement/datasource/dataSourceView";
     }
 
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "表码ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @RequestMapping(value = "delete/{id}")
     @ResponseBody
     public ResponseStatus delete(@PathVariable("id") String id) {

+ 4 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/resource/DuceapUploadController.java

@@ -3,6 +3,8 @@ package com.dragoninfo.dcuc.authweb.restcontroller.resource;
 import com.dragoninfo.dcuc.duceap.facade.IFileUploadFacade;
 import com.dragonsoft.duceap.base.entity.uploader.FileHolder;
 import feign.Response;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,6 +33,8 @@ public class DuceapUploadController {
         return upload;
     }
 
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "/view/{id}")
     public void view(@PathVariable("id") String id, HttpServletResponse response) {
         Response view = iFileUploadFacade.view(id);

+ 5 - 2
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/resource/MdDynCodeDicController.java

@@ -11,6 +11,7 @@ import com.dragonsoft.duceap.base.entity.search.SearchDTO;
 import com.dragonsoft.duceap.web.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -57,7 +58,8 @@ public class MdDynCodeDicController extends BaseController {
     }
 
     @ApiOperation(value = "修改表码")
-    @ApiImplicitParam(name = "codeDicVo", value = "表码vo")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "表码ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @PutMapping(value = "/code/{id}")
     public Result update(CodeDicVo codeDicVo) {
         try {
@@ -119,7 +121,8 @@ public class MdDynCodeDicController extends BaseController {
      * @return
      */
     @ApiOperation(value = "查询表码")
-    @ApiImplicitParam(name = "id", value = "id")
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "表码ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @GetMapping(value = "/code/{id}")
     public Result<CodeDicVo> getModel(@PathVariable("id") String id) {
         CodeDicDTO codeDic = iDuceapCodeFacade.get(id);

+ 6 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/resource/MdDynCodeDicSonController.java

@@ -12,6 +12,8 @@ import com.dragonsoft.duceap.core.entity.response.ResponseResult;
 import com.dragonsoft.duceap.core.search.Searchable;
 import com.dragonsoft.duceap.core.search.enums.SearchOperator;
 import com.dragonsoft.duceap.web.controller.BaseController;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -62,6 +64,8 @@ public class MdDynCodeDicSonController extends BaseController {
         return codeList;
     }
 
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "表码ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @RequestMapping(value = "previewData/{id}")
     public String previewData(@PathVariable("id") String id, Model model) {
         try {
@@ -91,6 +95,8 @@ public class MdDynCodeDicSonController extends BaseController {
 
     }
 
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "表码ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @RequestMapping(value = "data/{id}")
     @ResponseBody
     public List<Map<String, Object>> Data(@PathVariable("id") String id, String code, String name) {

+ 5 - 2
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/ManageStatisicsController.java

@@ -4,6 +4,8 @@ import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
 import com.dragoninfo.dcuc.user.admin.facade.IManageInfoFacade;
 import com.dragonsoft.duceap.web.controller.BaseController;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -33,11 +35,12 @@ public class ManageStatisicsController extends BaseController {
      * @return
      */
 
-
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @ApiOperation(value = "获取警员管理员统计列表")
     @GetMapping(value = "statisics/{id}")
     public List<Map<String, String>> getMgeSpreadDtlList(@PathVariable String id) {
-        if(id.equals("null")){
+        if (id.equals("null")) {
             id = "";
         }
         List<Map<String, String>> list = iManageInfoFacade.mgeSpreadDtlListForGD(id);

+ 4 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/UserStatisicsController.java

@@ -9,6 +9,8 @@ import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.duceap.web.controller.BaseController;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -66,6 +68,8 @@ public class UserStatisicsController extends BaseController {
      * @param id 节点机构id
      * @return
      */
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @ApiOperation(value = "获取完整树下各用户数量")
     @GetMapping(value = "statisics/{id}")
     public List<OrgTreeNodeVo> treeGrid(@PathVariable String id) {

+ 47 - 45
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/user/PoliceManagementController.java

@@ -109,22 +109,22 @@ public class PoliceManagementController {
 
     @ApiOperation(value = "获取警员")
     @GetMapping(value = "/police/{id}")
-    @ApiImplicitParam(name = "id", value = "id", required = true)
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "用户ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     public Result<PoliceInVo> get(@PathVariable("id") String id) {
         UserInfo userInfo = new UserInfo();
         userInfo = userInfoFacade.userDetail(id);
         List<PostInfo> postInfos = postInfoFacade.getPostInfos(id);
-        PoliceInVo policeInVo=new PoliceInVo();
-        UserUtils.copyObject( policeInVo,userInfo);
-        List<PostInfoVo> list=UserUtils.copyObjectByVo(postInfos);
+        PoliceInVo policeInVo = new PoliceInVo();
+        UserUtils.copyObject(policeInVo, userInfo);
+        List<PostInfoVo> list = UserUtils.copyObjectByVo(postInfos);
         policeInVo.setPostInfos(list);
-        policeInVo.setFile( uploadhandler.queryByBusiId(id,""));
-        List<FileHolder> fileHolders = uploadhandler.queryByBusiId(id,"");
+        policeInVo.setFile(uploadhandler.queryByBusiId(id, ""));
+        List<FileHolder> fileHolders = uploadhandler.queryByBusiId(id, "");
         return Result.success(policeInVo);
     }
 
 
-
     @ApiOperation(value = "修改警员")
     @PutMapping(value = "/police/{id}")
     public Result update(@RequestBody PoliceInVo userVo) {
@@ -132,26 +132,26 @@ public class PoliceManagementController {
             UserInfo info = new UserInfo();
             //用户PoliceInVo copy到UserInfo
             setUser(userVo, info);
-            if (UserUtils.verificaName(info)){
-                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"姓名不能为ADMIN");
+            if (UserUtils.verificaName(info)) {
+                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "姓名不能为ADMIN");
             }
-            if (UserUtils.verificaIdcard(info,userInfoFacade)){
-                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"身份证重复!");
+            if (UserUtils.verificaIdcard(info, userInfoFacade)) {
+                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "身份证重复!");
             }
             if (CollectionUtils.isEmpty(info.getPostInfos())) {
-                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"职务信息不能为空!");
+                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "职务信息不能为空!");
             }
             //设置用户部门
             UserUtils.setUserOrg(orgInfoFacade, info.getPostInfos(), info);
             ResponseStatus responseStatus = userInfoFacade.savePolice(info);
-            if(!responseStatus.getStatusCode().equals("200")){
-                return  Result.fail(responseStatus.getStatusCode(),responseStatus.getMessage());
-            }else {
+            if (!responseStatus.getStatusCode().equals("200")) {
+                return Result.fail(responseStatus.getStatusCode(), responseStatus.getMessage());
+            } else {
                 return Result.success();
             }
         } catch (Exception e) {
             logger.error(e.getMessage(), e);
-            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"保存异常");
+            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "保存异常");
         }
     }
 
@@ -162,31 +162,32 @@ public class PoliceManagementController {
             UserInfo info = new UserInfo();
             setUser(userVo, info);
             //姓名不能为ADMIN
-            if (UserUtils.verificaIdcard(info,userInfoFacade)){
-                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"身份证重复!");
+            if (UserUtils.verificaIdcard(info, userInfoFacade)) {
+                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "身份证重复!");
             }
-            if (UserUtils.verificaName(info)){
-                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"姓名不能为ADMIN");
+            if (UserUtils.verificaName(info)) {
+                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "姓名不能为ADMIN");
             }
             if (CollectionUtils.isEmpty(info.getPostInfos())) {
-                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"职务信息不能为空!");
+                return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "职务信息不能为空!");
             }
             //设置用户部门
             UserUtils.setUserOrg(orgInfoFacade, info.getPostInfos(), info);
             ResponseStatus responseStatus = userInfoFacade.savePolice(info);
-            if(!responseStatus.getStatusCode().equals("200")){
-                return  Result.fail(responseStatus.getStatusCode(),responseStatus.getMessage());
-            }else {
+            if (!responseStatus.getStatusCode().equals("200")) {
+                return Result.fail(responseStatus.getStatusCode(), responseStatus.getMessage());
+            } else {
                 return Result.success();
             }
         } catch (Exception e) {
             logger.error(e.getMessage(), e);
-            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"保存异常");
+            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "保存异常");
         }
     }
 
     @ApiOperation(value = "删除警员")
-    @ApiImplicitParam(name = "id", value = "id", required = true)
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "用户ID", required = true
+            , example = "40288a8b699fc2500169a33b20540000")})
     @DeleteMapping(value = "/police/{id}")
     public Result del(@PathVariable("id") String id) {
         try {
@@ -197,7 +198,7 @@ public class PoliceManagementController {
             return Result.success("删除成功");
         } catch (Exception e) {
             logger.error(e.getMessage(), e);
-            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(),"删除失败");
+            return Result.fail(ResultEnum.SERVICE_FAIL.getValue(), "删除失败");
         }
     }
 
@@ -210,8 +211,8 @@ public class PoliceManagementController {
         BigDecimal num = new BigDecimal(1);
         BigDecimal sort = userInfoFacade.sortNew(UserTypeEnum.POLICE.getValue()).add(num);
         HashMap<String, String> map = new HashMap<>();
-        map.put("policeNumber",pn+"");
-        map.put("pSortNo",sort+"");
+        map.put("policeNumber", pn + "");
+        map.put("pSortNo", sort + "");
         return Result.success(map);
     }
 
@@ -227,14 +228,14 @@ public class PoliceManagementController {
             @ApiImplicitParam(name = "id", value = "postId 职务ID", required = true),
             @ApiImplicitParam(name = "sort", value = "排序 10:上升,20:下降", required = true)
     })
-    public Result jySortPo(@RequestBody Map<String,String> map) {
+    public Result jySortPo(@RequestBody Map<String, String> map) {
         String id = map.get("id");
-        String sortType =  map.get("sort");
+        String sortType = map.get("sort");
         try {
             userInfoFacade.jySortPo(id, sortType);
             return Result.success();
         } catch (Exception e) {
-            logger.error("排序失败",e);
+            logger.error("排序失败", e);
             return Result.fail(ResultEnum.FAIL.getValue());
         }
     }
@@ -274,11 +275,11 @@ public class PoliceManagementController {
     public void batchExport(HttpServletRequest request, HttpServletResponse response) {
         String orgIds = request.getParameter("orgIds");
         try {
-            SearchDTO searchDTO=new SearchDTO();
+            SearchDTO searchDTO = new SearchDTO();
             //TODO 导出无数据
             List<UserInfoView> userInfoViews = userInfoFacade.batchExportPolice(orgIds);
             searchDTO.setMetadata(template());
-            ExportExcelUtils.exportPoliceExcel("警员信息", userInfoViews,Searchable.toSearchable(searchDTO).getMetaData(), request, response);
+            ExportExcelUtils.exportPoliceExcel("警员信息", userInfoViews, Searchable.toSearchable(searchDTO).getMetaData(), request, response);
         } catch (Exception e) {
             logger.error(e.getMessage(), e);
             throw new ApplicationException(300, "导出失败", e);
@@ -302,25 +303,26 @@ public class PoliceManagementController {
             List<UserInfo> list = ImpExcelUtils.loadScoreInfo(inputStream, UserTypeEnum.POLICE.getValue());
             String message = this.impPolice(list);
             if (message != null) {
-                if(message.startsWith("身份证或警号重复,未保存人员")){
+                if (message.startsWith("身份证或警号重复,未保存人员")) {
                     throw new NumberFormatException(message);
                 }
             }
             return Result.success("导入成功");
         } catch (IOException e) {
             logger.error(e.getMessage(), e);
-            return Result.fail("300","导入文件类型错误");
+            return Result.fail("300", "导入文件类型错误");
         } catch (NumberFormatException e) {
 
-            return Result.fail("300",e.getMessage());
+            return Result.fail("300", e.getMessage());
         } catch (Exception e) {
             logger.error(e.getMessage(), e);
-            return Result.fail("300","导入失败");
+            return Result.fail("300", "导入失败");
         }
     }
 
     /**
      * 根据业务域获取警种,通过机构id和警种获取用户
+     *
      * @return
      */
     @PostMapping(value = "police/businessUser")
@@ -335,7 +337,7 @@ public class PoliceManagementController {
         String business = businessVo.getBusiness();
         SecurityUser securityUser = (SecurityUser) ContextUtils.getUserInfo();
         UserInfo user = userInfoFacade.userDetail(securityUser.getId());
-        if (StringUtils.isEmpty(orgId) || StringUtils.isEmpty(business)){
+        if (StringUtils.isEmpty(orgId) || StringUtils.isEmpty(business)) {
             return Result.success(list);
         }
         Searchable searchable = new SearchRequest();
@@ -412,7 +414,7 @@ public class PoliceManagementController {
             @ApiImplicitParam(name = "availableId", value = "未选警员id,用逗号隔开")
     })
     @ApiOperation(value = "业务域保存配置")
-    public Result saveBusiness(@RequestBody BusinessVo businessVo ) {
+    public Result saveBusiness(@RequestBody BusinessVo businessVo) {
         try {
             String orgId = businessVo.getOrgId();
             String business = businessVo.getBusiness();
@@ -425,11 +427,13 @@ public class PoliceManagementController {
         }
         return Result.success("保存成功");
     }
+
     /**
      * 模板
+     *
      * @return
      */
-    private String template(){
+    private String template() {
         return "[{\"name\":\"name\",\"displyName\":\"姓名\"},{\"name\":\"policeNumber\",\"displyName\":\"警号\"}," +
                 "{\"name\":\"idcard\",\"displyName\":\"身份证\"}," +
                 "{\"name\":\"orgCode\",\"displyName\":\"单位机构代码\"}," +
@@ -455,6 +459,7 @@ public class PoliceManagementController {
 
     /**
      * copy UserInfo
+     *
      * @param userVo
      * @param info
      * @throws IllegalAccessException
@@ -532,7 +537,7 @@ public class PoliceManagementController {
             if (orgInfo == null) {
                 throw new NumberFormatException("身份证" + info.getIdcard() + "用户的单位机构代码不存在!");
             }
-            if (!AuthUtils.isHaveAuth(orgMgeMt, orgInfo)&&!userInfoFacade.isRootUser(ContextUtils.getUserInfo().getId())) {
+            if (!AuthUtils.isHaveAuth(orgMgeMt, orgInfo) && !userInfoFacade.isRootUser(ContextUtils.getUserInfo().getId())) {
                 throw new NumberFormatException("没有身份证" + info.getIdcard() + "用户所填写单位机构代码的管理权限!");
             }
             info.setSortNo(sort);
@@ -547,7 +552,4 @@ public class PoliceManagementController {
     }
 
 
-
-
-
 }

+ 0 - 32
src/main/java/com/dragoninfo/dcuc/authweb/vo/hwtoken/HwTokenCheckReqContentVO.java

@@ -1,32 +0,0 @@
-package com.dragoninfo.dcuc.authweb.vo.hwtoken;
-
-import lombok.Data;
-
-/**
- * @author huangzqa
- * @date 2021/3/30
- **/
-@Data
-public class HwTokenCheckReqContentVO {
-
-    /**
-     * 消息ID,默认规则为日期
-     */
-    private String messageId;
-
-    /**
-     * 用户令牌
-     */
-    private String userToken;
-
-    /**
-     * 应用令牌
-     */
-    private String appToken;
-
-    /**
-     * 可信接入唯一标识,与注册接口保持一致,不能为其他值
-     */
-    private String esn;
-
-}

+ 0 - 16
src/main/java/com/dragoninfo/dcuc/authweb/vo/hwtoken/HwTokenCheckReqVO.java

@@ -1,16 +0,0 @@
-package com.dragoninfo.dcuc.authweb.vo.hwtoken;
-
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * @author huangzqa
- * @date 2021/3/30
- **/
-@Data
-public class HwTokenCheckReqVO {
-
-    private List<HwTokenCheckReqContentVO> content;
-
-}

+ 0 - 26
src/main/java/com/dragoninfo/dcuc/authweb/vo/hwtoken/HwTokenCheckRespContentVO.java

@@ -1,26 +0,0 @@
-package com.dragoninfo.dcuc.authweb.vo.hwtoken;
-
-import lombok.Data;
-
-/**
- * @author huangzqa
- * @date 2021/3/30
- **/
-@Data
-public class HwTokenCheckRespContentVO {
-
-    private String messageId;
-
-    /**
-     * 用户令牌是否有效
-     */
-    private String usercheckResult;
-
-    /**
-     * 应用令牌是否有效
-     */
-    private String appcheckResult;
-
-    private String resultDescription;
-
-}

+ 0 - 17
src/main/java/com/dragoninfo/dcuc/authweb/vo/hwtoken/HwTokenCheckRespVO.java

@@ -1,17 +0,0 @@
-package com.dragoninfo.dcuc.authweb.vo.hwtoken;
-
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * @author huangzqa
- * @date 2021/3/30
- **/
-@Data
-public class HwTokenCheckRespVO {
-
-
-    private List<HwTokenCheckRespContentVO> content;
-
-}

+ 9 - 7
src/main/resources/application-base.yml

@@ -26,7 +26,7 @@ management:
 duceap:
   swagger:
     enabled: true
-    package-path: com.dragoninfo.dcuc.authweb
+    package-path: com.dragoninfo.dcuc.authweb.restcontroller.api
   license:
     #配置用来指定license对接的后端项目地址(格式:ip:port/context,如http://10.10.10.10:8080/ctx),
     #默认使用HttpServletRequest.getLocalAddr()方法获取ip地址,
@@ -35,14 +35,18 @@ duceap:
   apollo:
     client:
       host: http://10.201.3.20:8070
+  security-access:
+    jwt:
+      enabled: true
+      user-token-header-name: userToken
   security:
-    type: dcuc
+    #    type: dcuc ## 注解掉不开启认证登录
     dcuc:
-      cas-server-url-prefix: http://10.11.1.142:8877/dcucserver
-      server-name: 10.11.0.240:8871
+      cas-server-url-prefix: http://192.168.10.2:8877/sso
+      server-name: 10.11.1.151:8000
       ignore-pattern: '/js/*|/img/*|/css/*|/api/*|/*.png|/rest/*|/webSocket/*|/oauthLogin/*|/authorizationPage.html|/importAuthorizationFile.html|/license/LicenseManagerServlet|/authorizationFile/'
       app-code: QXXT0000000000000001
-      api-url: http://127.0.0.1:8861/dcucauth
+      api-url: http://192.168.10.2:8860/dcuc
     dids2:
       appCode: YHZX0000000000000001
       SSOLoginUrl: http://192.168.6.128:9995/didsserver/login
@@ -71,6 +75,4 @@ dcuc:
   authweb:
     app-code: QXXT0000000000000001
     auth-access: true
-    hw-identity-url: http://localhost:8080
-    hw-identity-esn: demo
     check-type-enum: token

+ 34 - 0
src/test/java/GenerateToken.java

@@ -0,0 +1,34 @@
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.JWTCreator;
+import com.auth0.jwt.algorithms.Algorithm;
+import com.dragonsoft.duceap.commons.util.date.DateUtils;
+import org.junit.Test;
+
+import java.util.Date;
+
+/**
+ * @author huangzqa
+ * @date 2021/4/8
+ **/
+public class GenerateToken {
+
+    @Test
+    public void getUserToken() {
+        DateTime date = DateUtil.date();
+
+        DateTime dateTime = DateUtil.offsetDay(date, 1);
+
+        Algorithm algorithm = Algorithm.HMAC256("secret");
+        JWTCreator.Builder builder = JWT.create().withExpiresAt(dateTime).withIssuedAt(date);
+
+        builder.withClaim("idCard", "379004198203211208");
+
+        String sign = builder.sign(algorithm);
+
+        System.out.println(sign);
+
+    }
+
+}