wangliang 2 tahun lalu
induk
melakukan
b0e25d3152
21 mengubah file dengan 138 tambahan dan 1082 penghapusan
  1. 6 13
      pom.xml
  2. 9 1
      teachcloud-exchange-common/pom.xml
  3. 0 44
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/CustomBaseMapper.java
  4. 0 32
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/CustomizedSqlInjector.java
  5. 0 63
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/method/InsertBatch.java
  6. 0 85
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/method/InsertOrUpdateBath.java
  7. 0 30
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/method/UpdateBatch.java
  8. 0 23
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/config/DictionaryConfig.java
  9. 1 25
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/contant/SystemConstant.java
  10. 0 28
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/domain/FssLocalFileDomain.java
  11. 0 28
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/domain/FssLocalPdfDomain.java
  12. 0 65
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/domain/SysDomain.java
  13. 9 0
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/service/AuthInfoService.java
  14. 0 93
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/service/CommonCacheService.java
  15. 57 35
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/service/impl/AuthInfoServiceImpl.java
  16. 0 166
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/service/impl/CommonCacheServiceImpl.java
  17. 51 56
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/util/FileStoreUtil.java
  18. 0 266
      teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/util/RedisUtil.java
  19. 0 7
      xjtu-exchange/src/main/java/com/qmth/xjtu/XjtuExchangeApplication.java
  20. 1 0
      xjtu-exchange/src/main/java/com/qmth/xjtu/api/OpenApiController.java
  21. 4 22
      xjtu-exchange/src/main/resources/application-dev.properties

+ 6 - 13
pom.xml

@@ -23,8 +23,6 @@
         <swagger2.version>2.9.2</swagger2.version>
         <fastjson.version>1.2.68</fastjson.version>
         <fileupload.version>1.4</fileupload.version>
-        <poi.version>3.17</poi.version>
-        <aliyun.version>3.8.1</aliyun.version>
         <guava.version>27.1-jre</guava.version>
         <hutool.version>5.0.6</hutool.version>
         <bcprov.version>1.52</bcprov.version>
@@ -39,15 +37,10 @@
         <httpclient.version>4.5.12</httpclient.version>
         <version-plugin.version>2.8.1</version-plugin.version>
         <netty-all.version>4.1.49.Final</netty-all.version>
-        <itextpdf.version>5.5.13</itextpdf.version>
-        <itextasian.version>5.2.0</itextasian.version>
-        <googleBar.version>3.4.0</googleBar.version>
-        <freemarker.version>2.3.30</freemarker.version>
         <commons-text.version>1.9</commons-text.version>
         <junit.version>4.13</junit.version>
-        <activiti.version>6.0.0</activiti.version>
-        <activiti-modeler.version>5.22.0</activiti-modeler.version>
         <zip4j.version>1.3.3</zip4j.version>
+        <aspectj.version>1.9.6</aspectj.version>
     </properties>
 
     <dependencyManagement>
@@ -92,11 +85,6 @@
                 <artifactId>core-fss</artifactId>
                 <version>${qmth.boot.version}</version>
             </dependency>
-            <dependency>
-                <groupId>com.qmth.boot</groupId>
-                <artifactId>data-redis</artifactId>
-                <version>${qmth.boot.version}</version>
-            </dependency>
             <dependency>
                 <groupId>com.qmth.boot</groupId>
                 <artifactId>data-mybatis-plus</artifactId>
