|
@@ -1,25 +1,20 @@
|
|
|
package cn.com.qmth.stmms.ms.admin.api;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import cn.com.qmth.stmms.ms.core.domain.user.MarkRight;
|
|
|
-import cn.com.qmth.stmms.ms.core.repository.MarkTaskRepo;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
import cn.com.qmth.stmms.ms.core.domain.MarkStage;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.MarkSubject;
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.user.MarkRight;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.user.MarkUser;
|
|
|
import cn.com.qmth.stmms.ms.core.domain.user.Role;
|
|
|
import cn.com.qmth.stmms.ms.core.repository.MarkSubjectRepo;
|
|
|
+import cn.com.qmth.stmms.ms.core.repository.MarkTaskRepo;
|
|
|
import cn.com.qmth.stmms.ms.core.repository.MarkUserRepo;
|
|
|
import cn.com.qmth.stmms.ms.core.vo.Subject;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author ting.yin
|
|
@@ -50,14 +45,14 @@ public class UserApi {
|
|
|
|
|
|
@RequestMapping(value = "{domain}", method = RequestMethod.PUT)
|
|
|
public void update(@PathVariable MarkUser domain, @RequestBody MarkUser user) {
|
|
|
- MarkSubject markSubject = markSubjectRepo.findOne(user.getWorkId() + "-" + user.getSubject().toString());
|
|
|
- if(domain.getRole().equals(Role.MARKER)){
|
|
|
- if (user.getWeight()-domain.getWeight()!=0 && !markSubject.getStage().equals(MarkStage.INIT)) {
|
|
|
- throw new RuntimeException("请在分档阶段前修改权重");
|
|
|
- }
|
|
|
- if(!(user.getWeight()>=1)){
|
|
|
- throw new RuntimeException("评卷员权重必须大于1");
|
|
|
- }
|
|
|
+ MarkSubject markSubject = markSubjectRepo.findOne(user.getWorkId() + "-" + user.getSubject().toString());
|
|
|
+ if (domain.getRole().equals(Role.MARKER)) {
|
|
|
+ if (user.getWeight() - domain.getWeight() != 0 && !markSubject.getStage().equals(MarkStage.INIT)) {
|
|
|
+ throw new RuntimeException("请在分档阶段前修改权重");
|
|
|
+ }
|
|
|
+ if (!(user.getWeight() >= 1)) {
|
|
|
+ throw new RuntimeException("评卷员权重必须大于1");
|
|
|
+ }
|
|
|
}
|
|
|
domain.setName(user.getName());
|
|
|
domain.setMarkRight(user.getMarkRight());
|
|
@@ -79,6 +74,9 @@ public class UserApi {
|
|
|
throw new RuntimeException("该登录名已经存在");
|
|
|
}
|
|
|
user.setLoginName(user.getLoginName());
|
|
|
+ if (Objects.equals(user.getRole().name(), Role.MARKER.name())) {
|
|
|
+ user.setOneClickLevel(false);
|
|
|
+ }
|
|
|
markUserRepo.save(user);
|
|
|
}
|
|
|
|