From 8546b3d285af4235a0ef615a0c6e89486ae2c806 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 17 十月 2024 21:01:37 +0800
Subject: [PATCH] 达梦不支持value改为values

---
 src/main/java/com/ycl/jxkg/job/StudyRecordJob.java |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/ycl/jxkg/job/StudyRecordJob.java b/src/main/java/com/ycl/jxkg/job/StudyRecordJob.java
index ee588fc..c901abd 100644
--- a/src/main/java/com/ycl/jxkg/job/StudyRecordJob.java
+++ b/src/main/java/com/ycl/jxkg/job/StudyRecordJob.java
@@ -38,30 +38,31 @@
         log.info("寮�濮嬪瓨瀛︿範鏃堕暱");
         List<StudyRecord> cacheList = new ArrayList<>();
         // 鍙栧嚭鎵�鏈夊涔犺褰曠紦瀛橀」
-        ConcurrentMap<String, Object> map = caffeineCache.asMap();
-        Map<String,StudyRecord> studyMap = (Map<String, StudyRecord>) map.get(CaffeineConstant.STUDY_RECORD);
-        for (Map.Entry<String, StudyRecord> entry : studyMap.entrySet()) {
-            cacheList.add(entry.getValue());
-        }
+        Map<String, StudyRecord> studyMap = (Map<String, StudyRecord>) caffeineCache.getIfPresent(CaffeineConstant.STUDY_RECORD);
+        if (!CollectionUtils.isEmpty(studyMap)) {
+            for (Map.Entry<String, StudyRecord> entry : studyMap.entrySet()) {
+                cacheList.add(entry.getValue());
+            }
 
-        List<Integer> studentIds = cacheList.stream().map(StudyRecord::getStudentId).collect(Collectors.toList());
-        if (!CollectionUtils.isEmpty(studentIds)) {
-            //鏁版嵁搴撲腑宸茬粡瀛樺湪鐨勫鐢熸暟鎹�
-            QueryWrapper<StudyRecord> wrapper = new QueryWrapper<>();
-            wrapper.in("student_id", studentIds);
-            List<StudyRecord> studyRecords = studyRecordMapper.selectList(wrapper);
-            for (StudyRecord record : studyRecords) {
-                for (StudyRecord cacheRecord : cacheList) {
-                    if (record.getStudentId().equals(cacheRecord.getStudentId())) {
-                        cacheRecord.setId(record.getId());
-                        cacheRecord.setStudyTime(record.getStudyTime() + cacheRecord.getStudyTime());
-                        cacheRecord.setMeetCount(record.getMeetCount());
+            List<Integer> studentIds = cacheList.stream().map(StudyRecord::getStudentId).collect(Collectors.toList());
+            if (!CollectionUtils.isEmpty(studentIds)) {
+                //鏁版嵁搴撲腑宸茬粡瀛樺湪鐨勫鐢熸暟鎹�
+                QueryWrapper<StudyRecord> wrapper = new QueryWrapper<>();
+                wrapper.in("student_id", studentIds);
+                List<StudyRecord> studyRecords = studyRecordMapper.selectList(wrapper);
+                for (StudyRecord record : studyRecords) {
+                    for (StudyRecord cacheRecord : cacheList) {
+                        if (record.getStudentId().equals(cacheRecord.getStudentId())) {
+                            cacheRecord.setId(record.getId());
+                            cacheRecord.setStudyTime(record.getStudyTime() + cacheRecord.getStudyTime());
+                            cacheRecord.setMeetCount(record.getMeetCount());
+                        }
                     }
                 }
+                studyRecordService.saveOrUpdateBatch(cacheList);
             }
-            studyRecordService.saveOrUpdateBatch(cacheList);
+            caffeineCache.invalidate(CaffeineConstant.STUDY_RECORD);
         }
-        caffeineCache.invalidate(CaffeineConstant.STUDY_RECORD);
         log.info("缁撴潫瀛樺涔犳椂闀�");
     }
 }

--
Gitblit v1.8.0