@@ -224,6 +212,11 @@
                 <artifactId>junit</artifactId>
                 <version>${junit.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.aspectj</groupId>
+                <artifactId>aspectjweaver</artifactId>
+                <version>${aspectj.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 

+ 9 - 1
teachcloud-exchange-common/pom.xml

@@ -20,7 +20,7 @@
         </dependency>
         <dependency>
             <groupId>com.qmth.boot</groupId>
-            <artifactId>data-redis</artifactId>
+            <artifactId>core-uid</artifactId>
         </dependency>
         <dependency>
             <groupId>com.qmth.boot</groupId>
@@ -46,6 +46,10 @@
             <groupId>com.qmth.boot</groupId>
             <artifactId>core-retrofit</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.qmth.boot</groupId>
+            <artifactId>core-cache</artifactId>
+        </dependency>
         <dependency>
             <groupId>io.netty</groupId>
             <artifactId>netty-all</artifactId>
@@ -114,6 +118,10 @@
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjweaver</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 0 - 44
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/CustomBaseMapper.java

@@ -1,44 +0,0 @@
-package com.qmth.teachcloud.exchange.common.base;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-/**
- * @Description: 自定义mapper
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2022/5/11
- */
-public interface CustomBaseMapper<T> extends BaseMapper<T> {
-
-    /**
-     * 自定义批量插入
-     * 如果要自动填充,@Param(xx) xx参数名必须是 list/collection/array 3个的其中之一
-     *
-     * @param list
-     * @return
-     */
-    int insertBatch(@Param("collection") Collection<? extends Serializable> list);
-
-    /**
-     * 自定义批量更新
-     * 如果要自动填充,@Param(xx) xx参数名必须是 list/collection/array 3个的其中之一
-     *
-     * @param list
-     * @return
-     */
-    int updateBatch(@Param("collection") Collection<? extends Serializable> list);
-
-    /**
-     * 自定义批量新增或更新
-     * 如果要自动填充,@Param(xx) xx参数名必须是 list/collection/array 3个的其中之一
-     *
-     * @param list
-     * @return
-     */
-    int insertOrUpdateBath(@Param("collection") Collection<? extends Serializable> list);
-}

+ 0 - 32
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/CustomizedSqlInjector.java

@@ -1,32 +0,0 @@
-package com.qmth.teachcloud.exchange.common.base;
-
-import com.baomidou.mybatisplus.core.injector.AbstractMethod;
-import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
-import com.qmth.teachcloud.exchange.common.base.method.InsertBatch;
-import com.qmth.teachcloud.exchange.common.base.method.InsertOrUpdateBath;
-import com.qmth.teachcloud.exchange.common.base.method.UpdateBatch;
-
-import java.util.List;
-
-/**
- * @Description: 自定义批量sql插入、更新
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2022/5/11
- */
-public class CustomizedSqlInjector extends DefaultSqlInjector {
-
-    /**
-     * 如果只需增加方法,保留mybatis plus自带方法,
-     * 可以先获取super.getMethodList(),再添加add
-     */
-    @Override
-    public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
-        List<AbstractMethod> methodList = super.getMethodList(mapperClass);
-        methodList.add(new InsertBatch());
-        methodList.add(new UpdateBatch());
-        methodList.add(new InsertOrUpdateBath());
-        return methodList;
-    }
-}

+ 0 - 63
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/method/InsertBatch.java

@@ -1,63 +0,0 @@
-package com.qmth.teachcloud.exchange.common.base.method;
-
-import com.baomidou.mybatisplus.core.injector.AbstractMethod;
-import com.baomidou.mybatisplus.core.metadata.TableInfo;
-import org.apache.ibatis.executor.keygen.NoKeyGenerator;
-import org.apache.ibatis.mapping.MappedStatement;
-import org.apache.ibatis.mapping.SqlSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @Description: 自定义批量插入
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2022/5/11
- */
-public class InsertBatch extends AbstractMethod {
-    private final static Logger log = LoggerFactory.getLogger(InsertBatch.class);
-
-    /**
-     * insert into user(id, name, age) values (1, "a", 17), (2, "b", 18);
-     * <script>
-     * insert into user(id, name, age) values
-     * <foreach collection="collection" item="item" index="index" open="(" separator="),(" close=")">
-     * #{item.id}, #{item.name}, #{item.age}
-     * </foreach>
-     * </script>
-     */
-    @Override
-    public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
-        final String sql = "<script>insert into %s %s values %s</script>";
-        final String fieldSql = prepareFieldSql(tableInfo);
-        final String valueSql = prepareValuesSql(tableInfo);
-        final String sqlResult = String.format(sql, tableInfo.getTableName(), fieldSql, valueSql);
-        log.debug("sqlResult----->{}", sqlResult);
-        SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass);
-        // 第三个参数必须和RootMapper的自定义方法名一致
-        return this.addInsertMappedStatement(mapperClass, modelClass, "insertBatch", sqlSource, new NoKeyGenerator(), null, null);
-    }
-
-    private String prepareFieldSql(TableInfo tableInfo) {
-        StringBuilder fieldSql = new StringBuilder();
-        fieldSql.append(tableInfo.getKeyColumn()).append(",");
-        tableInfo.getFieldList().forEach(x -> {
-            fieldSql.append(x.getColumn()).append(",");
-        });
-        fieldSql.delete(fieldSql.length() - 1, fieldSql.length());
-        fieldSql.insert(0, "(");
-        fieldSql.append(")");
-        return fieldSql.toString();
-    }
-
-    private String prepareValuesSql(TableInfo tableInfo) {
-        final StringBuilder valueSql = new StringBuilder();
-        valueSql.append("<foreach collection=\"collection\" item=\"item\" index=\"index\" open=\"(\" separator=\"),(\" close=\")\">");
-        valueSql.append("#{item.").append(tableInfo.getKeyProperty()).append("},");
-        tableInfo.getFieldList().forEach(x -> valueSql.append("#{item.").append(x.getProperty()).append("},"));
-        valueSql.delete(valueSql.length() - 1, valueSql.length());
-        valueSql.append("</foreach>");
-        return valueSql.toString();
-    }
-}

+ 0 - 85
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/method/InsertOrUpdateBath.java

@@ -1,85 +0,0 @@
-package com.qmth.teachcloud.exchange.common.base.method;
-
-import com.baomidou.mybatisplus.core.injector.AbstractMethod;
-import com.baomidou.mybatisplus.core.metadata.TableInfo;
-import org.apache.ibatis.executor.keygen.NoKeyGenerator;
-import org.apache.ibatis.mapping.MappedStatement;
-import org.apache.ibatis.mapping.SqlSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.util.StringUtils;
-
-/**
- * @Description: 自定义插入或更新
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2022/5/11
- */
-public class InsertOrUpdateBath extends AbstractMethod {
-    private final static Logger log = LoggerFactory.getLogger(InsertOrUpdateBath.class);
-
-    @Override
-    public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
-        final String sql = "<script>insert into %s %s values %s ON DUPLICATE KEY UPDATE %s</script>";
-        final String tableName = tableInfo.getTableName();
-        final String filedSql = prepareFieldSql(tableInfo);
-        final String modelValuesSql = prepareModelValuesSql(tableInfo);
-        final String duplicateKeySql = prepareDuplicateKeySql(tableInfo);
-        final String sqlResult = String.format(sql, tableName, filedSql, modelValuesSql, duplicateKeySql);
-        SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass);
-        return this.addInsertMappedStatement(mapperClass, modelClass, "insertOrUpdateBath", sqlSource, new NoKeyGenerator(), null, null);
-    }
-
-    /**
-     * 准备ON DUPLICATE KEY UPDATE sql
-     *
-     * @param tableInfo
-     * @return
-     */
-    private String prepareDuplicateKeySql(TableInfo tableInfo) {
-        final StringBuilder duplicateKeySql = new StringBuilder();
-        if (!StringUtils.isEmpty(tableInfo.getKeyColumn())) {
-            duplicateKeySql.append(tableInfo.getKeyColumn()).append("=values(").append(tableInfo.getKeyColumn()).append("),");
-        }
-
-        tableInfo.getFieldList().forEach(x -> {
-            duplicateKeySql.append(x.getColumn())
-                    .append("=values(")
-                    .append(x.getColumn())
-                    .append("),");
-        });
-        duplicateKeySql.delete(duplicateKeySql.length() - 1, duplicateKeySql.length());
-        return duplicateKeySql.toString();
-    }
-
-    /**
-     * 准备属性名
-     *
-     * @param tableInfo
-     * @return
-     */
-    private String prepareFieldSql(TableInfo tableInfo) {
-        StringBuilder fieldSql = new StringBuilder();
-        fieldSql.append(tableInfo.getKeyColumn()).append(",");
-        tableInfo.getFieldList().forEach(x -> {
-            fieldSql.append(x.getColumn()).append(",");
-        });
-        fieldSql.delete(fieldSql.length() - 1, fieldSql.length());
-        fieldSql.insert(0, "(");
-        fieldSql.append(")");
-        return fieldSql.toString();
-    }
-
-    private String prepareModelValuesSql(TableInfo tableInfo) {
-        final StringBuilder valueSql = new StringBuilder();
-        valueSql.append("<foreach collection=\"collection\" item=\"item\" index=\"index\" open=\"(\" separator=\"),(\" close=\")\">");
-        if (!StringUtils.isEmpty(tableInfo.getKeyProperty())) {
-            valueSql.append("#{item.").append(tableInfo.getKeyProperty()).append("},");
-        }
-        tableInfo.getFieldList().forEach(x -> valueSql.append("#{item.").append(x.getProperty()).append("},"));
-        valueSql.delete(valueSql.length() - 1, valueSql.length());
-        valueSql.append("</foreach>");
-        return valueSql.toString();
-    }
-}

