Browse Source

客户端新增上传db文件

wangliang 1 năm trước cách đây
mục cha
commit
bca2c61a57

+ 2 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamStudentMapper.java

@@ -89,6 +89,8 @@ public interface TEExamStudentMapper extends CustomBaseMapper<TEExamStudent> {
 
     public void updateCurrentRecordId(@Param("examStudentId") Long examStudentId, @Param("currentRecordId") Long currentRecordId);
 
+    public void updateAlreadyExamCountAndCurrentRecordId(@Param("examStudentId") Long examStudentId,@Param("alreadyExamCount") Integer alreadyExamCount, @Param("currentRecordId") Long currentRecordId);
+
     /**
      * 查询学生成绩信息
      *

+ 11 - 5
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -3,7 +3,6 @@ package com.qmth.themis.business.service.impl;
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.aliyun.oss.common.utils.BinaryUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -32,7 +31,6 @@ import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.GsonUtil;
-import com.qmth.themis.common.util.HexUtils;
 import com.qmth.themis.common.util.IpUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
@@ -362,6 +360,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                         es.getAlreadyExamCount() + 1, studentId, ec.getMobilePhotoUpload());
 
         es.setCurrentRecordId(recordId);
+        // 更新考生缓存
+        redisUtil.set(RedisKeyHelper.examStudentCacheKey(examStudentId), es);
+        updateExamStudent(examStudentId, null, recordId);
+
         ExamPrepareBean prepare = new ExamPrepareBean(recordId,
                 (ec.getObjectiveShuffle() == null || ec.getObjectiveShuffle().intValue() == 0 ? false : true),
                 (ec.getOptionShuffle() == null || ec.getOptionShuffle().intValue() == 0 ? false : true),
@@ -392,9 +394,13 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
 
     private void updateExamStudent(Long examStudentId, Integer alreadyExamCount, Long currentRecordId) {
         Map<String, Object> transMap = new HashMap<String, Object>();
-        transMap.put(SystemConstant.EXAM_STUDENT_ID, String.valueOf(examStudentId));
-        transMap.put("alreadyExamCount", String.valueOf(alreadyExamCount));
-        transMap.put("currentRecordId", String.valueOf(currentRecordId));
+        transMap.put(SystemConstant.EXAM_STUDENT_ID, examStudentId);
+        if (Objects.nonNull(alreadyExamCount)) {
+            transMap.put("alreadyExamCount", alreadyExamCount);
+        }
+        if (Objects.nonNull(currentRecordId)) {
+            transMap.put("currentRecordId", currentRecordId);
+        }
         MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.EXAM_STUDNET_UPDATE.name(), transMap,
                 MqTagEnum.EXAM_STUDNET_UPDATE, examStudentId.toString(), examStudentId.toString());
         mqDtoService.assembleSendAsyncMsg(mqDto);

+ 9 - 8
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamStudentServiceImpl.java

@@ -143,14 +143,15 @@ public class TEExamStudentServiceImpl extends ServiceImpl<TEExamStudentMapper, T
     @Transactional
     @Override
     public void updateByMqMsg(Map<String, Object> param) {
-        String examStudentId = String.valueOf(param.get(SystemConstant.EXAM_STUDENT_ID));
-        String alreadyExamCount = String.valueOf(param.get("alreadyExamCount"));
-        String currentRecordId = String.valueOf(param.get("currentRecordId"));
-        if (Objects.nonNull(alreadyExamCount)) {
-            teExamStudentMapper.updateAlreadyExamCount(Long.parseLong(examStudentId), Integer.parseInt(alreadyExamCount));
-        }
-        if (Objects.nonNull(currentRecordId)) {
-            teExamStudentMapper.updateCurrentRecordId(Long.parseLong(examStudentId), Long.parseLong(currentRecordId));
+        Long examStudentId = (Long) param.get(SystemConstant.EXAM_STUDENT_ID);
+        Integer alreadyExamCount = (Integer) param.get("alreadyExamCount");
+        Long currentRecordId = (Long) param.get("currentRecordId");
+        if (Objects.nonNull(alreadyExamCount) && Objects.nonNull(currentRecordId)) {
+            teExamStudentMapper.updateAlreadyExamCountAndCurrentRecordId(examStudentId, alreadyExamCount, currentRecordId);
+        } else if (Objects.nonNull(alreadyExamCount)) {
+            teExamStudentMapper.updateAlreadyExamCount(examStudentId, alreadyExamCount);
+        } else if (Objects.nonNull(currentRecordId)) {
+            teExamStudentMapper.updateCurrentRecordId(examStudentId, currentRecordId);
         }
     }
 

+ 3 - 2
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamSummaryServiceImpl.java

@@ -98,12 +98,13 @@ public class TEExamSummaryServiceImpl extends ServiceImpl<TEExamSummaryMapper, T
                 teExamSummary.setAbsentCount(teExamSummary.getTotalCount() - teExamSummary.getPrepareCount());
             }
             //考试中
-            if (startTime <= timestamp && endTime >= timestamp) {
+            if (ExamModeEnum.TOGETHER.equals(examCacheBean.getMode()) && startTime <= timestamp && endTime >= timestamp) {
                 teExamSummary.setPrepareCount(0);
-                teExamSummary.setAbsentCount(teExamSummary.getTotalCount() - teExamSummary.getExamCount() - teExamSummary.getFinishCount());
             }//交卷
             else if (endTime <= timestamp) {//当考试场次结束时间已过,缺考=全部应考-已完成考试
                 teExamSummary.setAbsentCount(teExamSummary.getTotalCount() - teExamSummary.getFinishCount());
+            } else {
+                teExamSummary.setAbsentCount(teExamSummary.getTotalCount() - teExamSummary.getExamCount() - teExamSummary.getFinishCount());
             }
             TEExamSummary teExamSummaryDb = this.getOne(new QueryWrapper<TEExamSummary>().lambda()
                     .eq(TEExamSummary::getExamId, examId)

+ 1 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEOrgSummaryServiceImpl.java

@@ -89,6 +89,7 @@ public class TEOrgSummaryServiceImpl extends ServiceImpl<TEOrgSummaryMapper, TEO
                 });
             }
         }
+        themisCacheService.updateOrgSummaryCache(orgId);
     }
 
     /**

+ 1 - 1
themis-business/src/main/resources/db/log/1.2.8.log

@@ -114,7 +114,7 @@ CREATE INDEX t_e_exam_student_student_id_IDX USING BTREE ON t_e_exam_student (st
 
 INSERT INTO sys_config
 (id, org_id, config_key, config_name, config_value, enable, create_id, create_time, update_id, update_time, remark, sort, editor)
-VALUES(32, NULL, 'client.db.upload.location', '客户端上传db地址', '/oe-client/exception/db', 1, 1, NULL, NULL, NULL, NULL, 1, 0);
+VALUES(32, NULL, 'client.db.upload.location', '客户端上传db地址', '/oe-client/exception', 1, 1, NULL, NULL, NULL, NULL, 1, 0);
 
 UPDATE sys_config
 SET org_id=NULL, config_key='exam.no.auth.urls', config_name='exam无需鉴权的url', config_value='/webjars/**,/druid/**,/swagger-ui.html,/doc.html,/swagger-resources/**,/v2/api-docs,/webjars/springfox-swagger-ui/**,/api/oe/student/login,/api/oe/sys/env,/file/**,/upload/**,/client/**,/base_photo/**,/frontend/**,/api/oe/exam/short_code,/api/mobile/authorization,/api/oe/black/list/select,/api/oe/sys/school/list,/api/oe/sys/upload/package/callback,/api/oe/sys/file/upload', enable=1, create_id=1, create_time=NULL, update_id=NULL, update_time=NULL, remark=NULL, sort=1, editor=0

+ 6 - 2
themis-business/src/main/resources/mapper/TEExamStudentMapper.xml

@@ -324,13 +324,17 @@
     </select>
 
     <update id="updateAlreadyExamCount">
-	update t_e_exam_student set already_exam_count=#{alreadyExamCount} where id=#{examStudentId} and (already_exam_count is null or already_exam_count <![CDATA[ < ]]> #{alreadyExamCount})
+	    update t_e_exam_student set already_exam_count = #{alreadyExamCount} where id = #{examStudentId}
 	</update>
 
     <update id="updateCurrentRecordId">
-	update t_e_exam_student set current_record_id=#{currentRecordId} where id=#{examStudentId} and (current_record_id is null or current_record_id <![CDATA[ < ]]> #{currentRecordId})
+	    update t_e_exam_student set current_record_id = #{currentRecordId} where id = #{examStudentId}
 	</update>
 
+    <update id="updateAlreadyExamCountAndCurrentRecordId">
+        update t_e_exam_student set current_record_id = #{currentRecordId},already_exam_count = #{alreadyExamCount} where id = #{examStudentId}
+    </update>
+
     <sql id="markResultCommon">
         select
         tees.id as examStudentId,

+ 1 - 0
themis-task/src/main/java/com/qmth/themis/task/quartz/ExamSummaryJob.java

@@ -114,6 +114,7 @@ public class ExamSummaryJob extends QuartzJobBean {
             orgExamIdMap.forEach((k, v) -> {
                 teOrgSummaryService.orgSummary(k, v);
             });
+            teOrgSummaryService.orgSummary(0L, null);
         }
     }
 }