multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamPaperServiceImpl.java
@@ -212,7 +212,7 @@ }else{//顺序分配 int totalPage=totalQuestionCount/questionCount;//不能整除,忽略最后一页 Random random=new Random(); int startIndex=random.nextInt(totalPage)+1; int startIndex=random.nextInt(totalPage); questions=questionMapper.selectQuestionWithLimit(currentUser.getCompanyId(), bankId,questionTypeEnum.getCode(),startIndex, questionCount); } List<ExPaperQuestion> paperQuestionList=questions.stream().map(item -> { @@ -249,19 +249,19 @@ throw new ApiException("更新试卷失败"); } //重新分配题 if(examPaper.getSingleRebuild()==1){ if(examPaper.getSingleNum()!=null && examPaper.getSingleRebuild()==1 && examPaper.getSingleNum()>0 ){ deletePaperQuestion(examPaper.getId(),QuestionTypeEnum.SINGLE); assignSingleQuestion(examPaper); } if(examPaper.getMultiRebuild()==1) { if( examPaper.getMultiNum()!=null && examPaper.getMultiRebuild()==1 && examPaper.getMultiNum()>0) { deletePaperQuestion(examPaper.getId(),QuestionTypeEnum.MULTI); assignMultiQuestion(examPaper); } if(examPaper.getJudgeRebuild()==1) { if(examPaper.getJudgeNum()!=null && examPaper.getJudgeRebuild()==1 && examPaper.getJudgeNum()>0) { deletePaperQuestion(examPaper.getId(),QuestionTypeEnum.JUDGE); assignJudgeQuestion(examPaper); } if(examPaper.getEasyRebuild()==1) { if(examPaper.getEasyNum()!=null && examPaper.getEasyRebuild()==1 && examPaper.getEasyNum()>0) { deletePaperQuestion(examPaper.getId(),QuestionTypeEnum.EASY); assignEasyQuestion(examPaper); } multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentServiceImpl.java
@@ -118,7 +118,9 @@ @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("手机号已存在"); @@ -332,7 +334,7 @@ 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()) ){ @@ -343,8 +345,8 @@ } } }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("没有权限操作"); multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditEvaluateServiceImpl.java
@@ -4,6 +4,7 @@ import com.gkhy.exam.common.api.CommonPage; import com.gkhy.exam.common.api.CommonResult; import com.gkhy.exam.common.domain.entity.SysUser; import com.gkhy.exam.common.enums.UserTypeEnum; import com.gkhy.exam.common.exception.ApiException; import com.gkhy.exam.common.utils.PageUtils; import com.gkhy.exam.common.utils.SecurityUtils; @@ -45,12 +46,14 @@ @Override public CommonResult insertEvaluate(InternalAuditEvaluate evaluate) { SysUser user = SecurityUtils.getLoginUser().getUser(); if (!user.getUserType().equals(0)&&!user.getUserType().equals(1)){ if (!user.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())&&!user.getUserType().equals(UserTypeEnum.COMPANY_USER.getCode())&&!user.getUserType().equals(UserTypeEnum.COMPANY_ADMIN.getCode())){ throw new ApiException("普通用户无法添加相关数据"); } ExStudent exStudent = exStudentMapper.selectStudentById(Long.valueOf(evaluate.getPersonId())); if (user.getDeptId().equals(exStudent.getDeptId())){ throw new ApiException("请勿选择本部门成员"); if ( user.getDeptId()!=null){ if ( user.getDeptId().equals(exStudent.getDeptId())) { throw new ApiException("请勿选择本部门成员"); } } evaluate.setCreateBy(SecurityUtils.getUsername()); evaluate.setCreateTime(LocalDateTime.now()); multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysUserServiceImpl.java
@@ -23,6 +23,7 @@ import com.gkhy.exam.system.service.SysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.validation.Validator; import java.util.ArrayList; @@ -137,6 +138,7 @@ } @Override @Transactional(rollbackFor = RuntimeException.class) public int addUser(SysUser user) { ExStudent exStudent = new ExStudent(); exStudent.setCompanyId(user.getCompanyId());