| | |
| | | import com.project.common.utils.SecurityUtils; |
| | | import com.project.common.utils.StringUtils; |
| | | import com.project.common.utils.poi.ExcelUtil; |
| | | import com.project.system.service.ISysDeptService; |
| | | import com.project.system.service.ISysPostService; |
| | | import com.project.system.service.ISysRoleService; |
| | | import com.project.system.service.ISysUserService; |
| | | import com.project.system.domain.bo.editBo.UserDeptBo; |
| | | import com.project.system.domain.vo.SysUserVo; |
| | | import com.project.system.service.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | private final ISysRoleService roleService; |
| | | private final ISysDeptService deptService; |
| | | private final ISysPostService postService; |
| | | private final ISysUserDeptService userDeptService; |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | |
| | | util.exportExcel(response, list, "用户数据"); |
| | | } |
| | | |
| | | |
| | | |
| | | @Log(title = "用户管理", businessType = BusinessType.IMPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:import')") |
| | | @PostMapping("/importData") |
| | |
| | | return success(message); |
| | | } |
| | | |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) |
| | | { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<>(SysUser.class); |
| | | util.importTemplateExcel(response, "用户数据"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据用户编号获取详细信息 |
| | |
| | | return toAjax(userService.resetPwd(user)); |
| | | } |
| | | |
| | | @ApiOperation("用户多机构——回显") |
| | | @GetMapping("/batchUserDeptView") |
| | | public AjaxResult batchUserDeptView(@RequestParam("userId") Long userId) |
| | | { |
| | | return AjaxResult.success(userDeptService.batchUserDeptView(userId)); |
| | | } |
| | | |
| | | @ApiOperation("用户多机构——保存") |
| | | @Log(title = "用户多机构保存", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/batchUserDeptSave") |
| | | public AjaxResult batchUserDeptSave(@RequestBody UserDeptBo bo) |
| | | { |
| | | return AjaxResult.success(userDeptService.batchUserDeptSave(bo)); |
| | | } |
| | | |
| | | @ApiOperation("企业用户重置密码") |
| | | @Log(title = "企业用户重置密码", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/resetCompanyUserPwd") |
| | | public AjaxResult resetCompanyUserPwd(@RequestParam("companyId") Long companyId,@RequestParam("newPassword") String newPassword) |
| | | { |
| | | SysUser user = userService.list(userService.lq().eq(SysUser::getDeptId, companyId)).get(0); |
| | | if (user==null) { |
| | | return AjaxResult.error("没有该企业对应账户"); |
| | | } |
| | | if (userService.resetUserPwd(user.getUserName(), SecurityUtils.encryptPassword(newPassword), newPassword) > 0) |
| | | { |
| | | return success(); |
| | | } |
| | | return error("修改密码异常,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | |
| | | { |
| | | return success(deptService.selectDeptTreeList(dept)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("用户模板下载") |
| | | @GetMapping("/exportTemplate") |
| | | public AjaxResult exportTemplate() |
| | | { |
| | | ExcelUtil<SysUserVo> util = new ExcelUtil<>(SysUserVo.class); |
| | | return util.exportExcel(null, "用户信息模板"); |
| | | } |
| | | |
| | | @ApiOperation(value = "处理导入信息") |
| | | @Log(title = "导入用户信息处理" , businessType = BusinessType.OTHER) |
| | | @ApiImplicitParam(value = "用户信息", name = "file", dataType = "file", dataTypeClass = MultipartFile.class) |
| | | @PostMapping("/doImport") |
| | | public AjaxResult doImport(@RequestPart(value = "file") MultipartFile file, @RequestParam("deptId") Long deptId) throws Exception |
| | | { |
| | | |
| | | ExcelUtil<SysUserVo> util = new ExcelUtil<>(SysUserVo.class); |
| | | List<SysUserVo> list = util.importExcel(file.getInputStream()); |
| | | return AjaxResult.success(userService.doImport(list, deptId)); |
| | | } |
| | | |
| | | // @ApiOperation(value = "校验导入信息") |
| | | // @Log(title = "导入用户信息校验" , businessType = BusinessType.OTHER) |
| | | // @PostMapping("/checkImport") |
| | | // public AjaxResult checkImport(@RequestBody SysCompanyResultVo resultVo) |
| | | // { |
| | | // return AjaxResult.success(userService.checkImport(resultVo)); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "保存导入信息") |
| | | // @Log(title = "导入用户信息保存" , businessType = BusinessType.IMPORT) |
| | | // @PostMapping("/saveImport") |
| | | // public AjaxResult saveImport(@RequestBody SysCompanyResultVo resultVo) |
| | | // { |
| | | // return toAjax(userService.saveImport(resultVo) ? 1 : 0); |
| | | // } |
| | | |
| | | } |