wisdomisite-java/src/main/java/com/zhgd/xmgl/util/ProfileJudgeUtil.java

109 lines
2.1 KiB
Java
Raw Normal View History

2023-03-24 14:57:54 +08:00
package com.zhgd.xmgl.util;
2023-04-11 18:57:47 +08:00
import lombok.extern.slf4j.Slf4j;
2023-03-24 14:57:54 +08:00
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
2023-03-30 18:03:44 +08:00
import java.util.stream.Stream;
2023-03-24 14:57:54 +08:00
/**
* 环境判断
*/
@Component
2023-04-11 18:57:47 +08:00
@Slf4j
2023-03-24 14:57:54 +08:00
public class ProfileJudgeUtil {
@Value("${spring.profiles.active}")
private String activeProfile;
/**
* 是否金林湾生产环境
*
* @return
*/
2023-03-29 13:54:23 +08:00
public boolean isJlwProd() {
return "ljw".equals(activeProfile);
2023-03-24 17:32:22 +08:00
}
2023-04-01 10:46:58 +08:00
/**
* 是否金林湾环境
*
* @return
*/
public boolean isJlw() {
return Stream.of("ljw", "ljw-gsx").anyMatch(s -> s.equals(activeProfile));
}
2023-03-24 17:32:22 +08:00
/**
* 是否三江本地环境
*
* @return
*/
2023-03-29 13:54:23 +08:00
public boolean isSjjtGsxDev() {
return "sjjt-gsx".equals(activeProfile);
2023-03-24 14:57:54 +08:00
}
2023-03-24 17:32:22 +08:00
2023-03-30 18:03:44 +08:00
/**
* 是否三江环境包括本地测试生产
*
* @return
*/
public boolean isSjjt() {
return Stream.of("sjjt-gsx", "sjjt-prod").anyMatch(s -> s.equals(activeProfile));
}
2023-03-24 17:32:22 +08:00
/**
* 是否中建四局生产环境
*
* @return
*/
2023-03-29 13:54:23 +08:00
public boolean isZjsjProd() {
return "zjsj".equals(activeProfile);
}
/**
* 是否中建四局环境
*
* @return
*/
public boolean isZjsj() {
return Stream.of("zjsj-gsx", "zjsj").anyMatch(s -> s.equals(activeProfile));
}
2023-06-10 15:06:50 +08:00
/**
* 是否中建四局沙湖环境
*
* @return
*/
public boolean isShahu() {
return Stream.of("shahu-gsx", "shahu").anyMatch(s -> s.equals(activeProfile));
}
2023-03-29 13:54:23 +08:00
/**
* 是否云联万物生产环境
*
* @return
*/
public boolean isYlwwProd() {
return "ylww".equals(activeProfile);
2023-03-24 17:32:22 +08:00
}
2023-04-11 18:57:47 +08:00
/**
* 是否广西联通生产环境
*
* @return
*/
public boolean isGxltProd() {
return "gxlt".equals(activeProfile);
}
/**
* 是否广西联通环境
*
* @return
*/
public boolean isGxlt() {
return Stream.of("gxlt", "gxlt-gsx").anyMatch(s -> s.equals(activeProfile));
}
2023-03-24 17:32:22 +08:00
2023-03-24 14:57:54 +08:00
}