Commit 16a069c0 authored by 李秀明's avatar 李秀明

fix: 删除无用或无重大意义的获取IP的代码, 解决SCA扫描报告为漏洞问题

国家电网换流站消防管控中心建设工程(V1.1.5)-后端-SCA扫描报告.pdf p544~p570 Links https://docs.qq.com/sheet/DTkRSaWhSZXBlaldN?tab=000008&_t=1711087563249 (No.12)
parent 7b6015f9
...@@ -22,7 +22,7 @@ import java.util.regex.Matcher; ...@@ -22,7 +22,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* *
* @Author lichenglong * @Author lichenglong
* *
*/ */
...@@ -40,7 +40,7 @@ public class oConvertUtils { ...@@ -40,7 +40,7 @@ public class oConvertUtils {
} }
return (false); return (false);
} }
public static boolean isNotEmpty(Object object) { public static boolean isNotEmpty(Object object) {
if (object != null && !object.equals("") && !object.equals("null")) { if (object != null && !object.equals("") && !object.equals("null")) {
return (true); return (true);
...@@ -164,7 +164,7 @@ public class oConvertUtils { ...@@ -164,7 +164,7 @@ public class oConvertUtils {
return (defval); return (defval);
} }
} }
public static Integer getInt(Object object) { public static Integer getInt(Object object) {
if (isEmpty(object)) { if (isEmpty(object)) {
return null; return null;
...@@ -208,7 +208,7 @@ public class oConvertUtils { ...@@ -208,7 +208,7 @@ public class oConvertUtils {
/*public static String escapeJava(Object s) { /*public static String escapeJava(Object s) {
return StringEscapeUtils.escapeJava(getString(s)); return StringEscapeUtils.escapeJava(getString(s));
}*/ }*/
public static String getString(Object object) { public static String getString(Object object) {
if (isEmpty(object)) { if (isEmpty(object)) {
return ""; return "";
...@@ -247,24 +247,10 @@ public class oConvertUtils { ...@@ -247,24 +247,10 @@ public class oConvertUtils {
return test.longValue(); return test.longValue();
} }
/**
* 获取本机IP
*/
public static String getIp() {
String ip = null;
try {
InetAddress address = InetAddress.getLocalHost();
ip = address.getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return ip;
}
/** /**
* 判断一个类是否为基本数据类型。 * 判断一个类是否为基本数据类型。
* *
* @param clazz * @param clazz
* 要判断的类。 * 要判断的类。
* @return true 表示为基本数据类型。 * @return true 表示为基本数据类型。
...@@ -293,41 +279,8 @@ public class oConvertUtils { ...@@ -293,41 +279,8 @@ public class oConvertUtils {
} }
/** /**
* @return 本机IP
* @throws SocketException
*/
public static String getRealIp() throws SocketException {
String localip = null;// 本地IP,如果没有配置外网IP则返回它
String netip = null;// 外网IP
Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
InetAddress ip = null;
boolean finded = false;// 是否找到外网IP
while (netInterfaces.hasMoreElements() && !finded) {
NetworkInterface ni = netInterfaces.nextElement();
Enumeration<InetAddress> address = ni.getInetAddresses();
while (address.hasMoreElements()) {
ip = address.nextElement();
if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 外网IP
netip = ip.getHostAddress();
finded = true;
break;
} else if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 内网IP
localip = ip.getHostAddress();
}
}
}
if (netip != null && !"".equals(netip)) {
return netip;
} else {
return localip;
}
}
/**
* java去除字符串中的空格、回车、换行符、制表符 * java去除字符串中的空格、回车、换行符、制表符
* *
* @param str * @param str
* @return * @return
*/ */
...@@ -344,7 +297,7 @@ public class oConvertUtils { ...@@ -344,7 +297,7 @@ public class oConvertUtils {
/** /**
* 判断元素是否在数组内 * 判断元素是否在数组内
* *
* @param substring * @param substring
* @param source * @param source
* @return * @return
...@@ -371,7 +324,7 @@ public class oConvertUtils { ...@@ -371,7 +324,7 @@ public class oConvertUtils {
/** /**
* SET转换MAP * SET转换MAP
* *
* @param str * @param str
* @return * @return
*/ */
...@@ -415,12 +368,12 @@ public class oConvertUtils { ...@@ -415,12 +368,12 @@ public class oConvertUtils {
private static boolean isInner(long userIp, long begin, long end) { private static boolean isInner(long userIp, long begin, long end) {
return (userIp >= begin) && (userIp <= end); return (userIp >= begin) && (userIp <= end);
} }
/** /**
* 将下划线大写方式命名的字符串转换为驼峰式。 * 将下划线大写方式命名的字符串转换为驼峰式。
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world->helloWorld * 例如:hello_world->helloWorld
* *
* @param name * @param name
* 转换前的下划线大写方式命名的字符串 * 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串 * @return 转换后的驼峰式命名的字符串
...@@ -457,12 +410,12 @@ public class oConvertUtils { ...@@ -457,12 +410,12 @@ public class oConvertUtils {
} }
return result.toString(); return result.toString();
} }
/** /**
* 将下划线大写方式命名的字符串转换为驼峰式。 * 将下划线大写方式命名的字符串转换为驼峰式。
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world,test_id->helloWorld,testId * 例如:hello_world,test_id->helloWorld,testId
* *
* @param name * @param name
* 转换前的下划线大写方式命名的字符串 * 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串 * @return 转换后的驼峰式命名的字符串
...@@ -480,13 +433,13 @@ public class oConvertUtils { ...@@ -480,13 +433,13 @@ public class oConvertUtils {
String result = sf.toString(); String result = sf.toString();
return result.substring(0, result.length() - 1); return result.substring(0, result.length() - 1);
} }
//update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能 //update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
/** /**
* 将下划线大写方式命名的字符串转换为驼峰式。(首字母写) * 将下划线大写方式命名的字符串转换为驼峰式。(首字母写)
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world->HelloWorld * 例如:hello_world->HelloWorld
* *
* @param name * @param name
* 转换前的下划线大写方式命名的字符串 * 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串 * @return 转换后的驼峰式命名的字符串
...@@ -515,7 +468,7 @@ public class oConvertUtils { ...@@ -515,7 +468,7 @@ public class oConvertUtils {
return result.toString(); return result.toString();
} }
//update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能 //update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
/** /**
* 将驼峰命名转化成下划线 * 将驼峰命名转化成下划线
* @param para * @param para
...@@ -523,18 +476,18 @@ public class oConvertUtils { ...@@ -523,18 +476,18 @@ public class oConvertUtils {
*/ */
public static String camelToUnderline(String para){ public static String camelToUnderline(String para){
if(para.length()<3){ if(para.length()<3){
return para.toLowerCase(); return para.toLowerCase();
} }
StringBuilder sb=new StringBuilder(para); StringBuilder sb=new StringBuilder(para);
int temp=0;//定位 int temp=0;//定位
//从第三个字符开始 避免命名不规范 //从第三个字符开始 避免命名不规范
for(int i=2;i<para.length();i++){ for(int i=2;i<para.length();i++){
if(Character.isUpperCase(para.charAt(i))){ if(Character.isUpperCase(para.charAt(i))){
sb.insert(i+temp, "_"); sb.insert(i+temp, "_");
temp+=1; temp+=1;
} }
} }
return sb.toString().toLowerCase(); return sb.toString().toLowerCase();
} }
/** /**
...@@ -549,10 +502,10 @@ public class oConvertUtils { ...@@ -549,10 +502,10 @@ public class oConvertUtils {
} }
return sb.toString(); return sb.toString();
} }
/** /**
* 获取类的所有属性,包括父类 * 获取类的所有属性,包括父类
* *
* @param object * @param object
* @return * @return
*/ */
...@@ -567,7 +520,7 @@ public class oConvertUtils { ...@@ -567,7 +520,7 @@ public class oConvertUtils {
fieldList.toArray(fields); fieldList.toArray(fields);
return fields; return fields;
} }
/** /**
* 将map的key全部转成小写 * 将map的key全部转成小写
* @param list * @param list
...@@ -577,10 +530,10 @@ public class oConvertUtils { ...@@ -577,10 +530,10 @@ public class oConvertUtils {
List<Map<String, Object>> select = new ArrayList<>(); List<Map<String, Object>> select = new ArrayList<>();
for (Map<String, Object> row : list) { for (Map<String, Object> row : list) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
Set<String> keySet = row.keySet(); Set<String> keySet = row.keySet();
for (String key : keySet) { for (String key : keySet) {
String newKey = key.toLowerCase(); String newKey = key.toLowerCase();
resultMap.put(newKey, row.get(key)); resultMap.put(newKey, row.get(key));
} }
select.add(resultMap); select.add(resultMap);
} }
...@@ -676,7 +629,7 @@ public class oConvertUtils { ...@@ -676,7 +629,7 @@ public class oConvertUtils {
} }
return json; return json;
} }
/** /**
* 字符串转为数组 * 字符串转为数组
* @param strs * @param strs
......
...@@ -24,9 +24,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -24,9 +24,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress; import java.net.InetAddress;
/** /**
* *
* <pre> * <pre>
* *
* </pre> * </pre>
* *
* @author gwb * @author gwb
...@@ -45,27 +45,21 @@ import java.net.InetAddress; ...@@ -45,27 +45,21 @@ import java.net.InetAddress;
"org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" }) "org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" })
@ComponentScan({ "org.typroject", "com.yeejoin.amos" }) @ComponentScan({ "org.typroject", "com.yeejoin.amos" })
public class AccessapiApplication { public class AccessapiApplication {
@Autowired @Autowired
private TaAccessConfigServiceImpl taAccessConfigServiceImpl; private TaAccessConfigServiceImpl taAccessConfigServiceImpl;
private static final Logger logger = LogManager.getLogger(AccessapiApplication.class); private static final Logger logger = LogManager.getLogger(AccessapiApplication.class);
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// //license授权验证
// System.setProperty("root.path",ClassPathUtil.getPath()+"/config");
// log.info("(license.bat)url:" + ClassPathUtil.getPath()+"/config");
// A.v();
// 服务启动
ConfigurableApplicationContext context = SpringApplication.run(AccessapiApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AccessapiApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + "Application {} is running!\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "----------------------------------------------------------\n"
+ path + "/doc.html\n" + "----------------------------------------------------------"); , appName
);
} }
@Bean @Bean
......
...@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress; import java.net.InetAddress;
/** /**
* *
* <pre> * <pre>
* *
* </pre> * </pre>
* *
* @author gwb * @author gwb
...@@ -50,11 +50,12 @@ public class AlarmApplication { ...@@ -50,11 +50,12 @@ public class AlarmApplication {
ConfigurableApplicationContext context = SpringApplication.run(AlarmApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AlarmApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + "Application {} is running!\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "----------------------------------------------------------\n"
+ path + "/doc.html\n" + "----------------------------------------------------------"); , appName
);
} }
} }
...@@ -41,18 +41,16 @@ public class EquipDataApplication { ...@@ -41,18 +41,16 @@ public class EquipDataApplication {
private static final Logger logger = LogManager.getLogger(EquipDataApplication.class); private static final Logger logger = LogManager.getLogger(EquipDataApplication.class);
public static void main(String[] args) throws Exception { public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(EquipDataApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(EquipDataApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + "Application {} is running!\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "----------------------------------------------------------\n"
+ path + "/doc.html\n" + "----------------------------------------------------------"); , appName
);
} }
} }
...@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress; import java.net.InetAddress;
/** /**
* *
* <pre> * <pre>
* *
* </pre> * </pre>
* *
* @author gwb * @author gwb
...@@ -54,11 +54,12 @@ public class OpenapiApplication { ...@@ -54,11 +54,12 @@ public class OpenapiApplication {
ConfigurableApplicationContext context = SpringApplication.run(OpenapiApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(OpenapiApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + "Application {} is running!\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "----------------------------------------------------------\n"
+ path + "/doc.html\n" + "----------------------------------------------------------"); , appName
);
} }
} }
...@@ -5,6 +5,8 @@ import org.springframework.context.annotation.Bean; ...@@ -5,6 +5,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import java.util.Objects;
/** /**
* 路由限流配置 * 路由限流配置
* @author zhuyu * @author zhuyu
...@@ -15,6 +17,6 @@ public class RateLimiterConfig { ...@@ -15,6 +17,6 @@ public class RateLimiterConfig {
@Bean(value = "remoteAddrKeyResolver") @Bean(value = "remoteAddrKeyResolver")
public KeyResolver remoteAddrKeyResolver() { public KeyResolver remoteAddrKeyResolver() {
return exchange -> Mono.just(exchange.getRequest().getRemoteAddress().getAddress().getHostAddress()); return exchange -> Mono.just(Objects.requireNonNull(exchange.getRequest().getRemoteAddress()).getAddress().getHostAddress());
} }
} }
\ No newline at end of file
...@@ -139,72 +139,6 @@ public class IpUtils { ...@@ -139,72 +139,6 @@ public class IpUtils {
return start <= end; return start <= end;
} }
public static List<String> getLocalIps() throws SocketException {
List<String> ips = new ArrayList<>();
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.isLoopbackAddress()) {
//回路地址
} else if (inetAddress.isLinkLocalAddress()) {
//链接地址
} else {
ips.add(inetAddress.getHostAddress());
}
}
}
return ips;
}
/**
* 获取所有网卡,注意或过滤掉回路地址、链接地址\ipv6
* @return 网卡列表
* @throws SocketException 异常
*/
public static List<InetAddress> getLocalHostLANAddress() throws SocketException {
List<InetAddress> addresses = new ArrayList<>();
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.isLoopbackAddress()) {
//回路地址
} else if (inetAddress.isLinkLocalAddress()) {
//链接地址
} else {
//非链接和回路真实ip
if(inetAddress.getHostAddress().contains(":")) {
//过滤ipv6
continue;
}
addresses.add(inetAddress);
}
}
}
return addresses;
}
public static InetAddress getInetAddress(String ip) throws SocketException {
validateIp(ip);
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if(inetAddress.getHostAddress().contains(ip)) {
return inetAddress;
}
}
}
throw new IllegalArgumentException("ip invalid, ip = " + ip);
}
public static String getMACAddress(InetAddress ia) throws SocketException { public static String getMACAddress(InetAddress ia) throws SocketException {
// 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。 // 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。
byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress(); byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();
...@@ -229,25 +163,5 @@ public class IpUtils { ...@@ -229,25 +163,5 @@ public class IpUtils {
} }
return macs; return macs;
} }
public static String getInet4Address() {
Enumeration<NetworkInterface> nis;
String ip = null;
try {
nis = NetworkInterface.getNetworkInterfaces();
for (; nis.hasMoreElements();) {
NetworkInterface ni = nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
for (; ias.hasMoreElements();) {
InetAddress ia = ias.nextElement();
if (ia instanceof Inet4Address && !ia.getHostAddress().equals("127.0.0.1")) {
ip = ia.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return ip;
}
} }
...@@ -137,73 +137,6 @@ public class IpUtils { ...@@ -137,73 +137,6 @@ public class IpUtils {
return start <= end; return start <= end;
} }
public static List<String> getLocalIps() throws SocketException {
List<String> ips = new ArrayList<>();
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.isLoopbackAddress()) {
//回路地址
} else if (inetAddress.isLinkLocalAddress()) {
//链接地址
} else {
ips.add(inetAddress.getHostAddress());
}
}
}
return ips;
}
/**
* 获取所有网卡,注意或过滤掉回路地址、链接地址\ipv6
*
* @return 网卡列表
* @throws SocketException 异常
*/
public static List<InetAddress> getLocalHostLanAddress() throws SocketException {
List<InetAddress> addresses = new ArrayList<>();
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.isLoopbackAddress()) {
//回路地址
} else if (inetAddress.isLinkLocalAddress()) {
//链接地址
} else {
//非链接和回路真实ip
if (inetAddress.getHostAddress().contains(":")) {
//过滤ipv6
continue;
}
addresses.add(inetAddress);
}
}
}
return addresses;
}
public static InetAddress getInetAddress(String ip) throws SocketException {
validateIp(ip);
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress.getHostAddress().contains(ip)) {
return inetAddress;
}
}
}
throw new IllegalArgumentException("ip invalid, ip = " + ip);
}
public static String getMacAddress(InetAddress ia) throws SocketException { public static String getMacAddress(InetAddress ia) throws SocketException {
// 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。 // 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。
byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress(); byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();
......
...@@ -618,27 +618,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -618,27 +618,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
return lists; return lists;
} }
private static String getInet4Address() {
Enumeration<NetworkInterface> nis;
String ip = null;
try {
nis = NetworkInterface.getNetworkInterfaces();
for (; nis.hasMoreElements(); ) {
NetworkInterface ni = nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
for (; ias.hasMoreElements(); ) {
InetAddress ia = ias.nextElement();
if (ia instanceof Inet4Address && !ia.getHostAddress().equals("127.0.0.1")) {
ip = ia.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return ip;
}
@Override @Override
public int getCountAlarmEquipment() { public int getCountAlarmEquipment() {
return equipmentSpecificAlarmMapper.getCountAlarmEquipment(); return equipmentSpecificAlarmMapper.getCountAlarmEquipment();
......
...@@ -1120,27 +1120,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1120,27 +1120,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return this.baseMapper.getEquipmentAlarmBySystemIdOrSourceIdVO(page, sourceId, systemId, confirmType, createDate, type, equipmentId); return this.baseMapper.getEquipmentAlarmBySystemIdOrSourceIdVO(page, sourceId, systemId, confirmType, createDate, type, equipmentId);
} }
private static String getInet4Address() {
Enumeration<NetworkInterface> nis;
String ip = null;
try {
nis = NetworkInterface.getNetworkInterfaces();
for (; nis.hasMoreElements(); ) {
NetworkInterface ni = nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
for (; ias.hasMoreElements(); ) {
InetAddress ia = ias.nextElement();
if (ia instanceof Inet4Address && !ia.getHostAddress().equals("127.0.0.1")) {
ip = ia.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return ip;
}
@Override @Override
public Map<String, Object> integrationPageSysData(String systemCode, Boolean isUpdate) { public Map<String, Object> integrationPageSysData(String systemCode, Boolean isUpdate) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
......
...@@ -82,10 +82,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -82,10 +82,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
@Value("${equip.point.equipmentdata.url}") @Value("${equip.point.equipmentdata.url}")
private String equipmentdataUrl; private String equipmentdataUrl;
//
// @Value("${equip.point.statusApi.url}")
// private String statusApiUrl;
@Value("${mqtt.scene.host}") @Value("${mqtt.scene.host}")
private String sceneUrl; private String sceneUrl;
...@@ -243,12 +239,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -243,12 +239,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
@Override @Override
public List queryPartType() { public List queryPartType() {
InetAddress address = null;
try {
address = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
String categoryUrl = url; String categoryUrl = url;
List<EquipmentCategory> list = iEquipmentCategoryService.list(); List<EquipmentCategory> list = iEquipmentCategoryService.list();
List<Map> returnList; List<Map> returnList;
...@@ -324,7 +314,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -324,7 +314,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
public List<PointTreeVo> getSystemmeanLsit() { public List<PointTreeVo> getSystemmeanLsit() {
return equipmentSpecificMapper.getSystemmeanLsit(); return equipmentSpecificMapper.getSystemmeanLsit();
} }
@Override @Override
public List<Map> getstatus(String sceneId) { public List<Map> getstatus(String sceneId) {
List<Map> data = new ArrayList<>(); List<Map> data = new ArrayList<>();
...@@ -334,7 +324,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -334,7 +324,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
}else{ }else{
equipIndexLatestStatus = equipmentSpecificMapper.getEquipLatestStatusBySceneId(sceneId); equipIndexLatestStatus = equipmentSpecificMapper.getEquipLatestStatusBySceneId(sceneId);
} }
equipIndexLatestStatus.forEach(action->{ equipIndexLatestStatus.forEach(action->{
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("equipCode", action.getQrCode()); map.put("equipCode", action.getQrCode());
...@@ -351,59 +341,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -351,59 +341,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
return data; return data;
} }
private String getStatusByQrCode(String qrCode) {
List<EquipmentSpecificIndex> equipMentStatus = equipmentSpecificMapper.getEquipMentStatus(qrCode);
if (equipMentStatus == null || equipMentStatus.size() == 0) {
return EquipmentRiskTypeEnum.QT.getStateCode();
}
// 组态图用
LinkedHashMap<String, String> map = equipMentStatus.stream().collect(LinkedHashMap::new, (n, v) -> n.put(v.getType(), v.getValue()), LinkedHashMap::putAll);
List<String> list = new ArrayList<>(map.keySet());
boolean flag = false;
if (0 < list.size()) {
for (String s : list) {
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(s)) {
flag = true;
if (TrueOrFalseEnum.real.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.HZGJ.getStateCode();
} else if (TrueOrFalseEnum.fake.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.YXZT.getStateCode();
}
}
if (EquipmentRiskTypeEnum.GZ.getCode().equals(s)) {
flag = true;
if (TrueOrFalseEnum.real.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.GZ.getStateCode();
} else if (TrueOrFalseEnum.fake.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.YXZT.getStateCode();
}
}
if (EquipmentRiskTypeEnum.PB.getCode().equals(s)) {
flag = true;
if (TrueOrFalseEnum.real.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.PB.getStateCode();
} else if (TrueOrFalseEnum.fake.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.YXZT.getStateCode();
}
}
// 如果是运行状态且值为false 或 所有指标都不存在返回挂起
if (EquipmentRiskTypeEnum.YXZT.getCode().equals(s)) {
flag = true;
if (TrueOrFalseEnum.fake.value.equals(map.get(s))) {
return EquipmentRiskTypeEnum.QT.getStateCode();
}
}
}
}
if (flag) {
return EquipmentRiskTypeEnum.QT.getStateCode();
}
return EquipmentRiskTypeEnum.YXZT.getStateCode();
}
private Map<String, Object> getSystemEquList(Map<String, Object> res, String orgCode, Long id) { private Map<String, Object> getSystemEquList(Map<String, Object> res, String orgCode, Long id) {
List<PointTreeVo> list = equipmentSpecificMapper.getSystemEquList(orgCode, id); List<PointTreeVo> list = equipmentSpecificMapper.getSystemEquList(orgCode, id);
String firstCanvas = equipmentSpecificMapper.getFirstCanvas(orgCode); String firstCanvas = equipmentSpecificMapper.getFirstCanvas(orgCode);
...@@ -428,70 +365,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -428,70 +365,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
return res; return res;
} }
private List<RiskSourceTreeVO> getImportantEquipTree(List<RiskSourceTreeVO> list) {
List<RiskSourceTreeVO> treeList = new ArrayList<>();
for (RiskSourceTreeVO tree : list) {
if (tree.getParentId() != null && tree.getParentId() == 0) {
treeList.add(tree);
}
for (RiskSourceTreeVO treeNode : list) {
if (treeNode.getParentId().longValue() == tree.getId()) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
}
riskSourceTreeVOs = null;
for (RiskSourceTreeVO x : treeList) {
if (x.getChildren() != null) {
for (RiskSourceTreeVO y : x.getChildren()) {
if (y.getChildren() != null) {
for (RiskSourceTreeVO z : y.getChildren()) {
if (z.getChildren() != null) {
for (RiskSourceTreeVO m : z.getChildren()) {
List<RiskSourceTreeVO> list1 = this.baseMapper.getImportantEquip(m.getId());
List<RiskSourceTreeVO> mapperImportantEquips = this.baseMapper.getImportantEquip(m.getId());
if (mapperImportantEquips.size() > 0) {
m.getChildren().addAll(mapperImportantEquips);
}
if (riskSourceTreeVOs == null && list1.size() > 0) {
riskSourceTreeVOs = list1;
}
if (list1.size() > 0 && riskSourceTreeVOs.size() < 4) {
riskSourceTreeVOs.addAll(list1);
}
}
List<RiskSourceTreeVO> mapperImportantEquips2 = this.baseMapper.getImportantEquip(z.getId());
if (mapperImportantEquips2.size() > 0) {
z.getChildren().addAll(mapperImportantEquips2);
}
}
}
}
List<RiskSourceTreeVO> mapperImportantEquips3 = this.baseMapper.getImportantEquip(y.getId());
if (mapperImportantEquips3.size() > 0) {
if (CollectionUtils.isEmpty(y.getChildren())) {
y.setChildren(new ArrayList<>());
}
y.getChildren().addAll(mapperImportantEquips3);
}
}
}
List<RiskSourceTreeVO> mapperImportantEquips4 = this.baseMapper.getImportantEquip(x.getId());
if (mapperImportantEquips4.size() > 0) {
x.getChildren().addAll(mapperImportantEquips4);
}
}
return treeList;
}
// @Override
// public String saveMorphic(PointTreeVo PointTreeVo) {
// RiskSourceScene risk = new RiskSourceScene();
// return null;
// }
private List<RiskSourceTreeVO> getRiskSourcesTree(List<RiskSourceTreeVO> list) { private List<RiskSourceTreeVO> getRiskSourcesTree(List<RiskSourceTreeVO> list) {
List<RiskSourceTreeVO> treeList = new ArrayList<>(); List<RiskSourceTreeVO> treeList = new ArrayList<>();
for (RiskSourceTreeVO tree : list) { for (RiskSourceTreeVO tree : list) {
......
...@@ -42,7 +42,7 @@ public class SocketClient { ...@@ -42,7 +42,7 @@ public class SocketClient {
logger.error(logs); logger.error(logs);
datagramSocket.send(new DatagramPacket(b, b.length, InetAddress.getLocalHost(), port)); datagramSocket.send(new DatagramPacket(b, b.length, port));
int deltaSleep = getSleepDelta(len, 16000); int deltaSleep = getSleepDelta(len, 16000);
Thread.sleep(deltaSleep); Thread.sleep(deltaSleep);
TimeUnit.MILLISECONDS.sleep(100); TimeUnit.MILLISECONDS.sleep(100);
...@@ -53,28 +53,5 @@ public class SocketClient { ...@@ -53,28 +53,5 @@ public class SocketClient {
} }
} }
@Async
public void processTcp(int port, int type) {
if (type < 0) type = 0;
if (type >= testFilePath.length) type -= 1;
try (Socket socket = new Socket();
FileInputStream fis = new FileInputStream(testFilePath[type]);) {
socket.connect(new InetSocketAddress(InetAddress.getLocalHost().getHostAddress(), port));
OutputStream outputStream = socket.getOutputStream();
byte[] b = new byte[4096];
int len;
while ((len = fis.read(b)) > 0) {
String logs = String.format("send data pack length: %s", len);
logger.error(logs);
outputStream.write(b);
TimeUnit.MILLISECONDS.sleep(200);
}
outputStream.flush();
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} }
...@@ -102,7 +102,6 @@ public class RealTimeStream2Text { ...@@ -102,7 +102,6 @@ public class RealTimeStream2Text {
map.add("number", number); map.add("number", number);
map.add("codec", "PCM"); map.add("codec", "PCM");
map.add("uuid", UUID.randomUUID().toString()); map.add("uuid", UUID.randomUUID().toString());
//map.add("dstip", InetAddress.getLocalHost().getHostAddress());
map.add("dstip", localIpAddress); map.add("dstip", localIpAddress);
map.add("dstport", String.valueOf(port)); map.add("dstport", String.valueOf(port));
map.add("marker", "amos"); map.add("marker", "amos");
......
...@@ -5,8 +5,6 @@ import java.io.FileInputStream; ...@@ -5,8 +5,6 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.net.DatagramPacket; import java.net.DatagramPacket;
import java.net.DatagramSocket; import java.net.DatagramSocket;
import java.net.InetAddress;
import com.alibaba.nls.client.AccessToken; import com.alibaba.nls.client.AccessToken;
import com.alibaba.nls.client.protocol.InputFormatEnum; import com.alibaba.nls.client.protocol.InputFormatEnum;
...@@ -171,7 +169,7 @@ public class SpeechTranscriberDemo { ...@@ -171,7 +169,7 @@ public class SpeechTranscriberDemo {
while ((len = fis.read(b)) > 0) { while ((len = fis.read(b)) > 0) {
// logger.info("send data pack length: " + len); // logger.info("send data pack length: " + len);
datagramSocket.send(new DatagramPacket(b, b.length, InetAddress.getLocalHost(), 25000)); datagramSocket.send(new DatagramPacket(b, b.length, 25000));
transcriber.send(b, len); transcriber.send(b, len);
//本案例用读取本地文件的形式模拟实时获取语音流并发送的,因为读取速度较快,这里需要设置sleep。 //本案例用读取本地文件的形式模拟实时获取语音流并发送的,因为读取速度较快,这里需要设置sleep。
......
...@@ -503,13 +503,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -503,13 +503,9 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) { public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
...@@ -588,13 +584,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -588,13 +584,9 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey,
long checkId) { long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
......
...@@ -875,18 +875,13 @@ public class CheckServiceImpl implements ICheckService { ...@@ -875,18 +875,13 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId) { public AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l);
pointShot.forEach(action -> { pointShot.forEach(action -> {
// pointImgUrls.add(fileUrl + action.getPhotoData());
pointImgUrls.add(action.getPhotoData()); pointImgUrls.add(action.getPhotoData());
}); });
Check check = checkDao.findById(checkId).get(); Check check = checkDao.findById(checkId).get();
...@@ -961,18 +956,13 @@ public class CheckServiceImpl implements ICheckService { ...@@ -961,18 +956,13 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke,String product,String appKey,long checkId) { public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke,String product,String appKey,long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l);
pointShot.forEach(action -> { pointShot.forEach(action -> {
// pointImgUrls.add(fileUrl + action.getPhotoData());
pointImgUrls.add(action.getPhotoData()); pointImgUrls.add(action.getPhotoData());
}); });
Check check = checkDao.findById(checkId).get(); Check check = checkDao.findById(checkId).get();
......
...@@ -164,7 +164,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -164,7 +164,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// private String photoUrlPre; // private String photoUrlPre;
// @Value("${file.url}") // @Value("${file.url}")
// private String fileUrl; // private String fileUrl;
@Value("${file.url}") @Value("${file.url}")
private String fileServerAddress; private String fileServerAddress;
...@@ -371,15 +371,6 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -371,15 +371,6 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}); });
} }
private String buildLocalHost() {
try {
String ip = InetAddress.getLocalHost().getHostAddress();
return "http://" + ip + ":" + port + "/";
} catch (Exception e) {
return "";
}
}
private void updateMeasuresContentStatus(Long riskFactorId, Long measuresContentId, String evaluateId, RiskFactorsCmStatusEnum riskFactorsCmStatusEnum) { private void updateMeasuresContentStatus(Long riskFactorId, Long measuresContentId, String evaluateId, RiskFactorsCmStatusEnum riskFactorsCmStatusEnum) {
Map<String, Object> map = Maps.newHashMap(); Map<String, Object> map = Maps.newHashMap();
map.put("riskFactorId", riskFactorId); map.put("riskFactorId", riskFactorId);
......
...@@ -272,13 +272,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -272,13 +272,9 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) { public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
...@@ -356,13 +352,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -356,13 +352,9 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, long checkId) { public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId); List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) { if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>(); List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0); PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l); List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
......
...@@ -343,15 +343,6 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -343,15 +343,6 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerMapper.updateCheckInputDangerState(id, code); latentDangerMapper.updateCheckInputDangerState(id, code);
} }
private String buildLocalHost() {
try {
String ip = InetAddress.getLocalHost().getHostAddress();
return "http://" + ip + ":" + port + "/";
} catch (Exception e) {
return "";
}
}
private void updateMeasuresContentStatus(Long riskFactorId, Long measuresContentId, String evaluateId, RiskFactorsCmStatusEnum riskFactorsCmStatusEnum) { private void updateMeasuresContentStatus(Long riskFactorId, Long measuresContentId, String evaluateId, RiskFactorsCmStatusEnum riskFactorsCmStatusEnum) {
Map<String, Object> map = Maps.newHashMap(); Map<String, Object> map = Maps.newHashMap();
map.put("riskFactorId", riskFactorId); map.put("riskFactorId", riskFactorId);
......
...@@ -42,13 +42,13 @@ public class AmoAVICApplication { ...@@ -42,13 +42,13 @@ public class AmoAVICApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmoAVICApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmoAVICApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -50,12 +50,12 @@ public class AmosCasApplication { ...@@ -50,12 +50,12 @@ public class AmosCasApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosCasApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosCasApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -40,13 +40,13 @@ public class AmoCCSApplication { ...@@ -40,13 +40,13 @@ public class AmoCCSApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmoCCSApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmoCCSApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -58,20 +58,18 @@ public class AmostEquipApplication { ...@@ -58,20 +58,18 @@ public class AmostEquipApplication {
@Autowired @Autowired
private CarIotNewListener carIotNewListener; private CarIotNewListener carIotNewListener;
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" Environment env = context.getEnvironment();
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port String appName = env.getProperty("spring.application.name");
+ path + "/doc.html\n" + "----------------------------------------------------------"); logger.info(
} "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
@Bean @Bean
@LoadBalanced @LoadBalanced
......
...@@ -34,7 +34,7 @@ import com.yeejoin.amos.fas.context.IotContext; ...@@ -34,7 +34,7 @@ import com.yeejoin.amos.fas.context.IotContext;
/** /**
* *
* <pre> * <pre>
* 服务启动类 * 服务启动类
* </pre> * </pre>
...@@ -70,15 +70,14 @@ public class FireAutoSysApplication implements ApplicationContextAware { ...@@ -70,15 +70,14 @@ public class FireAutoSysApplication implements ApplicationContextAware {
logger.info("start Service.........."); logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(FireAutoSysApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(FireAutoSysApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
/** /**
......
...@@ -50,17 +50,18 @@ public class AmosJcsApplication { ...@@ -50,17 +50,18 @@ public class AmosJcsApplication {
ConfigurableApplicationContext context = SpringApplication.run(AmosJcsApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosJcsApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
delKey(env, context);// 添加全部清空redis缓存的方法 2021-09-09 delKey(env, context);// 添加全部清空redis缓存的方法 2021-09-09
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
String logs=String.format("%n----------------------------------------------------------%n Application Amos-Biz-Boot is running! Access URLs:%n Swagger文档: http://%s:%s%s/doc.html%n----------------------------------------------------------",ip,port,path); + "----------------------------------------------------------\n"
logger.info( logs); , appName
);
} }
/** /**
* 清空redis缓存数据 * 清空redis缓存数据
* *
* @author 陈浩 * @author 陈浩
* @param env * @param env
* @param context * @param context
......
...@@ -42,13 +42,13 @@ public class AmoKGDApplication { ...@@ -42,13 +42,13 @@ public class AmoKGDApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmoKGDApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmoKGDApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -39,13 +39,12 @@ public class KnowledgebaseApplication { ...@@ -39,13 +39,12 @@ public class KnowledgebaseApplication {
ConfigurableApplicationContext context = new SpringApplicationBuilder(KnowledgebaseApplication.class).web(WebApplicationType.SERVLET).run(args); ConfigurableApplicationContext context = new SpringApplicationBuilder(KnowledgebaseApplication.class).web(WebApplicationType.SERVLET).run(args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
} }
...@@ -70,14 +70,13 @@ public class LatentDangerApplication { ...@@ -70,14 +70,13 @@ public class LatentDangerApplication {
logger.info("start Service.........."); logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(LatentDangerApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(LatentDangerApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
} }
\ No newline at end of file
...@@ -69,14 +69,13 @@ public class MaintenanceApplication { ...@@ -69,14 +69,13 @@ public class MaintenanceApplication {
ConfigurableApplicationContext context = SpringApplication.run(MaintenanceApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(MaintenanceApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
......
...@@ -85,14 +85,13 @@ public class PatrolApplication { ...@@ -85,14 +85,13 @@ public class PatrolApplication {
ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
/** /**
......
...@@ -75,14 +75,13 @@ public class SupervisionApplication { ...@@ -75,14 +75,13 @@ public class SupervisionApplication {
ConfigurableApplicationContext context = SpringApplication.run(SupervisionApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(SupervisionApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
GlobalExceptionHandler.setAlwaysOk(true); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
@Bean @Bean
......
...@@ -50,12 +50,12 @@ public class AmosTdcApplication { ...@@ -50,12 +50,12 @@ public class AmosTdcApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosTdcApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosTdcApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -74,18 +74,17 @@ public class AmosTzsApplication { ...@@ -74,18 +74,17 @@ public class AmosTzsApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmosTzsApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosTzsApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port"); String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
logger.info("\n----------------------------------------------------------\n\t" logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "Application Amos-Biz-Boot is running!\n\t"
+ path + "/doc.html\n" + "----------------------------------------------------------"); + "----------------------------------------------------------");
} }
/** /**
* 初始化MQTT * 初始化MQTT
* *
* @throws MqttException * @throws MqttException
*/ */
@Bean @Bean
......
...@@ -50,12 +50,12 @@ public class AmosUgpApplication { ...@@ -50,12 +50,12 @@ public class AmosUgpApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosUgpApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosUgpApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); "\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + "----------------------------------------------------------\n"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port , appName
+ path + "/doc.html\n" + "----------------------------------------------------------"); );
} }
} }
...@@ -40,14 +40,9 @@ public class JpushApplication { ...@@ -40,14 +40,9 @@ public class JpushApplication {
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(JpushApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(JpushApplication.class, args);
// GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); logger.info("\n----------------------------------------------------------\n\t"
String port = env.getProperty("server.port"); + "Application Amos-Biz-Boot is running!\n\t"
String path = env.getProperty("server.servlet.context-path"); + "----------------------------------------------------------");
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
} }
} }
\ No newline at end of file
...@@ -41,13 +41,13 @@ public class AmosBootUtilsMessageApplication { ...@@ -41,13 +41,13 @@ public class AmosBootUtilsMessageApplication {
ConfigurableApplicationContext context = SpringApplication.run(AmosBootUtilsMessageApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmosBootUtilsMessageApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress(); String appName = env.getProperty("spring.application.name");
String port = env.getProperty("server.port"); logger.info(
String path = env.getProperty("server.servlet.context-path"); "\n----------------------------------------------------------\n\t"
logger.info("\n----------------------------------------------------------\n\t" + + "Application {} is running!\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + + "----------------------------------------------------------\n"
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + , appName
"----------------------------------------------------------"); );
} }
} }
...@@ -36,16 +36,15 @@ import java.net.UnknownHostException; ...@@ -36,16 +36,15 @@ import java.net.UnknownHostException;
public class VideoApplication { public class VideoApplication {
private static final Logger logger = LoggerFactory.getLogger(VideoApplication.class); private static final Logger logger = LoggerFactory.getLogger(VideoApplication.class);
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(VideoApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(VideoApplication.class, args);
// GlobalExceptionHandler.setAlwaysOk(true); Environment env = context.getEnvironment();
Environment env = context.getEnvironment(); String appName = env.getProperty("spring.application.name");
String ip = InetAddress.getLocalHost().getHostAddress(); logger.info(
String port = env.getProperty("server.port"); "\n----------------------------------------------------------\n\t"
String path = env.getProperty("server.servlet.context-path"); + "Application {} is running!\n"
logger.info("\n----------------------------------------------------------\n\t" + + "----------------------------------------------------------\n"
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + , appName
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + );
"----------------------------------------------------------");
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment