Переглянути джерело

恢复考试详情并增加签到表数量;增加评卷时间并登录验证失败时给予提示;恢复评卷页面放大缩小功能

ting.yin 6 роки тому
батько
коміт
8a9d30fd4d

+ 30 - 0
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/model/Exam.java

@@ -73,6 +73,20 @@ public class Exam implements Serializable {
     @Enumerated(EnumType.STRING)
     private MarkMode markMode;
 
+    /**
+     * 评卷起始时间
+     */
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name = "mark_start_time")
+    private Date startTime;
+
+    /**
+     * 评卷结束时间
+     */
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name = "mark_end_time")
+    private Date endTime;
+
     public Integer getId() {
         return id;
     }
@@ -169,4 +183,20 @@ public class Exam implements Serializable {
         this.markMode = markMode;
     }
 
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
 }

+ 13 - 1
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/ExamController.java

@@ -21,6 +21,7 @@ import cn.com.qmth.stmms.admin.exam.parameter.BaseParameterController;
 import cn.com.qmth.stmms.admin.vo.ExamInfoVO;
 import cn.com.qmth.stmms.biz.exam.model.Exam;
 import cn.com.qmth.stmms.biz.exam.query.ExamSearchQuery;
+import cn.com.qmth.stmms.biz.exam.service.ExamPackageService;
 import cn.com.qmth.stmms.biz.exam.service.ExamService;
 import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
 import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
