| | |
| | | public TableDataInfo selectConfigList(@RequestParam(value = "pageNum",required = false) Integer pageNum, |
| | | @RequestParam(value = "pageSize",required = false) Integer pageSize, |
| | | @RequestParam(value = "keyword",required = false) String keyword, |
| | | @RequestParam(value = "isDivisionHead",required = false) String isDivisionHead, |
| | | @CurrentUser SysUser sysUser) |
| | | { |
| | | Assert.notNull(pageNum, "pageNum can not be empty"); |
| | | Assert.notNull(pageSize, "pageSize can not be empty"); |
| | | Page<SysUser> pageParam = new Page<>(pageNum,pageSize); |
| | | List<String> ids= PermissionUtil.getPermission(sysUser,iOrganizationChartService); |
| | | List<SysUser> list = IUserService.selectConfigList(pageParam,pageSize,"2",keyword,ids); |
| | | |
| | | int num=IUserService.selectNum("2",keyword,ids); |
| | | List<SysUser> list ; |
| | | int num; |
| | | if (isDivisionHead!=null&&!isDivisionHead.equals("")){ |
| | | list = IUserService.selectConfigList(pageParam,pageSize,"2",keyword,ids,isDivisionHead); |
| | | num=IUserService.selectNum("2",keyword,ids,isDivisionHead); |
| | | } |
| | | else{ |
| | | list = IUserService.selectConfigList(pageParam,pageSize,"2",keyword,ids,null); |
| | | num=IUserService.selectNum("2",keyword,ids,null); |
| | | } |
| | | return getDataTable(list,num); |
| | | } |
| | | |
| | |
| | | @ApiOperation("新增导办用户接口") |
| | | @PostMapping("/add") |
| | | @Authorization |
| | | public ResultData insertConfig(@RequestBody SysUser config) |
| | | public ResultData insertConfig(@RequestBody SysUser config,@CurrentUser SysUser sysUser) |
| | | { |
| | | Assert.notNull(config, "parameter can not be empty"); |
| | | |
| | |
| | | user.setPhonenumber(config.getPhonenumber()); |
| | | user.setLoginName(config.getLoginName()); |
| | | user.setMasterIds(config.getMasterIds()); |
| | | user.setRoleIds("2"); |
| | | //是否是部门领导(1是 2不是) |
| | | if(StringUtils.equals("1",config.getIsDivisionHead())) |
| | | { |
| | | user.setRoleIds("13"); |
| | | if(StringUtils.isEmpty(config.getDataPermission())) { |
| | | user.setDataPermission(config.getMoreDepartmentIds()); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if(StringUtils.isEmpty(config.getDataPermission())) { |
| | | user.setDataPermission(config.getDepartmentId()); |
| | | } |
| | | user.setRoleIds("2"); |
| | | } |
| | | user.setUserType("2"); |
| | | user.setIsDivisionHead("1"); |
| | | user.setIsDivisionHead(config.getIsDivisionHead()); |
| | | user.setStatus(config.getStatus()); |
| | | user.setUpdateTime(LocalDateTime.now()); |
| | | user.setDepartmentIds(config.getDepartmentIds()); |
| | | user.setDepartmentIdStr(config.getDepartmentIdStr()); |
| | | user.setMoreDepartmentIds(config.getMoreDepartmentIds()); |
| | | user.setMattersIds(config.getMattersIds()); |
| | | user.setMasterNames(config.getMasterNames()); |
| | | user.setMattersNames(config.getMattersNames()); |
| | | if (config.getMoreDepartmentIds()!=null&&config.getMoreDepartmentIds().indexOf(",")>0) |
| | | user.setDataPermission(config.getMoreDepartmentIds().substring(config.getMoreDepartmentIds().indexOf(",")+1)); |
| | | //提示用户名或密码错误 |
| | | return toAjax(IUserService.updateConfig(user)); |
| | | } |
| | | config.setRoleIds(2+""); |
| | | //是否是部门领导(1是 2不是) |
| | | if(StringUtils.equals("1",config.getIsDivisionHead())) |
| | | { |
| | | config.setRoleIds("13"); |
| | | if(StringUtils.isEmpty(config.getDataPermission())) { |
| | | config.setDataPermission(config.getMoreDepartmentIds()); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if(StringUtils.isEmpty(config.getDataPermission())) { |
| | | config.setDataPermission(config.getDepartmentId()); |
| | | } |
| | | config.setRoleIds("2"); |
| | | } |
| | | config.setCreateBy(sysUser.getUserId()); |
| | | config.setCreateTime(LocalDateTime.now()); |
| | | config.setUpdateTime(LocalDateTime.now()); |
| | | config.setUserId(Snowflake.getId()+""); |
| | | config.setIsDivisionHead("1"); |
| | | if (config.getMoreDepartmentIds()!=null&&config.getMoreDepartmentIds().indexOf(",")>0) |
| | | config.setDataPermission(config.getMoreDepartmentIds().substring(config.getMoreDepartmentIds().indexOf(",")+1)); |
| | | config.setIsDivisionHead(config.getIsDivisionHead()); |
| | | return toAjax(IUserService.insertConfig(config)); |
| | | } |
| | | |
| | |
| | | |
| | | config.setUserType("2"); |
| | | |
| | | //是否是部门领导(1是 2不是) |
| | | if(StringUtils.equals("1",config.getIsDivisionHead())) |
| | | { |
| | | if (config.getMoreDepartmentIds()!=null&&config.getMoreDepartmentIds().indexOf(",")>0) |
| | | config.setDataPermission(config.getMoreDepartmentIds().substring(config.getMoreDepartmentIds().indexOf(",")+1)); |
| | | else |
| | | { |
| | | config.setDataPermission("0"); |
| | | } |
| | | |
| | | config.setRoleIds("13"); |
| | | } |
| | | else |
| | | { |
| | | if(StringUtils.isEmpty(config.getDataPermission())) { |
| | | config.setDataPermission(config.getDepartmentId()); |
| | | } |
| | | config.setRoleIds("2"); |
| | | } |
| | | |
| | | SysUser user=IUserService.selectData(null,config.getPhonenumber(),null); |
| | | if (user != null && !(user.getUserId().equals(config.getUserId()))) |
| | | { |
| | | //提示用户名或密码错误 |
| | | return ResultData.error("该手机账户已存在!请更换手机号"); |
| | | } |
| | | return toAjax(IUserService.updateConfig(config)); |
| | | } |
| | | |