Просмотр исходного кода

Merge branch 'develop' of gitadmin/tuoheng_gateway into release

pull/142/head
xuziqing 1 год назад
Родитель
Сommit
072a87b100
9 измененных файлов: 72 добавлений и 3 удалений
  1. +12
    -0
      pom.xml
  2. +8
    -0
      src/main/java/com/tuoheng/gateway/commons/CommonsConfig.java
  3. +1
    -0
      src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java
  4. +6
    -0
      src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java
  5. +8
    -0
      src/main/java/com/tuoheng/gateway/utils/GatewayUrlPathUtil.java
  6. +9
    -1
      src/main/resources/application-dev.yml
  7. +9
    -1
      src/main/resources/application-prod.yml
  8. +9
    -1
      src/main/resources/application-test.yml
  9. +10
    -0
      src/main/resources/logback.xml

+ 12
- 0
pom.xml Просмотреть файл

@@ -87,6 +87,18 @@
<version>1.18.22</version>
</dependency>

<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
<version>9.0.0</version>
</dependency>

<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
<version>9.0.0</version>
</dependency>

</dependencies>

<!-- 构建环境变量 -->

+ 8
- 0
src/main/java/com/tuoheng/gateway/commons/CommonsConfig.java Просмотреть файл

@@ -49,6 +49,10 @@ public class CommonsConfig {
* 机场系统接口地址
*/
public static String airportPermissionUrl;
/**
* 全时空系统接口地址
*/
public static String spacetimePermissionUrl;


@Value("${tuoheng.hhz-admin-perUrl}")
@@ -56,6 +60,10 @@ public class CommonsConfig {
hhzPermissionUrl = url;
}

@Value("${tuoheng.spacetime-admin-perUrl}")
public void setSpacetimePermissionUrl(String url) {
spacetimePermissionUrl = url;
}
@Value("${tuoheng.freeway-admin-perUrl}")
public void setFreewayPermissionUrl(String url) {
freewayPermissionUrl = url;

+ 1
- 0
src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java Просмотреть файл

@@ -93,6 +93,7 @@ public class WebSecurityConfig {
.pathMatchers("/weptsp/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_WEPTSP_ADMIN)
.pathMatchers("/airmonitor/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_AIRMONITOR_ADMIN)
.pathMatchers("/alert/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_ALERT_ADMIN)
.pathMatchers("/spacetime/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_SPACETIME_ADMIN)
.pathMatchers("/airport/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_AIRPORT_ADMIN)
.pathMatchers("/oidc/admin/user/**").authenticated()
.pathMatchers("/api/inspection/**").authenticated()

+ 6
- 0
src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java Просмотреть файл

@@ -76,4 +76,10 @@ public class AuthorityConstant {
*/
public static final String SCOPE_TUOHNEG_AIRPORT_ADMIN = "SCOPE_tuoheng-airport-admin";
//public static final String SCOPE_TUOHNEG_ALERT_MP= "SCOPE_tuoheng-alert-mp";

/**
* Spacetime 用户权限
*/
public static final String SCOPE_TUOHNEG_SPACETIME_ADMIN = "SCOPE_tuoheng-spacetime-admin";
//public static final String SCOPE_TUOHNEG_ALERT_MP= "SCOPE_tuoheng-alert-mp";
}

+ 8
- 0
src/main/java/com/tuoheng/gateway/utils/GatewayUrlPathUtil.java Просмотреть файл

@@ -46,6 +46,8 @@ public class GatewayUrlPathUtil {

private static final String AIRPORT_ADMIN = "tuoheng-airport-admin";

private static final String SPACETIME_ADMIN = "tuoheng-spacetime-admin";


/**
* 获取 gateway 路由前缀,匹配url
@@ -89,6 +91,9 @@ public class GatewayUrlPathUtil {
case ALERT_ADMIN:
apiPath = "/alert/admin";
break;
case SPACETIME_ADMIN:
apiPath = "/spacetime/admin";
break;
default:
break;
}
@@ -128,6 +133,9 @@ public class GatewayUrlPathUtil {
if (clientId.equals(AIRPORT_ADMIN)) {
url = CommonsConfig.airportPermissionUrl;
}
if (clientId.equals(SPACETIME_ADMIN)) {
url = CommonsConfig.spacetimePermissionUrl;
}
log.info("getRoleIdByApiUrlPermission -url:{},token:{}", url, token);
if (StringUtils.isNotBlank(url)) {
HttpHeaders resultRequestHeader = new HttpHeaders();

+ 9
- 1
src/main/resources/application-dev.yml Просмотреть файл

@@ -262,6 +262,13 @@ spring:
- Path=/alert/admin/**
filters:
- StripPrefix=2
# 全时空影像系统 admin服务
- id: tuoheng-spacetime-admin
uri: lb://tuoheng-spacetime-admin
predicates:
- Path=/spacetime/admin/**
filters:
- StripPrefix=2
# Redis数据源
redis:
# 缓存库默认索引0
@@ -297,4 +304,5 @@ tuoheng:
waterway-admin-perUrl: http://192.168.11.11:9120/permission/getRoleIdList
weptsp-admin-perUrl: http://192.168.11.11:9140/permission/getRoleIdList
airmonitor-admin-perUrl: http://192.168.11.11:9130/permission/getRoleIdList
telecomumale-admin-perUrl: http://192.168.11.11:9150/permission/getRoleIdList
telecomumale-admin-perUrl: http://192.168.11.11:9150/permission/getRoleIdList
spacetime-admin-perUrl: http://192.168.11.11:9170/permission/getRoleIdList

+ 9
- 1
src/main/resources/application-prod.yml Просмотреть файл

@@ -254,6 +254,13 @@ spring:
- Path=/alert/admin/**
filters:
- StripPrefix=2
# 全时空影像系统 admin服务
- id: tuoheng-spacetime-admin
uri: lb://tuoheng-spacetime-admin
predicates:
- Path=/spacetime/admin/**
filters:
- StripPrefix=2
# Redis数据源
redis:
# 缓存库默认索引0
@@ -289,4 +296,5 @@ tuoheng:
airmonitor-admin-perUrl: https://airmonitor.t-aaron.com/permission/getRoleIdList
weptsp-admin-perUrl: https://weptsp.t-aaron.com/permission/getRoleIdList
telecomumale-admin-perUrl: https://telecomumale.t-aaron.com/permission/getRoleIdList
alert-admin-perUrl: https://alert.t-aaron.com/permission/getRoleIdList
alert-admin-perUrl: https://alert.t-aaron.com/permission/getRoleIdList
spacetime-admin-perUrl: https://spacetime.t-aaron.com/permission/getRoleIdList

+ 9
- 1
src/main/resources/application-test.yml Просмотреть файл

@@ -262,6 +262,13 @@ spring:
- Path=/alert/admin/**
filters:
- StripPrefix=2
# 全时空影像系统 admin服务
- id: tuoheng-spacetime-admin
uri: lb://tuoheng-spacetime-admin
predicates:
- Path=/spacetime/admin/**
filters:
- StripPrefix=2
# Redis数据源
redis:
# 缓存库默认索引0
@@ -297,4 +304,5 @@ tuoheng:
waterway-admin-perUrl: https://waterway-test.t-aaron.com/permission/getRoleIdList
weptsp-admin-perUrl: https://weptsp-test.t-aaron.com/permission/getRoleIdList
airmonitor-admin-perUrl: https://airmonitor-test.t-aaron.com/permission/getRoleIdList
telecomumale-admin-perUrl: https://telecomumale-test.t-aaron.com/permission/getRoleIdList
telecomumale-admin-perUrl: https://telecomumale-test.t-aaron.com/permission/getRoleIdList
spacetime-admin-perUrl: https://spacetime-test.t-aaron.com/permission/getRoleIdList

+ 10
- 0
src/main/resources/logback.xml Просмотреть файл

@@ -53,6 +53,15 @@
<appender-ref ref="LOG_FILE" />
</appender>

<!--skywalking日志上报-->
<appender name="grpc-log" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout">
<Pattern>[th-gateway] %d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n</Pattern>
</layout>
</encoder>
</appender>

<logger name="com.tuoheng" level="DEBUG" additivity="false">
<appender-ref ref="console" />
<appender-ref ref="file.async" />
@@ -65,5 +74,6 @@
<root level="INFO">
<appender-ref ref="console" />
<appender-ref ref="file.async" />
<appender-ref ref="grpc-log" />
</root>
</configuration>

Загрузка…
Отмена
Сохранить