Sfoglia il codice sorgente

Merge branch 'dev_v3.2.0' into release_v3.2.0
merge

wangliang 2 anni fa
parent
commit
7213913a46

+ 6 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/MenuCustomController.java

@@ -124,8 +124,12 @@ public class MenuCustomController {
         //清缓存
         if (!CollectionUtils.isEmpty(roleSetIds)) {
             for (Long l : roleSetIds) {
-                commonCacheService.updateRoleCache(l);
-                commonCacheService.updateRolePrivilegeCache(l);
+                if (Objects.isNull(commonCacheService.updateRoleCache(l))) {
+                    commonCacheService.removeRoleCache(l);
+                }
+                if (CollectionUtils.isEmpty(commonCacheService.updateRolePrivilegeCache(l))) {
+                    commonCacheService.removeRolePrivilegeCache(l);
+                }
                 //绑定该角色的用户都需要清除鉴权缓存
                 List<SysUserRole> sysUserRoleList = sysUserRoleService.listByRoleId(l);
                 for (SysUserRole s : sysUserRoleList) {

+ 3 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/AuthInfoServiceImpl.java

@@ -195,7 +195,9 @@ public class AuthInfoServiceImpl implements AuthInfoService {
             } else {
                 tsAuthList.add(new TSAuth(o.getId(), solarProperties.getAccessKey(), solarProperties.getAccessSecret(), authEnum, appInfo.getControl().getExpireTime()));
             }
-            commonCacheService.updateAuthInfoCache(o.getCode());
+            if (Objects.isNull(commonCacheService.updateAuthInfoCache(o.getCode()))) {
+                commonCacheService.removeAuthInfoCache(o.getCode());
+            }
 
             QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
             basicSchoolQueryWrapper.lambda().eq(BasicSchool::getCode, o.getCode());

+ 26 - 26
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/CommonCacheServiceImpl.java

@@ -63,7 +63,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.ROLE_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.ROLE_CACHE, key = "#p0", unless = "#result == null")
     public SysRole roleCache(Long roleId) {
         return sysRoleService.getById(roleId);
     }
@@ -75,7 +75,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.ROLE_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.ROLE_CACHE, key = "#p0", condition = "#result != null")
     public SysRole updateRoleCache(Long roleId) {
         return sysRoleService.getById(roleId);
     }
@@ -99,7 +99,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.USER_MENU_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.USER_MENU_CACHE, key = "#p0", unless = "#result == null")
     public MenuResult userMenuCache(Long userId) {
         return commonService.getUserMenu(userId);
     }
@@ -111,7 +111,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.USER_MENU_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.USER_MENU_CACHE, key = "#p0", condition = "#result != null")
     public MenuResult updateUserMenuCache(Long userId) {
         return commonService.getUserMenu(userId);
     }
@@ -134,7 +134,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0", unless = "#result == null")
     public SysUser userCache(Long userId) {
         return sysUserService.getById(userId);
     }
@@ -146,7 +146,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.USER_ACCOUNT_CACHE, key = "#p0", condition = "#result != null")
     public SysUser updateUserCache(Long userId) {
         return sysUserService.getById(userId);
     }
@@ -169,7 +169,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.USER_OAUTH_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.USER_OAUTH_CACHE, key = "#p0", unless = "#result == null")
     public AuthBean userAuthCache(Long userId) {
         return commonService.getUserAuth(userId);
     }
@@ -181,7 +181,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.USER_OAUTH_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.USER_OAUTH_CACHE, key = "#p0", condition = "#result != null")
     public AuthBean updateUserAuthCache(Long userId) {
         return commonService.getUserAuth(userId);
     }
@@ -204,7 +204,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.SCHOOL_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.SCHOOL_CACHE, key = "#p0", unless = "#result == null")
     public BasicSchool schoolCache(Long schoolId) {
         return basicSchoolService.getById(schoolId);
     }
