瀏覽代碼

美术阅卷10月新增需求-新增科组长是否一键分档和分档比例BUG修复

wangliang 5 年之前
父節點
當前提交
915fe24da9

+ 19 - 21
stmms-ms-admin/src/main/java/cn/com/qmth/stmms/ms/admin/api/UserApi.java

@@ -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);
     }
 

+ 14 - 0
stmms-ms-core/src/main/java/cn/com/qmth/stmms/ms/core/domain/user/MarkUser.java

@@ -38,6 +38,20 @@ public class MarkUser extends AbstractUser {
     
     private Double weight;
 
+    private boolean oneClickLevel;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public boolean getOneClickLevel() {
+        return oneClickLevel;
+    }
+
+    public void setOneClickLevel(boolean oneClickLevel) {
+        this.oneClickLevel = oneClickLevel;
+    }
+
     public MarkUser(String loginName,
                     String password,
                     Long workId,

+ 2 - 0
stmms-ms-core/src/main/java/cn/com/qmth/stmms/ms/core/repository/MarkTaskRepo.java

@@ -43,6 +43,8 @@ public interface MarkTaskRepo extends JpaRepository<MarkTask, Long>, JpaSpecific
 
     int countByQuestionIdAndStageAndResult(Long questionId, MarkStage stage, String result);
 
+    int countByQuestionIdAndMarkerIdAndStageAndResultIsNull(Long questionId, Long markerId, MarkStage stage);
+
     int countByQuestionIdAndMarkerIdAndStageAndResult(Long questionId, Long markerId, MarkStage stage, String result);
 
     int countByWorkIdAndSubjectAndMarkerIdAndStageAndResult(Long workId, Subject subject, Long markerId, MarkStage stage, String result);

+ 11 - 10
stmms-ms-marking/src/main/java/cn/com/qmth/stmms/ms/marking/api/MakrerApi.java

@@ -116,13 +116,14 @@ public class MakrerApi {
         paperRepo.countGroupByLevel(questionId)
                 .forEach(o -> {
                     LevelStatDTO levelStatDTO = levelStatAssembler.toDTO(o);
+                    levelStatDTO.setGcount(levelStatDTO.getCount());
                     if (Objects.isNull(levelStatDTO.getId())) {
                         //求任务数为null的条数
-                        int gcount = markTaskRepo.countByQuestionIdAndStageAndResultIsNull(questionId, MarkStage.LEVEL);
-                        levelStatDTO.setGcount(gcount);
+                        int count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultIsNull(questionId, marker.getId(), MarkStage.LEVEL);
+                        levelStatDTO.setCount(count);
                     } else {
-                        int gcount = markTaskRepo.countByQuestionIdAndStageAndResult(questionId, MarkStage.LEVEL, levelStatDTO.getId().toString());
-                        levelStatDTO.setGcount(gcount);
+                        int count = markTaskRepo.countByQuestionIdAndStageAndResult(questionId, MarkStage.LEVEL, levelStatDTO.getId().toString());
+                        levelStatDTO.setCount(count);
                     }
                     levelStatDTOs.add(levelStatDTO);
                 });
@@ -137,8 +138,8 @@ public class MakrerApi {
                 dto.setPercent(0.0);
 
                 //当前老师当前档位评档次数(所有考试)
-                int gcount = markTaskRepo.countByQuestionIdAndStageAndResult(questionId, MarkStage.LEVEL, level.getCode());
-                dto.setGcount(gcount);
+                int countNew = markTaskRepo.countByQuestionIdAndStageAndResult(questionId, MarkStage.LEVEL, level.getCode());
+                dto.setCount(countNew);
                 levelStatDTOs.add(dto);
             }
         }
@@ -153,17 +154,17 @@ public class MakrerApi {
                 o.setPt(levelMap.get(o.getId()).getPt());
                 o.setKdpt(levelMap.get(o.getId()).getKdpt());
                 o.setCount(Objects.isNull(o.getCount()) ? 0 : o.getCount());
-                double p = (double) o.getCount() / total;
+                double p = (double) o.getCount() / kdtotal;
                 BigDecimal bd = new BigDecimal(p).setScale(3, RoundingMode.HALF_EVEN);
                 o.setPercent(bd.doubleValue());
 
                 o.setGcount(Objects.isNull(o.getGcount()) ? 0 : o.getGcount());
-                double gp = (double) o.getGcount() / kdtotal;
+                double gp = (double) o.getGcount() / total;
                 BigDecimal gbd = new BigDecimal(gp).setScale(3, RoundingMode.HALF_EVEN);
                 o.setGpercent(gbd.doubleValue());
 
-                int gcount = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResult(questionId, marker.getId(), MarkStage.LEVEL, o.getId().toString());
-                o.setGcount(gcount);
+                int count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResult(questionId, marker.getId(), MarkStage.LEVEL, o.getId().toString());
+                o.setCount(count);
             }
         });
         return levelStatDTOs;