获取ip地址开关

dep_wangsr
RuoYi 6 years ago committed by Limy
parent fa1fb179dd
commit d45e13696b

@ -1,7 +1,6 @@
package com.ruoyi.common.exception.base; package com.ruoyi.common.exception.base;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.MessageUtils;
/** /**

@ -2,6 +2,7 @@ package com.ruoyi.common.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.config.RuoYiConfig;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -20,6 +21,8 @@ public class AddressUtils
{ {
String address = ""; String address = "";
try try
{
if (RuoYiConfig.isAddressEnabled())
{ {
address = HttpUtils.sendPost(IP_URL, "ip=" + ip); address = HttpUtils.sendPost(IP_URL, "ip=" + ip);
JSONObject json = JSONObject.parseObject(address); JSONObject json = JSONObject.parseObject(address);
@ -28,6 +31,7 @@ public class AddressUtils
String city = object.getString("city"); String city = object.getString("city");
address = region + " " + city; address = region + " " + city;
} }
}
catch (Exception e) catch (Exception e)
{ {
log.error("获取地理位置异常:", e); log.error("获取地理位置异常:", e);

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

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

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

@ -31,7 +31,6 @@ import org.apache.poi.ss.util.CellRangeAddressList;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.util.ResourceUtils; import org.springframework.util.ResourceUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.shiro.web.session.OnlineWebSessionManager; import com.ruoyi.framework.shiro.web.session.OnlineWebSessionManager;
@ -104,7 +103,7 @@ public class ExcelUtil<T>
} }
else else
{ {
// 先设置Cell的类型然后就可以把纯数字作为String类型读进来了 by zhuyangyong 20171228 // 先设置Cell的类型然后就可以把纯数字作为String类型读进来了
row.getCell(j).setCellType(Cell.CELL_TYPE_STRING); row.getCell(j).setCellType(Cell.CELL_TYPE_STRING);
cell = row.getCell(j); cell = row.getCell(j);
} }
@ -351,24 +350,6 @@ public class ExcelUtil<T>
} }
} }
/**
* EXCELA,B,C,D,E0,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;
// }
/** /**
* *
* *

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

@ -4,7 +4,6 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import com.ruoyi.framework.aspectj.lang.constant.DataSourceName; import com.ruoyi.framework.aspectj.lang.constant.DataSourceName;
/** /**

@ -1,5 +1,6 @@
package com.ruoyi.framework.config; package com.ruoyi.framework.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -20,6 +21,8 @@ public class RuoYiConfig
private String copyrightYear; private String copyrightYear;
/** 上传路径 */ /** 上传路径 */
private static String profile; private static String profile;
/** 获取地址开关 */
private static boolean addressEnabled;
public String getName() public String getName()
{ {
@ -61,4 +64,14 @@ public class RuoYiConfig
RuoYiConfig.profile = profile; RuoYiConfig.profile = profile;
} }
public static boolean isAddressEnabled()
{
return addressEnabled;
}
public void setAddressEnabled(boolean addressEnabled)
{
RuoYiConfig.addressEnabled = addressEnabled;
}
} }

@ -17,7 +17,6 @@ import org.apache.shiro.subject.PrincipalCollection;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.exception.user.CaptchaException; import com.ruoyi.common.exception.user.CaptchaException;
import com.ruoyi.common.exception.user.RoleBlockedException; import com.ruoyi.common.exception.user.RoleBlockedException;
import com.ruoyi.common.exception.user.UserBlockedException; import com.ruoyi.common.exception.user.UserBlockedException;

@ -8,7 +8,6 @@ import org.apache.shiro.crypto.hash.Md5Hash;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.exception.user.UserPasswordNotMatchException; import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException;

@ -9,7 +9,6 @@ import org.apache.shiro.web.filter.AccessControlFilter;
import org.apache.shiro.web.util.WebUtils; import org.apache.shiro.web.util.WebUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import com.ruoyi.common.constant.ShiroConstants; import com.ruoyi.common.constant.ShiroConstants;
import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.framework.shiro.session.OnlineSessionDAO; import com.ruoyi.framework.shiro.session.OnlineSessionDAO;

