瀏覽代碼

在考生状态字段中,可以通过导入违纪名单,将违纪考生信息导入系统

nikang 7 年之前
父節點
當前提交
40dd6659e2

+ 11 - 0
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/model/ExamStudent.java

@@ -158,6 +158,9 @@ public class ExamStudent implements Serializable {
     @Column(name = "is_absent")
     private boolean absent;
 
+    @Column(name = "is_breach",columnDefinition = " default 0")
+    private boolean breach;
+
     /**
      * 是否数据校验异常
      */
@@ -679,4 +682,12 @@ public class ExamStudent implements Serializable {
     public void setTagValue(String tagValue) {
         this.tagValue = tagValue;
     }
+
+    public boolean isBreach() {
+        return breach;
+    }
+
+    public void setBreach(boolean breach) {
+        this.breach = breach;
+    }
 }

+ 16 - 0
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/model/ExamStudentVO.java

@@ -0,0 +1,16 @@
+package cn.com.qmth.stmms.biz.exam.model;
+
+import cn.com.qmth.stmms.common.annotation.ExcelField;
+
+public class ExamStudentVO {
+    @ExcelField(title = "准考证号", align = 2, sort = 10)
+    private String examNumber;
+
+    public String getExamNumber() {
+        return examNumber;
+    }
+
+    public void setExamNumber(String examNumber) {
+        this.examNumber = examNumber;
+    }
+}

+ 11 - 1
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/query/ExamStudentSearchQuery.java

@@ -64,7 +64,9 @@ public class ExamStudentSearchQuery extends BaseQuery<ExamStudent> {
     
     private Double startScroe; 
     
-    private Double endScroe; 
+    private Double endScroe;
+
+    private Boolean breach;
 
     public void orderByExamNumber() {
         setSort(new Sort(Direction.ASC, "examNumber"));
@@ -301,4 +303,12 @@ public class ExamStudentSearchQuery extends BaseQuery<ExamStudent> {
 	public void setEndScroe(Double endScroe) {
 		this.endScroe = endScroe;
 	}
+
+    public Boolean getBreach() {
+        return breach;
+    }
+
+    public void setBreach(Boolean breach) {
+        this.breach = breach;
+    }
 }

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

@@ -457,6 +457,9 @@ public class ExamStudentServiceImpl extends BaseQueryService<ExamStudent> implem
                 if (query.getAbsent() != null) {
                     predicates.add(cb.equal(root.get("absent"), query.getAbsent()));
                 }
+                if (query.getBreach() != null) {
+                    predicates.add(cb.equal(root.get("breach"), query.getBreach()));
+                }
                 if (query.getException() != null) {
                     predicates.add(cb.equal(root.get("exception"), query.getException()));
                 }

+ 2 - 2
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/parameter/BaseParameterController.java

@@ -101,8 +101,8 @@ public class BaseParameterController extends BaseController {
     }
 
     protected void saveMarkLibrary(ExamStudent student) {
-        if (student.isAbsent()) {
-            // 缺考则强制删除评卷任务
+        if (student.isAbsent() || student.isBreach()) {
+            // 缺考(或违纪)则强制删除评卷任务
             libraryService.deleteByStudent(student.getId());
         } else {
             MarkLibrary library = libraryService.findByStudentId(student.getId());

+ 70 - 4
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/parameter/ExamStudentController.java

@@ -8,6 +8,10 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.com.qmth.stmms.biz.exam.model.*;
+import cn.com.qmth.stmms.biz.exam.service.impl.ExamStudentServiceImpl;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -18,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@@ -26,10 +31,6 @@ import com.google.common.collect.Lists;
 
 import cn.com.qmth.stmms.biz.campus.model.Campus;
 import cn.com.qmth.stmms.biz.campus.service.CampusService;
-import cn.com.qmth.stmms.biz.exam.model.Exam;
-import cn.com.qmth.stmms.biz.exam.model.ExamPackage;
-import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
-import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
 import cn.com.qmth.stmms.biz.exam.query.ExamStudentSearchQuery;
 import cn.com.qmth.stmms.biz.exam.service.ExamPackageService;
 import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
@@ -293,6 +294,70 @@ public class ExamStudentController extends BaseParameterController {
         }
         return "redirect:" + "/admin/exam-param/student";
     }
+    @RequestMapping(value = "/breachTemplate")
+    public String breachTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        try {
+            String fileName = "违纪考生导入模板.xlsx";
+            List<ExamStudentVO> list = Lists.newArrayList();
+            list.add(new ExamStudentVO());
+            new ExportExcel("", ExamStudentVO.class, 2).setDataList(list).write(response, fileName).dispose();
+            return null;
+        } catch (Exception e) {
+            addMessage(redirectAttributes, "导入模板下载失败!失败信息:" + e.getMessage());
+        }
+        return "redirect:" + "/admin/exam-param/student";
+    }
+
+    @RequestMapping(value = "/breachImport", method = RequestMethod.POST)
+    public String breachImportFile(HttpServletRequest request, MultipartFile file, RedirectAttributes redirectAttributes) {
+        int examId = getSessionExamId(request);
+        Exam exam = examService.findById(examId);
+        try {
+            int successNum = 0;
+            ImportExcel ei = new ImportExcel(file, 0, 0);
+            List<ExamStudentVO> list = ei.getDataList(ExamStudentVO.class);
+            for (ExamStudentVO studentVO : list) {
+                if ( StringUtils.isBlank(studentVO.getExamNumber())) {
+                    continue;
+                }
+                ExamStudent student = studentService.findByExamIdAndExamNumber(examId,studentVO.getExamNumber());
+                student.setBreach(true);
+                studentService.save(student);
+                saveMarkLibrary(student);
+                successNum ++;
+            }
+            addMessage(redirectAttributes, "已成功导入 " + successNum + " 条用户");
+        } catch (Exception e) {
+            log.error("Batch import BreachStudent error!", e);
+            addMessage(redirectAttributes, "导入考生失败!失败信息:" + e.getMessage());
+        }
+        return "redirect:" + "/admin/exam-param/student";
+    }
+
+
+    @RequestMapping(value = "/updateBreach",method = RequestMethod.POST)
+    @ResponseBody
+    public JSONObject updateBreach(HttpServletRequest request, Integer id) {
+        JSONObject result = new JSONObject();
+        ExamStudent student = studentService.findById(id);
+        student.setBreach(false);
+        try {
+            student = studentService.save(student);
+            saveMarkLibrary(student);
+            if (student != null) {
+                result.accumulate("message", "重置成功!");
+                result.accumulate("success", true);
+            } else {
+                result.accumulate("message", "将违纪考生信息重置为正常时出错!");
+                result.accumulate("success", false);
+            }
+        }catch (Exception e){
+            log.error("将违纪考生信息重置为正常时出错!", e);
+            result.accumulate("message", "将违纪考生信息重置为正常时抛异常!");
+            result.accumulate("success", false);
+        }
+        return result;
+    }
 
     @RequestMapping(value = "/export", method = RequestMethod.POST)
     public String exportFile(ExamStudentSearchQuery query, HttpServletRequest request, HttpServletResponse response,
@@ -344,6 +409,7 @@ public class ExamStudentController extends BaseParameterController {
         return false;
     }
 
+
     private void buildSheetUrl(ExamStudent student) {
         Campus campus = campusService.findBySchoolAndName(student.getSchoolId(), student.getCampusName());
         student.setSheetUrls(PictureUrlBuilder.getSheetUrls(student.getExamId(), campus.getId(),

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

@@ -16,6 +16,14 @@
 			<a href="${ctx}/admin/exam-param/student/template">下载模板</a>
 		</form>
 	</div>
+    <div id="breachImportBox" class="hide">
+        <form id="breachImportForm" action="${ctx}/admin/exam-param/student/breachImport" method="post" enctype="multipart/form-data"
+              style="padding-left:20px;text-align:center;" class="form-search" onsubmit="loading('正在导入,请稍等...');"><br/>
+            <input id="breachUploadFile" name="file" type="file" style="width:330px"/><br/><br/>  
+            <input id="breachBtnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
+            <a href="${ctx}/admin/exam-param/student/breachTemplate">下载模板</a>
+        </form>
+    </div>
 	<form id="searchForm"  action="${ctx}/admin/exam-param/student" 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}"/>
@@ -23,16 +31,16 @@
 			<label>姓名</label>
 			<input type="text" name="name" value="${query.name}"  maxlength="10" class="input-mini"/>
 			<label>准考证号</label>
-			<input type="text" name="examNumber" value="${query.examNumber}" maxlength="50" class="input-small"/>
+			<input type="text" name="examNumber" value="${query.examNumber}" maxlength="50" class="input-mini"/>
 			<label>学号</label>
-			<input type="text" name="studentCode" value="${query.studentCode}" maxlength="30" class="input-small"/>		
-			<label>学习中心</label>
-			<select class="input-large" id="campusName" name="campusName">
-				<option value="">请选择...</option>
-				<c:forEach items="${campusList }" var="campus">
-					<option value="${campus}" <c:if test="${query.campusName eq campus }">selected</c:if>>${campus}</option>
-				</c:forEach>
-			</select>
+			<input type="text" name="studentCode" value="${query.studentCode}" maxlength="30" class="input-small"/>
+            <label>专业类型</label>
+            <select class="input-small" id="subjectCategory" name="subjectCategory">
+                <option value="">请选择</option>
+                <c:forEach items="${categoryList }" var="category">
+                    <option value="${category}" <c:if test="${query.subjectCategory eq category }">selected</c:if>>${category}</option>
+                </c:forEach>
+            </select>
 			<label>科目</label>
 			<select class="input-large" id="subjectCode" name="subjectCode">
 				<option value="">请选择</option>
@@ -40,7 +48,6 @@
 					<option value="${subject.code }" <c:if test="${query.subjectCode eq subject.code }">selected</c:if>>${subject.code}-${subject.name}</option>
 				</c:forEach>
 			</select>
-			<br><br>
 			<label>层次</label>
 			<select class="input-small" id="subjectLevel" name="subjectLevel">
 				<option value="">请选择</option>
@@ -48,13 +55,15 @@
 					<option value="${level}" <c:if test="${query.subjectLevel eq level }">selected</c:if>>${level}</option>
 				</c:forEach>
 			</select>
-			<label>专业类型</label>
-			<select class="input-small" id="subjectCategory" name="subjectCategory">
-				<option value="">请选择</option>
-				<c:forEach items="${categoryList }" var="category">
-					<option value="${category}" <c:if test="${query.subjectCategory eq category }">selected</c:if>>${category}</option>
-				</c:forEach>
-			</select>
+            <br><br>
+            <label>学习中心</label>
+            <select class="input-large" id="campusName" name="campusName">
+                <option value="">请选择...</option>
+                <c:forEach items="${campusList }" var="campus">
+                    <option value="${campus}" <c:if test="${query.campusName eq campus }">selected</c:if>>${campus}</option>
+                </c:forEach>
+            </select>
+
 			
 			<label>状态</label>
 			<select id="upload" name="upload" class="input-small">
@@ -67,6 +76,11 @@
 				<option value="1" <c:if test="${query.absent!=null && query.absent==true}">selected</c:if>>缺考</option>
 				<option value="0" <c:if test="${query.absent!=null && query.absent==false}">selected</c:if>>正常</option>
 			</select>
+			<select id="breach" name="breach" class="input-small">
+				<option value="">不限</option>
+				<option value="1" <c:if test="${query.breach!=null && query.breach==true}">selected</c:if>>违纪</option>
+				<option value="0" <c:if test="${query.breach!=null && query.breach==false}">selected</c:if>>正常</option>
+			</select>
 			<label>签到表编号</label>
 			<input type="text" name="packageCode" value="${query.packageCode}" maxlength="30" class="input-small"/>
 			<label>批次编号</label>
@@ -78,6 +92,7 @@
 			<c:if test="${query.totalCount>0 && query.totalCount<=10000}">
 			&nbsp;<input id="export-button" class="btn" type="button" value="导出"/>
 			</c:if>
+            &nbsp;<input id="breachBtnImport" class="btn" type="button" value="违纪名单导入"/>
 			<!-- &nbsp;<input id="clear-button" class="btn btn-danger" type="button" value="清空"/> -->
 		</div>
 	</form>
@@ -96,6 +111,7 @@
 				<th>批次编号</th>
 				<th>签到表编号</th>
 				<th>考试备注信息</th>
+				<th>是否违纪</th>
 				<th>操作</th>
 			</tr>
 		</thead>
@@ -124,7 +140,7 @@
 				<c:if test="${student.upload==false}">
 				未上传
 				</c:if>
-				
+
 				</td>
 				<td>${student.batchCode}</td>
 				<td>
@@ -136,6 +152,14 @@
 				</c:if>
 				</td>
 				<td>${student.examSite}&nbsp;${student.examRoom}</td>
+                <td >
+                    <c:if test="${student.breach==true}">
+                        <a href="##" onclick="updateBreach(${student.id});">违纪</a>
+                    </c:if>
+                    <c:if test="${student.breach==false}">
+                        正常
+                    </c:if>
+                </td>
 				<td>
     				<a href="${ctx}/admin/exam-param/student/update?id=${student.id}">修改</a>
 					<a href="${ctx}/admin/exam-param/student/delete?id=${student.id}" onclick="return confirmx('确认要删除该考生吗?', this.href)">删除</a>
@@ -169,6 +193,10 @@ $("#btnImport").click(function(){
 	$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
 		bottomText:"导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!"});
 });
+$("#breachBtnImport").click(function(){
+	$.jBox($("#breachImportBox").html(), {title:"导入数据", buttons:{"关闭":true},
+		bottomText:"导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!"});
+});
 $("#clear-button").click(function(){
 	if(confirm('确定要删除当前的所有考生?')){
 		$("#searchForm").attr("action","${ctx}/admin/exam-param/student/clear");
@@ -193,6 +221,21 @@ function goSearch(){
 	$("#searchForm").submit();
 	return false;
 }
+function updateBreach(studentId) {
+  top.$.jBox.confirm("确认要将该考生违纪重置为正常?","提示",function(v,h,f){
+    if(v=="ok"){
+      var url = '${ctx}/admin/exam-param/student/updateBreach?id='+studentId;
+      $.ajax( {
+        url : url,
+        type : "POST",
+        success : function(val) {
+          if(val.success){
+            window.location.href="${ctx}/admin/exam-param/student";
+          }
+        }})
+    }
+  });
+}
 </script>	
 </body>
 </html>