syh пре 5 година
родитељ
комит
fb7e13a39d
38 измењених фајлова са 1988 додато и 18 уклоњено
  1. 14 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  2. 4 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouXxlEntity.java
  3. 16 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/BaseController.java
  4. 10 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/BaseEntity.java
  5. 23 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/BaseRepository.java
  6. 119 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/BaseService.java
  7. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/Page.java
  8. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/Request.java
  9. 139 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/Response.java
  10. 91 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/Context.java
  11. 33 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/CorsFilter.java
  12. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/PassUrl.java
  13. 62 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/UserHandlerAdapter.java
  14. 21 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/UserMvcAdapter.java
  15. 53 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileDTO.java
  16. 34 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileHisDTO.java
  17. 40 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileListDTO.java
  18. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileNewDTO.java
  19. 16 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileReqDTO.java
  20. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserAclBO.java
  21. 23 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserDTO.java
  22. 18 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/WatermarkBO.java
  23. 20 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/propertie/OSSProperties.java
  24. 18 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/propertie/QNProperties.java
  25. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/propertie/UploadProperties.java
  26. 22 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/propertie/WpsProperties.java
  27. 87 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/SignatureUtil.java
  28. 12 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/Token.java
  29. 45 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/WpsUtil.java
  30. 119 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileType.java
  31. 148 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileTypeJudge.java
  32. 113 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileUtil.java
  33. 28 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/ResFileDTO.java
  34. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/UploadFileLocation.java
  35. 414 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/oss/OSSUtil.java
  36. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/qn/MyPutRet.java
  37. 120 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/qn/QNUtil.java
  38. 9 0
      jeecg-boot-module-system/src/main/resources/application.yml

+ 14 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java

@@ -384,6 +384,13 @@ public class AdvertiserController {
                 }
             }
         }
+        List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
+        if (null != allocations && !allocations.isEmpty()) {
+            for (UserAllocation allocation : allocations) {
+                SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());
+                sheets.add(vo);
+            }
+        }
         result.put("data", sheets);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
@@ -412,7 +419,13 @@ public class AdvertiserController {
                 }
             }
         }
-
+        List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
+        if (null != allocations && !allocations.isEmpty()) {
+            for (UserAllocation allocation : allocations) {
+                SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());
+                sheets.add(vo);
+            }
+        }
         OutputStream outputStream = response.getOutputStream();
         String date = DateUtils.formatDate(new Date());
         HttpUtils.setResponseHeader(response, "爱上消消消日报" + date + ".xls");

+ 4 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouXxlEntity.java

@@ -30,23 +30,18 @@ public class KuaishouXxlEntity extends BaseRowModel {
     @ExcelProperty(index = 4, value = "非双出价(元)")
     private BigDecimal singleBid;
     /**
-     * 非双出价
-     */
-    @ExcelProperty(index = 5, value = "详情页消耗(元)")
-    private BigDecimal detailCost;
-    /**
      * 激活数
      */
-    @ExcelProperty(index = 6, value = "激活数")
+    @ExcelProperty(index = 5, value = "激活数")
     private int active;
     /**
      * 激活成本
      */
-    @ExcelProperty(index = 7, value = "激活成本")
+    @ExcelProperty(index = 6, value = "激活成本")
     private BigDecimal activeCost;
-    @ExcelProperty(index = 8, value = "每日计划(组)")
+    @ExcelProperty(index = 7, value = "每日计划(组)")
     private int planNum;
-    @ExcelProperty(index = 9, value = "每日素材安排")
+    @ExcelProperty(index = 8, value = "每日素材安排")
     private String mat;
 
     public String getDate() {
@@ -112,12 +107,4 @@ public class KuaishouXxlEntity extends BaseRowModel {
     public void setMat(String mat) {
         this.mat = mat;
     }
-
-    public BigDecimal getDetailCost() {
-        return detailCost;
-    }
-
-    public void setDetailCost(BigDecimal detailCost) {
-        this.detailCost = detailCost;
-    }
 }

+ 16 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/BaseController.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.wps.base;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ *
+ * @author zm
+ * @see abstract
+ */
+public abstract class BaseController {
+
+	protected Logger logger = LoggerFactory.getLogger(getClass());
+
+}

+ 10 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/BaseEntity.java

@@ -0,0 +1,10 @@
+package org.jeecg.modules.wps.base;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author zm
+ * @see abstract
+ */
+public abstract class BaseEntity implements Serializable {}

+ 23 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/BaseRepository.java

@@ -0,0 +1,23 @@
+/*
+ * www.takead.cn
+ * Copyright (c) 2012-2013 All Rights Reserved.
+ */
+package org.jeecg.modules.wps.base;
+
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.NoRepositoryBean;
+import org.springframework.data.repository.PagingAndSortingRepository;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author zm
+ * @see abstract
+ */
+@NoRepositoryBean
+public interface BaseRepository<M extends BaseEntity, ID extends Serializable>
+		extends PagingAndSortingRepository<M, ID>,JpaSpecificationExecutor<M> {
+
+
+}

+ 119 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/BaseService.java

@@ -0,0 +1,119 @@
+package org.jeecg.modules.wps.base;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import java.io.Serializable;
+import java.util.Optional;
+
+/**
+ *
+ * @author zm
+ * @see abstract
+ */
+public abstract class BaseService<M extends BaseEntity, ID extends Serializable> {
+
+	protected BaseRepository<M, ID> baseRepository;
+
+	protected abstract void setDao(BaseRepository baseRepository);
+
+	protected Logger logger = LoggerFactory.getLogger(getClass());
+
+	/**
+	 * 保存单个实体
+	 *
+	 * @param m
+	 *            实体
+	 * @return 返回保存的实体
+	 */
+	public M save(M m) {
+		return baseRepository.save(m);
+	}
+
+	/**
+	 * 更新单个实体
+	 *
+	 * @param m
+	 *            实体
+	 * @return 返回更新的实体
+	 */
+	public M update(M m) {
+		return baseRepository.save(m);
+	}
+
+	/**
+	 * 根据主键删除相应实体
+	 *
+	 * @param id
+	 *            主键
+	 */
+	public void delete(ID id) {
+		baseRepository.deleteById(id);
+	}
+
+	/**
+	 * 删除实体
+	 *
+	 * @param m
+	 *            实体
+	 */
+	public void delete(M m) {
+		baseRepository.delete(m);
+	}
+
+	/**
+	 * 按照主键查询
+	 *
+	 * @param id
+	 *            主键
+	 * @return 返回id对应的实体
+	 */
+	public M findOne(ID id) {
+		Optional<M> om = baseRepository.findById(id);
+		return om.orElse(null);
+	}
+
+	/**
+	 * 实体是否存在
+	 *
+	 * @param id
+	 *            主键
+	 * @return 存在 返回true,否则false
+	 */
+	public boolean exists(ID id) {
+		return baseRepository.existsById(id);
+	}
+
+	/**
+	 * 统计实体总数
+	 *
+	 * @return 实体总数
+	 */
+	public long count() {
+		return baseRepository.count();
+	}
+
+	/**
+	 * 分页及排序查询实体
+	 *
+	 * @param pageable
+	 *            分页及排序数据
+	 * @return
+	 */
+	public Page<M> findAll(Pageable pageable) {
+		return baseRepository.findAll(pageable);
+	}
+
+	/**
+	 * 获取全部
+	 *
+	 *            获取全部
+	 * @return
+	 */
+	public Iterable<M> findAll(){
+		return baseRepository.findAll();
+	}
+
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/Page.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.wps.base;
+
+import lombok.Data;
+
+@Data
+public class Page {
+
+	private int page = 1;
+	private int size = 5;
+
+	public Page(){}
+
+	public Page(int page, int size){
+		this.page = page;
+		this.size = size;
+	}
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/Request.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.wps.base;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class Request {
+
+    public static String getHeaderParam(HttpServletRequest request, String key) {
+        return request.getHeader(key);
+    }
+
+    public static String getQueryParam(HttpServletRequest request, String key) {
+        return request.getParameter(key);
+    }
+
+}

+ 139 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/base/Response.java

@@ -0,0 +1,139 @@
+package org.jeecg.modules.wps.base;
+
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.MultiValueMap;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @author zm
+ * @since 1.0
+ * @version 1.0 2019年7月14日
+ */
+public class Response {
+	// keys
+	private final static String MSG_KEY = "msg";
+	private final static String STATUS_KEY = "status";
+	private final static String CODE_KEY = "code";
+	private final static String DATA_KEY = "data";
+
+	// msg
+	private final static String SUCCESS_MSG = "ok";
+
+	// value
+	private final static String SUCCESS_VALUE = "success";
+
+	/**
+	 * 请求成功,并返回请求结果集
+	 *
+	 * @param data
+	 *            返回到客户端的对象
+	 * @return Spring mvc ResponseEntity
+	 */
+	public static ResponseEntity<Object> success(Map<String, Object> data, String msg) {
+		return getObjectResponseEntity(data, msg);
+	}
+
+	public static ResponseEntity<Object> success(String msg) {
+		Map<String, Object> result = new HashMap<String, Object>(){
+			{
+				put(STATUS_KEY, SUCCESS_VALUE);
+				put(MSG_KEY, msg);
+				put(CODE_KEY, HttpStatus.OK.value());
+			}
+		};
+		return getEntity(result);
+	}
+
+	public static ResponseEntity<Object> success() {
+		Map<String, Object> result = new HashMap<String, Object>(){
+			{
+				put(STATUS_KEY, SUCCESS_VALUE);
+				put(MSG_KEY, SUCCESS_MSG);
+				put(CODE_KEY, HttpStatus.OK.value());
+			}
+		};
+		return getEntity(result);
+	}
+
+	/**
+	 * 请求成功,并返回请求结果集
+	 *
+	 * @param data
+	 *            返回到客户端的对象
+	 * @return Spring mvc ResponseEntity
+	 */
+	public static ResponseEntity<Object> success(Map<String, Object> data) {
+		return getObjectResponseEntity(data, SUCCESS_MSG);
+	}
+
+	public static ResponseEntity<Object> success(Object data) {
+		Map<String, Object> result = new HashMap<String, Object>(){
+			{
+				put(STATUS_KEY, SUCCESS_VALUE);
+				put(MSG_KEY, SUCCESS_MSG);
+				put(CODE_KEY, HttpStatus.OK.value());
+				put(DATA_KEY,data);
+			}
+		};
+		return getEntity(result);
+	}
+
+	public static ResponseEntity<Object> success(boolean data, String msg) {
+		Map<String, Object> result = new HashMap<String, Object>(){
+			{
+				put(STATUS_KEY, SUCCESS_VALUE);
+				put(MSG_KEY, msg);
+				put(CODE_KEY, HttpStatus.OK.value());
+				put(DATA_KEY,data);
+			}
+		};
+		return getEntity(result);
+	}
+
+	public static ResponseEntity<Object> bad(String msg) {
+		Map<String, Object> result = new HashMap<String, Object>(){
+			{
+				put(STATUS_KEY, SUCCESS_VALUE);
+				put(MSG_KEY, msg);
+				put(CODE_KEY, HttpStatus.BAD_REQUEST.value());
+			}
+		};
+		return getEntity(result);
+	}
+
+	private static ResponseEntity<Object> getObjectResponseEntity(Map<String, Object> data, String msg) {
+		Map<String, Object> result = new HashMap<String, Object>(){
+			{
+				put(STATUS_KEY, SUCCESS_VALUE);
+				put(MSG_KEY, msg);
+				put(CODE_KEY, HttpStatus.OK.value());
+				for (Entry<String, Object> entry : data.entrySet()) {
+					put(entry.getKey(),entry.getValue());
+				}
+			}
+		};
+		return getEntity(result);
+	}
+
+	private static ResponseEntity<Object> getEntity(Object body) {
+		List<String> contentType = new ArrayList<String>(){
+			{
+				add("application/json;charset=utf-8");
+			}
+		};
+		MultiValueMap<String, String> headers = new HttpHeaders(){
+			{
+				put("Content-Type", contentType);
+			}
+		};
+		return new ResponseEntity<>(body, headers, HttpStatus.OK);
+	}
+
+}

+ 91 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/Context.java

@@ -0,0 +1,91 @@
+package org.jeecg.modules.wps.config;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Context {
+
+    // wps bi传递的参数,统一放在上下文中,方便使用
+    final static String TOKEN_KEY = "x-wps-weboffice-token";
+    final static String FILE_ID_KEY = "x-weboffice-file-id";
+    final static String USER_AGENT = "User-Agent";
+
+    final static String APP_ID = "_w_appid";
+    final static String SIGNATURE = "_w_signature";
+
+    private static final ThreadLocal<Map<String, String>> securityMap = new ThreadLocal<>();
+
+    private Context() {}
+
+    private static void init() {
+        if (securityMap.get() == null) {
+            Map<String, String> map = new HashMap<>();
+            securityMap.set(map);
+        } else {
+            securityMap.get().clear();
+        }
+    }
+
+    static void setToken(String tokenKey) {
+        init();
+        securityMap.get().put(TOKEN_KEY, tokenKey);
+    }
+
+    public static String getToken() {
+        if (securityMap.get() == null){
+            return null;
+        }
+        else{
+            return securityMap.get().get(TOKEN_KEY);
+        }
+    }
+
+    static void setFileId(String fileId) {
+        securityMap.get().put(FILE_ID_KEY, fileId);
+    }
+
+    public static String getFileId() {
+        if (securityMap.get() == null){
+            return null;
+        } else{
+            return securityMap.get().get(FILE_ID_KEY);
+        }
+    }
+
+    static void setAgent(String agent) {
+        securityMap.get().put(USER_AGENT, agent);
+    }
+
+    public static String getAgent() {
+        if (securityMap.get() == null){
+            return null;
+        } else{
+            return securityMap.get().get(USER_AGENT);
+        }
+    }
+
+    static void setAppId(String appId) {
+        securityMap.get().put(APP_ID, appId);
+    }
+
+    public static String getAppId() {
+        if (securityMap.get() == null){
+            return null;
+        } else{
+            return securityMap.get().get(APP_ID);
+        }
+    }
+
+    static void setSignature(String signature) {
+        securityMap.get().put(SIGNATURE, signature);
+    }
+
+    public static String getSignature() {
+        if (securityMap.get() == null){
+            return null;
+        } else {
+            return securityMap.get().get(SIGNATURE);
+        }
+    }
+
+}

+ 33 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/CorsFilter.java

@@ -0,0 +1,33 @@
+package org.jeecg.modules.wps.config;
+
+import org.springframework.stereotype.Component;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ *  跨域
+ * @author zm
+ * @version  1.0.0
+ * @since 2019年10月12日
+ */
+@Component
+public class CorsFilter implements Filter {
+
+    @Override
+    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
+        HttpServletResponse response = (HttpServletResponse) res;
+        response.setHeader("Access-Control-Allow-Origin", "*");
+        response.setHeader("Access-Control-Allow-Methods", "POST,PUT,GET");
+        response.setHeader("Access-Control-Max-Age", "3600");
+        response.setHeader("Access-Control-Allow-Headers", "*");
+        chain.doFilter(req, res);
+    }
+
+    @Override
+    public void init(FilterConfig filterConfig) {}
+
+    @Override
+    public void destroy() {}
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/PassUrl.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.wps.config;
+
+public enum PassUrl {
+
+    v1_3rd_user,v1_3rd_file,v1_api_file;
+
+    public static boolean checkCode(String code){
+        for (PassUrl mode : PassUrl.values()){
+            if (code.contains(mode.toString())){
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+}

+ 62 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/UserHandlerAdapter.java

@@ -0,0 +1,62 @@
+package org.jeecg.modules.wps.config;
+
+import org.jeecg.modules.wps.base.Request;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 拦截器
+ */
+
+@Component
+public class UserHandlerAdapter extends HandlerInterceptorAdapter {
+
+    private final Logger logger = LoggerFactory.getLogger(UserHandlerAdapter.class);
+
+    @Override
+    public boolean preHandle(HttpServletRequest request,
+                             HttpServletResponse response, Object handler){
+
+        String token = Request.getHeaderParam(request, Context.TOKEN_KEY);
+        String fileId = Request.getHeaderParam(request,Context.FILE_ID_KEY);
+        String agent = Request.getHeaderParam(request,Context.USER_AGENT);
+
+        String appId = Request.getQueryParam(request,Context.APP_ID);
+        String signature = Request.getQueryParam(request,Context.SIGNATURE);
+
+        logger.info("_w_agent:{}",agent);
+
+        String uri = request.getRequestURI();
+        logger.info("request whole uri:{}", uri);
+
+        Context.setToken(token);
+        Context.setFileId(fileId);
+        Context.setAgent(agent);
+        Context.setAppId(appId);
+        Context.setSignature(signature);
+
+        // 当是用户自定义接口,直接通过(有点废话,举个例子而已)
+        if (checkUri(request,response)){
+            return true;
+        }else {
+            response.setStatus(HttpStatus.BAD_REQUEST.value());
+            return false;
+        }
+
+        // 如果是三方回调接口,则需校验
+        // 这里可以增加 处理token的校验,如果开启强制token,通过传递的signature以及相应的参数,再次生成该token数值,然后进行对比即可
+//        return true;
+    }
+
+    private boolean checkUri(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse){
+        String uri = httpServletRequest.getRequestURI();
+        return PassUrl.checkCode(uri.replace("/", "_"));
+    }
+
+}

+ 21 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/config/UserMvcAdapter.java

@@ -0,0 +1,21 @@
+package org.jeecg.modules.wps.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+public class UserMvcAdapter extends WebMvcConfigurerAdapter {
+
+    private static String[] URL_PATTERNS = new String[] { "/v1/**"};
+
+    /**
+     * 注册拦截器
+     */
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(new UserHandlerAdapter()).addPathPatterns(URL_PATTERNS);
+        super.addInterceptors(registry);
+    }
+
+}

+ 53 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileDTO.java

@@ -0,0 +1,53 @@
+package org.jeecg.modules.wps.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class FileDTO {
+
+    public FileDTO() {
+        super();
+    }
+
+    public FileDTO(String id, String name, int version, int size, String creator,
+                      long create_time, String download_url, UserAclBO user_acl, WatermarkBO watermark) {
+        this.id = id;
+        this.name = name;
+        this.version = version;
+        this.size = size;
+        this.creator = creator;
+        this.create_time = create_time;
+        this.download_url = download_url;
+        this.user_acl = user_acl;
+        this.watermark = watermark;
+    }
+
+    	/*
+	id:  "132aa30a87064",                 //文件id,字符串长度小于40
+    name : "example.doc",                //文件名
+    version: 1,                        //当前版本号,位数小于11
+    size: 200,                        //文件大小,单位为kb
+    creator: "id0",                        //创建者id,字符串长度小于40
+    create_time: 1136185445,            //创建时间,时间戳,单位为秒
+    modifier: "id1000",                    //修改者id,字符串长度小于40
+    modify_time: 1551409818,            //修改时间,时间戳,单位为秒
+    download_url: "http://www.xxx.cn/v1/file?fid=f132aa30a87064",  //文档下载地址
+    */
+
+    private String id;
+    private String name;
+    private int version;
+    private int size;
+    private String creator;
+    private String modifier;
+    private long create_time;
+    private long modify_time;
+    private String download_url;
+
+    private UserAclBO user_acl;
+    private WatermarkBO watermark;
+
+}
+

+ 34 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileHisDTO.java

@@ -0,0 +1,34 @@
+package org.jeecg.modules.wps.dto;
+
+import lombok.Data;
+
+@Data
+public class FileHisDTO {
+
+    private String id;
+    private String name;
+    private int version;
+    private int size;
+    private long create_time;
+    private long modify_time;
+    private String download_url;
+
+    private UserDTO creator;
+    private UserDTO modifier;
+
+    public FileHisDTO(){super();}
+
+    public FileHisDTO(String id, String name, int version, int size,
+                      long create_time, long modify_time, String download_url,
+                      UserDTO creator, UserDTO modifier) {
+        this.id = id;
+        this.name = name;
+        this.version = version;
+        this.size = size;
+        this.create_time = create_time;
+        this.modify_time = modify_time;
+        this.download_url = download_url;
+        this.creator = creator;
+        this.modifier = modifier;
+    }
+}

+ 40 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileListDTO.java

@@ -0,0 +1,40 @@
+package org.jeecg.modules.wps.dto;
+
+import lombok.Data;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @author zm
+ * @date 2019.10.7
+ */
+
+@Data
+public class FileListDTO {
+
+    private String id;
+    private String name;
+    private int version;
+    private int size;
+    private String userId;
+    private String creator;
+    private String modifier;
+    private String createTime;
+    private String modifyTime;
+    private String download_url;
+
+    public FileListDTO(String id, String name, int version, int size, String creator,
+                       String modifier, long createTime, long modifyTime, String download_url,String userId) {
+        this.id = id;
+        this.name = name;
+        this.version = version;
+        this.size = size;
+        this.creator = creator;
+        this.modifier = modifier;
+        this.createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(Long.valueOf(createTime)));
+        this.modifyTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(Long.valueOf(modifyTime)));
+        this.download_url = download_url;
+        this.userId = userId;
+    }
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileNewDTO.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.wps.dto;
+
+import lombok.Data;
+
+@Data
+public class FileNewDTO {
+
+    private String redirect_url;
+    private String user_id;
+
+    public FileNewDTO(){super();}
+
+    public FileNewDTO(String redirect_url, String user_id) {
+        this.redirect_url = redirect_url;
+        this.user_id = user_id;
+    }
+}

+ 16 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/FileReqDTO.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.wps.dto;
+
+import lombok.Data;
+
+@Data
+public class FileReqDTO {
+
+    // 重命名用
+    private String name;
+
+    // 历史信息
+    private String id;
+    private int offset = 0;
+    private int count;
+
+}

+ 11 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserAclBO.java

@@ -0,0 +1,11 @@
+package org.jeecg.modules.wps.dto;
+
+import lombok.Data;
+
+@Data
+public class UserAclBO {
+
+    private int rename = 0; //重命名权限,1为打开该权限,0为关闭该权限,默认为0
+    private int history = 0; //历史版本权限,1为打开该权限,0为关闭该权限,默认为1
+
+}

+ 23 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/UserDTO.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.wps.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UserDTO {
+
+    private String id = "-1";
+    private String name = " ";
+    private String permission = "read";
+    private String avatar_url = "";
+
+    public UserDTO(){super();}
+
+    public UserDTO(String id, String name, String permission, String avatar_url) {
+        this.id = id;
+        this.name = name;
+        this.permission = permission;
+        this.avatar_url = avatar_url;
+    }
+}

+ 18 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/dto/WatermarkBO.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.wps.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class WatermarkBO {
+
+    private Integer type = 0;
+    private String value = "";
+    private String fillstyle = "rgba( 192, 192, 192, 0.6 )";
+    private String font = "bold 20px Serif";
+    private BigDecimal rotate = new BigDecimal("0");
+    private Integer horizontal = 50;
+    private Integer vertical = 50;
+
+}

+ 20 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/propertie/OSSProperties.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.wps.propertie;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "oss")
+public class OSSProperties {
+
+    private String fileUrlPrefix;
+    private String bucketName;
+    private String diskName;
+    private String regionId;
+    private String endpoint;
+    private String accessKey;
+    private String accessSecret;
+
+}

+ 18 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/propertie/QNProperties.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.wps.propertie;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "qn")
+public class QNProperties {
+
+    private String url;
+    private String bucket;
+    private String accessKey;
+    private String secretKey;
+    private String diskName;
+
+}

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/propertie/UploadProperties.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.wps.propertie;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "upload")
+public class UploadProperties {
+
+    private String fileLocation;
+
+}

+ 22 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/propertie/WpsProperties.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.wps.propertie;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * 属性文件
+ * @author zm
+ */
+@Data
+@Component
+@ConfigurationProperties(prefix = "wps")
+public class WpsProperties {
+
+	private String domain;
+	private String appid;
+	private String appsecret;
+	private String downloadHost;
+	private String localDir;
+
+}

+ 87 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/SignatureUtil.java

@@ -0,0 +1,87 @@
+package org.jeecg.modules.wps.util;
+
+import org.apache.commons.codec.digest.HmacUtils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.commons.codec.binary.Base64.encodeBase64String;
+
+
+public class SignatureUtil {
+
+    public static String getKeyValueStr(Map<String, String> params) {
+        List<String> keys = new ArrayList<String>(){
+            {
+                for (Map.Entry<String, String> entry : params.entrySet()) {
+                    add(entry.getKey());
+                }
+            }
+        };
+        StringBuilder sb = new StringBuilder();
+        for (String key : keys) {
+            String value = params.get(key) + "&";
+            sb.append(key).append("=").append(value);
+        }
+        return sb.toString();
+    }
+
+    public static String getSignature(Map<String, String> params, String appSecret) {
+        List<String> keys = new ArrayList<String>(){
+            {
+                for (Map.Entry<String, String> entry : params.entrySet()) {
+                    add(entry.getKey());
+                }
+            }
+        };
+
+        // 将所有参数按key的升序排序
+        keys.sort(String::compareTo);
+
+        // 构造签名的源字符串
+        StringBuilder contents = new StringBuilder();
+        for (String key : keys) {
+            if (key.equals("_w_signature")) {
+                continue;
+            }
+            contents.append(key).append("=").append(params.get(key));
+        }
+        contents.append("_w_secretkey=").append(appSecret);
+
+        // 进行hmac sha1 签名
+        byte[] bytes = HmacUtils.hmacSha1(appSecret.getBytes(), contents.toString().getBytes());
+
+        //字符串经过Base64编码
+        String sign = encodeBase64String(bytes);
+        try {
+            return URLEncoder.encode(sign, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static Map<String, String> paramToMap(String paramStr) {
+        String[] params = paramStr.split("&");
+        return new HashMap<String, String>(){
+            {
+                for (String param1 : params) {
+                    String[] param = param1.split("=");
+                    if (param.length >= 2) {
+                        String key = param[0];
+                        StringBuilder value = new StringBuilder(param[1]);
+                        for (int j = 2; j < param.length; j++) {
+                            value.append("=").append(param[j]);
+                        }
+                        put(key, value.toString());
+                    }
+                }
+            }
+        };
+    }
+
+}

+ 12 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/Token.java

@@ -0,0 +1,12 @@
+package org.jeecg.modules.wps.util;
+
+import lombok.Data;
+
+@Data
+public class Token {
+
+    private int expires_in;
+    private String token;
+    private String wpsUrl;
+
+}

+ 45 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/WpsUtil.java

@@ -0,0 +1,45 @@
+package org.jeecg.modules.wps.util;
+
+import com.web.wps.propertie.WpsProperties;
+import com.web.wps.util.file.FileUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Component
+public class WpsUtil {
+
+    private final WpsProperties wpsProperties;
+
+    @Autowired
+    public WpsUtil(WpsProperties wpsProperties) {
+        this.wpsProperties = wpsProperties;
+    }
+
+    public String getWpsUrl(Map<String,String> values,String fileType,String fileId){
+        String keyValueStr = SignatureUtil.getKeyValueStr(values);
+        String signature = SignatureUtil.getSignature(values, wpsProperties.getAppsecret());
+        String fileTypeCode = FileUtil.getFileTypeCode(fileType);
+
+        return wpsProperties.getDomain() + fileTypeCode + "/" + fileId + "?"
+                + keyValueStr + "_w_signature=" + signature;
+    }
+
+    public String getTemplateWpsUrl(String fileType,String userId){
+        Map<String,String> values = new HashMap<String,String>(){
+            {
+                put("_w_appid", wpsProperties.getAppid());
+                put("_w_userid", userId);
+            }
+        };
+        String keyValueStr = SignatureUtil.getKeyValueStr(values);
+        String signature = SignatureUtil.getSignature(values, wpsProperties.getAppsecret());
+        String fileTypeCode = FileUtil.getTypeCode(fileType);
+
+        return wpsProperties.getDomain() + fileTypeCode + "/new/0" + "?"
+                + keyValueStr + "_w_signature=" + signature;
+    }
+
+}

+ 119 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileType.java

@@ -0,0 +1,119 @@
+package org.jeecg.modules.wps.util.file;
+
+/**
+ * 文件类型枚取
+ */
+public enum FileType {
+
+	JPEG("FFD8FF"),//JPEG (jpg)
+
+	PNG("89504E47"),//PNG (png)
+
+	GIF("47494638"),//GIF (gif)
+
+	TIFF("49492A00"),//TIFF (tif)
+
+	BMP("424D"),//Windows Bitmap (bmp)
+
+	DWG("41433130"),//CAD (dwg)
+
+	PSD("38425053"),// Adobe Photoshop.
+
+	RTF("7B5C727466"),// Rich Text Format.
+
+	XML("3C3F786D6C"),// XML.
+
+	HTML("68746D6C3E"),//HTML (html)
+
+	CSS("48544D4C207B0D0A0942"),// CSS.
+
+	JS("696B2E71623D696B2E71"),// JS.
+
+	EML("44656C69766572792D646174653A"),// Email [thorough only].
+
+	DBX("CFAD12FEC5FD746F"),// Outlook Express.
+
+	PST("2142444E"),// Outlook (pst).
+
+	XLS_DOC("D0CF11E0"), // MS Word/Excel.
+
+	XLSX_DOCX("504B030414000600080000002100"),// MS Word/Excel.
+
+	WPSUSER("504B03040A0000000000"),// WPS(个人版)文字wps、表格et、演示dps都是一样的
+
+	WPS("D0CF11E0A1B11AE10000"),// WPS(专业版)文字wps、表格et、演示dps都是一样的
+
+	VSD("d0cf11e0a1b11ae10000"),// Visio
+
+	MDB("5374616E64617264204A"),// MS Access.
+
+	TORRENT("6431303A637265617465"),// torrent
+
+	WPD("FF575043"),// WordPerfect.
+
+	EPS("252150532D41646F6265"),// Postscript.
+
+	PDF("255044462D312E"),// Adobe Acrobat.
+
+	QDF("AC9EBD8F"),// Quicken.
+
+	PWL("E3828596"),// Windows Password.
+
+	ZIP("504B03040A000008"),// ZIP Archive.
+
+	RAR("52617221"),// RAR Archive.
+
+	JSP("3C2540207061676520"),// JSP Archive.
+
+	JAVA("7061636B61676520"),// JAVA Archive.
+
+	JAR("504B03040A000000"),// JAR Archive.
+
+	MF("4D616E69666573742D56"),// MF Archive.
+
+	EXE("4D5A9000030000000400"),// EXE Archive.
+
+	CHM("49545346030000006000"),// CHM Archive.
+
+	WAV("57415645"),// Wave.
+
+	AVI("41564920"),// AVI.
+
+	RAM("2E7261FD"),// Real Audio.
+
+	RM("2E524D46"),// Real Media.
+
+	MPG("000001BA"),// MPEG (mpg).
+
+	MOV("6D6F6F76"),// Quicktime.
+
+	ASF("3026B2758E66CF11"),// Windows Media.
+
+	MID("4D546864"),// MIDI.
+
+	MP4("00000020667479706d70"),// MP4.
+
+	MP3("49443303000000002176"),// MP3.
+
+	FLV("464C5601050000000900");// FLV.
+
+	private String value = "";
+
+	/**
+	 * Constructor.
+	 *
+	 * @param type
+	 */
+	private FileType(String value) {
+		this.value = value;
+	}
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+}

+ 148 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileTypeJudge.java

@@ -0,0 +1,148 @@
+package org.jeecg.modules.wps.util.file;
+
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+* 文件类型判断类
+*/
+@Component
+public class FileTypeJudge {
+
+   /**
+    * 将文件头转换成16进制字符串
+    * @return 16进制字符串
+    */
+   private static String bytesToHexString(byte[] src) {
+
+       StringBuilder stringBuilder = new StringBuilder();
+       if (src == null || src.length <= 0) {
+           return null;
+       }
+       for (int i = 0; i < src.length; i++) {
+           int v = src[i] & 0xFF;
+           String hv = Integer.toHexString(v);
+           if (hv.length() < 2) {
+               stringBuilder.append(0);
+           }
+           stringBuilder.append(hv);
+       }
+       return stringBuilder.toString();
+   }
+
+   /**
+    * 得到文件头
+    * @return 文件头
+    * @throws IOException ex
+    */
+   private static String getFileContent(InputStream is) throws IOException {
+
+       byte[] b = new byte[28];
+
+       InputStream inputStream = null;
+
+       try {
+           is.read(b, 0, 28);
+       } catch (IOException e) {
+           e.printStackTrace();
+           throw e;
+       } finally {
+           if (inputStream != null) {
+               try {
+                   inputStream.close();
+               } catch (IOException e) {
+                   e.printStackTrace();
+                   throw e;
+               }
+           }
+       }
+       return bytesToHexString(b);
+   }
+
+   /**
+    * 判断文件类型
+    * @return 文件类型
+    */
+   public FileType getType(InputStream is) throws IOException {
+
+       String fileHead = getFileContent(is);
+
+       if (fileHead == null || fileHead.length() == 0) {
+           return null;
+       }
+
+       fileHead = fileHead.toUpperCase();
+
+       FileType[] fileTypes = FileType.values();
+
+
+       for (FileType type : fileTypes) {
+    	   System.out.println(type.getValue());
+           if (fileHead.startsWith(type.getValue())) {
+               return type;
+           }
+       }
+
+       return null;
+   }
+
+   public static Integer isFileType(FileType value) {
+       int type = 7;// 其他
+       // 图片
+       FileType[] pics = { FileType.JPEG, FileType.PNG, FileType.GIF, FileType.TIFF, FileType.BMP, FileType.DWG, FileType.PSD };
+
+       FileType[] docs = { FileType.RTF, FileType.XML, FileType.HTML, FileType.CSS, FileType.JS, FileType.EML, FileType.DBX, FileType.PST, FileType.XLS_DOC, FileType.XLSX_DOCX, FileType.VSD,
+               FileType.MDB, FileType.WPS, FileType.WPD, FileType.EPS, FileType.PDF, FileType.QDF, FileType.PWL, FileType.ZIP, FileType.RAR, FileType.JSP, FileType.JAVA,
+               FileType.JAR, FileType.MF, FileType.EXE, FileType.CHM };
+
+       FileType[] videos = { FileType.AVI, FileType.RAM, FileType.RM, FileType.MPG, FileType.MOV, FileType.ASF, FileType.MP4, FileType.FLV, FileType.MID };
+
+       FileType[] tottents = { FileType.TORRENT };
+
+       FileType[] audios = { FileType.WAV, FileType.MP3 };
+
+       FileType[] others = {};
+
+       // 图片
+       for (FileType fileType : pics) {
+           if (fileType.equals(value)) {
+               type = 1;
+           }
+       }
+       // 文档
+       for (FileType fileType : docs) {
+           if (fileType.equals(value)) {
+               type = 2;
+           }
+       }
+       // 视频
+       for (FileType fileType : videos) {
+           if (fileType.equals(value)) {
+               type = 3;
+           }
+       }
+       // 种子
+       for (FileType fileType : tottents) {
+           if (fileType.equals(value)) {
+               type = 4;
+           }
+       }
+       // 音乐
+       for (FileType fileType : audios) {
+           if (fileType.equals(value)) {
+               type = 5;
+           }
+       }
+       return type;
+   }
+
+/*   public static void main(String args[]) throws Exception {
+       // System.out.println(FileTypeJudge.getType(new FileInputStream("")));
+       for (FileType type : FileType.values()) {
+           System.out.print(type + "\t");
+       }
+   }
+   */
+}

+ 113 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/file/FileUtil.java

@@ -0,0 +1,113 @@
+package org.jeecg.modules.wps.util.file;
+
+import java.nio.charset.StandardCharsets;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
+public class FileUtil {
+
+    // office
+    private static String[] office = {"word", "excel", "ppt"};
+
+    // excel
+    private static String[] etExts = {"et", "xls", "xlt", "xlsx", "xlsm", "xltx", "xltm", "csv"};
+
+    // word
+    private static String[] wpsExts = {"doc", "docx", "txt", "dot", "wps", "wpt", "dotx", "docm", "dotm"};
+
+    // ppt
+    private static String[] wppExts = {"ppt", "pptx", "pptm", "pptm", "ppsm", "pps", "potx", "potm", "dpt", "dps"};
+
+    // pdf
+    private static String[] pdfExts = {"pdf"};
+
+    public static String getFileTypeCode(String fileType){
+        for (String et : etExts){
+            if (et.equalsIgnoreCase(fileType)){
+                return "s";
+            }
+        }
+        for (String et : wpsExts){
+            if (et.equalsIgnoreCase(fileType)){
+                return "w";
+            }
+        }
+        for (String et : wppExts){
+            if (et.equalsIgnoreCase(fileType)){
+                return "p";
+            }
+        }
+        for (String et : pdfExts){
+            if (et.equalsIgnoreCase(fileType)){
+                return "f";
+            }
+        }
+        return null;
+    }
+
+    public static boolean checkCode(String fileType){
+        for (String et : office){
+            if (et.equalsIgnoreCase(fileType)){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static String getTypeCode(String fileType){
+        if ("word".equalsIgnoreCase(fileType)){
+            return "w";
+        }if ("excel".equalsIgnoreCase(fileType)){
+            return "s";
+        }if ("ppt".equalsIgnoreCase(fileType)){
+            return "p";
+        }
+        return null;
+    }
+
+    public static String getFileName(String filePath){
+        String[] pathArr = filePath.split("/");
+        String fileName ;
+        if (pathArr.length>1){
+            fileName = pathArr[pathArr.length-1];
+        }else {
+            fileName = filePath;
+        }
+        return fileName;
+    }
+
+    public static String getFileTypeByPath(String filePath){
+        String fileName = getFileName(filePath);
+        String[] arr = fileName.split("\\.");
+        return arr[arr.length-1];
+    }
+
+    public static String getFileTypeByName(String fileName){
+        String[] arr = fileName.split("\\.");
+        return arr[arr.length-1];
+    }
+
+    public static String getFileUUIDName(String fileName,String fileType){
+        String uuid = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+        String uuidFileName = fileName.replace(".","").replace(fileType,"") + uuid + "." + fileType ;
+        return new String(uuidFileName.getBytes(), StandardCharsets.UTF_8);
+    }
+
+    public static String makeNewFileName(String oldFileName){
+        String fileType = FileUtil.getFileTypeByName(oldFileName);
+        String tempFileName = oldFileName.replace("."+fileType,"");
+        Random ne = new Random();//实例化一个random的对象ne
+        int uuid = ne.nextInt(90000)+10000;//为变量赋随机值10000-99999
+        return  tempFileName + uuid + "." + fileType;
+    }
+
+    public static String makeNewFileName(String oldFileName,String fileType){
+        String tempFileName = oldFileName.replace("."+fileType,"");
+        Random ne = new Random();//实例化一个random的对象ne
+        int uuid = ne.nextInt(90000)+10000;//为变量赋随机值10000-99999
+        return  tempFileName + uuid + "." + fileType;
+    }
+
+
+}

+ 28 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/ResFileDTO.java

@@ -0,0 +1,28 @@
+package org.jeecg.modules.wps.util.upload;
+
+import lombok.Data;
+
+@Data
+public class ResFileDTO {
+
+	private String fileUrl;
+	private String fileName;
+	private String cFileName;
+	private String fileType;
+	private long fileSize;
+	private String md5key;
+
+	public ResFileDTO() {
+		super();
+	}
+
+	public ResFileDTO(String fileUrl, String fileName, String cFileName, String fileType, long fileSize, String md5key) {
+		this.fileUrl = fileUrl;
+		this.fileName = fileName;
+		this.cFileName = cFileName;
+		this.fileType = fileType;
+		this.fileSize = fileSize;
+		this.md5key = md5key;
+	}
+
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/UploadFileLocation.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.wps.util.upload;
+
+public abstract class UploadFileLocation {
+
+    /**
+     * 七牛云 对象存储
+     */
+    public final static String QN = "qn";
+
+    /**
+     * 阿里云 对象存储
+     */
+    public final static String OSS = "oss";
+
+}

+ 414 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/oss/OSSUtil.java

@@ -0,0 +1,414 @@
+package org.jeecg.modules.wps.util.upload.oss;
+
+import com.aliyun.oss.HttpMethod;
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.model.*;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.modules.wps.propertie.OSSProperties;
+import org.jeecg.modules.wps.util.file.FileType;
+import org.jeecg.modules.wps.util.file.FileTypeJudge;
+import org.jeecg.modules.wps.util.file.FileUtil;
+import org.jeecg.modules.wps.util.upload.ResFileDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.*;
+
+@Service
+public class OSSUtil {
+
+    @Autowired
+    public OSSUtil(OSSProperties oss, FileTypeJudge fileTypeJudge) {
+        this.oss = oss;
+        this.fileTypeJudge = fileTypeJudge;
+    }
+
+    private final OSSProperties oss;
+    private final FileTypeJudge fileTypeJudge;
+
+    private OSSClient getOSSClient(){
+        return new OSSClient(oss.getEndpoint(),oss.getAccessKey(), oss.getAccessSecret());
+    }
+
+    public String simpleUploadFilePath(String filePath){
+        File file = new File(filePath);
+        return (this.simpleUploadFile(file));
+    }
+
+    public String simpleUploadFile(File file){
+        String fileName = file.getName();
+        String newFileName = FileUtil.makeNewFileName(fileName);
+        this.getOSSClient().putObject(oss.getBucketName(), oss.getDiskName() + newFileName, file);
+        return (oss.getFileUrlPrefix() + oss.getDiskName() + newFileName);
+    }
+
+    public String simpleUploadMultipartFile(MultipartFile file){
+        String fileName = file.getOriginalFilename();
+        String newFileName = FileUtil.makeNewFileName(fileName);
+        try {
+            this.getOSSClient().putObject(oss.getBucketName(), oss.getDiskName() + newFileName, file.getInputStream());
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return (oss.getFileUrlPrefix() + oss.getDiskName() + newFileName);
+    }
+
+    public ResFileDTO uploadMultipartFile(MultipartFile file){
+        String fileName = file.getOriginalFilename();
+        InputStream inputStream;
+        ResFileDTO o = new ResFileDTO();
+        String fileType ;
+        long fileSize = file.getSize();
+        try {
+            inputStream = file.getInputStream();
+            FileType type = fileTypeJudge.getType(inputStream);
+
+            if(type == null || "null".equals(type.toString()) ||
+                    "XLS_DOC".equals(type.toString())|| "XLSX_DOCX".equals(type.toString()) ||
+                    "WPSUSER".equals(type.toString())|| "WPS".equals(type.toString())){
+                fileType = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+            }else{
+                fileType = type.toString().toLowerCase();
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            //用户上传的文件类型为空,并且通过二进制流获取不到文件类型,因为二进制流只列举了常用的
+            fileType = "";
+        }
+
+        try {
+            o = this.uploadDetailInputStream(file.getInputStream(),fileName,fileType,fileSize);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return o;
+    }
+
+    public ResFileDTO uploadDetailInputStream (InputStream in, String fileName , String fileType, long fileSize) {
+
+        String uuidFileName = FileUtil.getFileUUIDName(fileName,fileType);
+
+        String fileUrl = oss.getFileUrlPrefix() + oss.getDiskName() + uuidFileName;
+
+        String md5key = this.uploadFile(in, uuidFileName, fileSize, oss.getBucketName(),
+                oss.getDiskName(),fileName);
+        ResFileDTO o = new ResFileDTO();
+
+        if(md5key != null){
+            o.setFileType(fileType);
+            o.setFileName(fileName);
+            o.setCFileName(uuidFileName);
+            o.setFileUrl(fileUrl);
+            o.setFileSize(fileSize);
+            o.setMd5key(md5key);
+        }
+        return o;
+    }
+
+    /**
+     * 向阿里云的OSS存储中存储文件  --file也可以用InputStream替代
+     * @param bucketName bucket名称
+     * @param diskName 上传文件的目录  --bucket下文件的路径
+     * @return String 唯一MD5数字签名
+     * */
+    public String uploadFile(InputStream inputStream, String fileName,long fileSize,String bucketName, String diskName,String localFileName) {
+        String resultStr = null;
+        try {
+            OSSClient client =  this.getOSSClient();
+            //创建上传Object的Metadata
+            ObjectMetadata metadata = new ObjectMetadata();
+            metadata.setContentLength(inputStream.available());
+            metadata.setCacheControl("no-cache");
+            metadata.setHeader("Pragma", "no-cache");
+            metadata.setContentEncoding("utf-8");
+            metadata.setContentType(getContentType(fileName));
+            if(StringUtils.isEmpty(localFileName)){
+                metadata.setContentDisposition("filename=" + fileName);
+            }else{
+                metadata.setContentDisposition("filename=" + localFileName);
+            }
+            //上传文件
+            PutObjectResult putResult = client.putObject(bucketName, diskName + fileName, inputStream, metadata);
+            //解析结果
+            resultStr = putResult.getETag();
+            client.shutdown();
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("上传阿里云OSS服务器异常:"+e.getMessage());
+            //LOG.error("上传阿里云OSS服务器异常." + e.getMessage(), e);
+        }
+        return resultStr;
+    }
+
+    /**
+     * 修改文件元信息
+     * @param fileName   原文件名
+     * @param bucketName 桶名
+     * @param downName   下载时的文件名称
+     */
+    public void changeFileMetaInfo(String fileName,String bucketName,String downName){
+        try{
+            // 创建OSSClient实例。
+            OSS ossClient = this.getOSSClient();
+            // 设置源文件与目标文件相同,调用ossClient.copyObject方法修改文件元信息。
+            CopyObjectRequest request = new CopyObjectRequest(bucketName, fileName, bucketName, fileName);
+            ObjectMetadata meta = new ObjectMetadata();
+            // 指定上传的内容类型。内容类型决定浏览器将以什么形式、什么编码读取文件。如果没有指定则根据文件的扩展名生成,如果没有扩展名则为默认值application/octet-stream。
+            meta.setContentType(getContentType(fileName));
+            // 设置内容被下载时的名称。
+            System.out.println("downNmme"+downName);
+            meta.setContentDisposition("filename="+downName);
+            // 设置内容被下载时网页的缓存行为。
+            meta.setCacheControl("no-cache");
+            // 设置缓存过期时间,格式是格林威治时间(GMT)。
+            meta.setExpirationTime(com.aliyun.oss.common.utils.DateUtil.parseIso8601Date("2022-10-12T00:00:00.000Z"));
+            // 设置内容被下载时的编码格式。
+            meta.setContentEncoding("utf-8");
+            request.setNewObjectMetadata(meta);
+
+            //修改元信息。
+            ossClient.copyObject(request);
+
+            // 关闭OSSClient。
+            ossClient.shutdown();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 生成下载的url
+     * @param fileName wjm
+     * @return URL URL
+     */
+    public URL getDownLoadUrl(String fileName, String bucketName){
+        // 创建OSSClient实例。
+        OSS ossClient = this.getOSSClient();
+        //设置链接时效60分钟
+        Calendar c = Calendar.getInstance();
+        c.setTime(new Date());
+        c.add(Calendar.MINUTE, 60);
+
+        Date date= c.getTime();
+        GeneratePresignedUrlRequest request=new GeneratePresignedUrlRequest(bucketName,fileName, HttpMethod.GET);
+        request.addHeader("policy","");
+        request.setExpiration(date);
+
+        Map<String,String> map=new HashMap<String, String>();
+        map.put("response-content-disposition","attachment");
+        request.setQueryParameter(map);
+        URL url=ossClient.generatePresignedUrl(request);
+        System.out.println(url);
+        return url;
+    }
+
+    /**
+     * 新建Bucket  --Bucket权限:私有
+     * @param bucketName bucket名称
+     * @return true 新建Bucket成功
+     * */
+    public static boolean createBucket(OSSClient client, String bucketName){
+        Bucket bucket = client.createBucket(bucketName);
+        return bucketName.equals(bucket.getName());
+    }
+
+    /**
+     * 删除Bucket
+     * @param bucketName bucket名称
+     * */
+    public static void deleteBucket(OSSClient client, String bucketName){
+        client.deleteBucket(bucketName);
+        System.out.println("删除Bucket成功:"+bucketName);
+        //  logger.info("删除" + bucketName + "Bucket成功");
+    }
+
+    /**
+     * 向阿里云的OSS存储中存储文件  --file也可以用InputStream替代
+     * @param file 上传文件
+     * @param bucketName bucket名称
+     * @param diskName 上传文件的目录  --bucket下文件的路径
+     * @return String 唯一MD5数字签名
+     * */
+    public String uploadObject(File file, String bucketName, String diskName) {
+        String resultStr = null;
+        try {
+            OSSClient client =  this.getOSSClient();
+            InputStream is = new FileInputStream(file);
+            String fileName = file.getName();
+            long fileSize = file.length();
+            //创建上传Object的Metadata
+            ObjectMetadata metadata = new ObjectMetadata();
+            metadata.setContentLength(is.available());
+            metadata.setCacheControl("no-cache");
+            metadata.setHeader("Pragma", "no-cache");
+            metadata.setContentEncoding("utf-8");
+            metadata.setContentType(getContentType(fileName));
+            metadata.setContentDisposition("filename=" + fileName);
+            //上传文件
+            PutObjectResult putResult = client.putObject(bucketName, diskName + fileName, is, metadata);
+            //解析结果
+            resultStr = putResult.getETag();
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("上传阿里云OSS服务器异常:"+e.getMessage());
+            //LOG.error("上传阿里云OSS服务器异常." + e.getMessage(), e);
+        }
+        return resultStr;
+    }
+
+    /**
+     * 向阿里云的OSS存储中分片存储文件
+     * @param bucketName bucket名称
+     */
+    public String multipartUploadObject(String bucketName, String key,File partFile) {
+        String tag = null;
+        String uploadid = null;
+        int j=0;
+        // 初始化一个OSSClient
+        OSSClient client =  this.getOSSClient();
+        ListMultipartUploadsRequest lmur = new ListMultipartUploadsRequest(bucketName);
+        // 获取Bucket内所有上传事件
+        MultipartUploadListing listing = client.listMultipartUploads(lmur);
+        // 新建一个List保存每个分块上传后的ETag和PartNumber
+        List<PartETag> partETags = new ArrayList<PartETag>();
+        // 遍历所有上传事件  设置UploadId
+        for (MultipartUpload multipartUpload : listing.getMultipartUploads()) {
+            if (multipartUpload.getKey().equals(key)) {
+                uploadid=multipartUpload.getUploadId();
+                break;
+            }
+        }
+        if(StringUtils.isEmpty(uploadid)){
+            // 开始Multipart Upload,InitiateMultipartUploadRequest 来指定上传Object的名字和所属Bucke
+            InitiateMultipartUploadRequest initiateMultipartUploadRequest = new InitiateMultipartUploadRequest(bucketName, key);
+            InitiateMultipartUploadResult initiateMultipartUploadResult = client.initiateMultipartUpload(initiateMultipartUploadRequest);
+            uploadid=initiateMultipartUploadResult.getUploadId();
+        }else{
+            ListPartsRequest listPartsRequest = new ListPartsRequest(bucketName,key, uploadid);
+            //listParts 方法获取某个上传事件所有已上传的块
+            PartListing partListing = client.listParts(listPartsRequest);
+            // 遍历所有Part
+            for (PartSummary part : partListing.getParts()) {
+                partETags.add(new PartETag(part.getPartNumber(),part.getETag()));
+                j++;
+            }
+        }
+        // 设置每块为 5M(最小支持5M)
+        final int partSize = 1024 * 1024 * 5;
+        // 计算分块数目
+        int partCount = (int) (partFile.length() / partSize);
+        if (partFile.length() % partSize != 0) {
+            partCount++;
+        }
+        try {
+            for (int i=j ; i < partCount; i++) {
+                // 获取文件流
+                FileInputStream fis;
+                fis = new FileInputStream(partFile);
+                // 跳到每个分块的开头
+                long skipBytes = partSize * i;
+                fis.skip(skipBytes);
+                // 计算每个分块的大小
+                long size = partSize < partFile.length() - skipBytes ? partSize: partFile.length() - skipBytes;
+                // 创建UploadPartRequest,上传分块
+                UploadPartRequest uploadPartRequest = new UploadPartRequest();
+                uploadPartRequest.setBucketName(bucketName);
+                uploadPartRequest.setKey(key);
+                uploadPartRequest.setUploadId(uploadid);
+                uploadPartRequest.setInputStream(fis);
+                uploadPartRequest.setPartSize(size);
+                uploadPartRequest.setPartNumber(i + 1);
+                UploadPartResult uploadPartResult = client.uploadPart(uploadPartRequest);
+                // 将返回的PartETag保存到List中。
+                partETags.add(uploadPartResult.getPartETag());
+                // 关闭文件
+                fis.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        CompleteMultipartUploadRequest completeMultipartUploadRequest = new CompleteMultipartUploadRequest(bucketName, key, uploadid, partETags);
+        // 完成分块上传
+        CompleteMultipartUploadResult completeMultipartUploadResult = client.completeMultipartUpload(completeMultipartUploadRequest);
+        // 打印Object的ETag(返回的ETag不是md5.具体是什么不详)
+        tag = completeMultipartUploadResult.getETag();
+        return tag;
+    }
+
+
+
+    /**
+     * 从阿里云的OSS存储中下载文件  --file也可以用InputStream替代
+     * @param bucketName bucket名称
+     * @param diskName 上传文件的目录  --bucket下文件的路径
+     * @return String 唯一MD5数字签名
+     * */
+    public String downloadFile(String bucketName, String diskName,String filePath) {
+        String resultStr = null;
+        try {
+            OSSClient client =  this.getOSSClient();
+            client.getObject(new GetObjectRequest(bucketName, diskName), new File(filePath));
+            client.shutdown();
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("上传阿里云OSS服务器异常:"+e.getMessage());
+        }
+        return resultStr;
+    }
+    /**
+     * 根据key获取OSS服务器上的文件输入流
+     * @param client OSS客户端
+     * @param bucketName bucket名称
+     * @param diskName 文件路径
+     * @param key Bucket下的文件的路径名+文件名
+     */
+    public static InputStream getInputStream(OSSClient client, String bucketName, String diskName, String key){
+        OSSObject ossObj = client.getObject(bucketName, diskName + key);
+        return ossObj.getObjectContent();
+    }
+
+    /**
+     * 根据key删除OSS服务器上的文件
+     * @param bucketName bucket名称
+     * @param diskName 文件路径
+     * @param key Bucket下的文件的路径名+文件名
+     */
+    public void deleteFile( String bucketName, String diskName, String key){
+        OSSClient client =  this.getOSSClient();
+        client.deleteObject(bucketName, diskName + key);
+        client.shutdown();
+        System.out.println("删除" + bucketName + "下的文件" + diskName + key + "成功");
+    }
+
+    /**
+     * 通过文件名判断并获取OSS服务文件上传时文件的contentType
+     * @param fileName 文件名
+     * @return 文件的contentType
+     */
+    public static String getContentType(String fileName){
+        String fileExtension = fileName.substring(fileName.lastIndexOf(".")+1);
+        if("bmp".equalsIgnoreCase(fileExtension)) return "image/bmp";
+        if("gif".equalsIgnoreCase(fileExtension)) return "image/gif";
+        if("jpeg".equalsIgnoreCase(fileExtension) || "jpg".equalsIgnoreCase(fileExtension)  || "png".equalsIgnoreCase(fileExtension) ) return "image/jpeg";
+        if("html".equalsIgnoreCase(fileExtension)) return "text/html";
+        if("txt".equalsIgnoreCase(fileExtension)) return "text/plain";
+        if("vsd".equalsIgnoreCase(fileExtension)) return "application/vnd.visio";
+        if("ppt".equalsIgnoreCase(fileExtension) || "pptx".equalsIgnoreCase(fileExtension)) return "application/x-ppt";
+        if("xls".equalsIgnoreCase(fileExtension) || "xlsx".equalsIgnoreCase(fileExtension)) return "application/x-xls";
+        if("doc".equalsIgnoreCase(fileExtension) || "docx".equalsIgnoreCase(fileExtension)) return "application/x-docx";
+        if("xml".equalsIgnoreCase(fileExtension)) return "text/xml";
+        if("pdf".equalsIgnoreCase(fileExtension)) return "application/pdf";
+        if("mp3".equalsIgnoreCase(fileExtension)) return "audio/mp3";
+        if("mp4".equalsIgnoreCase(fileExtension)) return "video/mpeg4";
+        return "text/html";
+    }
+
+}

+ 11 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/qn/MyPutRet.java

@@ -0,0 +1,11 @@
+package org.jeecg.modules.wps.util.upload.qn;
+
+public final class MyPutRet {
+
+    public String key;
+
+    public String hash;
+
+    public long fsize;
+
+}

+ 120 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/upload/qn/QNUtil.java

@@ -0,0 +1,120 @@
+package org.jeecg.modules.wps.util.upload.qn;
+
+import com.qiniu.common.QiniuException;
+import com.qiniu.http.Response;
+import com.qiniu.storage.Configuration;
+import com.qiniu.storage.Region;
+import com.qiniu.storage.UploadManager;
+import com.qiniu.util.Auth;
+import com.qiniu.util.StringMap;
+import com.web.wps.propertie.QNProperties;
+import com.web.wps.util.file.FileUtil;
+import com.web.wps.util.upload.ResFileDTO;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+@Service
+public class QNUtil {
+
+    private final QNProperties qnConfig;
+
+    public QNUtil(QNProperties qnConfig) {
+        this.qnConfig = qnConfig;
+    }
+
+    private UploadManager uploadManager;
+    private String upToken;
+
+    /**
+     * 同名覆盖,不同名新建
+     * @param key cFilename
+     */
+    private void makeUploadManager(String key){
+        StringMap putPolicy = new StringMap();
+        putPolicy.put("returnBody", "{\"key\":\"$(key)\",\"hash\":\"$(etag)\",\"fsize\":$(fsize)}");
+        Configuration cfg = new Configuration(Region.huanan());
+        this.uploadManager = new UploadManager(cfg);
+        Auth auth = Auth.create(qnConfig.getAccessKey(), qnConfig.getSecretKey());
+        this.upToken = auth.uploadToken(qnConfig.getBucket(),key,3600,putPolicy);
+    }
+
+    public ResFileDTO uploadInputStream(InputStream inputStream, String fileName) {
+        try {
+            String fileType = FileUtil.getFileTypeByName(fileName);
+            String uuidFileName = FileUtil.makeNewFileName(fileName,fileType);
+            String key = qnConfig.getDiskName() + uuidFileName;
+            this.makeUploadManager(key);
+            // 默认不指定key的情况下,以文件内容的hash值作为文件名
+//            String key = fileName;
+            Response response = uploadManager.put(inputStream, key, upToken, null, null);
+            MyPutRet myPutRet = response.jsonToObject(MyPutRet.class);
+            String fileUrl = qnConfig.getUrl() + myPutRet.key;
+            return new ResFileDTO(fileUrl,fileName,key,fileType,myPutRet.fsize,myPutRet.hash);
+        } catch (QiniuException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public ResFileDTO uploadFile(File file){
+        try {
+            String fileName = file.getName();
+            String fileType = FileUtil.getFileTypeByName(fileName);
+            String uuidFileName = FileUtil.makeNewFileName(fileName,fileType);
+            String key = qnConfig.getDiskName() + uuidFileName;
+            this.makeUploadManager(key);
+            // 默认不指定key的情况下,以文件内容的hash值作为文件名
+//            String key = file.getName();
+            Response response = uploadManager.put(file, key, upToken);
+            MyPutRet myPutRet = response.jsonToObject(MyPutRet.class);
+            String fileUrl = qnConfig.getUrl() + myPutRet.key;
+            return new ResFileDTO(fileUrl,fileName,key,fileType,myPutRet.fsize,myPutRet.hash);
+        } catch (QiniuException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public ResFileDTO uploadFilePath(String filePath){
+        try {
+            String fileName = FileUtil.getFileName(filePath);
+            String fileType = FileUtil.getFileTypeByPath(filePath);
+            String uuidFileName = FileUtil.makeNewFileName(fileName,fileType);
+            String key = qnConfig.getDiskName() + uuidFileName;
+            this.makeUploadManager(key);
+            // 默认不指定key的情况下,以文件内容的hash值作为文件名
+//            String key = FileUtil.getFileName(filePath);
+            Response response = uploadManager.put(filePath, key, upToken);
+            MyPutRet myPutRet = response.jsonToObject(MyPutRet.class);
+            String fileUrl = qnConfig.getUrl() + myPutRet.key;
+            return new ResFileDTO(fileUrl,fileName,key,fileType,myPutRet.fsize,myPutRet.hash);
+        } catch (QiniuException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public ResFileDTO uploadMultipartFile(MultipartFile file){
+        try {
+            String fileName = file.getOriginalFilename();
+            String fileType = FileUtil.getFileTypeByName(fileName);
+            String uuidFileName = FileUtil.makeNewFileName(fileName,fileType);
+            String key = qnConfig.getDiskName() + uuidFileName;
+            this.makeUploadManager(key);
+            // 默认不指定key的情况下,以文件内容的hash值作为文件名
+//            String key = file.getOriginalFilename();
+            Response response = uploadManager.put(file.getInputStream(), key, upToken,null,null);
+            MyPutRet myPutRet = response.jsonToObject(MyPutRet.class);
+            String fileUrl = qnConfig.getUrl() + myPutRet.key;
+            return new ResFileDTO(fileUrl,fileName,key,fileType,myPutRet.fsize,myPutRet.hash);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+}

+ 9 - 0
jeecg-boot-module-system/src/main/resources/application.yml

@@ -15,3 +15,12 @@ swagger:
     username: jeecg
     password: jeecg1314
 
+oss:
+  file_url_prefix: https://file.xx.com/
+  bucket_name: xxxxxx
+  disk_name:  xxxxxxxxxxxxx/
+  region_id: cn-hangzhou
+  endpoint: https://oss-cn-hangzhou.aliyuncs.com
+  access_key: xxxxxxxxxxxxxx
+  access_secret:  xxxxxxxxxxxxxxxxxxxx
+