@@ -216,7 +216,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.SCHOOL_CODE_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.SCHOOL_CODE_CACHE, key = "#p0", unless = "#result == null")
     public BasicSchool schoolCache(String code) {
         QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
         basicSchoolQueryWrapper.lambda().eq(BasicSchool::getCode, code);
@@ -230,7 +230,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.SCHOOL_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.SCHOOL_CACHE, key = "#p0", condition = "#result != null")
     public BasicSchool updateSchoolCache(Long schoolId) {
         return basicSchoolService.getById(schoolId);
     }
@@ -242,7 +242,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.SCHOOL_CODE_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.SCHOOL_CODE_CACHE, key = "#p0", condition = "#result != null")
     public BasicSchool updateSchoolCache(String code) {
         QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
         basicSchoolQueryWrapper.lambda().eq(BasicSchool::getCode, code);
@@ -296,7 +296,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.ORG_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.ORG_CACHE, key = "#p0", unless = "#result == null")
     public SysOrg orgCache(Long orgId) {
         return sysOrgService.getById(orgId);
     }
@@ -308,7 +308,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.ORG_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.ORG_CACHE, key = "#p0", condition = "#result != null")
     public SysOrg updateOrgCache(Long orgId) {
         return sysOrgService.getById(orgId);
     }
@@ -340,13 +340,13 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0", unless = "#result == null")
     public Set<String> privilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum) {
         return commonService.getPrivilegeUrl(privilegePropertyEnum);
     }
 
     @Override
-    @Cacheable(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0 + '-' + #p1")
+    @Cacheable(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0 + '-' + #p1", unless = "#result == null")
     public Set<String> privilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId) {
         return commonService.getPrivilegeUrl(privilegePropertyEnum, schoolId);
     }
@@ -358,7 +358,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0", condition = "#result != null")
     public Set<String> updatePrivilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum) {
         return commonService.getPrivilegeUrl(privilegePropertyEnum);
     }
@@ -381,7 +381,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.ROLE_PRIVILEGE_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.ROLE_PRIVILEGE_CACHE, key = "#p0", unless = "#result == null")
     public List<SysRolePrivilege> rolePrivilegeCache(Long roleId) {
         return commonService.getRolePrivilege(roleId);
     }
@@ -393,7 +393,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.ROLE_PRIVILEGE_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.ROLE_PRIVILEGE_CACHE, key = "#p0", condition = "#result != null")
     public List<SysRolePrivilege> updateRolePrivilegeCache(Long roleId) {
         return commonService.getRolePrivilege(roleId);
     }
@@ -416,7 +416,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.USER_ROLE_PRIVILEGE_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.USER_ROLE_PRIVILEGE_CACHE, key = "#p0", unless = "#result == null")
     public List<SysUserRole> userRolePrivilegeCache(Long userId) {
         return commonService.getUserRolePrivilege(userId);
     }
@@ -428,7 +428,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.USER_ROLE_PRIVILEGE_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.USER_ROLE_PRIVILEGE_CACHE, key = "#p0", condition = "#result != null")
     public List<SysUserRole> updateUserRolePrivilegeCache(Long userId) {
         return commonService.getUserRolePrivilege(userId);
     }
@@ -553,7 +553,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     }
 
     @Override
-    @CachePut(value = SystemConstant.AUTH_INFO_CACHE, key = "#p0", unless = "#result == null")
+    @CachePut(value = SystemConstant.AUTH_INFO_CACHE, key = "#p0", condition = "#result != null")
     public AuthOrgInfoDto updateAuthInfoCache(String code) {
         AppInfo appInfo = solarService.getAppInfo();
         AuthOrgInfoDto authOrgInfoDto = null;
@@ -591,7 +591,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", unless = "#result == null")
+    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", condition = "#result != null")
     public SysConfig updateSysConfigCache(String key) {
         return sysConfigService.getById(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getConfigKey, key));
     }
@@ -628,7 +628,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", unless = "#result != null")
+    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", condition = "#result != null")
     public SysConfig updateSysConfigCache(Long schoolId, String key) {
         return sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getSchoolId, schoolId).eq(SysConfig::getConfigKey, key));
     }
