Browse Source

Merge branch 'dev_v3.2.2' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev_v3.2.2

xiaof 2 years ago
parent
commit
16d60771fa
22 changed files with 632 additions and 223 deletions
  1. 9 48
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/SysAdminSetParam.java
  2. 0 11
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/CustomPrivilegeResult.java
  3. 10 53
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/SysAdminSetResult.java
  4. 38 10
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ActivitiServiceImpl.java
  5. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/PdfUtil.java
  6. 3 0
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicClazzController.java
  7. 70 83
      distributed-print/src/main/java/com/qmth/distributed/print/api/SysAdminSetController.java
  8. 5 0
      distributed-print/src/main/resources/application.properties
  9. 49 3
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/aspect/LogAspect.java
  10. 108 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/SysConfigResult.java
  11. 13 4
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/config/DictionaryConfig.java
  12. 5 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java
  13. 28 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/domain/FssLocalFileDomain.java
  14. 28 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/domain/FssLocalPdfDomain.java
  15. 40 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/SysConfig.java
  16. 17 10
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/log/CustomizedOperationTypeEnum.java
  17. 67 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/CommonCacheService.java
  18. 9 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysPrivilegeService.java
  19. 7 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysRoleService.java
  20. 94 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/CommonCacheServiceImpl.java
  21. 15 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysPrivilegeServiceImpl.java
  22. 16 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysRoleServiceImpl.java

+ 9 - 48
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/SysAdminSetParam.java

@@ -3,9 +3,12 @@ package com.qmth.distributed.print.business.bean.params;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.bean.result.SysConfigResult;
 import com.qmth.teachcloud.common.entity.TSchoolPrivilege;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.List;
