| | |
| | | import com.gkhy.exam.common.utils.RedisUtils; |
| | | import com.gkhy.exam.common.utils.SecurityUtils; |
| | | import com.gkhy.exam.common.utils.StringUtils; |
| | | import com.gkhy.exam.system.domain.ExStudent; |
| | | import com.gkhy.exam.system.domain.SysUserRole; |
| | | import com.gkhy.exam.system.mapper.SysUserMapper; |
| | | import com.gkhy.exam.system.mapper.SysUserRoleMapper; |
| | | import com.gkhy.exam.system.service.ExStudentService; |
| | | import com.gkhy.exam.system.service.SysConfigService; |
| | | import com.gkhy.exam.system.service.SysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private Validator validator; |
| | | @Autowired |
| | | private SysUserRoleMapper userRoleMapper; |
| | | |
| | | @Autowired |
| | | private ExStudentService exStudentService; |
| | | |
| | | @Override |
| | | public CommonPage<SysUser> selectUserList(SysUser user) { |
| | |
| | | |
| | | @Override |
| | | public int addUser(SysUser user) { |
| | | ExStudent exStudent = new ExStudent(); |
| | | exStudent.setCompanyId(user.getCompanyId()); |
| | | exStudent.setName(user.getName()); |
| | | exStudent.setPassword(user.getPassword()); |
| | | exStudent.setDeptId(user.getDeptId()); |
| | | exStudent.setDuty(user.getDuty()); |
| | | exStudent.setSex(user.getSex()); |
| | | exStudent.setPhone(user.getPhone()); |
| | | checkRequestData(user); |
| | | checkUserAllowed(user); |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | |
| | | sysUserRole.setRoleId(2L); |
| | | userRoleList.add(sysUserRole); |
| | | userRoleMapper.batchUserRole(userRoleList); |
| | | |
| | | exStudentService.insertStudent(exStudent); |
| | | |
| | | if(row<1){ |
| | | throw new ApiException("新增用户失败"); |
| | |
| | | if(userType.equals(UserTypeEnum.OTHER_USER.getCode())){ |
| | | throw new ApiException("没有权限操作或者更新上级用户类型的用户"); |
| | | } |
| | | if(currentUserType.equals(UserTypeEnum.OTHER_USER.getCode())){ |
| | | if(userType<=UserTypeEnum.COMPANY_USER.getCode()){ |
| | | if(currentUserType.equals(UserTypeEnum.OTHER_USER.getCode()) || currentUserType.equals(UserTypeEnum.COMPANY_ADMIN.getCode())){ |
| | | if(userType<=UserTypeEnum.COMPANY_USER.getCode() && !currentUserType.equals(UserTypeEnum.COMPANY_ADMIN.getCode())){ |
| | | throw new ApiException("没有权限操作或者更新上级用户类型的用户"); |
| | | } |
| | | }else{ |