Bladeren bron

BUG修复

wangliang 3 jaren geleden
bovenliggende
commit
130ec446c9

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskPrintServiceImpl.java

@@ -36,6 +36,7 @@ import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -77,6 +78,7 @@ public class ExamTaskPrintServiceImpl extends ServiceImpl<ExamTaskPrintMapper, E
     TBTaskService tbTaskService;
 
     @Autowired
+    @Lazy
     PrintCommonService printCommonService;
 
     @Resource

+ 0 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/TFFlowController.java

@@ -76,7 +76,6 @@ public class TFFlowController {
     @Resource
     TFFlowApproveLogService tfFlowApproveLogService;
 
-
     @ApiOperation(value = "注册流程")
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})

+ 1 - 1
distributed-print/src/main/java/com/qmth/distributed/print/auth/DistributedPrintAuthenticationService.java

@@ -118,7 +118,7 @@ public class DistributedPrintAuthenticationService implements AuthorizationServi
             return true;
         }
         //系统公用接口不拦截
-        List<String> sysUrls = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS);
+        List<String> sysUrls = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS, SystemConstant.getHeadOrUserSchoolId());
         int sysCount = Objects.nonNull(sysUrls) ? (int) sysUrls.stream().filter(s -> s.equalsIgnoreCase(path)).count() : 0;
         if (sysCount > 0) {
             return true;

+ 6 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/CommonCacheService.java

@@ -137,25 +137,28 @@ public interface CommonCacheService {
      * 获取鉴权url
      *
      * @param privilegePropertyEnum
+     * @param schoolId
      * @return
      */
-    public List<String> privilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum);
+    public List<String> privilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId);
 
     /**
      * 修改鉴权url
      *
      * @param privilegePropertyEnum
+     * @param schoolId
      * @return
      */
-    public List<String> updatePrivilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum);
+    public List<String> updatePrivilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId);
 
 
     /**
      * 删除鉴权url
      *
      * @param privilegePropertyEnum
+     * @param schoolId
      */
-    public void removePrivilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum);
+    public void removePrivilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId);
 
     /**
      * 添加角色权限缓存

+ 2 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/TeachcloudCommonService.java

@@ -91,9 +91,10 @@ public interface TeachcloudCommonService {
      * 获取鉴权url
      *
      * @param privilegePropertyEnum
+     * @param schoolId
      * @return
      */
-    public List<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum);
+    public List<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId);
 
     /**
      * 给学校赋予权限的公共方法(权限是否启用跟学校联动)

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

@@ -226,34 +226,37 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * 获取鉴权url
      *
      * @param privilegePropertyEnum
+     * @param schoolId
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0")
-    public List<String> privilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum) {
-        return commonService.getPrivilegeUrl(privilegePropertyEnum);
+    @Cacheable(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0 + '-' + #p1")
+    public List<String> privilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId) {
+        return commonService.getPrivilegeUrl(privilegePropertyEnum, schoolId);
     }
 
     /**
      * 修改鉴权url
      *
      * @param privilegePropertyEnum
+     * @param schoolId
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0")
-    public List<String> updatePrivilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum) {
-        return commonService.getPrivilegeUrl(privilegePropertyEnum);
+    @CachePut(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0 + '-' + #p1")
+    public List<String> updatePrivilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId) {
+        return commonService.getPrivilegeUrl(privilegePropertyEnum, schoolId);
     }
 
     /**
      * 删除鉴权url
      *
      * @param privilegePropertyEnum
+     * @param schoolId
      */
     @Override
-    @CacheEvict(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0")
-    public void removePrivilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum) {
+    @CacheEvict(value = SystemConstant.PRIVILEGE_URL_CACHE, key = "#p0 + '-' + #p1")
+    public void removePrivilegeUrlCache(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId) {
 
     }
 

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

@@ -298,14 +298,16 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
      * 获取鉴权url
      *
      * @param privilegePropertyEnum
+     * @param schoolId
      * @return
      */
     @Override
-    public List<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum) {
+    public List<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId) {
         QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
         sysPrivilegeQueryWrapper.lambda().eq(SysPrivilege::getType, PrivilegeEnum.URL)
                 .eq(SysPrivilege::getProperty, privilegePropertyEnum)
-                .eq(SysPrivilege::getEnable, true);
+                .eq(SysPrivilege::getEnable, true)
+                .eq(SysPrivilege::getSchoolId, schoolId);
         List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
         return Objects.nonNull(sysPrivilegeList) && sysPrivilegeList.size() > 0 ? sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toList()) : null;
     }

+ 2 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/AuthUtil.java

@@ -46,7 +46,7 @@ public class AuthUtil {
     public static boolean adminAuthInterceptor(HttpServletRequest request, HttpServletResponse response, Object handler) {
         String url = request.getServletPath();
         commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
-        List<String> privilegeUrl = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.NO_AUTH);
+        List<String> privilegeUrl = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.NO_AUTH, SystemConstant.getHeadOrUserSchoolId());
         //无需鉴权的url
         int noAuthCount = Objects.nonNull(privilegeUrl) ? (int) privilegeUrl.stream().filter(s -> s.equalsIgnoreCase(url)).count() : 0;
         if (noAuthCount > 0) {
@@ -159,7 +159,7 @@ public class AuthUtil {
             return true;
         }
         //系统公用接口不拦截
-        List<String> sysUrls = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS);
+        List<String> sysUrls = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS, SystemConstant.getHeadOrUserSchoolId());
         int sysCount = Objects.nonNull(sysUrls) ? (int) sysUrls.stream().filter(s -> s.equalsIgnoreCase(url)).count() : 0;
         if (sysCount > 0) {
             return true;

+ 1 - 1
teachcloud-report/src/main/java/com/qmth/teachcloud/report/auth/TeachcloudReportAuthenticationService.java

@@ -118,7 +118,7 @@ public class TeachcloudReportAuthenticationService implements AuthorizationServi
             return true;
         }
         //系统公用接口不拦截
-        List<String> sysUrls = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS);
+        List<String> sysUrls = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS, SystemConstant.getHeadOrUserSchoolId());
         int sysCount = Objects.nonNull(sysUrls) ? (int) sysUrls.stream().filter(s -> s.equalsIgnoreCase(path)).count() : 0;
         if (sysCount > 0) {
             return true;