From 353131ab2c26859fd285acccbd3a7ff5822de473 Mon Sep 17 00:00:00 2001 From: thinkgem Date: Sat, 23 Dec 2023 23:00:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=A7=A3=E5=86=BB=E7=94=A8=E6=88=B7=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/web/user/EmpUserController.java | 67 ++++++++----------- .../views/modules/sys/user/empUserList.html | 19 ++++-- 2 files changed, 40 insertions(+), 46 deletions(-) diff --git a/modules/core/src/main/java/com/jeesite/modules/sys/web/user/EmpUserController.java b/modules/core/src/main/java/com/jeesite/modules/sys/web/user/EmpUserController.java index 67b21fc4..a5ef3a83 100644 --- a/modules/core/src/main/java/com/jeesite/modules/sys/web/user/EmpUserController.java +++ b/modules/core/src/main/java/com/jeesite/modules/sys/web/user/EmpUserController.java @@ -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())); } /** diff --git a/modules/core/src/main/resources/views/modules/sys/user/empUserList.html b/modules/core/src/main/resources/views/modules/sys/user/empUserList.html index 6d2e73e4..f567464e 100644 --- a/modules/core/src/main/resources/views/modules/sys/user/empUserList.html +++ b/modules/core/src/main/resources/views/modules/sys/user/empUserList.html @@ -70,7 +70,7 @@
<#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"/>
@@ -79,7 +79,7 @@
<#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"/>
@@ -123,7 +123,7 @@