浏览代码

feature(解决冲突): 解决冲突

解决冲突
mazq 4 年之前
父节点
当前提交
b4521c4425

+ 6 - 8
pom.xml

@@ -40,6 +40,11 @@
             <optional>true</optional>
             <optional>true</optional>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>com.dragoninfo</groupId>
+            <artifactId>dcuc-user-api</artifactId>
+            <version>2.1.0-tjdsj-SNAPSHOT</version>
+        </dependency>
         <!--监控配置-->
         <!--监控配置-->
         <dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <groupId>org.springframework.boot</groupId>
@@ -122,23 +127,16 @@
             </exclusions>
             </exclusions>
         </dependency>
         </dependency>
 
 
-
         <dependency>
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-app-api</artifactId>
             <artifactId>dcuc-app-api</artifactId>
             <version>2.1.3-tjdsj-SNAPSHOT</version>
             <version>2.1.3-tjdsj-SNAPSHOT</version>
         </dependency>
         </dependency>
 
 
-        <dependency>
-            <groupId>com.dragoninfo</groupId>
-            <artifactId>dcuc-user-api</artifactId>
-            <version>2.0.2-tjdsj-SNAPSHOT</version>
-        </dependency>
-
         <dependency>
         <dependency>
             <groupId>com.dragoninfo</groupId>
             <groupId>com.dragoninfo</groupId>
             <artifactId>dcuc-org-api</artifactId>
             <artifactId>dcuc-org-api</artifactId>
-            <version>2.0.0-tjdsj-SNAPSHOT</version>
+            <version>2.0.1-tjdsj-SNAPSHOT</version>
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>

+ 64 - 0
src/main/java/com/dragoninfo/dcuc/authweb/NacosPortConfig.java

@@ -0,0 +1,64 @@
+package com.dragoninfo.dcuc.authweb;
+
+import com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration;
+import com.dragonsoft.duceap.commons.util.string.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.stereotype.Component;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.Query;
+import java.lang.management.ManagementFactory;
+import java.util.Set;
+
+@Component
+public class NacosPortConfig implements ApplicationRunner {
+    private static final Logger logger = LoggerFactory.getLogger(NacosPortConfig.class);
+    @Autowired
+    private NacosAutoServiceRegistration registration;
+    @Value("${spring.application.name}")
+    private String appName;
+    @Value("${server.port}")
+    private int port;
+    @Override
+    public void run(ApplicationArguments args) throws Exception {
+        int port = this.getTomcatPort();
+        if (registration != null) {
+            registration.setPort(port);
+            registration.start();
+        }
+    }
+    /**
+     * 获取容器端口号
+     *
+     * @return
+     * @throws Exception 容器端口号未获取到
+     */
+    public int getTomcatPort() throws Exception {
+        String port = this.getTomcatPortValue();
+        if (!StringUtils.isEmpty(port)) {
+            return Integer.valueOf(port);
+        }
+        return this.port;
+    }
+    /**
+     * 获取容器端口号(解决使用外部容器部署,nacos无法注册问题)
+     *
+     * @return port
+     */
+    private String getTomcatPortValue() throws Exception {
+        MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
+        Set<ObjectName> objectNames = beanServer.queryNames
+                (new ObjectName("*:type=Connector,*"),
+                        Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));
+        for (ObjectName objectName : objectNames) {
+            return objectName.getKeyProperty("port");
+        }
+        return "";
+    }
+}

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

@@ -8,7 +8,6 @@ import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.dto.AppDataSensitiveLevelDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.AppDataSensitiveLevelDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
 import com.dragoninfo.dcuc.auth.auth.dto.ServiceAuthResultDTO;
 import com.dragoninfo.dcuc.auth.auth.facade.IBimBusinessFacade;
 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.IServiceAuthFlowFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthResultFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IServiceAuthResultFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IStaffAssignAuthInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.facade.IStaffAssignAuthInfoFacade;
