Browse Source

科目新增及格分和优秀分;增加用户与班级绑定;

ting.yin 4 năm trước cách đây
mục cha
commit
15e0ab1303

+ 19 - 22
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/model/Exam.java

@@ -6,6 +6,11 @@ import cn.com.qmth.stmms.common.enums.ExamStatus;
 import cn.com.qmth.stmms.common.enums.ExamType;
 
 import javax.persistence.*;
+
+import net.sf.json.JSONObject;
+
+import org.apache.commons.lang3.StringUtils;
+
 import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
@@ -63,18 +68,6 @@ public class Exam implements Serializable {
     @Column(name = "creator_id", nullable = true)
     private Integer creatorId;
 
-    /**
-     * 及格分数
-     */
-    @Column(name = "pass_score")
-    private Double passScore;
-
-    /**
-     * 优秀分数
-     */
-    @Column(name = "excellent_score")
-    private Double excellentScore;
-
     /**
      * 统计配置
      */
@@ -194,19 +187,23 @@ public class Exam implements Serializable {
     }
 
     public Double getPassScore() {
-        return passScore;
-    }
-
-    public void setPassScore(Double passScore) {
-        this.passScore = passScore;
+        String text = StringUtils.trimToEmpty(sasConfig);
+        if (StringUtils.isNotBlank(text)) {
+            JSONObject jsonObject = JSONObject.fromObject(text);
+            Double passScore = jsonObject.getDouble("passScore");
+            return passScore;
+        }
+        return null;
     }
 
     public Double getExcellentScore() {
-        return excellentScore;
-    }
-
-    public void setExcellentScore(Double excellentScore) {
-        this.excellentScore = excellentScore;
+        String text = StringUtils.trimToEmpty(sasConfig);
+        if (StringUtils.isNotBlank(text)) {
+            JSONObject jsonObject = JSONObject.fromObject(text);
+            Double excellentScore = jsonObject.getDouble("excellentScore");
+            return excellentScore;
+        }
+        return null;
     }
 
     public String getSasConfig() {

+ 37 - 0
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/model/ExamSubject.java

@@ -3,9 +3,12 @@ package cn.com.qmth.stmms.biz.exam.model;
 import cn.com.qmth.stmms.biz.file.enums.FormatType;
 import cn.com.qmth.stmms.biz.file.service.FileService;
 import cn.com.qmth.stmms.biz.mark.model.PictureConfigItem;
+import net.sf.json.JSONObject;
+
 import org.apache.commons.lang.StringUtils;
 
 import javax.persistence.*;
+
 import java.io.Serializable;
 import java.util.List;
 
@@ -90,6 +93,12 @@ public class ExamSubject implements Serializable {
     @Column(name = "answer_file_type", length = 16, nullable = true)
     private FormatType answerFileType;
 
+    /**
+     * 统计配置
+     */
+    @Column(name = "sas_config", nullable = true)
+    private String sasConfig;
+
     /**
      * 大题数量
      */
@@ -299,4 +308,32 @@ public class ExamSubject implements Serializable {
             answerUrl = fileService.getAnswerUri(getExamId(), getCode(), answerFileType);
         }
     }
+
+    public String getSasConfig() {
+        return sasConfig;
+    }
+
+    public void setSasConfig(String sasConfig) {
+        this.sasConfig = sasConfig;
+    }
+
+    public Double getPassScore() {
+        String text = StringUtils.trimToEmpty(sasConfig);
+        if (StringUtils.isNotBlank(text)) {
+            JSONObject jsonObject = JSONObject.fromObject(text);
+            Double passScore = jsonObject.getDouble("passScore");
+            return passScore;
+        }
+        return null;
+    }
+
+    public Double getExcellentScore() {
+        String text = StringUtils.trimToEmpty(sasConfig);
+        if (StringUtils.isNotBlank(text)) {
+            JSONObject jsonObject = JSONObject.fromObject(text);
+            Double excellentScore = jsonObject.getDouble("excellentScore");
+            return excellentScore;
+        }
+        return null;
+    }
 }

+ 14 - 0
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/mark/model/TrialHistory.java

@@ -68,6 +68,12 @@ public class TrialHistory implements Serializable {
     @Column(name = "marker_score_list")
     private String markerScoreList;
 
+    /**
+     * 考生密号
+     */
+    @Column(name = "secret_number")
+    private String secretNumber;
+
     @Transient
     private Marker marker;
 
@@ -155,4 +161,12 @@ public class TrialHistory implements Serializable {
         this.marker = marker;
     }
 
+    public String getSecretNumber() {
+        return secretNumber;
+    }
+
+    public void setSecretNumber(String secretNumber) {
+        this.secretNumber = secretNumber;
+    }
+
 }

+ 8 - 2
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/report/utils/ReportContext.java

@@ -131,11 +131,17 @@ public class ReportContext {
     }
 
     public Double getPassScore() {
-        return exam.getPassScore();
+        if (exam.getPassScore() != null) {
+            return exam.getPassScore();
+        }
+        return sasConfigItem.getPassScore();
     }
 
     public Double getExcellentScore() {
-        return exam.getExcellentScore();
+        if (exam.getExcellentScore() != null) {
+            return exam.getExcellentScore();
+        }
+        return sasConfigItem.getExcellentScore();
     }
 
     public double getRangeInterval() {

+ 17 - 4
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/ExamController.java

@@ -22,7 +22,9 @@ import cn.com.qmth.stmms.common.enums.LogType;
 import cn.com.qmth.stmms.common.enums.Role;
 import cn.com.qmth.stmms.common.utils.RequestUtils;
 import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
 import net.sf.json.JsonConfig;
+
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
@@ -37,6 +39,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
 import javax.servlet.http.HttpServletRequest;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -94,13 +97,16 @@ public class ExamController extends BaseExamController {
         model.addAttribute("exam", exam);
         model.addAttribute("statusList", ExamStatus.values());
         model.addAttribute("pictureConfig", buildPictureConfig(exam.getSheetConfig()));
+        model.addAttribute("passScore", exam.getPassScore());
+        model.addAttribute("excellentScore", exam.getExcellentScore());
         return "modules/exam/examEdit";
     }
 
     @Logging(menu = "创建考试", type = LogType.ADD)
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @RoleRequire(Role.SCHOOL_ADMIN)
-    public String save(HttpServletRequest request, Exam exam, RedirectAttributes redirectAttributes) {
+    public String save(HttpServletRequest request, Exam exam, @RequestParam(required = false) Double passScore,
+            @RequestParam(required = false) Double excellentScore, RedirectAttributes redirectAttributes) {
         User user = RequestUtils.getWebUser(request).getUser();
         exam.setSchoolId(user.getSchoolId());
         exam.setCreatorId(user.getId());
@@ -108,6 +114,10 @@ public class ExamController extends BaseExamController {
         if (exam.getType().equals(ExamType.MULTI_MEDIA)) {
             exam.setForceSpecialTag(false);
         }
+        JSONObject sasConfig = new JSONObject();
+        sasConfig.accumulate("passScore", passScore);
+        sasConfig.accumulate("excellentScore", excellentScore);
+        exam.setSasConfig(sasConfig.toString());
         exam = examService.save(exam);
         addMessage(redirectAttributes, "创建考试'" + exam.getName() + "'成功");
         return "redirect:/admin/exam/list";
@@ -117,7 +127,8 @@ public class ExamController extends BaseExamController {
     @SuppressWarnings("unchecked")
     @RequestMapping(value = "/edit", method = RequestMethod.POST)
     @RoleRequire(Role.SCHOOL_ADMIN)
-    public String edit(HttpServletRequest request, Exam exam, @RequestParam(required = false) String picList) {
+    public String edit(HttpServletRequest request, Exam exam, @RequestParam(required = false) String picList,
+            @RequestParam(required = false) Double passScore, @RequestParam(required = false) Double excellentScore) {
         User user = RequestUtils.getWebUser(request).getUser();
         Exam oldExam = examService.findById(exam.getId());
         if (oldExam != null && oldExam.getSchoolId().equals(user.getSchoolId())) {
@@ -126,8 +137,10 @@ public class ExamController extends BaseExamController {
             oldExam.setDescription(exam.getDescription());
             oldExam.setStatus(exam.getStatus());
             oldExam.setForceSpecialTag(exam.isForceSpecialTag());
-            oldExam.setPassScore(exam.getPassScore());
-            oldExam.setExcellentScore(exam.getExcellentScore());
+            JSONObject sasConfig = new JSONObject();
+            sasConfig.accumulate("passScore", passScore);
+            sasConfig.accumulate("excellentScore", excellentScore);
+            oldExam.setSasConfig(sasConfig.toString());
             if (StringUtils.isNotBlank(picList)) {
                 String sheetConfig = StringEscapeUtils.unescapeHtml(picList);
                 JSONArray array = JSONArray.fromObject(sheetConfig);

+ 13 - 3
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/SubjectController.java

@@ -10,6 +10,7 @@ import cn.com.qmth.stmms.common.enums.Role;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 import net.sf.json.JsonConfig;
+
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
+
 import java.util.List;
 
 @Controller
@@ -52,22 +54,30 @@ public class SubjectController extends BaseExamController {
         ExamSubject subject = subjectService.find(getSessionExamId(request), code);
         model.addAttribute("subject", subject);
         model.addAttribute("pictureConfig", buildPictureConfig(subject.getSheetConfig()));
+        model.addAttribute("passScore", subject.getPassScore());
+        model.addAttribute("excellentScore", subject.getExcellentScore());
         return "modules/exam/subjectEdit";
     }
 
-    @Logging(menu = "科目设置原图遮盖", type = LogType.UPDATE)
+    @Logging(menu = "科目设置", type = LogType.UPDATE)
     @SuppressWarnings("unchecked")
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @RoleRequire(Role.SCHOOL_ADMIN)
-    public String save(HttpServletRequest request, ExamSubject subject, Model model, @RequestParam String picList) {
+    public String save(HttpServletRequest request, ExamSubject subject, Model model, @RequestParam String picList,
+            @RequestParam(required = false) Double passScore, @RequestParam(required = false) Double excellentScore) {
         ExamSubject previous = subjectService.find(getSessionExamId(request), subject.getCode());
         if (previous != null && StringUtils.isNotBlank(picList)) {
             String sheetConfig = StringEscapeUtils.unescapeHtml(picList);
             JSONArray array = JSONArray.fromObject(sheetConfig);
             List<PictureConfigItem> list = JSONArray.toList(array, new PictureConfigItem(), new JsonConfig());
             previous.setSheetConfig(list == null ? null : StringUtils.join(list, PictureConfigItem.DB_ITEM_JOINER));
-            subjectService.save(previous);
         }
+        JSONObject sasConfig = new JSONObject();
+        sasConfig.accumulate("passScore", passScore);
+        sasConfig.accumulate("excellentScore", excellentScore);
+        previous.setSasConfig(sasConfig.toString());
+        subjectService.save(previous);
+
         model.addAttribute("message", "修改成功");
         return "redirect:/admin/exam/paper";
     }

+ 3 - 3
stmms-web/src/main/java/cn/com/qmth/stmms/admin/user/UserClassController.java

@@ -50,10 +50,10 @@ public class UserClassController extends BaseExamController {
     @RequestMapping(value = "/template")
     public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
         try {
-            String fileName = "评卷员班级导入模板.xlsx";
+            String fileName = "用户班级导入模板.xlsx";
             List<MarkerClass> list = new ArrayList<MarkerClass>();
             list.add(new MarkerClass());
-            new ExportExcel("评卷员班级数据", MarkerClass.class, 2).setDataList(list).write(response, fileName).dispose();
+            new ExportExcel("用户班级数据", MarkerClass.class, 2).setDataList(list).write(response, fileName).dispose();
             return null;
         } catch (Exception e) {
             addMessage(redirectAttributes, "导入模板下载失败!失败信息:" + e.getMessage());
@@ -124,7 +124,7 @@ public class UserClassController extends BaseExamController {
             addMessage(redirectAttributes, "已成功导入" + successNum + " 条 " + failureMsg);
         } catch (Exception e) {
             log.error("Batch import subject user error!", e);
-            addMessage(redirectAttributes, "导入用户失败!失败信息:" + e.getMessage());
+            addMessage(redirectAttributes, "导入用户班级失败!失败信息:" + e.getMessage());
         }
         return "redirect:/admin/user/list";
     }

+ 0 - 58
stmms-web/src/main/java/cn/com/qmth/stmms/admin/utils/UpyunConfig.java

@@ -1,58 +0,0 @@
-package cn.com.qmth.stmms.admin.utils;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-@Component
-public class UpyunConfig {
-
-    @Value("${upyun.sheet.bucket}")
-    private String sheetBucket;
-
-    @Value("${upyun.sheet.username}")
-    private String sheetUsername;
-
-    @Value("${upyun.sheet.password}")
-    private String sheetPassword;
-
-    @Value("${upyun.slice.bucket}")
-    private String sliceBucket;
-
-    @Value("${upyun.slice.username}")
-    private String sliceUsername;
-
-    @Value("${upyun.slice.password}")
-    private String slicePassword;
-
-    @Value("${upyun.media.bucket}")
-    private String mediaBucket;
-
-    public String getSheetBucket() {
-        return sheetBucket;
-    }
-
-    public String getSheetUsername() {
-        return sheetUsername;
-    }
-
-    public String getSheetPassword() {
-        return sheetPassword;
-    }
-
-    public String getSliceBucket() {
-        return sliceBucket;
-    }
-
-    public String getSliceUsername() {
-        return sliceUsername;
-    }
-
-    public String getSlicePassword() {
-        return slicePassword;
-    }
-
-    public String getMediaBucket() {
-        return mediaBucket;
-    }
-
-}

+ 1 - 1
stmms-web/src/main/webapp/WEB-INF/spring-mvc.xml

@@ -15,7 +15,7 @@
     <!-- Handles HTTP GET requests for /static/** by efficiently serving
         up static resources in the ${webappRoot}/static/ directory -->
     <mvc:resources mapping="/resources/**" location="/static/" order="0"/>
-    <mvc:resources mapping="/static/**" location="file:${file.root}/" order="0"/>
+    <mvc:resources mapping="/static/**" location="file:${file.store}/" order="0"/>
 
     <!-- 自动扫描包下的所有类,使其认为spring mvc的控制器 -->
     <context:component-scan base-package="cn.com.qmth.stmms.common.controller,

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

@@ -70,14 +70,14 @@
     <div class="control-group">
         <label class="control-label">及格分</label>
         <div class="controls">
-            <input name="passScore" type="number" value="${exam.passScore }" class="required"
+            <input name="passScore" type="number" value="${passScore }" class="required"
                    oninput="if(value<0)value=0"/>
         </div>
     </div>
     <div class="control-group">
         <label class="control-label">优秀分</label>
         <div class="controls">
-            <input name="excellentScore" type="number" value="${exam.excellentScore }" class="required"
+            <input name="excellentScore" type="number" value="${excellentScore }" class="required"
                    oninput="if(value<0)value=0"/>
         </div>
     </div>
@@ -85,7 +85,7 @@
         <div class="control-group">
             <label class="control-label">状态</label>
             <div class="controls">
-                <select class="input-small" name="StatusValue">
+                <select class="input-small" name="status">
                     <c:forEach items="${statusList}" var="item">
                         <option value="${item.value}"
                                 <c:if test="${item.value==exam.status.value}">selected</c:if>>${item.name}</option>

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

@@ -142,7 +142,6 @@
                                     </c:if>
                                     
                                     <c:if test="${web_user.subjectHeader==true}">
-                                        <li><a href="${ctx}/admin/exam/list" target="mainFrame"><i class="icon-th-list"></i><span data-i18n-text="index.exam">考试管理</span></a></li>
                                         <li><a href="${ctx}/admin/exam/student" target="mainFrame"><i class="icon-user"></i><span data-i18n-text="index.student">考生管理</span></a></li>
                                         <li><a href="${ctx}/admin/exam/mark" target="mainFrame"><i class="icon-pencil"></i><span data-i18n-text="index.mark">评卷管理</span></a></li>
                                         <li><a href="${ctx}/admin/exam/score" target="mainFrame"><i class="icon-search"></i><span data-i18n-text="index.score">成绩查询</span></a></li>

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

@@ -130,7 +130,7 @@
             <td>${subject.totalScore}</td>
             <td>
                 <c:if test="${examType!='MULTI_MEDIA'}">
-                    <a href="${ctx}/admin/exam/subject/edit?code=${subject.code}">原图遮盖</a>
+                    <a href="${ctx}/admin/exam/subject/edit?code=${subject.code}">编辑</a>
                 </c:if>
             </td>
         </tr>

+ 14 - 0
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/subjectEdit.jsp

@@ -26,6 +26,20 @@
 			</div>
 		</div>
 		<div class="control-group">
+        <label class="control-label">及格分</label>
+	        <div class="controls">
+	            <input name="passScore" type="number" value="${passScore }" class="required"
+	                   oninput="if(value<0)value=0"/>
+	        </div>
+	    </div>
+	    <div class="control-group">
+	        <label class="control-label">优秀分</label>
+	        <div class="controls">
+	            <input name="excellentScore" type="number" value="${excellentScore }" class="required"
+	                   oninput="if(value<0)value=0"/>
+	        </div>
+	    </div>
+		<div class="control-group">
             <label class="control-label">原图遮盖</label>
             <div class="controls">
                 <input name="picList" id="picList"  type="hidden"/>

+ 14 - 0
stmms-web/src/main/webapp/WEB-INF/views/modules/user/userList.jsp

@@ -25,6 +25,14 @@
             <a href="${ctx}/admin/user/subject/template">下载模板</a>
         </form>
     </div>
+    <div id="importClassBox" class="hide">
+        <form id="importClassForm" action="${ctx}/admin/user/class/import" method="post" enctype="multipart/form-data"
+              style="padding-left:20px;text-align:center;" class="form-search" onsubmit="loading('正在导入,请稍等...');"><br/>
+            <input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>  
+            <input id="btnImportSubmit" class="btn btn-primary" type="submit" value="  导    入  "/>
+            <a href="${ctx}/admin/user/class/template">下载模板</a>
+        </form>
+    </div>
 <form id="searchForm" action="${ctx}/admin/user/list" method="post" class="breadcrumb form-search">
     <input type="hidden" id="pageNumber" name="pageNumber" value="${query.pageNumber}"/>
     <input type="hidden" id="pageSize" name="pageSize" value="${query.pageSize}"/>
@@ -63,6 +71,8 @@
             <a href="${ctx}/admin/user/add" class="btn">新建</a>
             &nbsp;
             <input id="btnImport" class="btn" type="button" value="导入科组长"/>
+            &nbsp;
+            <input id="btnImportClass" class="btn" type="button" value="导入用户班级"/>
         </c:if>
     </div>
 </form>
@@ -123,6 +133,10 @@
     	  $.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true},
     	    bottomText:"导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!"});
     });
+    $("#btnImportClass").click(function(){
+  	  $.jBox($("#importClassBox").html(), {title:"导入数据", buttons:{"关闭":true},
+  	    bottomText:"导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!"});
+  });
 </script>
 </body>
 </html>