| | |
| | | @Override |
| | | public int insertStudent(ExStudent student) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | student.setCompanyId(currentUser.getCompanyId()); |
| | | if (student.getCompanyId()==null){ |
| | | student.setCompanyId(currentUser.getCompanyId()); |
| | | } |
| | | checkUserAllowed(student); |
| | | if(!checkPhoneUnique(student)){ |
| | | throw new ApiException("手机号已存在"); |
| | |
| | | if(paperStudentList.size()>0){ |
| | | trainRecordVOList.addAll(paperStudentList.stream().map(item -> { |
| | | TrainRecordVO trainRecordVO=new TrainRecordVO(); |
| | | trainRecordVO.setPaperStudentId(item.getId()); |
| | | trainRecordVO.setStudentId(item.getStudentId()); |
| | | trainRecordVO.setTrainType(2); |
| | | trainRecordVO.setPassed(item.getPassed()); |
| | |
| | | public void checkUserAllowed(ExStudent student) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | if(student.getId()!=null){ |
| | | if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){ |
| | | if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) || currentUser.getUserType().equals(UserTypeEnum.COMPANY_ADMIN.getCode())){ |
| | | return; |
| | | } |
| | | if(currentUser.getUserType().equals(UserTypeEnum.STUDENT.getCode()) ){ |
| | |
| | | } |
| | | } |
| | | }else{ |
| | | if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){ |
| | | throw new ApiException("系统管理员没有权限操作"); |
| | | if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) || currentUser.getUserType().equals(UserTypeEnum.COMPANY_ADMIN.getCode())){ |
| | | return; |
| | | } |
| | | if(currentUser.getUserType().equals(UserTypeEnum.STUDENT.getCode())){ |
| | | throw new ApiException("没有权限操作"); |