@@ -646,13 +646,13 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     }
 
     @Override
-    @Cacheable(value = SystemConstant.ORG_COLLEGE_LEVEL_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.ORG_COLLEGE_LEVEL_CACHE, key = "#p0", unless = "#result == null")
     public List<SysOrg> addOrgCollegeLevelCache(Long schoolId) {
         return sysOrgService.findCollegeLevelOrgList(schoolId);
     }
 
     @Override
-    @CachePut(value = SystemConstant.ORG_COLLEGE_LEVEL_CACHE, key = "#p0")
+    @CachePut(value = SystemConstant.ORG_COLLEGE_LEVEL_CACHE, key = "#p0", condition = "#result != null")
     public List<SysOrg> updateOrgCollegeLevelCache(Long schoolId) {
         return sysOrgService.findCollegeLevelOrgList(schoolId);
     }

+ 6 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysOrgServiceImpl.java

@@ -127,7 +127,9 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
                 org.updateInfo(sysUser.getId());
                 success = this.updateById(org);
             }
-            commonCacheService.updateOrgCollegeLevelCache(schoolId);
+            if(Objects.isNull(commonCacheService.updateOrgCollegeLevelCache(schoolId))){
+                commonCacheService.removeOrgCollegeLevelCache(schoolId);
+            }
         } catch (Exception e) {
             if (e instanceof DuplicateKeyException) {
                 String errorColumn = e.getCause().toString();
@@ -395,7 +397,9 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
                 }
             }
         }
-        commonCacheService.updateOrgCollegeLevelCache(requestUser.getSchoolId());
+        if(Objects.isNull(commonCacheService.updateOrgCollegeLevelCache(requestUser.getSchoolId()))){
+            commonCacheService.removeOrgCollegeLevelCache(requestUser.getSchoolId());
+        }
         return map;
     }
 

+ 2 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysPrivilegeServiceImpl.java

@@ -318,7 +318,7 @@ public class SysPrivilegeServiceImpl extends ServiceImpl<SysPrivilegeMapper, Sys
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.CUSTOM_PRIVILEGE_CACHE)
+    @Cacheable(value = SystemConstant.CUSTOM_PRIVILEGE_CACHE, unless = "#result == null")
     public List<PrivilegeDto> addCustomList() {
         return this.commonCustomList();
     }
@@ -329,7 +329,7 @@ public class SysPrivilegeServiceImpl extends ServiceImpl<SysPrivilegeMapper, Sys
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.CUSTOM_PRIVILEGE_CACHE, unless = "#result == null")
+    @CachePut(value = SystemConstant.CUSTOM_PRIVILEGE_CACHE, condition = "#result != null")
     public List<PrivilegeDto> updateCustomList() {
         return this.commonCustomList();
     }

+ 19 - 6
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysRoleServiceImpl.java

@@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.security.NoSuchAlgorithmException;
@@ -114,11 +115,15 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
                 int count = (int) sysRolePrivilegeList.stream().filter(s -> relatedList.contains(s.getPrivilegeId())).count();
                 role.updateInfo(sysUser.getId());
                 sysRoleService.updateById(role);
