|  |  | 
 |  |  | package com.ruoyi.web.controller.system; | 
 |  |  |  | 
 |  |  | import com.github.pagehelper.PageInfo; | 
 |  |  | import com.ruoyi.common.annotation.Log; | 
 |  |  | import com.ruoyi.common.constant.HttpStatus; | 
 |  |  | import com.ruoyi.common.constant.UserConstants; | 
 |  |  | import com.ruoyi.common.core.controller.BaseController; | 
 |  |  | import com.ruoyi.common.core.domain.AjaxResult; | 
 |  |  | 
 |  |  | import com.ruoyi.common.core.page.TableDataInfo; | 
 |  |  | import com.ruoyi.common.enums.BusinessType; | 
 |  |  | import com.ruoyi.common.exception.base.BaseException; | 
 |  |  | import com.ruoyi.common.utils.PageUtils; | 
 |  |  | import com.ruoyi.common.utils.SecurityUtils; | 
 |  |  | import com.ruoyi.common.utils.StringUtils; | 
 |  |  | import com.ruoyi.common.utils.poi.ExcelUtil; | 
 |  |  | 
 |  |  | import org.springframework.web.multipart.MultipartFile; | 
 |  |  |  | 
 |  |  | import javax.servlet.http.HttpServletResponse; | 
 |  |  | import java.util.HashMap; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |      */ | 
 |  |  |     //@PreAuthorize("@ss.hasPermi('system:user:list')") | 
 |  |  |     @GetMapping("/list") | 
 |  |  |     public TableDataInfo list(SysUser user) { | 
 |  |  |         startPage(); | 
 |  |  |         List<SysUser> list = userService.selectUserList(user); | 
 |  |  |         return getDataTable(list); | 
 |  |  |     public Map<String, Object> list(SysUser user) { | 
 |  |  |         LoginUser loginUser = getLoginUser(); | 
 |  |  |         String orgid = loginUser.getUser().getOrgid(); | 
 |  |  |         user.setOrgid(orgid); | 
 |  |  |         user.setPageNum(PageUtils.getOffset(user.getPageNum(), user.getPageSize())); | 
 |  |  |         List<SysUser> list = userService.getUserList(user); | 
 |  |  |  | 
 |  |  |         Map<String, Object> rspData = new HashMap(); | 
 |  |  |         rspData.put("code", HttpStatus.SUCCESS); | 
 |  |  |         rspData.put("msg", "查询成功"); | 
 |  |  |         rspData.put("rows", list); | 
 |  |  |  | 
 |  |  |         user.setPageNum(null); | 
 |  |  |         user.setPageSize(null); | 
 |  |  |         List<SysUser> total = userService.getUserList(user); | 
 |  |  |         rspData.put("total", total.size()); | 
 |  |  |  | 
 |  |  |         return rspData; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Log(title = "用户管理", businessType = BusinessType.EXPORT) | 
 |  |  | 
 |  |  |     //@PreAuthorize("@ss.hasPermi('system:user:query')") | 
 |  |  |     @GetMapping("/getInfo/{userId}") | 
 |  |  |     public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { | 
 |  |  |         log.info("--------userId的值为:{}", userId); | 
 |  |  |         userService.checkUserDataScope(userId); | 
 |  |  |         AjaxResult ajax = AjaxResult.success(); | 
 |  |  |         List<SysRole> roles = roleService.selectRoleAll(); | 
 |  |  | 
 |  |  |         SysUserDept sysUserDept = new SysUserDept(); | 
 |  |  |         sysUserDept.setUserId(userId); | 
 |  |  |         sysUserDept.setDeptType("1"); | 
 |  |  |         LoginUser loginUser = getLoginUser(); | 
 |  |  |         SysUser user = loginUser.getUser(); | 
 |  |  |         log.info("--------user的值为:{}", user); | 
 |  |  |         sysUserDept.setOrgid(user.getOrgid()); | 
 |  |  |         sysUserDeptKSs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept); | 
 |  |  |         ajax.put("belongDepts", sysUserDeptKSs); | 
 |  |  |  | 
 |  |  | 
 |  |  |     @Log(title = "用户管理", businessType = BusinessType.GRANT) | 
 |  |  |     @PostMapping("/authRole/insertAuthRole") | 
 |  |  |     public AjaxResult insertAuthRole(@RequestBody AuthRole authRole) { | 
 |  |  |         log.error("-----用户授权角色的入参为:userId={},roleIds={}", authRole.getUserId(), authRole.getRoleIds()); | 
 |  |  |         log.info("-----用户授权角色的入参为:userId={},roleIds={}", authRole.getUserId(), authRole.getRoleIds()); | 
 |  |  |         if (ObjectUtils.isEmpty(authRole.getRoleIds())) { | 
 |  |  |             throw new BaseException("角色为空,请检查之后再次尝试"); | 
 |  |  |         } |