Merge remote-tracking branch 'ruoyi-orgin/master'
This commit is contained in:
@ -12,6 +12,11 @@ public class Constants
|
||||
*/
|
||||
public static final String UTF8 = "UTF-8";
|
||||
|
||||
/**
|
||||
* GBK 字符集
|
||||
*/
|
||||
public static final String GBK = "GBK";
|
||||
|
||||
/**
|
||||
* 通用成功标识
|
||||
*/
|
||||
@ -31,7 +36,7 @@ public class Constants
|
||||
* 注销
|
||||
*/
|
||||
public static final String LOGOUT = "Logout";
|
||||
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
|
@ -19,14 +19,17 @@ public class UserConstants
|
||||
public static final String EXCEPTION = "1";
|
||||
|
||||
/** 用户封禁状态 */
|
||||
public static final String USER_BLOCKED = "1";
|
||||
public static final String USER_DISABLE = "1";
|
||||
|
||||
/** 角色封禁状态 */
|
||||
public static final String ROLE_BLOCKED = "1";
|
||||
public static final String ROLE_DISABLE = "1";
|
||||
|
||||
/** 部门正常状态 */
|
||||
public static final String DEPT_NORMAL = "0";
|
||||
|
||||
/** 部门停用状态 */
|
||||
public static final String DEPT_DISABLE = "1";
|
||||
|
||||
/** 字典正常状态 */
|
||||
public static final String DICT_NORMAL = "0";
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class TableDataInfo implements Serializable
|
||||
private int code;
|
||||
|
||||
/** 消息内容 */
|
||||
private int msg;
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 表格数据对象
|
||||
@ -73,12 +73,12 @@ public class TableDataInfo implements Serializable
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getMsg()
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(int msg)
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
|
@ -2,9 +2,9 @@ package com.ruoyi.common.utils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.config.Global;
|
||||
import com.ruoyi.common.json.JSON;
|
||||
import com.ruoyi.common.json.JSONObject;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
|
||||
/**
|
||||
@ -16,12 +16,15 @@ public class AddressUtils
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(AddressUtils.class);
|
||||
|
||||
public static final String IP_URL = "http://ip.taobao.com/service/getIpInfo.php";
|
||||
// IP地址查询
|
||||
public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp";
|
||||
|
||||
// 未知地址
|
||||
public static final String UNKNOWN = "XX XX";
|
||||
|
||||
public static String getRealAddressByIP(String ip)
|
||||
{
|
||||
String address = "XX XX";
|
||||
|
||||
String address = UNKNOWN;
|
||||
// 内网不查询
|
||||
if (IpUtils.internalIp(ip))
|
||||
{
|
||||
@ -29,24 +32,22 @@ public class AddressUtils
|
||||
}
|
||||
if (Global.isAddressEnabled())
|
||||
{
|
||||
String rspStr = HttpUtils.sendPost(IP_URL, "ip=" + ip);
|
||||
if (StringUtils.isEmpty(rspStr))
|
||||
{
|
||||
log.error("获取地理位置异常 {}", ip);
|
||||
return address;
|
||||
}
|
||||
JSONObject obj;
|
||||
try
|
||||
{
|
||||
obj = JSON.unmarshal(rspStr, JSONObject.class);
|
||||
JSONObject data = obj.getObj("data");
|
||||
String region = data.getStr("region");
|
||||
String city = data.getStr("city");
|
||||
address = region + " " + city;
|
||||
String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK);
|
||||
if (StringUtils.isEmpty(rspStr))
|
||||
{
|
||||
log.error("获取地理位置异常 {}", ip);
|
||||
return UNKNOWN;
|
||||
}
|
||||
JSONObject obj = JSONObject.parseObject(rspStr);
|
||||
String region = obj.getString("pro");
|
||||
String city = obj.getString("city");
|
||||
return String.format("%s %s", region, city);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("获取地理位置异常 {}", ip);
|
||||
log.error("获取地理位置异常 {}", e);
|
||||
}
|
||||
}
|
||||
return address;
|
||||
|
@ -18,6 +18,7 @@ import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
|
||||
/**
|
||||
* 通用http发送方法
|
||||
@ -36,6 +37,19 @@ public class HttpUtils
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url, String param)
|
||||
{
|
||||
return sendGet(url, param, Constants.UTF8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送GET方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @param contentType 编码类型
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url, String param, String contentType)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
BufferedReader in = null;
|
||||
@ -49,7 +63,7 @@ public class HttpUtils
|
||||
connection.setRequestProperty("connection", "Keep-Alive");
|
||||
connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
connection.connect();
|
||||
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ public class ExcelUtil<T>
|
||||
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
|
||||
{
|
||||
Cell cell = heard.getCell(i);
|
||||
if (StringUtils.isNotNull(cell != null))
|
||||
if (StringUtils.isNotNull(cell))
|
||||
{
|
||||
String value = this.getCellValue(heard, i).toString();
|
||||
cellMap.put(value, i);
|
||||
@ -835,7 +835,7 @@ public class ExcelUtil<T>
|
||||
try
|
||||
{
|
||||
Cell cell = row.getCell(column);
|
||||
if (cell != null)
|
||||
if (StringUtils.isNotNull(cell))
|
||||
{
|
||||
if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA)
|
||||
{
|
||||
|
Reference in New Issue
Block a user