@@ -57,6 +58,9 @@ public class ExamController extends BaseParameterController {
 
     @Autowired
     private MarkLibraryService libraryService;
+    
+    @Autowired
+    private ExamPackageService packageService;
 
     @RequestMapping(value = { "", "/list" })
     @AuthRequire(value = { Auth.EXAM_VIEW_SELF, Auth.EXAM_VIEW_CAMPUS }, isAny = true)
@@ -125,6 +129,8 @@ public class ExamController extends BaseParameterController {
             oldExam.setForceSpecialTag(exam.isForceSpecialTag());
             oldExam.setShowSheet(exam.isShowSheet());
             oldExam.setMarkMode(exam.getMarkMode()); 
+            oldExam.setStartTime(exam.getStartTime());
+            oldExam.setEndTime(exam.getEndTime());
             examService.save(oldExam);
         }
         return "redirect:/admin/exam";
@@ -150,7 +156,8 @@ public class ExamController extends BaseParameterController {
         long markerCount = markerService.countByExam(exam.getId());
         long scanCount = examStudentService.countByExamIdAndUpload(examId, true);
         long markedCount = libraryService.countByExamAndStatus(examId, LibraryStatus.MARKED);
-
+        long packageCount = packageService.count(examId, true);
+        
         List<ExamInfoVO> voList = new ArrayList<ExamInfoVO>();
 
         ExamInfoVO student = new ExamInfoVO();
@@ -167,6 +174,10 @@ public class ExamController extends BaseParameterController {
         campus.setName("学习中心");
         campus.setAttr("共导入 " + campusCount + " 个学习中心");
         campus.setUrl("/admin/exam-param/student");
+        
+        ExamInfoVO packages = new ExamInfoVO();
+        packages.setName("签到表");
+        packages.setAttr("共导入 " + packageCount + " 个签到表");
 
         ExamInfoVO marker = new ExamInfoVO();
         marker.setName("评卷员");
@@ -195,6 +206,7 @@ public class ExamController extends BaseParameterController {
         voList.add(student);
         voList.add(subject);
         voList.add(campus);
+        voList.add(packages);
         voList.add(marker);
         voList.add(scan);
         voList.add(mark);

+ 20 - 0
stmms-web/src/main/java/cn/com/qmth/stmms/common/controller/LoginController.java

@@ -1,5 +1,6 @@
 package cn.com.qmth.stmms.common.controller;
 
+import java.text.SimpleDateFormat;
 import java.util.Date;
 
 import javax.servlet.http.HttpServletRequest;
@@ -14,7 +15,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.servlet.ModelAndView;
 
+import cn.com.qmth.stmms.biz.exam.model.Exam;
 import cn.com.qmth.stmms.biz.exam.model.Marker;
+import cn.com.qmth.stmms.biz.exam.service.ExamService;
 import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
 import cn.com.qmth.stmms.biz.exam.service.MarkerService;
 import cn.com.qmth.stmms.biz.user.model.User;
@@ -48,6 +51,9 @@ public class LoginController {
 
     @Autowired
     private ExamSubjectService examSubjectService;
+    
+    @Autowired
+    private ExamService examService;
 
     @Value("${app.index}")
     private String appIndex;
@@ -228,6 +234,20 @@ public class LoginController {
             modelAndView.addObject("message", "帐号已禁用");
             return modelAndView;
         }
+        Exam exam = examService.findById(marker.getExamId());
+        Date now = new Date();
+        if((exam.getStartTime()!=null&&now.before(exam.getStartTime()))
+                || (exam.getEndTime()!=null&&now.after(exam.getEndTime()))){
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String start = exam.getStartTime()==null?"":" 开始时间:"+sdf.format(exam.getStartTime());
+            String end = exam.getEndTime()==null?"":" 结束时间:"+sdf.format(exam.getEndTime());
+            if ("aopeng".equals(appIndex)) {
+                modelAndViewForAP.addObject("message", "不在评卷时间范围,"+start+" "+end);
+                return modelAndViewForAP;
+            }
+            modelAndView.addObject("message", "不在评卷时间范围 "+start+" "+end);
+            return modelAndView; 
+        }
 
         new WebUser(marker.getId(), UserType.MARKER).writeToSession(RequestUtils.getSession(request));
 

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

@@ -53,6 +53,22 @@
 					value="${exam.examTime }"
 					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
 			</div>
+		</div>
+				<div class="control-group">
+			<label class="control-label">评卷开始日期:</label>
+			<div class="controls">
+				<input name="startTime" type="text" readonly="readonly" maxlength="20" class="Wdate "
+					value="${exam.startTime }"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">评卷结束日期:</label>
+			<div class="controls">
+				<input name="endTime" type="text" readonly="readonly" maxlength="20" class="Wdate "
+					value="${exam.endTime }"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
+			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">强制标记</label>

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

@@ -52,6 +52,22 @@
 					value=""
 					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
 			</div>
+		</div>
+				<div class="control-group">
+			<label class="control-label">评卷开始日期:</label>
+			<div class="controls">
+				<input name="startTime" type="text" readonly="readonly" maxlength="20" class="Wdate"
+					value=""
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">评卷结束日期:</label>
+			<div class="controls">
+				<input name="endTime" type="text" readonly="readonly" maxlength="20" class="Wdate"
+					value=""
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
+			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">强制标记</label>

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

@@ -42,7 +42,7 @@
 				<td>${exam.id}</td>
 				<td>
 					<c:if test="${web_user.type.value==0}">
-					<a href="${ctx}/admin/exam/view/${exam.id}">${exam.name}</a>
+					<a href="${ctx}/admin/exam/view/${exam.id}/info">${exam.name}</a>
 					</c:if>
 					<c:if test="${web_user.type.value!=0}">${exam.name}</c:if>
 				</td>

+ 36 - 5
stmms-web/src/main/webapp/static/mark-new/js/modules/single-image-view.js

@@ -72,6 +72,20 @@ SingleImageView.prototype.init = function() {
         	});
         }
     });
+    
+    this.imageControl = getDom(this.image_control_dom, this.markControl).insertBefore(this.markControl.container.assistantButton.parent());
+    this.imageControl.find('.zoom-out-button').click(this, function(event) {
+    	self.reloadImage(0.2);
+        self.markControl.trigger('image.reload.event');
+    });
+    this.imageControl.find('.zoom-in-button').click(this, function(event) {
+    	self.reloadImage(-0.2);
+        self.markControl.trigger('image.reload.event');
+    });
+    this.imageControl.find('.zoom-fit-button').click(this, function(event) {
+    	self.reloadImage();
+        self.markControl.trigger('image.reload.event');
+    });
 }
 
 SingleImageView.prototype.render = function() {
@@ -81,6 +95,7 @@ SingleImageView.prototype.render = function() {
         //设置画布大小及背景颜色
         this.image = new Image();
         this.image.src = this.task.imageData;
+        this.image.scale = 1.0;
         this.image.onload = function(){
             self.canvas.width = Math.min(self.container.width(), self.image.width);
             self.canvas.height = self.canvas.width * self.image.height / self.image.width;
@@ -93,17 +108,27 @@ SingleImageView.prototype.render = function() {
     }
 }
 
-SingleImageView.prototype.reloadImage = function() {
+SingleImageView.prototype.reloadImage = function(scale) {
     if(this.image != undefined){
-    	this.canvas.width = Math.min(this.container.width(), this.image.width);
+    	if(scale != undefined){
+    		this.image.scale = this.image.scale + scale;
+    		if(this.image.scale < 0.2){
+    			this.image.scale = 0.2;
+    		}else if(this.image.scale > 3){
+    			this.image.scale = 3;
+    		}
+    	}else{
+    		this.image.scale = 1.0;
+    	}
+    	this.canvas.width = Math.min(this.container.width(), this.image.width) * this.image.scale;
         this.canvas.height = this.canvas.width * this.image.height / this.image.width;
         this.ctx.drawImage(this.image, 0, 0, this.image.width, this.image.height, 0, 0, this.canvas.width, this.canvas.height);
     }
 }
 
 SingleImageView.prototype.drawTag = function(tag){
-    if(tag!=undefined && tag.positionX>0 && tag.positionY>0){
-        this.ctx.font ="60px Arial";
+    if(tag!=undefined && tag.positionX>0 && tag.positionY>0 && this.image!=undefined){
+        this.ctx.font = parseInt(60 * this.image.scale) + "px Arial";
         this.ctx.fillStyle = 'red';
         this.ctx.fillText(tag.content, tag.positionX*this.canvas.width, tag.positionY*this.canvas.height);
     }
@@ -119,4 +144,10 @@ SingleImageView.prototype.updateScrollTop = function(scrollTopPercent) {
     } else {
         this.container.scrollTop(0);
     }
-}
+}
+
+SingleImageView.prototype.image_control_dom = '<em>\
+<a href="#" class="btn zoom-out-button">放大</a>\
+<a href="#" class="btn zoom-in-button">缩小</a>\
+<a href="#" class="btn zoom-fit-button">适应</a>\
+</em>';

+ 37 - 4
stmms-web/src/main/webapp/static/mark-track/js/modules/single-image-view.js

@@ -57,6 +57,20 @@ SingleImageView.prototype.init = function() {
         	});
         }
     });
