|
@@ -14,8 +14,11 @@ import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 评卷工作api
|
|
@@ -110,6 +113,14 @@ public class WorkApi {
|
|
|
// throw new RuntimeException("已有分档数据,不可更改");
|
|
|
// }
|
|
|
|
|
|
+ //根据A~Z排序后,重新设置levelValue
|
|
|
+ List<Level> levels = work.getLevels();
|
|
|
+ AtomicInteger ai = new AtomicInteger(0);
|
|
|
+ levels.stream().sorted(Comparator.comparing(Level::getCode)).map(l->{
|
|
|
+ l.setLevelValue(ai.getAndIncrement());
|
|
|
+ return l;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ work.setLevels(levels);
|
|
|
work.setCreatedOn(new Date());
|
|
|
return workRepo.save(work);
|
|
|
}
|