ソースを参照

新增系统配置自动统计,默认不开启

ting.yin 2 年 前
コミット
d036231e24

+ 9 - 0
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/mark/service/Impl/MarkCronService.java

@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import cn.com.qmth.stmms.biz.config.service.SystemConfigService;
 import cn.com.qmth.stmms.biz.config.service.impl.SystemCache;
 import cn.com.qmth.stmms.biz.exam.model.Exam;
 import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
@@ -29,6 +30,7 @@ import cn.com.qmth.stmms.biz.lock.LockService;
 import cn.com.qmth.stmms.biz.mark.service.MarkService;
 import cn.com.qmth.stmms.biz.report.service.ReportService;
 import cn.com.qmth.stmms.biz.utils.TaskLockUtil;
+import cn.com.qmth.stmms.common.enums.ConfigType;
 import cn.com.qmth.stmms.common.enums.ExamStatus;
 import cn.com.qmth.stmms.common.enums.LockType;
 import cn.com.qmth.stmms.common.enums.MarkStatus;
@@ -74,6 +76,9 @@ public class MarkCronService {
     @Autowired
     private ReportService reportService;
 
+    @Autowired
+    private SystemConfigService systemConfigService;
+
     /**
      * 自动释放可清除的锁
      */
@@ -291,6 +296,10 @@ public class MarkCronService {
 
     @Scheduled(fixedDelay = 30 * 60 * 1000, initialDelay = 2 * 60 * 1000)
     public void updateReport() {
+        String systemConfig = systemConfigService.findByType(ConfigType.AUTO_REPORT);
+        if (systemConfig == null || systemConfig != "on") {
+            return;
+        }
         log.info("start auto-update report");
         try {
             Map<Integer, Set<String>> map = new HashMap<Integer, Set<String>>();

+ 1 - 1
stmms-common/src/main/java/cn/com/qmth/stmms/common/enums/ConfigType.java

@@ -1,7 +1,7 @@
 package cn.com.qmth.stmms.common.enums;
 
 public enum ConfigType {
-    FILE_SERVER("图片服务", 1), MARK_TIME("评卷时长", 2);
+    FILE_SERVER("图片服务", 1), MARK_TIME("评卷时长", 2), AUTO_REPORT("自动统计", 3);
 
     private String name;
 

+ 5 - 0
stmms-web/src/main/webapp/WEB-INF/views/modules/sys/configEdit.jsp

@@ -39,7 +39,12 @@
     <div class="control-group">
         <label class="control-label">详情</label>
         <div class="controls">
+        	<c:if test="${config.type.value==3 }">
+        		<input name="description" type="checkbox" <c:if test="${config.description=='on'}">checked</c:if>/>
+        	</c:if>
+        	<c:if test="${config.type.value!=3 }">
             <form:textarea path="description" htmlEscape="false" rows="4" maxlength="200" class="input-xxlarge"/>
+        	</c:if>
         </div>
     </div>
     <div class="form-actions">

+ 9 - 1
stmms-web/src/main/webapp/WEB-INF/views/modules/sys/configList.jsp

@@ -21,7 +21,15 @@
 		<c:forEach items="${list}" var="config">
 			<tr>
 				<td>${config.type.name}</td>
-				<td>${config.description}</td>
+				<td>
+				<c:if test="${config.type.value==3 }">
+        			<c:if test="${config.description=='on'}">开启</c:if>
+        			<c:if test="${config.description!='on'}">关闭</c:if>
+        		</c:if>
+        		<c:if test="${config.type.value!=3 }">
+				${config.description}
+        		</c:if>
+				</td>
 				<td>
 					<a href="${ctx}/admin/sys/config/edit?id=${config.id}">修改</a>
 				</td>

+ 2 - 0
stmms-web/src/main/webapp/sql/stmms_ft.sql

@@ -54,6 +54,8 @@ INSERT INTO `b_sys_config` (`id`, `type`, `description`, `update_time`)
 VALUES (1, 'FILE_SERVER', 'http://192.168.10.42:9000/,http://192.168.10.42:9000/', '2021-08-09 15:38:58');
 INSERT INTO `b_sys_config` (`id`, `type`, `description`, `update_time`)
 VALUES (2, 'MARK_TIME', '30', '2021-08-09 15:38:58');
+INSERT INTO `b_sys_config` (`id`, `type`, `description`, `update_time`)
+VALUES (3, 'AUTO_REPORT', null, '2021-08-09 15:38:58');
 
 UNLOCK TABLES;
 

+ 4 - 0
stmms-web/src/main/webapp/sql/upgrade/1.3.12.sql

@@ -49,3 +49,7 @@ CREATE TABLE `m_reject_history`
     KEY `index1` (`exam_id`, `subject_code`, `group_number`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4 COMMENT ='打回记录表';
+  
+-- 新增系统配置,自动统计
+INSERT INTO `b_sys_config` (`id`, `type`, `description`, `update_time`)
+VALUES (3, 'AUTO_REPORT', null, '2021-08-09 15:38:58');