|
@@ -37,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -79,17 +80,18 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
|
|
|
|
|
|
@Override
|
|
|
public void save(ExamSaveReqDTO reqDTO) {
|
|
|
-
|
|
|
// 从token中获得用户ID
|
|
|
String userId = UserUtils.getUserId(false);
|
|
|
- if (reqDTO.getCreateBy() != null && !reqDTO.getCreateBy().equals(userId)) {
|
|
|
- throw new ServiceException("非创建人不允许修改");
|
|
|
- }
|
|
|
-
|
|
|
- int count = paperService.allProcess(reqDTO.getId());
|
|
|
+ String userName = UserUtils.getUser(false).getUserName();
|
|
|
+ if (!StringUtils.isEmpty(userName) && !userName.toLowerCase().contains("admin")){
|
|
|
+ if (reqDTO.getCreateBy() != null && !reqDTO.getCreateBy().equals(userId)) {
|
|
|
+ throw new ServiceException("非创建人不允许修改");
|
|
|
+ }
|
|
|
|
|
|
- if (count > 0){
|
|
|
- throw new ServiceException("已有人员参加考试,不允许修改试卷");
|
|
|
+ int count = paperService.allProcess(reqDTO.getId());
|
|
|
+ if (count > 0){
|
|
|
+ throw new ServiceException("已有人员参加考试,不允许修改试卷");
|
|
|
+ }
|
|
|
}
|
|
|
// ID
|
|
|
String id = reqDTO.getId();
|