|
@@ -6,6 +6,7 @@ import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.entity.ServiceFilter;
|
|
|
import com.diagbot.exception.ErrorCode;
|
|
|
import com.diagbot.util.GsonUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
|
@@ -67,11 +68,16 @@ public class GlobalGatewayFilter implements GlobalFilter {
|
|
|
log.info("SERVICENAME:{}", serviceName);
|
|
|
|
|
|
if(!IS_GENERATE) {
|
|
|
- List<ServiceFilter> list = diagbotmanServiceClient.getAll().data;
|
|
|
- for(ServiceFilter bean : list) {
|
|
|
- SERVICE_FILTER.put(bean.getName(), bean.getProductId());
|
|
|
+ RespDTO<List<ServiceFilter>> filter = diagbotmanServiceClient.getAll();
|
|
|
+ if (filter != null){
|
|
|
+ List<ServiceFilter> list = filter.data;
|
|
|
+ if (ListUtil.isNotEmpty(list)){
|
|
|
+ for(ServiceFilter bean : list) {
|
|
|
+ SERVICE_FILTER.put(bean.getName(), bean.getProductId());
|
|
|
+ }
|
|
|
+ IS_GENERATE = true;
|
|
|
+ }
|
|
|
}
|
|
|
- IS_GENERATE = true;
|
|
|
}
|
|
|
serviceName = "icss";
|
|
|
if(SERVICE_FILTER.get(serviceName) != null) {
|