-                commonCacheService.updateRoleCache(role.getId());
+                if (Objects.isNull(commonCacheService.updateRoleCache(role.getId()))) {
+                    commonCacheService.removeRoleCache(role.getId());
+                }
                 if (count != sysRolePrivilegeList.size() || count != finalRelatedSet.size()) {
                     sysRolePrivilegeService.removeByRoleId(role.getId());
                     sysRolePrivilegeService.saveBatch(role);//角色权限
-                    commonCacheService.updateRolePrivilegeCache(role.getId());
+                    if (CollectionUtils.isEmpty(commonCacheService.updateRolePrivilegeCache(role.getId()))) {
+                        commonCacheService.removeRolePrivilegeCache(role.getId());
+                    }
                     //绑定该角色的用户都需要清除鉴权缓存
                     List<SysUserRole> sysUserRoleList = sysUserRoleService.listByRoleId(role.getId());
                     commonService.removeUserInfoBatch(sysUserRoleList.stream().map(SysUserRole::getUserId).collect(Collectors.toList()), true);
@@ -186,12 +191,16 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
                 int count = (int) sysRolePrivilegeList.stream().filter(s -> relatedList.contains(s.getPrivilegeId())).count();
                 role.updateInfo(sysUser.getId());
                 sysRoleService.updateById(role);
-                commonCacheService.updateRoleCache(role.getId());
+                if (Objects.isNull(commonCacheService.updateRoleCache(role.getId()))) {
+                    commonCacheService.removeRoleCache(role.getId());
+                }
                 if (count != sysRolePrivilegeList.size() || count != finalRelatedSet.size()) {
                     // 删除权限前先更新涉及特殊权限用户 -> 需要重新同步
                     sysRolePrivilegeService.removeByRoleId(role.getId());
                     sysRolePrivilegeService.saveBatch(role);//角色权限
-                    commonCacheService.updateRolePrivilegeCache(role.getId());
+                    if (CollectionUtils.isEmpty(commonCacheService.updateRolePrivilegeCache(role.getId()))) {
+                        commonCacheService.removeRolePrivilegeCache(role.getId());
+                    }
                     //绑定该角色的用户都需要清除鉴权缓存
                     List<SysUserRole> sysUserRoleList = sysUserRoleService.listByRoleId(role.getId());
                     commonService.removeUserInfoBatch(sysUserRoleList.stream().map(s -> s.getUserId()).collect(Collectors.toList()), true);
@@ -226,7 +235,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
                 .set(SysRoleGroupMember::getEnable, role.getEnable());
         sysRoleGroupMemberService.update(sysRoleGroupMemberUpdateWrapper);
 
-        commonCacheService.updateRoleCache(role.getId());
+        if (Objects.isNull(commonCacheService.updateRoleCache(role.getId()))) {
+            commonCacheService.removeRoleCache(role.getId());
+        }
         //如果状态为禁用,需要踢下线重新登录
         if (!role.getEnable()) {
             List<SysUserRole> sysUserRoleList = sysUserRoleService.listByRoleId(role.getId());
@@ -243,7 +254,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
         updateWrapper.lambda().set(SysRole::getEnable, role.getEnable()).eq(SysRole::getId, role.getId());
         this.update(updateWrapper);
 
-        commonCacheService.updateRoleCache(role.getId());
+        if (Objects.isNull(commonCacheService.updateRoleCache(role.getId()))) {
+            commonCacheService.removeRoleCache(role.getId());
+        }
         //如果状态为禁用,需要踢下线重新登录
         if (!role.getEnable()) {
             List<SysUserRole> sysUserRoleList = sysUserRoleService.listByRoleId(role.getId());

+ 15 - 5
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java

@@ -161,7 +161,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     public boolean enable(SysUser user) throws NoSuchAlgorithmException, IllegalAccessException {
         UpdateWrapper<SysUser> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().set(SysUser::getEnable, user.getEnable()).eq(SysUser::getId, user.getId());
-        commonCacheService.updateUserCache(user.getId());
+        if (Objects.isNull(commonCacheService.updateUserCache(user.getId()))) {
+            commonCacheService.removeUserCache(user.getId());
+        }
         boolean success = this.update(updateWrapper);
         //如果状态为禁用,需要踢下线重新登录
         if (!user.getEnable()) {
@@ -554,8 +556,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 if (Objects.nonNull(dbUser.getOrgId())) {
                     if (dbUser.getOrgId().longValue() != sysUser.getOrgId().longValue()
                             || !Objects.equals(dbUser.getMobileNumber(), sysUser.getMobileNumber())) {
-                        commonCacheService.updateUserCache(sysUser.getId());
-                        commonCacheService.updateUserAuthCache(sysUser.getId());
+                        if (Objects.isNull(commonCacheService.updateUserCache(sysUser.getId()))) {
+                            commonCacheService.removeUserCache(sysUser.getId());
+                        }
+                        if (Objects.isNull(commonCacheService.updateUserAuthCache(sysUser.getId()))) {
+                            commonCacheService.removeUserAuthCache(sysUser.getId());
+                        }
                     }
                 }
 
@@ -646,8 +652,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 if (Objects.nonNull(dbUser.getOrgId())) {
                     if (containsQuestionTeacher || dbUser.getOrgId().longValue() != sysUser.getOrgId().longValue()
                             || !Objects.equals(dbUser.getMobileNumber(), sysUser.getMobileNumber())) {
-                        commonCacheService.updateUserCache(sysUser.getId());
-                        commonCacheService.updateUserAuthCache(sysUser.getId());
+                        if (Objects.isNull(commonCacheService.updateUserCache(sysUser.getId()))) {
+                            commonCacheService.removeUserCache(sysUser.getId());
+                        }
+                        if (Objects.isNull(commonCacheService.updateUserAuthCache(sysUser.getId()))) {
+                            commonCacheService.removeUserAuthCache(sysUser.getId());
+                        }
                     }
                 }
             }

+ 1 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/CourseReportServiceImpl.java

@@ -24,7 +24,7 @@ public class CourseReportServiceImpl implements CourseReportService {
     private CourseReportMapper courseReportMapper;
 
     @Override
-    @Cacheable(value = SystemConstant.COLLEGE_DEAN_REPORT, key = "#schoolId + '-' + #semesterId + '-' + #examId + '-' +#collegeId")
+    @Cacheable(value = SystemConstant.COLLEGE_DEAN_REPORT, key = "#schoolId + '-' + #semesterId + '-' + #examId + '-' +#collegeId", unless = "#result == null")
     public InspectCourseTotalReportResult findInfoInspectCourseExamTotal(Long schoolId, Long semesterId, Long examId, Long collegeId) {
 
         // 考试总览数据

+ 2 - 2
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseServiceImpl.java

@@ -146,7 +146,7 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.COLLEGE_COURSE_REPORT, key = "#schoolId + '-' + #semesterId + '-' + #examId + '-' + #courseCode + '-' + #collegeId")
+    @Cacheable(value = SystemConstant.COLLEGE_COURSE_REPORT, key = "#schoolId + '-' + #semesterId + '-' + #examId + '-' + #courseCode + '-' + #collegeId", unless = "#result == null")
     public CollegeAndCourseResult surveyInspectAnalyseView(Long schoolId, Long semesterId, Long examId, String courseCode, Long collegeId) {
         //学院学科报表查询科目信息
         CourseInfoResult courseInfoResult = reportCommonService.findCourseInfo(examId, courseCode, collegeId);
@@ -176,7 +176,7 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.SURVEY_TEACHER_VIEW_REPORT, key = "#schoolId + '-' + #semesterId + '-' + #examId + '-' + #courseCode + '-' + #collegeId")
+    @Cacheable(value = SystemConstant.SURVEY_TEACHER_VIEW_REPORT, key = "#schoolId + '-' + #semesterId + '-' + #examId + '-' + #courseCode + '-' + #collegeId", unless = "#result == null")
     public SurveyTeacherViewResult surveyTeacherView(Long schoolId, Long semesterId, Long examId, String courseCode, Long collegeId) {
         // 考试概况
         TeachCourseSurveyResult teachCourseSurveyResult = reportCommonService.getTeachCourseSurveyInfo(semesterId, examId, courseCode);

+ 1 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamStudentServiceImpl.java

@@ -348,7 +348,7 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
     }
 
     @Override
-    @Cacheable(value = SystemConstant.EXAM_STUDENT_REPORT, key = "#schoolId + '-' + #studentCode + '-' + #examId + '-' + #courseCode")
+    @Cacheable(value = SystemConstant.EXAM_STUDENT_REPORT, key = "#schoolId + '-' + #studentCode + '-' + #examId + '-' + #courseCode", unless = "#result == null")
     public PersonalReportResult reportMark(Long schoolId, String studentCode, String examId, String courseCode) {
         if (schoolId == null) {
             schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());