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;
import java.util.regex.Pattern;
/**
*
*
* @Author lichenglong
*
*/
......@@ -40,7 +40,7 @@ public class oConvertUtils {
}
return (false);
}
public static boolean isNotEmpty(Object object) {
if (object != null && !object.equals("") && !object.equals("null")) {
return (true);
......@@ -164,7 +164,7 @@ public class oConvertUtils {
return (defval);
}
}
public static Integer getInt(Object object) {
if (isEmpty(object)) {
return null;
......@@ -208,7 +208,7 @@ public class oConvertUtils {
/*public static String escapeJava(Object s) {
return StringEscapeUtils.escapeJava(getString(s));
}*/
public static String getString(Object object) {
if (isEmpty(object)) {
return "";
......@@ -247,24 +247,10 @@ public class oConvertUtils {
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
* 要判断的类。
* @return true 表示为基本数据类型。
......@@ -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去除字符串中的空格、回车、换行符、制表符
*
*
* @param str
* @return
*/
......@@ -344,7 +297,7 @@ public class oConvertUtils {
/**
* 判断元素是否在数组内
*
*
* @param substring
* @param source
* @return
......@@ -371,7 +324,7 @@ public class oConvertUtils {
/**
* SET转换MAP
*
*
* @param str
* @return
*/
......@@ -415,12 +368,12 @@ public class oConvertUtils {
private static boolean isInner(long userIp, long begin, long end) {
return (userIp >= begin) && (userIp <= end);
}
/**
* 将下划线大写方式命名的字符串转换为驼峰式。
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world->helloWorld
*
*
* @param name
* 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串
......@@ -457,12 +410,12 @@ public class oConvertUtils {
}
return result.toString();
}
/**
* 将下划线大写方式命名的字符串转换为驼峰式。
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world,test_id->helloWorld,testId
*
*
* @param name
* 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串
......@@ -480,13 +433,13 @@ public class oConvertUtils {
String result = sf.toString();
return result.substring(0, result.length() - 1);
}
//update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
/**
* 将下划线大写方式命名的字符串转换为驼峰式。(首字母写)
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world->HelloWorld
*
*
* @param name
* 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串
......@@ -515,7 +468,7 @@ public class oConvertUtils {
return result.toString();
}
//update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
/**
* 将驼峰命名转化成下划线
* @param para
......@@ -523,18 +476,18 @@ public class oConvertUtils {
*/
public static String camelToUnderline(String para){
if(para.length()<3){
return para.toLowerCase();
return para.toLowerCase();
}
StringBuilder sb=new StringBuilder(para);
int temp=0;//定位
//从第三个字符开始 避免命名不规范
//从第三个字符开始 避免命名不规范
for(int i=2;i<para.length();i++){
if(Character.isUpperCase(para.charAt(i))){
sb.insert(i+temp, "_");
temp+=1;
}
}
return sb.toString().toLowerCase();
return sb.toString().toLowerCase();
}
/**
......@@ -549,10 +502,10 @@ public class oConvertUtils {
}
return sb.toString();
}
/**
* 获取类的所有属性,包括父类
*
*
* @param object
* @return
*/
......@@ -567,7 +520,7 @@ public class oConvertUtils {
fieldList.toArray(fields);
return fields;
}
/**
* 将map的key全部转成小写
* @param list
......@@ -577,10 +530,10 @@ public class oConvertUtils {
List<Map<String, Object>> select = new ArrayList<>();
for (Map<String, Object> row : list) {
Map<String, Object> resultMap = new HashMap<>();
Set<String> keySet = row.keySet();
for (String key : keySet) {
String newKey = key.toLowerCase();
resultMap.put(newKey, row.get(key));
Set<String> keySet = row.keySet();
for (String key : keySet) {
String newKey = key.toLowerCase();
resultMap.put(newKey, row.get(key));
}
select.add(resultMap);
}
......@@ -676,7 +629,7 @@ public class oConvertUtils {
}
return json;
}
/**
* 字符串转为数组
* @param strs
......
......@@ -24,9 +24,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress;
/**
*
*
* <pre>
*
*
* </pre>
*
* @author gwb
......@@ -45,27 +45,21 @@ import java.net.InetAddress;
"org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" })
@ComponentScan({ "org.typroject", "com.yeejoin.amos" })
public class AccessapiApplication {
@Autowired
private TaAccessConfigServiceImpl taAccessConfigServiceImpl;
private static final Logger logger = LogManager.getLogger(AccessapiApplication.class);
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);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
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" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
@Bean
......
......@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress;
/**
*
*
* <pre>
*
*
* </pre>
*
* @author gwb
......@@ -50,11 +50,12 @@ public class AlarmApplication {
ConfigurableApplicationContext context = SpringApplication.run(AlarmApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
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" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -41,18 +41,16 @@ public class EquipDataApplication {
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);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
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" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -21,9 +21,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress;
/**
*
*
* <pre>
*
*
* </pre>
*
* @author gwb
......@@ -54,11 +54,12 @@ public class OpenapiApplication {
ConfigurableApplicationContext context = SpringApplication.run(OpenapiApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
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" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -5,6 +5,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono;
import java.util.Objects;
/**
* 路由限流配置
* @author zhuyu
......@@ -15,6 +17,6 @@ public class RateLimiterConfig {
@Bean(value = "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 {
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 {
// 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。
byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();
......@@ -229,25 +163,5 @@ public class IpUtils {
}
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 {
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 {
// 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。
byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();
......
......@@ -618,27 +618,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
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
public int getCountAlarmEquipment() {
return equipmentSpecificAlarmMapper.getCountAlarmEquipment();
......
......@@ -1120,27 +1120,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
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
public Map<String, Object> integrationPageSysData(String systemCode, Boolean isUpdate) {
// TODO Auto-generated method stub
......
......@@ -82,10 +82,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
@Value("${equip.point.equipmentdata.url}")
private String equipmentdataUrl;
//
// @Value("${equip.point.statusApi.url}")
// private String statusApiUrl;
@Value("${mqtt.scene.host}")
private String sceneUrl;
......@@ -243,12 +239,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
@Override
public List queryPartType() {
InetAddress address = null;
try {
address = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
String categoryUrl = url;
List<EquipmentCategory> list = iEquipmentCategoryService.list();
List<Map> returnList;
......@@ -324,7 +314,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
public List<PointTreeVo> getSystemmeanLsit() {
return equipmentSpecificMapper.getSystemmeanLsit();
}
@Override
public List<Map> getstatus(String sceneId) {
List<Map> data = new ArrayList<>();
......@@ -334,7 +324,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
}else{
equipIndexLatestStatus = equipmentSpecificMapper.getEquipLatestStatusBySceneId(sceneId);
}
equipIndexLatestStatus.forEach(action->{
Map<String, String> map = new HashMap<>();
map.put("equipCode", action.getQrCode());
......@@ -351,59 +341,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
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) {
List<PointTreeVo> list = equipmentSpecificMapper.getSystemEquList(orgCode, id);
String firstCanvas = equipmentSpecificMapper.getFirstCanvas(orgCode);
......@@ -428,70 +365,6 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
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) {
List<RiskSourceTreeVO> treeList = new ArrayList<>();
for (RiskSourceTreeVO tree : list) {
......
......@@ -42,7 +42,7 @@ public class SocketClient {
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);
Thread.sleep(deltaSleep);
TimeUnit.MILLISECONDS.sleep(100);
......@@ -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 {
map.add("number", number);
map.add("codec", "PCM");
map.add("uuid", UUID.randomUUID().toString());
//map.add("dstip", InetAddress.getLocalHost().getHostAddress());
map.add("dstip", localIpAddress);
map.add("dstport", String.valueOf(port));
map.add("marker", "amos");
......
......@@ -5,8 +5,6 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import com.alibaba.nls.client.AccessToken;
import com.alibaba.nls.client.protocol.InputFormatEnum;
......@@ -171,7 +169,7 @@ public class SpeechTranscriberDemo {
while ((len = fis.read(b)) > 0) {
// 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);
//本案例用读取本地文件的形式模拟实时获取语音流并发送的,因为读取速度较快,这里需要设置sleep。
......
......@@ -503,13 +503,9 @@ public class CheckServiceImpl implements ICheckService {
@Override
public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
......@@ -588,13 +584,9 @@ public class CheckServiceImpl implements ICheckService {
@Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey,
long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
......
......@@ -875,18 +875,13 @@ public class CheckServiceImpl implements ICheckService {
@Override
public AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l);
pointShot.forEach(action -> {
// pointImgUrls.add(fileUrl + action.getPhotoData());
pointImgUrls.add(action.getPhotoData());
});
Check check = checkDao.findById(checkId).get();
......@@ -961,18 +956,13 @@ public class CheckServiceImpl implements ICheckService {
@Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke,String product,String appKey,long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l);
pointShot.forEach(action -> {
// pointImgUrls.add(fileUrl + action.getPhotoData());
pointImgUrls.add(action.getPhotoData());
});
Check check = checkDao.findById(checkId).get();
......
......@@ -164,7 +164,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// private String photoUrlPre;
// @Value("${file.url}")
// private String fileUrl;
@Value("${file.url}")
private String fileServerAddress;
......@@ -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) {
Map<String, Object> map = Maps.newHashMap();
map.put("riskFactorId", riskFactorId);
......
......@@ -272,13 +272,9 @@ public class CheckServiceImpl implements ICheckService {
@Override
public AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
......@@ -356,13 +352,9 @@ public class CheckServiceImpl implements ICheckService {
@Override
public AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, long checkId) {
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) {
// InetAddress address = InetAddress.getLocalHost();
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l, 0l);
......
......@@ -343,15 +343,6 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
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) {
Map<String, Object> map = Maps.newHashMap();
map.put("riskFactorId", riskFactorId);
......
......@@ -42,13 +42,13 @@ public class AmoAVICApplication {
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmoAVICApplication.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);
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -50,12 +50,12 @@ public class AmosCasApplication {
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosCasApplication.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"));
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -40,13 +40,13 @@ public class AmoCCSApplication {
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmoCCSApplication.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);
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -58,20 +58,18 @@ public class AmostEquipApplication {
@Autowired
private CarIotNewListener carIotNewListener;
public static void main(String[] args) throws UnknownHostException {
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"));
ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
}
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
@Bean
@LoadBalanced
......
......@@ -34,7 +34,7 @@ import com.yeejoin.amos.fas.context.IotContext;
/**
*
*
* <pre>
* 服务启动类
* </pre>
......@@ -70,15 +70,14 @@ public class FireAutoSysApplication implements ApplicationContextAware {
logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(FireAutoSysApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
/**
......
......@@ -50,17 +50,18 @@ public class AmosJcsApplication {
ConfigurableApplicationContext context = SpringApplication.run(AmosJcsApplication.class, args);
Environment env = context.getEnvironment();
delKey(env, context);// 添加全部清空redis缓存的方法 2021-09-09
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
GlobalExceptionHandler.setAlwaysOk(true);
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);
logger.info( logs);
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
/**
* 清空redis缓存数据
*
*
* @author 陈浩
* @param env
* @param context
......
......@@ -42,13 +42,13 @@ public class AmoKGDApplication {
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmoKGDApplication.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);
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -39,13 +39,12 @@ public class KnowledgebaseApplication {
ConfigurableApplicationContext context = new SpringApplicationBuilder(KnowledgebaseApplication.class).web(WebApplicationType.SERVLET).run(args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -70,14 +70,13 @@ public class LatentDangerApplication {
logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(LatentDangerApplication.class, args);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
\ No newline at end of file
......@@ -69,14 +69,13 @@ public class MaintenanceApplication {
ConfigurableApplicationContext context = SpringApplication.run(MaintenanceApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
......
......@@ -85,14 +85,13 @@ public class PatrolApplication {
ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
/**
......
......@@ -75,14 +75,13 @@ public class SupervisionApplication {
ConfigurableApplicationContext context = SpringApplication.run(SupervisionApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
@Bean
......
......@@ -50,12 +50,12 @@ public class AmosTdcApplication {
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosTdcApplication.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"));
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -74,18 +74,17 @@ public class AmosTzsApplication {
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmosTzsApplication.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"));
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
+ "Application Amos-Biz-Boot is running!\n\t"
+ "----------------------------------------------------------");
}
/**
* 初始化MQTT
*
*
* @throws MqttException
*/
@Bean
......
......@@ -50,12 +50,12 @@ public class AmosUgpApplication {
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AmosUgpApplication.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"));
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -40,14 +40,9 @@ public class JpushApplication {
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(JpushApplication.class, args);
// GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
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" +
"----------------------------------------------------------");
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running!\n\t"
+ "----------------------------------------------------------");
}
}
\ No newline at end of file
......@@ -41,13 +41,13 @@ public class AmosBootUtilsMessageApplication {
ConfigurableApplicationContext context = SpringApplication.run(AmosBootUtilsMessageApplication.class, args);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
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" +
"----------------------------------------------------------");
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
......@@ -36,16 +36,15 @@ import java.net.UnknownHostException;
public class VideoApplication {
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);
// GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
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" +
"----------------------------------------------------------");
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
+ "----------------------------------------------------------\n"
, appName
);
}
}
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