Explorar o código

精度改为共10位,小数点后3位;已上传考生不允许删除;

ting.yin %!s(int64=3) %!d(string=hai) anos
pai
achega
8638555281

+ 1 - 1
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/dao/ExamQuestionDao.java

@@ -88,7 +88,7 @@ public interface ExamQuestionDao extends JpaRepository<ExamQuestion, Integer>, J
     public ExamQuestion findByExamIdAndSubjectCodeAndObjectiveAndMainNumberAndSubNumber(Integer examId,
             String subjectCode, boolean objective, Integer mainNumber, String subNumber);
 
-    @Query(value = "select sum(cast(q.total_score as decimal)) from eb_exam_question q where q.exam_id=?1 and q.subject_code=?2 and q.is_objective=?3 ", nativeQuery = true)
+    @Query(value = "select sum(cast(q.total_score as decimal(10,3))) from eb_exam_question q where q.exam_id=?1 and q.subject_code=?2 and q.is_objective=?3 ", nativeQuery = true)
     public Double sumTotalScore(int examId, String subjectCode, boolean objective);
 
     @Modifying

+ 11 - 14
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/dao/ExamStudentDao.java

@@ -11,8 +11,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 import java.util.Date;
 import java.util.List;
 
-public interface ExamStudentDao
-        extends PagingAndSortingRepository<ExamStudent, Integer>, JpaSpecificationExecutor<ExamStudent> {
+public interface ExamStudentDao extends PagingAndSortingRepository<ExamStudent, Integer>,
+        JpaSpecificationExecutor<ExamStudent> {
 
     public List<ExamStudent> findByExamId(int examId, Pageable pageable);
 
@@ -70,8 +70,8 @@ public interface ExamStudentDao
 
     @Modifying
     @Query("update ExamStudent s set s.subjectiveStatus=?3, s.subjectiveScore=?4, s.subjectiveScoreList=?5,s.inspectTime=?6,s.inspectorId=?7 where s.examId=?1 and s.subjectCode=?2")
-    public void updateSubjectiveStatusAndScore(Integer examId, String subjetCode, SubjectiveStatus status, double score,
-            String scoreList, Date inspectTime, Integer inspectorId);
+    public void updateSubjectiveStatusAndScore(Integer examId, String subjetCode, SubjectiveStatus status,
+            double score, String scoreList, Date inspectTime, Integer inspectorId);
 
     @Modifying
     @Query("update ExamStudent s set s.subjectiveStatus=?3, s.subjectiveScore=?4, s.subjectiveScoreList=?5 "
@@ -143,8 +143,7 @@ public interface ExamStudentDao
 
     @Query("select s from ExamStudent s where s.examId=?1 and s.subjectCode=?2 and s.upload=true and s.absent=false and s.breach=false and s.uploadTime!=null "
             + "and not exists (select l.id from MarkLibrary l where l.studentId=s.id and l.groupNumber=?3)")
-    public List<ExamStudent> findUnLibraryStudent(Integer examId, String subjectCode, Integer groupNumber,
-            Pageable page);
+    public List<ExamStudent> findUnLibraryStudent(Integer examId, String subjectCode, Integer groupNumber, Pageable page);
 
     @Query("select s from ExamStudent s where s.examId=?1 and s.subjectCode=?2 and s.upload=true and s.absent=false and s.breach=false and s.uploadTime!=null and s.uploadTime>=?4 "
             + "and not exists (select l.id from MarkLibrary l where l.studentId=s.id and l.groupNumber=?3)")
@@ -171,18 +170,17 @@ public interface ExamStudentDao
     @Query("select s.className from ExamStudent s where s.examId=?1 and s.subjectCode=?2 group by s.className")
     public List<String> findDistinctClassName(Integer examId, String subjectCode);
 
-    @Query(value = "select cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) from eb_exam_student s where s.exam_id=?1 and s.subject_code=?2 and s.is_upload =true and s.is_absent=false and s.is_breach=false order by cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) desc limit ?3 ", nativeQuery = true)
-    public List<Double> findHighCountTotalSocreByExamIdAndSubjectCode(Integer examId, String subjectCode,
-            int highCount);
+    @Query(value = "select cast(s.objective_score as decimal(10,3))+cast(s.subjective_score as decimal(10,3)) from eb_exam_student s where s.exam_id=?1 and s.subject_code=?2 and s.is_upload =true and s.is_absent=false and s.is_breach=false order by cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) desc limit ?3 ", nativeQuery = true)
+    public List<Double> findHighCountTotalSocreByExamIdAndSubjectCode(Integer examId, String subjectCode, int highCount);
 
-    @Query(value = "select cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) from eb_exam_student s where s.exam_id=?1 and s.subject_code=?2 and s.is_upload =true and s.is_absent=false and s.is_breach=false order by cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) asc limit ?3 ", nativeQuery = true)
+    @Query(value = "select cast(s.objective_score as decimal(10,3))+cast(s.subjective_score as decimal(10,3)) from eb_exam_student s where s.exam_id=?1 and s.subject_code=?2 and s.is_upload =true and s.is_absent=false and s.is_breach=false order by cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) asc limit ?3 ", nativeQuery = true)
     public List<Double> findLowCountTotalSocreByExamIdAndSubjectCode(Integer examId, String subjectCode, int lowCount);
 
-    @Query(value = "select cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) from eb_exam_student s where s.exam_id=?1 and s.subject_code=?2 and s.class_name=?3 and s.is_upload =true and s.is_absent=false and s.is_breach=false order by cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) desc limit ?4 ", nativeQuery = true)
+    @Query(value = "select cast(s.objective_score as decimal(10,3))+cast(s.subjective_score as decimal(10,3)) from eb_exam_student s where s.exam_id=?1 and s.subject_code=?2 and s.class_name=?3 and s.is_upload =true and s.is_absent=false and s.is_breach=false order by cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) desc limit ?4 ", nativeQuery = true)
     public List<Double> findHighCountTotalSocreByExamIdAndSubjectCodeAndClass(Integer examId, String subjectCode,
             String className, int highCount);
 
-    @Query(value = "select cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) from eb_exam_student s where s.exam_id=?1 and s.subject_code=?2 and s.class_name=?3 and s.is_upload =true and s.is_absent=false and s.is_breach=false order by cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) asc limit ?4 ", nativeQuery = true)
+    @Query(value = "select cast(s.objective_score as decimal(10,3))+cast(s.subjective_score as decimal(10,3)) from eb_exam_student s where s.exam_id=?1 and s.subject_code=?2 and s.class_name=?3 and s.is_upload =true and s.is_absent=false and s.is_breach=false order by cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) asc limit ?4 ", nativeQuery = true)
     public List<Double> findLowCountTotalSocreByExamIdAndSubjectCodeAndClass(Integer examId, String subjectCode,
             String className, int lowCount);
 
@@ -194,7 +192,6 @@ public interface ExamStudentDao
     public void updateSubjectiveStatusAndTimeAndInspectorId(Integer studentId, SubjectiveStatus status,
             Date inspectTime, Integer inspectorId);
 
-    public List<ExamStudent> findByExamIdAndStudentCodeAndSubjectCode(int examId, String studentCode,
-            String subjectCode);
+    public List<ExamStudent> findByExamIdAndStudentCodeAndSubjectCode(int examId, String studentCode, String subjectCode);
 
 }

+ 4 - 4
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/dao/ExamSubjectDao.java

@@ -10,8 +10,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 import java.util.List;
 import java.util.Set;
 
-public interface ExamSubjectDao
-        extends PagingAndSortingRepository<ExamSubject, ExamSubjectPK>, JpaSpecificationExecutor<ExamSubject> {
+public interface ExamSubjectDao extends PagingAndSortingRepository<ExamSubject, ExamSubjectPK>,
+        JpaSpecificationExecutor<ExamSubject> {
 
     @Query("select s from ExamSubject s where s.pk.examId=?1")
     public List<ExamSubject> findByExamId(int examId);
@@ -35,11 +35,11 @@ public interface ExamSubjectDao
     public List<ExamSubject> findByExamIdAndUploadCountGt(int examId, int uploadCount);
 
     @Modifying
-    @Query(value = "update eb_exam_subject s set s.total_score=cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) where s.exam_id=?1", nativeQuery = true)
+    @Query(value = "update eb_exam_subject s set s.total_score=cast(s.objective_score as decimal(10,3))+cast(s.subjective_score as decimal(10,3)) where s.exam_id=?1", nativeQuery = true)
     public void updateTotalScoreByExamId(int examId);
 
     @Modifying
-    @Query(value = "update eb_exam_subject s set s.total_score=cast(s.objective_score as decimal)+cast(s.subjective_score as decimal) where s.exam_id=?1 and s.code=?2", nativeQuery = true)
+    @Query(value = "update eb_exam_subject s set s.total_score=cast(s.objective_score as decimal(10,3))+cast(s.subjective_score as decimal(10,3)) where s.exam_id=?1 and s.code=?2", nativeQuery = true)
     public void updateTotalScoreByExamIdAndCode(int examId, String code);
 
     @Modifying

+ 3 - 3
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/service/impl/InspectedServiceImpl.java

@@ -85,10 +85,10 @@ public class InspectedServiceImpl extends BaseQueryService<ExamStudent> implemen
             whereSql.append(" and s.subjective_status IN ('MARKED','INSPECTED')");
         }
         if (query.getStartScore() != null) {
-            whereSql.append(" and (cast(s.objective_score as decimal)+cast(s.subjective_score as decimal)) >= :startScore");
+            whereSql.append(" and (cast(s.objective_score as decimal(10,3))+cast(s.subjective_score as decimal(10,3))) >= :startScore");
         }
         if (query.getEndScore() != null) {
-            whereSql.append(" and (cast(s.objective_score as decimal)+cast(s.subjective_score as decimal)) <= :endScore");
+            whereSql.append(" and (cast(s.objective_score as decimal(10,3))+cast(s.subjective_score as decimal(10,3))) <= :endScore");
         }
         if (StringUtils.isNotBlank(query.getSecretNumber())) {
             whereSql.append(" and s.secret_number = :secretNumber");
@@ -121,7 +121,7 @@ public class InspectedServiceImpl extends BaseQueryService<ExamStudent> implemen
         // 选做题多选做
         if (selectiveStatus != null && SelectiveStatus.MUTI_SELECTIVE.equals(selectiveStatus) && !groups.isEmpty()
                 && !selectiveGroups.isEmpty()) {
-            whereSql.append(" and (select count(distinct ss.group_number) from eb_subjective_score ss where ss.student_id = s.id and e.group_number in (:groupNumbers) and e.group_score = -1 )< :unSelectiveCount ");
+            whereSql.append(" and (select count(distinct ss.group_number) from eb_subjective_score ss where ss.student_id = s.id and ss.group_number in (:groupNumbers) and ss.group_score = -1 )< :unSelectiveCount ");
         }
         dataSql.append(whereSql);
         StringBuilder orderSql = new StringBuilder(" order by s.inspect_time desc ");

+ 2 - 2
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/paperDetail.jsp

@@ -49,8 +49,8 @@
 				<td>${question.mainTitle}</td>
 				<td>${question.mainNumber}</td>
 				<td>${question.subNumber}</td>
-				<td><fmt:formatNumber pattern="###.#" value="${question.totalScore}"/></td>
-				<td><fmt:formatNumber pattern="###.#" value="${question.intervalScore}"/></td>
+				<td><fmt:formatNumber pattern="###.###" value="${question.totalScore}"/></td>
+				<td><fmt:formatNumber pattern="###.###" value="${question.intervalScore}"/></td>
 				<td>${question.answer}</td>
 				<td>
 					<c:if test="${question.objective}">

+ 3 - 3
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/paperList.jsp

@@ -155,9 +155,9 @@
                 <c:if test="${subject.cardType == 'JSON'}">电子题卡</c:if>
                 <c:if test="${subject.cardType == 'ZIP'}">扫描题卡</c:if>
             </td>
-            <td>${subject.objectiveScore}</td>
-            <td>${subject.subjectiveScore}</td>
-            <td>${subject.totalScore}</td>
+            <td><fmt:formatNumber pattern="###.###" value="${subject.objectiveScore}"/></td>
+            <td><fmt:formatNumber pattern="###.###" value="${subject.subjectiveScore}"/></td>
+            <td><fmt:formatNumber pattern="###.###" value="${subject.totalScore}"/></td>
             <td>
                 <c:if test="${examLock || subject.locked}">正在计算</c:if>
                 <c:if test="${!examLock && !subject.locked}">正常</c:if>

+ 3 - 3
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/selectiveList.jsp

@@ -13,9 +13,9 @@
 		<input name="subjectCode" value="${subject.code}" type="hidden"/>
 		<div>
 			<label>科目:${subject.code}-${subject.name}</label>
-			<label>客观总分:${subject.objectiveScore}</label>
-			<label>主观总分:${subject.subjectiveScore}</label>
-			<label>试卷总分:${subject.totalScore}</label>
+			<label>客观总分:<fmt:formatNumber pattern="###.###" value="${subject.objectiveScore}"/></label>
+			<label>主观总分:<fmt:formatNumber pattern="###.###" value="${subject.subjectiveScore}"/></label>
+			<label>试卷总分:<fmt:formatNumber pattern="###.###" value="${subject.totalScore}"/></label>
 			&nbsp;		
 			<a class="btn" href="${ctx}/admin/exam/paper">返回</a>
 			&nbsp;

+ 1 - 1
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/studentList.jsp

@@ -211,7 +211,7 @@
             <td>
                 <c:if test="${web_user.schoolAdmin==true}">
                     <a href="${ctx}/admin/exam/student/update?id=${student.id}">修改</a>
-                    <c:if test="${examType!='MULTI_MEDIA'}">
+                    <c:if test="${examType!='MULTI_MEDIA' && student.upload==false}">
                         &nbsp;
                         <a href="${ctx}/admin/exam/student/delete?id=${student.id}" onclick="return confirmx('确认要删除该考生吗?', this.href)">删除</a>
                     </c:if>