Przeglądaj źródła

Merge branch 'develop' of gitadmin/tuoheng_gateway into release

pull/142/head
xuziqing 1 rok temu
rodzic
commit
072a87b100
9 zmienionych plików z 72 dodań i 3 usunięć
  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 Wyświetl plik

<version>1.18.22</version> <version>1.18.22</version>
</dependency> </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> </dependencies>


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

+ 8
- 0
src/main/java/com/tuoheng/gateway/commons/CommonsConfig.java Wyświetl plik

* 机场系统接口地址 * 机场系统接口地址
*/ */
public static String airportPermissionUrl; public static String airportPermissionUrl;
/**
* 全时空系统接口地址
*/
public static String spacetimePermissionUrl;




@Value("${tuoheng.hhz-admin-perUrl}") @Value("${tuoheng.hhz-admin-perUrl}")
hhzPermissionUrl = url; hhzPermissionUrl = url;
} }


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

+ 1
- 0
src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java Wyświetl plik

.pathMatchers("/weptsp/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_WEPTSP_ADMIN) .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("/airmonitor/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_AIRMONITOR_ADMIN)
.pathMatchers("/alert/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_ALERT_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("/airport/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_AIRPORT_ADMIN)
.pathMatchers("/oidc/admin/user/**").authenticated() .pathMatchers("/oidc/admin/user/**").authenticated()
.pathMatchers("/api/inspection/**").authenticated() .pathMatchers("/api/inspection/**").authenticated()

+ 6
- 0
src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java Wyświetl plik

*/ */
public static final String SCOPE_TUOHNEG_AIRPORT_ADMIN = "SCOPE_tuoheng-airport-admin"; public static final String SCOPE_TUOHNEG_AIRPORT_ADMIN = "SCOPE_tuoheng-airport-admin";
//public static final String SCOPE_TUOHNEG_ALERT_MP= "SCOPE_tuoheng-alert-mp"; //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 Wyświetl plik



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


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



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

+ 9
- 1
src/main/resources/application-dev.yml Wyświetl plik

- Path=/alert/admin/** - Path=/alert/admin/**
filters: filters:
- StripPrefix=2 - StripPrefix=2
# 全时空影像系统 admin服务
- id: tuoheng-spacetime-admin
uri: lb://tuoheng-spacetime-admin
predicates:
- Path=/spacetime/admin/**
filters:
- StripPrefix=2
# Redis数据源 # Redis数据源
redis: redis:
# 缓存库默认索引0 # 缓存库默认索引0
waterway-admin-perUrl: http://192.168.11.11:9120/permission/getRoleIdList waterway-admin-perUrl: http://192.168.11.11:9120/permission/getRoleIdList
weptsp-admin-perUrl: http://192.168.11.11:9140/permission/getRoleIdList weptsp-admin-perUrl: http://192.168.11.11:9140/permission/getRoleIdList
airmonitor-admin-perUrl: http://192.168.11.11:9130/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 Wyświetl plik

- Path=/alert/admin/** - Path=/alert/admin/**
filters: filters:
- StripPrefix=2 - StripPrefix=2
# 全时空影像系统 admin服务
- id: tuoheng-spacetime-admin
uri: lb://tuoheng-spacetime-admin
predicates:
- Path=/spacetime/admin/**
filters:
- StripPrefix=2
# Redis数据源 # Redis数据源
redis: redis:
# 缓存库默认索引0 # 缓存库默认索引0
airmonitor-admin-perUrl: https://airmonitor.t-aaron.com/permission/getRoleIdList airmonitor-admin-perUrl: https://airmonitor.t-aaron.com/permission/getRoleIdList
weptsp-admin-perUrl: https://weptsp.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 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 Wyświetl plik

- Path=/alert/admin/** - Path=/alert/admin/**
filters: filters:
- StripPrefix=2 - StripPrefix=2
# 全时空影像系统 admin服务
- id: tuoheng-spacetime-admin
uri: lb://tuoheng-spacetime-admin
predicates:
- Path=/spacetime/admin/**
filters:
- StripPrefix=2
# Redis数据源 # Redis数据源
redis: redis:
# 缓存库默认索引0 # 缓存库默认索引0
waterway-admin-perUrl: https://waterway-test.t-aaron.com/permission/getRoleIdList waterway-admin-perUrl: https://waterway-test.t-aaron.com/permission/getRoleIdList
weptsp-admin-perUrl: https://weptsp-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 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 Wyświetl plik

<appender-ref ref="LOG_FILE" /> <appender-ref ref="LOG_FILE" />
</appender> </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"> <logger name="com.tuoheng" level="DEBUG" additivity="false">
<appender-ref ref="console" /> <appender-ref ref="console" />
<appender-ref ref="file.async" /> <appender-ref ref="file.async" />
<root level="INFO"> <root level="INFO">
<appender-ref ref="console" /> <appender-ref ref="console" />
<appender-ref ref="file.async" /> <appender-ref ref="file.async" />
<appender-ref ref="grpc-log" />
</root> </root>
</configuration> </configuration>

Ładowanie…
Anuluj
Zapisz