xiaof преди 2 години
родител
ревизия
e898393f39
променени са 47 файла, в които са добавени 702 реда и са изтрити 916 реда
  1. 4 5
      paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryCommonServiceImpl.java
  2. 7 10
      paper-library-business/src/main/java/com/qmth/paper/library/business/templete/export/AsyncExportTaskTemplate.java
  3. 7 7
      paper-library-business/src/main/java/com/qmth/paper/library/business/templete/importData/AsyncImportTaskTemplate.java
  4. 0 20
      paper-library-business/src/main/java/com/qmth/paper/library/business/util/SmsUtils.java
  5. 0 43
      paper-library-common-api/src/main/java/com/qmth/paper/library/common/api/SysConfigController.java
  6. 47 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/bean/dto/syssetting/SettingObject.java
  7. 65 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/bean/dto/syssetting/SimpleObject.java
  8. 0 9
      paper-library-common/src/main/java/com/qmth/paper/library/common/config/DictionaryConfig.java
  9. 21 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/contant/SysSettingConstant.java
  10. 2 5
      paper-library-common/src/main/java/com/qmth/paper/library/common/contant/SystemConstant.java
  11. 0 51
      paper-library-common/src/main/java/com/qmth/paper/library/common/domain/OcrDomain.java
  12. 0 9
      paper-library-common/src/main/java/com/qmth/paper/library/common/domain/SmsDomain.java
  13. 0 10
      paper-library-common/src/main/java/com/qmth/paper/library/common/domain/SysDomain.java
  14. 0 121
      paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysConfig.java
  15. 36 16
      paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysSetting.java
  16. 62 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysSettingGlobal.java
  17. 5 4
      paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysUser.java
  18. 0 16
      paper-library-common/src/main/java/com/qmth/paper/library/common/mapper/SysConfigMapper.java
  19. 13 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/mapper/SysSettingGlobalMapper.java
  20. 32 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/CommonCacheService.java
  21. 0 70
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/LibraryCommonService.java
  22. 0 17
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/SysConfigService.java
  23. 21 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/SysSettingGlobalService.java
  24. 7 2
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/SysSettingService.java
  25. 9 8
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/BasicVerifyCodeServiceImpl.java
  26. 58 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/CommonCacheServiceImpl.java
  27. 3 178
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/LibraryCommonServiceImpl.java
  28. 0 33
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/SysConfigServiceImpl.java
  29. 83 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/SysSettingGlobalServiceImpl.java
  30. 36 17
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/SysSettingServiceImpl.java
  31. 10 9
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/SysUserServiceImpl.java
  32. 37 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/util/Base64Util.java
  33. 25 15
      paper-library-common/src/main/java/com/qmth/paper/library/common/util/OcrUtil.java
  34. 0 24
      paper-library-common/src/main/resources/mapper/SysConfigMapper.xml
  35. 4 0
      paper-library-common/src/main/resources/mapper/SysSettingGlobalMapper.xml
  36. 2 3
      paper-library-common/src/main/resources/mapper/SysSettingMapper.xml
  37. 0 3
      paper-library/src/main/java/com/qmth/paper/library/api/MenuCustomController.java
  38. 3 1
      paper-library/src/main/java/com/qmth/paper/library/api/SysController.java
  39. 4 8
      paper-library/src/main/java/com/qmth/paper/library/api/SysSettingController.java
  40. 53 0
      paper-library/src/main/java/com/qmth/paper/library/api/SysSettingGlobalController.java
  41. 0 98
      paper-library/src/main/resources/application-36dev.properties
  42. 6 13
      paper-library/src/main/resources/application-dev.properties
  43. 5 29
      paper-library/src/main/resources/application-offline.properties
  44. 0 0
      paper-library/src/main/resources/ehcache/ehcache.xml
  45. BIN
      paper-library/src/main/resources/static/wx_logo.png
  46. 18 31
      sql/paper-library-v1.0.1-按罗总要求优化后.sql
  47. 17 31
      sql/paper-library-v1.0.1.sql

+ 4 - 5
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryCommonServiceImpl.java

@@ -10,6 +10,7 @@ import com.qmth.paper.library.business.service.PaperLibraryCommonService;
 import com.qmth.paper.library.common.bean.dto.OrgDto;
 import com.qmth.paper.library.common.config.DictionaryConfig;
 import com.qmth.paper.library.common.contant.SpringContextHolder;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
 import com.qmth.paper.library.common.contant.SystemConstant;
 import com.qmth.paper.library.common.entity.BasicAttachment;
 import com.qmth.paper.library.common.entity.SysOrg;