+ 0 - 30
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/base/method/UpdateBatch.java

@@ -1,30 +0,0 @@
-package com.qmth.teachcloud.exchange.common.base.method;
-
-import com.baomidou.mybatisplus.core.injector.AbstractMethod;
-import com.baomidou.mybatisplus.core.metadata.TableInfo;
-import org.apache.ibatis.mapping.MappedStatement;
-import org.apache.ibatis.mapping.SqlSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @Description: 自定义更新
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2022/5/11
- */
-public class UpdateBatch extends AbstractMethod {
-    private final static Logger log = LoggerFactory.getLogger(UpdateBatch.class);
-
-    @Override
-    public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
-        String sql = "<script>\n<foreach collection=\"collection\" item=\"item\" separator=\";\">\nupdate %s %s where %s=#{%s} %s\n</foreach>\n</script>";
-        String additional = tableInfo.isWithVersion() ? tableInfo.getVersionFieldInfo().getVersionOli("item", "item.") : "" + tableInfo.getLogicDeleteSql(true, true);
-        String setSql = sqlSet(tableInfo.isWithLogicDelete(), false, tableInfo, false, "item", "item.");
-        String sqlResult = String.format(sql, tableInfo.getTableName(), setSql, tableInfo.getKeyColumn(), "item." + tableInfo.getKeyProperty(), additional);
-        SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass);
-        // 第三个参数必须和RootMapper的自定义方法名一致
-        return this.addUpdateMappedStatement(mapperClass, modelClass, "updateBatch", sqlSource);
-    }
-}

+ 0 - 23
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/config/DictionaryConfig.java

@@ -26,17 +26,6 @@ public class DictionaryConfig {
         return new PrefixUrlDomain();
     }
 
