mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
uploadFirmware 上传固件接口
This commit is contained in:
@@ -227,6 +227,23 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||||||
return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
|
return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 去除http(s)://开头
|
||||||
|
* @param link
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String removeHttp(String link) {
|
||||||
|
String result;
|
||||||
|
if (StringUtils.startsWith(link, Constants.HTTP)) {
|
||||||
|
result = link.replace(Constants.HTTP, "");
|
||||||
|
} else if (StringUtils.startsWith(link, Constants.HTTPS)) {
|
||||||
|
result = link.replace(Constants.HTTPS, "");
|
||||||
|
} else {
|
||||||
|
result = link;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字符串转set
|
* 字符串转set
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.jsowell.pile.service;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.jsowell.common.constant.CacheConstants;
|
import com.jsowell.common.constant.CacheConstants;
|
||||||
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
@@ -223,7 +224,8 @@ public class PileRemoteService {
|
|||||||
|
|
||||||
String ip;
|
String ip;
|
||||||
try {
|
try {
|
||||||
ip = InetAddress.getByName(serverAddress).getHostAddress();
|
String server = StringUtils.removeHttp(serverAddress);
|
||||||
|
ip = InetAddress.getByName(server).getHostAddress();
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
throw new BusinessException("", "无法解析出IP");
|
throw new BusinessException("", "无法解析出IP");
|
||||||
}
|
}
|
||||||
@@ -238,6 +240,32 @@ public class PileRemoteService {
|
|||||||
ykcPushCommandService.pushUpdateFileCommand(command);
|
ykcPushCommandService.pushUpdateFileCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//获取百度IP地址
|
||||||
|
try {
|
||||||
|
System.out.println("www.baidu.com的地址: "+InetAddress.getByName("www.baidu.com").getHostAddress());
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取百度IP地址
|
||||||
|
try {
|
||||||
|
System.out.println("jsowell的地址: "+InetAddress.getByName("apitest.jsowellcloud.com").getHostAddress());
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
String serverAddress = "http://apitest.jsowellcloud.com";
|
||||||
|
String ip;
|
||||||
|
try {
|
||||||
|
String server = StringUtils.removeHttp(serverAddress);;
|
||||||
|
ip = InetAddress.getByName(server).getHostAddress();
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
throw new BusinessException("", "无法解析出IP");
|
||||||
|
}
|
||||||
|
System.out.println("=====" + ip);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 远程账户余额更新
|
* 远程账户余额更新
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user