@ -4,7 +4,6 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import org.apache.shiro.web.filter.PathMatchingFilter; import org.apache.shiro.web.filter.PathMatchingFilter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.constant.ShiroConstants; import com.ruoyi.common.constant.ShiroConstants;
import com.ruoyi.framework.shiro.session.OnlineSessionDAO; import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
import com.ruoyi.project.monitor.online.domain.OnlineSession; import com.ruoyi.project.monitor.online.domain.OnlineSession;

@ -1,7 +1,6 @@
package com.ruoyi.project.monitor.job.domain; package com.ruoyi.project.monitor.job.domain;
import java.io.Serializable; import java.io.Serializable;
import com.ruoyi.common.constant.ScheduleConstants; import com.ruoyi.common.constant.ScheduleConstants;
import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity; import com.ruoyi.framework.web.domain.BaseEntity;

@ -1,9 +1,7 @@
package com.ruoyi.project.monitor.job.util; package com.ruoyi.project.monitor.job.util;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;

@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType; import com.ruoyi.framework.aspectj.lang.constant.BusinessType;

@ -1,7 +1,6 @@
package com.ruoyi.project.monitor.operlog.domain; package com.ruoyi.project.monitor.operlog.domain;
import java.util.Date; import java.util.Date;
import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity; import com.ruoyi.framework.web.domain.BaseEntity;

@ -2,7 +2,6 @@ package com.ruoyi.project.system.dept.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.ruoyi.project.system.dept.domain.Dept; import com.ruoyi.project.system.dept.domain.Dept;
/** /**

@ -1,9 +1,7 @@
package com.ruoyi.project.system.dict.mapper; package com.ruoyi.project.system.dict.mapper;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.ruoyi.project.system.dict.domain.DictData; import com.ruoyi.project.system.dict.domain.DictData;
/** /**

@ -3,7 +3,6 @@ package com.ruoyi.project.system.menu.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import com.ruoyi.project.system.menu.domain.Menu; import com.ruoyi.project.system.menu.domain.Menu;
import com.ruoyi.project.system.role.domain.Role; import com.ruoyi.project.system.role.domain.Role;

@ -1,7 +1,6 @@
package com.ruoyi.project.system.post.controller; package com.ruoyi.project.system.post.controller;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -11,7 +10,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.annotation.Log;

@ -1,7 +1,6 @@
package com.ruoyi.project.system.role.domain; package com.ruoyi.project.system.role.domain;
import java.util.Arrays; import java.util.Arrays;
import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity; import com.ruoyi.framework.web.domain.BaseEntity;

@ -3,7 +3,6 @@ package com.ruoyi.project.system.user.domain;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import org.apache.shiro.crypto.SecureRandomNumberGenerator; import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity; import com.ruoyi.framework.web.domain.BaseEntity;
import com.ruoyi.project.system.dept.domain.Dept; import com.ruoyi.project.system.dept.domain.Dept;

@ -1,7 +1,6 @@
package com.ruoyi.project.system.user.mapper; package com.ruoyi.project.system.user.mapper;
import com.ruoyi.project.system.user.domain.User; import com.ruoyi.project.system.user.domain.User;
import java.util.List; import java.util.List;
/** /**

@ -12,7 +12,6 @@ import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity; import org.apache.velocity.app.Velocity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;

@ -2,7 +2,6 @@ package com.ruoyi.project.tool.gen.util;
import java.util.Properties; import java.util.Properties;
import org.apache.velocity.app.Velocity; import org.apache.velocity.app.Velocity;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
/** /**

@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;

@ -8,6 +8,8 @@ ruoyi:
copyrightYear: 2018 copyrightYear: 2018
#头像上传路径 #头像上传路径
profile: D:/profile/ profile: D:/profile/
# 获取ip地址开关
addressEnabled: false
#开发环境配置 #开发环境配置
server: server:
#服务端口 #服务端口
@ -54,7 +56,7 @@ spring:
max-request-size: 30MB max-request-size: 30MB
devtools: devtools:
restart: restart:
#禁用devtools模块的热部署功能 #热部署开关
enabled: true enabled: true
# MyBatis # MyBatis
mybatis: mybatis:

Loading…
Cancel
Save