@@ -50,10 +51,8 @@ import java.util.*;
 @Service
 public class PaperLibraryCommonServiceImpl implements PaperLibraryCommonService {
     private final static Logger log = LoggerFactory.getLogger(PaperLibraryCommonServiceImpl.class);
-
-//    @Resource
-//    OssUtil ossUtil;
-
+    @Resource
+    CommonCacheService commonCacheService;
     @Autowired
     private DictionaryConfig dictionaryConfig;
 
@@ -342,7 +341,7 @@ public class PaperLibraryCommonServiceImpl implements PaperLibraryCommonService
         String pathUrl;
         // 本地文件
         if (Objects.equals(type, SystemConstant.LOCAL)) {
-            String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.fssLocalFileDomain().getServer());
+            String hostUrl = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_FILE_HOST_URL);
             path = SystemConstant.getLocalFilePath(hostUrl, path);
             if (path.startsWith("/")) {
                 pathUrl = hostUrl + path;

+ 7 - 10
paper-library-business/src/main/java/com/qmth/paper/library/business/templete/export/AsyncExportTaskTemplate.java

@@ -6,14 +6,14 @@ import com.qmth.boot.api.exception.ApiException;
 import com.qmth.paper.library.business.templete.importData.AsyncImportTaskTemplate;
 import com.qmth.paper.library.common.config.DictionaryConfig;
 import com.qmth.paper.library.common.contant.SpringContextHolder;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
 import com.qmth.paper.library.common.contant.SystemConstant;
-import com.qmth.paper.library.common.entity.SysConfig;
 import com.qmth.paper.library.common.entity.TBTask;
 import com.qmth.paper.library.common.enums.LocalCatalogEnum;
 import com.qmth.paper.library.common.enums.TaskResultEnum;
 import com.qmth.paper.library.common.enums.TaskStatusEnum;
 import com.qmth.paper.library.common.enums.UploadFileEnum;
-import com.qmth.paper.library.common.service.SysConfigService;
+import com.qmth.paper.library.common.service.CommonCacheService;
 import com.qmth.paper.library.common.service.TBTaskService;
 import com.qmth.paper.library.common.util.FileStoreUtil;
 import com.qmth.paper.library.common.util.Result;
@@ -24,7 +24,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.annotation.Async;
 
-import javax.annotation.Resource;
 import java.io.*;
 import java.text.MessageFormat;
 import java.time.LocalDateTime;
@@ -41,8 +40,6 @@ import java.util.StringJoiner;
  * @Date: 2021/3/29
  */
 public abstract class AsyncExportTaskTemplate {
-    @Resource
-    SysConfigService sysConfigService;
 
     private final static Logger log = LoggerFactory.getLogger(AsyncImportTaskTemplate.class);
     public static final String BEGIN_TITLE = "->开始准备处理导出的";
@@ -99,11 +96,11 @@ public abstract class AsyncExportTaskTemplate {
             String type = (String) jsonObject.get(SystemConstant.TYPE);
 
             String charset = SystemConstant.CHARSET_GBK;
-            SysConfigService sysConfigService = SpringContextHolder.getBean(SysConfigService.class);
-            if (sysConfigService != null) {
-                SysConfig sysConfig = sysConfigService.getByKey(SystemConstant.SYS_CONFIG_KEY_CHARSETS);
-                if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
-                    charset = sysConfig.getConfigValue();
+            CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
+            if (commonCacheService != null) {
+                String txtCharset = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_TXT_CHARSET);
+                if (StringUtils.isNotBlank(txtCharset)) {
+                    charset = txtCharset;
                 }
             }
 

+ 7 - 7
paper-library-business/src/main/java/com/qmth/paper/library/business/templete/importData/AsyncImportTaskTemplate.java

@@ -4,14 +4,14 @@ import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.paper.library.common.contant.SpringContextHolder;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
 import com.qmth.paper.library.common.contant.SystemConstant;
-import com.qmth.paper.library.common.entity.SysConfig;
 import com.qmth.paper.library.common.entity.TBTask;
 import com.qmth.paper.library.common.enums.LocalCatalogEnum;
 import com.qmth.paper.library.common.enums.TaskResultEnum;
 import com.qmth.paper.library.common.enums.TaskStatusEnum;
 import com.qmth.paper.library.common.enums.UploadFileEnum;
-import com.qmth.paper.library.common.service.SysConfigService;
+import com.qmth.paper.library.common.service.CommonCacheService;
 import com.qmth.paper.library.common.service.TBTaskService;
 import com.qmth.paper.library.common.util.FileStoreUtil;
 import com.qmth.paper.library.common.util.Result;
@@ -109,11 +109,11 @@ public abstract class AsyncImportTaskTemplate {
             String type = (String) jsonObject.get(SystemConstant.TYPE);
 
             String charset = SystemConstant.CHARSET_GBK;
-            SysConfigService sysConfigService = SpringContextHolder.getBean(SysConfigService.class);
-            if (sysConfigService != null) {
-                SysConfig sysConfig = sysConfigService.getByKey(SystemConstant.SYS_CONFIG_KEY_CHARSETS);
-                if (sysConfig != null && StringUtils.isNotBlank(sysConfig.getConfigValue())) {
-                    charset = sysConfig.getConfigValue();
+            CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
+            if (commonCacheService != null) {
+                String txtCharset = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_TXT_CHARSET);
+                if (StringUtils.isNotBlank(txtCharset)) {
+                    charset = txtCharset;
                 }
             }
 

+ 0 - 20
paper-library-business/src/main/java/com/qmth/paper/library/business/util/SmsUtils.java

@@ -8,13 +8,10 @@ import com.aliyuncs.exceptions.ClientException;
 import com.aliyuncs.http.MethodType;
 import com.aliyuncs.profile.DefaultProfile;
 import com.aliyuncs.profile.IClientProfile;
-import com.qmth.paper.library.business.enums.MessageEnum;
 import com.qmth.paper.library.common.config.DictionaryConfig;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * @Date: 2021/11/5.
@@ -69,21 +66,4 @@ public class SmsUtils {
         SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
         return sendSmsResponse;
     }
-
-    public Map<String, String> getCodeAndContentByEnum(MessageEnum messageEnum) {
-        Map<String, String> result = new HashMap<>();
-        String templateContent = null;
-        String templateCode = null;
-        switch (messageEnum) {
-            case NOTICE_OF_AUDIT_PASS:
-                templateCode = dictionaryConfig.smsDomain().getAliyunSMSAuditPassCode();
-                templateContent = messageEnum.getTemplate();
-                break;
-            default:
-                break;
-        }
-        result.put("templateContent", templateContent);
-        result.put("templateCode", templateCode);
-        return result;
-    }
 }

+ 0 - 43
paper-library-common-api/src/main/java/com/qmth/paper/library/common/api/SysConfigController.java

@@ -1,43 +0,0 @@
-package com.qmth.paper.library.common.api;
-
-import com.qmth.boot.api.annotation.Aac;
-import com.qmth.boot.api.annotation.BOOL;
-import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.paper.library.common.contant.ApiPrefixConstant;
-import com.qmth.paper.library.common.entity.SysConfig;
-import com.qmth.paper.library.common.service.SysConfigService;
-import com.qmth.paper.library.common.util.Result;
-import com.qmth.paper.library.common.util.ResultUtil;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * <p>
- * 参数表 前端控制器
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
-@Api(tags = "参数Controller")
-@RestController
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + ApiPrefixConstant.PREFIX_COMMON + "/sys_config")
-public class SysConfigController {
-
-    @Autowired
-    private SysConfigService sysConfigService;
-
-    @ApiOperation(value = "根据key查询")
-    @RequestMapping(value = "/get_one", method = RequestMethod.POST)
-    @Aac(auth = BOOL.FALSE)
-    public Result getOne(@RequestParam(value = "key", required = false) String key) {
-        SysConfig value = sysConfigService.getByKey(key);
-        return ResultUtil.ok(value);
-    }
-}
-

+ 47 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/bean/dto/syssetting/SettingObject.java

@@ -0,0 +1,47 @@
+package com.qmth.paper.library.common.bean.dto.syssetting;
+
+import java.util.List;
+
+public class SettingObject {
+
+    private String name;
+
+    private int sort;
+
+    private List<SimpleObject> data;
+
+    public SettingObject() {
+    }
+
+    public SettingObject(String name, int sort, List<SimpleObject> data) {
+        this.name = name;
+        this.sort = sort;
+        this.data = data;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getSort() {
+        return sort;
+    }
+
+    public void setSort(int sort) {
+        this.sort = sort;
+    }
+
+    public List<SimpleObject> getData() {
+        return data;
+    }
+
+    public void setData(List<SimpleObject> data) {
+        this.data = data;
+    }
+
+
+}

+ 65 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/bean/dto/syssetting/SimpleObject.java

@@ -0,0 +1,65 @@
+package com.qmth.paper.library.common.bean.dto.syssetting;
+
+public class SimpleObject {
+
+    private String code;
+
+    private String value;
+
+    private String name;
+
+    private int sort;
+
+    private boolean enable;
+
+    public SimpleObject() {
+    }
+
+    public SimpleObject(String code, String name, String value, int sort, boolean enable) {
+        this.code = code;
+        this.name = name;
+        this.value = value;
+        this.sort = sort;
+        this.enable = enable;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getSort() {
+        return sort;
+    }
+
+    public void setSort(int sort) {
+        this.sort = sort;
+    }
+
+    public boolean isEnable() {
+        return enable;
+    }
+
+    public void setEnable(boolean enable) {
+        this.enable = enable;
+    }
+}

+ 0 - 9
paper-library-common/src/main/java/com/qmth/paper/library/common/config/DictionaryConfig.java

@@ -51,13 +51,4 @@ public class DictionaryConfig {
     public FssLocalFileDomain fssLocalFileDomain() {
         return new FssLocalFileDomain();
     }
-
-    /**
-     * ocr配置
-     */
-    @Bean
-    @ConfigurationProperties(prefix = "ocr.config")
-    public OcrDomain ocrDomain() {
-        return new OcrDomain();
-    }
 }

+ 21 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/contant/SysSettingConstant.java

@@ -0,0 +1,21 @@
+package com.qmth.paper.library.common.contant;
+
+/**
+ * API常量
+ */
+public class SysSettingConstant {
+    /**
+     * api请求前缀
+     */
+    public static final String SYS_INIT_PASSWORD = "initPassword";
+    public static final String SYS_FILE_HOST_URL = "fileHostUrl";
+    public static final String SYS_VERIFICATION_CODE_LOGIN_ENABLE = "verificationCodeLoginEnable";
+    public static final String SYS_SMS_NOTIFICATION_ENABLE = "SMSNotificationEnable";
+    public static final String SYS_TXT_CHARSET = "txtCharset";
+    public static final String OCR_OPEN = "openOcr";
+    public static final String OCR_APP_ID = "ocrAppId";
+    public static final String OCR_APP_KEY = "ocrAppKey";
+    public static final String OCR_APP_SECRET = "ocrAppSecret";
+    public static final String CHECK_OPEN_GLOBAL_MATCH = "openGlobalMatch";
+
+}

+ 2 - 5
paper-library-common/src/main/java/com/qmth/paper/library/common/contant/SystemConstant.java

@@ -34,9 +34,6 @@ public class SystemConstant {
      */
     public static final int OCR_CONNECTION_TIMEOUT_IN_MILLIS = 2000;
     public static final int OCR_SOCKET_TIMEOUT_IN_MILLIS = 60000;
-    public static final String SYS_CONFIG_KEY_CHARSETS = "sys.txt.charset";
-    public static final String SYS_PDF_SIZE_LIST = "sys.pdf.size.list";
-    public static final String PDF_SIZE_LIST = "pdf.size.list";
     public static final String CHARSET_NAME = "UTF-8";
     public static final String CHARSET_GBK = "gbk";
     public static final Charset CHARSET = Charset.forName(CHARSET_NAME);
@@ -431,10 +428,10 @@ public class SystemConstant {
      * @return
      */
     public static String getLocalFilePath(String hostUrl, String filePath) {
-        Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置hostUrl"));
+        Optional.ofNullable(hostUrl).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置文件访问地址"));
         String[] hostArray = hostUrl.split(":");
         if (hostArray.length == 2 && filePath.contains(SystemConstant.IMAGE_TEMP)) {
-            filePath = filePath.substring(filePath.indexOf(SystemConstant.IMAGE_TEMP), filePath.length());
+            filePath = filePath.substring(filePath.indexOf(SystemConstant.IMAGE_TEMP));
         }
         return filePath;
     }

+ 0 - 51
paper-library-common/src/main/java/com/qmth/paper/library/common/domain/OcrDomain.java

@@ -1,51 +0,0 @@
-package com.qmth.paper.library.common.domain;
-
-/**
- * @Description: ocr前缀
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2022/10/12
- */
-public class OcrDomain {
-
-    String appId;
-
-    String appKey;
-
-    String appSecret;
-
-    public OcrDomain() {
-
-    }
-
-    public OcrDomain(String appId, String appKey, String appSecret) {
-        this.appId = appId;
-        this.appKey = appKey;
-        this.appSecret = appSecret;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-
-    public void setAppId(String appId) {
-        this.appId = appId;
-    }
-
-    public String getAppKey() {
-        return appKey;
-    }
-
-    public void setAppKey(String appKey) {
-        this.appKey = appKey;
-    }
-
-    public String getAppSecret() {
-        return appSecret;
-    }
-
-    public void setAppSecret(String appSecret) {
-        this.appSecret = appSecret;
-    }
-}

+ 0 - 9
paper-library-common/src/main/java/com/qmth/paper/library/common/domain/SmsDomain.java

@@ -12,7 +12,6 @@ public class SmsDomain {
     String aliyunSMSSecret;
     String aliyunSMSSignName;
     String aliyunSMSTplCode;
-    String aliyunSMSAuditPassCode;
 
     public String getSmsNormalCode() {
         return smsNormalCode;
@@ -69,12 +68,4 @@ public class SmsDomain {
     public void setAliyunSMSTplCode(String aliyunSMSTplCode) {
         this.aliyunSMSTplCode = aliyunSMSTplCode;
     }
-
-    public String getAliyunSMSAuditPassCode() {
-        return aliyunSMSAuditPassCode;
-    }
-
-    public void setAliyunSMSAuditPassCode(String aliyunSMSAuditPassCode) {
-        this.aliyunSMSAuditPassCode = aliyunSMSAuditPassCode;
-    }
 }

+ 0 - 10
paper-library-common/src/main/java/com/qmth/paper/library/common/domain/SysDomain.java

@@ -21,8 +21,6 @@ public class SysDomain implements Serializable {
 
     Double attachmentSize;
 
-    String adminLogoUrl;
-
     Duration sessionActive;
 
     public Duration getSessionActive() {
@@ -33,14 +31,6 @@ public class SysDomain implements Serializable {
         this.sessionActive = sessionActive;
     }
 
-    public String getAdminLogoUrl() {
-        return adminLogoUrl;
-    }
-
-    public void setAdminLogoUrl(String adminLogoUrl) {
-        this.adminLogoUrl = adminLogoUrl;
-    }
-
     public Integer getAttachmentLength() {
         return attachmentLength;
     }

+ 0 - 121
paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysConfig.java

@@ -1,121 +0,0 @@
-package com.qmth.paper.library.common.entity;
-
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import com.qmth.paper.library.common.base.BaseEntity;
-import com.qmth.paper.library.common.contant.SystemConstant;
-import io.swagger.annotations.ApiModelProperty;
-
-import java.io.Serializable;
-
-/**
- * <p>
- * 参数表
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
-@TableName("sys_config")
-public class SysConfig extends BaseEntity implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty(value = "学校id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField("school_id")
-    private Long schoolId;
-
-    @ApiModelProperty(value = "机构id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField("org_id")
-    private Long orgId;
-
-    /**
-     * 参数键值
-     */
-    @TableField("config_key")
-    private String configKey;
-
-    /**
-     * 参数名称
-     */
-    @TableField("config_name")
-    private String configName;
-    /**
-     * 参数键值
-     */
-    @TableField(value = "config_value", updateStrategy = FieldStrategy.IGNORED)
-    private String configValue;
-
-    private String remark;
-
-    public SysConfig() {
-
-    }
-
-    public SysConfig(Long schoolId, String configKey, String configName, String configValue) {
-        setId(SystemConstant.getDbUuid());
-        this.schoolId = schoolId;
-        this.configKey = configKey;
-        this.configName = configName;
-        this.configValue = configValue;
-        setCreateId(1L);
-        setCreateTime(System.currentTimeMillis());
-    }
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public Long getSchoolId() {
-        return schoolId;
-    }
-
-    public void setSchoolId(Long schoolId) {
-        this.schoolId = schoolId;
-    }
-
-    public Long getOrgId() {
-        return orgId;
-    }
-
-    public void setOrgId(Long orgId) {
-        this.orgId = orgId;
-    }
-
-    public String getConfigKey() {
-        return configKey;
-    }
-
-    public void setConfigKey(String configKey) {
-        this.configKey = configKey;
-    }
-
-    public String getConfigName() {
-        return configName;
-    }
-
-    public void setConfigName(String configName) {
-        this.configName = configName;
-    }
-
-    public String getConfigValue() {
-        return configValue;
-    }
-
-    public void setConfigValue(String configValue) {
-        this.configValue = configValue;
-    }
-
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-}

+ 36 - 16
paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysSetting.java

@@ -1,13 +1,19 @@
 package com.qmth.paper.library.common.entity;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.paper.library.common.base.BaseEntity;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
+import com.qmth.paper.library.common.bean.dto.syssetting.SimpleObject;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * <p>
@@ -24,17 +30,12 @@ public class SysSetting extends BaseEntity implements Serializable {
     @TableField("school_id")
     private Long schoolId;
 
-    /**
-     * 是否开启ocr识别
-     */
-    @TableField("open_ocr")
-    private Boolean openOcr;
 
     /**
      * 是否开启全局匹配
      */
-    @TableField("open_global_match")
-    private Boolean openGlobalMatch;
+    @TableField("parameter_object")
+    private String parameterObject;
 
     public Long getSchoolId() {
         return schoolId;
@@ -44,19 +45,38 @@ public class SysSetting extends BaseEntity implements Serializable {
         this.schoolId = schoolId;
     }
 
-    public Boolean getOpenOcr() {
-        return openOcr;
+    public String getParameterObject() {
+        return parameterObject;
     }
 
-    public void setOpenOcr(Boolean openOcr) {
-        this.openOcr = openOcr;
+    public void setParameterObject(String parameterObject) {
+        this.parameterObject = parameterObject;
     }
 
-    public Boolean getOpenGlobalMatch() {
-        return openGlobalMatch;
-    }
+    /**
+     * 初始化数据
+     */
+    public static SysSetting init(Long schoolId) {
+        List<SettingObject> settingObjects = new ArrayList<>();
+        List<SimpleObject> simpleObjects1 = new ArrayList<>();
+        simpleObjects1.add(new SimpleObject(SysSettingConstant.SYS_VERIFICATION_CODE_LOGIN_ENABLE, "是否开启验证码登录", "false", 2, true));
+        simpleObjects1.add(new SimpleObject(SysSettingConstant.SYS_SMS_NOTIFICATION_ENABLE, "是否开启短信提醒功能", "false", 3, true));
+
+        settingObjects.add(new SettingObject("系统设置", 1, simpleObjects1));
+
+        List<SimpleObject> simpleObjects2 = new ArrayList<>();
+        simpleObjects2.add(new SimpleObject(SysSettingConstant.OCR_OPEN, "是否启用OCR", "false", 1, true));
+
+        settingObjects.add(new SettingObject("OCR设置", 2, simpleObjects2));
+
+        List<SimpleObject> simpleObjects3 = new ArrayList<>();
+        simpleObjects3.add(new SimpleObject(SysSettingConstant.CHECK_OPEN_GLOBAL_MATCH, "是否开启全局匹配", "false", 1, true));
+
+        settingObjects.add(new SettingObject("图片检查设置", 3, simpleObjects3));
 
-    public void setOpenGlobalMatch(Boolean openGlobalMatch) {
-        this.openGlobalMatch = openGlobalMatch;
+        SysSetting sysSetting = new SysSetting();
+        sysSetting.setSchoolId(schoolId);
+        sysSetting.setParameterObject(JSON.toJSONString(settingObjects));
+        return sysSetting;
     }
 }

+ 62 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysSettingGlobal.java

@@ -0,0 +1,62 @@
+package com.qmth.paper.library.common.entity;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.qmth.paper.library.common.base.BaseEntity;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
+import com.qmth.paper.library.common.bean.dto.syssetting.SimpleObject;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 系统设置表
+ * </p>
+ */
+@TableName("sys_setting_global")
+public class SysSettingGlobal extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 是否开启全局匹配
+     */
+    @TableField("parameter_object")
+    private String parameterObject;
+
+    public String getParameterObject() {
+        return parameterObject;
+    }
+
+    public void setParameterObject(String parameterObject) {
+        this.parameterObject = parameterObject;
+    }
+
+    /**
+     * 初始化数据
+     */
+    public static SysSettingGlobal init() {
+        List<SettingObject> settingObjects = new ArrayList<>();
+        List<SimpleObject> simpleObjects1 = new ArrayList<>();
+        simpleObjects1.add(new SimpleObject(SysSettingConstant.SYS_INIT_PASSWORD, "默认初始登录密码", "123456", 1, true));
+        simpleObjects1.add(new SimpleObject(SysSettingConstant.SYS_FILE_HOST_URL, "文件访问地址", "", 2, true));
+        simpleObjects1.add(new SimpleObject(SysSettingConstant.SYS_TXT_CHARSET, "异步任务txt日志文件编码", "gbk", 3, true));
+
+        settingObjects.add(new SettingObject("系统设置", 1, simpleObjects1));
+
+        List<SimpleObject> simpleObjects2 = new ArrayList<>();
+        simpleObjects2.add(new SimpleObject(SysSettingConstant.OCR_APP_ID, "OCR AppId", "", 2, true));
+        simpleObjects2.add(new SimpleObject(SysSettingConstant.OCR_APP_KEY, "OCR AppKey", "", 3, true));
+        simpleObjects2.add(new SimpleObject(SysSettingConstant.OCR_APP_SECRET, "OCR AppSecret", "", 4, true));
+
+        settingObjects.add(new SettingObject("OCR参数设置", 2, simpleObjects2));
+
+        SysSettingGlobal sysSetting = new SysSettingGlobal();
+        sysSetting.setParameterObject(JSON.toJSONString(settingObjects));
+        return sysSetting;
+    }
+}

+ 5 - 4
paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysUser.java

@@ -6,8 +6,9 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.paper.library.common.base.BaseEntity;
 import com.qmth.paper.library.common.contant.SpringContextHolder;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
 import com.qmth.paper.library.common.contant.SystemConstant;
-import com.qmth.paper.library.common.service.SysConfigService;
+import com.qmth.paper.library.common.service.CommonCacheService;
 import com.qmth.paper.library.common.util.Base64Util;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.StringUtils;
@@ -139,9 +140,9 @@ public class SysUser extends BaseEntity implements Serializable {
     @Override
     public void insertInfo(Long userId) {
         super.insertInfo(userId);
-        SysConfigService sysConfigService = SpringContextHolder.getBean(SysConfigService.class);
-        SysConfig sysConfig = sysConfigService.getByKey("sys.user.initPassword");
-        setPassword(Base64Util.encode(StringUtils.isNoneBlank(sysConfig.getConfigValue()) ? sysConfig.getConfigValue().getBytes() : "123456".getBytes()));
+        CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
+        String initPassword = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_INIT_PASSWORD);
+        setPassword(Base64Util.encode(StringUtils.isNoneBlank(initPassword) ? initPassword.getBytes() : "123456".getBytes()));
     }
 
     public static long getSerialVersionUID() {

+ 0 - 16
paper-library-common/src/main/java/com/qmth/paper/library/common/mapper/SysConfigMapper.java

@@ -1,16 +0,0 @@
-package com.qmth.paper.library.common.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.qmth.paper.library.common.entity.SysConfig;
-
-/**
- * <p>
- * 参数表 Mapper 接口
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
-public interface SysConfigMapper extends BaseMapper<SysConfig> {
-
-}

+ 13 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/mapper/SysSettingGlobalMapper.java

@@ -0,0 +1,13 @@
+package com.qmth.paper.library.common.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.paper.library.common.entity.SysSettingGlobal;
+
+/**
+ * <p>
+ * 系统全局设置 Mapper 接口
+ * </p>
+ */
+public interface SysSettingGlobalMapper extends BaseMapper<SysSettingGlobal> {
+
+}

+ 32 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/service/CommonCacheService.java

@@ -2,6 +2,8 @@ package com.qmth.paper.library.common.service;
 
 import com.qmth.paper.library.common.entity.TBSession;
 
+import java.util.Map;
+
 public interface CommonCacheService {
 
     /**
@@ -26,4 +28,34 @@ public interface CommonCacheService {
      * @return
      */
     String removeTbSession(String sessionId);
+
+    /**
+     * 查询系统参数数据
+     *
+     * @param schoolId
+     * @return
+     */
+    Map<String, String> getSysSetting(Long schoolId);
+
+    /**
+     * 删除系统参数数据
+     *
+     * @param schoolId
+     * @return
+     */
+    String removeSysSetting(Long schoolId);
+
+    /**
+     * 查询全局系统参数数据
+     *
+     * @return
+     */
+    Map<String, String> getSysSettingGlobal();
+
+    /**
+     * 删除全局系统参数数据
+     *
+     * @return
+     */
+    String removeSysSettingGlobal();
 }

+ 0 - 70
paper-library-common/src/main/java/com/qmth/paper/library/common/service/LibraryCommonService.java

@@ -4,15 +4,12 @@ import com.qmth.paper.library.common.bean.auth.AuthBean;
 import com.qmth.paper.library.common.bean.dto.AuthOrgInfoDto;
 import com.qmth.paper.library.common.bean.result.LoginResult;
 import com.qmth.paper.library.common.bean.result.MenuResult;
-import com.qmth.paper.library.common.entity.BasicAttachment;
 import com.qmth.paper.library.common.entity.SysRolePrivilege;
 import com.qmth.paper.library.common.entity.SysUser;
 import com.qmth.paper.library.common.entity.SysUserRole;
 import com.qmth.paper.library.common.enums.AppSourceEnum;
 import com.qmth.paper.library.common.enums.PrivilegePropertyEnum;
 
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
 import java.security.NoSuchAlgorithmException;
 import java.util.List;
 import java.util.Set;
@@ -34,14 +31,6 @@ public interface LibraryCommonService {
      */
     public MenuResult getUserMenu(Long userId);
 
-    /**
-     * 新增用户权限
-     *
-     * @param sysUser
-     * @param roleId
-     */
-    public void addUserRolePrivilege(SysUser sysUser, Long roleId);
-
     /**
      * 新增用户权限
      *
@@ -50,15 +39,6 @@ public interface LibraryCommonService {
      */
     public void addUserRolePrivilege(SysUser sysUser, Long[] roleIds);
 
-    /**
-     * 获取要新增的用户权限集合
-     *
-     * @param sysUser
-     * @param roleIds
-     * @return
-     */
-    List<SysUserRole> disposeUserPrivilege(SysUser sysUser, Long[] roleIds);
-
     /**
      * 获取用户角色
      *
@@ -83,14 +63,6 @@ public interface LibraryCommonService {
      */
     public AuthBean getUserAuth(Long userId);
 
-    /**
-     * 获取鉴权url
-     *
-     * @param privilegePropertyEnum
-     * @return
-     */
-    public Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum);
-
     /**
      * 获取鉴权url
      *
@@ -126,48 +98,6 @@ public interface LibraryCommonService {
 
     String preViewPath(String path, String uploadType, String type, Boolean isExpire);
 
-    /**
-     * 文件预览
-     *
-     * @param path
-     * @return
-     */
-    public String filePreviewByPathAndType(String path, String type, Boolean isExpire);
-
-    /**
-     * 获取文件
-     *
-     * @param path
-     * @param pdf
-     * @return
-     */
-    public File getFile(String path, boolean pdf) throws Exception;
-
-    /**
-     * 下载文件到本地
-     *
-     * @param rootPath   保存目录
-     * @param attachment 附件表对象
-     * @return
-     */
-    public File copyFile(String rootPath, String fileName, BasicAttachment attachment) throws Exception;
-
-    /**
-     * 下载文件到本地并压缩返回
-     *
-     * @param filePath 文件根目录
-     * @param files    需要下载的文件集合
-     */
-    public void downloadFileAndZip(HttpServletResponse response, String filePath, List<File> files);
-
-    /**
-     * 下载文件到本地并压缩返回
-     *
-     * @param filePath 文件根目录
-     * @param time     zip文件名(时间戳)
-     */
-    public void downloadFileAndZip(HttpServletResponse response, String filePath, long time);
-
     /**
      * 根据orgId查询所有子机构ID集合
      *

+ 0 - 17
paper-library-common/src/main/java/com/qmth/paper/library/common/service/SysConfigService.java

@@ -1,17 +0,0 @@
-package com.qmth.paper.library.common.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.qmth.paper.library.common.entity.SysConfig;
-
-/**
- * <p>
- * 参数表 服务类
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
-public interface SysConfigService extends IService<SysConfig> {
-
-    SysConfig getByKey(String key);
-}

+ 21 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/service/SysSettingGlobalService.java

@@ -0,0 +1,21 @@
+package com.qmth.paper.library.common.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
+import com.qmth.paper.library.common.entity.SysSettingGlobal;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 系统全局设置 服务类
+ * </p>
+ */
+public interface SysSettingGlobalService extends IService<SysSettingGlobal> {
+
+    List<SettingObject> getData();
+
+    boolean saveData(List<SettingObject> settingObjects);
+
+    SysSettingGlobal getOnlyOne();
+}

+ 7 - 2
paper-library-common/src/main/java/com/qmth/paper/library/common/service/SysSettingService.java

@@ -1,8 +1,11 @@
 package com.qmth.paper.library.common.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
 import com.qmth.paper.library.common.entity.SysSetting;
 
+import java.util.List;
+
 /**
  * <p>
  * 系统设置 服务类
@@ -10,7 +13,9 @@ import com.qmth.paper.library.common.entity.SysSetting;
  */
 public interface SysSettingService extends IService<SysSetting> {
 
-    SysSetting getData();
+    List<SettingObject> getData();
+
+    boolean saveData(List<SettingObject> settingObjects);
 
-    boolean saveData(SysSetting sysSetting);
+    SysSetting getBySchoolId(Long schoolId);
 }

+ 9 - 8
paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/BasicVerifyCodeServiceImpl.java

@@ -11,16 +11,17 @@ import com.aliyuncs.profile.IClientProfile;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.paper.library.common.config.DictionaryConfig;
-import com.qmth.paper.library.common.enums.ExceptionResultEnum;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
 import com.qmth.paper.library.common.entity.BasicVerifyCode;
-import com.qmth.paper.library.common.entity.SysConfig;
 import com.qmth.paper.library.common.entity.SysUser;
+import com.qmth.paper.library.common.enums.ExceptionResultEnum;
 import com.qmth.paper.library.common.mapper.BasicVerifyCodeMapper;
 import com.qmth.paper.library.common.service.BasicVerifyCodeService;
-import com.qmth.paper.library.common.service.SysConfigService;
+import com.qmth.paper.library.common.service.CommonCacheService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.Calendar;
 import java.util.Date;
 
@@ -38,16 +39,16 @@ public class BasicVerifyCodeServiceImpl extends ServiceImpl<BasicVerifyCodeMappe
     @Autowired
     private DictionaryConfig dictionaryConfig;
 
-    @Autowired
-    private SysConfigService sysConfigService;
+    @Resource
+    private CommonCacheService commonCacheService;
 
     @Override
     public void sendVeirfyCode(String mobileNumber, SysUser sysUser) {
-        SysConfig sysConfig = sysConfigService.getByKey("sys.code.enable");
-        if (sysConfig.getConfigValue() == null) {
+        String verificationCodeLoginEnable = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_VERIFICATION_CODE_LOGIN_ENABLE);
+        if (verificationCodeLoginEnable == null) {
             throw ExceptionResultEnum.ERROR.exception("短信验证码启用开关未设置");
         }
-        if (sysConfig.getConfigValue().equals("false")) {
+        if (verificationCodeLoginEnable.equals("false") || verificationCodeLoginEnable.equals("0")) {
             throw ExceptionResultEnum.ERROR.exception("短信验证码已关闭");
         }
         QueryWrapper<BasicVerifyCode> wrapper = new QueryWrapper<>();

+ 58 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/CommonCacheServiceImpl.java

@@ -1,8 +1,15 @@
 package com.qmth.paper.library.common.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
+import com.qmth.paper.library.common.bean.dto.syssetting.SimpleObject;
 import com.qmth.paper.library.common.contant.SystemConstant;
+import com.qmth.paper.library.common.entity.SysSetting;
+import com.qmth.paper.library.common.entity.SysSettingGlobal;
 import com.qmth.paper.library.common.entity.TBSession;
 import com.qmth.paper.library.common.service.CommonCacheService;
+import com.qmth.paper.library.common.service.SysSettingGlobalService;
+import com.qmth.paper.library.common.service.SysSettingService;
 import com.qmth.paper.library.common.service.TBSessionService;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
@@ -10,6 +17,9 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Service
 public class CommonCacheServiceImpl implements CommonCacheService {
@@ -17,6 +27,12 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     @Resource
     TBSessionService tbSessionService;
 
+    @Resource
+    SysSettingService sysSettingService;
+
+    @Resource
+    SysSettingGlobalService sysSettingGlobalService;
+
     @Override
     @CachePut(value = SystemConstant.CACHE_NAME, key = "'tbSession' + #sessionId")
     public TBSession saveTbSession(String sessionId, TBSession tbSession) {
@@ -34,4 +50,46 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     public String removeTbSession(String sessionId) {
         return null;
     }
+
+    @Override
+    @Cacheable(value = SystemConstant.CACHE_NAME, key = "'sysSetting' + #schoolId")
+    public Map<String, String> getSysSetting(Long schoolId) {
+        SysSetting sysSetting = sysSettingService.getBySchoolId(schoolId);
+        String parameterObject = sysSetting.getParameterObject();
+        List<SettingObject> settingObjects = JSON.parseArray(parameterObject, SettingObject.class);
+        Map<String, String> map = new HashMap<>();
+        for (SettingObject settingObject : settingObjects) {
+            for (SimpleObject simpleObject : settingObject.getData()) {
+                map.put(simpleObject.getCode(), simpleObject.getValue());
+            }
+        }
+        return map;
+    }
+
+    @Override
+    @CacheEvict(value = SystemConstant.CACHE_NAME, key = "'sysSetting' + #schoolId")
+    public String removeSysSetting(Long schoolId) {
+        return null;
+    }
+
+    @Override
+    @Cacheable(value = SystemConstant.CACHE_NAME, key = "'sysSetting'")
+    public Map<String, String> getSysSettingGlobal() {
+        SysSettingGlobal sysSettingGlobal = sysSettingGlobalService.getOnlyOne();
+        String parameterObject = sysSettingGlobal.getParameterObject();
+        List<SettingObject> settingObjects = JSON.parseArray(parameterObject, SettingObject.class);
+        Map<String, String> map = new HashMap<>();
+        for (SettingObject settingObject : settingObjects) {
+            for (SimpleObject simpleObject : settingObject.getData()) {
+                map.put(simpleObject.getCode(), simpleObject.getValue());
+            }
+        }
+        return map;
+    }
+
+    @Override
+    @CacheEvict(value = SystemConstant.CACHE_NAME, key = "'sysSetting'")
+    public String removeSysSettingGlobal() {
+        return null;
+    }
 }

+ 3 - 178
paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/LibraryCommonServiceImpl.java

@@ -1,6 +1,5 @@
 package com.qmth.paper.library.common.service.impl;
 
-import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.reflect.TypeToken;
@@ -17,6 +16,7 @@ import com.qmth.paper.library.common.bean.dto.MenuPrivilegeDto;
 import com.qmth.paper.library.common.bean.dto.OrgDto;
 import com.qmth.paper.library.common.bean.result.*;
 import com.qmth.paper.library.common.config.DictionaryConfig;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
 import com.qmth.paper.library.common.contant.SystemConstant;
 import com.qmth.paper.library.common.entity.*;
 import com.qmth.paper.library.common.enums.*;
@@ -167,22 +167,6 @@ public class LibraryCommonServiceImpl implements LibraryCommonService {
         return new MenuResult(sysUser.getId(), menuPrivilegeDtoList);
     }
 
-    /**
-     * 新增用户权限
-     *
-     * @param sysUser
-     * @param roleId
-     */
-    @Override
-    public void addUserRolePrivilege(SysUser sysUser, Long roleId) {
-        List<SysRolePrivilege> sysRolePrivilegeList = getRolePrivilege(roleId);
-        List<SysUserRole> sysUserRoleList = new ArrayList<>();
-        sysRolePrivilegeList.forEach(s -> {
-            sysUserRoleList.add(new SysUserRole(sysUser.getId(), s.getRoleId(), s.getPrivilegeId()));
-        });
-        sysUserRoleService.saveBatch(sysUserRoleList);
-    }
-
     /**
      * 新增用户权限
      *
@@ -198,15 +182,6 @@ public class LibraryCommonServiceImpl implements LibraryCommonService {
         sysUserRoleService.saveBatch(sysUserRoleList);
     }
 
-    @Override
-    public List<SysUserRole> disposeUserPrivilege(SysUser sysUser, Long[] roleIds) {
-        List<SysUserRole> sysUserRoleList = new ArrayList<>();
-        for (int i = 0; i < roleIds.length; i++) {
-            sysUserRoleList.add(new SysUserRole(sysUser.getId(), roleIds[i]));
-        }
-        return sysUserRoleList;
-    }
-
 
     /**
      * 获取用户角色权限
@@ -297,22 +272,6 @@ public class LibraryCommonServiceImpl implements LibraryCommonService {
         return authBean;
     }
 
-    /**
-     * 获取鉴权url
-     *
-     * @param privilegePropertyEnum
-     * @return
-     */
-    @Override
-    public Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum) {
-        QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
-        sysPrivilegeQueryWrapper.lambda().eq(SysPrivilege::getType, PrivilegeEnum.URL)
-                .eq(SysPrivilege::getProperty, privilegePropertyEnum)
-                .eq(SysPrivilege::getEnable, true);
-        List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
-        return Objects.nonNull(sysPrivilegeList) && sysPrivilegeList.size() > 0 ? sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()) : null;
-    }
-
     /**
      * 获取鉴权url
      *
@@ -423,7 +382,7 @@ public class LibraryCommonServiceImpl implements LibraryCommonService {
         String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
         String filePath = (String) jsonObject.get(SystemConstant.PATH);
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
-            String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.fssLocalFileDomain().getServer());
+            String hostUrl = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_FILE_HOST_URL);
             filePath = SystemConstant.getLocalFilePath(hostUrl, filePath);
             if (filePath.startsWith("/")) {
                 url = hostUrl + filePath;
@@ -445,7 +404,7 @@ public class LibraryCommonServiceImpl implements LibraryCommonService {
         String pathUrl;
         // 本地文件
         if (Objects.equals(type, SystemConstant.LOCAL)) {
-            String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.fssLocalFileDomain().getServer());
+            String hostUrl = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_FILE_HOST_URL);
             path = SystemConstant.getLocalFilePath(hostUrl, path);
             if (path.startsWith("/")) {
                 pathUrl = hostUrl + path;
@@ -463,142 +422,8 @@ public class LibraryCommonServiceImpl implements LibraryCommonService {
         return pathUrl;
     }
 
-    /**
-     * 文件预览
-     *
-     * @param path     附件路径
-     * @param type     保存类型:本地、OSS
-     * @param isExpire url是否带过期时间
-     * @return
-     */
-    @Override
-    public String filePreviewByPathAndType(String path, String type, Boolean isExpire) {
-        if (StringUtils.isBlank(path)) {
-            return null;
-        }
-        String pathUrl;
-        if (Objects.equals(type, SystemConstant.LOCAL)) {
-            String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.fssLocalFileDomain().getServer());
-            path = SystemConstant.getLocalFilePath(hostUrl, path);
-            if (path.startsWith("/")) {
-                pathUrl = hostUrl + path;
-            } else {
-                pathUrl = hostUrl + File.separator + path;
-            }
-        } else {
-            if (isExpire) {
-                pathUrl = fileStoreUtil.getPrivateUrl(path, fileStoreUtil.getUploadEnumByPath(path).getFssType());
-            } else {
-                pathUrl = fileStoreUtil.getPrivateUrl(path, fileStoreUtil.getUploadEnumByPath(path).getFssType());
-            }
 
-        }
-        return pathUrl;
-    }
 
-    /**
-     * 获取文件
-     *
-     * @param path
-     * @param pdf
-     * @return
-     * @throws IOException
-     */
-    @Override
-    public File getFile(String path, boolean pdf) throws Exception {
-        File file = null;
-        JSONObject jsonObject = JSONObject.parseObject(path);
-        String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
-        String filePath = pdf ? (String) jsonObject.get(SystemConstant.PDF_PATH) : (String) jsonObject.get(SystemConstant.PATH);
-        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
-
-        StringJoiner localPath = new StringJoiner("");
-        if (Objects.equals(attachmentType, SystemConstant.OSS)) {
-//            file = ossUtil.ossDownload(filePath, localPath.toString());
-            localPath = localPath.add(dictionaryConfig.fssLocalFileDomain().getConfig()).add(File.separator).add(filePath);
-            file = fileStoreUtil.ossDownload(filePath, localPath.toString(), uploadType.getFssType());
-        } else {
-            if (!filePath.contains(dictionaryConfig.fssLocalFileDomain().getConfig())) {
-                localPath = localPath.add(dictionaryConfig.fssLocalFileDomain().getConfig()).add(File.separator).add(filePath);
-            } else {
-                localPath = localPath.add(filePath);
-            }
-            file = new File(localPath.toString());
-        }
-        return file;
-    }
-
-    @Override
-    public File copyFile(String rootPath, String fileName, BasicAttachment attachment) throws Exception {
-        JSONObject object = JSONObject.parseObject(attachment.getPath());
-        String filePath = object.getString(SystemConstant.PATH);
-        String type = object.getString(SystemConstant.TYPE);
-        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) object.get(SystemConstant.UPLOAD_TYPE));
-
-        if (type.equals(SystemConstant.OSS)) {
-            File localPath = new File(rootPath, fileName);
-            try {
-//                File file = ossUtil.ossDownload(filePath, localPath.getPath());
-                File file = fileStoreUtil.ossDownload(filePath, localPath.getPath(), uploadType.getFssType());
-                return file;
-            } catch (IOException e) {
-                throw ExceptionResultEnum.ERROR.exception("从OSS上下载文件失败");
-            }
-        } else {
-            File file = new File(filePath);
-            if (!file.exists()) {
-                throw ExceptionResultEnum.ERROR.exception("本地文件不存在");
-            }
-            return file;
-        }
-    }
-
-    @Override
-    public void downloadFileAndZip(HttpServletResponse response, String rootPath, List<File> files) {
-        String schoolId = ServletUtil.getRequestHeaderSchoolId().toString();
-        long time = System.nanoTime();
-        File rootFile = new File(rootPath);
-        // 创建保存目录
-        if (!rootFile.exists()) {
-            rootFile.mkdirs();
-        }
-        File zipFile = null;
-        try {
-            String zipPath = dictionaryConfig.fssLocalFileDomain().getConfig() + File.separator + schoolId;
-            zipFile = FileUtil.file(zipPath, time + ".zip");
-            Zip4jUtil.zipEncryptFile(zipFile.getPath(), files, SystemConstant.ZIP_ENCRYPT_PWD);
-            outputFile(response, zipFile, String.valueOf(time));
-        } catch (Exception e) {
-            throw ExceptionResultEnum.ERROR.exception("下载失败");
-        } finally {
-            // 删除zip文件
-            FileUtil.del(zipFile);
-            // 删除压缩内容
-            FileUtil.del(rootPath);
-        }
-    }
-
-    @Override
-    public void downloadFileAndZip(HttpServletResponse response, String rootPath, long time) {
-        File rootFile = new File(rootPath);
-        // 创建保存目录
-        if (!rootFile.exists()) {
-            rootFile.mkdirs();
-        }
-        File zipFile = null;
-        try {
-            zipFile = FileUtil.file(dictionaryConfig.fssLocalFileDomain().getConfig(), time + ".zip");
-            Zip4jUtil.zipEncryptFile(zipFile.getPath(), rootPath, SystemConstant.ZIP_ENCRYPT_PWD);
-            outputFile(response, zipFile, String.valueOf(time));
-        } catch (Exception e) {
-            throw ExceptionResultEnum.ERROR.exception("下载失败");
-        } finally {
-            // 删除zip文件
-            FileUtil.del(zipFile);
-            // 删除压缩内容
-            FileUtil.del(rootPath);
-        }
-    }
 
     @Override
     public Set<Long> listSubOrgIds(Long id) {

+ 0 - 33
paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/SysConfigServiceImpl.java

@@ -1,33 +0,0 @@
-package com.qmth.paper.library.common.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.qmth.paper.library.common.enums.ExceptionResultEnum;
-import com.qmth.paper.library.common.entity.SysConfig;
-import com.qmth.paper.library.common.mapper.SysConfigMapper;
-import com.qmth.paper.library.common.service.SysConfigService;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 参数表 服务实现类
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
-@Service
-public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {
-
-    @Override
-    public SysConfig getByKey(String key) {
-        if (StringUtils.isBlank(key)) {
-            throw ExceptionResultEnum.ERROR.exception("key不能为空");
-        }
-        QueryWrapper<SysConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(SysConfig::getConfigKey, key);
-        SysConfig sysConfig = this.baseMapper.selectOne(queryWrapper);
-        return sysConfig;
-    }
-}

+ 83 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/SysSettingGlobalServiceImpl.java

@@ -0,0 +1,83 @@
+package com.qmth.paper.library.common.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
+import com.qmth.paper.library.common.contant.SystemConstant;
+import com.qmth.paper.library.common.entity.SysSettingGlobal;
+import com.qmth.paper.library.common.enums.ExceptionResultEnum;
+import com.qmth.paper.library.common.mapper.SysSettingGlobalMapper;
+import com.qmth.paper.library.common.service.CommonCacheService;
+import com.qmth.paper.library.common.service.SysSettingGlobalService;
+import com.qmth.paper.library.common.util.ServletUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ * 系统设置 服务实现类
+ * </p>
+ */
+@Service
+public class SysSettingGlobalServiceImpl extends ServiceImpl<SysSettingGlobalMapper, SysSettingGlobal> implements SysSettingGlobalService {
+
+    @Resource
+    CommonCacheService commonCacheService;
+
+    @Override
+    public List<SettingObject> getData() {
+        QueryWrapper<SysSettingGlobal> queryWrapper = new QueryWrapper<>();
+        List<SysSettingGlobal> sysSettingList = this.list(queryWrapper);
+
+        SysSettingGlobal sysSettingGlobal = new SysSettingGlobal();
+        // 第一次设置,初始化数据
+        if (sysSettingList.isEmpty()) {
+            sysSettingGlobal = SysSettingGlobal.init();
+            this.save(sysSettingGlobal);
+        } else if (sysSettingList.size() > 1) {
+            throw ExceptionResultEnum.ERROR.exception("系统设置有误,查出多条数据");
+        }
+
+        if (!sysSettingList.isEmpty()) {
+            sysSettingGlobal = sysSettingList.get(0);
+        }
+        return JSON.parseArray(sysSettingGlobal.getParameterObject(), SettingObject.class);
+    }
+
+    @Override
+    public boolean saveData(List<SettingObject> settingObjects) {
+        Long userId = Long.valueOf(ServletUtil.getRequestHeaderUserId().toString());
+
+        QueryWrapper<SysSettingGlobal> queryWrapper = new QueryWrapper<>();
+        SysSettingGlobal sysSettingGlobal = this.getOne(queryWrapper);
+
+        // 新增
+        if (sysSettingGlobal == null) {
+            sysSettingGlobal = new SysSettingGlobal();
+            sysSettingGlobal.setId(SystemConstant.getDbUuid());
+            sysSettingGlobal.setParameterObject(JSON.toJSONString(settingObjects));
+            sysSettingGlobal.setCreateId(userId);
+            sysSettingGlobal.setCreateTime(System.currentTimeMillis());
+        } else {
+            sysSettingGlobal.setParameterObject(JSON.toJSONString(settingObjects));
+            sysSettingGlobal.setUpdateId(userId);
+            sysSettingGlobal.setUpdateTime(System.currentTimeMillis());
+
+            commonCacheService.removeSysSettingGlobal();
+        }
+        return this.saveOrUpdate(sysSettingGlobal);
+    }
+
+    @Override
+    public SysSettingGlobal getOnlyOne() {
+        QueryWrapper<SysSettingGlobal> queryWrapper = new QueryWrapper<>();
+        List<SysSettingGlobal> sysSettingGlobals = this.list(queryWrapper);
+        if (!sysSettingGlobals.isEmpty() && sysSettingGlobals.size() != 1) {
+            throw ExceptionResultEnum.ERROR.exception("全局参数未设置");
+        }
+        return sysSettingGlobals.get(0);
+    }
+}

+ 36 - 17
paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/SysSettingServiceImpl.java

@@ -1,16 +1,19 @@
 package com.qmth.paper.library.common.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
 import com.qmth.paper.library.common.contant.SystemConstant;
 import com.qmth.paper.library.common.entity.SysSetting;
-import com.qmth.paper.library.common.entity.SysUser;
 import com.qmth.paper.library.common.enums.ExceptionResultEnum;
 import com.qmth.paper.library.common.mapper.SysSettingMapper;
+import com.qmth.paper.library.common.service.CommonCacheService;
 import com.qmth.paper.library.common.service.SysSettingService;
 import com.qmth.paper.library.common.util.ServletUtil;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -21,47 +24,63 @@ import java.util.List;
 @Service
 public class SysSettingServiceImpl extends ServiceImpl<SysSettingMapper, SysSetting> implements SysSettingService {
 
+    @Resource
+    CommonCacheService commonCacheService;
+
     @Override
-    public SysSetting getData() {
+    public List<SettingObject> getData() {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         QueryWrapper<SysSetting> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(SysSetting::getSchoolId, schoolId);
         List<SysSetting> sysSettingList = this.list(queryWrapper);
-        if (!sysSettingList.isEmpty() && sysSettingList.size() > 1) {
+
+        SysSetting sysSetting = new SysSetting();
+        // 第一次设置,初始化数据
+        if (sysSettingList.isEmpty()) {
+            sysSetting = SysSetting.init(schoolId);
+            this.save(sysSetting);
+        } else if (sysSettingList.size() > 1) {
             throw ExceptionResultEnum.ERROR.exception("系统设置有误,查出多条数据");
         }
-        SysSetting sysSetting = new SysSetting();
+
         if (!sysSettingList.isEmpty()) {
             sysSetting = sysSettingList.get(0);
         }
-        return sysSetting;
+
+        return JSON.parseArray(sysSetting.getParameterObject(), SettingObject.class);
     }
 
     @Override
-    public boolean saveData(SysSetting sysSetting) {
+    public boolean saveData(List<SettingObject> settingObjects) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         Long userId = Long.valueOf(ServletUtil.getRequestHeaderUserId().toString());
 
         QueryWrapper<SysSetting> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(SysSetting::getSchoolId, schoolId);
-        SysSetting oldSysSetting = this.getOne(queryWrapper);
+        SysSetting sysSetting = this.getOne(queryWrapper);
 
         // 新增
-        if (oldSysSetting == null) {
+        if (sysSetting == null) {
+            sysSetting = new SysSetting();
             sysSetting.setId(SystemConstant.getDbUuid());
+            sysSetting.setParameterObject(JSON.toJSONString(settingObjects));
             sysSetting.setSchoolId(schoolId);
             sysSetting.setCreateId(userId);
             sysSetting.setCreateTime(System.currentTimeMillis());
-            return this.save(sysSetting);
         } else {
-             if (!oldSysSetting.getSchoolId().equals(schoolId)) {
-                throw ExceptionResultEnum.ERROR.exception("查询数据学校与当前学校不一致");
-            }
-            oldSysSetting.setOpenOcr(sysSetting.getOpenOcr());
-            oldSysSetting.setOpenGlobalMatch(sysSetting.getOpenGlobalMatch());
-            oldSysSetting.setUpdateId(userId);
-            oldSysSetting.setUpdateTime(System.currentTimeMillis());
-            return this.updateById(oldSysSetting);
+            sysSetting.setParameterObject(JSON.toJSONString(settingObjects));
+            sysSetting.setUpdateId(userId);
+            sysSetting.setUpdateTime(System.currentTimeMillis());
+
+            commonCacheService.removeSysSetting(schoolId);
         }
+        return this.saveOrUpdate(sysSetting);
+    }
+
+    @Override
+    public SysSetting getBySchoolId(Long schoolId) {
+        QueryWrapper<SysSetting> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(SysSetting::getSchoolId, schoolId);
+        return this.getOne(queryWrapper);
     }
 }

+ 10 - 9
paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/SysUserServiceImpl.java

@@ -20,6 +20,7 @@ import com.qmth.paper.library.common.bean.result.SysUserResult;
 import com.qmth.paper.library.common.bean.result.UserRoleNameResult;
 import com.qmth.paper.library.common.config.DictionaryConfig;
 import com.qmth.paper.library.common.contant.SpringContextHolder;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
 import com.qmth.paper.library.common.contant.SystemConstant;
 import com.qmth.paper.library.common.entity.*;
 import com.qmth.paper.library.common.enums.AppSourceEnum;
@@ -58,9 +59,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Resource
     private SysRoleService sysRoleService;
 
-    @Resource
-    private SysConfigService sysConfigService;
-
     @Resource
     private SysUserRoleService sysUserRoleService;
 
@@ -91,6 +89,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Resource
     SysRoleGroupMemberService sysRoleGroupMemberService;
 
+    @Resource
+    CommonCacheService commonCacheService;
+
     @Override
     public IPage<UserDto> listForPrintSystem(String userInfo, Long orgId, String roleId, Boolean enable, Integer pageNumber, Integer pageSize) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
@@ -200,8 +201,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 
     @Override
     public boolean resetPassword(Long id) throws NoSuchAlgorithmException {
-        SysConfig sysConfig = sysConfigService.getByKey("sys.user.initPassword");
-        String md5Password = Base64Util.encode(StringUtils.isNoneBlank(sysConfig.getConfigValue()) ? sysConfig.getConfigValue().getBytes() : "123456".getBytes());
+        String initPassword = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_INIT_PASSWORD);
+        String md5Password = Base64Util.encode(StringUtils.isNoneBlank(initPassword) ? initPassword.getBytes() : "123456".getBytes());
 
         SysUser user = this.getById(id);
         String oldPassword = user.getPassword();
@@ -472,8 +473,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 
     @Override
     public void checkSmsCode(Long userId, String mobileNumber, String code) {
-        SysConfig value = sysConfigService.getByKey("sys.code.enable");
-        if (Objects.nonNull(value) && value.getConfigValue().equals("true")) {
+        String verificationCodeLoginEnable = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_VERIFICATION_CODE_LOGIN_ENABLE);
+        if (Objects.nonNull(verificationCodeLoginEnable) && (verificationCodeLoginEnable.equals("true") || verificationCodeLoginEnable.equals("1"))) {
             if (Objects.isNull(code)) {
                 throw ExceptionResultEnum.ERROR.exception("验证码为空");
             }
@@ -497,8 +498,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Transactional
     @Override
     public void expiredVerifyCode(Long userId, String mobileNumber) {
-        SysConfig value = sysConfigService.getByKey("sys.code.enable");
-        if (Objects.nonNull(value) && value.getConfigValue().equals("true")) {
+        String verificationCodeLoginEnable = commonCacheService.getSysSettingGlobal().get(SysSettingConstant.SYS_VERIFICATION_CODE_LOGIN_ENABLE);
+        if (Objects.nonNull(verificationCodeLoginEnable) && (verificationCodeLoginEnable.equals("true") || verificationCodeLoginEnable.equals("1"))) {
             int count = this.baseMapper.updateVerifyCodeExpiredTime(userId, mobileNumber);
             if (count != 1) {
                 throw ExceptionResultEnum.ERROR.exception("验证码过期失败");

+ 37 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/util/Base64Util.java

@@ -2,6 +2,8 @@ package com.qmth.paper.library.common.util;
 
 import com.qmth.paper.library.common.contant.SystemConstant;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.util.Base64;
 
 public class Base64Util {
@@ -13,4 +15,39 @@ public class Base64Util {
     public static byte[] decode(String input) {
         return Base64.getDecoder().decode(input.getBytes(SystemConstant.CHARSET));
     }
+
+    public static String imageToBase64(String path) {
+        File file = new File(path);
+        return imageToBase64(file);
+    }
+
+    /**
+     * 文件File类型转BASE64
+     *
+     * @param file
+     * @return
+     */
+    public static String imageToBase64(File file) {
+        return "data:image/png;base64," + encode(fileToByte(file));
+    }
+
+    /**
+     * 文件File类型转byte[]
+     *
+     * @param file
+     * @return
+     */
+    private static byte[] fileToByte(File file) {
+        byte[] fileBytes = null;
+        FileInputStream fis;
+        try {
+            fis = new FileInputStream(file);
+            fileBytes = new byte[(int) file.length()];
+            fis.read(fileBytes);
+            fis.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return fileBytes;
+    }
 }

+ 25 - 15
paper-library-common/src/main/java/com/qmth/paper/library/common/util/OcrUtil.java

@@ -1,12 +1,15 @@
 package com.qmth.paper.library.common.util;
 
 import com.baidu.aip.ocr.AipOcr;
+import com.qmth.paper.library.common.contant.SysSettingConstant;
 import com.qmth.paper.library.common.contant.SystemConstant;
-import com.qmth.paper.library.common.domain.OcrDomain;
+import com.qmth.paper.library.common.enums.ExceptionResultEnum;
+import com.qmth.paper.library.common.service.CommonCacheService;
+import org.apache.commons.lang3.StringUtils;
 import org.json.JSONObject;
-import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -20,29 +23,30 @@ import java.util.Map;
 @Component
 public class OcrUtil {
 
-    private OcrDomain ocrDomain;
-
     private AipOcr client;
 
     private HashMap<String, String> options;
 
-    @Bean
-    public OcrDomain ocrDomainEnv(OcrDomain ocrDomain) {
-        this.ocrDomain = new OcrDomain(ocrDomain.getAppId(),
-                ocrDomain.getAppKey(),
-                ocrDomain.getAppSecret());
-        client = new AipOcr(ocrDomain.getAppId(), ocrDomain.getAppKey(), ocrDomain.getAppSecret());
+    @Resource
+    CommonCacheService commonCacheService;
+
+    //    @Bean
+    public void init() {
+        Map<String, String> map = commonCacheService.getSysSettingGlobal();
+        String appId = map.get(SysSettingConstant.OCR_APP_ID);
+        String appKey = map.get(SysSettingConstant.OCR_APP_KEY);
+        String appSecret = map.get(SysSettingConstant.OCR_APP_SECRET);
+        if (StringUtils.isAnyBlank(appId, appKey, appSecret)) {
+            throw ExceptionResultEnum.ERROR.exception("OCR参数未配置,请联系管理员");
+        }
+        client = new AipOcr(appId, appKey, appSecret);
         // 可选:设置网络连接参数
         client.setConnectionTimeoutInMillis(SystemConstant.OCR_CONNECTION_TIMEOUT_IN_MILLIS);
         client.setSocketTimeoutInMillis(SystemConstant.OCR_SOCKET_TIMEOUT_IN_MILLIS);
-        options = new HashMap<String, String>();
+        options = new HashMap<>();
         options.put("probability", "true");
-        return this.ocrDomain;
     }
 
-    public OcrDomain getOcrDomain() {
-        return ocrDomain;
-    }
 
     public AipOcr getClient() {
         return client;
@@ -59,6 +63,7 @@ public class OcrUtil {
      * @return
      */
     public JSONObject callBasicGeneral(String path) {
+        init();
         return client.basicGeneral(path, options);
     }
 
@@ -69,6 +74,7 @@ public class OcrUtil {
      * @return
      */
     public JSONObject callBasicAccurateGeneral(String path) {
+        init();
         return client.basicAccurateGeneral(path, options);
     }
 
@@ -79,6 +85,7 @@ public class OcrUtil {
      * @return
      */
     public JSONObject callGeneral(String path) {
+        init();
         return client.general(path, options);
     }
 
@@ -89,6 +96,7 @@ public class OcrUtil {
      * @return
      */
     public JSONObject callAccurateGeneral(String path) {
+        init();
         return client.accurateGeneral(path, options);
     }
 
@@ -99,6 +107,7 @@ public class OcrUtil {
      * @return
      */
     public JSONObject callHandwriting(String path) {
+        init();
         return client.handwriting(path, options);
     }
 
@@ -109,6 +118,7 @@ public class OcrUtil {
      * @return
      */
     public JSONObject callDocAnalysis(String path) {
+        init();
         return client.docAnalysis(path, options);
     }
 }

+ 0 - 24
paper-library-common/src/main/resources/mapper/SysConfigMapper.xml

@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.qmth.paper.library.common.mapper.SysConfigMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.qmth.paper.library.common.entity.SysConfig">
-    <result column="id" property="id" />
-        <result column="config_key" property="configKey" />
-        <result column="config_name" property="configName" />
-        <result column="config_value" property="configValue" />
-        <result column="remark" property="remark" />
-        <result column="create_id" property="createId" />
-        <result column="create_time" property="createTime" />
-        <result column="update_id" property="updateId" />
-        <result column="update_time" property="updateTime" />
-    </resultMap>
-
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-        id,
-        config_key, config_name, config_value, remark, create_id, create_time, update_id, update_time
-    </sql>
-
-</mapper>

+ 4 - 0
paper-library-common/src/main/resources/mapper/SysSettingGlobalMapper.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.qmth.paper.library.common.mapper.SysSettingGlobalMapper">
+</mapper>

+ 2 - 3
paper-library-common/src/main/resources/mapper/SysSettingMapper.xml

@@ -5,8 +5,7 @@
     <resultMap id="BaseResultMap" type="com.qmth.paper.library.common.entity.SysSetting">
         <result column="id" property="id" />
         <result column="school_id" property="schoolId" />
-        <result column="school_logo" property="schoolLogo" />
-        <result column="open_ocr" property="openOcr" />
+        <result column="parameter_object" property="parameterObject" />
         <result column="create_id" property="createId" />
         <result column="create_time" property="createTime" />
         <result column="update_id" property="createTime" />
@@ -15,6 +14,6 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        select id, school_id, school_logo, open_ocr from sys_setting
+        select id, school_id, parameter_object from sys_setting
     </sql>
 </mapper>

+ 0 - 3
paper-library/src/main/java/com/qmth/paper/library/api/MenuCustomController.java

@@ -60,9 +60,6 @@ public class MenuCustomController {
     @Resource
     LibraryCommonService commonService;
 
-    @Resource
-    SysConfigService sysConfigService;
-
     @ApiOperation(value = "查询自定义菜单权限")
     @ApiResponses({@ApiResponse(code = 200, message = "菜单权限信息", response = SysPrivilege.class)})
     @RequestMapping(value = "/custom/list", method = RequestMethod.POST)

+ 3 - 1
paper-library/src/main/java/com/qmth/paper/library/api/SysController.java

@@ -24,6 +24,7 @@ import com.qmth.paper.library.common.enums.ExceptionResultEnum;
 import com.qmth.paper.library.common.enums.RoleTypeEnum;
 import com.qmth.paper.library.common.enums.UploadFileEnum;
 import com.qmth.paper.library.common.service.*;
+import com.qmth.paper.library.common.util.Base64Util;
 import com.qmth.paper.library.common.util.Result;
 import com.qmth.paper.library.common.util.ResultUtil;
 import com.qmth.paper.library.common.util.ServletUtil;
@@ -350,7 +351,8 @@ public class SysController {
             return ResultUtil.ok(map);
         } else {
             Map<String, String> map = new HashMap<>();
-            map.put(SystemConstant.LOGO, dictionaryConfig.sysDomain().getAdminLogoUrl());
+            String path = this.getClass().getClassLoader().getResource("static/wx_logo.png").getPath();
+            map.put(SystemConstant.LOGO, Base64Util.imageToBase64(path));
             map.put("name", null);
             return ResultUtil.ok(map);
         }

+ 4 - 8
paper-library/src/main/java/com/qmth/paper/library/api/SysSettingController.java

@@ -3,8 +3,8 @@ package com.qmth.paper.library.api;
 
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.paper.library.business.bean.result.EditResult;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
 import com.qmth.paper.library.common.contant.ApiPrefixConstant;
-import com.qmth.paper.library.common.entity.SysSetting;
 import com.qmth.paper.library.common.service.SysSettingService;
 import com.qmth.paper.library.common.util.Result;
 import com.qmth.paper.library.common.util.ResultUtil;
@@ -12,7 +12,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
-import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -20,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import javax.validation.Valid;
+import java.util.List;
 
 /**
  * <p>
@@ -47,11 +46,8 @@ public class SysSettingController {
     @ApiOperation(value = "新增/修改")
     @PostMapping("/save")
     @ApiResponses({@ApiResponse(code = 200, message = "保存/更新成功", response = EditResult.class)})
-    public Result save(@Valid @RequestBody SysSetting sysSetting, BindingResult bindingResult) {
-        if (bindingResult.hasErrors()) {
-            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
-        }
-        return ResultUtil.ok(sysSettingService.saveData(sysSetting));
+    public Result save(@RequestBody List<SettingObject> simpleObjectList) {
+        return ResultUtil.ok(sysSettingService.saveData(simpleObjectList));
     }
 
 }

+ 53 - 0
paper-library/src/main/java/com/qmth/paper/library/api/SysSettingGlobalController.java

@@ -0,0 +1,53 @@
+package com.qmth.paper.library.api;
+
+
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.paper.library.business.bean.result.EditResult;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
+import com.qmth.paper.library.common.contant.ApiPrefixConstant;
+import com.qmth.paper.library.common.service.SysSettingGlobalService;
+import com.qmth.paper.library.common.util.Result;
+import com.qmth.paper.library.common.util.ResultUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ * 系统全局设置 前端控制器
+ * </p>
+ */
+@Api(tags = "系统全局设置controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + ApiPrefixConstant.PREFIX_SYS + "/setting_global")
+@Validated
+public class SysSettingGlobalController {
+
+    @Resource
+    private SysSettingGlobalService sysSettingGlobalService;
+
+    @ApiOperation(value = "查询")
+    @PostMapping("/get")
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
+    public Result getData() {
+        return ResultUtil.ok(sysSettingGlobalService.getData());
+    }
+
+
+    @ApiOperation(value = "新增/修改")
+    @PostMapping("/save")
+    @ApiResponses({@ApiResponse(code = 200, message = "保存/更新成功", response = EditResult.class)})
+    public Result save(@RequestBody List<SettingObject> settingObjects) {
+        return ResultUtil.ok(sysSettingGlobalService.saveData(settingObjects));
+    }
+
+}

+ 0 - 98
paper-library/src/main/resources/application-36dev.properties

@@ -1,98 +0,0 @@
-server.port=8011
-#tomcat\u6700\u5927\u7EBF\u7A0B\u6570\uFF0C\u9ED8\u8BA4\u4E3A200
-server.tomcat.threads.max=2500
-#tomcat\u6700\u5927\u8FDE\u63A5\u6570
-server.tomcat.max-connections=2500
-#tomcat\u7684URI\u7F16\u7801
-server.tomcat.uri-encoding=UTF-8
-
-#\u9879\u76EE\u540D\u79F0
-spring.application.name=paper-library
-
-#\u6570\u636E\u6E90\u914D\u7F6E
-db.host=localhost
-db.port=3306
-db.name=paper-library-v1.0.0
-db.username=root
-db.password=123456789
-
-#redis\u6570\u636E\u6E90\u914D\u7F6E
-com.qmth.redis.host=${db.host}
-com.qmth.redis.port=6379
-com.qmth.redis.db=2
-#com.qmth.redis.password=
-
-#mysql\u914D\u7F6E
-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
-
-#\u7CFB\u7EDF\u914D\u7F6E
-sys.config.oss=false
-sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,.mp3,.wav,.dll,.exe,.ftl,.bpmn,.xml
-sys.config.attachmentLength=100
-sys.config.attachmentSize=200
-sys.config.serverUpload=
-sys.config.adminLogoUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com/frontend/wx_logo.png
-sys.config.autoCreatePdfResetMaxCount=5
-sys.config.threadPoolCoreSize=1
-sys.config.customThreadPoolCoreSize=true
-sys.config.sessionActive=24h
-spring.resources.static-locations=file:${sys.config.serverUpload},classpath:/META-INF/resources/,classpath:/resources/
-
-com.qmth.fss.public.config=oss://key:secret@teachcloud-print-dev-public.oss-api.qmth.com.cn
-com.qmth.fss.public.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-public
-com.qmth.fss.private.config=oss://key:secret@teachcloud-print-dev-private.oss-api.qmth.com.cn
-com.qmth.fss.private.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-private
-com.qmth.fss.localfile.config=/Users/king/Downloads/file-temp
-com.qmth.fss.localfile.server=http://127.0.0.1:7001
-com.qmth.fss.localpdf.config=/Users/king/Downloads/pdf-temp
-com.qmth.fss.localpdf.server=http://127.0.0.1:7001
-
-#com.qmth.api.uri-prefix=/aaa
-#\u7EDF\u8BA1\u9875\u9762\u914D\u7F6E
-com.qmth.api.metrics-endpoint=/metrics-count
-com.qmth.api.global-auth=true
-#com.qmth.api.global-strict=false
-#com.qmth.api.global-rate-limit=1/5s
-
-#token\u8D85\u65F6\u914D\u7F6E
-com.qmth.auth.time-max-ahead=1m
-com.qmth.auth.time-max-delay=5m
-
-#\u7F13\u5B58\u65F6\u95F4
-com.qmth.cache.expire-after-write=8h
-
-#api\u524D\u7F00
-prefix.url.common=admin/common
-prefix.url.sys=admin/sys
-prefix.url.basic=admin/basic
-prefix.url.data=admin/data
-prefix.url.menu=admin/menu
-prefix.url.auth=admin/auth
-prefix.url.paper=admin/paper
-prefix.url.client=admin/client
-
-#\u65E5\u671F\u683C\u5F0F\u5316
-spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
-spring.jackson.time-zone=GMT+8
-
-#\u65E5\u5FD7\u914D\u7F6E
-com.qmth.logging.root-level=info
-com.qmth.logging.file-path=/Users/king/Downloads/paper-library.log
-
-com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
-com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
-#com.qmth.solar.license=/Volumes/extend/\u542F\u660E/\u5206\u5E03\u5F0F\u5370\u5237/\u5206\u5E03\u5F0F\u5370\u5237&\u6559\u7814\u5206\u6790v3.1.0/tc-dev-wl.lic
-
-sms.config.smsNormalCode=qmth
-sms.config.codeExpiredTime=2
-sms.config.codeSendInterval=60
-#aliyun SMS key
-sms.config.aliyunSMSKey=LTAI4Fi8jVRYT49QBXU9x5QX
-#aliyun SMS secret
-sms.config.aliyunSMSSecret=97aBLBfkQR5mzCiQa82yWLAH57eUd8
-sms.config.aliyunSMSSignName=\u9038\u6559\u4E91
-sms.config.aliyunSMSTplCode=SMS_147416565
-sms.config.aliyunSMSAuditPassCode=SMS_216425141

+ 6 - 13
paper-library/src/main/resources/application-dev.properties

@@ -8,7 +8,7 @@ server.tomcat.uri-encoding=UTF-8
 #--------database config--------------
 db.host=localhost
 db.port=3306
-db.name=paper-library-v1.0.0
+db.name=paper-library-v1.0.1
 db.username=root
 db.password=root
 
@@ -22,7 +22,6 @@ sys.config.oss=false
 sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,.mp3,.wav,.dll,.exe,.ftl,.bpmn,.xml
 sys.config.attachmentLength=100
 sys.config.attachmentSize=200
-sys.config.adminLogoUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com/frontend/wx_logo.png
 sys.config.sessionActive=24h
 spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/
 
@@ -31,8 +30,8 @@ com.qmth.fss.public.config=oss://key:secret@teachcloud-print-dev-public.oss-api.
 com.qmth.fss.public.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-public
 com.qmth.fss.private.config=oss://key:secret@teachcloud-print-dev-private.oss-api.qmth.com.cn
 com.qmth.fss.private.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-private
-com.qmth.fss.localfile.config=/Users/king/Downloads/file-temp
-com.qmth.fss.localfile.server=http://localhost:8001
+com.qmth.fss.localfile.config=file-temp
+com.qmth.fss.localfile.server=http://localhost:8000
 
 #-----------------qmth boot config--------------
 com.qmth.api.metrics-endpoint=/metrics-count
@@ -46,13 +45,13 @@ com.qmth.auth.time-max-delay=5m
 com.qmth.cache.expire-after-write=8h
 
 com.qmth.logging.root-level=info
-com.qmth.logging.file-path=/Users/king/Downloads/paper-library.log
+com.qmth.logging.file-path=logs/paper-library.log
 
 com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
 com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
 #com.qmth.solar.license=/Volumes/extend/\u542F\u660E/\u5206\u5E03\u5F0F\u5370\u5237/\u5206\u5E03\u5F0F\u5370\u5237&\u6559\u7814\u5206\u6790v3.1.0/tc-dev-wl.lic
 
-spring.cache.ehcache.config=classpath:static/ehcache.xml
+spring.cache.ehcache.config=classpath:ehcache/ehcache.xml
 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
 spring.jackson.time-zone=GMT+8
 
@@ -62,10 +61,4 @@ sms.config.codeSendInterval=60
 sms.config.aliyunSMSKey=LTAI4Fi8jVRYT49QBXU9x5QX
 sms.config.aliyunSMSSecret=97aBLBfkQR5mzCiQa82yWLAH57eUd8
 sms.config.aliyunSMSSignName=\u9038\u6559\u4E91
-sms.config.aliyunSMSTplCode=SMS_147416565
-sms.config.aliyunSMSAuditPassCode=SMS_216425141
-
-#---------------------ocr config--------------------
-ocr.config.appId=27869327
-ocr.config.appKey=0EatsWDMu4Ts4Q4I9eYZdgV7
-ocr.config.appSecret=rlEolf9jVqS9V0tsi6x4l9Eu4ATKnfYv
+sms.config.aliyunSMSTplCode=SMS_147416565

+ 5 - 29
paper-library/src/main/resources/application-offline.properties

@@ -17,29 +17,21 @@ com.qmth.datasource.username=${db.username}
 com.qmth.datasource.password=${db.password}
 com.qmth.mybatis.log-level=debug
 
-
-#---------redis config---------------
-com.qmth.redis.host=${db.host}
-com.qmth.redis.port=6379
-com.qmth.redis.db=3
-#com.qmth.redis.password=
-
 #---------sys config-----------------
 sys.config.oss=false
 sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,.mp3,.wav,.dll,.exe,.ftl,.bpmn,.xml
 sys.config.attachmentLength=100
 sys.config.attachmentSize=200
-sys.config.adminLogoUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com/frontend/wx_logo.png
 sys.config.sessionActive=24h
-spring.resources.static-locations=file:${sys.config.serverUpload},classpath:/META-INF/resources/,classpath:/resources/
+spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/
 
 #----------------fss config-----------------
 com.qmth.fss.public.config=oss://key:secret@teachcloud-print-dev-public.oss-api.qmth.com.cn
 com.qmth.fss.public.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-public
 com.qmth.fss.private.config=oss://key:secret@teachcloud-print-dev-private.oss-api.qmth.com.cn
 com.qmth.fss.private.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-private
-com.qmth.fss.localfile.config=/Users/king/Downloads/file-temp
-com.qmth.fss.localfile.server=http://${db.host}:${server.port}
+com.qmth.fss.localfile.config=file-temp
+com.qmth.fss.localfile.server=http://localhost:8000
 
 #-----------------qmth boot config--------------
 com.qmth.api.metrics-endpoint=/metrics-count
@@ -59,17 +51,7 @@ com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
 com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
 #com.qmth.solar.license=/Volumes/extend/\u542F\u660E/\u5206\u5E03\u5F0F\u5370\u5237/\u5206\u5E03\u5F0F\u5370\u5237&\u6559\u7814\u5206\u6790v3.1.0/tc-dev-wl.lic
 
-#----------------api prefix-----------------
-prefix.url.common=admin/common
-prefix.url.sys=admin/sys
-prefix.url.basic=admin/basic
-prefix.url.data=admin/data
-prefix.url.menu=admin/menu
-prefix.url.auth=admin/auth
-prefix.url.paper=admin/paper
-prefix.url.client=admin/client
-
-
+spring.cache.ehcache.config=classpath:ehcache/ehcache.xml
 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
 spring.jackson.time-zone=GMT+8
 
@@ -79,10 +61,4 @@ sms.config.codeSendInterval=60
 sms.config.aliyunSMSKey=LTAI4Fi8jVRYT49QBXU9x5QX
 sms.config.aliyunSMSSecret=97aBLBfkQR5mzCiQa82yWLAH57eUd8
 sms.config.aliyunSMSSignName=\u9038\u6559\u4E91
-sms.config.aliyunSMSTplCode=SMS_147416565
-sms.config.aliyunSMSAuditPassCode=SMS_216425141
-
-#---------------------ocr config--------------------
-ocr.config.appId=27869327
-ocr.config.appKey=0EatsWDMu4Ts4Q4I9eYZdgV7
-ocr.config.appSecret=rlEolf9jVqS9V0tsi6x4l9Eu4ATKnfYv
+sms.config.aliyunSMSTplCode=SMS_147416565

+ 0 - 0
paper-library/src/main/resources/static/ehcache.xml → paper-library/src/main/resources/ehcache/ehcache.xml


BIN
paper-library/src/main/resources/static/wx_logo.png


+ 18 - 31
sql/paper-library-v1.0.0-按罗总要求优化后.sql → sql/paper-library-v1.0.1-按罗总要求优化后.sql

@@ -272,35 +272,6 @@ CREATE TABLE `paper_scan_task_detail`  (
   PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COMMENT = '扫描任务详情表' ROW_FORMAT = Dynamic;
 
--- ----------------------------
--- Table structure for sys_config
--- ----------------------------
-DROP TABLE IF EXISTS `sys_config`;
-CREATE TABLE `sys_config`  (
-  `id` bigint(20) NOT NULL COMMENT '主键',
-  `school_id` bigint(20) DEFAULT NULL COMMENT '学校id',
-  `org_id` bigint(20) DEFAULT NULL COMMENT '机构id',
-  `config_key` varchar(100) NOT NULL COMMENT '参数键名',
-  `config_name` varchar(100) NOT NULL COMMENT '参数名称',
-  `config_value` varchar(100) DEFAULT NULL COMMENT '参数键值',
-  `remark` varchar(100) DEFAULT NULL COMMENT '备注',
-  `create_id` bigint(20) DEFAULT NULL COMMENT '创建人',
-  `create_time` bigint(20) DEFAULT NULL COMMENT '创建时间',
-  `update_id` bigint(20) DEFAULT NULL COMMENT '更新人',
-  `update_time` bigint(20) DEFAULT NULL COMMENT '更新时间',
-  PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8mb4 COMMENT = '参数表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of sys_config
--- ----------------------------
-INSERT INTO `sys_config` VALUES (1, NULL, NULL, 'sys.user.initPassword', '初始密码', '123456', NULL, 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (3, NULL, NULL, 'sys.code.enable', '是否启用短信验证码', 'true', 'true-启用,false-禁用', 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (4, NULL, NULL, 'sys.message.enable', '是否启用短信消息提示', 'true', 'true-启用,false-禁用', 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (5, NULL, NULL, 'sys.message.resendCount', '失败短信重试次数', '3', NULL, 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (7, NULL, NULL, 'sys.txt.charset', 'txt文件编码', 'gbk', NULL, 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (8, NULL, NULL, 'sys.pdf.size.list', '全局pdf格式清单', '[A3, A4, A5, B3, B4, B5, 8K]', NULL, 1, NULL, NULL, NULL);
-
 -- ----------------------------
 -- Table structure for sys_org
 -- ----------------------------
@@ -517,6 +488,8 @@ INSERT INTO `sys_privilege` VALUES (408, '删除接口', '/api/admin/paper/archi
 INSERT INTO `sys_privilege` VALUES (409, '系统设置', 'SystemSetting', 'MENU', 112, 1, NULL, '410,411', 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (410, '查询', '/api/admin/sys/setting/get', 'URL', 409, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO `sys_privilege` VALUES (411, '新增/修改', '/api/admin/sys/setting/save', 'URL', 409, 2, 'AUTH', NULL, 1, 1, 1);
+INSERT INTO `sys_privilege` VALUES (412, '查询全局系统设置参数', '/api/admin/sys/setting_global/get', 'URL', 149, 16, 'SYS', NULL, 1, 1, 1);
+INSERT INTO `sys_privilege` VALUES (413, '新增/修改全局系统设置参数', '/api/admin/sys/setting_global/save', 'URL', 149, 17, 'SYS', NULL, 1, 1, 1);
 INSERT INTO `sys_privilege` VALUES (507, '菜单管理', 'MenuManage', 'MENU', 1, 7, NULL, NULL, 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (508, '自定义菜单', 'CustomMenu', 'MENU', 507, 1, NULL, NULL, 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (510, '学期管理', 'SemesterManage', 'MENU', 112, 2, NULL, NULL, 1, 0, 1);
@@ -677,8 +650,7 @@ DROP TABLE IF EXISTS `sys_setting`;
 CREATE TABLE `sys_setting`  (
   `id` bigint(20) NOT NULL,
   `school_id` bigint(20) NOT NULL COMMENT '学校Id',
-  `open_ocr` tinyint(1) DEFAULT 0 COMMENT '是否开启ocr识别,默认否(0)',
-  `open_global_match` tinyint(1) DEFAULT 0 COMMENT '是否开启全局匹配,默认否(0)',
+  `parameter_object` varchar(2000) NOT NULL COMMENT '参数对象(json)',
   `create_id` bigint(20) DEFAULT NULL COMMENT '创建人',
   `create_time` bigint(20) DEFAULT NULL COMMENT '创建时间',
   `update_id` bigint(20) DEFAULT NULL COMMENT '更新人',
@@ -686,6 +658,21 @@ CREATE TABLE `sys_setting`  (
   PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COMMENT = '系统设置' ROW_FORMAT = Dynamic;
 
+-- ----------------------------
+-- Table structure for sys_setting_global
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_setting_global`;
+CREATE TABLE `sys_setting_global`  (
+    `id` bigint(20) NOT NULL,
+    `parameter_object` varchar(2000) NOT NULL COMMENT '参数对象(json)',
+    `create_id` bigint(20) DEFAULT NULL COMMENT '创建人',
+    `create_time` bigint(20) DEFAULT NULL COMMENT '创建时间',
+    `update_id` bigint(20) DEFAULT NULL COMMENT '更新人',
+    `update_time` bigint(20) DEFAULT NULL COMMENT '更新时间',
+    PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统全局设置' ROW_FORMAT = Dynamic;
+
+
 -- ----------------------------
 -- Table structure for sys_user
 -- ----------------------------

+ 17 - 31
sql/paper-library-v1.0.0.sql → sql/paper-library-v1.0.1.sql

@@ -272,35 +272,6 @@ CREATE TABLE `paper_scan_task_detail`  (
   PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '扫描任务详情表' ROW_FORMAT = Dynamic;
 
--- ----------------------------
--- Table structure for sys_config
--- ----------------------------
-DROP TABLE IF EXISTS `sys_config`;
-CREATE TABLE `sys_config`  (
-  `id` bigint(20) NOT NULL COMMENT '主键',
-  `school_id` bigint(20) NULL DEFAULT NULL COMMENT '学校id',
-  `org_id` bigint(20) NULL DEFAULT NULL COMMENT '机构id',
-  `config_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参数键名',
-  `config_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参数名称',
-  `config_value` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '参数键值',
-  `remark` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
-  `create_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
-  `create_time` bigint(20) NULL DEFAULT NULL COMMENT '创建时间',
-  `update_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
-  `update_time` bigint(20) NULL DEFAULT NULL COMMENT '更新时间',
-  PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '参数表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of sys_config
--- ----------------------------
-INSERT INTO `sys_config` VALUES (1, NULL, NULL, 'sys.user.initPassword', '初始密码', '123456', NULL, 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (3, NULL, NULL, 'sys.code.enable', '是否启用短信验证码', 'true', 'true-启用,false-禁用', 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (4, NULL, NULL, 'sys.message.enable', '是否启用短信消息提示', 'true', 'true-启用,false-禁用', 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (5, NULL, NULL, 'sys.message.resendCount', '失败短信重试次数', '3', NULL, 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (7, NULL, NULL, 'sys.txt.charset', 'txt文件编码', 'gbk', NULL, 1, NULL, NULL, NULL);
-INSERT INTO `sys_config` VALUES (8, NULL, NULL, 'sys.pdf.size.list', '全局pdf格式清单', '[A3, A4, A5, B3, B4, B5, 8K]', NULL, 1, NULL, NULL, NULL);
-
 -- ----------------------------
 -- Table structure for sys_org
 -- ----------------------------
@@ -517,6 +488,8 @@ INSERT INTO `sys_privilege` VALUES (408, '删除接口', '/api/admin/paper/archi
 INSERT INTO `sys_privilege` VALUES (409, '系统设置', 'SystemSetting', 'MENU', 112, 1, NULL, '410,411', 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (410, '查询', '/api/admin/sys/setting/get', 'URL', 409, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO `sys_privilege` VALUES (411, '新增/修改', '/api/admin/sys/setting/save', 'URL', 409, 2, 'AUTH', NULL, 1, 1, 1);
+INSERT INTO `sys_privilege` VALUES (412, '查询全局系统设置参数', '/api/admin/sys/setting_global/get', 'URL', 149, 16, 'SYS', NULL, 1, 1, 1);
+INSERT INTO `sys_privilege` VALUES (413, '新增/修改全局系统设置参数', '/api/admin/sys/setting_global/save', 'URL', 149, 17, 'SYS', NULL, 1, 1, 1);
 INSERT INTO `sys_privilege` VALUES (507, '菜单管理', 'MenuManage', 'MENU', 1, 7, NULL, NULL, 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (508, '自定义菜单', 'CustomMenu', 'MENU', 507, 1, NULL, NULL, 1, 0, 1);
 INSERT INTO `sys_privilege` VALUES (510, '学期管理', 'SemesterManage', 'MENU', 112, 2, NULL, NULL, 1, 0, 1);
@@ -677,8 +650,7 @@ DROP TABLE IF EXISTS `sys_setting`;
 CREATE TABLE `sys_setting`  (
   `id` bigint(20) NOT NULL,
   `school_id` bigint(20) NOT NULL COMMENT '学校Id',
-  `open_ocr` tinyint(1) NULL DEFAULT 0 COMMENT '是否开启ocr识别,默认否(0)',
-  `open_global_match` tinyint(1) NULL DEFAULT 0 COMMENT '是否开启全局匹配,默认否(0)',
+  `parameter_object` varchar(2000) NOT NULL COMMENT '参数对象(json)',
   `create_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
   `create_time` bigint(20) NULL DEFAULT NULL COMMENT '创建时间',
   `update_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
@@ -686,6 +658,20 @@ CREATE TABLE `sys_setting`  (
   PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统设置' ROW_FORMAT = Dynamic;
 
+-- ----------------------------
+-- Table structure for sys_setting_global
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_setting_global`;
+CREATE TABLE `sys_setting_global`  (
+    `id` bigint(20) NOT NULL,
+    `parameter_object` varchar(2000) NOT NULL COMMENT '参数对象(json)',
+    `create_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
+    `create_time` bigint(20) NULL DEFAULT NULL COMMENT '创建时间',
+    `update_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
+    `update_time` bigint(20) NULL DEFAULT NULL COMMENT '更新时间',
+    PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统全局设置' ROW_FORMAT = Dynamic;
+
 -- ----------------------------
 -- Table structure for sys_user
 -- ----------------------------