-    /**
-     * 系统配置
-     *
-     * @return
-     */
-    @Bean
-    @ConfigurationProperties(prefix = "sys.config")
-    public SysDomain sysDomain() {
-        return new SysDomain();
-    }
-
     @Bean
     @ConfigurationProperties(prefix = "com.qmth.fss.public", ignoreUnknownFields = false)
     public FssPublicDomain fssPublicDomain() {
@@ -48,16 +37,4 @@ public class DictionaryConfig {
     public FssPrivateDomain fssPrivateDomain() {
         return new FssPrivateDomain();
     }
-
-    @Bean
-    @ConfigurationProperties(prefix = "com.qmth.fss.localpdf", ignoreUnknownFields = false)
-    public FssLocalPdfDomain fssLocalPdfDomain() {
-        return new FssLocalPdfDomain();
-    }
-
-    @Bean
-    @ConfigurationProperties(prefix = "com.qmth.fss.localfile", ignoreUnknownFields = false)
-    public FssLocalFileDomain fssLocalFileDomain() {
-        return new FssLocalFileDomain();
-    }
 }

+ 1 - 25
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/contant/SystemConstant.java

@@ -44,13 +44,13 @@ public class SystemConstant {
     public static final String GET_EQUAL = "=";
     public static final String PATH_MATCH = "*";
     public static final String PATH_SUBSTR = "/#";
+    public static final String OSS = "oss";
 
     /**
      * 缓存配置
      */
     public static final String SCHOOL_CACHE = "school:cache";
     public static final String SCHOOL_CODE_CACHE = "school:code:cache";
-    public static final String AUTH_INFO_CACHE = "auth:info:cache";
 
     /**
      * 鉴权
@@ -61,30 +61,6 @@ public class SystemConstant {
     public static final String HEADER_DEVICE_ID = "deviceId";
     public static final String TOKEN = "token";
     public static final String SIGN = "sign";
-
-    /**
-     * redis
-     */
-    public static final int DEFAULT_SESSION_EXPIRE = 1;//过期时间1天
-//    public static final long REDIS_DEFAULT_EXPIRE_TIME = 24 * 60L * 60L;//过期时间24小时
-
-    /**
-     * aes相关
-     */
-    public static final String AES = "AES";
-    public static final String AES_MODE_PKCS5 = "AES/CBC/PKCS5Padding";//用这个模式,规则必须为16位
-    public static final String AES_MODE_PKCS7 = "AES/CBC/PKCS7Padding";//用这个模式,规则必须为16位
-    public static final String AES_RULE = "1234567890123456";//aes密钥
-
-    /**
-     * 线程池配置
-     */
-    public static final String THREAD_POOL_NAME = "taskThreadPool";
-    //    public static final int THREAD_POOL_CORE_POOL_SIZE = 5;
-//    public static final int THREAD_POOL_MAX_POOL_SIZE = 100;
-    public static final int THREAD_POOL_KEEP_ALIVE_SECONDS = 10;
-    public static final int THREAD_POOL_QUEUE_CAPACITY = 500;
-
     public static final String LOG_ERROR = "请求出错:{}";
 
     /**

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

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

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

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

+ 0 - 65
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/domain/SysDomain.java

@@ -1,65 +0,0 @@
-package com.qmth.teachcloud.exchange.common.domain;
-
-import java.io.Serializable;
-import java.time.Duration;
-import java.util.List;
-
-/**
- * @Description: 系统配置
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2020/4/10
- */
-public class SysDomain implements Serializable {
-
-    boolean oss;
-
-    List attachmentType;
-
-    Integer attachmentLength;
-
-    Double attachmentSize;
-
-    String serverUpload;
-
-    public boolean isOss() {
-        return oss;
-    }
-
-    public void setOss(boolean oss) {
-        this.oss = oss;
-    }
-
-    public List getAttachmentType() {
-        return attachmentType;
-    }
-
-    public void setAttachmentType(List attachmentType) {
-        this.attachmentType = attachmentType;
-    }
-
-    public Integer getAttachmentLength() {
-        return attachmentLength;
-    }
-
-    public void setAttachmentLength(Integer attachmentLength) {
-        this.attachmentLength = attachmentLength;
-    }
-
-    public Double getAttachmentSize() {
-        return attachmentSize;
-    }
-
-    public void setAttachmentSize(Double attachmentSize) {
-        this.attachmentSize = attachmentSize;
-    }
-
-    public String getServerUpload() {
-        return serverUpload;
-    }
-
-    public void setServerUpload(String serverUpload) {
-        this.serverUpload = serverUpload;
-    }
-}

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

@@ -3,6 +3,8 @@ package com.qmth.teachcloud.exchange.common.service;
 import com.qmth.boot.core.solar.model.AppInfo;
 import com.qmth.teachcloud.exchange.common.enums.AuthEnum;
 
+import java.util.Map;
+
 /**
  * @Description: 授权信息service
  * @Param:
@@ -49,4 +51,11 @@ public interface AuthInfoService {
      * @throws Exception
      */
     public void saveAuthInfo(AppInfo appInfo, AuthEnum authEnum, byte[] file) throws Exception;
+
+    /**
+     * 更新学校启用/禁用
+     *
+     * @param orgCodesMap
+     */
+    public void updateSchoolEnable(Map<String, String> orgCodesMap);
 }

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

@@ -1,93 +0,0 @@
-package com.qmth.teachcloud.exchange.common.service;
-
-import com.qmth.teachcloud.exchange.common.bean.dto.AuthOrgInfoDto;
-import com.qmth.teachcloud.exchange.common.entity.BasicSchool;
-
-/**
- * @Description: 缓存操作service
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2021/3/25
- */
-public interface CommonCacheService {
-
-    /**
-     * 添加学校缓存
-     *
-     * @param schoolId
-     * @return
-     */
-    public BasicSchool schoolCache(Long schoolId);
-
-    /**
-     * 添加学校缓存
-     *
-     * @param code
-     * @return
-     */
-    public BasicSchool schoolCache(String code);
-
-    /**
-     * 更新学校缓存
-     *
-     * @param schoolId
-     * @return
-     */
-    public BasicSchool updateSchoolCache(Long schoolId);
-
-    /**
-     * 更新学校缓存
-     *
-     * @param code
-     * @return
-     */
-    public BasicSchool updateSchoolCache(String code);
-
-    /**
-     * 删除学校缓存
-     *
-     * @param schoolId
-     */
-    public void removeSchoolCache(Long schoolId);
-
-    /**
-     * 删除学校缓存
-     */
-    public void removeSchoolIdCache();
-
-    /**
-     * 删除学校缓存
-     *
-     * @param code
-     */
-    public void removeSchoolCache(String code);
-
-    /**
-     * 删除学校缓存
-     */
-    public void removeSchoolCodeCache();
-
-    /**
-     * 添加鉴权缓存
-     *
-     * @param code
-     * @return
-     */
-    public AuthOrgInfoDto authInfoCache(String code);
-
-    /**
-     * 修改鉴权缓存
-     *
-     * @param code
-     * @return
-     */
-    public AuthOrgInfoDto updateAuthInfoCache(String code);
-
-    /**
-     * 删除鉴权缓存
-     *
-     * @param code
-     */
-    public void removeAuthInfoCache(String code);
-}

+ 57 - 35
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/service/impl/AuthInfoServiceImpl.java

@@ -1,11 +1,11 @@
 package com.qmth.teachcloud.exchange.common.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.qmth.boot.core.cache.service.CacheService;
 import com.qmth.boot.core.solar.config.SolarProperties;
 import com.qmth.boot.core.solar.model.AppInfo;
 import com.qmth.boot.core.solar.model.OrgInfo;
 import com.qmth.boot.core.solar.service.SolarService;
-import com.qmth.teachcloud.exchange.common.bean.dto.AuthOrgInfoDto;
 import com.qmth.teachcloud.exchange.common.config.DictionaryConfig;
 import com.qmth.teachcloud.exchange.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.exchange.common.contant.SystemConstant;
@@ -14,11 +14,8 @@ import com.qmth.teachcloud.exchange.common.entity.TSAuth;
 import com.qmth.teachcloud.exchange.common.enums.AuthEnum;
 import com.qmth.teachcloud.exchange.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.exchange.common.enums.UploadFileEnum;
-import com.qmth.teachcloud.exchange.common.mapper.BasicSchoolMapper;
-import com.qmth.teachcloud.exchange.common.mapper.TSAuthMapper;
 import com.qmth.teachcloud.exchange.common.service.AuthInfoService;
 import com.qmth.teachcloud.exchange.common.service.BasicSchoolService;
-import com.qmth.teachcloud.exchange.common.service.CommonCacheService;
 import com.qmth.teachcloud.exchange.common.service.TSAuthService;
 import com.qmth.teachcloud.exchange.common.util.FileStoreUtil;
 import org.apache.commons.codec.digest.DigestUtils;
@@ -54,24 +51,18 @@ public class AuthInfoServiceImpl implements AuthInfoService {
     @Resource
     TSAuthService tsAuthService;
 
-    @Resource
-    TSAuthMapper tsAuthMapper;
-
-    @Resource
-    CommonCacheService commonCacheService;
-
     @Resource
     BasicSchoolService basicSchoolService;
 
-    @Resource
-    BasicSchoolMapper basicSchoolMapper;
-
     @Resource
     FileStoreUtil fileStoreUtil;
 
     @Resource
     DictionaryConfig dictionaryConfig;
 
+    @Resource
+    CacheService cacheService;
+
     /**
      * 授权信息初始化
      *
@@ -118,11 +109,11 @@ public class AuthInfoServiceImpl implements AuthInfoService {
      */
     @Override
     public void appHasExpired(String code) {
-        if (Objects.nonNull(code)) {
-            AuthOrgInfoDto authOrgInfoDto = commonCacheService.authInfoCache(code);
-            if (Objects.isNull(authOrgInfoDto) || (Objects.nonNull(authOrgInfoDto) && authOrgInfoDto.getControl().hasExpired())) {
-                throw ExceptionResultEnum.AUTH_INFO_ERROR.exception();
-            }
+        BasicSchool basicSchool = (BasicSchool) cacheService.get(SystemConstant.SCHOOL_CODE_CACHE, code);
+        if ((Objects.nonNull(basicSchool) && Objects.nonNull(basicSchool.getEnable()) && !basicSchool.getEnable())
+                || (Objects.isNull(solarService.getAppInfo()) || solarService.getAppInfo().getControl().hasExpired())
+                || (Objects.isNull(solarService.getAppControl()) || solarService.getAppControl().hasExpired())) {
+            throw ExceptionResultEnum.AUTH_INFO_ERROR.exception();
         }
     }
 
@@ -169,16 +160,22 @@ public class AuthInfoServiceImpl implements AuthInfoService {
     public void saveAuthInfo(AppInfo appInfo, AuthEnum authEnum, byte[] file) throws Exception {
         List<OrgInfo> orgInfoList = solarService.getOrgList();
         List<TSAuth> tsAuthList = null;
-        Set<Long> orgIdsSet = null;
+        Map<String, String> orgCodesMap = null;
         Set<BasicSchool> basicSchoolSet = null;
         if (!CollectionUtils.isEmpty(orgInfoList)) {
             tsAuthList = new ArrayList<>();
-            orgIdsSet = new HashSet<>();
+            orgCodesMap = new HashMap<>();
             basicSchoolSet = new HashSet<>();
         }
-        boolean oss = dictionaryConfig.sysDomain().isOss();
+        String config = null;
+        if (Objects.nonNull(dictionaryConfig.fssPublicDomain())) {
+            config = dictionaryConfig.fssPublicDomain().getConfig();
+        } else if (Objects.nonNull(dictionaryConfig.fssPrivateDomain())) {
+            config = dictionaryConfig.fssPrivateDomain().getConfig();
+        }
+        boolean oss = Objects.nonNull(config) && (config.startsWith(SystemConstant.OSS) || config.startsWith(SystemConstant.OSS.toUpperCase())) ? true : false;
         for (OrgInfo o : orgInfoList) {
-            orgIdsSet.add(o.getId());
+            orgCodesMap.put(o.getCode(), o.getCode());
             if (authEnum == AuthEnum.OFF_LINE) {
                 if (Objects.isNull(file)) {
                     tsAuthList.add(new TSAuth(o.getId(), solarProperties.getLicense(), authEnum, appInfo.getControl().getExpireTime()));
@@ -188,9 +185,6 @@ public class AuthInfoServiceImpl implements AuthInfoService {
             } else {
                 tsAuthList.add(new TSAuth(o.getId(), solarProperties.getAccessKey(), solarProperties.getAccessSecret(), authEnum, appInfo.getControl().getExpireTime()));
             }
-            if (Objects.isNull(commonCacheService.updateAuthInfoCache(o.getCode()))) {
-                commonCacheService.removeAuthInfoCache(o.getCode());
-            }
 
             QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
             basicSchoolQueryWrapper.lambda().eq(BasicSchool::getCode, o.getCode());
@@ -198,7 +192,7 @@ public class AuthInfoServiceImpl implements AuthInfoService {
             if (Objects.isNull(basicSchool)) {//不存在则创建学校
                 basicSchool = new BasicSchool(o.getId(), o.getCode(), o.getName(), o.getAccessKey(), o.getAccessSecret());
                 if (Objects.nonNull(o.getLogo()) && (!o.getLogo().startsWith("https:") || !o.getLogo().startsWith("http"))) {
-                    String filePath = dictionaryConfig.fssLocalFileDomain().getConfig() + File.separator + SystemConstant.getUuid() + ".jpg";
+                    String filePath = dictionaryConfig.fssPublicDomain().getConfig() + File.separator + SystemConstant.getUuid() + ".jpg";
                     File logoFile = new File(filePath);
                     if (!logoFile.getParentFile().exists()) {
                         // 不存在则创建父目录及子文件
@@ -222,23 +216,51 @@ public class AuthInfoServiceImpl implements AuthInfoService {
                         basicSchool.setLogo(filePath);
                     }
                 } else {
-                    basicSchool.setLogo(o.getLogo());
+                    basicSchool.setLogo(o.getLogoUrl());
                 }
                 basicSchoolSet.add(basicSchool);
+            } else {
+                basicSchool.setAccessKey(o.getAccessKey());
+                basicSchool.setAccessSecret(o.getAccessSecret());
+                basicSchool.setLogo(Objects.nonNull(o.getLogoUrl()) ? o.getLogoUrl() : basicSchool.getLogo());
+                basicSchoolSet.add(basicSchool);
             }
         }
 
-        if (!CollectionUtils.isEmpty(tsAuthList) && !CollectionUtils.isEmpty(orgIdsSet)) {
-            QueryWrapper<TSAuth> tsAuthQueryWrapper = new QueryWrapper<>();
-            tsAuthQueryWrapper.lambda().in(TSAuth::getSchoolId, orgIdsSet);
-            tsAuthService.remove(tsAuthQueryWrapper);
-            tsAuthMapper.insertBatch(tsAuthList);
+        if (!CollectionUtils.isEmpty(tsAuthList) && !CollectionUtils.isEmpty(orgCodesMap)) {
+            tsAuthService.remove(new QueryWrapper<TSAuth>().lambda().ge(TSAuth::getId, 0L));
+            tsAuthService.saveOrUpdateBatch(tsAuthList);
 
             if (!CollectionUtils.isEmpty(basicSchoolSet)) {
-                commonCacheService.removeSchoolIdCache();
-                commonCacheService.removeSchoolCodeCache();
-                basicSchoolMapper.insertBatch(basicSchoolSet);
+                basicSchoolService.saveOrUpdateBatch(basicSchoolSet);
+                cacheService.clear(SystemConstant.SCHOOL_CACHE);
+                cacheService.clear(SystemConstant.SCHOOL_CODE_CACHE);
+            }
+
+            AuthInfoService authInfoService = SpringContextHolder.getBean(AuthInfoService.class);
+            authInfoService.updateSchoolEnable(orgCodesMap);
+        }
+    }
+
+    /**
+     * 更新学校启用/禁用
+     *
+     * @param orgCodesMap
+     */
+    @Override
+    public void updateSchoolEnable(Map<String, String> orgCodesMap) {
+        List<BasicSchool> basicSchoolList = basicSchoolService.list();
+        if (!CollectionUtils.isEmpty(basicSchoolList)) {
+            for (BasicSchool b : basicSchoolList) {
+                if (orgCodesMap.containsKey(b.getCode())) {
+                    b.setEnable(true);
+                } else {
+                    b.setEnable(false);
+                }
+                cacheService.put(SystemConstant.SCHOOL_CACHE, String.valueOf(b.getId()), b);
+                cacheService.put(SystemConstant.SCHOOL_CODE_CACHE, b.getCode(), b);
             }
+            basicSchoolService.saveOrUpdateBatch(basicSchoolList);
         }
     }
 }

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

@@ -1,166 +0,0 @@
-package com.qmth.teachcloud.exchange.common.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.qmth.boot.core.solar.model.AppInfo;
-import com.qmth.boot.core.solar.model.OrgInfo;
-import com.qmth.boot.core.solar.service.SolarService;
-import com.qmth.teachcloud.exchange.common.bean.dto.AuthOrgInfoDto;
-import com.qmth.teachcloud.exchange.common.contant.SystemConstant;
-import com.qmth.teachcloud.exchange.common.entity.BasicSchool;
-import com.qmth.teachcloud.exchange.common.service.BasicSchoolService;
-import com.qmth.teachcloud.exchange.common.service.CommonCacheService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-/**
- * @Description: 缓存操作serviceImpl 实现类
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2021/3/25
- */
-@Service
-public class CommonCacheServiceImpl implements CommonCacheService {
-    private final static Logger log = LoggerFactory.getLogger(CommonCacheServiceImpl.class);
-
-    @Resource
-    BasicSchoolService basicSchoolService;
-
-    @Resource
-    SolarService solarService;
-
-    /**
-     * 添加学校缓存
-     *
-     * @param schoolId
-     * @return
-     */
-    @Override
-    @Cacheable(value = SystemConstant.SCHOOL_CACHE, key = "#p0", unless = "#result == null")
-    public BasicSchool schoolCache(Long schoolId) {
-        return basicSchoolService.getById(schoolId);
-    }
-
-    /**
-     * 添加学校缓存
-     *
-     * @param code
-     * @return
-     */
-    @Override
-    @Cacheable(value = SystemConstant.SCHOOL_CODE_CACHE, key = "#p0", unless = "#result == null")
-    public BasicSchool schoolCache(String code) {
-        QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
-        basicSchoolQueryWrapper.lambda().eq(BasicSchool::getCode, code);
-        return basicSchoolService.getOne(basicSchoolQueryWrapper);
-    }
-
-    /**
-     * 更新学校缓存
-     *
-     * @param schoolId
-     * @return
-     */
-    @Override
-    @CachePut(value = SystemConstant.SCHOOL_CACHE, key = "#p0", condition = "#result != null")
-    public BasicSchool updateSchoolCache(Long schoolId) {
-        return basicSchoolService.getById(schoolId);
-    }
-
-    /**
-     * 更新学校缓存
-     *
-     * @param code
-     * @return
-     */
-    @Override
-    @CachePut(value = SystemConstant.SCHOOL_CODE_CACHE, key = "#p0", condition = "#result != null")
-    public BasicSchool updateSchoolCache(String code) {
-        QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
-        basicSchoolQueryWrapper.lambda().eq(BasicSchool::getCode, code);
-        return basicSchoolService.getOne(basicSchoolQueryWrapper);
-    }
-
-    /**
-     * 删除学校缓存
-     *
-     * @param schoolId
-     */
-    @Override
-    @CacheEvict(value = SystemConstant.SCHOOL_CACHE, key = "#p0")
-    public void removeSchoolCache(Long schoolId) {
-
-    }
-
-    /**
-     * 删除学校缓存
-     */
-    @Override
-    @CacheEvict(value = SystemConstant.SCHOOL_CACHE, allEntries = true)
-    public void removeSchoolIdCache() {
-
-    }
-
-    /**
-     * 删除学校缓存
-     *
-     * @param code
-     */
-    @Override
-    @CacheEvict(value = SystemConstant.SCHOOL_CODE_CACHE, key = "#p0")
-    public void removeSchoolCache(String code) {
-
-    }
-
-    /**
-     * 删除学校缓存
-     */
-    @Override
-    @CacheEvict(value = SystemConstant.SCHOOL_CODE_CACHE, allEntries = true)
-    public void removeSchoolCodeCache() {
-
-    }
-
-    @Override
-    @Cacheable(value = SystemConstant.AUTH_INFO_CACHE, key = "#p0", unless = "#result == null")
-    public AuthOrgInfoDto authInfoCache(String code) {
-        AppInfo appInfo = solarService.getAppInfo();
-        AuthOrgInfoDto authOrgInfoDto = null;
-        if (Objects.nonNull(appInfo)) {
-            List<OrgInfo> orgInfoList = solarService.getOrgList().stream().filter(s -> Objects.equals(s.getCode(), code)).collect(Collectors.toList());
-            if (Objects.nonNull(orgInfoList) && orgInfoList.size() > 0) {
-                authOrgInfoDto = new AuthOrgInfoDto(orgInfoList.get(0), appInfo.getControl());
-            }
-        }
-        return authOrgInfoDto;
-    }
-
-    @Override
-    @CachePut(value = SystemConstant.AUTH_INFO_CACHE, key = "#p0", condition = "#result != null")
-    public AuthOrgInfoDto updateAuthInfoCache(String code) {
-        AppInfo appInfo = solarService.getAppInfo();
-        AuthOrgInfoDto authOrgInfoDto = null;
-        if (Objects.nonNull(appInfo)) {
-            List<OrgInfo> orgInfoList = solarService.getOrgList().stream().filter(s -> Objects.equals(s.getCode(), code)).collect(Collectors.toList());
-            if (Objects.nonNull(orgInfoList) && orgInfoList.size() > 0) {
-                authOrgInfoDto = new AuthOrgInfoDto(orgInfoList.get(0), appInfo.getControl());
-            }
-        }
-        return authOrgInfoDto;
-    }
-
-    @Override
-    @CacheEvict(value = SystemConstant.AUTH_INFO_CACHE, key = "#p0")
-    public void removeAuthInfoCache(String code) {
-
-    }
-}

+ 51 - 56
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/util/FileStoreUtil.java

@@ -1,10 +1,7 @@
 package com.qmth.teachcloud.exchange.common.util;
 
 import com.qmth.boot.core.fss.service.FileService;
-import com.qmth.boot.core.fss.store.FileStore;
 import com.qmth.teachcloud.exchange.common.config.DictionaryConfig;
-import com.qmth.teachcloud.exchange.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.exchange.common.enums.LocalCatalogEnum;
 import com.qmth.teachcloud.exchange.common.enums.UploadFileEnum;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.io.FileUtils;
@@ -15,8 +12,6 @@ import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
 import java.io.*;
-import java.time.Duration;
-import java.util.Objects;
 
 /**
  * @Description: 文件存储工具类
@@ -46,43 +41,43 @@ public class FileStoreUtil {
         log.info("dirName:{}", dirName);
     }
 
-    /**
-     * 上传文件到本地
-     *
-     * @param dirName     上传到地址
-     * @param inputStream 流
-     * @param catalogType 文件
-     */
-    public void localUpload(String dirName, InputStream inputStream, String md5, LocalCatalogEnum catalogType) throws Exception {
-        log.info("ossUpload is come in");
-        String configPath = "";
-        switch (catalogType) {
-            case LOCAL_FILE:
-                configPath = dictionaryConfig.fssLocalFileDomain().getConfig();
-                break;
-            case LOCAL_PDF:
-                configPath = dictionaryConfig.fssLocalPdfDomain().getConfig();
-                break;
-            default:
-                break;
-        }
-        dirName = dirName.replaceAll(configPath, "");
-        fileService.getFileStore(catalogType.getType()).write(dirName, inputStream, md5);
-        log.info("dirName:{}", dirName);
-    }
-
-    /**
-     * 上传文件到本地
-     *
-     * @param inputStream 流
-     * @param finalFile   最终文件
-     * @param catalogType 文件类型
-     * @throws Exception 异常
-     */
-    public void copyInputStreamToFile(InputStream inputStream, File finalFile, String md5, LocalCatalogEnum catalogType) throws Exception {
-        String dirName = finalFile.getPath().replaceAll("\\\\", "/");
-        this.localUpload(dirName, inputStream, md5, catalogType);
-    }
+//    /**
+//     * 上传文件到本地
+//     *
+//     * @param dirName     上传到地址
+//     * @param inputStream 流
+//     * @param catalogType 文件
+//     */
+//    public void localUpload(String dirName, InputStream inputStream, String md5, LocalCatalogEnum catalogType) throws Exception {
+//        log.info("ossUpload is come in");
+//        String configPath = "";
+//        switch (catalogType) {
+//            case LOCAL_FILE:
+//                configPath = dictionaryConfig.fssLocalFileDomain().getConfig();
+//                break;
+//            case LOCAL_PDF:
+//                configPath = dictionaryConfig.fssLocalPdfDomain().getConfig();
+//                break;
+//            default:
+//                break;
+//        }
+//        dirName = dirName.replaceAll(configPath, "");
+//        fileService.getFileStore(catalogType.getType()).write(dirName, inputStream, md5);
+//        log.info("dirName:{}", dirName);
+//    }
+
+//    /**
+//     * 上传文件到本地
+//     *
+//     * @param inputStream 流
+//     * @param finalFile   最终文件
+//     * @param catalogType 文件类型
+//     * @throws Exception 异常
+//     */
+//    public void copyInputStreamToFile(InputStream inputStream, File finalFile, String md5, LocalCatalogEnum catalogType) throws Exception {
+//        String dirName = finalFile.getPath().replaceAll("\\\\", "/");
+//        this.localUpload(dirName, inputStream, md5, catalogType);
+//    }
 
     /**
      * 上传文件
@@ -158,20 +153,20 @@ public class FileStoreUtil {
      */
     public String getPrivateUrl(String objectPath, String type) {
         String server = null;
-        if ("public".equals(type)) {
-            server = dictionaryConfig.fssPublicDomain().getServer();
-            return server + "/" + objectPath;
-        } else if ("private".equals(type)) {
-            Boolean oss = dictionaryConfig.sysDomain().isOss();
-            if (Objects.nonNull(oss) && oss) {
-                FileStore fileStore = fileService.getFileStore(type);
-                return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(5L));
-            } else {
-                return dictionaryConfig.fssPrivateDomain().getServer() + "/" + objectPath;
-            }
-        } else {
-            throw ExceptionResultEnum.ERROR.exception("文件存储store类型不存在");
-        }
+//        if ("public".equals(type)) {
+        server = dictionaryConfig.fssPublicDomain().getServer();
+        return server + File.separator + objectPath;
+//        } else if ("private".equals(type)) {
+//            Boolean oss = dictionaryConfig.sysDomain().isOss();
+//            if (Objects.nonNull(oss) && oss) {
+//                FileStore fileStore = fileService.getFileStore(type);
+//                return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(5L));
+//            } else {
+//                return dictionaryConfig.fssPrivateDomain().getServer() + "/" + objectPath;
+//            }
+//        } else {
+//            throw ExceptionResultEnum.ERROR.exception("文件存储store类型不存在");
+//        }
     }
 
     /**

+ 0 - 266
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/util/RedisUtil.java

@@ -1,266 +0,0 @@
-package com.qmth.teachcloud.exchange.common.util;
-
-import com.qmth.teachcloud.exchange.common.contant.SystemConstant;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @Description: redis util
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2020/4/15
- */
-@Component
-public class RedisUtil {
-
-    @Resource
-    RedisTemplate<String, Object> redisTemplate;
-
-    /**
-     * 获取用户会话信息
-     *
-     * @param sessionId
-     * @return
-     */
-    public Object getUserSession(String sessionId) {
-        return redisTemplate.opsForValue().get(SystemConstant.SESSION + sessionId);
-    }
-
-    /**
-     * 删除用户会话缓存
-     *
-     * @param sessionId
-     */
-    public void deleteUserSession(String sessionId) {
-        redisTemplate.delete(SystemConstant.SESSION + sessionId);
-    }
-
-    /**
-     * 设置用户session信息
-     *
-     * @param sessionId
-     * @param o
-     * @param time
-     */
-    public void setUserSession(String sessionId, Object o, long time) {
-        redisTemplate.opsForValue().set(SystemConstant.SESSION + sessionId, o, time, TimeUnit.SECONDS);
-    }
-
-    /**
-     * 获取过期时间
-     *
-     * @param sessionId
-     * @return
-     */
-    public Long getUserSessionExpire(String sessionId) {
-        return redisTemplate.opsForValue().getOperations().getExpire(SystemConstant.SESSION + sessionId);
-    }
-
-    /**
-     * 批量获取key的value
-     *
-     * @param keys
-     * @return
-     */
-    public List<?> multiGet(Set keys) {
-        return redisTemplate.opsForValue().multiGet(keys);
-    }
-
-    /**
-     * 获取key like
-     *
-     * @param key
-     * @return
-     */
-    public Set<?> getKeyPatterns(String key) {
-        if (Objects.nonNull(key)) {
-            return redisTemplate.keys(key);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * 设置hash
-     *
-     * @param key
-     * @param hashKey
-     * @param hashValue
-     */
-    public void set(String key, String hashKey, Object hashValue) {
-        redisTemplate.opsForHash().put(key, hashKey, hashValue);
-    }
-
-    /**
-     * 获取hash
-     *
-     * @param key
-     * @param hashKey
-     * @return
-     */
-    public Object get(String key, String hashKey) {
-        return redisTemplate.opsForHash().get(key, hashKey);
-    }
-
-    /**
-     * hash删除
-     *
-     * @param key
-     * @param hashKey
-     */
-    public void delete(String key, String hashKey) {
-        redisTemplate.opsForHash().delete(key, hashKey);
-    }
-
-    /**
-     * 获取hash大小
-     *
-     * @param key
-     * @return
-     */
-    public Long getHashSize(String key) {
-        return redisTemplate.opsForHash().size(key);
-    }
-
-    /**
-     * 获取hash map
-     *
-     * @param key
-     * @return
-     */
-    public Map getHashEntries(String key) {
-        return redisTemplate.opsForHash().entries(key);
-    }
-
-    /**
-     * 分布式锁
-     *
-     * @param key
-     * @param timeout SECONDS
-     * @return
-     */
-    public boolean lock(String key, long timeout) {
-        long expireAt = System.currentTimeMillis() + (timeout * 1000) + 1;
-        return redisTemplate.opsForValue().setIfAbsent(key, expireAt, timeout, TimeUnit.SECONDS);
-    }
-
-    /**
-     * 删除锁
-     *
-     * @param key
-     * @return
-     */
-    public void releaseLock(String key) {
-        redisTemplate.expire(key, 100, TimeUnit.MILLISECONDS);
-    }
-
-    /**
-     * 设置缓存
-     *
-     * @param key
-     * @param o
-     */
-    public void set(String key, Object o) {
-        redisTemplate.opsForValue().set(key, o);
-    }
-
-    /**
-     * 设置缓存
-     *
-     * @param key
-     * @param o
-     * @param time
-     * @param timeUnit
-     */
-    public void set(String key, Object o, long time, TimeUnit timeUnit) {
-        redisTemplate.opsForValue().set(key, o, time, timeUnit);
-    }
-
-    /**
-     * 设置缓存
-     *
-     * @param key
-     * @param o
-     * @param time SECONDS
-     */
-    public void set(String key, Object o, long time) {
-        set(key, o, time, TimeUnit.SECONDS);
-    }
-
-    /**
-     * 获取缓存
-     *
-     * @param key
-     * @return
-     */
-    public Object get(String key) {
-        return redisTemplate.opsForValue().get(key);
-    }
-
-    /**
-     * 删除缓存
-     *
-     * @param key
-     * @return
-     */
-    public void delete(String key) {
-        redisTemplate.expire(key, 0, TimeUnit.SECONDS);
-    }
-
-    /**
-     * 保存hash结构
-     *
-     * @param key
-     * @param map
-     */
-    public void setForHash(String key, Map<String, Object> map) {
-        redisTemplate.opsForHash().putAll(key, map);
-    }
-
-    /**
-     * 保存list
-     *
-     * @param key
-     * @param Object
-     */
-    public void setForLeftList(String key, Object Object) {
-        redisTemplate.opsForList().leftPush(key, Object);
-    }
-
-    /**
-     * 获取list
-     *
-     * @param key
-     */
-    public Object getForRightList(String key) {
-        return redisTemplate.opsForList().rightPop(key, 0, TimeUnit.SECONDS);
-    }
-
-    /**
-     * 设置过期时间(秒)
-     *
-     * @param key
-     * @param timeOutSecond
-     */
-    public void expire(String key, int timeOutSecond) {
-        redisTemplate.expire(key, timeOutSecond, TimeUnit.SECONDS);
-    }
-
-    /**
-     * 设置过期时间
-     *
-     * @param key
-     * @param timeOut
-     */
-    public void expire(String key, long timeOut, TimeUnit timeUnit) {
-        redisTemplate.expire(key, timeOut, timeUnit);
-    }
-}

+ 0 - 7
xjtu-exchange/src/main/java/com/qmth/xjtu/XjtuExchangeApplication.java

@@ -1,13 +1,11 @@
 package com.qmth.xjtu;
 
 import com.qmth.boot.core.security.config.SecurityAutoConfiguration;
-import com.qmth.teachcloud.exchange.common.base.CustomizedSqlInjector;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.domain.EntityScan;
 import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.context.annotation.Bean;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
@@ -24,9 +22,4 @@ public class XjtuExchangeApplication {
     public static void main(String[] args) {
         SpringApplication.run(XjtuExchangeApplication.class, args);
     }
-
-    @Bean
-    public CustomizedSqlInjector customizedSqlInjector() {
-        return new CustomizedSqlInjector();
-    }
 }

+ 1 - 0
xjtu-exchange/src/main/java/com/qmth/xjtu/api/OpenApiController.java

@@ -73,6 +73,7 @@ public class OpenApiController {
                                @ApiParam(value = "用户类型") @RequestParam(required = false) String userType,
                                @ApiParam(value = "员工工号") @RequestParam(required = false) String employeeNo,
                                @ApiParam(value = "返回url") @RequestParam(required = false) String returnUrl) throws IOException {
+        authInfoService.appInfoInit();
         if ((Objects.isNull(code) || Objects.equals(code, ""))
                 || (Objects.isNull(employeeNo) || Objects.equals(employeeNo, ""))) {
             throw ExceptionResultEnum.ERROR.exception("请先通过学校地址登录");

+ 4 - 22
xjtu-exchange/src/main/resources/application-dev.properties

@@ -16,11 +16,10 @@ db.name=exchange-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=
+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
 
 #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
@@ -28,23 +27,6 @@ com.qmth.datasource.username=${db.username}
 com.qmth.datasource.password=${db.password}
 com.qmth.mybatis.log-level=debug
 
-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
-
-#\u7CFB\u7EDF\u914D\u7F6E
-sys.config.oss=true
-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=
-spring.resources.static-locations=file:${sys.config.serverUpload},classpath:/META-INF/resources/,classpath:/resources/
-
 #com.qmth.api.uri-prefix=/aaa
 #\u7EDF\u8BA1\u9875\u9762\u914D\u7F6E
 com.qmth.api.metrics-endpoint=/metrics-count