+    
+    this.imageControl = getDom(this.image_control_dom, this.markControl).insertBefore(this.markControl.container.assistantButton.parent());
+    this.imageControl.find('.zoom-out-button').click(this, function(event) {
+    	self.reloadImage(0.2);
+        self.markControl.trigger('image.reload.event');
+    });
+    this.imageControl.find('.zoom-in-button').click(this, function(event) {
+    	self.reloadImage(-0.2);
+        self.markControl.trigger('image.reload.event');
+    });
+    this.imageControl.find('.zoom-fit-button').click(this, function(event) {
+    	self.reloadImage();
+        self.markControl.trigger('image.reload.event');
+    });
 }
 
 SingleImageView.prototype.render = function() {
@@ -66,6 +80,7 @@ SingleImageView.prototype.render = function() {
         //设置画布大小及背景颜色
         this.image = new Image();
         this.image.src = this.task.imageData;
+        this.image.scale = 1.0;
         this.image.onload = function(){
             self.canvas.width = Math.min(self.container.width(), self.image.width);
             self.canvas.height = self.canvas.width * self.image.height / self.image.width;
@@ -78,18 +93,36 @@ SingleImageView.prototype.render = function() {
     }
 }
 
-SingleImageView.prototype.reloadImage = function() {
+SingleImageView.prototype.reloadImage = function(scale) {
     if(this.image != undefined){
+    	if(scale != undefined){
+    		this.image.scale = this.image.scale + scale;
+    		if(this.image.scale < 0.2){
+    			this.image.scale = 0.2;
+    		}else if(this.image.scale > 3){
+    			this.image.scale = 3;
+    		}
+    	}else{
+    		this.image.scale = 1.0;
+    	}
+    	this.canvas.width = Math.min(this.container.width(), this.image.width) * this.image.scale;
+        this.canvas.height = this.canvas.width * this.image.height / this.image.width;
         this.ctx.drawImage(this.image, 0, 0, this.image.width, this.image.height, 0, 0, this.canvas.width, this.canvas.height);
     }
 }
 
 SingleImageView.prototype.drawTag = function(tag){
-    if(tag != undefined && tag.positionX > 0 && tag.positionY > 0){
-        this.ctx.font ="60px Arial";
+    if(tag != undefined && tag.positionX > 0 && tag.positionY > 0 && this.image!=undefined){
+        this.ctx.font = parseInt(60 * this.image.scale) + "px Arial";
         this.ctx.fillStyle = 'red';
         this.ctx.fillText(tag.content, tag.positionX*this.canvas.width, tag.positionY*this.canvas.height);
     }
 }
 
-SingleImageView.prototype.container_dom = '<div style="overflow: scroll"><canvas></canvas></div>';
+SingleImageView.prototype.container_dom = '<div style="overflow: scroll; width: 100%"><canvas></canvas></div>';
+
+SingleImageView.prototype.image_control_dom = '<em>\
+<a href="#" class="btn zoom-out-button">放大</a>\
+<a href="#" class="btn zoom-in-button">缩小</a>\
+<a href="#" class="btn zoom-fit-button">适应</a>\
+</em>';