Browse Source

增加超管统计

wangliang 1 year ago
parent
commit
148d35abbf

+ 6 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TEOrgSummaryMapper.java

@@ -76,4 +76,10 @@ public interface TEOrgSummaryMapper extends BaseMapper<TEOrgSummary> {
      */
     int selectOrgSummaryCount(@Param("orgId") Long orgId);
 
+    /**
+     * 更新全局机构考试完成数量和考生完成数量
+     *
+     * @param finishStudentCount
+     */
+    public void updateOrgZeroSummary(@Param("finishStudentCount") Integer finishStudentCount);
 }

+ 7 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TEOrgSummaryService.java

@@ -29,4 +29,11 @@ public interface TEOrgSummaryService extends IService<TEOrgSummary> {
      * @param teOrgSummary
      */
     public void saveOrgSummaryCommon(TEOrgSummary teOrgSummary);
+
+    /**
+     * 更新全局机构考试完成数量和考生完成数量
+     *
+     * @param finishStudentCount
+     */
+    public void updateOrgZeroSummary(Integer finishStudentCount);
 }

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

@@ -119,4 +119,15 @@ public class TEOrgSummaryServiceImpl extends ServiceImpl<TEOrgSummaryMapper, TEO
                 .add(teOrgSummary.getFinishStudentCount() + "");
         this.baseMapper.saveOrgSummary(stringJoinerFieldName.toString(), stringJoinerFieldValue.toString());
     }
+
+    /**
+     * 更新全局机构考试完成数量和考生完成数量
+     *
+     * @param finishStudentCount
+     */
+    @Override
+    @Transactional
+    public void updateOrgZeroSummary(Integer finishStudentCount) {
+        this.baseMapper.updateOrgZeroSummary(finishStudentCount);
+    }
 }

+ 15 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -107,6 +107,12 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
 //    @Resource
 //    TOeExamRecordService tOeExamRecordService;
 
+    @Resource
+    TEOrgSummaryService teOrgSummaryService;
+
+    @Resource
+    ThemisCacheService themisCacheService;
+
     @Transactional
     @Override
     public Long saveByPrepare(Long examId, Long examActivityId, Long examStudentId, Long paperId,
@@ -416,6 +422,15 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
             }
             //更新考生信息
             teExamStudentService.updateExamStudentByCache(er.getExamStudentId());
+            ExamStudentCacheBean examStudentCache = (ExamStudentCacheBean) redisUtil.get(RedisKeyHelper.examStudentCacheKey(er.getExamStudentId()));
+            if (Objects.nonNull(examStudentCache.getAlreadyExamCount()) &&
+                    examStudentCache.getAlreadyExamCount().longValue() == 1) {
+                teOrgSummaryService.updateOrgZeroSummary(1);
+            } else {
+                teOrgSummaryService.updateOrgZeroSummary(0);
+            }
+            themisCacheService.updateOrgSummaryCache(0L);
+
             //上传个人试卷结构
             if (Objects.nonNull(struct)) {
                 ossUtil.upload(false, structFilePath, struct.getContent());

+ 4 - 0
themis-business/src/main/resources/mapper/TEOrgSummaryMapper.xml

@@ -85,4 +85,8 @@
             </if>
         </where>
     </select>
+
+    <update id="updateOrgZeroSummary">
+        update t_e_org_summary set finish_count = finish_count + 1,finish_student_count = finish_student_count + #{finishStudentCount} where org_id = 0
+    </update>
 </mapper>