mirror of https://gitee.com/y_project/RuoYi.git
Merge remote-tracking branch 'ruoyi-orgin/master'
commit
0b85032ca8
|
@ -112,6 +112,11 @@ public class SysDeptController extends BaseController
|
||||||
{
|
{
|
||||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
}
|
}
|
||||||
|
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||||
|
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
|
||||||
|
{
|
||||||
|
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||||
|
}
|
||||||
dept.setUpdateBy(ShiroUtils.getLoginName());
|
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(deptService.updateDept(dept));
|
return toAjax(deptService.updateDept(dept));
|
||||||
}
|
}
|
||||||
|
@ -148,11 +153,16 @@ public class SysDeptController extends BaseController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择部门树
|
* 选择部门树
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @param excludeId 排除ID
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectDeptTree/{deptId}")
|
@GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
|
||||||
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
public String selectDeptTree(@PathVariable("deptId") Long deptId,
|
||||||
|
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
|
||||||
{
|
{
|
||||||
mmap.put("dept", deptService.selectDeptById(deptId));
|
mmap.put("dept", deptService.selectDeptById(deptId));
|
||||||
|
mmap.put("excludeId", excludeId);
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +177,19 @@ public class SysDeptController extends BaseController
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载部门列表树(排除下级)
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeData/{excludeId}")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
|
||||||
|
{
|
||||||
|
SysDept dept = new SysDept();
|
||||||
|
dept.setDeptId(excludeId);
|
||||||
|
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载角色部门(数据权限)列表树
|
* 加载角色部门(数据权限)列表树
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -192,7 +192,7 @@ public class SysUserController extends BaseController
|
||||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||||
if (userService.resetUserPwd(user) > 0)
|
if (userService.resetUserPwd(user) > 0)
|
||||||
{
|
{
|
||||||
if (ShiroUtils.getUserId() == user.getUserId())
|
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
|
||||||
{
|
{
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ ruoyi:
|
||||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||||
profile: D:/ruoyi/uploadPath
|
profile: D:/ruoyi/uploadPath
|
||||||
# 获取ip地址开关
|
# 获取ip地址开关
|
||||||
addressEnabled: true
|
addressEnabled: false
|
||||||
|
|
||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -900,6 +900,16 @@ label {
|
||||||
z-index:100;
|
z-index:100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 表格全屏样式 **/
|
||||||
|
.bootstrap-table.fullscreen {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1050;
|
||||||
|
width: 100%!important;
|
||||||
|
background: #FFF;
|
||||||
|
}
|
||||||
|
|
||||||
/** 表格树样式 **/
|
/** 表格树样式 **/
|
||||||
.bootstrap-tree-table .treetable-indent {width:16px; height: 16px; display: inline-block; position: relative;}
|
.bootstrap-tree-table .treetable-indent {width:16px; height: 16px; display: inline-block; position: relative;}
|
||||||
.bootstrap-tree-table .treetable-expander {width:16px; height: 16px; display: inline-block; position: relative; cursor: pointer;}
|
.bootstrap-tree-table .treetable-expander {width:16px; height: 16px; display: inline-block; position: relative; cursor: pointer;}
|
||||||
|
|
|
@ -8,6 +8,7 @@ layer.config({
|
||||||
});
|
});
|
||||||
|
|
||||||
var isMobile = $.common.isMobile() || $(window).width() < 769;
|
var isMobile = $.common.isMobile() || $(window).width() < 769;
|
||||||
|
var sidebarHeight = isMobile ? '100%' : '96%';
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
// MetsiMenu
|
// MetsiMenu
|
||||||
|
@ -15,7 +16,7 @@ $(function() {
|
||||||
|
|
||||||
// 固定菜单栏
|
// 固定菜单栏
|
||||||
$('.sidebar-collapse').slimScroll({
|
$('.sidebar-collapse').slimScroll({
|
||||||
height: '96%',
|
height: sidebarHeight,
|
||||||
railOpacity: 0.9,
|
railOpacity: 0.9,
|
||||||
alwaysVisible: false
|
alwaysVisible: false
|
||||||
});
|
});
|
||||||
|
@ -371,6 +372,7 @@ $(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
scrollToTab($('.menuTab.active'));
|
scrollToTab($('.menuTab.active'));
|
||||||
|
setIframeUrl($('.page-tabs-content').find('.active').attr('data-id'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,6 +430,7 @@ $(function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
$('.page-tabs-content').css("margin-left", "0");
|
$('.page-tabs-content').css("margin-left", "0");
|
||||||
|
setIframeUrl($('.page-tabs-content').find('.active').attr('data-id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关闭全部选项卡
|
// 关闭全部选项卡
|
||||||
|
@ -441,6 +444,7 @@ $(function() {
|
||||||
$(this).addClass("active");
|
$(this).addClass("active");
|
||||||
});
|
});
|
||||||
$('.page-tabs-content').css("margin-left", "0");
|
$('.page-tabs-content').css("margin-left", "0");
|
||||||
|
setIframeUrl($('.page-tabs-content').find('.active').attr('data-id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,13 @@ $(function() {
|
||||||
if (!$(".popover:hover").length) $(_this).popover("hide");
|
if (!$(".popover:hover").length) $(_this).popover("hide");
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 取消回车自动提交表单
|
||||||
|
$(document).on("keypress", ":input:not(textarea):not([type=submit])", function(event) {
|
||||||
|
if (event.keyCode == 13) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// laydate 时间控件绑定
|
// laydate 时间控件绑定
|
||||||
if ($(".select-time").length > 0) {
|
if ($(".select-time").length > 0) {
|
||||||
|
|
|
@ -43,6 +43,7 @@ var table = {
|
||||||
sortName: "",
|
sortName: "",
|
||||||
sortOrder: "asc",
|
sortOrder: "asc",
|
||||||
pagination: true,
|
pagination: true,
|
||||||
|
paginationLoop: false,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
pageList: [10, 25, 50],
|
pageList: [10, 25, 50],
|
||||||
toolbar: "toolbar",
|
toolbar: "toolbar",
|
||||||
|
@ -85,6 +86,7 @@ var table = {
|
||||||
sortName: options.sortName, // 排序列名称
|
sortName: options.sortName, // 排序列名称
|
||||||
sortOrder: options.sortOrder, // 排序方式 asc 或者 desc
|
sortOrder: options.sortOrder, // 排序方式 asc 或者 desc
|
||||||
pagination: options.pagination, // 是否显示分页(*)
|
pagination: options.pagination, // 是否显示分页(*)
|
||||||
|
paginationLoop: options.paginationLoop, // 是否启用分页条无限循环的功能
|
||||||
pageNumber: 1, // 初始化加载第一页,默认第一页
|
pageNumber: 1, // 初始化加载第一页,默认第一页
|
||||||
pageSize: options.pageSize, // 每页的记录行数(*)
|
pageSize: options.pageSize, // 每页的记录行数(*)
|
||||||
pageList: options.pageList, // 可供选择的每页的行数(*)
|
pageList: options.pageList, // 可供选择的每页的行数(*)
|
||||||
|
@ -103,10 +105,12 @@ var table = {
|
||||||
showToggle: options.showToggle, // 是否显示详细视图和列表视图的切换按钮
|
showToggle: options.showToggle, // 是否显示详细视图和列表视图的切换按钮
|
||||||
showExport: options.showExport, // 是否支持导出文件
|
showExport: options.showExport, // 是否支持导出文件
|
||||||
showHeader: options.showHeader, // 是否显示表头
|
showHeader: options.showHeader, // 是否显示表头
|
||||||
|
showFullscreen: options.showFullscreen, // 是否显示全屏按钮
|
||||||
uniqueId: options.uniqueId, // 唯 一的标识符
|
uniqueId: options.uniqueId, // 唯 一的标识符
|
||||||
clickToSelect: options.clickToSelect, // 是否启用点击选中行
|
clickToSelect: options.clickToSelect, // 是否启用点击选中行
|
||||||
singleSelect: options.singleSelect, // 是否单选checkbox
|
singleSelect: options.singleSelect, // 是否单选checkbox
|
||||||
mobileResponsive: options.mobileResponsive, // 是否支持移动端适配
|
mobileResponsive: options.mobileResponsive, // 是否支持移动端适配
|
||||||
|
cardView: options.cardView, // 是否启用显示卡片视图
|
||||||
detailView: options.detailView, // 是否启用显示细节视图
|
detailView: options.detailView, // 是否启用显示细节视图
|
||||||
onClickRow: options.onClickRow, // 点击某行触发的事件
|
onClickRow: options.onClickRow, // 点击某行触发的事件
|
||||||
onDblClickRow: options.onDblClickRow, // 双击某行触发的事件
|
onDblClickRow: options.onDblClickRow, // 双击某行触发的事件
|
||||||
|
@ -286,7 +290,7 @@ var table = {
|
||||||
_value = _value.replace(/\'/g,"'");
|
_value = _value.replace(/\'/g,"'");
|
||||||
_value = _value.replace(/\"/g,""");
|
_value = _value.replace(/\"/g,""");
|
||||||
var actions = [];
|
var actions = [];
|
||||||
actions.push($.common.sprintf('<input id="tooltip-show" style="opacity: 0;position: absolute;z-index:-1" type="text" value="%s"/>', _value));
|
actions.push($.common.sprintf('<input style="opacity: 0;position: absolute;z-index:-1" type="text" value="%s"/>', _value));
|
||||||
actions.push($.common.sprintf('<a href="###" class="tooltip-show" data-toggle="tooltip" data-target="%s" title="%s">%s</a>', _target, _value, _text));
|
actions.push($.common.sprintf('<a href="###" class="tooltip-show" data-toggle="tooltip" data-target="%s" title="%s">%s</a>', _target, _value, _text));
|
||||||
return actions.join('');
|
return actions.join('');
|
||||||
} else {
|
} else {
|
||||||
|
@ -504,6 +508,16 @@ var table = {
|
||||||
hideColumn: function(column, tableId) {
|
hideColumn: function(column, tableId) {
|
||||||
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
|
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
|
||||||
$("#" + currentId).bootstrapTable('hideColumn', column);
|
$("#" + currentId).bootstrapTable('hideColumn', column);
|
||||||
|
},
|
||||||
|
// 显示所有表格列
|
||||||
|
showAllColumns: function(tableId) {
|
||||||
|
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
|
||||||
|
$("#" + currentId).bootstrapTable('showAllColumns');
|
||||||
|
},
|
||||||
|
// 隐藏所有表格列
|
||||||
|
hideAllColumns: function(tableId) {
|
||||||
|
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
|
||||||
|
$("#" + currentId).bootstrapTable('hideAllColumns');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 表格树封装处理
|
// 表格树封装处理
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<script th:src="@{/js/jquery.min.js}"></script>
|
<script th:src="@{/js/jquery.min.js}"></script>
|
||||||
<script th:src="@{/js/bootstrap.min.js}"></script>
|
<script th:src="@{/js/bootstrap.min.js}"></script>
|
||||||
<!-- bootstrap-table 表格插件 -->
|
<!-- bootstrap-table 表格插件 -->
|
||||||
<script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20191219}"></script>
|
<script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200423}"></script>
|
||||||
<script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
|
<script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
|
||||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js}"></script>
|
<script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js}"></script>
|
||||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js}"></script>
|
<script th:src="@{/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js}"></script>
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<ul class="nav" id="side-menu">
|
<ul class="nav" id="side-menu">
|
||||||
<li>
|
<li>
|
||||||
<div class="user-panel">
|
<div class="user-panel">
|
||||||
<a class="menuItem" title="个人中心" th:href="@{/system/user/profile}">
|
<a class="menuItem noactive" title="个人中心" th:href="@{/system/user/profile}">
|
||||||
<div class="hide" th:text="个人中心"></div>
|
<div class="hide" th:text="个人中心"></div>
|
||||||
<div class="pull-left image">
|
<div class="pull-left image">
|
||||||
<img th:src="(${user.avatar} == '') ? @{/img/profile.jpg} : @{${user.avatar}}" class="img-circle" alt="User Image">
|
<img th:src="(${user.avatar} == '') ? @{/img/profile.jpg} : @{${user.avatar}}" class="img-circle" alt="User Image">
|
||||||
|
@ -288,7 +288,9 @@ function switchSkin() {
|
||||||
/** 刷新时访问路径页签 */
|
/** 刷新时访问路径页签 */
|
||||||
function applyPath(url) {
|
function applyPath(url) {
|
||||||
$('a[href$="' + decodeURI(url) + '"]').click();
|
$('a[href$="' + decodeURI(url) + '"]').click();
|
||||||
$('a[href$="' + url + '"]').parent("li").addClass("selected").parents("li :not(.user-panel)").addClass("active").end().parents("ul").addClass("in");
|
if (!$('a[href$="' + url + '"]').hasClass("noactive")) {
|
||||||
|
$('a[href$="' + url + '"]').parent("li").addClass("selected").parents("li").addClass("active").end().parents("ul").addClass("in");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
|
@ -113,11 +113,12 @@
|
||||||
/*部门管理-修改-选择部门树*/
|
/*部门管理-修改-选择部门树*/
|
||||||
function selectDeptTree() {
|
function selectDeptTree() {
|
||||||
var deptId = $("#treeId").val();
|
var deptId = $("#treeId").val();
|
||||||
|
var excludeId = $("input[name='deptId']").val();
|
||||||
if(deptId > 0) {
|
if(deptId > 0) {
|
||||||
var options = {
|
var options = {
|
||||||
title: '部门选择',
|
title: '部门选择',
|
||||||
width: "380",
|
width: "380",
|
||||||
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
|
url: prefix + "/selectDeptTree/" + $("#treeId").val() + "/" + excludeId,
|
||||||
callBack: doSubmit
|
callBack: doSubmit
|
||||||
};
|
};
|
||||||
$.modal.openOptions(options);
|
$.modal.openOptions(options);
|
||||||
|
|
|
@ -28,8 +28,11 @@
|
||||||
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: footer" />
|
||||||
<th:block th:include="include :: ztree-js" />
|
<th:block th:include="include :: ztree-js" />
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
var prefix = ctx + "system/dept"
|
||||||
|
var deptId = [[${deptId}]];
|
||||||
|
var excludeId = [[${excludeId}]];
|
||||||
$(function() {
|
$(function() {
|
||||||
var url = ctx + "system/dept/treeData";
|
var url = $.common.isEmpty(excludeId) ? prefix + "/treeData": prefix + "/treeData/" + excludeId;
|
||||||
var options = {
|
var options = {
|
||||||
url: url,
|
url: url,
|
||||||
expandLevel: 2,
|
expandLevel: 2,
|
||||||
|
|
|
@ -12,6 +12,11 @@ public class Constants
|
||||||
*/
|
*/
|
||||||
public static final String UTF8 = "UTF-8";
|
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";
|
public static final String LOGOUT = "Logout";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册
|
* 注册
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,14 +19,17 @@ public class UserConstants
|
||||||
public static final String EXCEPTION = "1";
|
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_NORMAL = "0";
|
||||||
|
|
||||||
|
/** 部门停用状态 */
|
||||||
|
public static final String DEPT_DISABLE = "1";
|
||||||
|
|
||||||
/** 字典正常状态 */
|
/** 字典正常状态 */
|
||||||
public static final String DICT_NORMAL = "0";
|
public static final String DICT_NORMAL = "0";
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class TableDataInfo implements Serializable
|
||||||
private int code;
|
private int code;
|
||||||
|
|
||||||
/** 消息内容 */
|
/** 消息内容 */
|
||||||
private int msg;
|
private String msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格数据对象
|
* 表格数据对象
|
||||||
|
@ -73,12 +73,12 @@ public class TableDataInfo implements Serializable
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMsg()
|
public String getMsg()
|
||||||
{
|
{
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMsg(int msg)
|
public void setMsg(String msg)
|
||||||
{
|
{
|
||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@ package com.ruoyi.common.utils;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ruoyi.common.config.Global;
|
import com.ruoyi.common.config.Global;
|
||||||
import com.ruoyi.common.json.JSON;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.json.JSONObject;
|
|
||||||
import com.ruoyi.common.utils.http.HttpUtils;
|
import com.ruoyi.common.utils.http.HttpUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,12 +16,15 @@ public class AddressUtils
|
||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(AddressUtils.class);
|
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)
|
public static String getRealAddressByIP(String ip)
|
||||||
{
|
{
|
||||||
String address = "XX XX";
|
String address = UNKNOWN;
|
||||||
|
|
||||||
// 内网不查询
|
// 内网不查询
|
||||||
if (IpUtils.internalIp(ip))
|
if (IpUtils.internalIp(ip))
|
||||||
{
|
{
|
||||||
|
@ -29,24 +32,22 @@ public class AddressUtils
|
||||||
}
|
}
|
||||||
if (Global.isAddressEnabled())
|
if (Global.isAddressEnabled())
|
||||||
{
|
{
|
||||||
String rspStr = HttpUtils.sendPost(IP_URL, "ip=" + ip);
|
|
||||||
if (StringUtils.isEmpty(rspStr))
|
|
||||||
{
|
|
||||||
log.error("获取地理位置异常 {}", ip);
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
JSONObject obj;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
obj = JSON.unmarshal(rspStr, JSONObject.class);
|
String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK);
|
||||||
JSONObject data = obj.getObj("data");
|
if (StringUtils.isEmpty(rspStr))
|
||||||
String region = data.getStr("region");
|
{
|
||||||
String city = data.getStr("city");
|
log.error("获取地理位置异常 {}", ip);
|
||||||
address = region + " " + city;
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.error("获取地理位置异常 {}", ip);
|
log.error("获取地理位置异常 {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return address;
|
return address;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用http发送方法
|
* 通用http发送方法
|
||||||
|
@ -36,6 +37,19 @@ public class HttpUtils
|
||||||
* @return 所代表远程资源的响应结果
|
* @return 所代表远程资源的响应结果
|
||||||
*/
|
*/
|
||||||
public static String sendGet(String url, String param)
|
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();
|
StringBuilder result = new StringBuilder();
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
|
@ -49,7 +63,7 @@ public class HttpUtils
|
||||||
connection.setRequestProperty("connection", "Keep-Alive");
|
connection.setRequestProperty("connection", "Keep-Alive");
|
||||||
connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||||
connection.connect();
|
connection.connect();
|
||||||
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
|
||||||
String line;
|
String line;
|
||||||
while ((line = in.readLine()) != null)
|
while ((line = in.readLine()) != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class ExcelUtil<T>
|
||||||
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
|
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
|
||||||
{
|
{
|
||||||
Cell cell = heard.getCell(i);
|
Cell cell = heard.getCell(i);
|
||||||
if (StringUtils.isNotNull(cell != null))
|
if (StringUtils.isNotNull(cell))
|
||||||
{
|
{
|
||||||
String value = this.getCellValue(heard, i).toString();
|
String value = this.getCellValue(heard, i).toString();
|
||||||
cellMap.put(value, i);
|
cellMap.put(value, i);
|
||||||
|
@ -835,7 +835,7 @@ public class ExcelUtil<T>
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Cell cell = row.getCell(column);
|
Cell cell = row.getCell(column);
|
||||||
if (cell != null)
|
if (StringUtils.isNotNull(cell))
|
||||||
{
|
{
|
||||||
if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA)
|
if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package ${packageName}.domain;
|
package ${packageName}.domain;
|
||||||
|
|
||||||
|
#foreach ($import in $importList)
|
||||||
|
import ${import};
|
||||||
|
#end
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
@ -8,9 +11,6 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
import com.ruoyi.common.core.domain.TreeEntity;
|
import com.ruoyi.common.core.domain.TreeEntity;
|
||||||
#end
|
#end
|
||||||
#foreach ($import in $importList)
|
|
||||||
import ${import};
|
|
||||||
#end
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}对象 ${tableName}
|
* ${functionName}对象 ${tableName}
|
||||||
|
|
|
@ -101,8 +101,17 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询所有子部门
|
* 根据ID查询所有子部门
|
||||||
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 部门列表
|
* @return 部门列表
|
||||||
*/
|
*/
|
||||||
public List<SysDept> selectChildrenDeptById(Long deptId);
|
public List<SysDept> selectChildrenDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询所有子部门(正常状态)
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 子部门数
|
||||||
|
*/
|
||||||
|
public int selectNormalChildrenDeptById(Long deptId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,14 @@ public interface ISysDeptService
|
||||||
*/
|
*/
|
||||||
public List<Ztree> selectDeptTree(SysDept dept);
|
public List<Ztree> selectDeptTree(SysDept dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门管理树(排除下级)
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 所有部门信息
|
||||||
|
*/
|
||||||
|
public List<Ztree> selectDeptTreeExcludeChild(SysDept dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询菜单
|
* 根据角色ID查询菜单
|
||||||
*
|
*
|
||||||
|
@ -84,6 +92,14 @@ public interface ISysDeptService
|
||||||
*/
|
*/
|
||||||
public SysDept selectDeptById(Long deptId);
|
public SysDept selectDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询所有子部门(正常状态)
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 子部门数
|
||||||
|
*/
|
||||||
|
public int selectNormalChildrenDeptById(Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门名称是否唯一
|
* 校验部门名称是否唯一
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
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 org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -54,6 +56,32 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门管理树(排除下级)
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 所有部门信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@DataScope(deptAlias = "d")
|
||||||
|
public List<Ztree> selectDeptTreeExcludeChild(SysDept dept)
|
||||||
|
{
|
||||||
|
Long deptId = dept.getDeptId();
|
||||||
|
List<SysDept> deptList = deptMapper.selectDeptList(dept);
|
||||||
|
Iterator<SysDept> it = deptList.iterator();
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
SysDept d = (SysDept) it.next();
|
||||||
|
if (d.getDeptId().intValue() == deptId
|
||||||
|
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Ztree> ztrees = initZtree(deptList);
|
||||||
|
return ztrees;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询部门(数据权限)
|
* 根据角色ID查询部门(数据权限)
|
||||||
*
|
*
|
||||||
|
@ -251,6 +279,18 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
return deptMapper.selectDeptById(deptId);
|
return deptMapper.selectDeptById(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询所有子部门(正常状态)
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 子部门数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int selectNormalChildrenDeptById(Long deptId)
|
||||||
|
{
|
||||||
|
return deptMapper.selectNormalChildrenDeptById(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门名称是否唯一
|
* 校验部门名称是否唯一
|
||||||
*
|
*
|
||||||
|
|
|
@ -79,6 +79,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
|
||||||
|
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertDept" parameterType="SysDept">
|
<insert id="insertDept" parameterType="SysDept">
|
||||||
insert into sys_dept(
|
insert into sys_dept(
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
|
|
Loading…
Reference in New Issue