用户管理增加解冻用户功能提示

This commit is contained in:
thinkgem
2023-12-23 23:00:30 +08:00
parent acb6baa226
commit 353131ab2c
2 changed files with 40 additions and 46 deletions

View File

@@ -4,29 +4,6 @@
*/
package com.jeesite.modules.sys.web.user;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONValidator;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.collect.ListUtils;
@@ -41,20 +18,28 @@ import com.jeesite.common.shiro.realm.AuthorizingRealm;
import com.jeesite.common.utils.excel.ExcelExport;
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.sys.entity.EmpUser;
import com.jeesite.modules.sys.entity.Employee;
import com.jeesite.modules.sys.entity.Post;
import com.jeesite.modules.sys.entity.Role;
import com.jeesite.modules.sys.entity.User;
import com.jeesite.modules.sys.entity.UserDataScope;
import com.jeesite.modules.sys.service.EmpUserService;
import com.jeesite.modules.sys.service.EmployeeService;
import com.jeesite.modules.sys.service.PostService;
import com.jeesite.modules.sys.service.RoleService;
import com.jeesite.modules.sys.service.UserService;
import com.jeesite.modules.sys.entity.*;
import com.jeesite.modules.sys.service.*;
import com.jeesite.modules.sys.utils.EmpUtils;
import com.jeesite.modules.sys.utils.ModuleUtils;
import com.jeesite.modules.sys.utils.UserUtils;
import io.swagger.annotations.Api;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 员工用户Controller
@@ -279,19 +264,20 @@ public class EmpUserController extends BaseController {
@RequiresPermissions("sys:empUser:updateStatus")
@ResponseBody
@RequestMapping(value = "disable")
public String disable(EmpUser empUser) {
public String disable(EmpUser empUser, boolean freeze) {
if (User.isSuperAdmin(empUser.getUserCode())) {
return renderResult(Global.FALSE, "非法操作,不能够操作此用户!");
}
if (!EmpUser.USER_TYPE_EMPLOYEE.equals(empUser.getUserType())){
return renderResult(Global.FALSE, "非法操作,不能够操作此用户!");
}
String text = freeze ? "冻结" : "停用";
if (empUser.currentUser().getUserCode().equals(empUser.getUserCode())) {
return renderResult(Global.FALSE, text("停用用户失败,不允许停用当前用户"));
return renderResult(Global.FALSE, text(text + "用户失败,不允许" + text + "当前用户"));
}
empUser.setStatus(User.STATUS_DISABLE);
empUser.setStatus(freeze ? User.STATUS_FREEZE : User.STATUS_DISABLE);
empUserService.updateStatus(empUser);
return renderResult(Global.TRUE, text("停用用户''{0}''成功", empUser.getUserName()));
return renderResult(Global.TRUE, text(text + "用户''{0}''成功", empUser.getUserName()));
}
/**
@@ -302,17 +288,18 @@ public class EmpUserController extends BaseController {
@RequiresPermissions("sys:empUser:updateStatus")
@ResponseBody
@RequestMapping(value = "enable")
public String enable(EmpUser empUser) {
public String enable(EmpUser empUser, boolean freeze) {
if (User.isSuperAdmin(empUser.getUserCode())) {
return renderResult(Global.FALSE, "非法操作,不能够操作此用户!");
}
if (!EmpUser.USER_TYPE_EMPLOYEE.equals(empUser.getUserType())){
return renderResult(Global.FALSE, "非法操作,不能够操作此用户!");
}
String text = freeze ? "解冻" : "启用";
empUser.setStatus(User.STATUS_NORMAL);
empUserService.updateStatus(empUser);
AuthorizingRealm.isValidCodeLogin(empUser.getLoginCode(), empUser.getCorpCode_(), null, "success");
return renderResult(Global.TRUE, text("启用用户''{0}''成功", empUser.getUserName()));
return renderResult(Global.TRUE, text(text + "用户''{0}''成功", empUser.getUserName()));
}
/**

View File

@@ -70,7 +70,7 @@
<label class="control-label">${text('机构')}</label>
<div class="control-inline width-90">
<#form:treeselect id="office" title="${text('机构选择')}"
path="employee.office.officeCode" labelPath="employee.office.officeName"
path="employee.office.officeCode" labelPath="employee.office.officeName"
url="${ctx}/sys/office/treeData?ctrlPermi=${ctrlPermi}"
btnClass="btn-sm" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
</div>
@@ -79,7 +79,7 @@
<label class="control-label">${text('公司')}</label>
<div class="control-inline width-90">
<#form:treeselect id="company" title="${text('公司选择')}"
path="employee.company.companyCode" labelPath="employee.company.companyName"
path="employee.company.companyCode" labelPath="employee.company.companyName"
url="${ctx}/sys/company/treeData?ctrlPermi=${ctrlPermi}"
btnClass="btn-sm" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
</div>
@@ -123,7 +123,7 @@
<script>
//# // 初始化DataGrid对象
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
searchForm: $('#searchForm'),
columnModel: [
{header:'${text("登录账号")}', name:'loginCode', index:'a.login_code', width:125, align:"center", frozen:true, fixed:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/sys/empUser/form?userCode='+row.userCode+'&op=edit" class="btnList" data-title="${text("编辑用户")}">'+(val||row.id)+'</a>';
@@ -147,8 +147,10 @@ $('#dataGrid').dataGrid({
//# if(hasPermi('sys:empUser:updateStatus')){
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/sys/empUser/disable?userCode='+row.userCode+'" class="btnList" title="${text("停用用户")}" data-confirm="${text("确认要停用该用户吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
}else if (row.status == Global.STATUS_DISABLE || row.status == Global.STATUS_FREEZE || row.status == Global.STATUS_AUDIT){
}else if (row.status == Global.STATUS_DISABLE || row.status == Global.STATUS_AUDIT){
actions.push('<a href="${ctx}/sys/empUser/enable?userCode='+row.userCode+'" class="btnList" title="${text("启用用户")}" data-confirm="${text("确认要启用该用户吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
}else if (row.status == Global.STATUS_FREEZE){
actions.push('<a href="${ctx}/sys/empUser/enable?userCode='+row.userCode+'&freeze=true" class="btnList" title="${text("解冻用户")}" data-confirm="${text("确认要解冻该用户吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
}
//# }
//# if(hasPermi('sys:empUser:edit')){
@@ -164,7 +166,12 @@ $('#dataGrid').dataGrid({
actions.push('<a href="${ctx}/sys/empUser/formAuthDataScope?userCode='+row.userCode+'" class="btn btn-default btn-xs btnList" title="${text("用户分配数据权限")}"><i class="fa fa-check-circle-o"></i> ${text("数据权限")}</a>&nbsp;');
//# }
//# if(hasPermi('sys:empUser:resetpwd')){
actions.push('<a href="${ctx}/sys/empUser/resetpwd?userCode='+row.userCode+'" class="btn btn-default btn-xs btnList" title="${text("用户密码重置")}" data-confirm="${text("确认要将该用户密码重置到初始状态吗?")}"><i class="fa fa-reply-all"></i> ${text("重置密码")}</a>&nbsp;');
actions.push('<a href="${ctx}/sys/empUser/resetpwd?userCode='+row.userCode+'" class="btn btn-default btn-xs btnList" title="${text("用户密码重置")}" data-confirm="${text("确认要将该用户密码重置到初始状态吗?")}"><i class="fa fa-key"></i> ${text("重置密码")}</a>&nbsp;');
//# }
//# if(hasPermi('sys:empUser:updateStatus')){
// if (row.status == Global.STATUS_NORMAL){
// actions.push('<a href="${ctx}/sys/empUser/disable?userCode='+row.userCode+'&freeze=true" class="btn btn-default btn-xs btnList" title="${text("冻结用户")}" data-confirm="${text("确认要冻结该用户吗?")}"><i class="glyphicon glyphicon-ban-circle"></i> ${text("冻结用户")}</a>&nbsp;');
// }
//# }
actions.push('</div>');
//# }
@@ -174,7 +181,7 @@ $('#dataGrid').dataGrid({
frozenCols: true,
//# // 加载成功后执行事件
ajaxSuccess: function(data){
}
});
$('#btnExport').click(function(){