Sfoglia il codice sorgente

快速开发框架升级至1.0.1

wangliang 3 anni fa
parent
commit
70c9eb4ea2
29 ha cambiato i file con 135 aggiunte e 164 eliminazioni
  1. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlow.java
  2. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlowApprove.java
  3. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlowApproveLog.java
  4. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlowLog.java
  5. 6 6
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicMessageServiceImpl.java
  6. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java
  7. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  8. 3 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java
  9. 11 0
      distributed-print/src/main/java/com/qmth/distributed/print/DistributedPrintApplication.java
  10. 3 4
      distributed-print/src/main/java/com/qmth/distributed/print/api/ClientController.java
  11. 4 5
      distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java
  12. 5 5
      distributed-print/src/main/java/com/qmth/distributed/print/auth/DistributedPrintAuthenticationService.java
  13. 4 6
      distributed-print/src/main/resources/application-dev.properties
  14. 2 2
      pom.xml
  15. 1 1
      teachcloud-common/pom.xml
  16. 1 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/CommonCacheService.java
  17. 3 17
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/CommonCacheServiceImpl.java
  18. 9 10
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysRoleServiceImpl.java
  19. 4 14
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserRoleServiceImpl.java
  20. 14 14
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java
  21. 20 22
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java
  22. 7 9
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/AuthUtil.java
  23. 1 1
      teachcloud-report-business/pom.xml
  24. 3 5
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamCourseServiceImpl.java
  25. 3 5
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamStudentServiceImpl.java
  26. 6 6
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/templete/execute/AsyncDataCalculateTempleteService.java
  27. 7 8
      teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/SysController.java
  28. 3 3
      teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/WudaOpenApiController.java
  29. 5 5
      teachcloud-report/src/main/java/com/qmth/teachcloud/report/auth/TeachcloudReportAuthenticationService.java

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlow.java