+
 /**
  * @Description: 学校自定义菜单 param
  * @Param:
@@ -20,37 +23,19 @@ public class SysAdminSetParam extends TSchoolPrivilege {
     @ApiModelProperty(value = "权限id数组")
     private Long[] privilegeIds;
 
-    @ApiModelProperty(value = "pdf格式数组")
-    private String[] pdfSize;
-
-    @ApiModelProperty(value = "用户/密码模式是否开启短信验证")
-    Boolean accountSmsVerify;
-
-    @ApiModelProperty(value = "第三方统一身份认证地址")
-    String teachcloudExchangeHostUrl;
-
-    @ApiModelProperty(value = "同步配置地址")
-    String syncServicePaths;
+    @ApiModelProperty(value = "参数")
+    List<SysConfigResult> param;
 
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "角色id数组")
     private Long[] roleIds;
 
-    public SysAdminSetParam() {
-
+    public List<SysConfigResult> getParam() {
+        return param;
     }
 
-    public SysAdminSetParam(Boolean accountSmsVerify, String teachcloudExchangeHostUrl) {
-        this.accountSmsVerify = accountSmsVerify;
-        this.teachcloudExchangeHostUrl = teachcloudExchangeHostUrl;
-    }
-
-    public String getTeachcloudExchangeHostUrl() {
-        return teachcloudExchangeHostUrl;
-    }
-
-    public void setTeachcloudExchangeHostUrl(String teachcloudExchangeHostUrl) {
-        this.teachcloudExchangeHostUrl = teachcloudExchangeHostUrl;
+    public void setParam(List<SysConfigResult> param) {
+        this.param = param;
     }
 
     public Long[] getRoleIds() {
@@ -61,22 +46,6 @@ public class SysAdminSetParam extends TSchoolPrivilege {
         this.roleIds = roleIds;
     }
 
-    public String getSyncServicePaths() {
-        return syncServicePaths;
-    }
-
-    public void setSyncServicePaths(String syncServicePaths) {
-        this.syncServicePaths = syncServicePaths;
-    }
-
-    public Boolean getAccountSmsVerify() {
-        return accountSmsVerify;
-    }
-
-    public void setAccountSmsVerify(Boolean accountSmsVerify) {
-        this.accountSmsVerify = accountSmsVerify;
-    }
-
     public Long[] getPrivilegeIds() {
         return privilegeIds;
     }
@@ -84,12 +53,4 @@ public class SysAdminSetParam extends TSchoolPrivilege {
     public void setPrivilegeIds(Long[] privilegeIds) {
         this.privilegeIds = privilegeIds;
     }
-
-    public String[] getPdfSize() {
-        return pdfSize;
-    }
-
-    public void setPdfSize(String[] pdfSize) {
-        this.pdfSize = pdfSize;
-    }
 }

+ 0 - 11
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/CustomPrivilegeResult.java

@@ -21,9 +21,6 @@ public class CustomPrivilegeResult implements Serializable {
     @ApiModelProperty(value = "自定义菜单")
     List<PrivilegeDto> customPrivilegeList;
 
-    @ApiModelProperty(value = "全局pdf格式")
-    List<String> sysPdfSize;
-
     @ApiModelProperty(value = "自定义角色")
     List<SysRole> customRoleList;
 
@@ -50,12 +47,4 @@ public class CustomPrivilegeResult implements Serializable {
     public void setCustomRoleList(List<SysRole> customRoleList) {
         this.customRoleList = customRoleList;
     }
-
-    public List<String> getSysPdfSize() {
-        return sysPdfSize;
-    }
-
-    public void setSysPdfSize(List<String> sysPdfSize) {
-        this.sysPdfSize = sysPdfSize;
-    }
 }

+ 10 - 53
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/SysAdminSetResult.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.bean.result;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.bean.result.SysConfigResult;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
@@ -25,17 +26,8 @@ public class SysAdminSetResult implements Serializable {
     @ApiModelProperty(value = "自定义菜单id")
     List<String> privilegeIdList;
 
-    @ApiModelProperty(value = "pdf格式")
-    List<String> pdfSize;
-
-    @ApiModelProperty(value = "用户/密码模式是否开启短信验证")
-    Boolean accountSmsVerify;
-
-    @ApiModelProperty(value = "第三方统一身份认证地址")
-    String teachcloudExchangeHostUrl;
-
-    @ApiModelProperty(value = "同步配置地址")
-    String syncServicePaths;
+    @ApiModelProperty(value = "返回结果")
+    List<SysConfigResult> result;
 
     @ApiModelProperty(value = "自定义角色id")
     List<String> roleIdList;
@@ -44,24 +36,13 @@ public class SysAdminSetResult implements Serializable {
 
     }
 
-    public SysAdminSetResult(List<String> pdfSize) {
-        this.pdfSize = pdfSize;
-    }
-
-    public SysAdminSetResult(Long schoolId, List<String> privilegeIdList) {
+    public SysAdminSetResult(Long schoolId) {
         this.schoolId = schoolId;
-        this.privilegeIdList = privilegeIdList;
     }
 
-    public SysAdminSetResult(Long schoolId, String syncServicePaths) {
+    public SysAdminSetResult(Long schoolId, List<SysConfigResult> result) {
         this.schoolId = schoolId;
-        this.syncServicePaths = syncServicePaths;
-    }
-
-    public SysAdminSetResult(Long schoolId, Boolean accountSmsVerify, String teachcloudExchangeHostUrl) {
-        this.schoolId = schoolId;
-        this.accountSmsVerify = accountSmsVerify;
-        this.teachcloudExchangeHostUrl = teachcloudExchangeHostUrl;
+        this.result = result;
     }
 
     public List<String> getRoleIdList() {
@@ -72,30 +53,6 @@ public class SysAdminSetResult implements Serializable {
         this.roleIdList = roleIdList;
     }
 
-    public String getTeachcloudExchangeHostUrl() {
-        return teachcloudExchangeHostUrl;
-    }
-
-    public void setTeachcloudExchangeHostUrl(String teachcloudExchangeHostUrl) {
-        this.teachcloudExchangeHostUrl = teachcloudExchangeHostUrl;
-    }
-
-    public String getSyncServicePaths() {
-        return syncServicePaths;
-    }
-
-    public void setSyncServicePaths(String syncServicePaths) {
-        this.syncServicePaths = syncServicePaths;
-    }
-
-    public Boolean getAccountSmsVerify() {
-        return accountSmsVerify;
-    }
-
-    public void setAccountSmsVerify(Boolean accountSmsVerify) {
-        this.accountSmsVerify = accountSmsVerify;
-    }
-
     public List<String> getPrivilegeIdList() {
         return privilegeIdList;
     }
@@ -112,11 +69,11 @@ public class SysAdminSetResult implements Serializable {
         this.schoolId = schoolId;
     }
 
-    public List<String> getPdfSize() {
-        return pdfSize;
+    public List<SysConfigResult> getResult() {
+        return result;
     }
 
-    public void setPdfSize(List<String> pdfSize) {
-        this.pdfSize = pdfSize;
+    public void setResult(List<SysConfigResult> result) {
+        this.result = result;
     }
 }

+ 38 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ActivitiServiceImpl.java

@@ -26,10 +26,7 @@ import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.SysRoleGroupMemberService;
 import com.qmth.teachcloud.common.service.SysUserService;
-import com.qmth.teachcloud.common.util.JacksonUtil;
-import com.qmth.teachcloud.common.util.RedisUtil;
-import com.qmth.teachcloud.common.util.ResultUtil;
-import com.qmth.teachcloud.common.util.ServletUtil;
+import com.qmth.teachcloud.common.util.*;
 import org.activiti.bpmn.BpmnAutoLayout;
 import org.activiti.bpmn.model.Process;
 import org.activiti.bpmn.model.*;
@@ -42,6 +39,7 @@ import org.activiti.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
 import org.activiti.engine.repository.Deployment;
 import org.activiti.engine.runtime.ProcessInstance;
 import org.activiti.engine.task.Task;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -52,6 +50,7 @@ import org.springframework.util.LinkedMultiValueMap;
 
 import javax.annotation.Resource;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.text.MessageFormat;
@@ -122,6 +121,9 @@ public class ActivitiServiceImpl implements ActivitiService {
     @Resource
     DictionaryConfig dictionaryConfig;
 
+    @Resource
+    FileStoreUtil fileStoreUtil;
+
     /**
      * 启动流程
      *
@@ -236,10 +238,23 @@ public class ActivitiServiceImpl implements ActivitiService {
 
         //保存png图片(这一步可做可不做)
         InputStream processDiagram = repositoryService.getProcessDiagram(processDefinitionId);
+        File file = null;
         try {
-            FileUtils.copyInputStreamToFile(processDiagram, new File(SystemConstant.getUserDir() + File.separator + DefaultInstanceConvertToMultiInstance.BPMN_NAME + File.separator + bpmnPngName));
-        } catch (IOException e) {
-            e.printStackTrace();
+            if (!StringUtils.isBlank(dictionaryConfig.fssLocalFileDomain().getConfig())) {
+                FileUtils.copyInputStreamToFile(processDiagram, new File(dictionaryConfig.fssLocalFileDomain().getConfig() + File.separator + DefaultInstanceConvertToMultiInstance.BPMN_NAME + File.separator + bpmnPngName));
+            } else {
+                file = SystemConstant.getFileTempVar(bpmnPngName);
+                FileUtils.copyInputStreamToFile(processDiagram, file);
+                StringJoiner stringJoiner = SystemConstant.getDirName();
+                stringJoiner.add(DefaultInstanceConvertToMultiInstance.BPMN_NAME).add(File.separator).add(bpmnPngName);
+                fileStoreUtil.ossUpload(stringJoiner.toString(), file, DigestUtils.md5Hex(new FileInputStream(file)), UploadFileEnum.FILE.getFssType());
+            }
+        } catch (Exception e) {
+            log.error(SystemConstant.LOG_ERROR, e);
+        } finally {
+            if (Objects.nonNull(file)) {
+                file.delete();
+            }
         }
     }
 
@@ -264,10 +279,23 @@ public class ActivitiServiceImpl implements ActivitiService {
 
         //保存xml文件(这一步可做可不做)
         InputStream processBpmn = repositoryService.getResourceAsStream(deployment.getId(), bpmnName);
+        File file = null;
         try {
-            FileUtils.copyInputStreamToFile(processBpmn, new File(SystemConstant.getUserDir() + File.separator + DefaultInstanceConvertToMultiInstance.BPMN_NAME + File.separator + bpmnProcessName));
-        } catch (IOException e) {
-            e.printStackTrace();
+            if (!StringUtils.isBlank(dictionaryConfig.fssLocalFileDomain().getConfig())) {
+                FileUtils.copyInputStreamToFile(processBpmn, new File(dictionaryConfig.fssLocalFileDomain().getConfig() + File.separator + DefaultInstanceConvertToMultiInstance.BPMN_NAME + File.separator + bpmnProcessName));
+            } else {
+                file = SystemConstant.getFileTempVar(bpmnProcessName);
+                FileUtils.copyInputStreamToFile(processBpmn, file);
+                StringJoiner stringJoiner = SystemConstant.getDirName();
+                stringJoiner.add(DefaultInstanceConvertToMultiInstance.BPMN_NAME).add(File.separator).add(bpmnProcessName);
+                fileStoreUtil.ossUpload(stringJoiner.toString(), file, DigestUtils.md5Hex(new FileInputStream(file)), UploadFileEnum.FILE.getFssType());
+            }
+        } catch (Exception e) {
+            log.error(SystemConstant.LOG_ERROR, e);
+        } finally {
+            if (Objects.nonNull(file)) {
+                file.delete();
+            }
         }
         return deployment;
     }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/PdfUtil.java

@@ -199,7 +199,7 @@ public class PdfUtil {
         CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
         SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.PDF_SIZE_LIST);
         sysConfig = Objects.isNull(sysConfig) ? commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST) : sysConfig;
-        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局pdf格式清单"));
+        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局上传试卷规格"));
 
         String pdfSize = sysConfig.getConfigValue().replace("8K", "K8");
         List<String> pdfSizeList = Objects.nonNull(sysConfig) ? Arrays.asList(pdfSize.replaceAll("\\[", "").replaceAll("\\]", "").split(", ")) : null;

+ 3 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicClazzController.java

@@ -4,11 +4,13 @@ import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.bean.result.EditResult;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.distributed.print.business.templete.execute.AsyncBasicClazzImportService;
+import com.qmth.teachcloud.common.annotation.OperationLogDetail;
 import com.qmth.teachcloud.common.bean.params.BasicClazzParams;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.TBTask;
 import com.qmth.teachcloud.common.enums.TaskTypeEnum;
+import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
 import com.qmth.teachcloud.common.service.BasicClazzService;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
@@ -49,6 +51,7 @@ public class BasicClazzController {
     @ApiOperation(value = "班级基本信息管理-查询")
     @RequestMapping(value = "/query", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
     public Result findBasicClazzList(@ApiParam(value = "查询参数(班级号或班级名)") @RequestParam(required = false) String queryParams,
                                      @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
                                      @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {

+ 70 - 83
distributed-print/src/main/java/com/qmth/distributed/print/api/SysAdminSetController.java

@@ -1,6 +1,5 @@
 package com.qmth.distributed.print.api;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.backup.MySQLDatabaseBackup;
@@ -8,6 +7,7 @@ import com.qmth.distributed.print.business.bean.params.SysAdminSetParam;
 import com.qmth.distributed.print.business.bean.result.CustomPrivilegeResult;
 import com.qmth.distributed.print.business.bean.result.SysAdminSetResult;
 import com.qmth.teachcloud.common.bean.dto.PrivilegeDto;
+import com.qmth.teachcloud.common.bean.result.SysConfigResult;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.*;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
@@ -85,26 +85,26 @@ public class SysAdminSetController {
         SysConfig sysConfigQuestionHostUrl = commonCacheService.addSysConfigCache(schoolId, SystemConstant.QUESTION_HOST_URL);
         SysConfig sysConfigCloudmarkHostUrl = commonCacheService.addSysConfigCache(schoolId, SystemConstant.CLOUDMARK_HOST_URL);
         SysConfig sysConfigTeachcloudReportHostUrl = commonCacheService.addSysConfigCache(schoolId, SystemConstant.TEACHCLOUD_REPORT_HOST_URL);
-        JSONObject jsonObject = new JSONObject();
 
+        List<SysConfigResult> sysConfigResultList = new ArrayList<>();
         if (Objects.nonNull(sysConfigQuestionHostUrl)) {
-            jsonObject.put(SystemConstant.QUESTION_HOST_URL, sysConfigQuestionHostUrl.getConfigValue());
+            sysConfigResultList.add(new SysConfigResult(sysConfigQuestionHostUrl));
         } else {
-            jsonObject.put(SystemConstant.QUESTION_HOST_URL, "");
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.QUESTION_HOST_URL, "题库地址", "", 1));
         }
 
         if (Objects.nonNull(sysConfigCloudmarkHostUrl)) {
-            jsonObject.put(SystemConstant.CLOUDMARK_HOST_URL, sysConfigCloudmarkHostUrl.getConfigValue());
+            sysConfigResultList.add(new SysConfigResult(sysConfigCloudmarkHostUrl));
         } else {
-            jsonObject.put(SystemConstant.CLOUDMARK_HOST_URL, "");
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.CLOUDMARK_HOST_URL, "云阅卷地址", "", 2));
         }
 
         if (Objects.nonNull(sysConfigTeachcloudReportHostUrl)) {
-            jsonObject.put(SystemConstant.TEACHCLOUD_REPORT_HOST_URL, sysConfigTeachcloudReportHostUrl.getConfigValue());
+            sysConfigResultList.add(new SysConfigResult(sysConfigTeachcloudReportHostUrl));
         } else {
-            jsonObject.put(SystemConstant.TEACHCLOUD_REPORT_HOST_URL, "");
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.TEACHCLOUD_REPORT_HOST_URL, "教研分析地址", "", 3));
         }
-        return ResultUtil.ok(new SysAdminSetResult(schoolId, jsonObject.toString()));
+        return ResultUtil.ok(new SysAdminSetResult(schoolId, sysConfigResultList));
     }
 
     @ApiOperation(value = "同步配置保存")
@@ -115,33 +115,18 @@ public class SysAdminSetController {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
-        Optional.ofNullable(sysAdminSetParam.getSyncServicePaths()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("同步配置地址不能为空"));
+        Optional.ofNullable(sysAdminSetParam.getParam()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("同步配置地址不能为空"));
 
-        SysConfig sysConfigQuestionHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.QUESTION_HOST_URL);
-        SysConfig sysConfigCloudmarkHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.CLOUDMARK_HOST_URL);
-        SysConfig sysConfigTeachcloudReportHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_REPORT_HOST_URL);
-        JSONObject jsonObject = JSONObject.parseObject(sysAdminSetParam.getSyncServicePaths());
-
-        if (Objects.isNull(sysConfigQuestionHostUrl)) {
-            sysConfigQuestionHostUrl = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.QUESTION_HOST_URL, "题库地址", jsonObject.getString(SystemConstant.QUESTION_HOST_URL));
-        } else {
-            sysConfigQuestionHostUrl.setConfigValue(jsonObject.getString(SystemConstant.QUESTION_HOST_URL));
-        }
-        if (Objects.isNull(sysConfigCloudmarkHostUrl)) {
-            sysConfigCloudmarkHostUrl = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.CLOUDMARK_HOST_URL, "云阅卷地址", jsonObject.getString(SystemConstant.CLOUDMARK_HOST_URL));
-        } else {
-            sysConfigCloudmarkHostUrl.setConfigValue(jsonObject.getString(SystemConstant.CLOUDMARK_HOST_URL));
-        }
-        if (Objects.isNull(sysConfigTeachcloudReportHostUrl)) {
-            sysConfigTeachcloudReportHostUrl = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_REPORT_HOST_URL, "教研分析地址", jsonObject.getString(SystemConstant.TEACHCLOUD_REPORT_HOST_URL));
-        } else {
-            sysConfigTeachcloudReportHostUrl.setConfigValue(jsonObject.getString(SystemConstant.TEACHCLOUD_REPORT_HOST_URL));
+        List<SysConfigResult> sysConfigResultList = sysAdminSetParam.getParam();
+        List<SysConfig> sysConfigList = new ArrayList<>();
+        for (SysConfigResult s : sysConfigResultList) {
+            sysConfigList.add(new SysConfig(sysAdminSetParam.getSchoolId(), s));
         }
-        sysConfigService.saveOrUpdateBatch(Arrays.asList(sysConfigQuestionHostUrl, sysConfigCloudmarkHostUrl, sysConfigTeachcloudReportHostUrl));
+        sysConfigService.saveOrUpdateBatch(sysConfigList);
 
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.QUESTION_HOST_URL);
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.CLOUDMARK_HOST_URL);
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_REPORT_HOST_URL);
+        for (SysConfigResult s : sysConfigResultList) {
+            commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), s.getCode());
+        }
         return ResultUtil.ok(true);
     }
 
@@ -150,10 +135,12 @@ public class SysAdminSetController {
     @RequestMapping(value = "/paper/sys/select", method = RequestMethod.POST)
     public Result sysadminPaperSysSelect() {
         SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST);
-        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局pdf格式清单"));
-        CustomPrivilegeResult customPrivilegeResult = new CustomPrivilegeResult();
-        customPrivilegeResult.setSysPdfSize(Arrays.asList(sysConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")));
-        return ResultUtil.ok(customPrivilegeResult);
+        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局上传试卷规格"));
+        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult();
+        SysConfigResult sysConfigResult = new SysConfigResult(sysConfig);
+        sysConfigResult.setValue(Arrays.asList(sysConfigResult.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")));
+        sysAdminSetResult.setResult(Arrays.asList(sysConfigResult));
+        return ResultUtil.ok(sysAdminSetResult);
     }
 
     @ApiOperation(value = "试卷规格配置查询")
@@ -162,12 +149,16 @@ public class SysAdminSetController {
     public Result sysadminPaperSelect(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
         SysConfig sysConfigPdfSize = commonCacheService.addSysConfigCache(schoolId, SystemConstant.PDF_SIZE_LIST);
         List<String> pdfSize = null;
+        SysConfigResult sysConfigResult = null;
         if (Objects.nonNull(sysConfigPdfSize)) {
             pdfSize = Arrays.asList(sysConfigPdfSize.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", "));
+            sysConfigResult = new SysConfigResult(sysConfigPdfSize);
+            sysConfigResult.setValue(pdfSize);
+        } else {
+            sysConfigResult = new SysConfigResult(null, SystemConstant.PDF_SIZE_LIST, "允许上传试卷规格", new ArrayList<>(), 1);
         }
-        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult();
-        sysAdminSetResult.setSchoolId(schoolId);
-        sysAdminSetResult.setPdfSize(CollectionUtils.isEmpty(pdfSize) ? new ArrayList<>() : pdfSize);
+        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult(schoolId);
+        sysAdminSetResult.setResult(Arrays.asList(sysConfigResult));
         return ResultUtil.ok(sysAdminSetResult);
     }
 
@@ -179,21 +170,20 @@ public class SysAdminSetController {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
-        Optional.ofNullable(sysAdminSetParam.getPdfSize()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("试卷规格配置不能为空"));
+        Optional.ofNullable(sysAdminSetParam.getParam()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("试卷规格配置不能为空"));
 
-        SysConfig sysConfigPdfSize = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
-        if (Objects.isNull(sysConfigPdfSize)) {
-            sysConfigPdfSize = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST, "pdf格式清单", Arrays.asList(sysAdminSetParam.getPdfSize()).toString());
-        } else {
-            if (Objects.nonNull(sysAdminSetParam.getPdfSize()) && sysAdminSetParam.getPdfSize().length > 0) {
-                sysConfigPdfSize.setConfigValue(Arrays.asList(sysAdminSetParam.getPdfSize()).toString());
-            } else {
-                sysConfigPdfSize.setConfigValue(null);
-            }
+        List<SysConfigResult> sysConfigResultList = sysAdminSetParam.getParam();
+        List<SysConfig> sysConfigList = new ArrayList<>();
+        for (SysConfigResult s : sysConfigResultList) {
+            SysConfig sysConfig = new SysConfig(sysAdminSetParam.getSchoolId(), s);
+            sysConfig.setConfigValue(Arrays.asList(s.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")).toString());
+            sysConfigList.add(sysConfig);
         }
-        sysConfigService.saveOrUpdate(sysConfigPdfSize);
+        sysConfigService.saveOrUpdateBatch(sysConfigList);
 
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
+        for (SysConfigResult s : sysConfigResultList) {
+            commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), s.getCode());
+        }
         return ResultUtil.ok(true);
     }
 
@@ -203,7 +193,18 @@ public class SysAdminSetController {
     public Result sysadminUserSelect(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
         SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(schoolId, SystemConstant.ACCOUNT_SMS_VERIFY);
         SysConfig sysConfigTeachcloudExchangeHostUrl = commonCacheService.addSysConfigCache(schoolId, SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL);
-        return ResultUtil.ok(new SysAdminSetResult(schoolId, Objects.nonNull(sysConfigAccount) ? Boolean.valueOf(sysConfigAccount.getConfigValue()) : false, Objects.nonNull(sysConfigTeachcloudExchangeHostUrl) ? sysConfigTeachcloudExchangeHostUrl.getConfigValue() : ""));
+        List<SysConfigResult> sysConfigResultList = new ArrayList<>();
+        if (Objects.nonNull(sysConfigAccount)) {
+            sysConfigResultList.add(new SysConfigResult(sysConfigAccount));
+        } else {
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.ACCOUNT_SMS_VERIFY, "用户/密码模式是否开启短信验证", false, 1));
+        }
+        if (Objects.nonNull(sysConfigTeachcloudExchangeHostUrl)) {
+            sysConfigResultList.add(new SysConfigResult(sysConfigTeachcloudExchangeHostUrl));
+        } else {
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL, "第三方统一身份认证", "", 2));
+        }
+        return ResultUtil.ok(new SysAdminSetResult(schoolId, sysConfigResultList));
     }
 
     @ApiOperation(value = "用户验证保存")
@@ -214,29 +215,18 @@ public class SysAdminSetController {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
-        Optional.ofNullable(sysAdminSetParam.getAccountSmsVerify()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("用户/密码模式是否开启不能为空"));
-        Optional.ofNullable(sysAdminSetParam.getTeachcloudExchangeHostUrl()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("第三方统一身份认证不能为空"));
+        Optional.ofNullable(sysAdminSetParam.getParam()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("用户/密码模式是否开启不能为空"));
 
+        List<SysConfigResult> sysConfigResultList = sysAdminSetParam.getParam();
         List<SysConfig> sysConfigList = new ArrayList<>();
-        SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY);
-        if (Objects.isNull(sysConfigAccount)) {
-            sysConfigAccount = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY, "用户/密码模式是否开启短信验证", String.valueOf(sysAdminSetParam.getAccountSmsVerify()));
-        } else {
-            sysConfigAccount.setConfigValue(String.valueOf(sysAdminSetParam.getAccountSmsVerify()));
-        }
-        sysConfigList.add(sysConfigAccount);
-
-        SysConfig sysConfigTeachcloudExchangeHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL);
-        if (Objects.isNull(sysConfigTeachcloudExchangeHostUrl)) {
-            sysConfigTeachcloudExchangeHostUrl = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL, "第三方统一身份认证", sysAdminSetParam.getTeachcloudExchangeHostUrl());
-        } else {
-            sysConfigTeachcloudExchangeHostUrl.setConfigValue(sysAdminSetParam.getTeachcloudExchangeHostUrl());
+        for (SysConfigResult s : sysConfigResultList) {
+            sysConfigList.add(new SysConfig(sysAdminSetParam.getSchoolId(), s));
         }
-        sysConfigList.add(sysConfigTeachcloudExchangeHostUrl);
         sysConfigService.saveOrUpdateBatch(sysConfigList);
 
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY);
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL);
+        for (SysConfigResult s : sysConfigResultList) {
+            commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), s.getCode());
+        }
         return ResultUtil.ok(true);
     }
 
@@ -284,6 +274,7 @@ public class SysAdminSetController {
                 }
             }
             tSchoolPrivilegeService.remove(tSchoolPrivilegeQueryWrapper);
+            commonCacheService.removeSchoolPrivilegeCache(tSchoolPrivilegeParam.getSchoolId());
         }
         Long[] privilegeIds = tSchoolPrivilegeParam.getPrivilegeIds();
         if (Objects.nonNull(privilegeIds) && privilegeIds.length > 0) {
@@ -318,22 +309,18 @@ public class SysAdminSetController {
     @ApiResponses({@ApiResponse(code = 200, message = "菜单权限信息", response = SysAdminSetResult.class)})
     @RequestMapping(value = "/menu/custom/get_school_custom_privileges", method = RequestMethod.POST)
     public Result getSchoolPrivileges(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
-        List<TSchoolPrivilege> tSchoolPrivilegeList = tSchoolPrivilegeService.findBySchoolId(schoolId);
+        List<TSchoolPrivilege> tSchoolPrivilegeList = commonCacheService.addSchoolPrivilegeCache(schoolId);
         List<String> privilegeIdList = tSchoolPrivilegeList.stream().map(s -> String.valueOf(s.getPrivilegeId())).collect(Collectors.toList());
-        return ResultUtil.ok(new SysAdminSetResult(schoolId, CollectionUtils.isEmpty(privilegeIdList) ? new ArrayList<>() : privilegeIdList));
+        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult(schoolId);
+        sysAdminSetResult.setPrivilegeIdList(CollectionUtils.isEmpty(privilegeIdList) ? new ArrayList<>() : privilegeIdList);
+        return ResultUtil.ok(sysAdminSetResult);
     }
 
     @ApiOperation(value = "查询自定义角色权限")
     @ApiResponses({@ApiResponse(code = 200, message = "角色权限信息", response = CustomPrivilegeResult.class)})
     @RequestMapping(value = "/role/custom/list", method = RequestMethod.POST)
     public Result customRoleList() {
-        QueryWrapper<SysRole> sysRoleQueryWrapper = new QueryWrapper<>();
-        sysRoleQueryWrapper.lambda().eq(SysRole::getDefaultRole, true)
-                .eq(SysRole::getEnable, true)
-                .isNull(SysRole::getSchoolId)
-                .ne(SysRole::getType, SystemConstant.ADMIN_CODE.toUpperCase())
-                .orderByAsc(SysRole::getId);
-        List<SysRole> sysRoleList = sysRoleService.list(sysRoleQueryWrapper);
+        List<SysRole> sysRoleList = commonCacheService.addCustomRoleCache();
         CustomPrivilegeResult customPrivilegeResult = new CustomPrivilegeResult();
         customPrivilegeResult.setCustomRoleList(sysRoleList);
         return ResultUtil.ok(sysRoleList);
@@ -371,6 +358,7 @@ public class SysAdminSetController {
                 }
             }
             tSchoolRoleService.remove(tSchoolRoleQueryWrapper);
+            commonCacheService.removeSchoolRoleCache(tSchoolPrivilegeParam.getSchoolId());
         }
         Long[] roleIds = tSchoolPrivilegeParam.getRoleIds();
         if (Objects.nonNull(roleIds) && roleIds.length > 0) {
@@ -394,10 +382,9 @@ public class SysAdminSetController {
     @ApiResponses({@ApiResponse(code = 200, message = "角色权限信息", response = SysAdminSetResult.class)})
     @RequestMapping(value = "/role/custom/get_school_custom_roles", method = RequestMethod.POST)
     public Result getSchoolRoles(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
-        List<TSchoolRole> tSchoolRoleList = tSchoolRoleService.findBySchoolId(schoolId);
+        List<TSchoolRole> tSchoolRoleList = commonCacheService.addSchoolRoleCache(schoolId);
         List<String> roleIdList = tSchoolRoleList.stream().map(s -> String.valueOf(s.getRoleId())).collect(Collectors.toList());
-        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult();
-        sysAdminSetResult.setSchoolId(schoolId);
+        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult(schoolId);
         sysAdminSetResult.setRoleIdList(CollectionUtils.isEmpty(roleIdList) ? new ArrayList<>() : roleIdList);
         return ResultUtil.ok(sysAdminSetResult);
     }

+ 5 - 0
distributed-print/src/main/resources/application.properties

@@ -62,6 +62,11 @@ com.qmth.fss.public.server=/Users/king/git
 com.qmth.fss.private.config=../static/
 com.qmth.fss.private.server=/Users/king/git
 
+#com.qmth.fss.localfile.config=
+#com.qmth.fss.localfile.server=
+#com.qmth.fss.localpdf.config=
+#com.qmth.fss.localpdf.server=
+
 #\u7CFB\u7EDF\u914D\u7F6E
 sys.config.oss=true
 sys.config.htmlToPdfUrl=/usr/local/bin/wkhtmltopdf

+ 49 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/aspect/LogAspect.java

@@ -1,13 +1,19 @@
 package com.qmth.teachcloud.common.aspect;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.teachcloud.common.annotation.OperationLogDetail;
 import com.qmth.teachcloud.common.bean.dto.LogArgsDto;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicOperationLog;
+import com.qmth.teachcloud.common.entity.SysPrivilege;
 import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.enums.PrivilegeEnum;
+import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
+import com.qmth.teachcloud.common.enums.log.OperationTypeEnum;
 import com.qmth.teachcloud.common.service.BasicOperationLogService;
+import com.qmth.teachcloud.common.service.SysPrivilegeService;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.aspectj.lang.JoinPoint;
@@ -36,6 +42,8 @@ import java.util.*;
 public class LogAspect {
     @Resource
     private BasicOperationLogService basicOperationLogService;
+    @Resource
+    private SysPrivilegeService sysPrivilegeService;
 
     private final static Logger log = LoggerFactory.getLogger(LogAspect.class);
 
@@ -124,10 +132,20 @@ public class LogAspect {
         // 注解中的信息
         OperationLogDetail annotation = signature.getMethod().getAnnotation(OperationLogDetail.class);
         if (annotation != null) {
-            operationLog.setDetail(getDetail(((MethodSignature) joinPoint.getSignature()).getParameterNames(), joinPoint.getArgs(), annotation));
+            String detail = annotation.detail();
+            if (SystemConstant.strNotNull(detail)) {
+                operationLog.setDetail(getDetail(((MethodSignature) joinPoint.getSignature()).getParameterNames(), joinPoint.getArgs(), annotation));
+            } else {
+                operationLog.setDetail(autoCreateOperationLogDetailByUrl(request.getServletPath()));
+            }
             operationLog.setLevel(annotation.level());
-            operationLog.setCustomizedOperationType(annotation.customizedOperationType());
-            operationLog.setOperationType(annotation.operationType());
+            CustomizedOperationTypeEnum customizedOperationType = annotation.customizedOperationType();
+            operationLog.setCustomizedOperationType(customizedOperationType);
+            OperationTypeEnum operationType = annotation.operationType();
+            if (OperationTypeEnum.UN_KNOW.equals(operationType)) {
+                operationType = customizedOperationType.getOperationType();
+            }
+            operationLog.setOperationType(operationType);
             operationLog.setOperationUnit(annotation.operationUnit());
             operationLog.setSystemType(annotation.system());
         }
@@ -182,6 +200,34 @@ public class LogAspect {
         return detail;
     }
 
+    /**
+     * 根据权限url自动创建操作日志详情
+     *
+     * @param url url
+     * @return 操作日志详情
+     */
+    private String autoCreateOperationLogDetailByUrl(String url) {
+        String detail = "";
+        List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(new QueryWrapper<SysPrivilege>()
+                .lambda()
+                .eq(SysPrivilege::getUrl, url)
+                .eq(SysPrivilege::getType, PrivilegeEnum.URL)
+                .orderByAsc(SysPrivilege::getId));
+        if (sysPrivilegeList.size() > 0) {
+            SysPrivilege sysPrivilege = sysPrivilegeList.get(0);
+            Long parentId = sysPrivilege.getParentId();
+            String operationName = sysPrivilege.getName();
+            String path = sysPrivilegeService.findPrivilegeUrlCatalog(parentId);
+            if (SystemConstant.strNotNull(path)) {
+                path = path.substring(0, path.length() - SystemConstant.CATALOG_LINK.length());
+                detail = path + SystemConstant.OPERATE_LINK + operationName;
+            } else {
+                detail = operationName;
+            }
+        }
+        return detail;
+    }
+
     @Before(value = "operationLog()")
     public void doBeforeAdvice(JoinPoint joinPoint) {
         System.out.println("进入方法前执行.....");

+ 108 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/SysConfigResult.java

@@ -0,0 +1,108 @@
+package com.qmth.teachcloud.common.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.entity.SysConfig;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 系统参数result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/11/30
+ */
+public class SysConfigResult implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @ApiModelProperty(value = "参数编码")
+    private String code;
+
+    @ApiModelProperty(value = "参数名称")
+    private String name;
+
+    @ApiModelProperty(value = "参数值")
+    private Object value;
+
+    @ApiModelProperty(value = "启用/禁用,ture:启用,false:禁用,默认启用")
+    private Boolean enable = true;
+
+    @ApiModelProperty(value = "排序")
+    private Integer sort = 1;
+
+    public SysConfigResult() {
+
+    }
+
+    public SysConfigResult(Long id, String code, String name, Object value, Integer sort) {
+        this.id = id;
+        this.code = code;
+        this.name = name;
+        this.value = value;
+        this.sort = sort;
+    }
+
+    public SysConfigResult(SysConfig sysConfig) {
+        this.id = sysConfig.getId();
+        this.code = sysConfig.getConfigKey();
+        this.name = sysConfig.getConfigName();
+        this.value = sysConfig.getConfigValue();
+        this.enable = sysConfig.getEnable();
+        this.sort = sysConfig.getSort();
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    public Boolean getEnable() {
+        return enable;
+    }
+
+    public void setEnable(Boolean enable) {
+        this.enable = enable;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+}

+ 13 - 4
teachcloud-common/src/main/java/com/qmth/teachcloud/common/config/DictionaryConfig.java

@@ -1,9 +1,6 @@
 package com.qmth.teachcloud.common.config;
 
-import com.qmth.teachcloud.common.domain.FssPrivateDomain;
-import com.qmth.teachcloud.common.domain.FssPublicDomain;
-import com.qmth.teachcloud.common.domain.SmsDomain;
-import com.qmth.teachcloud.common.domain.SysDomain;
+import com.qmth.teachcloud.common.domain.*;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -51,4 +48,16 @@ public class DictionaryConfig {
     public FssPrivateDomain fssPrivateDomain() {
         return new FssPrivateDomain();
     }
+
+    @Bean
+    @ConfigurationProperties(prefix = "com.qmth.fss.localpdf", ignoreUnknownFields = false)
+    public FssLocalPdfDomain fssLocalPdfDomain() {
+        return new FssLocalPdfDomain();
+    }
+
+    @Bean
+    @ConfigurationProperties(prefix = "com.qmth.fss.localfile", ignoreUnknownFields = false)
+    public FssLocalFileDomain fssLocalFileDomain() {
+        return new FssLocalFileDomain();
+    }
 }

+ 5 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -252,6 +252,8 @@ public class SystemConstant {
     public static final String GET_EQUAL = "=";
     public static final String PATH_MATCH = "*";
     public static final String PATH_SUBSTR = "/#";
+    public static final String CATALOG_LINK = "->";
+    public static final String OPERATE_LINK = "--";
 
     /**
      * oss url过期时间
@@ -273,7 +275,10 @@ public class SystemConstant {
     public static final String ROLE_CACHE = "role:cache";
     //    public static final String AUTH_INFO_CACHE = "auth:info:cache";
     public static final String SYS_CONFIG_CACHE = "sys:config:cache";
+    public static final String SCHOOL_PRIVILEGE_CACHE = "school:privilege:cache";
+    public static final String SCHOOL_ROLE_CACHE = "school:role:cache";
     public static final String CUSTOM_PRIVILEGE_CACHE = "custom:privilege:cache";
+    public static final String CUSTOM_ROLE_CACHE = "custom:role:cache";
     public static final String NUMBER_CACHE = "school:number:cache:";
     public static final String ORG_COLLEGE_LEVEL_CACHE = "org:college:level:cache";
 

+ 28 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/domain/FssLocalFileDomain.java

@@ -0,0 +1,28 @@
+package com.qmth.teachcloud.common.domain;
+
+/**
+ * @Description:
+ * @Author: CaoZixuan
+ * @Date:
+ */
+public class FssLocalFileDomain {
+    private String config;
+
+    private String server;
+
+    public String getConfig() {
+        return config;
+    }
+
+    public void setConfig(String config) {
+        this.config = config;
+    }
+
+    public String getServer() {
+        return server;
+    }
+
+    public void setServer(String server) {
+        this.server = server;
+    }
+}

+ 28 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/domain/FssLocalPdfDomain.java

@@ -0,0 +1,28 @@
+package com.qmth.teachcloud.common.domain;
+
+/**
+ * @Description:
+ * @Author: CaoZixuan
+ * @Date:
+ */
+public class FssLocalPdfDomain {
+    private String config;
+
+    private String server;
+
+    public String getConfig() {
+        return config;
+    }
+
+    public void setConfig(String config) {
+        this.config = config;
+    }
+
+    public String getServer() {
+        return server;
+    }
+
+    public void setServer(String server) {
+        this.server = server;
+    }
+}

+ 40 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/SysConfig.java

@@ -6,10 +6,12 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.base.BaseEntity;
+import com.qmth.teachcloud.common.bean.result.SysConfigResult;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
+import java.util.Objects;
 
 /**
  * <p>
@@ -53,10 +55,32 @@ public class SysConfig extends BaseEntity implements Serializable {
 
     private String remark;
 
+    @ApiModelProperty(value = "启用/禁用,ture:启用,false:禁用,默认启用")
+    private Boolean enable = true;
+
+    @ApiModelProperty(value = "排序")
+    private Integer sort = 1;
+
     public SysConfig() {
 
     }
 
+    public SysConfig(Long schoolId, SysConfigResult sysConfigResult) {
+        if (Objects.isNull(sysConfigResult.getId())) {
+            setId(SystemConstant.getDbUuid());
+        } else {
+            setId(sysConfigResult.getId());
+        }
+        this.schoolId = schoolId;
+        this.configKey = sysConfigResult.getCode();
+        this.configName = sysConfigResult.getName();
+        this.configValue = String.valueOf(sysConfigResult.getValue());
+        this.enable = sysConfigResult.getEnable();
+        this.sort = sysConfigResult.getSort();
+        setCreateId(1L);
+        setCreateTime(System.currentTimeMillis());
+    }
+
     public SysConfig(Long schoolId, String configKey, String configName, String configValue) {
         setId(SystemConstant.getDbUuid());
         this.schoolId = schoolId;
@@ -67,6 +91,22 @@ public class SysConfig extends BaseEntity implements Serializable {
         setCreateTime(System.currentTimeMillis());
     }
 
+    public Boolean getEnable() {
+        return enable;
+    }
+
+    public void setEnable(Boolean enable) {
+        this.enable = enable;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }

+ 17 - 10
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/log/CustomizedOperationTypeEnum.java

@@ -6,22 +6,29 @@ package com.qmth.teachcloud.common.enums.log;
  * @Date: 2022-11-29
  */
 public enum CustomizedOperationTypeEnum {
-    LOGIN("用户登录"),
-    LOGOUT("用户登出"),
-    ADD("新增"),
-    DELETE("删除"),
-    UPDATE("修改"),
-    SEARCH("查询"),
-    IMPORT("导入"),
-    EXPORT("导出"),
-    UN_KNOW("未知");
+    LOGIN("用户登录", OperationTypeEnum.UN_KNOW),
+    LOGOUT("用户登出", OperationTypeEnum.UN_KNOW),
+    ADD("新增", OperationTypeEnum.EDIT),
+    DELETE("删除", OperationTypeEnum.DELETE),
+    UPDATE("修改", OperationTypeEnum.EDIT),
+    SEARCH("查询", OperationTypeEnum.SELECT),
+    IMPORT("导入", OperationTypeEnum.EDIT),
+    EXPORT("导出", OperationTypeEnum.SELECT),
+    PUSH("推送", OperationTypeEnum.UN_KNOW),
+    UN_KNOW("未知", OperationTypeEnum.UN_KNOW);
     private final String desc;
+    private final OperationTypeEnum operationType;
 
-    CustomizedOperationTypeEnum(String desc) {
+    CustomizedOperationTypeEnum(String desc, OperationTypeEnum operationType) {
         this.desc = desc;
+        this.operationType = operationType;
     }
 
     public String getDesc() {
         return desc;
     }
+
+    public OperationTypeEnum getOperationType() {
+        return operationType;
+    }
 }

+ 67 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/CommonCacheService.java

@@ -436,4 +436,71 @@ public interface CommonCacheService {
      * @param schoolId 学校id
      */
     void removeOrgCollegeLevelCache(Long schoolId);
+
+    /**
+     * 根据学校id查找自定义菜单
+     *
+     * @param schoolId
+     * @return
+     */
+    List<TSchoolPrivilege> addSchoolPrivilegeCache(Long schoolId);
+
+    /**
+     * 根据学校id修改自定义菜单
+     *
+     * @param schoolId
+     * @return
+     */
+    List<TSchoolPrivilege> updateSchoolPrivilegeCache(Long schoolId);
+
+    /**
+     * 根据学校id删除自定义菜单
+     *
+     * @param schoolId
+     */
+    void removeSchoolPrivilegeCache(Long schoolId);
+
+    /**
+     * 根据学校id查找自定义角色
+     *
+     * @param schoolId
+     * @return
+     */
+    List<TSchoolRole> addSchoolRoleCache(Long schoolId);
+
+    /**
+     * 根据学校id修改自定义角色
+     *
+     * @param schoolId
+     * @return
+     */
+    List<TSchoolRole> updateSchoolRoleCache(Long schoolId);
+
+    /**
+     * 根据学校id删除自定义角色
+     *
+     * @param schoolId
+     */
+    void removeSchoolRoleCache(Long schoolId);
+
+    /**
+     * 获取自定义角色
+     *
+     * @return
+     */
+    List<SysRole> addCustomRoleCache();
+
+    /**
+     * 更新自定义角色
+     *
+     * @return
+     */
+    List<SysRole> updateCustomRoleCache();
+
+    /**
+     * 删除自定义角色
+     *
+     * @return
+     */
+    void removeCustomRoleCache();
 }

+ 9 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysPrivilegeService.java

@@ -72,4 +72,13 @@ public interface SysPrivilegeService extends IService<SysPrivilege> {
      * @return
      */
     void removeCustomList();
+
+    /**
+     * 构建权限url的目录
+     *
+     * @param privilegeParentId 权限父id eg。 101
+     * @param path              当前路径
+     * @return eg。考试中心->印刷管理->印刷计划管理
+     */
+    String findPrivilegeUrlCatalog(Long privilegeParentId);
 }

+ 7 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysRoleService.java

@@ -44,4 +44,11 @@ public interface SysRoleService extends IService<SysRole> {
     List<SysRole> list(Long[] roleIds, String name);
 
     List<SysRole> listToUser();
+
+    /**
+     * 查询自定义角色
+     *
+     * @return
+     */
+    List<SysRole> findCustomRole();
 }

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

@@ -51,6 +51,12 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     @Resource
     CacheManager cacheManager;
 
+    @Resource
+    TSchoolPrivilegeService tSchoolPrivilegeService;
+
+    @Resource
+    TSchoolRoleService tSchoolRoleService;
+
     /**
      * 添加角色缓存
      *
@@ -668,4 +674,92 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     public void removeOrgCollegeLevelCache(Long schoolId) {
 
     }
+
+    /**
+     * 根据学校id查找自定义菜单
+     *
+     * @param schoolId
+     * @return
+     */
+    @Override
+    @Cacheable(value = SystemConstant.SCHOOL_PRIVILEGE_CACHE, key = "#p0", unless = "#result == null")
+    public List<TSchoolPrivilege> addSchoolPrivilegeCache(Long schoolId) {
+        return tSchoolPrivilegeService.findBySchoolId(schoolId);
+    }
+
+    /**
+     * 根据学校id修改自定义菜单
+     *
+     * @param schoolId
+     * @return
+     */
+    @Override
+    @CachePut(value = SystemConstant.SCHOOL_PRIVILEGE_CACHE, key = "#p0", condition = "#result != null")
+    public List<TSchoolPrivilege> updateSchoolPrivilegeCache(Long schoolId) {
+        return tSchoolPrivilegeService.findBySchoolId(schoolId);
+    }
+
+    /**
+     * 根据学校id删除自定义菜单
+     *
+     * @param schoolId
+     */
+    @Override
+    @CacheEvict(value = SystemConstant.SCHOOL_PRIVILEGE_CACHE, key = "#p0")
+    public void removeSchoolPrivilegeCache(Long schoolId) {
+
+    }
+
+    /**
+     * 根据学校id查找自定义角色
+     *
+     * @param schoolId
+     * @return
+     */
+    @Override
+    @Cacheable(value = SystemConstant.SCHOOL_ROLE_CACHE, key = "#p0", unless = "#result == null")
+    public List<TSchoolRole> addSchoolRoleCache(Long schoolId) {
+        return tSchoolRoleService.findBySchoolId(schoolId);
+    }
+
+    /**
+     * 根据学校id修改自定义角色
+     *
+     * @param schoolId
+     * @return
+     */
+    @Override
+    @CachePut(value = SystemConstant.SCHOOL_ROLE_CACHE, key = "#p0", condition = "#result != null")
+    public List<TSchoolRole> updateSchoolRoleCache(Long schoolId) {
+        return tSchoolRoleService.findBySchoolId(schoolId);
+    }
+
+    /**
+     * 根据学校id删除自定义角色
+     *
+     * @param schoolId
+     */
+    @Override
+    @CacheEvict(value = SystemConstant.SCHOOL_ROLE_CACHE, key = "#p0")
+    public void removeSchoolRoleCache(Long schoolId) {
+
+    }
+
+    @Override
+    @Cacheable(value = SystemConstant.CUSTOM_ROLE_CACHE, unless = "#result == null")
+    public List<SysRole> addCustomRoleCache() {
+        return sysRoleService.findCustomRole();
+    }
+
+    @Override
+    @CachePut(value = SystemConstant.CUSTOM_ROLE_CACHE, condition = "#result != null")
+    public List<SysRole> updateCustomRoleCache() {
+        return sysRoleService.findCustomRole();
+    }
+
+    @Override
+    @CacheEvict(value = SystemConstant.CUSTOM_ROLE_CACHE)
+    public void removeCustomRoleCache() {
+
+    }
 }

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

@@ -312,6 +312,21 @@ public class SysPrivilegeServiceImpl extends ServiceImpl<SysPrivilegeMapper, Sys
 
     }
 
+    @Override
+    public String findPrivilegeUrlCatalog(Long privilegeParentId) {
+        SysPrivilege sysPrivilege = this.getById(privilegeParentId);
+        if (Objects.nonNull(sysPrivilege)) {
+            String currentName = sysPrivilege.getName();
+            Long parentId = sysPrivilege.getParentId();
+            if (SystemConstant.longNotNull(parentId)) {
+                return this.findPrivilegeUrlCatalog(parentId) + SystemConstant.CATALOG_LINK + currentName;
+            }else {
+                return currentName;
+            }
+        }
+        return SystemConstant.CATALOG_LINK;
+    }
+
     /**
      * 获取自定义菜单
      *

+ 16 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysRoleServiceImpl.java

@@ -330,4 +330,20 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
 //        }
         return this.baseMapper.listRolesBySchoolId(Objects.nonNull(schoolId) ? Long.valueOf(schoolId) : null);
     }
+
+    /**
+     * 查询自定义角色
+     *
+     * @return
+     */
+    @Override
+    public List<SysRole> findCustomRole() {
+        QueryWrapper<SysRole> sysRoleQueryWrapper = new QueryWrapper<>();
+        sysRoleQueryWrapper.lambda().eq(SysRole::getDefaultRole, true)
+                .eq(SysRole::getEnable, true)
+                .isNull(SysRole::getSchoolId)
+                .ne(SysRole::getType, SystemConstant.ADMIN_CODE.toUpperCase())
+                .orderByAsc(SysRole::getId);
+        return sysRoleService.list(sysRoleQueryWrapper);
+    }
 }