@@ -122,13 +121,23 @@ public class AuthServiceController {
     @ApiOperation(value = "服务级鉴权")
     @ApiOperation(value = "服务级鉴权")
     @ApiImplicitParams({@ApiImplicitParam(name = "ServiceAuthenticationReq", value = "服务鉴权vo")})
     @ApiImplicitParams({@ApiImplicitParam(name = "ServiceAuthenticationReq", value = "服务鉴权vo")})
     public ApiResult authentication(HttpServletRequest request) {
     public ApiResult authentication(HttpServletRequest request) {
-        String appCode = request.getHeader("appCode");
+        String idcard = request.getHeader(Constants.IDCARD);
+        String appCode = request.getHeader(Constants.APP_CODE);
+        String userToken = request.getHeader(Constants.DCUC_USER_TOKEN);
+        String appToken = request.getHeader(Constants.DCUC_APP_TOKEN);
+
+        if (StrUtil.isNotBlank(appToken)) {
+            DecodedJWT decode = JWT.decode(appToken);
+            appCode = decode.getClaim("appCode").asString();
+        }
+
         if (StrUtil.isBlank(appCode)) {
         if (StrUtil.isBlank(appCode)) {
-            return ApiResult.setFailMessage("appCode is not null");
+            return ApiResult.setFailMessage(String.format("appCode: %s is blank.", appCode));
         }
         }
+
         ApplyInfo applyInfo = applyInfoFacade.getAppByCode(appCode);
         ApplyInfo applyInfo = applyInfoFacade.getAppByCode(appCode);
         if (applyInfo == null || BooleanEnum.TRUE.value.equals(applyInfo.getApplyStatus())) {
         if (applyInfo == null || BooleanEnum.TRUE.value.equals(applyInfo.getApplyStatus())) {
-            return ApiResult.setFailMessage("app is not enabled");
+            return ApiResult.setFailMessage(String.format("app: %s is not enabled", appCode));
         }
         }
         Object o = serviceAuthFlowFacade.serviceAuthentication(appCode);
         Object o = serviceAuthFlowFacade.serviceAuthentication(appCode);
         return ApiResult.setSuccessResult(o);
         return ApiResult.setSuccessResult(o);
@@ -142,7 +151,7 @@ public class AuthServiceController {
         Map<String, SearchOperator[]> requestMap = new HashMap<>();
         Map<String, SearchOperator[]> requestMap = new HashMap<>();
         requestMap.put("appCode", new SearchOperator[]{SearchOperator.eq});
         requestMap.put("appCode", new SearchOperator[]{SearchOperator.eq});
         requestMap.put("serviceCode", new SearchOperator[]{SearchOperator.eq});
         requestMap.put("serviceCode", new SearchOperator[]{SearchOperator.eq});
-        requestMap.put("serviceStatus", new SearchOperator[]{SearchOperator.ne,SearchOperator.eq,SearchOperator.in});
+        requestMap.put("serviceStatus", new SearchOperator[]{SearchOperator.ne, SearchOperator.eq, SearchOperator.in});
         Searchable searchable;
         Searchable searchable;
         try {
         try {
             searchable = SearchableUtil.parseApiSearchReqToSearchable(apiSearchReq, requestMap, 1000);
             searchable = SearchableUtil.parseApiSearchReqToSearchable(apiSearchReq, requestMap, 1000);
@@ -181,9 +190,9 @@ public class AuthServiceController {
     }
     }
 
 
 
 
-
     /**
     /**
      * 提供给服务方查询
      * 提供给服务方查询
+     *
      * @param apiSearchReq
      * @param apiSearchReq
      * @return
      * @return
      */
      */
@@ -203,8 +212,8 @@ public class AuthServiceController {
         requestMap.put("serviceName", new SearchOperator[]{SearchOperator.eq, SearchOperator.like});
         requestMap.put("serviceName", new SearchOperator[]{SearchOperator.eq, SearchOperator.like});
         requestMap.put("serviceManagerOrgCode", new SearchOperator[]{SearchOperator.eq});
         requestMap.put("serviceManagerOrgCode", new SearchOperator[]{SearchOperator.eq});
         requestMap.put("serviceManagerOrgName", new SearchOperator[]{SearchOperator.eq, SearchOperator.like});
         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});
+        requestMap.put("serviceStatus", new SearchOperator[]{SearchOperator.ne, SearchOperator.eq, SearchOperator.in});
+        requestMap.put("appStatus", new SearchOperator[]{SearchOperator.ne, SearchOperator.eq, SearchOperator.in});
         Searchable searchable;
         Searchable searchable;
         try {
         try {
             searchable = SearchableUtil.parseApiSearchReqToSearchable(apiSearchReq, requestMap, 1000);
             searchable = SearchableUtil.parseApiSearchReqToSearchable(apiSearchReq, requestMap, 1000);

+ 1 - 9
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/controller/DataAuthApiController.java → src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/controller/DataAuthApiController.java

@@ -1,12 +1,10 @@
-package com.dragoninfo.dcuc.authweb.restcontroller.api.controller;
+package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.controller;
 
 
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
 import com.auth0.jwt.JWT;
 import com.auth0.jwt.JWT;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.auth0.jwt.interfaces.DecodedJWT;
 import com.dragoninfo.dcuc.auth.auth.api.IApiDataAuthFacade;
 import com.dragoninfo.dcuc.auth.auth.api.IApiDataAuthFacade;
 import com.dragoninfo.dcuc.auth.auth.dto.DataItemsCheckDto;
 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.authweb.util.VersionUtils;
 import com.dragoninfo.dcuc.common.Constants;
 import com.dragoninfo.dcuc.common.Constants;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
@@ -18,8 +16,6 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
-import java.util.List;
-
 /**
 /**
  * 代码千万行,注释第一行,编码不规范,同事两行泪
  * 代码千万行,注释第一行,编码不规范,同事两行泪
  *
  *
@@ -35,10 +31,6 @@ public class DataAuthApiController {
     @Autowired
     @Autowired
     private IApiDataAuthFacade apiDataAuthFacade;
     private IApiDataAuthFacade apiDataAuthFacade;
 
 
-    @Autowired
-    private IBimBusinessFacade bimBusinessFacade;
-
-
     @ApiOperation(value = "查询是否拥有数据项权限接口")
     @ApiOperation(value = "查询是否拥有数据项权限接口")
     @ApiImplicitParams({@ApiImplicitParam(name = "DataItemsCheckDto", value = "数据资源对象")})
     @ApiImplicitParams({@ApiImplicitParam(name = "DataItemsCheckDto", value = "数据资源对象")})
     @PostMapping(value = "data-auth/data-items/check")
     @PostMapping(value = "data-auth/data-items/check")

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

@@ -11,6 +11,15 @@ spring:
       # 设置文件上传大小,springboot默认的最大上传大小是1MB
       # 设置文件上传大小,springboot默认的最大上传大小是1MB
       max-file-size: 150MB
       max-file-size: 150MB
       max-request-size: 150MB
       max-request-size: 150MB
+  redis:
+    # Redis服务器地址
+    host: 192.168.10.12
+    # Redis服务器连接端口 使用默认端口6379可以省略配置
+    port: 6379
+    # 连接池最大连接数(如果配置<=0,则没有限制 )
+    jedis:
+      pool:
+        max-active: 8
 server:
 server:
   port: 8861
   port: 8861
   servlet:
   servlet: