Bläddra i källkod

Merge remote-tracking branch 'origin/master'

wangqiang 2 år sedan
förälder
incheckning
fd4bb8cf65
32 ändrade filer med 3789 tillägg och 4 borttagningar
  1. 35 0
      jeeplus-common/jeeplus-common-core/src/main/java/com/jeeplus/config/properties/JeePlusProperties.java
  2. 162 0
      jeeplus-modules/jeeplus-assess/pom.xml
  3. 27 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/JeeplusAssessApplication.java
  4. 60 0
      jeeplus-modules/jeeplus-assess/src/main/resources/bootstrap.yml
  5. 165 0
      jeeplus-modules/jeeplus-public-modules/pom.xml
  6. 25 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/JeeplusPublicModulesApplication.java
  7. 177 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/controller/OssController.java
  8. 129 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/controller/OssFileController.java
  9. 69 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/domain/WorkAttachment.java
  10. 29 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/mapper/OssServiceMapper.java
  11. 96 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/mapper/xml/OssServiceMapper.xml
  12. 333 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/OSSClientService.java
  13. 443 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/OssService.java
  14. 11 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/dto/FileDetailDTO.java
  15. 12 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/dto/FileUrlDto.java
  16. 6 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/dto/OssServiceDto.java
  17. 20 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/dto/WorkAttachmentDto.java
  18. 64 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/controller/SerialnumTplController.java
  19. 64 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/domain/SysSerialnumTpl.java
  20. 20 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/mapper/SerialnumTplMapper.java
  21. 38 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/mapper/xml/TemplateMapper.xml
  22. 312 0
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/service/SerialnumTplService.java
  23. 98 0
      jeeplus-modules/jeeplus-public-modules/src/main/resources/bootstrap.yml
  24. 23 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/domain/SysParameterValue.java
  25. 3 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/OfficeMapper.java
  26. 10 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/OfficeMapper.xml
  27. 27 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/model/FileData.java
  28. 289 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/FileKit.java
  29. 489 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/FileUtils.java
  30. 514 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/Global.java
  31. 37 4
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/UserUtils.java
  32. 2 0
      jeeplus-modules/pom.xml

+ 35 - 0
jeeplus-common/jeeplus-common-core/src/main/java/com/jeeplus/config/properties/JeePlusProperties.java

@@ -3,11 +3,13 @@
  */
 package com.jeeplus.config.properties;
 
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
 import lombok.Data;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
 
+import java.io.File;
 import java.io.Serializable;
 
 /**
@@ -28,6 +30,17 @@ public class JeePlusProperties implements Serializable {
     @Value("${jwt.accessToken.expireTime}")
     public long EXPIRE_TIME;
 
+    /**
+     * 文件存储路径
+     */
+    @Value("${userfiles.basedir}")
+    private String userfilesBasedir;
+
+    /**
+     * 上传文件基础虚拟路径
+     */
+    public static final String USERFILES_BASE_URL = "/userfiles/";
+
 
     public static JeePlusProperties newInstance() {
 
@@ -35,6 +48,28 @@ public class JeePlusProperties implements Serializable {
     }
 
 
+    /**
+     * 获取上传文件的根目录
+     *
+     * @return
+     */
+    public String getUserfilesBaseDir() {
+        String dir = this.userfilesBasedir;
+        if (StrUtil.isBlank(dir)) {
+            try {
+                return new File(this.getClass().getResource("/").getPath())
+                        .getParentFile().getParentFile().getParentFile().getCanonicalPath();
+            } catch (Exception e) {
+                return "";
+            }
+        }
+        if (!dir.endsWith("/")) {
+            dir += "/";
+        }
+
+        return dir;
+    }
+
 
 
 }

+ 162 - 0
jeeplus-modules/jeeplus-assess/pom.xml

@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>jeeplus-modules</artifactId>
+        <groupId>org.jeeplus</groupId>
+        <version>9.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>jeeplus-assess</artifactId>
+
+    <name>jeeplus-assess</name>
+    <description>Assess project for Spring Boot</description>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-mybatis-plus</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <!-- SpringCloud Alibaba Nacos -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+
+        <!-- SpringCloud Alibaba Nacos Config -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
+
+        <!-- SpringCloud Alibaba Sentinel -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>${zxing.core}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>javase</artifactId>
+            <version>${zxing.core}</version>
+        </dependency>
+
+        <!--添加actuator依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <!--spring boot admin依赖-->
+        <dependency>
+            <groupId>de.codecentric</groupId>
+            <artifactId>spring-boot-admin-starter-client</artifactId>
+        </dependency>
+
+        <!-- 获取系统信息 -->
+        <dependency>
+            <groupId>com.github.oshi</groupId>
+            <artifactId>oshi-core</artifactId>
+            <version>${oshi.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna-platform</artifactId>
+            <version>${jna.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna</artifactId>
+            <version>${jna.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-mail</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-core</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-security</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-system-api</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-log</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-swagger</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-system</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>${hutool.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>jeeplus-assess</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.1.2.RELEASE</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+
+</project>

+ 27 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/JeeplusAssessApplication.java

@@ -0,0 +1,27 @@
+package com.jeeplus.assess;
+
+import com.jeeplus.core.annotation.JeeplusCloudApplication;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.cache.annotation.EnableCaching;
+
+/**
+ * 评估模块
+ */
+@EnableCaching
+@JeeplusCloudApplication
+public class JeeplusAssessApplication {
+    public static void main(String[] args) {
+        SpringApplication.run ( JeeplusAssessApplication.class, args );
+        System.out.println ( " O(∩_∩)O~ 评估模块启动成功 ^_^゙  \n" +
+                "    _                         _                                       _                      \n" +
+                "   (_)                       | |                                     | |                     \n" +
+                "    _    ___    ___   _ __   | |  _   _   ___     ___   _   _   ___  | |_    ___   _ __ ___  \n" +
+                "   | |  / _ \\  / _ \\ | '_ \\  | | | | | | / __|   / __| | | | | / __| | __|  / _ \\ | '_ ` _ \\ \n" +
+                "   | | |  __/ |  __/ | |_) | | | | |_| | \\__ \\   \\__ \\ | |_| | \\__ \\ | |_  |  __/ | | | | | |\n" +
+                "   | |  \\___|  \\___| | .__/  |_|  \\__,_| |___/   |___/  \\__, | |___/  \\__|  \\___| |_| |_| |_|\n" +
+                "  _/ |               | |                                 __/ |                               \n" +
+                " |__/                |_|                                |___/                                " );
+    }
+}

+ 60 - 0
jeeplus-modules/jeeplus-assess/src/main/resources/bootstrap.yml

@@ -0,0 +1,60 @@
+# Tomcat
+server:
+  port: 9240
+  servlet:
+    context-path:
+#mybatis-plus配置
+#mybatis-plus:
+#  mapper-locations:
+#    - classpath*:com/jeeplus/modules/**/*Mapper.xml
+#    - classpath:/META-INF/admin-mybatis-mappings/*.xml
+#    - classpath:/META-INF/modeler-mybatis-mappings/*.xml
+#  #实体扫描,多个package用逗号或者分号分隔
+#  typeAliasesPackage: com.jeeplus.modules.**.entity
+#  configuration-properties:
+#    prefix:
+#    boolValue: TRUE
+#    blobType: BLOB
+
+# Spring
+spring:
+  servlet:
+    multipart:
+      max-file-size: 100MB
+      max-request-size: 100MB
+  application:
+    # 应用名称
+    name: jeeplus-assess
+  profiles:
+    # 环境配置
+    active: dev
+  cloud:
+    nacos:
+      discovery:
+        # 服务注册地址
+        server-addr: 127.0.0.1:8848
+        # 命名空间
+        namespace: ${spring.profiles.active}
+      config:
+        # 配置中心地址
+        server-addr: 127.0.0.1:8848
+        # 配置文件格式
+        file-extension: yml
+        # 共享配置
+        shared-configs:
+          - application.${spring.cloud.nacos.config.file-extension}
+        # 命名空间
+        namespace: ${spring.profiles.active}
+#ribbon的超时时间
+ribbon:
+  ConnectTimeout: 60000 # 连接超时时间(ms)
+  ReadTimeout: 60000 # 通信超时时间(ms)
+
+hystrix:
+  command:
+    default:
+      execution:
+        isolation:
+          thread:
+            timeoutInMillisecond: 60000 # 熔断超时时长:60000ms
+

+ 165 - 0
jeeplus-modules/jeeplus-public-modules/pom.xml

@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>jeeplus-modules</artifactId>
+        <groupId>org.jeeplus</groupId>
+        <version>9.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>jeeplus-public-modules</artifactId>
+
+    <name>jeeplus-public-modules</name>
+    <description>public-modules project for Spring Boot</description>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-mybatis-plus</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <!-- SpringCloud Alibaba Nacos -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+
+        <!-- SpringCloud Alibaba Nacos Config -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
+
+        <!-- SpringCloud Alibaba Sentinel -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>${zxing.core}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>javase</artifactId>
+            <version>${zxing.core}</version>
+        </dependency>
+
+        <!--添加actuator依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <!--spring boot admin依赖-->
+        <dependency>
+            <groupId>de.codecentric</groupId>
+            <artifactId>spring-boot-admin-starter-client</artifactId>
+        </dependency>
+
+        <!-- 获取系统信息 -->
+        <dependency>
+            <groupId>com.github.oshi</groupId>
+            <artifactId>oshi-core</artifactId>
+            <version>${oshi.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna-platform</artifactId>
+            <version>${jna.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna</artifactId>
+            <version>${jna.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-mail</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-core</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-security</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-system-api</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-log</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-common-swagger</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeeplus</groupId>
+            <artifactId>jeeplus-system</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>${hutool.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun.oss</groupId>
+            <artifactId>aliyun-sdk-oss</artifactId>
+            <version>${aliyun-sdk-oss.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>jeeplus-public-modules</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.1.2.RELEASE</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+</project>

+ 25 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/JeeplusPublicModulesApplication.java

@@ -0,0 +1,25 @@
+package com.jeeplus.pubmodules;
+
+import com.jeeplus.core.annotation.JeeplusCloudApplication;
+import org.springframework.boot.SpringApplication;
+import org.springframework.cache.annotation.EnableCaching;
+
+/**
+ * 公共模块
+ */
+@EnableCaching
+@JeeplusCloudApplication
+public class JeeplusPublicModulesApplication {
+    public static void main(String[] args) {
+        SpringApplication.run ( JeeplusPublicModulesApplication.class, args );
+        System.out.println ( " O(∩_∩)O~ 公共模块启动成功 ^_^゙  \n" +
+                "    _                         _                                       _                      \n" +
+                "   (_)                       | |                                     | |                     \n" +
+                "    _    ___    ___   _ __   | |  _   _   ___     ___   _   _   ___  | |_    ___   _ __ ___  \n" +
+                "   | |  / _ \\  / _ \\ | '_ \\  | | | | | | / __|   / __| | | | | / __| | __|  / _ \\ | '_ ` _ \\ \n" +
+                "   | | |  __/ |  __/ | |_) | | | | |_| | \\__ \\   \\__ \\ | |_| | \\__ \\ | |_  |  __/ | | | | | |\n" +
+                "   | |  \\___|  \\___| | .__/  |_|  \\__,_| |___/   |___/  \\__, | |___/  \\__|  \\___| |_| |_| |_|\n" +
+                "  _/ |               | |                                 __/ |                               \n" +
+                " |__/                |_|                                |___/                                " );
+    }
+}

+ 177 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/controller/OssController.java

@@ -0,0 +1,177 @@
+package com.jeeplus.pubmodules.oss.controller;
+
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.auth.sts.AssumeRoleRequest;
+import com.aliyuncs.auth.sts.AssumeRoleResponse;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.http.MethodType;
+import com.aliyuncs.http.ProtocolType;
+import com.aliyuncs.profile.DefaultProfile;
+import com.aliyuncs.profile.IClientProfile;
+import com.jeeplus.config.properties.JeePlusProperties;
+import com.jeeplus.pubmodules.oss.service.OSSClientService;
+import com.jeeplus.sys.utils.FileKit;
+import com.jeeplus.sys.utils.FileUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+@Api(tags ="oss")
+@RestController
+@RequestMapping(value = "/oss/oss")
+public class OssController {
+
+    private static final String DIRECTORY = "/attachment-file";
+
+    private static final String ALIYUNURL = "http://oss.gangwaninfo.com";
+
+    private static final String ALIYUNDOWNLOADURL = "";
+
+    @Value("${config.accessory.aliyun.bucketName}")
+    private String bucketName;
+
+    @Value("${config.accessory.aliyun.endpoint}")
+    private String endpoint;
+
+    @Autowired
+    private OSSClientService ossClientService;
+
+    /**
+     * 文件上传
+     * @param storeAs
+     * @param file
+     * @return
+     * @throws Exception
+     */
+    @ApiOperation(value = "文件上传")
+    @PostMapping("/upload")
+    public ResponseEntity<String> upload(@RequestParam String storeAs, @RequestParam("file") MultipartFile file) throws Exception {
+        //取得上传文件
+        if (file != null && !file.isEmpty()) {
+            // 文件保存路径
+            String realPath =DIRECTORY.replace("/","")+"/"+storeAs+ossClientService.datePath()+"/"+ System.currentTimeMillis();
+            //文件原名称
+            String newName = file.getOriginalFilename();
+            ossClientService.uploadFile2OSS(file.getInputStream(),realPath,newName);
+            String filepath = ALIYUNURL + "/" + realPath + newName;
+            return ResponseEntity.ok (filepath);
+        }
+        return ResponseEntity.ok(null);
+    }
+
+    @PostMapping("/getAccess")
+    @ApiOperation(value = "文件上传(前端调用)")
+    public Map<Object, Object> getAccess() {
+        // 只有 RAM用户(子账号)才能调用 AssumeRole 接口
+        // 阿里云主账号的AccessKeys不能用于发起AssumeRole请求
+        // 请首先在RAM控制台创建一个RAM用户,并为这个用户创建AccessKeys
+        String accessKeyId =  "LTAI5tBBnQdpZapU28Ds89fb";
+        String accessKeySecret = "A37CuoALjoxCjPolzRm3ct5o8UHILF";
+        // RoleArn 需要在 RAM 控制台上获取
+        String roleArn = "acs:ram::1132186699724035:role/yf";
+        long durationSeconds = Long.parseLong("3600");
+        String policy = "{\n" +
+                "  \"Version\": \"1\",\n" +
+                "  \"Statement\": [\n" +
+                "    {\n" +
+                "      \"Effect\": \"Allow\",\n" +
+                "      \"Action\": [\n" +
+                "        \"oss:*\"\n" +
+                "      ],\n" +
+                "      \"Resource\": [\n" +
+                "        \"acs:oss:*:*:*\"\n" +
+                "      ],\n" +
+                "      \"Condition\": {}\n" +
+                "    }\n" +
+                "  ]\n" +
+                "}";
+        // RoleSessionName 是临时Token的会话名称,自己指定用于标识你的用户,主要用于审计,或者用于区分Token颁发给谁
+        // 但是注意RoleSessionName的长度和规则,不要有空格,只能有'-' '_' 字母和数字等字符
+        // 具体规则请参考API文档中的格式要求
+        String roleSessionName = "yf";
+        // 此处必须为 HTTPS
+        ProtocolType protocolType = ProtocolType.HTTPS;
+        try {
+            final AssumeRoleResponse stsResponse = assumeRole(accessKeyId, accessKeySecret, roleArn, roleSessionName,
+                    policy, protocolType, durationSeconds);
+
+            Map<Object, Object> respMap = new HashMap<Object, Object>();
+            respMap.put("status", "200");
+            respMap.put("AccessKeyId", stsResponse.getCredentials().getAccessKeyId());
+            respMap.put("AccessKeySecret", stsResponse.getCredentials().getAccessKeySecret());
+            respMap.put("SecurityToken", stsResponse.getCredentials().getSecurityToken());
+            respMap.put("Expiration", stsResponse.getCredentials().getExpiration());
+            respMap.put("AliyunUrl",ALIYUNDOWNLOADURL);
+            respMap.put("Bucket", bucketName);
+            respMap.put("Endpoint", endpoint);
+            return respMap;
+        } catch (ClientException e) {
+            log.error("调用ali获取临时token报错,错误信息:" + e.getMessage());
+            Map<Object, Object> respMap = new HashMap<Object, Object>();
+            respMap.put("status", e.getErrCode());
+            respMap.put("AccessKeyId", "");
+            respMap.put("AccessKeySecret", "");
+            respMap.put("SecurityToken", "");
+            respMap.put("Expiration", "");
+            respMap.put("AliyunUrl", "");
+            respMap.put("Bucket", "");
+            respMap.put("Endpoint", "");
+            return respMap;
+        }
+    }
+
+    public static final String REGION_CN_HANGZHOU = "cn-hangzhou";
+    public static final String STS_API_VERSION = "2015-04-01";
+    protected AssumeRoleResponse assumeRole(String accessKeyId, String accessKeySecret, String roleArn,
+                                            String roleSessionName, String policy, ProtocolType protocolType, long durationSeconds) throws ClientException
+    {
+        try {
+            // 创建一个 Aliyun Acs Client, 用于发起 OpenAPI 请求
+            IClientProfile profile = DefaultProfile.getProfile(REGION_CN_HANGZHOU, accessKeyId, accessKeySecret);
+            DefaultAcsClient client = new DefaultAcsClient(profile);
+            // 创建一个 AssumeRoleRequest 并设置请求参数
+            final AssumeRoleRequest request = new AssumeRoleRequest();
+            request.setVersion(STS_API_VERSION);
+            request.setMethod(MethodType.POST);
+            request.setProtocol(protocolType);
+            request.setRoleArn(roleArn);
+            request.setRoleSessionName(roleSessionName);
+            request.setPolicy(policy);
+            request.setDurationSeconds(durationSeconds);
+            // 发起请求,并得到response
+            final AssumeRoleResponse response = client.getAcsResponse(request);
+            return response;
+        } catch (ClientException e) {
+            throw e;
+        }
+    }
+
+    /**
+     * 根据url删除文件
+     * @param url
+     * @return
+     */
+    @ApiOperation("根据url删除文件")
+    @GetMapping("/deleteByUrl")
+    public ResponseEntity delFileByUrl(@RequestParam String url) {
+        String id = FileKit.getFileDir(url);
+        if(FileUtils.delFile(id)){
+            return ResponseEntity.ok ("删除文件成功");
+        }else{
+            return ResponseEntity.badRequest().body ("删除文件失败");
+        }
+
+    }
+}

+ 129 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/controller/OssFileController.java

@@ -0,0 +1,129 @@
+package com.jeeplus.pubmodules.oss.controller;
+
+import com.jeeplus.pubmodules.oss.domain.WorkAttachment;
+import com.jeeplus.pubmodules.oss.service.OssService;
+import com.jeeplus.pubmodules.oss.service.dto.FileDetailDTO;
+import com.jeeplus.pubmodules.oss.service.dto.FileUrlDto;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@Slf4j
+@Api(tags ="oss")
+@RestController
+@RequestMapping(value = "/oss/file")
+public class OssFileController {
+
+    @Value("${config.accessory.aliyun.aliyunUrl}")
+    private String aliyunUrl;
+
+    @Value("${config.accessory.aliyun.aliyunDownloadUrl}")
+    private String aliyunDownloadUrl;
+
+    @Resource
+    private OssService ossService;
+
+    @ApiOperation(value = "保存数据")
+    @PostMapping("/saveMsg")
+    public void saveMsg(@RequestBody List<WorkAttachment> workAttachments) {
+        ossService.saveMsg(workAttachments);
+    }
+
+    @GetMapping("/deleteMsgByFileName")
+    @ApiOperation(value = "删除数据")
+    public void deleteMsgByFileName(@RequestParam String url) {
+        ossService.deleteMsgByFileName(url);
+    }
+
+    @GetMapping("/deleteMsgById")
+    @ApiOperation(value = "根据id删除数据")
+    public void deleteMsgById(@RequestParam String id) {
+        ossService.deleteMsgById(id);
+    }
+
+    @GetMapping("/getTemporaryUrl")
+    @ApiOperation(value = "根据url获取临时文件地址")
+    public ResponseEntity<String> getTemporaryUrl(@RequestParam String url) {
+        String temporaryLookUrl = ossService.getFileTemporaryLookUrl(aliyunUrl + url);
+        return ResponseEntity.ok(temporaryLookUrl);
+    }
+
+    @GetMapping("/findFileList")
+    @ApiOperation(value = "查询数据")
+    public ResponseEntity<List<WorkAttachment>> findFileList(@RequestParam("attachmentId") String attachmentId) {
+        List<WorkAttachment> list = ossService.findFileList(attachmentId);
+        return ResponseEntity.ok(list);
+    }
+
+    /**
+     * 下载附件
+     */
+    @GetMapping("/downLoadAttach")
+    @ApiOperation(value = "下载附件")
+    public String downLoadAttach(@RequestParam String file, HttpServletResponse response, HttpServletRequest request) throws IOException {
+        file = "http://oss.gangwaninfo.com" + file;
+        file = file.replace("amp;", "");
+        String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+        String cons = "";
+        if (file.contains(aliyunUrl)) {
+            cons = aliyunUrl;
+        } else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")) {
+            cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+        } else {
+            cons = aliyunDownloadUrl;
+        }
+        String key = file.split(cons + "/")[1];
+        log.info("-----------------------------------------");
+        log.info("fileName=" + fileName);
+        log.info("key=" + key);
+        log.info("-----------------------------------------");
+        ossService.downByStream(key, fileName, response, request.getHeader("USER-AGENT"));
+        return null;
+    }
+
+    @GetMapping("/getFileSizeByUrl")
+    @ApiOperation(value = "根据文件路径获取文件信息")
+    public ResponseEntity<FileDetailDTO> getFileSizeByUrl(@RequestParam("url") String url) {
+        FileDetailDTO fileDetailDTO = ossService.getFileSizeByUrl(url);
+        return ResponseEntity.ok(fileDetailDTO);
+    }
+
+    /**
+     * 上传文件
+     * @return
+     * @throws IOException
+     */
+    @ApiOperation("上传文件")
+    @PostMapping("webUpload/upload")
+    public ResponseEntity<FileUrlDto> webUpload(MultipartFile file) throws IOException {
+        String dir = "note";
+        FileUrlDto dto = ossService.webUpload(file,dir);
+        return ResponseEntity.ok(dto);
+    }
+
+    /**
+     * 上传文件
+     * @return
+     * @throws IOException
+     */
+    @ApiOperation("上传文件")
+    @PostMapping("webUpload/fileUpload")
+    public ResponseEntity<FileUrlDto> fileUpload(MultipartFile file,@RequestParam(required = false) String dir) throws IOException {
+        if(StringUtils.isBlank(dir)){
+            dir = "oss";
+        }
+        FileUrlDto dto = ossService.webUpload(file,dir);
+        return ResponseEntity.ok(dto);
+    }
+}

+ 69 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/domain/WorkAttachment.java

@@ -0,0 +1,69 @@
+package com.jeeplus.pubmodules.oss.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.service.dto.BaseDTO;
+import lombok.Data;
+
+@Data
+@TableName("work_attachment")
+public class WorkAttachment extends BaseDTO {
+
+    /**
+     * 附件地址
+     */
+    private String url;
+
+    /**
+     * 文件类型(文件后缀名)
+     */
+    private String type;
+
+    /**
+     * 附件对应父节点id(记录是谁的id)
+     */
+    private String attachmentId;
+
+    /**
+     * 文件名
+     */
+    private String attachmentName;
+
+    /**
+     * 文件所属业务模块(数据字典配置)
+     */
+    private String attachmentFlag;
+
+    /**
+     * 所属模块子模块
+     */
+    private String moduleType;
+
+    /**
+     * 附件类型
+     */
+    private String attachmentType;
+
+    /**
+     * 附件大小
+     */
+    private String fileSize;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 文件描述
+     */
+    private String description;
+
+    /**
+     * 附件临时地址
+     *该属性不是实体字段
+     */
+    @TableField(exist = false)
+    private String temporaryUrl;
+}

+ 29 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/mapper/OssServiceMapper.java

@@ -0,0 +1,29 @@
+package com.jeeplus.pubmodules.oss.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.jeeplus.pubmodules.oss.domain.WorkAttachment;
+import com.jeeplus.sys.service.dto.UserDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface OssServiceMapper extends BaseMapper<WorkAttachment> {
+
+    Integer selectSaveById(String id);
+
+    void updateProjectRecord(String id);
+
+    List<WorkAttachment> findList(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
+
+    void insertWorkAttachment (@Param("workAttachment") WorkAttachment workAttachment, @Param("userDto") UserDTO userDto);
+
+    /**
+     * 根据关联id和url查询数据信息
+     * @param workAttachment
+     * @return
+     */
+    List<WorkAttachment> getByAttachmentIdAndUrlAndAttachmentFlag(WorkAttachment workAttachment);
+}

+ 96 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/mapper/xml/OssServiceMapper.xml

@@ -0,0 +1,96 @@
+<?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.jeeplus.pubmodules.oss.mapper.OssServiceMapper">
+
+  <select id="selectSaveById" resultType="java.lang.Integer">
+    SELECT
+        COUNT( 0 )
+    FROM
+        work_attachment
+    WHERE
+        del_flag = 0
+        AND attachment_id = (
+        SELECT
+            attachment_id
+        FROM
+            work_attachment
+    WHERE
+        id = #{id})
+  </select>
+
+  <update id="updateProjectRecord">
+    UPDATE project_records
+    SET file_upload_type = 0
+    WHERE
+        id = (
+        SELECT
+            attachment_id
+        FROM
+            work_attachment
+    WHERE
+        id = #{id})
+  </update>
+
+    <select id="findList" resultType="com.jeeplus.pubmodules.oss.domain.WorkAttachment">
+        SELECT a.id, a.url, a.type, a.attachment_id, a.attachment_name, a.attachment_flag,
+        a.module_type, a.attachment_type, a.file_size, a.sort, a.description,
+        a.create_date, a.create_by as "create_by.id", su.name as "createBy.name" , a.update_date, a.update_by as "updateBy.id", a.del_flag
+         FROM work_attachment a
+         left join sys_user su on su.id = a.create_by
+         ${ew.customSqlSegment}
+         ORDER BY a.sort ASC;
+    </select>
+
+    <insert id="insertWorkAttachment">
+        INSERT INTO work_attachment (
+            id,
+            create_by,
+            create_date,
+            update_by,
+            update_date,
+            del_flag,
+            url,
+            type,
+            attachment_id,
+            attachment_name,
+            attachment_flag,
+            file_size,
+            sort
+            )
+        VALUES(
+            #{workAttachment.id},
+            #{userDto.id},
+            #{workAttachment.createDate},
+            #{userDto.id},
+            #{workAttachment.updateDate},
+            #{workAttachment.delFlag},
+            #{workAttachment.url},
+            #{workAttachment.type},
+            #{workAttachment.attachmentId},
+            #{workAttachment.attachmentName},
+            #{workAttachment.attachmentFlag},
+            #{workAttachment.fileSize},
+            #{workAttachment.sort}
+            )
+    </insert>
+
+    <select id="getByAttachmentIdAndUrlAndAttachmentFlag" resultType="com.jeeplus.pubmodules.oss.domain.WorkAttachment">
+        SELECT a.id, a.url, a.type, a.attachment_id, a.attachment_name, a.attachment_flag,
+        a.module_type, a.attachment_type, a.file_size, a.sort, a.description,
+        a.create_date, a.create_by as "create_by.id", su.name as "createBy.name" , a.update_date, a.update_by as "updateBy.id", a.del_flag
+         FROM work_attachment a
+         left join sys_user su on su.id = a.create_by
+         <where>
+             a.del_flag = 0
+             <if test="attachmentId != null and attachmentId != ''">
+                 and a.attachment_id = #{attachmentId}
+             </if>
+             <if test="attachmentName != null and attachmentName != ''">
+                 and a.attachment_name = #{attachmentName}
+             </if>
+             <if test="attachmentFlag != null and attachmentFlag != ''">
+                 and a.attachment_flag = #{attachmentFlag}
+             </if>
+         </where>
+    </select>
+</mapper>

+ 333 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/OSSClientService.java

@@ -0,0 +1,333 @@
+package com.jeeplus.pubmodules.oss.service;
+
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.OSSObject;
+import com.aliyun.oss.model.PutObjectResult;
+import com.aliyun.oss.model.SimplifiedObjectMeta;
+import com.jeeplus.sys.utils.Global;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.*;
+import java.net.URL;
+import java.util.Calendar;
+import java.util.Date;
+
+@Slf4j
+@Service
+public class OSSClientService {
+
+    @Value("${config.accessory.aliyun.aliyunDownloadUrl}")
+    private String aliyunDownloadUrl;
+
+    @Value("${config.accessory.aliyun.aliyunUrl}")
+    private String aliyunUrl;
+
+    @Value("${config.accessory.aliyun.bucketName}")
+    private String bucketName;
+
+    @Value("${qzBucketName}")
+    private String qzBucketName;
+
+    @Value("${config.accessory.aliyun.endpoint}")
+    private String endpoint;
+
+    @Value("${config.accessory.aliyun.accessKeyId}")
+    private String accessKeyId;
+
+    @Value("${config.accessory.aliyun.accessKeySecret}")
+    private String accessKeySecret;
+
+    /**
+     * 上传到OSS服务器  如果同名文件会覆盖服务器上的
+     *
+     * @param fileName 文件名称 包括后缀名
+     * @return 出错返回"" ,唯一MD5数字签名
+     */
+    public String uploadFile2OSS(InputStream inStream, String fileDir, String fileName) {
+        //初始化OSSClient
+        OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+        long start = System.currentTimeMillis();
+        //上传文件
+        PutObjectResult putResult = ossClient.putObject(bucketName, fileDir + fileName, inStream);
+        String ret = putResult.getETag();
+
+        try {
+            if (inStream != null) {
+                inStream.close();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        long end = System.currentTimeMillis();
+        log.info("上传文件到云服务器成功,文件名:{},耗时:{}ms",fileName,end-start);
+        return ret;
+    }
+
+    /**
+     * 获得url链接
+     *
+     * @param key
+     * @return
+     */
+    public String getUrl(String key) {
+        OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+        // 设置URL过期时间为10年  3600l* 1000*24*365*10
+        Date expiration = new Date(new Date().getTime() + 3600l * 1000 * 24 * 365 * 10);
+        // 生成URL
+        URL url = ossClient.generatePresignedUrl(bucketName, key, expiration);
+        if (url != null) {
+            return url.toString();
+        }
+        return null;
+    }
+
+
+
+    /**
+     * 阿里云获取临时文件大小
+     * @param file
+     */
+    public Long getSimplifiedObjectMeta(String file){
+        //初始化OSSClient
+        OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+
+        URL url = null;
+        SimplifiedObjectMeta simplifiedObjectMeta = new SimplifiedObjectMeta();
+        try {
+
+            file = file.replace("amp;","");
+            String aliyunDownload = aliyunDownloadUrl;
+            String aliDownloadUrl = aliyunUrl;
+            String cons = "";
+            if (file.contains(aliyunDownload)){
+                cons = aliyunDownload;
+            }else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+                cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+            }else {
+                cons = aliDownloadUrl;
+            }
+            String key = file.split(cons+"/")[1];
+            simplifiedObjectMeta = ossClient.getSimplifiedObjectMeta(bucketName, key);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+        return simplifiedObjectMeta.getSize();
+    }
+
+
+    /**
+     * 文件下载
+     * @param key
+     * @param fileName
+     */
+    public byte[] downBytesByStream(String key, String fileName){
+        OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+        byte[] bytes = null;
+        BufferedInputStream in = null;
+        ByteArrayOutputStream outputStream = null;
+        log.info("开始从云服务器加载文件,文件名:{}",fileName);
+        try {
+            // 创建OSSClient实例
+            long start = System.currentTimeMillis();
+            OSSObject ossObject = ossClient.getObject(bucketName, key);
+            in = new BufferedInputStream(ossObject.getObjectContent());
+            outputStream = new ByteArrayOutputStream();
+            byte[] car=new byte[1024];
+            int L=0;
+            while((L=in.read(car))!=-1){
+                outputStream.write(car, 0,L);
+            }
+            bytes = outputStream.toByteArray();
+            long end = System.currentTimeMillis();
+            log.info("从云服务器加载文件成功,文件名:{},耗时:{}ms",fileName,end-start);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally {
+            if (in!=null){
+                try {
+                    in.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (outputStream!=null){
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return  bytes;
+    }
+
+
+    /**
+     * 附件下载到本地指定文件夹
+     * @param key
+     * @param fileName
+     */
+    public void downByStreamSaveLocal(String key, String fileName,String downFileStr){
+        try {
+            // 创建OSSClient实例
+            OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+            OSSObject ossObject = ossClient.getObject(bucketName, key);
+            BufferedInputStream in = new BufferedInputStream(ossObject.getObjectContent());
+
+
+            //写入到文件(注意文件保存路径的后面一定要加上文件的名称)
+            FileOutputStream fileOut = new FileOutputStream(downFileStr);
+            BufferedOutputStream bos = new BufferedOutputStream(fileOut);
+            byte[] buf = new byte[4096];
+            int length = in.read(buf);
+            //保存文件
+            while(length != -1)
+            {
+                bos.write(buf, 0, length);
+                length = in.read(buf);
+            }
+            if(bos!=null){
+                bos.flush();
+                bos.close();
+            }
+            if(in!=null){
+                in.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * 文件下载(签章系统)
+     * @param key
+     * @param fileName
+     */
+    public byte[] downQzBytesByStream(String key, String fileName){
+        OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+        byte[] bytes = null;
+        BufferedInputStream in = null;
+        ByteArrayOutputStream outputStream = null;
+        log.info("开始从云服务器加载文件,文件名:{}",fileName);
+        try {
+            // 创建OSSClient实例
+            long start = System.currentTimeMillis();
+            OSSObject ossObject = ossClient.getObject(qzBucketName, key);
+            in = new BufferedInputStream(ossObject.getObjectContent());
+            outputStream = new ByteArrayOutputStream();
+            byte[] car=new byte[1024];
+            int L=0;
+            while((L=in.read(car))!=-1){
+                outputStream.write(car, 0,L);
+            }
+            bytes = outputStream.toByteArray();
+            long end = System.currentTimeMillis();
+            log.info("从云服务器加载文件成功,文件名:{},耗时:{}ms",fileName,end-start);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally {
+            if (in!=null){
+                try {
+                    in.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (outputStream!=null){
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return  bytes;
+    }
+
+
+    /**
+     * 附件下载到本地指定文件夹(签章系统)
+     * @param key
+     * @param fileName
+     */
+    public void downQzByStreamSaveLocal(String key, String fileName,String downFileStr){
+        try {
+            // 创建OSSClient实例
+            OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+            OSSObject ossObject = ossClient.getObject(qzBucketName, key);
+            BufferedInputStream in = new BufferedInputStream(ossObject.getObjectContent());
+
+
+            //写入到文件(注意文件保存路径的后面一定要加上文件的名称)
+            FileOutputStream fileOut = new FileOutputStream(downFileStr);
+            BufferedOutputStream bos = new BufferedOutputStream(fileOut);
+            byte[] buf = new byte[4096];
+            int length = in.read(buf);
+            //保存文件
+            while(length != -1)
+            {
+                bos.write(buf, 0, length);
+                length = in.read(buf);
+            }
+            if(bos!=null){
+                bos.flush();
+                bos.close();
+            }
+            if(in!=null){
+                in.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 阿里云获取临时文件查看url
+     * 签章文件查看
+     * @param file
+     */
+    public String getQzFileTemporaryLookUrl(String file){
+        URL url = null;
+        try {
+            OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+
+            file = file.replace("amp;","");
+            String aliyunUrl = Global.getAliyunUrl();
+            String aliDownloadUrl = Global.getAliDownloadUrl();
+            String cons = "";
+            if (file.contains(aliyunUrl)){
+                cons = aliyunUrl;
+            }else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+                cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+            }else {
+                cons = aliDownloadUrl;
+            }
+            String key = file.split(cons+"/")[1];
+            // 指定过期时间为24小时。
+            Date expiration = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 );
+            url = ossClient.generatePresignedUrl(qzBucketName, key, expiration);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return "";
+        }
+        return url.toString();
+    }
+
+
+    public String datePath(){
+        Calendar date = Calendar.getInstance();
+        String year = String.valueOf(date.get(Calendar.YEAR));
+        String month = String.valueOf(date.get(Calendar.MONTH)+1);
+        String day = String.valueOf(date.get(Calendar.DAY_OF_MONTH));
+        String path = "/"+year+"/"+month+"/"+day;
+        return path;
+    }
+}

+ 443 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/OssService.java

@@ -0,0 +1,443 @@
+package com.jeeplus.pubmodules.oss.service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.model.OSSObject;
+import com.aliyun.oss.model.SimplifiedObjectMeta;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jeeplus.core.query.QueryWrapperGenerator;
+import com.jeeplus.pubmodules.oss.domain.WorkAttachment;
+import com.jeeplus.pubmodules.oss.mapper.OssServiceMapper;
+import com.jeeplus.pubmodules.oss.service.dto.FileDetailDTO;
+import com.jeeplus.pubmodules.oss.service.dto.FileUrlDto;
+import com.jeeplus.pubmodules.oss.service.dto.WorkAttachmentDto;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.UserUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+public class OssService extends ServiceImpl<OssServiceMapper, WorkAttachment> {
+
+    @Value("${config.accessory.aliyun.aliyunUrl}")
+    private String aliyunUrl;
+
+    @Value("${config.accessory.aliyun.aliyunDownloadUrl}")
+    private String aliyunDownloadUrl;
+
+    @Value("${config.accessory.aliyun.endpoint}")
+    private String endpoint;
+
+    @Value("${config.accessory.aliyun.accessKeyId}")
+    private String accessKeyId;
+
+    @Value("${config.accessory.aliyun.accessKeySecret}")
+    private String accessKeySecret;
+
+    @Value("${config.accessory.aliyun.bucketName}")
+    private String bucketName;
+
+    @Resource
+    private OssServiceMapper ossServiceMapper;
+
+    @Value("${aliyun_directory}")
+    private String directory = "attachment-file/assess";
+
+    @Resource
+    private OSSClientService ossClientService;
+
+    /**
+     * 保存数据
+     * @param workAttachments
+     * @return
+     */
+    public void saveMsg(List<WorkAttachment> workAttachments) {
+        if (CollectionUtil.isNotEmpty(workAttachments)) {
+            //获取当前登录人信息
+            String id = UserUtils.getCurrentUserDTO().getId();
+            int i = 1;
+            for (WorkAttachment workAttachment : workAttachments) {
+                //判断文件是否存在
+                LambdaQueryWrapper<WorkAttachment> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+                lambdaQueryWrapper.eq(WorkAttachment::getUrl, workAttachment.getUrl());
+                lambdaQueryWrapper.eq(WorkAttachment::getAttachmentId, workAttachment.getAttachmentId());
+                List<WorkAttachment> list = ossServiceMapper.selectList(lambdaQueryWrapper);
+                if (CollectionUtil.isNotEmpty(list)) {
+                    i++;
+                    continue;
+                }
+                log.info("开始执行保存操作,入参:{}" , JSONObject.toJSONString(workAttachments));
+                //文件后缀名赋值
+                List<String> strings = Arrays.asList(workAttachment.getUrl().split("\\."));
+                workAttachment.setType(strings.get(strings.size()-1));
+                workAttachment.setId(UUID.randomUUID().toString().replace("-",""));
+                //排序赋值
+                workAttachment.setSort(i);
+                //基础信息赋值
+                //workAttachment.getCreateBy().setId(id);
+                workAttachment.setCreateTime(new Date());
+                //workAttachment.getUpdateBy().setId(id);
+                workAttachment.setUpdateTime(new Date());
+                workAttachment.setDelFlag(0);
+                i++;
+
+                UserDTO userDTO = UserUtils.getCurrentUserDTO();
+                ossServiceMapper.insertWorkAttachment(workAttachment, userDTO);
+            }
+            log.info("保存操作执行完成");
+        }
+    }
+
+    /**
+     * 根据文件路径删除文件
+     * @param url
+     */
+    public void deleteMsgByFileName(String url) {
+        log.info("开始执行删除操作,入参:{}" , url);
+        Map<String,Object> map = new HashMap<>();
+        map.put("url", url);
+        int i = ossServiceMapper.deleteByMap(map);
+        log.info("删除操作完成,共删除{}条数据" , i);
+    }
+
+    /**
+     * 根据id删除数据
+     * @param id
+     */
+    public void deleteMsgById(String id) {
+        log.info("开始执行删除操作,入参:{}" , id);
+        Map<String,Object> map = new HashMap<>();
+        map.put("id", id);
+        int i = ossServiceMapper.deleteByMap(map);
+        //项目文件删除后处理项目文件状态
+        Integer num = ossServiceMapper.selectSaveById(id);
+        if (num == 0) {
+            ossServiceMapper.updateProjectRecord(id);
+        }
+        log.info("删除操作完成,共删除{}条数据" , i);
+    }
+
+    /**
+     * 根据附件对应父节点id查询文件列表
+     * @param attachmentId
+     * @return
+     */
+    public List<WorkAttachment> findFileList(String attachmentId) {
+
+        log.info("文件查询开始,入参:{}" , attachmentId);
+        QueryWrapper<WorkAttachment> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq ("a.attachment_id", attachmentId );
+        List<WorkAttachment> list = ossServiceMapper.findList(queryWrapper);
+        //创建人和文件名称处理
+        if (CollectionUtil.isNotEmpty(list)) {
+            temporaryUrl(list);
+        }
+        log.info("文件查询结束,查询结果:{}" , JSONObject.toJSONString(list));
+        return list;
+    }
+
+    /**
+     * 生成临时文件
+     * @param list
+     * @return
+     */
+    public List<WorkAttachment> temporaryUrl(List<WorkAttachment> list) {
+        list.stream().forEach(work -> {
+            String url = null;
+            if (StringUtils.isNotEmpty(work.getUrl())) {
+                url = aliyunUrl + work.getUrl();
+                work.setTemporaryUrl(getFileTemporaryLookUrl(url));
+            }
+
+            //对文件大小进行处理
+            if(StringUtils.isBlank(work.getFileSize())){
+                work.setFileSize("0");
+            }
+            if(StringUtils.isNotBlank(work.getFileSize())){
+                Long fileSizeBytes = Long.parseLong(work.getFileSize());
+                //如果数据库文件大小小于等于0, 则访问阿里云获取文件大小
+                fileSizeBytes = 0L;
+                if (fileSizeBytes<=0){
+                    fileSizeBytes = ossClientService.getSimplifiedObjectMeta(url);
+                }
+
+                if(null != fileSizeBytes){
+                    Double fileSize = (double)fileSizeBytes/1024/1024;
+                    work.setFileSize(String.format("%.2f", fileSize));
+                }else{
+                    work.setFileSize("0.00");
+                }
+            }
+        });
+        return list;
+    }
+
+    /**
+     * 根据文件路径获取文件信息
+     * @param url
+     * @return
+     */
+    public FileDetailDTO getFileSizeByUrl(String url){
+        FileDetailDTO fileDetailDTO = new FileDetailDTO();
+        fileDetailDTO.setUrl(getFileTemporaryLookUrl(aliyunUrl + url));
+        Long fileSizeBytes = ossClientService.getSimplifiedObjectMeta(aliyunUrl + url);
+        if(null != fileSizeBytes){
+            Double fileSize = (double)fileSizeBytes;
+            fileDetailDTO.setSize(String.format("%.2f", fileSize));
+        }else{
+            fileDetailDTO.setSize("0");
+        }
+        return fileDetailDTO;
+    }
+
+    /**
+     * 阿里云获取临时文件查看url
+     * @param url
+     */
+    public String getFileTemporaryLookUrl(String url){
+        url = url.replace("amp;","");
+        String cons = "";
+        if (url.contains(aliyunUrl)){
+            cons = aliyunUrl;
+        }else if (url.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+            cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+        }else {
+            cons = aliyunDownloadUrl;
+        }
+        String key = "";
+        String[] split = url.split(cons + "/");
+        if(split.length>1){
+            key = split[1];
+        }else{
+            key = url;
+        }
+        // 指定过期时间为24小时。
+        Date expiration = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 );
+        //初始化OSSClient
+        OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+        return ossClient.generatePresignedUrl(bucketName, key, expiration).toString();
+    }
+
+    /**
+     * 附件下载
+     * @param key
+     * @param fileName
+     * @param response
+     */
+    public void downByStream(String key, String fileName, HttpServletResponse response, String agent){
+        try {
+            String newName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20").replaceAll("%28", "\\(").replaceAll("%29", "\\)").replaceAll("%3B", ";").replaceAll("%40", "@").replaceAll("%23", "\\#").replaceAll("%26", "\\&").replaceAll("%2C", "\\,");
+            // 创建OSSClient实例
+            //初始化OSSClient
+            OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+            OSSObject ossObject = ossClient.getObject(bucketName, key);
+            BufferedInputStream in = new BufferedInputStream(ossObject.getObjectContent());
+            BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
+            response.setHeader("Content-Disposition","attachment;filename*=UTF-8''"+ newName);
+
+            /*if(agent != null && agent.toLowerCase().indexOf("firefox") > 0){
+                response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''"+ URLEncoder.encode(fileName,"utf-8"));
+            }else {
+                response.setHeader("Content-Disposition","attachment;filename="+ URLEncoder.encode(fileName,"utf-8"));
+            }*/
+            byte[] car=new byte[1024];
+            int L=0;
+            while((L=in.read(car))!=-1){
+                out.write(car, 0,L);
+            }
+            if(out!=null){
+                out.flush();
+                out.close();
+            }
+            if(in!=null){
+                in.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 上传文件
+     * @param file
+     * @param dir 存放文件夹名称
+     * @return
+     * @throws Exception
+     */
+    public FileUrlDto webUpload(MultipartFile file, String dir) throws IOException {
+        FileUrlDto dto = new FileUrlDto();
+        // 文件保存路径
+        String fileDir =directory+"/"+dir+ossClientService.datePath()+"/"+ System.currentTimeMillis();
+        // 判断文件是否为空
+        if (!file.isEmpty()) {
+            String name = file.getOriginalFilename ();
+            ossClientService.uploadFile2OSS(file.getInputStream(), fileDir, name);
+            String url = fileDir +name;
+            String lsUrl = this.getFileTemporaryLookUrl(aliyunUrl + "/" + fileDir +name);
+            dto.setUrl(url);
+            dto.setLsUrl(lsUrl);
+        }
+        return dto;
+    }
+
+    /**
+     * 保存/修改附件
+     * @param fileList 要保存的附件,传空值则删除attachmentId下的所有附件
+     * @param attachmentId 附件的attachmentId
+     * @param attachmentFlag 附件的attachmentFlag
+     */
+    public void saveOrUpdateFileList(List<WorkAttachmentDto> fileList, String attachmentId, String attachmentFlag){
+        UserDTO userDTO = UserUtils.getCurrentUserDTO();
+        if (CollectionUtil.isNotEmpty(fileList)) {
+            List<String> ids = fileList.stream().filter(item -> {
+                if (StringUtils.isNotBlank(item.getId())) {
+                    return true;
+                }
+                return false;
+            }).map(WorkAttachmentDto::getId).collect(Collectors.toList());
+            if(CollectionUtil.isNotEmpty(ids)){
+                ossServiceMapper.delete(new QueryWrapper<WorkAttachment>().lambda()
+                        .eq(WorkAttachment::getAttachmentId, attachmentId)
+                        .notIn(WorkAttachment::getId,ids));
+            }else{
+                ossServiceMapper.delete(new QueryWrapper<WorkAttachment>().lambda()
+                        .eq(WorkAttachment::getAttachmentId, attachmentId));
+            }
+
+            List<WorkAttachmentDto> dtoList = fileList.stream().filter(item -> {
+                if (StringUtils.isNotBlank(item.getId())) {
+                    return false;
+                }
+                return true;
+            }).collect(Collectors.toList());
+
+            this.saveFileList(dtoList, userDTO, attachmentId,attachmentFlag);
+        } else {
+            ossServiceMapper.delete(new QueryWrapper<WorkAttachment>().lambda().eq(WorkAttachment::getAttachmentId, attachmentId));
+        }
+    }
+
+    /**
+     * 保存/修改附件
+     * @param fileList 要保存的附件,传空值则删除attachmentId下attachmentFlag下的所有附件
+     * @param attachmentId 附件的attachmentId
+     * @param attachmentFlag 附件的attachmentFlag
+     */
+    public void saveOrUpdateFileListFlag(List<WorkAttachmentDto> fileList,String attachmentId,String attachmentFlag){
+        UserDTO userDTO = UserUtils.getCurrentUserDTO();
+        if (CollectionUtil.isNotEmpty(fileList)) {
+            List<String> ids = fileList.stream().filter(item -> {
+                if (StringUtils.isNotBlank(item.getId())) {
+                    return true;
+                }
+                return false;
+            }).map(WorkAttachmentDto::getId).collect(Collectors.toList());
+            if(CollectionUtil.isNotEmpty(ids)){
+                ossServiceMapper.delete(new QueryWrapper<WorkAttachment>().lambda()
+                        .eq(WorkAttachment::getAttachmentId, attachmentId)
+                        .eq(WorkAttachment::getAttachmentFlag, attachmentFlag)
+                        .notIn(WorkAttachment::getId,ids));
+            }else{
+                ossServiceMapper.delete(new QueryWrapper<WorkAttachment>().lambda()
+                        .eq(WorkAttachment::getAttachmentId, attachmentId)
+                        .eq(WorkAttachment::getAttachmentFlag, attachmentFlag));
+            }
+
+            List<WorkAttachmentDto> dtoList = fileList.stream().filter(item -> {
+                if (StringUtils.isNotBlank(item.getId())) {
+                    return false;
+                }
+                return true;
+            }).collect(Collectors.toList());
+
+            this.saveFileList(dtoList, userDTO, attachmentId,attachmentFlag);
+        } else {
+            ossServiceMapper.delete(new QueryWrapper<WorkAttachment>().lambda().eq(WorkAttachment::getAttachmentId, attachmentId).eq(WorkAttachment::getAttachmentFlag, attachmentFlag));
+        }
+    }
+
+    /**
+     * 保存附件信息
+     * @param list 待保存的附件列表
+     * @param userDTO 当前登录用户
+     * @param attachmentId 关联id
+     */
+    public void saveFileList(List<WorkAttachmentDto> list, UserDTO userDTO, String attachmentId,String attachmentFlag) {
+        int sort = 1;
+        for (WorkAttachmentDto dto : list) {
+            WorkAttachment i = new WorkAttachment();
+            //包含了url、size、name
+            i.setId(UUID.randomUUID().toString().replace("-", ""));
+//            i.getCreateBy().setId(userDTO.getId());
+            i.setCreateTime(new Date());
+//            i.getUpdateBy().setId(userDTO.getId());
+            i.setUpdateTime(new Date());
+            i.setDelFlag(0);
+            i.setUrl(dto.getUrl());
+            //文件类型处理
+            List<String> strings = Arrays.asList(dto.getName().split("\\."));
+            if (CollectionUtil.isNotEmpty(strings)) {
+                i.setType(strings.get(1));
+            }
+            i.setAttachmentId(attachmentId);
+            i.setAttachmentName(dto.getName());
+            i.setAttachmentFlag(attachmentFlag);
+            i.setFileSize(dto.getSize());
+            i.setSort(sort);
+            ossServiceMapper.insertWorkAttachment(i, userDTO);
+            sort++;
+        }
+    }
+
+    /**
+     * 保存附件信息
+     * @param workAttachmentDto 待保存的附件信息
+     * @param userDTO 当前登录用户
+     * @param attachmentId 关联id
+     * @param attachmentFlag
+     * @param sort
+     */
+    public String saveFile(WorkAttachmentDto workAttachmentDto, UserDTO userDTO, String attachmentId,String attachmentFlag, Integer sort) {
+        WorkAttachment i = new WorkAttachment();
+        //包含了url、size、name
+        i.setId(UUID.randomUUID().toString().replace("-", ""));
+        i.setCreateTime(new Date());
+        i.setUpdateTime(new Date());
+        i.setDelFlag(0);
+        i.setUrl(workAttachmentDto.getUrl());
+        //文件类型处理
+        List<String> strings = Arrays.asList(workAttachmentDto.getName().split("\\."));
+        if (CollectionUtil.isNotEmpty(strings)) {
+            i.setType(strings.get(1));
+        }
+        i.setAttachmentId(attachmentId);
+        i.setAttachmentName(workAttachmentDto.getName());
+        i.setAttachmentFlag(attachmentFlag);
+        i.setFileSize(workAttachmentDto.getSize());
+        i.setSort(sort);
+        ossServiceMapper.insertWorkAttachment(i, userDTO);
+        return i.getId();
+    }
+
+
+}

+ 11 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/dto/FileDetailDTO.java

@@ -0,0 +1,11 @@
+package com.jeeplus.pubmodules.oss.service.dto;
+
+import lombok.Data;
+
+@Data
+public class FileDetailDTO {
+
+    private String url;
+
+    private String size;
+}

+ 12 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/dto/FileUrlDto.java

@@ -0,0 +1,12 @@
+package com.jeeplus.pubmodules.oss.service.dto;
+
+import lombok.Data;
+
+@Data
+public class FileUrlDto {
+
+    private String url;
+
+    private String lsUrl;
+
+}

+ 6 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/dto/OssServiceDto.java

@@ -0,0 +1,6 @@
+package com.jeeplus.pubmodules.oss.service.dto;
+
+import com.jeeplus.pubmodules.oss.domain.WorkAttachment;
+
+public class OssServiceDto extends WorkAttachment {
+}

+ 20 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/dto/WorkAttachmentDto.java

@@ -0,0 +1,20 @@
+package com.jeeplus.pubmodules.oss.service.dto;
+
+import com.jeeplus.core.service.dto.BaseDTO;
+import com.jeeplus.sys.service.dto.UserDTO;
+import lombok.Data;
+
+@Data
+public class WorkAttachmentDto extends BaseDTO {
+
+    private String name;
+
+    private String size;
+
+    private String url;
+
+    private UserDTO createBy;
+
+    private String by;
+
+}

+ 64 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/controller/SerialnumTplController.java

@@ -0,0 +1,64 @@
+package com.jeeplus.pubmodules.serialNumTpl.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.core.query.QueryWrapperGenerator;
+import com.jeeplus.pubmodules.serialNumTpl.domain.SysSerialnumTpl;
+import com.jeeplus.pubmodules.serialNumTpl.service.SerialnumTplService;
+import com.jeeplus.sys.domain.User;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.UserUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@Api(tags ="template")
+@RestController
+@RequestMapping(value = "/sys/template")
+public class SerialnumTplController {
+
+    @Resource
+    private SerialnumTplService serialnumTplService;
+
+    /**
+     * 编号模板列表
+     */
+    @ApiOperation(value = "编号模板列表")
+    @GetMapping(value = "/list")
+    public ResponseEntity<IPage<SysSerialnumTpl>> list(Page<SysSerialnumTpl> page, SysSerialnumTpl sysSerialnumTpl) throws Exception{
+        QueryWrapper<SysSerialnumTpl> sysSerialnumTplQueryWrapper = QueryWrapperGenerator.buildQueryCondition(sysSerialnumTpl, SysSerialnumTpl.class);
+        IPage<SysSerialnumTpl> list = serialnumTplService.list(page, sysSerialnumTplQueryWrapper);
+        return ResponseEntity.ok (list);
+    }
+
+    /**
+     * 编号模板删除
+     */
+    @ApiOperation(value = "编号模板列表")
+    @GetMapping(value = "/remove")
+    public String remove(@RequestParam String id){
+        return serialnumTplService.remove(id);
+    }
+
+    /**
+     * 编号模板查询
+     */
+    @ApiOperation(value = "编号模板列表")
+    @GetMapping(value = "/findById")
+    public SysSerialnumTpl findById(@RequestParam String id){
+        return serialnumTplService.findById(id);
+    }
+
+    /**
+     * 编号模板保存、修改
+     */
+    @ApiOperation(value = "编号模板保存、修改")
+    @PostMapping(value = "/save")
+    public String save(@RequestBody SysSerialnumTpl sysSerialnumTpl){
+        return serialnumTplService.save(sysSerialnumTpl);
+    }
+}

+ 64 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/domain/SysSerialnumTpl.java

@@ -0,0 +1,64 @@
+package com.jeeplus.pubmodules.serialNumTpl.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.query.Query;
+import lombok.Data;
+
+@Data
+@TableName(value = "sys_serialnum_tpl")
+public class SysSerialnumTpl extends BaseEntity {
+
+    /**
+     * 公司id
+     */
+    @TableField(value = "company_id")
+    private String companyId;
+
+    /**
+     * 业务标识
+     */
+    @TableField(value = "biz_code")
+    private String bizCode;
+
+    /**
+     * 年度
+     */
+    @TableField(value = "year_built")
+    private String yearBuilt;
+
+    /**
+     * 序列号
+     */
+    @TableField(value = "serial_num")
+    private Integer serialNum;
+
+    /**
+     * 编号模板
+     */
+    @TableField(value = "serial_tpl")
+    private String serialTpl;
+
+    /**
+     * 序列号长度
+     */
+    @TableField(value = "serial_num_len")
+    private Integer serialNumLen;
+
+    /**
+     * 模板名称
+     */
+    @Query
+    @TableField(value = "tpl_name")
+    private String tplName;
+
+    /**
+     * 模板示例
+     */
+    @TableField(value = "serial_tpl_ex")
+    private String serialTplEx;
+
+    @TableField(exist = false)
+    private String companyName;
+}

+ 20 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/mapper/SerialnumTplMapper.java

@@ -0,0 +1,20 @@
+package com.jeeplus.pubmodules.serialNumTpl.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.pubmodules.serialNumTpl.domain.SysSerialnumTpl;
+import org.apache.ibatis.annotations.Param;
+
+public interface SerialnumTplMapper extends BaseMapper<SysSerialnumTpl> {
+
+    IPage<SysSerialnumTpl> pageList(Page<SysSerialnumTpl> page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper);
+
+    SysSerialnumTpl queryByComAndBizCode(@Param("id")String id, @Param("bizCode")String bizCode);
+
+    void resetSerialNum(@Param("id")String id,@Param("yearBuilt")String yearBuilt,@Param("newYear")String newYear);
+
+    int updateSerialNum(SysSerialnumTpl numTpl);
+}

+ 38 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/mapper/xml/TemplateMapper.xml

@@ -0,0 +1,38 @@
+<?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.jeeplus.pubmodules.serialNumTpl.mapper.SerialnumTplMapper">
+
+	<select id="pageList" resultType="com.jeeplus.pubmodules.serialNumTpl.domain.SysSerialnumTpl">
+		SELECT
+			a.id,
+			a.tpl_name,
+			(SELECT b.`name` FROM sys_office b WHERE b.del_flag = 0 AND b.id = a.company_id ) AS company_name,
+			a.biz_code,
+			a.serial_num_len,
+			a.serial_tpl_ex
+		FROM
+			sys_serialnum_tpl a
+		${ew.customSqlSegment}
+		ORDER BY create_date DESC
+	</select>
+
+	<select id="queryByComAndBizCode" resultType="com.jeeplus.pubmodules.serialNumTpl.domain.SysSerialnumTpl">
+		select	a.*
+		 from sys_serialnum_tpl a
+		where a.company_id = #{id} and a.biz_code = #{bizCode} and a.del_flag = 0
+		order by update_date desc
+		limit 1
+	</select>
+
+	<update id="resetSerialNum">
+		UPDATE sys_serialnum_tpl
+		SET serial_num = 0 , year_built = #{newYear}
+		WHERE id = #{id} AND  year_built = #{yearBuilt}
+	</update>
+
+	<update id="updateSerialNum">
+		UPDATE sys_serialnum_tpl
+		SET serial_num = serial_num +1
+		WHERE id = #{id}
+	</update>
+</mapper>

+ 312 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/service/SerialnumTplService.java

@@ -0,0 +1,312 @@
+package com.jeeplus.pubmodules.serialNumTpl.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.pubmodules.serialNumTpl.domain.SysSerialnumTpl;
+import com.jeeplus.pubmodules.serialNumTpl.mapper.SerialnumTplMapper;
+import com.jeeplus.sys.domain.Office;
+import com.jeeplus.sys.mapper.OfficeMapper;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.UserUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.client.utils.DateUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.Month;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Service
+public class SerialnumTplService {
+
+    @Resource
+    private SerialnumTplMapper serialnumTplMapper;
+
+    @Resource
+    private OfficeMapper officeMapper;
+
+    public IPage<SysSerialnumTpl> list(Page<SysSerialnumTpl> page, QueryWrapper<SysSerialnumTpl> sysSerialnumTplQueryWrapper) {
+        sysSerialnumTplQueryWrapper.eq("del_flag", 0);
+        IPage<SysSerialnumTpl> list = serialnumTplMapper.pageList(page, sysSerialnumTplQueryWrapper);
+        return list;
+    }
+
+    public String remove(String id) {
+        serialnumTplMapper.deleteById(id);
+        return "操作成功";
+    }
+
+    public SysSerialnumTpl findById(String id) {
+        SysSerialnumTpl sysSerialnumTpl = serialnumTplMapper.selectById(id);
+        return sysSerialnumTpl;
+    }
+
+    public String save(SysSerialnumTpl sysSerialnumTpl) {
+        //获取当前登录人信息
+        UserDTO dto = UserUtils.getCurrentUserDTO();
+        //新增
+        if (StringUtils.isEmpty(sysSerialnumTpl.getId())) {
+            String id = UUID.randomUUID().toString().replace("-", "");
+            sysSerialnumTpl.setId(id);
+            sysSerialnumTpl.setCreateById(dto.getId());
+            sysSerialnumTpl.setCreateTime(new Date());
+            sysSerialnumTpl.setUpdateById(dto.getId());
+            sysSerialnumTpl.setUpdateTime(new Date());
+            sysSerialnumTpl.setDelFlag(0);
+            serialnumTplMapper.insert(sysSerialnumTpl);
+        }
+        //修改
+        if (StringUtils.isNotEmpty(sysSerialnumTpl.getId())) {
+            sysSerialnumTpl.setUpdateById(dto.getId());
+            sysSerialnumTpl.setUpdateTime(new Date());
+            serialnumTplMapper.updateById(sysSerialnumTpl);
+        }
+        return "操作完成";
+    }
+
+    @Transactional(readOnly = false,propagation = Propagation.REQUIRES_NEW)
+    public String genSerialNum(String companyId, String bizCode) throws Exception {
+        //获取当前登录人信息
+        UserDTO dto = UserUtils.getCurrentUserDTO();
+        Office office = officeMapper.selectById(companyId);
+        if (StringUtils.isBlank(bizCode)){
+            throw new Exception("生成编号失败,业务类型不能为空");
+        }
+        if (office != null) {
+            SysSerialnumTpl numTpl = this.querySerialTpl(office, bizCode);
+            if (numTpl == null) {
+                //查询编号模板   {brspnm}DZ-{year}-{serialNum}
+                SysSerialnumTpl serialNumTpl = serialnumTplMapper.queryByComAndBizCode(companyId, bizCode);
+                serialNumTpl.setCompanyId(companyId);
+                serialNumTpl.setSerialNum(0);
+                serialNumTpl.setCreateById(dto.getId());
+                serialNumTpl.setId(UUID.randomUUID().toString().replace("-", ""));
+                serialnumTplMapper.insert(serialNumTpl);
+                numTpl = serialNumTpl;
+            }
+            if (numTpl == null) {
+                throw new Exception("生成编号失败,请先设置相关业务编号模板");
+            }
+            String year = DateUtils.formatDate(new Date(), "yyyy");
+            if (!year.equals(numTpl.getYearBuilt())) {
+                serialnumTplMapper.resetSerialNum(numTpl.getId(), numTpl.getYearBuilt(), year);
+            }
+            Map<String, String> map = new HashMap<>();
+            String serialTpl = numTpl.getSerialTpl();
+            int i = serialnumTplMapper.updateSerialNum(numTpl);
+            if (i != 1) {
+                throw new Exception("生成编号失败,请稍后重试");
+            }
+            String num = String.valueOf(numTpl.getSerialNum() + 1);
+            StringBuffer sb = new StringBuffer();
+            for (int x = 0; x < (numTpl.getSerialNumLen() - num.length()); x++) {
+                sb.append("0");
+            }
+            sb.append(num);
+            //查询公司简称
+            if (serialTpl.contains("spnm")) {
+                String companyShortname = UserUtils.getSysParam("company_shortname");
+                map.put("spnm", StringUtils.isBlank(companyShortname) ? "" : companyShortname);
+            }
+            //查询分公司简称
+            if (serialTpl.contains("brspnm")) {
+                String branchShortname = UserUtils.getSysParam("branch_shortname");
+                map.put("brspnm", StringUtils.isBlank(branchShortname) ? "" : branchShortname);
+            }
+            //年份
+            if (serialTpl.contains("year")) {
+                map.put("year", year);
+            }
+            //月份
+            if (serialTpl.contains("month")) {
+                int month = new Date().getMonth() + 1;
+                map.put("month", month + "");
+            }
+            //序列号
+            if (serialTpl.contains("serialNum")) {
+                map.put("serialNum", sb.toString());
+            }
+            //日期
+            if (serialTpl.contains("day")) {
+                map.put("day", new Date().getDate() + "");
+            }
+            String serNum = renderString(serialTpl, map);
+            return serNum;
+        }
+        return "";
+    }
+
+    @Transactional(readOnly = false,propagation = Propagation.REQUIRES_NEW)
+    public String genSerialNumNoSort(String companyId, String bizCode) throws Exception {
+        //获取当前登录人信息
+        UserDTO dto = UserUtils.getCurrentUserDTO();
+        Office office = officeMapper.selectById(companyId);
+        if (StringUtils.isBlank(bizCode)){
+            throw new Exception("生成编号失败,业务类型不能为空");
+        }
+        if (office != null) {
+            SysSerialnumTpl numTpl = this.querySerialTpl(office, bizCode);
+            if (numTpl == null) {
+                //查询编号模板   {brspnm}DZ-{year}-{serialNum}
+                SysSerialnumTpl serialNumTpl = serialnumTplMapper.queryByComAndBizCode(companyId, bizCode);
+                serialNumTpl.setCompanyId(companyId);
+                serialNumTpl.setSerialNum(0);
+                serialNumTpl.setCreateById(dto.getId());
+                serialNumTpl.setId(UUID.randomUUID().toString().replace("-", ""));
+                serialnumTplMapper.insert(serialNumTpl);
+                numTpl = serialNumTpl;
+            }
+            if (numTpl == null) {
+                throw new Exception("生成编号失败,请先设置相关业务编号模板");
+            }
+            String year = DateUtils.formatDate(new Date(), "yyyy");
+            if (!year.equals(numTpl.getYearBuilt())) {
+                serialnumTplMapper.resetSerialNum(numTpl.getId(), numTpl.getYearBuilt(), year);
+            }
+            Map<String, String> map = new HashMap<>();
+            String serialTpl = numTpl.getSerialTpl();
+            int i = serialnumTplMapper.updateSerialNum(numTpl);
+            if (i != 1) {
+                throw new Exception("生成编号失败,请稍后重试");
+            }
+            String num = String.valueOf(numTpl.getSerialNum() + 1);
+            StringBuffer sb = new StringBuffer();
+            sb.append(num);
+            //查询公司简称
+            if (serialTpl.contains("spnm")) {
+                String companyShortname = UserUtils.getSysParam("company_shortname");
+                map.put("spnm", StringUtils.isBlank(companyShortname) ? "" : companyShortname);
+            }
+            //查询分公司简称
+            if (serialTpl.contains("brspnm")) {
+                String branchShortname = UserUtils.getSysParam("branch_shortname");
+                map.put("brspnm", StringUtils.isBlank(branchShortname) ? "" : branchShortname);
+            }
+            //年份
+            if (serialTpl.contains("year")) {
+                map.put("year", year);
+            }
+            //月份
+            if (serialTpl.contains("month")) {
+                int month = new Date().getMonth() + 1;
+                map.put("month", month + "");
+            }
+            //序列号
+            if (serialTpl.contains("serialNum")) {
+                map.put("serialNum", sb.toString());
+            }
+            //日期
+            if (serialTpl.contains("day")) {
+                map.put("day", new Date().getDate() + "");
+            }
+            String serNum = renderString(serialTpl, map);
+            return serNum;
+        }
+        return "";
+    }
+
+    @Transactional(readOnly = false,propagation = Propagation.REQUIRES_NEW)
+    public String genSerialReviewNum(String companyId, String bizCode) throws Exception {
+        //获取当前登录人信息
+        UserDTO dto = UserUtils.getCurrentUserDTO();
+        Office office = officeMapper.selectById(companyId);
+        if (StringUtils.isBlank(bizCode)){
+            throw new Exception("生成编号失败,业务类型不能为空");
+        }
+        if (office != null) {
+            SysSerialnumTpl numTpl = this.querySerialTpl(office, bizCode);
+            if (numTpl == null) {
+                //查询编号模板   {brspnm}DZ-{year}-{serialNum}
+                SysSerialnumTpl serialNumTpl = serialnumTplMapper.queryByComAndBizCode(companyId, bizCode);
+                serialNumTpl.setCompanyId(companyId);
+                serialNumTpl.setSerialNum(0);
+                serialNumTpl.setCreateById(dto.getId());
+                serialNumTpl.setId(UUID.randomUUID().toString().replace("-", ""));
+                serialnumTplMapper.insert(serialNumTpl);
+                numTpl = serialNumTpl;
+            }
+            if (numTpl == null) {
+                throw new Exception("生成编号失败,请先设置相关业务编号模板");
+            }
+            String year = DateUtils.formatDate(new Date(), "yyyy");
+            if (!year.equals(numTpl.getYearBuilt())) {
+                serialnumTplMapper.resetSerialNum(numTpl.getId(), numTpl.getYearBuilt(), year);
+            }
+            Map<String, String> map = new HashMap<>();
+            String serialTpl = numTpl.getSerialTpl();
+            int i = serialnumTplMapper.updateSerialNum(numTpl);
+            if (i != 1) {
+                throw new Exception("生成编号失败,请稍后重试");
+            }
+            String num = String.valueOf(numTpl.getSerialNum() + 1);
+            StringBuffer sb = new StringBuffer();
+//            for (int x = 0; x < (numTpl.getSerialNumLen() - num.length()); x++) {
+//                sb.append("0");
+//            }
+            sb.append(num);
+            //查询公司简称
+            if (serialTpl.contains("spnm")) {
+                String companyShortname = UserUtils.getSysParam("company_shortname");
+                map.put("spnm", StringUtils.isBlank(companyShortname) ? "" : companyShortname);
+            }
+            //查询分公司简称
+            if (serialTpl.contains("brspnm")) {
+                String branchShortname = UserUtils.getSysParam("branch_shortname");
+                map.put("brspnm", StringUtils.isBlank(branchShortname) ? "" : branchShortname);
+            }
+            //年份
+            if (serialTpl.contains("year")) {
+                map.put("year", year);
+            }
+            //月份
+            if (serialTpl.contains("month")) {
+                int month = new Date().getMonth() + 1;
+                map.put("month", month + "");
+            }
+            //序列号
+            if (serialTpl.contains("serialNum")) {
+                map.put("serialNum", sb.toString());
+            }
+            //日期
+            if (serialTpl.contains("day")) {
+                map.put("day", new Date().getDate() + "");
+            }
+            String serNum = renderString(serialTpl, map);
+            return serNum;
+        }
+        return "";
+    }
+
+    private SysSerialnumTpl querySerialTpl(Office company, String bizCode) {
+        SysSerialnumTpl numTpl = serialnumTplMapper.queryByComAndBizCode(company.getId(), bizCode);
+        if (numTpl==null && company.getParentId()!=null && !"0".equals(company.getParentId())){
+            Office office = officeMapper.selectById(company.getParentId());
+            numTpl = this.querySerialTpl(office,bizCode);
+        }
+        return numTpl;
+    }
+
+    /**
+     * 根据键值对填充字符串,如("hello {name}",{name:"xiaoming"})
+     * 输出:
+     * @param content
+     * @param map
+     * @return
+     */
+    public static String renderString(String content, Map<String, String> map){
+        Set<Map.Entry<String, String>> sets = map.entrySet();
+        for(Map.Entry<String, String> entry : sets) {
+            String regex = "\\{" + entry.getKey() + "\\}";
+            Pattern pattern = Pattern.compile(regex);
+            Matcher matcher = pattern.matcher(content);
+            content = matcher.replaceAll(entry.getValue());
+        }
+        return content;
+    }
+}

+ 98 - 0
jeeplus-modules/jeeplus-public-modules/src/main/resources/bootstrap.yml

@@ -0,0 +1,98 @@
+# Tomcat
+server:
+  port: 9245
+  servlet:
+    context-path:
+#mybatis-plus配置
+#mybatis-plus:
+#  mapper-locations:
+#    - classpath*:com/jeeplus/modules/**/*Mapper.xml
+#    - classpath:/META-INF/admin-mybatis-mappings/*.xml
+#    - classpath:/META-INF/modeler-mybatis-mappings/*.xml
+#  #实体扫描,多个package用逗号或者分号分隔
+#  typeAliasesPackage: com.jeeplus.modules.**.entity
+#  configuration-properties:
+#    prefix:
+#    boolValue: TRUE
+#    blobType: BLOB
+
+# Spring
+spring:
+  main:
+    allow-bean-definition-overriding: true
+  servlet:
+    multipart:
+      max-file-size: 100MB
+      max-request-size: 100MB
+  application:
+    # 应用名称
+    name: jeeplus-public-modules
+  profiles:
+    # 环境配置
+    active: dev
+  cloud:
+    nacos:
+      discovery:
+        # 服务注册地址
+        server-addr: 127.0.0.1:8848
+        # 命名空间
+        namespace: ${spring.profiles.active}
+      config:
+        # 配置中心地址
+        server-addr: 127.0.0.1:8848
+        # 配置文件格式
+        file-extension: yml
+        # 共享配置
+        shared-configs:
+          - application.${spring.cloud.nacos.config.file-extension}
+        # 命名空间
+        namespace: ${spring.profiles.active}
+#ribbon的超时时间
+ribbon:
+  ConnectTimeout: 60000 # 连接超时时间(ms)
+  ReadTimeout: 60000 # 通信超时时间(ms)
+
+hystrix:
+  command:
+    default:
+      execution:
+        isolation:
+          thread:
+            timeoutInMillisecond: 60000 # 熔断超时时长:60000ms
+
+#上传文件绝对路径, 路径中不允许包含“userfiles”
+userfiles:
+  basedir:       # 文件上传路径,可以留空
+  allowedType: file  # 允许上传的文件类型, all, file ,image, audio, video, office
+  extensions:
+    all: all       # 允许上传所有类型文件
+    file: 7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip       # 只允许上传安全文件(linux系统非可执行)
+    image: gif,jpg,jpeg,bmp,png     # 只允许上传图片
+    audio: CD,OGG,MP3,ASF,WMA,WAV,MP3PRO,RM,REAL,APE,MODULE,MIDI,VQF    # 只允许上传音频
+    video: AVI,WMV,RM,RMVB,MPEG1,MPEG2,MPEG4(MP4),3GP,ASF,SWF,VOB,DAT,MOV,M4V,FLV,F4V,MKV,MTS,TS     # 只允许上传视频
+    office: txt,xls,xlsx,xlsm,xltx,xltm,xlsb,xlam,doc,docx,docm,dotx,dotm,ppt,pptx,pptm,ppsx,ppsm,potx,potm,ppam     # 只允许上传office文件
+
+#oss配置
+config:
+  accessory:
+    type: minIO       #local, aliyun, minIO
+    baseDir: file
+    local:
+      location: d:\\accessory
+    aliyun:
+      aliyunUrl: http://oss.gangwaninfo.com
+      aliyunDownloadUrl: http://cdn.gangwaninfo.com
+      endpoint: http://oss-cn-hangzhou.aliyuncs.com
+      accessKeyId: LTAI5tQDWoM9c1WyJNPs86rX
+      accessKeySecret: 84dDIx4edT1n78KUOqqSmDZ35pchJv
+      bucketName: xgxm-test
+    minIO:
+      endpoint:
+      accessKey:
+      secretKey:
+      bucketName:
+
+#阿里云文件夹路径
+aliyun_directory: attachment-file/assess
+#签章阿里云文件bucketName
+qzBucketName: xg-qz

+ 23 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/domain/SysParameterValue.java

@@ -0,0 +1,23 @@
+package com.jeeplus.sys.domain;
+
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+@Data
+public class SysParameterValue extends BaseEntity {
+
+    private String remarks;
+
+    private String officeId;
+
+    private String companyId;
+
+    private String branchOffice;
+
+    private String parameterId;
+
+    private String falt;
+
+    private String value;
+
+}

+ 3 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/OfficeMapper.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.jeeplus.core.domain.TreeMapper;
 import com.jeeplus.sys.domain.Office;
+import com.jeeplus.sys.domain.SysParameterValue;
 import com.jeeplus.sys.service.dto.OfficeDTO;
 import org.apache.ibatis.annotations.Param;
 
@@ -26,4 +27,6 @@ public interface OfficeMapper extends TreeMapper <Office> {
      * @return
      */
     public List <OfficeDTO> findList(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
+
+    SysParameterValue findValueByParameter(@Param("parameter")String parameter, @Param("branchOffice")String branchOffice);
 }

+ 10 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/OfficeMapper.xml

@@ -33,4 +33,14 @@
             ${ew.customSqlSegment}
     </select>
 
+    <select id="findValueByParameter" resultType="com.jeeplus.sys.domain.SysParameterValue" >
+		SELECT
+		a.*
+		FROM sys_parameter_value a
+		WHERE a.parameter_id=(select s.id from sys_parameter s where s.parameter=#{parameter})
+		 and a.branch_office = #{branchOffice}
+		 and falt='0'
+		 and del_flag = '0'
+	</select>
+
 </mapper>

+ 27 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/model/FileData.java

@@ -0,0 +1,27 @@
+/**
+ * Copyright &copy; 2021-2026 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.sys.model;
+
+import com.google.common.collect.Lists;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * Created by 刘高峰 on 2018/3/18.
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class FileData {
+    private String id;
+    private String value;
+    private boolean open;
+    private String type;
+    private Long date;
+    private String icon;
+    private String size;
+    private String pId;
+    private List <FileData> data = Lists.newArrayList ( );
+}

+ 289 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/FileKit.java

@@ -0,0 +1,289 @@
+/**
+ * Copyright &copy; 2021-2026 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.sys.utils;
+
+import cn.hutool.core.util.StrUtil;
+import com.google.common.collect.Lists;
+import com.jeeplus.config.properties.JeePlusProperties;
+import com.jeeplus.sys.model.FileData;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by 刘高峰 on 2018/3/18.
+ */
+public class FileKit {
+    public static List<FileData> getFileList(File[] files) {
+        List fileDataList = Lists.newArrayList();
+        if (files != null) {
+            for (File file : files) {
+                FileData fileData = new FileData();
+                if (file.isDirectory()) { // 判断是文件还是文件夹
+                    fileData.setId(file.getName());
+                    fileData.setType("folder");
+                    fileData.setOpen(true);
+                    fileData.setValue(file.getName());
+                    fileData.setData(getFileList(file.listFiles()));
+                } else  { // 判断文件名是否以.avi结尾
+                    fileData.setId(file.getName());
+                    fileData.setType("file");
+                    fileData.setSize(String.valueOf(file.getTotalSpace()));
+                    fileData.setValue(file.getName());
+                }
+                fileDataList.add(fileData);
+            }
+
+        }
+        return fileDataList;
+    }
+
+    public  static String getFileType(String fileName){
+        String type = "file";
+        String suffix = StrUtil.subAfter (fileName, ".", true);
+        switch (suffix){
+            //html
+            case "htm":
+            case "html":
+            case "css":
+            case "less":
+            case "asp":
+            case "php":
+            case "jsp":
+            case "js":
+            case "java":
+            case "class":
+            case "c":
+            case "sql":
+                type = "code";
+                break;
+            //word
+            case "doc":
+                type = "word";
+                break;
+            case "txt":
+                type = "text";
+                break;
+            case "wps":
+                type = "word";
+                break;
+            case "xls":
+            case "xlsx":
+                type = "excel";
+                break;
+            case "ppt":
+            case "pptx":
+                type = "pp";
+                break;
+            case "pdf":
+                //压缩文件
+                type = "pdf";
+                break;
+            case "rar":
+            case "zip":
+                type = "archive";
+                break;
+            //
+            case "exe":
+                type = "fa-windows";
+                break;
+            //视频
+            case "rmvb":
+            case "wmv":
+            case "asf":
+            case "avi":
+            case "3gp":
+            case "mpg":
+            case "mkv":
+            case "mp4":
+            case "dvd":
+            case "ogm":
+            case "mov":
+            case "mpeg2":
+            case "mpeg4":
+                type = "video";
+                break;
+            //音频
+            case "mp3":
+            case "ogg":
+            case "wav":
+            case "ape":
+            case "cda":
+            case "au":
+            case "midi":
+            case "mac":
+            case "aac":
+                type = "audio";
+                break;
+            //flash
+            case "flv":
+            case "swf":
+            case "m4v":
+            case "f4v":
+                type = "flash";
+                break;
+            //图片
+            case "gif":
+            case "jpeg":
+            case "bmp":
+            case "tif":
+            case "png":
+            case "jpg":
+            case "pcd":
+            case "qti":
+            case "qtf":
+            case "tiff":
+                type = "image";
+                break;
+            default:
+                type = "file";
+        }
+        return type;
+    }
+
+    private static Long getCreateTime(String fullFileName){
+        Path path= Paths.get(fullFileName);
+        BasicFileAttributeView basicview= Files.getFileAttributeView(path, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS );
+        BasicFileAttributes attr;
+        try {
+            attr = basicview.readAttributes();
+            Date createDate = new Date(attr.creationTime().toMillis());
+            return createDate.getTime()/1000;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Calendar cal = Calendar.getInstance();
+        cal.set(1970, 0, 1, 0, 0, 0);
+        return cal.getTime().getTime()/1000;
+    }
+
+    public static List<FileData> getFileList(String pId,List<File> files) {
+        List fileDataList = Lists.newArrayList();
+        if (files != null) {
+            for (File file : files) {
+                FileData fileData = new FileData();
+                if (file.isDirectory()) { // 判断是文件还是文件夹
+                    fileData.setId(transDirToUrl (file.getAbsolutePath ()));
+                    fileData.setType("folder");
+                    fileData.setOpen(true);
+                    fileData.setPId (pId);
+                    fileData.setDate(getCreateTime(file.getAbsolutePath()));
+                    fileData.setValue(file.getName());
+                    file.listFiles();
+                    fileData.setData(getFileList(file.getName(), 	Lists.newArrayList(file.listFiles())));
+                } else  { // 判断文件
+                    fileData.setId(transDirToUrl (file.getAbsolutePath()));
+                    fileData.setType(getFileType(file.getName()));
+                    fileData.setPId (pId);
+                    fileData.setSize(String.valueOf(file.length()));
+                    fileData.setDate(getCreateTime(file.getAbsolutePath()));
+                    fileData.setValue(file.getName());
+                }
+                fileDataList.add(fileData);
+            }
+
+        }
+        return fileDataList;
+    }
+
+    /**
+     * 网络地址转为绝对地址
+     * @return
+     */
+    public static  String getFileDir(String fileUrl){
+        return  (JeePlusProperties.newInstance().getUserfilesBaseDir() + fileUrl).replace("\\","/");
+    }
+
+    /**
+     * 绝对地址转换为网络地址
+     * @return
+     */
+    public static String transDirToUrl(String dir){
+        return   dir.substring( JeePlusProperties.newInstance().getUserfilesBaseDir().length());
+    }
+
+
+    /**
+     * 共享文档物理存储地址
+     * @return
+     */
+    public static String getShareBaseDir(){
+        String dir =  JeePlusProperties.newInstance().getUserfilesBaseDir() + JeePlusProperties.USERFILES_BASE_URL  + "共享文档/";
+        FileUtils.createDirectory(dir);
+        return dir;
+    }
+    /**
+     * 共享文档网络访问地址
+     * @return
+     */
+    public static String getShareBaseUrl(){
+        return  JeePlusProperties.USERFILES_BASE_URL +  "/共享文档/";
+    }
+
+    /**
+     * 我的文档物理存储地址
+     * @return
+     */
+    public static String getMyDocDir(){
+        String id = UserUtils.getCurrentUserDTO ().getId();
+        String dir = JeePlusProperties.newInstance().getUserfilesBaseDir() + JeePlusProperties.USERFILES_BASE_URL + id + "/我的文档/";
+        FileUtils.createDirectory(dir);
+        return dir;
+    }
+    /**
+     * 我的文档网络访问地址
+     * @return
+     */
+    public static String getMyDocUrl(){
+        String id = UserUtils.getCurrentUserDTO ().getId();
+        return  JeePlusProperties.USERFILES_BASE_URL + id + "/我的文档/";
+    }
+
+    /**
+     * 程序附件物理存储地址
+     * @return
+     */
+    public static String getAttachmentDir(){
+        String id = UserUtils.getCurrentUserDTO ().getId();
+        String dir = JeePlusProperties.newInstance().getUserfilesBaseDir() + JeePlusProperties.USERFILES_BASE_URL + id + "/程序附件/";
+        FileUtils.createDirectory(dir);
+        return dir;
+    }
+
+    /**
+     * 程序附件网络访问地址
+     * @return
+     */
+    public static String getAttachmentUrl(){
+
+        String id = UserUtils.getCurrentUserDTO ().getId();
+        return  JeePlusProperties.USERFILES_BASE_URL + id + "/程序附件/";
+    }
+
+
+    public static String getFileSize(String fileDir){
+        File file = new File(fileDir);
+        long size = file.length()*100;
+        String label;
+        if (size == 0F){
+            label = "0";
+        }else if(size < 1024*100){
+            label = String.valueOf(size/100)+"b";
+        }else if(size <1024*1024*100){
+            label = String.valueOf(size/1024/100F)+"KB";
+        }else{
+            label = String.valueOf(size/(1024*1024)/100F)+"M";
+        }
+        return label;
+    }
+
+}

+ 489 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/FileUtils.java

@@ -0,0 +1,489 @@
+/**
+ * Copyright &copy; 2021-2026 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.sys.utils;
+
+import cn.hutool.core.util.StrUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.*;
+
+/**
+ * 文件操作工具类
+ * 实现文件的创建、删除、复制、压缩、解压以及目录的创建、删除、复制、压缩解压等功能
+ * @author jeeplus
+ * @version 2021-06-21
+ */
+public class FileUtils extends org.apache.commons.io.FileUtils {
+
+	private static Logger log = LoggerFactory.getLogger(FileUtils.class);
+
+
+
+	/**
+	 * 判断是否是文件
+	 * @param source
+	 */
+	public static boolean isFile(String source) {
+		return  new File(source).isFile();
+	}
+
+	/**
+	 * 判断是否是目录
+	 * @param source
+	 */
+	public static boolean isFolder(String source) {
+		return  new File(source).isDirectory();
+	}
+
+	/**
+	 * 复制单个文件,如果目标文件存在,则不覆盖
+	 * @param srcFileName 待复制的文件名
+	 * @param descFileName 目标文件名
+	 * @return 如果复制成功,则返回true,否则返回false
+	 */
+	public static boolean copyFile(String srcFileName, String descFileName) {
+		return FileUtils.copyFileCover(srcFileName, descFileName, false);
+	}
+
+	/**
+	 * 复制单个文件
+	 * @param srcFileName 待复制的文件名
+	 * @param descFileName 目标文件名
+	 * @param coverlay 如果目标文件已存在,是否覆盖
+	 * @return 如果复制成功,则返回true,否则返回false
+	 */
+	public static boolean copyFileCover(String srcFileName,
+			String descFileName, boolean coverlay) {
+		File srcFile = new File(srcFileName);
+		// 判断源文件是否存在
+		if (!srcFile.exists()) {
+			log.debug("复制文件失败,源文件 " + srcFileName + " 不存在!");
+			return false;
+		}
+		// 判断源文件是否是合法的文件
+		else if (!srcFile.isFile()) {
+			log.debug("复制文件失败," + srcFileName + " 不是一个文件!");
+			return false;
+		}
+		File descFile = new File(descFileName);
+		// 判断目标文件是否存在
+		if (descFile.exists()) {
+			// 如果目标文件存在,并且允许覆盖
+			if (coverlay) {
+				log.debug("目标文件已存在,准备删除!");
+				if (!FileUtils.delFile(descFileName)) {
+					log.debug("删除目标文件 " + descFileName + " 失败!");
+					return false;
+				}
+			} else {
+				log.debug("复制文件失败,目标文件 " + descFileName + " 已存在!");
+				return false;
+			}
+		} else {
+			if (!descFile.getParentFile().exists()) {
+				// 如果目标文件所在的目录不存在,则创建目录
+				log.debug("目标文件所在的目录不存在,创建目录!");
+				// 创建目标文件所在的目录
+				if (!descFile.getParentFile().mkdirs()) {
+					log.debug("创建目标文件所在的目录失败!");
+					return false;
+				}
+			}
+		}
+
+		// 准备复制文件
+		// 读取的位数
+		int readByte = 0;
+		InputStream ins = null;
+		OutputStream outs = null;
+		try {
+			// 打开源文件
+			ins = new FileInputStream(srcFile);
+			// 打开目标文件的输出流
+			outs = new FileOutputStream(descFile);
+			byte[] buf = new byte[1024];
+			// 一次读取1024个字节,当readByte为-1时表示文件已经读取完毕
+			while ((readByte = ins.read(buf)) != -1) {
+				// 将读取的字节流写入到输出流
+				outs.write(buf, 0, readByte);
+			}
+			log.debug("复制单个文件 " + srcFileName + " 到" + descFileName
+					+ "成功!");
+			return true;
+		} catch (Exception e) {
+			log.debug("复制文件失败:" + e.getMessage());
+			return false;
+		} finally {
+			// 关闭输入输出流,首先关闭输出流,然后再关闭输入流
+			if (outs != null) {
+				try {
+					outs.close();
+				} catch (IOException oute) {
+					oute.printStackTrace();
+				}
+			}
+			if (ins != null) {
+				try {
+					ins.close();
+				} catch (IOException ine) {
+					ine.printStackTrace();
+				}
+			}
+		}
+	}
+
+	/**
+	 * 复制整个目录的内容,如果目标目录存在,则不覆盖
+	 * @param srcDirName 源目录名
+	 * @param descDirName 目标目录名
+	 * @return 如果复制成功返回true,否则返回false
+	 */
+	public static boolean copyDirectory(String srcDirName, String descDirName) {
+		return FileUtils.copyDirectoryCover(srcDirName, descDirName,
+				false);
+	}
+
+	/**
+	 * 复制整个目录的内容
+	 * @param srcDirName 源目录名
+	 * @param descDirName 目标目录名
+	 * @param coverlay 如果目标目录存在,是否覆盖
+	 * @return 如果复制成功返回true,否则返回false
+	 */
+	public static boolean copyDirectoryCover(String srcDirName,
+			String descDirName, boolean coverlay) {
+		File srcDir = new File(srcDirName);
+		// 判断源目录是否存在
+		if (!srcDir.exists()) {
+			log.debug("复制目录失败,源目录 " + srcDirName + " 不存在!");
+			return false;
+		}
+		// 判断源目录是否是目录
+		else if (!srcDir.isDirectory()) {
+			log.debug("复制目录失败," + srcDirName + " 不是一个目录!");
+			return false;
+		}
+		// 如果目标文件夹名不以文件分隔符结尾,自动添加文件分隔符
+		String descDirNames = descDirName;
+		if (!descDirNames.endsWith(File.separator)) {
+			descDirNames = descDirNames + File.separator;
+		}
+		File descDir = new File(descDirNames);
+		// 如果目标文件夹存在
+		if (descDir.exists()) {
+			if (coverlay) {
+				// 允许覆盖目标目录
+				log.debug("目标目录已存在,准备删除!");
+				if (!FileUtils.delFile(descDirNames)) {
+					log.debug("删除目录 " + descDirNames + " 失败!");
+					return false;
+				}
+			} else {
+				log.debug("目标目录复制失败,目标目录 " + descDirNames + " 已存在!");
+				return false;
+			}
+		} else {
+			// 创建目标目录
+			log.debug("目标目录不存在,准备创建!");
+			if (!descDir.mkdirs()) {
+				log.debug("创建目标目录失败!");
+				return false;
+			}
+
+		}
+
+		boolean flag = true;
+		// 列出源目录下的所有文件名和子目录名
+		File[] files = srcDir.listFiles();
+		for (int i = 0; i < files.length; i++) {
+			// 如果是一个单个文件,则直接复制
+			if (files[i].isFile()) {
+				flag = FileUtils.copyFile(files[i].getAbsolutePath(),
+						descDirName + files[i].getName());
+				// 如果拷贝文件失败,则退出循环
+				if (!flag) {
+					break;
+				}
+			}
+			// 如果是子目录,则继续复制目录
+			if (files[i].isDirectory()) {
+				flag = FileUtils.copyDirectory(files[i]
+						.getAbsolutePath(), descDirName + files[i].getName());
+				// 如果拷贝目录失败,则退出循环
+				if (!flag) {
+					break;
+				}
+			}
+		}
+
+		if (!flag) {
+			log.debug("复制目录 " + srcDirName + " 到 " + descDirName + " 失败!");
+			return false;
+		}
+		log.debug("复制目录 " + srcDirName + " 到 " + descDirName + " 成功!");
+		return true;
+
+	}
+
+	/**
+	 *
+	 * 删除文件,可以删除单个文件或文件夹
+	 *
+	 * @param fileName 被删除的文件名
+	 * @return 如果删除成功,则返回true,否是返回false
+	 */
+	public static boolean delFile(String fileName) {
+ 		File file = new File(fileName);
+		if (!file.exists()) {
+			log.debug(fileName + " 文件不存在!");
+			return true;
+		} else {
+			if (file.isFile()) {
+				return FileUtils.deleteFile(fileName);
+			} else {
+				return FileUtils.deleteDirectory(fileName);
+			}
+		}
+	}
+
+	/**
+	 *
+	 * 删除单个文件
+	 *
+	 * @param fileName 被删除的文件名
+	 * @return 如果删除成功,则返回true,否则返回false
+	 */
+	public static boolean deleteFile(String fileName) {
+		File file = new File(fileName);
+		if (file.exists() && file.isFile()) {
+			if (file.delete()) {
+				log.debug("删除文件 " + fileName + " 成功!");
+				return true;
+			} else {
+				log.debug("删除文件 " + fileName + " 失败!");
+				return false;
+			}
+		} else {
+			log.debug(fileName + " 文件不存在!");
+			return true;
+		}
+	}
+
+	/**
+	 *
+	 * 删除目录及目录下的文件
+	 *
+	 * @param dirName 被删除的目录所在的文件路径
+	 * @return 如果目录删除成功,则返回true,否则返回false
+	 */
+	public static boolean deleteDirectory(String dirName) {
+		String dirNames = dirName;
+		if (!dirNames.endsWith(File.separator)) {
+			dirNames = dirNames + File.separator;
+		}
+		File dirFile = new File(dirNames);
+		if (!dirFile.exists() || !dirFile.isDirectory()) {
+			log.debug(dirNames + " 目录不存在!");
+			return true;
+		}
+		boolean flag = true;
+		// 列出全部文件及子目录
+		File[] files = dirFile.listFiles();
+		for (int i = 0; i < files.length; i++) {
+			// 删除子文件
+			if (files[i].isFile()) {
+				flag = FileUtils.deleteFile(files[i].getAbsolutePath());
+				// 如果删除文件失败,则退出循环
+				if (!flag) {
+					break;
+				}
+			}
+			// 删除子目录
+			else if (files[i].isDirectory()) {
+				flag = FileUtils.deleteDirectory(files[i]
+						.getAbsolutePath());
+				// 如果删除子目录失败,则退出循环
+				if (!flag) {
+					break;
+				}
+			}
+		}
+
+		if (!flag) {
+			log.debug("删除目录失败!");
+			return false;
+		}
+		// 删除当前目录
+		if (dirFile.delete()) {
+			log.debug("删除目录 " + dirName + " 成功!");
+			return true;
+		} else {
+			log.debug("删除目录 " + dirName + " 失败!");
+			return false;
+		}
+
+	}
+
+	/**
+	 * 创建单个文件
+	 * @param descFileName 文件名,包含路径
+	 * @return 如果创建成功,则返回true,否则返回false
+	 */
+	public static boolean createFile(String descFileName) {
+		File file = new File(descFileName);
+		if (file.exists()) {
+			log.debug("文件 " + descFileName + " 已存在!");
+			return false;
+		}
+		if (descFileName.endsWith(File.separator)) {
+			log.debug(descFileName + " 为目录,不能创建目录!");
+			return false;
+		}
+		if (!file.getParentFile().exists()) {
+			// 如果文件所在的目录不存在,则创建目录
+			if (!file.getParentFile().mkdirs()) {
+				log.debug("创建文件所在的目录失败!");
+				return false;
+			}
+		}
+
+		// 创建文件
+		try {
+			if (file.createNewFile()) {
+				log.debug(descFileName + " 文件创建成功!");
+				return true;
+			} else {
+				log.debug(descFileName + " 文件创建失败!");
+				return false;
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.debug(descFileName + " 文件创建失败!");
+			return false;
+		}
+
+	}
+
+	/**
+	 * 创建目录
+	 * @param descDirName 目录名,包含路径
+	 * @return 如果创建成功,则返回true,否则返回false
+	 */
+	public static boolean createDirectory(String descDirName) {
+		String descDirNames = descDirName;
+		if (!descDirNames.endsWith(File.separator)) {
+			descDirNames = descDirNames + File.separator;
+		}
+		File descDir = new File(descDirNames);
+		if (descDir.exists()) {
+			log.debug("目录 " + descDirNames + " 已存在!");
+			return false;
+		}
+		// 创建目录
+		if (descDir.mkdirs()) {
+			log.debug("目录 " + descDirNames + " 创建成功!");
+			return true;
+		} else {
+			log.debug("目录 " + descDirNames + " 创建失败!");
+			return false;
+		}
+
+	}
+
+
+	/**
+	 * 获取可以创建的文件名(如果有同名文件存在,参照Windows系统重命名为xxx(2).xxx)
+	 * @param name
+	 * @param index
+	 * @return
+	 */
+	public static File getAvailableFile(String name, int index){
+		File newFile = null;
+
+        String suffix = StrUtil.subAfter (name, ".", true);
+        String filePath = StrUtil.subBefore (name, ".", true);
+		if(index == 0 ){
+			newFile = new File(filePath+"."+suffix);
+		}else{
+			newFile = new File(filePath+"("+index+")"+"."+suffix);
+		}
+		if(newFile.exists()){
+			return  getAvailableFile(name,index+1);
+		}else{
+			return  newFile;
+		}
+	};
+
+	/**
+	 * 获取可以创建的目录名(如果有同名目录存在,参照Windows系统重命名为xxx(2))
+	 * @param name
+	 * @param index
+	 * @return
+	 */
+	public static File getAvailableFolder(String name, int index){
+		File newFolder = null;
+		if(index == 0 ){
+			newFolder = new File(name);
+		}else{
+			newFolder = new File(name+"("+index+")");
+		}
+		if(newFolder.exists()){
+			return  getAvailableFolder(name,index+1);
+		}else{
+			return  newFolder;
+		}
+	};
+
+	/**
+	 * 写入文件
+	 */
+	public static void writeToFile(String fileName, String content, boolean append) {
+		try {
+			FileUtils.write(new File(fileName), content, "utf-8", append);
+			log.debug("文件 " + fileName + " 写入成功!");
+		} catch (IOException e) {
+			log.debug("文件 " + fileName + " 写入失败! " + e.getMessage());
+		}
+	}
+
+	/**
+	 * 写入文件
+	 */
+	public static void writeToFile(String fileName, String content, String encoding, boolean append) {
+		try {
+			FileUtils.write(new File(fileName), content, encoding, append);
+			log.debug("文件 " + fileName + " 写入成功!");
+		} catch (IOException e) {
+			log.debug("文件 " + fileName + " 写入失败! " + e.getMessage());
+		}
+	}
+
+
+	/**
+	 * 获取待压缩文件在ZIP文件中entry的名字,即相对于跟目录的相对路径名
+	 * @param dirPath 目录名
+	 * @param file entry文件名
+	 * @return
+	 */
+	private static String getEntryName(String dirPath, File file) {
+		String dirPaths = dirPath;
+		if (!dirPaths.endsWith(File.separator)) {
+			dirPaths = dirPaths + File.separator;
+		}
+		String filePath = file.getAbsolutePath();
+		// 对于目录,必须在entry名字后面加上"/",表示它将以目录项存储
+		if (file.isDirectory()) {
+			filePath += "/";
+		}
+		int index = filePath.indexOf(dirPaths);
+
+		return filePath.substring(index + dirPaths.length());
+	}
+
+
+
+
+
+}

+ 514 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/Global.java

@@ -0,0 +1,514 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.sys.utils;
+
+import com.google.common.collect.Maps;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
+import org.springframework.core.io.DefaultResourceLoader;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * 全局配置类
+ * @author jeeplus
+ * @version 2014-06-25
+ */
+public class Global {
+
+	/**
+	 * 当前对象实例
+	 */
+	private static Global global = new Global();
+
+	/**
+	 * 保存全局属性值
+	 */
+	private static Map<String, String> map = Maps.newHashMap();
+
+
+	/**
+	 * 显示/隐藏
+	 */
+	public static final String SHOW = "1";
+	public static final String HIDE = "0";
+
+	/**
+	 * 是/否
+	 */
+	public static final String YES = "1";
+	public static final String NO = "0";
+
+	/**
+	 * 对/错
+	 */
+	public static final String TRUE = "true";
+	public static final String FALSE = "false";
+
+	/**
+	 * 上传文件基础虚拟路径
+	 */
+	public static final String USERFILES_BASE_URL = "/userfiles/";
+
+	/**
+	 * 获取当前对象实例
+	 */
+	public static Global getInstance() {
+		return global;
+	}
+
+	/**
+	 * 获取配置
+	 * @see {fns:getConfig('adminPath')}
+	 */
+	public static String getConfig(String key) {
+		String value = null;
+		Properties prop = new Properties();
+		Properties applicationProp = new Properties();
+		try {
+			ClassLoader classLoader = DaoAuthenticationProvider.class.getClassLoader();// 读取属性文件xxxxx.properties
+			InputStream applicationIn = classLoader.getResourceAsStream("application.yml");
+			InputStream productionIn = classLoader.getResourceAsStream("application-production.yml");
+			InputStream developmentIn = classLoader.getResourceAsStream("application-development.yml");
+			applicationProp.load(applicationIn);
+			Iterator applicationIt = applicationProp.stringPropertyNames().iterator();
+
+			while (applicationIt.hasNext()) {
+				if (applicationIt.next().equals("active")) {
+					String applicationValue = applicationProp.getProperty("active");
+					switch (applicationValue){
+						case "development":
+							prop.load(developmentIn); /// 加载属性列表
+							Iterator it = prop.stringPropertyNames().iterator();
+							while (it.hasNext()) {
+								if (it.next().equals(key)) {
+									value = prop.getProperty(key);
+									break;
+								}
+							}
+							developmentIn.close();
+							break;
+						case "production":
+							prop.load(productionIn); /// 加载属性列表
+							it = prop.stringPropertyNames().iterator();
+							while (it.hasNext()) {
+								if (it.next().equals(key)) {
+									value = prop.getProperty(key);
+									break;
+								}
+							}
+							productionIn.close();
+							break;
+					}
+				}
+			}
+
+		} catch (Exception e) {
+
+		}
+		return value;
+	}
+
+	/**
+	 * 获取管理端根路径
+	 */
+	public static String getAdminPath() {
+		return getConfig("adminPath");
+	}
+	/**
+	 */
+	public static String getAliyunUrl() {
+		return getConfig("aliyunDownloadUrl");
+	}
+	/**
+	 */
+	public static String getAliDownloadUrl() {
+		return getConfig("aliyunUrl");
+	}
+	/**
+	 */
+	public static String getEndpoint() {
+		return getConfig("endpoint");
+	}
+	/**
+	 */
+	public static String getAccessKeyId() {
+		return getConfig("accessKeyId");
+	}
+	/**
+	 */
+	public static String getAccessKeySecret() {
+		return getConfig("accessKeySecret");
+	}
+	/**
+	 */
+	public static String getBucketName() {
+		return getConfig("bucketName");
+	}
+	/**
+	 */
+	public static String getQzBucketName() {
+		return getConfig("qzBucketName");
+	}
+	/**
+	 */
+	public static String getAvatarDir() {
+		return getConfig("avatarDir");
+	}
+	/**
+	 */
+	public static String getNotifyDir() {
+		return getConfig("notifyDir");
+	}
+	/**
+	 */
+	public static String getReportDir() {
+		return getConfig("reportDir");
+	}
+	/**
+	 */
+	public static String getRqcode() {
+		return getConfig("rqcode");
+	}
+	/**
+	 */
+	public static String getGoout() {
+		return getConfig("goout");
+	}
+	/**
+	 */
+	public static String getLeave() {
+		return getConfig("leave");
+	}
+	/**
+	 */
+	public static String getOvertimeform() {
+		return getConfig("overtimeform");
+	}
+	/**
+	 */
+	public static String getSealform() {
+		return getConfig("sealform");
+	}
+	/**
+	 *
+	 */
+	public static String getWorkReimbur() {return getConfig("workReimbur");}
+	/**
+	 */
+	public static String getEvection() {
+		return getConfig("evection");
+	}
+	/**
+	 */
+	public static String getOaBuy() {
+		return getConfig("oaBuy");
+	}
+	/**
+	 */
+	public static String getOaAll() {
+		return getConfig("oaAll");
+	}
+	/**
+	 */
+	public static String getIm() {
+		return getConfig("im");
+	}/**
+	 */
+	public static String getWorkContractInfo() {
+		return getConfig("workContractInfo");
+	}
+	/**
+	 */
+	public static String getNotifyData() {
+		return getConfig("notifyData");
+	}
+    /**
+     */
+    public static String getAppData() {
+        return getConfig("appData");
+    }
+	/**
+	 */
+	public static String getLogo() {
+		return getConfig("logo");
+	}
+    /**
+     */
+	public static String getPhoto() {
+		return getConfig("photo");
+	}
+	/**
+	 *
+	 */
+	public static String getUserEvaluation(){return getConfig("userEvaluation");}
+	/**
+	 */
+	public static String getWorkBidingDocument() {return getConfig("workBidingDocument");}
+	/**
+	 */
+	public static String getWorkEngineeringProject() {return getConfig("workEngineeringProject");}
+
+	/**
+	 */
+	public static String getWorkFullExecute() {return getConfig("workFullExecute");}
+	/**
+	 */
+	public static String getWorkFullMeetingminutes() {return getConfig("workFullMeetingminutes");}
+	/**
+	 */
+	public static String getWorkFullDesignchange(){return getConfig("workFullDesignchange");}
+	/**
+	 */
+	public static String getWorkFullConstructsheet(){return getConfig("workFullConstructsheet");}
+	/**
+	 */
+	public static String getWorkFullProprietorsheet(){return getConfig("workFullProprietorsheet");}
+	/**
+	 */
+	public static String getWorkFullSupervisorsheet(){return getConfig("workFullSupervisorsheet");}
+	/**
+	 */
+	public static String getWorkProjectReport() {return getConfig("workProjectReport");}
+	/**
+	 */
+	public static String getWorkProjectBasis() {return getConfig("workProjectBasis");}
+	/**
+	 */
+	public static String getWorkProjectRemote() {return getConfig("workProjectRemote");}
+	/**
+	 */
+	public static String getWorkProjectSummary() {return getConfig("workProjectSummary");}
+	/**
+	 */
+	public static String getWorkProjectOther() {return getConfig("workProjectOther");}
+	/**
+	 */
+	public static String getWorkVisa() {return getConfig("workVisa");}
+	/**
+	 */
+	public static String getOfficehonor() {return getConfig("Officehonor");}
+	/**
+	 *
+	 */
+	public static String getJobResume() {return getConfig("jobResume");}
+	/**
+	 *
+	 */
+	public static String getSatisfaction() {return getConfig("satisfaction");}
+	/**
+	 *
+	 */
+	public static String getCertificate() {return getConfig("certificate");}
+	/**
+	 *
+	 */
+	public static String getJudgeAttachment() {return getConfig("judgeAttachment");}
+	/**
+	 * 获取前端根路径
+	 */
+	public static String getFrontPath() {
+		return getConfig("frontPath");
+	}
+
+	/**
+	 * 获取URL后缀
+	 */
+	public static String getUrlSuffix() {
+		return getConfig("urlSuffix");
+	}
+
+	/**
+	 * 获取电子签章文件路径
+	 */
+	public static String getISignature() {
+		return getConfig("iSignature");
+	}
+
+	/**
+	 */
+	public static String getOSSUrl() {
+		return getConfig("oSSUrl");
+	}
+	public static String getContractNumPath() {
+		return getConfig("contract_num_path");
+	}
+	/**
+	 * 是否是演示模式,演示模式下不能修改用户、岗位、密码、菜单、授权
+	 */
+	public static Boolean isDemoMode() {
+		String dm = getConfig("demoMode");
+		return "true".equals(dm) || "1".equals(dm);
+	}
+
+	/**
+	 * 在修改系统用户和岗位时是否同步到Activiti
+	 */
+	public static Boolean isSynActivitiIndetity() {
+		String dm = getConfig("activiti.isSynActivitiIndetity");
+		return "true".equals(dm) || "1".equals(dm);
+	}
+
+	/**
+	 * 页面获取常量
+	 * @see {fns:getConst('YES')}
+	 */
+	public static Object getConst(String field) {
+		try {
+			return Global.class.getField(field).get(null);
+		} catch (Exception e) {
+			// 异常代表无配置,这里什么也不做
+		}
+		return null;
+	}
+
+    /**
+     * 获取工程路径
+     * @return
+     */
+    public static String getProjectPath(){
+    	// 如果配置了工程路径,则直接返回,否则自动获取。
+		String projectPath = Global.getConfig("projectPath");
+		if (StringUtils.isNotBlank(projectPath)){
+			return projectPath;
+		}
+		try {
+			File file = new DefaultResourceLoader().getResource("").getFile();
+			if (file != null){
+				while(true){
+					File f = new File(file.getPath() + File.separator + "src" + File.separator + "main");
+					if (f == null || f.exists()){
+						break;
+					}
+					if (file.getParentFile() != null){
+						file = file.getParentFile();
+					}else{
+						break;
+					}
+				}
+				projectPath = file.toString();
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return projectPath;
+    }
+
+    /**
+     * 获取短信SMS信息
+     */
+    public static String getSmsUserid() {
+        return getConfig("sms_userid");
+    }
+    public static String getSmsAccount() {
+        return getConfig("sms_account");
+    }
+    public static String getSmsPassword() {
+        return getConfig("sms_password");
+    }
+    public static String getSmsMobile() {
+        return getConfig("sms_mobile");
+    }
+    public static String getSmsContent() {
+        return getConfig("sms_content");
+    }
+    public static String getSmsSendTime() {
+        return getConfig("sms_sendTime");
+    }
+    public static String getSmsAction() {
+        return getConfig("sms_action");
+    }
+    public static String getSmsCheckcontent() {
+        return getConfig("sms_checkcontent");
+    }
+
+	/**
+	 * 获取数据库连接信息
+	 */
+	public static String getJdbcUserName() {
+		return getConfig("jdbc.username");
+	}
+	public static String getJdbcPassword() {
+		return getConfig("jdbc.password");
+	}
+	public static String getJdbcUrl() {
+		return getConfig("jdbc.url");
+	}
+	public static String getJdbcDriver() {
+		return getConfig("jdbc.driver");
+	}
+
+	/**
+	 * 获取容联云账户信息
+	 */
+	public static String getRongUserid() {
+		return getConfig("rong_userid");
+	}
+	public static String getRongToken() {
+		return getConfig("rong_token");
+	}
+	//应用id
+	public static String getAppId() {
+		return getConfig("app_id");
+	}
+	//模板id
+	public static String getTemplateId() {
+		return getConfig("template_id");
+	}
+	//短信发送方式(1:旧的 2:容联云通讯)
+	public static String getCodeType() {
+		return getConfig("code_type");
+	}
+
+    public static String getOpenOfficeAddr() {
+        return getConfig("open_office_addr");
+    }
+
+    public static int getOpenOfficePort() {
+        String openOfficePort = getConfig("open_office_port");
+        return StringUtils.isBlank(openOfficePort)?8100:Integer.valueOf(openOfficePort);
+    }
+    public static String getOpenfireServer() {
+        String openOfficePort = getConfig("openfire.server");
+        return StringUtils.isBlank(openOfficePort)?"oa-pre.ssruihua.com":openOfficePort;
+    }
+    public static String getSysNotify() {
+        String sysNotify = getConfig("sys.notify");
+        return StringUtils.isBlank(sysNotify)?"http://cdn.gangwaninfo.com/jeeplus-resource-data/static/sys/notify.png":sysNotify;
+    }
+
+    public static String getStaffBasicFilePath() {
+        return getConfig("staff_basic_file_path");
+    }
+	public static String getDbName() {
+		return getConfig("db.name");
+	}
+	public static String getVersion() {
+		return getConfig("app_version");
+	}
+	public static String getTestVersion() {
+		return getConfig("app_version_test");
+	}
+
+    public static String getProjectTemplatePath() {
+        return getConfig("project.plan.template.path");
+    }
+
+    public static String getYyApiCode(){
+		return getConfig("yy_apicode");
+	}
+
+	public static String getYyMhUrl(){
+		return getConfig("yy_mhcxurl");
+	}
+
+	public static String getYyShUrl(){
+		return getConfig("yy_shcxurl");
+	}
+}

+ 37 - 4
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/utils/UserUtils.java

@@ -10,13 +10,12 @@ import com.google.common.collect.Lists;
 import com.jeeplus.common.SecurityUtils;
 import com.jeeplus.common.constant.CacheNames;
 import com.jeeplus.common.redis.RedisUtils;
+import com.jeeplus.sys.domain.SysParameterValue;
+import com.jeeplus.sys.mapper.OfficeMapper;
 import com.jeeplus.sys.service.DataRuleService;
 import com.jeeplus.sys.service.MenuService;
 import com.jeeplus.sys.service.UserService;
-import com.jeeplus.sys.service.dto.DataRuleDTO;
-import com.jeeplus.sys.service.dto.MenuDTO;
-import com.jeeplus.sys.service.dto.RoleDTO;
-import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.service.dto.*;
 import com.jeeplus.sys.service.mapstruct.MenuWrapper;
 
 import java.util.HashSet;
@@ -31,6 +30,7 @@ import java.util.Set;
  */
 public class UserUtils {
 
+    private static OfficeMapper officeMapper = SpringUtil.getBean(OfficeMapper.class);
 
     /**
      * 根据ID获取用户
@@ -201,5 +201,38 @@ public class UserUtils {
         return false;
     }
 
+    /**
+     * 获取系统参数
+     * parameter 参数类型
+     * branchOffice 分公司Id 分公司id为空传公司id
+     * @return
+     */
+    public static String getSysParam(String parameter) {
+        //查询当前登录人公司信息
+        UserDTO userDTO = UserUtils.getCurrentUserDTO();
+        OfficeDTO companyDTO = userDTO.getCompanyDTO();
+        //当前登录人所属公司是子公司
+        if (!"0".equals(companyDTO.getParentId()) && "1".equals(companyDTO.getType())) {
+            //查询子公司简称
+            if ("branch_shortname".equals(parameter)) {
+                SysParameterValue sysParameterValue = officeMapper.findValueByParameter(parameter, companyDTO.getId());
+                return sysParameterValue == null ? "" : sysParameterValue.getValue();
+            }
+            //查询公司简称
+            if ("company_shortname".equals(parameter)) {
+                SysParameterValue sysParameterValue = officeMapper.findValueByParameter(parameter, companyDTO.getParentId());
+                return sysParameterValue == null ? "" : sysParameterValue.getValue();
+            }
+        } else {
+            //当前登录人所属公司是总公司
+            //查询公司简称
+            if ("company_shortname".equals(parameter)) {
+                SysParameterValue sysParameterValue = officeMapper.findValueByParameter(parameter, companyDTO.getId());
+                return sysParameterValue == null ? "" : sysParameterValue.getValue();
+            }
+        }
+        return "";
+    }
+
 
 }

+ 2 - 0
jeeplus-modules/pom.xml

@@ -22,6 +22,8 @@
         <module>jeeplus-xxl-job-executor-sample</module>
         <module>jeeplus-admin-server</module>
         <module>jeeplus-test</module>
+        <module>jeeplus-assess</module>
+        <module>jeeplus-public-modules</module>
     </modules>
 
 </project>