@@ -52,7 +52,7 @@ public class TFFlow extends BaseEntity implements Serializable {
     public TFFlow(Long schoolId, Long orgId, String name, Long userId, String flowKey) {
         setId(SystemConstant.getDbUuid());
         this.schoolId = schoolId;
-//        this.orgId = orgId;
+        this.orgId = orgId;
         this.name = name;
         this.flowKey = flowKey;
         setCreateId(userId);

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlowApprove.java

@@ -58,7 +58,7 @@ public class TFFlowApprove extends BaseEntity implements Serializable {
     public TFFlowApprove(Long schoolId, Long orgId, Long flowId, Long approveId, FlowStatusEnum status, Long userId) {
         setId(SystemConstant.getDbUuid());
         this.schoolId = schoolId;
-//        this.orgId = orgId;
+        this.orgId = orgId;
         this.flowId = flowId;
         this.approveId = approveId;
         this.status = status;

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlowApproveLog.java

@@ -79,7 +79,7 @@ public class TFFlowApproveLog extends BaseEntity implements Serializable {
     public TFFlowApproveLog(Long schoolId, Long orgId, Long flowId, Long taskId, Long startId, Long userId) {
         setId(SystemConstant.getDbUuid());
         this.schoolId = schoolId;
-//        this.orgId = orgId;
+        this.orgId = orgId;
         this.flowId = flowId;
         this.taskId = taskId;
         this.startId = startId;

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TFFlowLog.java

@@ -65,7 +65,7 @@ public class TFFlowLog extends BaseEntity implements Serializable {
     public TFFlowLog(Long schoolId, Long orgId, Long flowId, Long taskId, Long approveId, Long userId, String approveRemark) {
         setId(SystemConstant.getDbUuid());
         this.schoolId = schoolId;
-//        this.orgId = orgId;
+        this.orgId = orgId;
         this.flowId = flowId;
         this.approveId = approveId;
         this.taskId = taskId;

+ 6 - 6
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicMessageServiceImpl.java

@@ -23,7 +23,7 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.SysConfig;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.SysConfigService;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -46,7 +46,7 @@ public class BasicMessageServiceImpl extends ServiceImpl<BasicMessageMapper, Bas
     @Resource
     private DictionaryConfig dictionaryConfig;
     @Resource
-    private CacheService cacheService;
+    private CommonCacheService commonCacheService;
 
     @Transactional(rollbackFor = Exception.class)
     @Override
@@ -166,7 +166,7 @@ public class BasicMessageServiceImpl extends ServiceImpl<BasicMessageMapper, Bas
                 String paperNumber = examTask.getPaperNumber();
                 // 获取短信接收对象的信息
                 Long userId = examTask.getUserId();
-                SysUser user = cacheService.userCache(userId);
+                SysUser user = commonCacheService.userCache(userId);
                 if (Objects.nonNull(user)) {
                     String userName = user.getRealName();
                     String mobileNumber = user.getMobileNumber();
@@ -196,7 +196,7 @@ public class BasicMessageServiceImpl extends ServiceImpl<BasicMessageMapper, Bas
         for (Map.Entry<Long, List<String>> longListEntry : collects.entrySet()) {
             Long userId = longListEntry.getKey();
             List<String> ids = longListEntry.getValue();
-            SysUser user = cacheService.userCache(userId);
+            SysUser user = commonCacheService.userCache(userId);
             if (Objects.nonNull(user)) {
                 String userName = user.getRealName();
                 String mobileNumber = user.getMobileNumber();
@@ -216,7 +216,7 @@ public class BasicMessageServiceImpl extends ServiceImpl<BasicMessageMapper, Bas
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         // 考务老师(命题任务创建人)
         Long userId = examTask.getCreateId();
-        SysUser user = cacheService.userCache(userId);
+        SysUser user = commonCacheService.userCache(userId);
         if (Objects.nonNull(user)) {
             String userName = user.getRealName();
             String mobileNumber = user.getMobileNumber();
@@ -234,7 +234,7 @@ public class BasicMessageServiceImpl extends ServiceImpl<BasicMessageMapper, Bas
     @Override
     public void sendNoticeExpireOrOverdue(MessageEnum messageType, Long userId, List<String> ids) {
         // 考务老师(命题任务创建人)
-        SysUser user = cacheService.userCache(userId);
+        SysUser user = commonCacheService.userCache(userId);
         if (Objects.nonNull(user)) {
             String userName = user.getRealName();
             String mobileNumber = user.getMobileNumber();

+ 3 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java

@@ -20,7 +20,7 @@ import com.qmth.teachcloud.common.entity.SysConfig;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.TaskResultEnum;
 import com.qmth.teachcloud.common.enums.TaskStatusEnum;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.SysConfigService;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.codec.digest.DigestUtils;
@@ -55,7 +55,7 @@ public class DataSyncServiceImpl implements DataSyncService {
     private DictionaryConfig dictionaryConfig;
 
     @Autowired
-    private CacheService cacheService;
+    private CommonCacheService commonCacheService;
 
     @Autowired
     private ExamStudentService examStudentService;
@@ -379,7 +379,7 @@ public class DataSyncServiceImpl implements DataSyncService {
      * @return
      */
     private String createSign(Long schoolId, long time, String url) {
-        BasicSchool basicSchool = cacheService.schoolCache(schoolId);
+        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
         if (basicSchool == null) {
             throw ExceptionResultEnum.ERROR.exception("学校不存在");
         } else {

+ 3 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -26,7 +26,7 @@ import com.qmth.teachcloud.common.entity.TBTask;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.TaskTypeEnum;
 import com.qmth.teachcloud.common.service.BasicAttachmentService;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.TBTaskService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.ConvertUtil;
@@ -67,7 +67,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
     @Resource
     private ExamDetailMapper examDetailMapper;
     @Resource
-    private CacheService cacheService;
+    private CommonCacheService commonCacheService;
     @Resource
     private ExamStudentService examStudentService;
     @Resource
@@ -197,7 +197,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
         String fileName = "考务数据模板";
         response.setHeader("Content-Disposition", "inline;filename=" + URLEncoder.encode(fileName, SystemConstant.CHARSET_NAME) + DEFALUT_EXT);
         response.setContentType(DEFALUT_CONTENT_TYPE);
-        XSSFSheet sheet = wb.createSheet(cacheService.schoolCache(schoolId).getName() + "考务数据模板");
+        XSSFSheet sheet = wb.createSheet(commonCacheService.schoolCache(schoolId).getName() + "考务数据模板");
 
         XSSFFont font = wb.createFont();
         font.setFontHeightInPoints((short) 11);

+ 3 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -55,14 +55,12 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.FileCopyUtils;
 import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.io.*;
 import java.lang.reflect.Field;
 import java.time.LocalDateTime;
 import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -111,7 +109,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     OssUtil ossUtil;
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Resource
     BasicCourseService basicCourseService;
@@ -440,7 +438,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 throw ExceptionResultEnum.EXAM_PRINT_IS_NULL.exception();
             }
 
-            BasicSchool basicSchool = cacheService.schoolCache(examPrintPlan.getSchoolId());
+            BasicSchool basicSchool = commonCacheService.schoolCache(examPrintPlan.getSchoolId());
             BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId(schoolId);
             if (Objects.isNull(basicExamRule)) {
                 throw ExceptionResultEnum.EXAM_RULE_IS_NULL.exception();
@@ -980,7 +978,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     public Map<String, Object> executeExportPaperAndCardLogic(Map<String, Object> map) throws IOException {
         TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
         String yyyyMMddHH24mmss = DateUtil.format(new Date(), "yyyyMMddHHmmss");
-        BasicSchool basicSchool = cacheService.schoolCache(tbTask.getSchoolId());
+        BasicSchool basicSchool = commonCacheService.schoolCache(tbTask.getSchoolId());
         LocalDateTime nowTime = LocalDateTime.now();
         StringJoiner zipJoiner = new StringJoiner("")
                 .add(SystemConstant.TEMP_FILES_DIR).add(File.separator);

+ 11 - 0
distributed-print/src/main/java/com/qmth/distributed/print/DistributedPrintApplication.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print;
 
 import com.qmth.boot.core.security.service.CustomizeAuthorizationService;
 import com.qmth.distributed.print.auth.DistributedPrintAuthenticationService;
+import com.qmth.teachcloud.common.threadPool.MyThreadPool;
 import org.activiti.spring.boot.SecurityAutoConfiguration;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
@@ -9,7 +10,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.domain.EntityScan;
 import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.task.TaskExecutor;
 import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 import javax.annotation.Resource;
@@ -37,4 +41,11 @@ public class DistributedPrintApplication {
             registration.setDefault(distributedPrintAuthenticationService);
         };
     }
+
+    @Primary
+    @Bean
+    public TaskExecutor primaryTaskExecutor() {
+        return new MyThreadPool();
+    }
+
 }

+ 3 - 4
distributed-print/src/main/java/com/qmth/distributed/print/api/ClientController.java

@@ -14,8 +14,7 @@ import com.qmth.teachcloud.common.entity.BasicSchool;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.AppSourceEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.enums.RoleTypeEnum;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.SysUserService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.Result;
@@ -50,7 +49,7 @@ public class ClientController {
     SysUserService sysUserService;
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Resource
     TeachcloudCommonService teachcloudCommonService;
@@ -70,7 +69,7 @@ public class ClientController {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
 
-        BasicSchool basicSchool = cacheService.schoolCache(login.getSchoolCode());
+        BasicSchool basicSchool = commonCacheService.schoolCache(login.getSchoolCode());
         if (Objects.isNull(basicSchool)) {
             throw ExceptionResultEnum.SCHOOL_NO_DATA.exception();
         }

+ 4 - 5
distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java

@@ -37,7 +37,6 @@ import javax.annotation.Resource;
 import javax.validation.Valid;
 import java.security.NoSuchAlgorithmException;
 import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * @Date: 2021/3/30.
@@ -58,7 +57,7 @@ public class SysController {
     private DictionaryConfig dictionaryConfig;
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Resource
     PrintCommonService printCommonService;
@@ -98,7 +97,7 @@ public class SysController {
 
         BasicSchool basicSchool = null;
         if (!login.getSchoolCode().equalsIgnoreCase(SystemConstant.ADMIN_CODE)) {
-            basicSchool = cacheService.schoolCache(login.getSchoolCode());
+            basicSchool = commonCacheService.schoolCache(login.getSchoolCode());
             if (Objects.isNull(basicSchool)) {
                 throw ExceptionResultEnum.SCHOOL_NO_DATA.exception();
             }
@@ -184,7 +183,7 @@ public class SysController {
         String password = loginParam.getPassword();
         QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
         if (StringUtils.isNotBlank(loginParam.getSchoolCode())) {
-            BasicSchool basicSchool = cacheService.schoolCache(loginParam.getSchoolCode());
+            BasicSchool basicSchool = commonCacheService.schoolCache(loginParam.getSchoolCode());
             wrapper.lambda().eq(SysUser::getSchoolId, basicSchool.getId());
         }
         wrapper.lambda().eq(SysUser::getLoginName, loginName);
@@ -210,7 +209,7 @@ public class SysController {
     @Aac(auth = BOOL.FALSE)
     public Result queryBySchoolCode(@ApiParam(value = "机构code", required = true) @RequestParam String code) {
         if (!code.equalsIgnoreCase(SystemConstant.ADMIN_CODE)) {
-            BasicSchool basicSchool = cacheService.schoolCache(code);
+            BasicSchool basicSchool = commonCacheService.schoolCache(code);
             if (Objects.isNull(basicSchool)) {
                 throw ExceptionResultEnum.SCHOOL_NO_DATA.exception();
             }

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

@@ -12,7 +12,7 @@ import com.qmth.teachcloud.common.entity.TBSession;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.PrivilegePropertyEnum;
 import com.qmth.teachcloud.common.enums.RoleTypeEnum;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.slf4j.Logger;
@@ -31,7 +31,7 @@ public class DistributedPrintAuthenticationService implements AuthorizationServi
     private final static Logger log = LoggerFactory.getLogger(DistributedPrintAuthenticationService.class);
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Resource
     RedisUtil redisUtil;
@@ -67,7 +67,7 @@ public class DistributedPrintAuthenticationService implements AuthorizationServi
                 throw ExceptionResultEnum.AUTHORIZATION_ERROR.exception();
             }
             Long userId = Long.parseLong(tbSession.getIdentity());
-            SysUser sysUser = cacheService.userCache(userId);
+            SysUser sysUser = commonCacheService.userCache(userId);
             HttpServletRequest request = ServletUtil.getRequest();
             HttpServletResponse response = ServletUtil.getResponse();
             request.setAttribute(SystemConstant.SESSION, tbSession);
@@ -105,7 +105,7 @@ public class DistributedPrintAuthenticationService implements AuthorizationServi
                                   HttpServletRequest request,
                                   HttpServletResponse response) {
         //验证权限
-        AuthBean authBean = type.contains(SystemConstant.USER_OAUTH_CACHE) ? authBean = cacheService.userAuthCache(userId) : null;
+        AuthBean authBean = type.contains(SystemConstant.USER_OAUTH_CACHE) ? authBean = commonCacheService.userAuthCache(userId) : null;
         if (Objects.isNull(authBean)) {
             throw ExceptionResultEnum.ROLE_ENABLE_AUTHORIZATION.exception();
         }
@@ -118,7 +118,7 @@ public class DistributedPrintAuthenticationService implements AuthorizationServi
             return true;
         }
         //系统公用接口不拦截
-        List<String> sysUrls = cacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS);
+        List<String> sysUrls = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS);
         int sysCount = Objects.nonNull(sysUrls) ? (int) sysUrls.stream().filter(s -> s.equalsIgnoreCase(path)).count() : 0;
         if (sysCount > 0) {
             return true;

+ 4 - 6
distributed-print/src/main/resources/application-dev.properties

@@ -23,12 +23,10 @@ com.qmth.redis.db=15
 #com.qmth.redis.password=
 
 #mysql\u914D\u7F6E
-com.qmth.mysql.url=jdbc:mysql://${db.host}:${db.port}/${db.name}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
-com.qmth.mysql.username=${db.username}
-com.qmth.mysql.password=${db.password}
-com.qmth.mysql.min-idle=40
-com.qmth.mysql.max-pool-size=200
-com.qmth.mysql.log-level=debug
+com.qmth.datasource.url=jdbc:mysql://${db.host}:${db.port}/${db.name}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
+com.qmth.datasource.username=${db.username}
+com.qmth.datasource.password=${db.password}
+com.qmth.mybatis.log-level=debug
 
 #activiti\u914D\u7F6E
 #activiti\u4F1A\u5BF9\u6570\u636E\u5E93\u4E2D\u6240\u6709\u8868\u8FDB\u884C\u66F4\u65B0\u64CD\u4F5C\u3002\u5982\u679C\u8868\u4E0D\u5B58\u5728\uFF0C\u5219\u81EA\u52A8\u521B\u5EFA

+ 2 - 2
pom.xml

@@ -22,7 +22,7 @@
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
-        <qmth.boot.version>1.0.0</qmth.boot.version>
+        <qmth.boot.version>1.0.1</qmth.boot.version>
         <java.version>1.8</java.version>
         <swagger2.version>2.9.2</swagger2.version>
         <fastjson.version>1.2.68</fastjson.version>
@@ -116,7 +116,7 @@
             </dependency>
             <dependency>
                 <groupId>com.qmth.boot</groupId>
-                <artifactId>data-mysql-mp</artifactId>
+                <artifactId>data-mybatis-plus</artifactId>
                 <version>${qmth.boot.version}</version>
             </dependency>
             <dependency>

+ 1 - 1
teachcloud-common/pom.xml

@@ -76,7 +76,7 @@
         </dependency>
         <dependency>
             <groupId>com.qmth.boot</groupId>
-            <artifactId>data-mysql-mp</artifactId>
+            <artifactId>data-mybatis-plus</artifactId>
         </dependency>
         <dependency>
             <groupId>io.springfox</groupId>

+ 1 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/CacheService.java → teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/CommonCacheService.java

@@ -15,7 +15,7 @@ import java.util.Set;
  * @Author: wangliang
  * @Date: 2021/3/25
  */
-public interface CacheService {
+public interface CommonCacheService {
 
     /**
      * 添加角色缓存

+ 3 - 17
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/CacheServiceImpl.java → teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/CommonCacheServiceImpl.java

@@ -1,32 +1,21 @@
 package com.qmth.teachcloud.common.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.google.common.reflect.TypeToken;
-import com.google.gson.Gson;
 import com.qmth.teachcloud.common.bean.auth.AuthBean;
-import com.qmth.teachcloud.common.bean.dto.MenuDto;
-import com.qmth.teachcloud.common.bean.dto.MenuPrivilegeDto;
 import com.qmth.teachcloud.common.bean.result.MenuResult;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.*;
-import com.qmth.teachcloud.common.enums.PrivilegeEnum;
 import com.qmth.teachcloud.common.enums.PrivilegePropertyEnum;
 import com.qmth.teachcloud.common.service.*;
-import com.qmth.teachcloud.common.util.JacksonUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
-import org.springframework.util.LinkedMultiValueMap;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
 
 /**
  * @Description: 缓存操作serviceImpl 实现类
@@ -35,9 +24,9 @@ import java.util.stream.Collectors;
  * @Author: wangliang
  * @Date: 2021/3/25
  */
-@Service(value = "applicationCacheService")
-public class CacheServiceImpl implements CacheService {
-    private final static Logger log = LoggerFactory.getLogger(CacheServiceImpl.class);
+@Service
+public class CommonCacheServiceImpl implements CommonCacheService {
+    private final static Logger log = LoggerFactory.getLogger(CommonCacheServiceImpl.class);
 
     @Resource
     SysUserService sysUserService;
@@ -54,9 +43,6 @@ public class CacheServiceImpl implements CacheService {
     @Resource
     SysRoleService sysRoleService;
 
-    @Resource
-    SysPrivilegeService sysPrivilegeService;
-
     /**
      * 添加角色缓存
      *

+ 9 - 10
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysRoleServiceImpl.java

@@ -21,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import sun.misc.Request;
 
 import javax.annotation.Resource;
 import java.security.NoSuchAlgorithmException;
@@ -48,7 +47,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
     private SysRolePrivilegeService sysRolePrivilegeService;
 
     @Autowired
-    private CacheService cacheService;
+    private CommonCacheService commonCacheService;
 
     @Resource
     SysRoleService sysRoleService;
@@ -110,8 +109,8 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
         sysUserRoleService.rebindPrivileges(role.getId());
 
         // 清除缓存
-        cacheService.removeUserAuthCache(sysUser.getId());
-        cacheService.removeRolePrivilegeCache(role.getId());
+        commonCacheService.removeUserAuthCache(sysUser.getId());
+        commonCacheService.removeRolePrivilegeCache(role.getId());
 
         return isSuccess;
     }
@@ -134,15 +133,15 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
                 role.setSchoolId(schoolId);
             }
             if (Objects.nonNull(role.getId())) {//编辑
-                List<SysRolePrivilege> sysRolePrivilegeList = cacheService.rolePrivilegeCache(role.getId());
+                List<SysRolePrivilege> sysRolePrivilegeList = commonCacheService.rolePrivilegeCache(role.getId());
                 int count = (int) sysRolePrivilegeList.stream().filter(s -> Arrays.asList(role.getPrivilegeIds()).contains(s.getPrivilegeId())).count();
                 role.updateInfo(sysUser.getId());
                 sysRoleService.updateById(role);
-                cacheService.updateRoleCache(role.getId());
+                commonCacheService.updateRoleCache(role.getId());
                 if (count != sysRolePrivilegeList.size() || count != role.getPrivilegeIds().length) {
                     sysRolePrivilegeService.removeByRoleId(role.getId());
                     sysRolePrivilegeService.saveBatch(role);//角色权限
-                    cacheService.updateRolePrivilegeCache(role.getId());
+                    commonCacheService.updateRolePrivilegeCache(role.getId());
                     //绑定该角色的用户都需要清除鉴权缓存
                     List<SysUserRole> sysUserRoleList = sysUserRoleService.listByRoleId(role.getId());
                     for (SysUserRole s : sysUserRoleList) {
@@ -173,7 +172,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
         UpdateWrapper<SysRole> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().set(SysRole::getEnable, role.getEnable()).eq(SysRole::getId, role.getId());
         this.update(updateWrapper);
-        cacheService.updateRoleCache(role.getId());
+        commonCacheService.updateRoleCache(role.getId());
         //如果状态为禁用,需要踢下线重新登录
         if (!role.getEnable()) {
             List<SysUserRole> sysUserRoleList = sysUserRoleService.listByRoleId(role.getId());
@@ -195,8 +194,8 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
         //删除权限
         sysRolePrivilegeService.removeByRoleId(id);
         this.removeById(id);
-        cacheService.removeRoleCache(id);
-        cacheService.removeRolePrivilegeCache(id);
+        commonCacheService.removeRoleCache(id);
+        commonCacheService.removeRolePrivilegeCache(id);
         return true;
     }
 

+ 4 - 14
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserRoleServiceImpl.java

@@ -3,30 +3,20 @@ package com.qmth.teachcloud.common.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.google.gson.Gson;
-import com.qmth.teachcloud.common.bean.auth.AuthBean;
-import com.qmth.teachcloud.common.bean.dto.MenuDto;
-import com.qmth.teachcloud.common.bean.dto.MenuPrivilegeDto;
 import com.qmth.teachcloud.common.bean.result.MenuResult;
 import com.qmth.teachcloud.common.entity.SysRole;
 import com.qmth.teachcloud.common.entity.SysRolePrivilege;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.SysUserRole;
-import com.qmth.teachcloud.common.enums.PrivilegeEnum;
-import com.qmth.teachcloud.common.enums.RoleTypeEnum;
 import com.qmth.teachcloud.common.mapper.SysUserRoleMapper;
-import com.qmth.teachcloud.common.service.CacheService;
-import com.qmth.teachcloud.common.service.SysRolePrivilegeService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.SysUserRoleService;
 import com.qmth.teachcloud.common.util.ServletUtil;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.LinkedMultiValueMap;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -42,7 +32,7 @@ import java.util.stream.Collectors;
 public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Override
     public List<SysUserRole> listByRoleId(Long id) {
@@ -66,7 +56,7 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
     @Override
     public MenuResult listByUserId() {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return cacheService.userMenuCache(sysUser.getId());
+        return commonCacheService.userMenuCache(sysUser.getId());
     }
 
     @Override
@@ -82,7 +72,7 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
         for (Long userId : userIds) {
             List<SysRole> sysRoles = this.listRoleByUserId(userId);
             for (SysRole role : sysRoles) {
-                List<SysRolePrivilege> rolePrivileges = cacheService.rolePrivilegeCache(role.getId());
+                List<SysRolePrivilege> rolePrivileges = commonCacheService.rolePrivilegeCache(role.getId());
                 for (SysRolePrivilege rolePrivilege : rolePrivileges) {
                     SysUserRole userRole = new SysUserRole();
                     userRole.setUserId(userId);

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

@@ -64,7 +64,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     private SysRolePrivilegeService sysRolePrivilegeService;
 
     @Autowired
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Autowired
     private TeachcloudCommonService commonService;
@@ -108,7 +108,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     public boolean enable(SysUser user) throws NoSuchAlgorithmException {
         UpdateWrapper<SysUser> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().set(SysUser::getEnable, user.getEnable()).eq(SysUser::getId, user.getId());
-        cacheService.updateUserCache(user.getId());
+        commonCacheService.updateUserCache(user.getId());
         boolean success = this.update(updateWrapper);
         //如果状态为禁用,需要踢下线重新登录
         if (!user.getEnable()) {
@@ -301,7 +301,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 sysUserService.save(sysUser);
                 commonService.addUserRolePrivilege(sysUser, userSaveParams.getRoleIds());
             } else {//修改用户
-                List<SysUserRole> sysUserRoleList = cacheService.userRolePrivilegeCache(sysUser.getId());
+                List<SysUserRole> sysUserRoleList = commonCacheService.userRolePrivilegeCache(sysUser.getId());
                 List<Long> userRolesList = Arrays.asList(userSaveParams.getRoleIds());
                 Set<Long> dbUserRolesList = sysUserRoleList.stream().map(SysUserRole::getRoleId).collect(Collectors.toSet());
                 int count = (int) dbUserRolesList.stream().filter(s -> userRolesList.contains(s)).count();
@@ -314,7 +314,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                     sysUserRoleQueryWrapper.lambda().eq(SysUserRole::getUserId, sysUser.getId());
                     sysUserRoleService.remove(sysUserRoleQueryWrapper);
 
-                    cacheService.removeUserRolePrivilegeCache(sysUser.getId());
+                    commonCacheService.removeUserRolePrivilegeCache(sysUser.getId());
                     commonService.addUserRolePrivilege(sysUser, userSaveParams.getRoleIds());
                     commonService.removeUserInfo(sysUser.getId(), true);
                 }
@@ -322,8 +322,8 @@ 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())) {
-                        cacheService.updateUserCache(sysUser.getId());
-                        cacheService.updateUserAuthCache(sysUser.getId());
+                        commonCacheService.updateUserCache(sysUser.getId());
+                        commonCacheService.updateUserAuthCache(sysUser.getId());
                     }
                 }
             }
@@ -400,7 +400,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                     commonService.addUserRolePrivilege(sysUser, roleId);
                 }
             } else {//修改用户
-                List<SysUserRole> sysUserRoleList = cacheService.userRolePrivilegeCache(sysUser.getId());
+                List<SysUserRole> sysUserRoleList = commonCacheService.userRolePrivilegeCache(sysUser.getId());
                 List<Long> userRolesList = Arrays.asList(userSaveParams.getRoleIds());
                 Set<Long> dbUserRolesList = sysUserRoleList.stream().map(SysUserRole::getRoleId).collect(Collectors.toSet());
                 int count = (int) dbUserRolesList.stream().filter(s -> userRolesList.contains(s)).count();
@@ -414,7 +414,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                     sysUserRoleQueryWrapper.lambda().eq(SysUserRole::getUserId, sysUser.getId());
                     sysUserRoleService.remove(sysUserRoleQueryWrapper);
 
-                    cacheService.removeUserRolePrivilegeCache(sysUser.getId());
+                    commonCacheService.removeUserRolePrivilegeCache(sysUser.getId());
                     for (Long roleId : userSaveParams.getRoleIds()) {
                         commonService.addUserRolePrivilege(sysUser, roleId);
                     }
@@ -427,8 +427,8 @@ 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())) {
-                        cacheService.updateUserCache(sysUser.getId());
-                        cacheService.updateUserAuthCache(sysUser.getId());
+                        commonCacheService.updateUserCache(sysUser.getId());
+                        commonCacheService.updateUserAuthCache(sysUser.getId());
                     }
                 }
             }
@@ -558,7 +558,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 List<SysUserRole> sysUserRoleCell = commonService.disposeUserPrivilege(userCell, userSaveParams.getRoleIds());
                 sysUserRoleList.addAll(sysUserRoleCell);
             } else {//修改用户
-                List<SysUserRole> oldRoleList = cacheService.userRolePrivilegeCache(userCell.getId());
+                List<SysUserRole> oldRoleList = commonCacheService.userRolePrivilegeCache(userCell.getId());
                 List<Long> newRoleList = Arrays.asList(userSaveParams.getRoleIds());
                 Set<Long> dbUserRolesList = oldRoleList.stream().map(SysUserRole::getRoleId).collect(Collectors.toSet());
                 int count = (int) dbUserRolesList.stream().filter(newRoleList::contains).count();
@@ -571,7 +571,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                     sysUserRoleQueryWrapper.lambda().eq(SysUserRole::getUserId, userCell.getId());
                     sysUserRoleService.remove(sysUserRoleQueryWrapper);
 
-                    cacheService.removeUserRolePrivilegeCache(userCell.getId());
+                    commonCacheService.removeUserRolePrivilegeCache(userCell.getId());
                     List<SysUserRole> sysUserRoleCell = commonService.disposeUserPrivilege(userCell, userSaveParams.getRoleIds());
                     sysUserRoleList.addAll(sysUserRoleCell);
                     commonService.removeUserInfo(userCell.getId(), true);
@@ -580,8 +580,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 if (Objects.nonNull(dbUser.getOrgId())) {
                     if (dbUser.getOrgId().longValue() != userCell.getOrgId().longValue()
                             || !Objects.equals(dbUser.getMobileNumber(), userCell.getMobileNumber())) {
-                        cacheService.updateUserCache(userCell.getId());
-                        cacheService.updateUserAuthCache(userCell.getId());
+                        commonCacheService.updateUserCache(userCell.getId());
+                        commonCacheService.updateUserAuthCache(userCell.getId());
                     }
                 }
             }

+ 20 - 22
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

@@ -8,8 +8,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.common.reflect.TypeToken;
 import com.google.gson.Gson;
 import com.qmth.boot.core.enums.Platform;
-import com.qmth.boot.tools.signature.SignatureType;
-import com.qmth.teachcloud.common.SignatureEntityTest;
 import com.qmth.teachcloud.common.bean.auth.AuthBean;
 import com.qmth.teachcloud.common.bean.auth.ExpireTimeBean;
 import com.qmth.teachcloud.common.bean.dto.MenuDto;
@@ -54,7 +52,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
     private final static Logger log = LoggerFactory.getLogger(TeachcloudCommonServiceImpl.class);
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Resource
     SysUserRoleService sysUserRoleService;
@@ -97,11 +95,11 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
      */
     @Override
     public MenuResult getUserMenu(Long userId) {
-        SysUser sysUser = cacheService.userCache(userId);
-        List<SysUserRole> sysUserRoleList = cacheService.userRolePrivilegeCache(userId);
+        SysUser sysUser = commonCacheService.userCache(userId);
+        List<SysUserRole> sysUserRoleList = commonCacheService.userRolePrivilegeCache(userId);
         List<SysRolePrivilege> sysRolePrivilegeList = new ArrayList<>();
         for (SysUserRole s : sysUserRoleList) {
-            sysRolePrivilegeList.addAll(cacheService.rolePrivilegeCache(s.getRoleId()));
+            sysRolePrivilegeList.addAll(commonCacheService.rolePrivilegeCache(s.getRoleId()));
         }
         Set<Long> privilegeIds = sysRolePrivilegeList.stream().map(s -> s.getPrivilegeId()).collect(Collectors.toSet());
         QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
@@ -165,7 +163,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
      */
     @Override
     public void addUserRolePrivilege(SysUser sysUser, Long roleId) {
-        List<SysRolePrivilege> sysRolePrivilegeList = cacheService.rolePrivilegeCache(roleId);
+        List<SysRolePrivilege> sysRolePrivilegeList = commonCacheService.rolePrivilegeCache(roleId);
         List<SysUserRole> sysUserRoleList = new ArrayList<>();
         sysRolePrivilegeList.forEach(s -> {
             sysUserRoleList.add(new SysUserRole(sysUser.getId(), s.getRoleId(), s.getPrivilegeId()));
@@ -235,18 +233,18 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
     public AuthBean getUserAuth(Long userId) {
         AuthBean authBean = null;
         try {
-            CacheService cacheService = SpringContextHolder.getBean(CacheService.class);
-            SysUser user = cacheService.userCache(userId);
+            CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
+            SysUser user = commonCacheService.userCache(userId);
             if (Objects.isNull(user)) {
                 throw ExceptionResultEnum.USER_NO_DATA.exception();
             }
             //查询用户角色和权限
-            List<SysUserRole> sysUserRoleList = cacheService.userRolePrivilegeCache(user.getId());
+            List<SysUserRole> sysUserRoleList = commonCacheService.userRolePrivilegeCache(user.getId());
             if (Objects.nonNull(sysUserRoleList) && sysUserRoleList.size() > 0) {
                 Set<Long> roleIds = sysUserRoleList.stream().map(s -> s.getRoleId()).collect(Collectors.toSet());
                 List<SysRolePrivilege> sysRolePrivilegeList = new ArrayList<>();
                 for (Long l : roleIds) {
-                    sysRolePrivilegeList.addAll(cacheService.rolePrivilegeCache(l));
+                    sysRolePrivilegeList.addAll(commonCacheService.rolePrivilegeCache(l));
                 }
                 Set<Long> privilegeIds = sysRolePrivilegeList.stream().map(s -> s.getPrivilegeId()).collect(Collectors.toSet());
                 QueryWrapper<SysRole> sysRoleQueryWrapper = new QueryWrapper<>();
@@ -264,8 +262,8 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
                     List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
                     authBean = new AuthBean(sysRoleList, sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()));
                 } else {
-                    BasicSchool tbSchool = Objects.nonNull(user.getSchoolId()) ? cacheService.schoolCache(user.getSchoolId()) : null;
-                    SysOrg org = Objects.nonNull(user.getOrgId()) ? cacheService.orgCache(user.getOrgId()) : null;
+                    BasicSchool tbSchool = Objects.nonNull(user.getSchoolId()) ? commonCacheService.schoolCache(user.getSchoolId()) : null;
+                    SysOrg org = Objects.nonNull(user.getOrgId()) ? commonCacheService.orgCache(user.getOrgId()) : null;
                     sysPrivilegeQueryWrapper.lambda().in(SysPrivilege::getId, privilegeIds)
                             .eq(SysPrivilege::getSchoolId, user.getSchoolId())
                             .eq(SysPrivilege::getType, PrivilegeEnum.URL)
@@ -305,7 +303,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
      */
     @Override
     public void removeUserInfo(Long userId, boolean all) throws NoSuchAlgorithmException {
-        AuthBean authBean = cacheService.userAuthCache(userId);
+        AuthBean authBean = commonCacheService.userAuthCache(userId);
         if (Objects.isNull(authBean)) {
             throw ExceptionResultEnum.NOT_LOGIN.exception();
         }
@@ -321,10 +319,10 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
             tbSessionService.removeById(tbSession.getId());
             redisUtil.deleteUserSession(tbSession.getId());
         }
-        cacheService.removeUserCache(userId);
-        cacheService.removeUserAuthCache(userId);
-        cacheService.removeUserMenuCache(userId);
-        cacheService.removeUserRolePrivilegeCache(userId);
+        commonCacheService.removeUserCache(userId);
+        commonCacheService.removeUserAuthCache(userId);
+        commonCacheService.removeUserMenuCache(userId);
+        commonCacheService.removeUserRolePrivilegeCache(userId);
     }
 
     /**
@@ -366,7 +364,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
             //如果数据库的状态和修改的状态不同
             if (Objects.nonNull(dbRole.getEnable()) && dbRole.getEnable().booleanValue() != enable.booleanValue()) {
                 //更新角色权限
-                cacheService.updateRolePrivilegeCache(dbRole.getId());
+                commonCacheService.updateRolePrivilegeCache(dbRole.getId());
                 updateRoleIds.add(dbRole.getId());
             }
         }
@@ -376,8 +374,8 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         List<SysUserRole> sysUserRoleList = sysUserRoleService.list(sysUserRoleQueryWrapper);
         Set<Long> userIds = sysUserRoleList.stream().map(s -> s.getUserId()).collect(Collectors.toSet());
         for (Long l : userIds) {
-            cacheService.updateUserRolePrivilegeCache(l);
-            cacheService.updateUserAuthCache(l);
+            commonCacheService.updateUserRolePrivilegeCache(l);
+            commonCacheService.updateUserAuthCache(l);
         }
     }
 
@@ -744,7 +742,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         }
         //生成token
         String token = SystemConstant.getUuid();
-        cacheService.userCache(sysUser.getId());
+        commonCacheService.userCache(sysUser.getId());
         //添加用户会话缓存
         Set<String> roleNames = new HashSet<>(), roleTypes = new HashSet<>();
         for (SysRole s : authBean.getRoleList()) {

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

@@ -14,15 +14,13 @@ import com.qmth.teachcloud.common.entity.TBSession;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.PrivilegePropertyEnum;
 import com.qmth.teachcloud.common.enums.RoleTypeEnum;
-import com.qmth.teachcloud.common.service.CacheService;
-import org.apache.catalina.Role;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.method.HandlerMethod;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.lang.annotation.Annotation;
 import java.util.*;
 
 /**
@@ -35,7 +33,7 @@ import java.util.*;
 public class AuthUtil {
     private final static Logger log = LoggerFactory.getLogger(AuthUtil.class);
 
-    static CacheService cacheService = null;
+    static CommonCacheService commonCacheService = null;
 
     /**
      * admin鉴权
@@ -47,8 +45,8 @@ public class AuthUtil {
      */
     public static boolean adminAuthInterceptor(HttpServletRequest request, HttpServletResponse response, Object handler) {
         String url = request.getServletPath();
-        cacheService = SpringContextHolder.getBean(CacheService.class);
-        List<String> privilegeUrl = cacheService.privilegeUrlCache(PrivilegePropertyEnum.NO_AUTH);
+        commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
+        List<String> privilegeUrl = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.NO_AUTH);
         //无需鉴权的url
         int noAuthCount = Objects.nonNull(privilegeUrl) ? (int) privilegeUrl.stream().filter(s -> s.equalsIgnoreCase(url)).count() : 0;
         if (noAuthCount > 0) {
@@ -67,7 +65,7 @@ public class AuthUtil {
 
         TBSession tbSession = authHeadCommon(platform, deviceId, authorization, time, method, url);
         Long userId = Long.parseLong(tbSession.getIdentity());
-        SysUser sysUser = cacheService.userCache(userId);
+        SysUser sysUser = commonCacheService.userCache(userId);
         request.setAttribute(SystemConstant.SESSION, tbSession);
         request.setAttribute(SystemConstant.USER, sysUser);
         return authFootCommon(userId, SystemConstant.USER_OAUTH_CACHE, request, response, handler);
@@ -148,7 +146,7 @@ public class AuthUtil {
                                   Object handler) {
         String url = request.getServletPath();
         //验证权限
-        AuthBean authBean = type.contains(SystemConstant.USER_OAUTH_CACHE) ? authBean = cacheService.userAuthCache(userId) : null;
+        AuthBean authBean = type.contains(SystemConstant.USER_OAUTH_CACHE) ? authBean = commonCacheService.userAuthCache(userId) : null;
         if (Objects.isNull(authBean)) {
             throw ExceptionResultEnum.ROLE_ENABLE_AUTHORIZATION.exception();
         }
@@ -161,7 +159,7 @@ public class AuthUtil {
             return true;
         }
         //系统公用接口不拦截
-        List<String> sysUrls = cacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS);
+        List<String> sysUrls = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS);
         int sysCount = Objects.nonNull(sysUrls) ? (int) sysUrls.stream().filter(s -> s.equalsIgnoreCase(url)).count() : 0;
         if (sysCount > 0) {
             return true;

+ 1 - 1
teachcloud-report-business/pom.xml

@@ -57,7 +57,7 @@
 		</dependency>
 		<dependency>
 			<groupId>com.qmth.boot</groupId>
-			<artifactId>data-mysql-mp</artifactId>
+			<artifactId>data-mybatis-plus</artifactId>
 		</dependency>
 		<dependency>
 			<groupId>io.springfox</groupId>

+ 3 - 5
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamCourseServiceImpl.java

@@ -5,12 +5,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.teachcloud.common.bean.auth.AuthBean;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicCourse;
-import com.qmth.teachcloud.common.entity.SysOrg;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.RoleTypeEnum;
 import com.qmth.teachcloud.common.service.BasicCourseService;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.SysOrgService;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.report.business.bean.result.TBExamCourseResult;
@@ -21,7 +20,6 @@ import com.qmth.teachcloud.report.business.enums.TestStatusEnum;
 import com.qmth.teachcloud.report.business.mapper.TBExamCourseMapper;
 import com.qmth.teachcloud.report.business.service.TBExamCourseService;
 import com.qmth.teachcloud.report.business.service.TBExaminationRelationService;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -53,7 +51,7 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
     TBExaminationRelationService tbExaminationRelationService;
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Override
     public boolean verifyExamCourseCantRun(Long examId, Long schoolId, String courseCode, String courseName) {
@@ -126,7 +124,7 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
     public List<TBExamCourseResult> findCourseList(Long schoolId, Long examId, boolean inspect, Boolean absent, Boolean current, PublishStatusEnum status) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         List<Long> collegeIds = sysOrgService.findCollegeIds(sysUser.getOrgId());
-        AuthBean authBean = cacheService.userAuthCache(sysUser.getId());
+        AuthBean authBean = commonCacheService.userAuthCache(sysUser.getId());
         //院长开课学院不过滤,学校管理员不过滤,(院长考查学院过滤,教务老师过滤)
         boolean filter = true;
         if (Objects.nonNull(authBean) && Objects.nonNull(authBean.getRoleList()) && authBean.getRoleList().get(0).getType() == RoleTypeEnum.SCHOOL_ADMIN) {

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

@@ -10,14 +10,12 @@ import com.google.common.collect.Lists;
 import com.qmth.teachcloud.common.bean.auth.AuthBean;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicCourse;
-import com.qmth.teachcloud.common.entity.SysRole;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.RoleTypeEnum;
 import com.qmth.teachcloud.common.service.BasicCourseService;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.SysOrgService;
-import com.qmth.teachcloud.common.service.SysRoleService;
 import com.qmth.teachcloud.common.util.ExcelUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
@@ -89,7 +87,7 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
     SysOrgService sysOrgService;
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     /**
      * 查询开课学院列表
@@ -121,7 +119,7 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
     @Override
     public List<TBExamStudentResult> selectInspectCollegeList(Long schoolId, Long examId, String courseCode, Boolean absent, Boolean current, PublishStatusEnum status) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        AuthBean authBean = cacheService.userAuthCache(sysUser.getId());
+        AuthBean authBean = commonCacheService.userAuthCache(sysUser.getId());
         if (Objects.nonNull(authBean) && Objects.nonNull(authBean.getRoleList()) && authBean.getRoleList().get(0).getType() == RoleTypeEnum.TEACHER) {
             List<Long> collegeIds = sysOrgService.findCollegeIds(sysUser.getOrgId());
             if (Objects.nonNull(collegeIds) && collegeIds.size() > 0) {

+ 6 - 6
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/templete/execute/AsyncDataCalculateTempleteService.java

@@ -5,7 +5,7 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.TBTask;
 import com.qmth.teachcloud.common.enums.TaskResultEnum;
 import com.qmth.teachcloud.common.enums.TaskStatusEnum;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.TBTaskService;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
@@ -36,7 +36,7 @@ public class AsyncDataCalculateTempleteService extends AsyncCalculateTaskTemplet
     @Resource
     private AnalyzeForReportService analyzeForReportService;
     @Resource
-    private CacheService cacheService;
+    private CommonCacheService commonCacheService;
     @Resource
     private TBExamCourseService tbExamCourseService;
 
@@ -72,10 +72,10 @@ public class AsyncDataCalculateTempleteService extends AsyncCalculateTaskTemplet
             tbTask.setStatus(TaskStatusEnum.FINISH);
             tbTaskService.updateById(tbTask);
             if (Objects.isNull(exception)){
-                cacheService.removeExamStudentReportCache();
-                cacheService.removeCollegeDeanCache();
-                cacheService.removeCollegeCourseCache();
-                cacheService.removeSurveyTeacherViewCache();
+                commonCacheService.removeExamStudentReportCache();
+                commonCacheService.removeCollegeDeanCache();
+                commonCacheService.removeCollegeCourseCache();
+                commonCacheService.removeSurveyTeacherViewCache();
             }
         }
         return ResultUtil.ok(map);

+ 7 - 8
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/SysController.java

@@ -11,7 +11,6 @@ import com.qmth.distributed.print.business.entity.BasicVerifyCode;
 import com.qmth.distributed.print.business.service.BasicVerifyCodeService;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.teachcloud.common.bean.auth.AuthBean;
-import com.qmth.teachcloud.common.bean.dto.MenuDto;
 import com.qmth.teachcloud.common.bean.result.LoginResult;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.contant.SystemConstant;
@@ -57,7 +56,7 @@ public class SysController {
     private DictionaryConfig dictionaryConfig;
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Resource
     TBSessionService tbSessionService;
@@ -100,7 +99,7 @@ public class SysController {
 
         BasicSchool basicSchool = null;
         if (!login.getSchoolCode().equalsIgnoreCase(SystemConstant.ADMIN_CODE)) {
-            basicSchool = cacheService.schoolCache(login.getSchoolCode());
+            basicSchool = commonCacheService.schoolCache(login.getSchoolCode());
             if (Objects.isNull(basicSchool)) {
                 throw ExceptionResultEnum.SCHOOL_NO_DATA.exception();
             }
@@ -170,14 +169,14 @@ public class SysController {
     public Result logout() {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
-        AuthBean authBean = cacheService.userAuthCache(sysUser.getId());
+        AuthBean authBean = commonCacheService.userAuthCache(sysUser.getId());
         if (Objects.isNull(authBean)) {
             throw ExceptionResultEnum.NOT_LOGIN.exception();
         }
         tbSessionService.removeById(tbSession.getId());
         redisUtil.deleteUserSession(tbSession.getId());
-        cacheService.removeUserCache(sysUser.getId());
-        cacheService.removeUserAuthCache(sysUser.getId());
+        commonCacheService.removeUserCache(sysUser.getId());
+        commonCacheService.removeUserAuthCache(sysUser.getId());
         return ResultUtil.ok(new EditResult(sysUser.getId()));
     }
 
@@ -195,7 +194,7 @@ public class SysController {
         String password = loginParam.getPassword();
         QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
         if (StringUtils.isNotBlank(loginParam.getSchoolCode())) {
-            BasicSchool basicSchool = cacheService.schoolCache(loginParam.getSchoolCode());
+            BasicSchool basicSchool = commonCacheService.schoolCache(loginParam.getSchoolCode());
             wrapper.lambda().eq(SysUser::getSchoolId, basicSchool.getId());
         }
         wrapper.lambda().eq(SysUser::getLoginName, loginName);
@@ -221,7 +220,7 @@ public class SysController {
     @Aac(auth = BOOL.FALSE)
     public Result queryBySchoolCode(@ApiParam(value = "机构code", required = true) @RequestParam String code) {
         if (!code.equalsIgnoreCase(SystemConstant.ADMIN_CODE)) {
-            BasicSchool basicSchool = cacheService.schoolCache(code);
+            BasicSchool basicSchool = commonCacheService.schoolCache(code);
             if (Objects.isNull(basicSchool)) {
                 throw ExceptionResultEnum.SCHOOL_NO_DATA.exception();
             }

+ 3 - 3
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/WudaOpenApiController.java

@@ -13,7 +13,7 @@ import com.qmth.teachcloud.common.entity.BasicSchool;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.AppSourceEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.SysUserService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.JacksonUtil;
@@ -51,7 +51,7 @@ public class WudaOpenApiController {
     DictionaryConfig dictionaryConfig;
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Resource
     SysUserService sysUserService;
@@ -72,7 +72,7 @@ public class WudaOpenApiController {
         if (Objects.isNull(uid)) {
             throw ExceptionResultEnum.NOT_LOGIN.exception();
         }
-        BasicSchool basicSchool = cacheService.schoolCache(SystemConstant.SCHOOL_CODE);
+        BasicSchool basicSchool = commonCacheService.schoolCache(SystemConstant.SCHOOL_CODE);
         response.setHeader("Access-Control-Allow-Origin", "*");
         response.sendRedirect(dictionaryConfig.sysDomain().getReportUrl() + basicSchool.getId() + "/" + uid);
     }

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

@@ -12,7 +12,7 @@ import com.qmth.teachcloud.common.entity.TBSession;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.PrivilegePropertyEnum;
 import com.qmth.teachcloud.common.enums.RoleTypeEnum;
-import com.qmth.teachcloud.common.service.CacheService;
+import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.slf4j.Logger;
@@ -31,7 +31,7 @@ public class TeachcloudReportAuthenticationService implements AuthorizationServi
     private final static Logger log = LoggerFactory.getLogger(TeachcloudReportAuthenticationService.class);
 
     @Resource
-    CacheService cacheService;
+    CommonCacheService commonCacheService;
 
     @Resource
     RedisUtil redisUtil;
@@ -67,7 +67,7 @@ public class TeachcloudReportAuthenticationService implements AuthorizationServi
                 throw ExceptionResultEnum.AUTHORIZATION_ERROR.exception();
             }
             Long userId = Long.parseLong(tbSession.getIdentity());
-            SysUser sysUser = cacheService.userCache(userId);
+            SysUser sysUser = commonCacheService.userCache(userId);
             HttpServletRequest request = ServletUtil.getRequest();
             HttpServletResponse response = ServletUtil.getResponse();
             request.setAttribute(SystemConstant.SESSION, tbSession);
@@ -105,7 +105,7 @@ public class TeachcloudReportAuthenticationService implements AuthorizationServi
                                   HttpServletRequest request,
                                   HttpServletResponse response) {
         //验证权限
-        AuthBean authBean = type.contains(SystemConstant.USER_OAUTH_CACHE) ? authBean = cacheService.userAuthCache(userId) : null;
+        AuthBean authBean = type.contains(SystemConstant.USER_OAUTH_CACHE) ? authBean = commonCacheService.userAuthCache(userId) : null;
         if (Objects.isNull(authBean)) {
             throw ExceptionResultEnum.ROLE_ENABLE_AUTHORIZATION.exception();
         }
@@ -118,7 +118,7 @@ public class TeachcloudReportAuthenticationService implements AuthorizationServi
             return true;
         }
         //系统公用接口不拦截
-        List<String> sysUrls = cacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS);
+        List<String> sysUrls = commonCacheService.privilegeUrlCache(PrivilegePropertyEnum.SYS);
         int sysCount = Objects.nonNull(sysUrls) ? (int) sysUrls.stream().filter(s -> s.equalsIgnoreCase(path)).count() : 0;
         if (sysCount > 0) {
             return true;