获取ip地址开关

This commit is contained in:
RuoYi
2018-08-10 14:36:31 +08:00
parent d7dc50a157
commit 07ffcbf6eb
28 changed files with 27 additions and 55 deletions

View File

@ -2,6 +2,7 @@ package com.ruoyi.common.utils;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.config.RuoYiConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -21,12 +22,15 @@ public class AddressUtils
String address = "";
try
{
address = HttpUtils.sendPost(IP_URL, "ip=" + ip);
JSONObject json = JSONObject.parseObject(address);
JSONObject object = json.getObject("data", JSONObject.class);
String region = object.getString("region");
String city = object.getString("city");
address = region + " " + city;
if (RuoYiConfig.isAddressEnabled())
{
address = HttpUtils.sendPost(IP_URL, "ip=" + ip);
JSONObject json = JSONObject.parseObject(address);
JSONObject object = json.getObject("data", JSONObject.class);
String region = object.getString("region");
String city = object.getString("city");
address = region + " " + city;
}
}
catch (Exception e)
{

View File

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
/**

View File

@ -2,9 +2,7 @@ package com.ruoyi.common.utils;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang.text.StrBuilder;
import com.ruoyi.common.support.StrFormatter;
/**

View File

@ -3,7 +3,6 @@ package com.ruoyi.common.utils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.ruoyi.project.system.menu.domain.Menu;
/**

View File

@ -31,7 +31,6 @@ import org.apache.poi.ss.util.CellRangeAddressList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ResourceUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.shiro.web.session.OnlineWebSessionManager;
@ -104,7 +103,7 @@ public class ExcelUtil<T>
}
else
{
// 先设置Cell的类型然后就可以把纯数字作为String类型读进来了 by zhuyangyong 20171228
// 先设置Cell的类型然后就可以把纯数字作为String类型读进来了
row.getCell(j).setCellType(Cell.CELL_TYPE_STRING);
cell = row.getCell(j);
}
@ -351,24 +350,6 @@ public class ExcelUtil<T>
}
}
/**
* 将EXCEL中A,B,C,D,E列映射成0,1,2,3
*
* @param col
*/
// public static int getExcelCol(String col)
// {
// col = col.toUpperCase();
// // 从-1开始计算,字母重1开始运算。这种总数下来算数正好相同。
// int count = -1;
// char[] cs = col.toCharArray();
// for (int i = 0; i < cs.length; i++)
// {
// count += (cs[i] - 64) * Math.pow(26, cs.length - 1 - i);
// }
// return count;
// }
/**
* 设置单元格上提示
*

View File

@ -6,7 +6,6 @@ import org.apache.shiro.session.Session;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.SimplePrincipalCollection;
import org.apache.shiro.subject.Subject;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.framework.shiro.realm.UserRealm;