瀏覽代碼

Merge remote-tracking branch 'origin/master'

zhou-hao 7 年之前
父節點
當前提交
693bce99ae
共有 21 個文件被更改,包括 599 次插入170 次删除
  1. 7 1
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Request.java
  2. 2 0
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/response/OAuth2Response.java
  3. 20 8
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/simple/request/SimpleOAuth2Request.java
  4. 15 3
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/simple/request/SimpleOAuth2Response.java
  5. 20 1
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/src/main/java/org/hswebframework/web/service/oauth2/AbstractOAuth2CrudService.java
  6. 13 2
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/src/test/java/org/hswebframework/web/service/oauth2/MockOAuth2Request.java
  7. 7 0
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/src/test/java/org/hswebframework/web/service/oauth2/MockOAuth2Response.java
  8. 1 2
      hsweb-system/hsweb-system-file/hsweb-system-file-controller/src/main/java/org/hswebframework/web/controller/file/FileInfoController.java
  9. 6 131
      hsweb-system/hsweb-system-file/hsweb-system-file-entity/src/main/java/org/hswebframework/web/entity/file/SimpleFileInfoEntity.java
  10. 26 0
      hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/pom.xml
  11. 28 0
      hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/main/java/org/hswebframework/web/service/file/oauth2/OAuth2FileAutoConfiguration.java
  12. 50 0
      hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/main/java/org/hswebframework/web/service/file/oauth2/OAuth2FileInfoService.java
  13. 84 0
      hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/main/java/org/hswebframework/web/service/file/oauth2/OAuth2FileService.java
  14. 3 0
      hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/main/resources/META-INF/spring.factories
  15. 109 0
      hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/test/java/org/hswebframework/web/service/file/oauth2/MockOAuth2Request.java
  16. 71 0
      hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/test/java/org/hswebframework/web/service/file/oauth2/MockOAuth2Response.java
  17. 111 0
      hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/test/java/org/hswebframework/web/service/file/oauth2/OAuth2FileServiceTest.java
  18. 1 0
      hsweb-system/hsweb-system-file/hsweb-system-file-service/pom.xml
  19. 1 0
      hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/pom.xml
  20. 1 2
      hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/src/main/resources/META-INF/spring.factories
  21. 23 20
      pom.xml

+ 7 - 1
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Request.java

@@ -20,6 +20,8 @@ package org.hswebframework.web.authorization.oauth2.client.request;
 
 
 import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
 import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
 
 
+import java.io.FileInputStream;
+import java.io.InputStream;
 import java.util.Map;
 import java.util.Map;
 import java.util.function.Consumer;
 import java.util.function.Consumer;
 
 
@@ -43,7 +45,11 @@ public interface OAuth2Request {
      */
      */
     OAuth2Request param(String name, Object value);
     OAuth2Request param(String name, Object value);
 
 
-    OAuth2Request params(Map<String,String> params);
+    OAuth2Request params(Map<String, String> params);
+
+    OAuth2Response upload(String name, InputStream inputStream);
+
+    OAuth2Response upload(String name, InputStream inputStream,String fileName);
 
 
     /**
     /**
      * 设置请求体,将内容根据contentType(默认application/json)序列化为对应的请求数据
      * 设置请求体,将内容根据contentType(默认application/json)序列化为对应的请求数据

+ 2 - 0
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/response/OAuth2Response.java

@@ -21,6 +21,7 @@ package org.hswebframework.web.authorization.oauth2.client.response;
 import org.hswebframework.web.authorization.oauth2.client.exception.OAuth2RequestException;
 import org.hswebframework.web.authorization.oauth2.client.exception.OAuth2RequestException;
 import org.hswebframework.web.oauth2.core.ErrorType;
 import org.hswebframework.web.oauth2.core.ErrorType;
 
 
+import java.io.InputStream;
 import java.util.List;
 import java.util.List;
 import java.util.function.BiConsumer;
 import java.util.function.BiConsumer;
 
 
@@ -31,6 +32,7 @@ import java.util.function.BiConsumer;
  */
  */
 public interface OAuth2Response {
 public interface OAuth2Response {
 
 
+    InputStream asStream();
     /**
     /**
      * @return 结果转为字符串
      * @return 结果转为字符串
      */
      */

+ 20 - 8
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/simple/request/SimpleOAuth2Request.java

@@ -27,6 +27,8 @@ import org.hswebframework.web.authorization.oauth2.client.request.TokenExpiredCa
 import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
 import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
 import org.hswebframework.web.oauth2.core.ErrorType;
 import org.hswebframework.web.oauth2.core.ErrorType;
 
 
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.Map;
 import java.util.Map;
 import java.util.function.Consumer;
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 import java.util.function.Supplier;
@@ -59,8 +61,8 @@ public class SimpleOAuth2Request implements OAuth2Request {
     }
     }
 
 
     @Override
     @Override
-    public OAuth2Request onRefreshTokenExpired(TokenExpiredCallBack refreshTokenExpiredCallBack){
-        this.refreshTokenExpiredCallBack=refreshTokenExpiredCallBack;
+    public OAuth2Request onRefreshTokenExpired(TokenExpiredCallBack refreshTokenExpiredCallBack) {
+        this.refreshTokenExpiredCallBack = refreshTokenExpiredCallBack;
         return this;
         return this;
     }
     }
 
 
@@ -70,6 +72,16 @@ public class SimpleOAuth2Request implements OAuth2Request {
         return this;
         return this;
     }
     }
 
 
+    @Override
+    public OAuth2Response upload(String name, InputStream inputStream) {
+        return createUnCheckResponse(() -> request.upload(name, inputStream));
+    }
+
+    @Override
+    public OAuth2Response upload(String name, InputStream inputStream, String fileName) {
+        return createUnCheckResponse(() -> request.upload(name, inputStream, fileName));
+    }
+
     @Override
     @Override
     public OAuth2Request params(Map<String, String> params) {
     public OAuth2Request params(Map<String, String> params) {
         request.params(params);
         request.params(params);
@@ -120,17 +132,17 @@ public class SimpleOAuth2Request implements OAuth2Request {
     private volatile SimpleOAuth2Response auth2Response;
     private volatile SimpleOAuth2Response auth2Response;
 
 
     protected SimpleOAuth2Response createNativeResponse(Supplier<Response> responseSupplier) {
     protected SimpleOAuth2Response createNativeResponse(Supplier<Response> responseSupplier) {
-        SimpleOAuth2Response response=  new SimpleOAuth2Response(responseSupplier.get(), convertHandler, responseJudge);
+        SimpleOAuth2Response response = new SimpleOAuth2Response(responseSupplier.get(), convertHandler, responseJudge);
 
 
 
 
-        return auth2Response =response;
+        return auth2Response = response;
     }
     }
 
 
     protected OAuth2Response createResponse(Supplier<Response> responseSupplier) {
     protected OAuth2Response createResponse(Supplier<Response> responseSupplier) {
         createNativeResponse(responseSupplier);
         createNativeResponse(responseSupplier);
         if (null != expiredCallBack) {
         if (null != expiredCallBack) {
             //判定token是否过期,过期后先执行回调进行操作如更新token,并尝试重新请求
             //判定token是否过期,过期后先执行回调进行操作如更新token,并尝试重新请求
-            auth2Response.judgeError(ErrorType.EXPIRED_TOKEN,() -> {
+            auth2Response.judgeError(ErrorType.EXPIRED_TOKEN, () -> {
 
 
                 //调用回调,并指定重试的操作(重新请求)
                 //调用回调,并指定重试的操作(重新请求)
                 expiredCallBack.call(() -> createNativeResponse(responseSupplier));
                 expiredCallBack.call(() -> createNativeResponse(responseSupplier));
@@ -141,14 +153,14 @@ public class SimpleOAuth2Request implements OAuth2Request {
         }
         }
         if (null != refreshTokenExpiredCallBack) {
         if (null != refreshTokenExpiredCallBack) {
             //判定token是否有效,无效的token将重新申请token
             //判定token是否有效,无效的token将重新申请token
-            auth2Response.judgeError(ErrorType.INVALID_TOKEN,() -> {
+            auth2Response.judgeError(ErrorType.INVALID_TOKEN, () -> {
                 //调用回调,并指定重试的操作(重新请求)
                 //调用回调,并指定重试的操作(重新请求)
                 refreshTokenExpiredCallBack.call(() -> createNativeResponse(responseSupplier));
                 refreshTokenExpiredCallBack.call(() -> createNativeResponse(responseSupplier));
                 //返回重试后的response
                 //返回重试后的response
                 return auth2Response;
                 return auth2Response;
             });
             });
             //判定refresh_token是否过期,过期后先执行回调进行操作如更新token,并尝试重新请求
             //判定refresh_token是否过期,过期后先执行回调进行操作如更新token,并尝试重新请求
-            auth2Response.judgeError(ErrorType.EXPIRED_REFRESH_TOKEN,() -> {
+            auth2Response.judgeError(ErrorType.EXPIRED_REFRESH_TOKEN, () -> {
                 //调用回调,并指定重试的操作(重新请求)
                 //调用回调,并指定重试的操作(重新请求)
                 refreshTokenExpiredCallBack.call(() -> createNativeResponse(responseSupplier));
                 refreshTokenExpiredCallBack.call(() -> createNativeResponse(responseSupplier));
                 //返回重试后的response
                 //返回重试后的response
@@ -156,7 +168,7 @@ public class SimpleOAuth2Request implements OAuth2Request {
             });
             });
 
 
             //如果是invalid token 也将重新生成token
             //如果是invalid token 也将重新生成token
-            auth2Response.judgeError(ErrorType.INVALID_TOKEN,() -> {
+            auth2Response.judgeError(ErrorType.INVALID_TOKEN, () -> {
                 //调用回调,并指定重试的操作(重新请求)
                 //调用回调,并指定重试的操作(重新请求)
                 refreshTokenExpiredCallBack.call(() -> createNativeResponse(responseSupplier));
                 refreshTokenExpiredCallBack.call(() -> createNativeResponse(responseSupplier));
                 //返回重试后的response
                 //返回重试后的response

+ 15 - 3
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/simple/request/SimpleOAuth2Response.java

@@ -19,6 +19,7 @@
 package org.hswebframework.web.authorization.oauth2.client.simple.request;
 package org.hswebframework.web.authorization.oauth2.client.simple.request;
 
 
 import org.hswebframework.expands.request.http.Response;
 import org.hswebframework.expands.request.http.Response;
+import org.hswebframework.web.authorization.oauth2.client.exception.OAuth2RequestException;
 import org.hswebframework.web.authorization.oauth2.client.request.ResponseConvertHandler;
 import org.hswebframework.web.authorization.oauth2.client.request.ResponseConvertHandler;
 import org.hswebframework.web.authorization.oauth2.client.request.ResponseJudge;
 import org.hswebframework.web.authorization.oauth2.client.request.ResponseJudge;
 import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
 import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
@@ -26,7 +27,10 @@ import org.hswebframework.web.authorization.oauth2.client.response.ResponseConve
 import org.hswebframework.web.oauth2.core.ErrorType;
 import org.hswebframework.web.oauth2.core.ErrorType;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
+import org.springframework.util.StreamUtils;
 
 
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.List;
 import java.util.List;
 import java.util.function.BiConsumer;
 import java.util.function.BiConsumer;
 import java.util.function.Supplier;
 import java.util.function.Supplier;
@@ -50,8 +54,9 @@ public class SimpleOAuth2Response implements OAuth2Response {
 
 
     private OAuth2Response proxy = this;
     private OAuth2Response proxy = this;
 
 
+    private InputStream inputStream;
 
 
-    public void judgeError(ErrorType ifError,Supplier<OAuth2Response> expiredCallBack) {
+    public void judgeError(ErrorType ifError, Supplier<OAuth2Response> expiredCallBack) {
 
 
         if (errorType == ifError) {
         if (errorType == ifError) {
             //尝试执行认证过时回调进行重试,并返回重试的结果
             //尝试执行认证过时回调进行重试,并返回重试的结果
@@ -64,7 +69,7 @@ public class SimpleOAuth2Response implements OAuth2Response {
 
 
                 if (type == ifError) {
                 if (type == ifError) {
                     //重试后依然是相同的错误,可能是错误类型判断错误或者服务端的问题?
                     //重试后依然是相同的错误,可能是错误类型判断错误或者服务端的问题?
-                    logger.error("still error [{}], maybe judge error or auth server error! {}",ifError,retryResponse,Thread.currentThread().getStackTrace());
+                    logger.error("still error [{}], maybe judge error or auth server error! {}", ifError, retryResponse, Thread.currentThread().getStackTrace());
                 } else {
                 } else {
                     errorType = type;
                     errorType = type;
                 }
                 }
@@ -78,11 +83,15 @@ public class SimpleOAuth2Response implements OAuth2Response {
                                 ResponseConvertHandler convertHandler,
                                 ResponseConvertHandler convertHandler,
                                 ResponseJudge responseJudge) {
                                 ResponseJudge responseJudge) {
         this.convertHandler = convertHandler;
         this.convertHandler = convertHandler;
-        data = UnCheck.unCheck(response::asBytes);
+        inputStream = UnCheck.unCheck(response::asStream);
         status = response.getCode();
         status = response.getCode();
         errorType = responseJudge.judge(this);
         errorType = responseJudge.judge(this);
     }
     }
 
 
+    public InputStream asStream() {
+        return inputStream;
+    }
+
     @Override
     @Override
     public String asString() {
     public String asString() {
         if (asBytes() == null) {
         if (asBytes() == null) {
@@ -93,6 +102,9 @@ public class SimpleOAuth2Response implements OAuth2Response {
 
 
     @Override
     @Override
     public byte[] asBytes() {
     public byte[] asBytes() {
+        if (data == null) {
+            data = UnCheck.unCheck(() -> StreamUtils.copyToByteArray(inputStream));
+        }
         return data;
         return data;
     }
     }
 
 

+ 20 - 1
hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/src/main/java/org/hswebframework/web/service/oauth2/AbstractOAuth2CrudService.java

@@ -2,10 +2,12 @@ package org.hswebframework.web.service.oauth2;
 
 
 import org.hswebframework.utils.ClassUtils;
 import org.hswebframework.utils.ClassUtils;
 import org.hswebframework.web.authorization.oauth2.client.OAuth2RequestService;
 import org.hswebframework.web.authorization.oauth2.client.OAuth2RequestService;
+import org.hswebframework.web.commons.entity.factory.EntityFactory;
+import org.hswebframework.web.service.CreateEntityService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 
 
 @SuppressWarnings("unchecked")
 @SuppressWarnings("unchecked")
-public abstract class AbstractOAuth2CrudService<E, PK> implements OAuth2CrudService<E, PK> {
+public abstract class AbstractOAuth2CrudService<E, PK> implements CreateEntityService<E>, OAuth2CrudService<E, PK> {
 
 
     private Class<E> entityType;
     private Class<E> entityType;
 
 
@@ -13,11 +15,23 @@ public abstract class AbstractOAuth2CrudService<E, PK> implements OAuth2CrudServ
 
 
     private OAuth2RequestService oAuth2RequestService;
     private OAuth2RequestService oAuth2RequestService;
 
 
+    private EntityFactory entityFactory;
+
     public AbstractOAuth2CrudService() {
     public AbstractOAuth2CrudService() {
         entityType = (Class) ClassUtils.getGenericType(this.getClass(), 0);
         entityType = (Class) ClassUtils.getGenericType(this.getClass(), 0);
         primaryKeyType = (Class) ClassUtils.getGenericType(this.getClass(), 1);
         primaryKeyType = (Class) ClassUtils.getGenericType(this.getClass(), 1);
     }
     }
 
 
+    @Override
+    public E createEntity() {
+        return entityFactory.newInstance(entityType);
+    }
+
+    @Override
+    public Class<E> getEntityInstanceType() {
+        return entityType;
+    }
+
     @Override
     @Override
     public OAuth2RequestService getRequestService() {
     public OAuth2RequestService getRequestService() {
         return oAuth2RequestService;
         return oAuth2RequestService;
@@ -39,6 +53,11 @@ public abstract class AbstractOAuth2CrudService<E, PK> implements OAuth2CrudServ
         return primaryKeyType;
         return primaryKeyType;
     }
     }
 
 
+    @Autowired
+    public void setEntityFactory(EntityFactory entityFactory) {
+        this.entityFactory = entityFactory;
+    }
+
     @Autowired
     @Autowired
     public void setoAuth2RequestService(OAuth2RequestService oAuth2RequestService) {
     public void setoAuth2RequestService(OAuth2RequestService oAuth2RequestService) {
         this.oAuth2RequestService = oAuth2RequestService;
         this.oAuth2RequestService = oAuth2RequestService;

+ 13 - 2
hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/src/test/java/org/hswebframework/web/service/oauth2/MockOAuth2Request.java

@@ -5,6 +5,7 @@ import org.hswebframework.web.authorization.oauth2.client.request.OAuth2Request;
 import org.hswebframework.web.authorization.oauth2.client.request.TokenExpiredCallBack;
 import org.hswebframework.web.authorization.oauth2.client.request.TokenExpiredCallBack;
 import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
 import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
 
 
+import java.io.InputStream;
 import java.util.Map;
 import java.util.Map;
 import java.util.function.Consumer;
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Function;
@@ -13,10 +14,10 @@ import java.util.function.Function;
 public class MockOAuth2Request implements OAuth2Request {
 public class MockOAuth2Request implements OAuth2Request {
 
 
 
 
-    private Function<String,OAuth2Response> responseGetter;
+    private Function<String, OAuth2Response> responseGetter;
 
 
 
 
-    public MockOAuth2Request(Function<String,OAuth2Response> responseGetter) {
+    public MockOAuth2Request(Function<String, OAuth2Response> responseGetter) {
         this.responseGetter = responseGetter;
         this.responseGetter = responseGetter;
     }
     }
 
 
@@ -42,6 +43,16 @@ public class MockOAuth2Request implements OAuth2Request {
         return this;
         return this;
     }
     }
 
 
+    @Override
+    public OAuth2Response upload(String name, InputStream inputStream) {
+        return responseGetter.apply("post");
+    }
+
+    @Override
+    public OAuth2Response upload(String name, InputStream inputStream, String fileName) {
+        return responseGetter.apply("post");
+    }
+
     @Override
     @Override
     public OAuth2Request requestBody(String value) {
     public OAuth2Request requestBody(String value) {
         log.info("set request body :{}", value);
         log.info("set request body :{}", value);

+ 7 - 0
hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/src/test/java/org/hswebframework/web/service/oauth2/MockOAuth2Response.java

@@ -8,6 +8,8 @@ import org.hswebframework.web.authorization.simple.builder.SimpleAuthenticationB
 import org.hswebframework.web.authorization.simple.builder.SimpleDataAccessConfigBuilderFactory;
 import org.hswebframework.web.authorization.simple.builder.SimpleDataAccessConfigBuilderFactory;
 import org.hswebframework.web.oauth2.core.ErrorType;
 import org.hswebframework.web.oauth2.core.ErrorType;
 
 
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
 import java.util.List;
 import java.util.List;
 import java.util.function.BiConsumer;
 import java.util.function.BiConsumer;
 
 
@@ -18,6 +20,11 @@ public class MockOAuth2Response implements OAuth2Response {
     private ResponseConvertHandler handler = new HswebResponseConvertSupport(new SimpleAuthenticationBuilderFactory(new SimpleDataAccessConfigBuilderFactory()));
     private ResponseConvertHandler handler = new HswebResponseConvertSupport(new SimpleAuthenticationBuilderFactory(new SimpleDataAccessConfigBuilderFactory()));
 
 
 
 
+    @Override
+    public InputStream asStream() {
+        return new ByteArrayInputStream(result.getBytes());
+    }
+
     public MockOAuth2Response(String result) {
     public MockOAuth2Response(String result) {
         this.result = result;
         this.result = result;
     }
     }

+ 1 - 2
hsweb-system/hsweb-system-file/hsweb-system-file-controller/src/main/java/org/hswebframework/web/controller/file/FileInfoController.java

@@ -4,9 +4,7 @@ import io.swagger.annotations.Api;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.hswebframework.web.commons.entity.param.QueryParamEntity;
 import org.hswebframework.web.controller.QueryController;
 import org.hswebframework.web.controller.QueryController;
-import org.hswebframework.web.controller.SimpleGenericEntityController;
 import org.hswebframework.web.entity.file.FileInfoEntity;
 import org.hswebframework.web.entity.file.FileInfoEntity;
-import org.hswebframework.web.logging.AccessLogger;
 import org.hswebframework.web.service.file.FileInfoService;
 import org.hswebframework.web.service.file.FileInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -35,4 +33,5 @@ public class FileInfoController implements QueryController<FileInfoEntity, Strin
     public FileInfoService getService() {
     public FileInfoService getService() {
         return fileInfoService;
         return fileInfoService;
     }
     }
+
 }
 }

+ 6 - 131
hsweb-system/hsweb-system-file/hsweb-system-file-entity/src/main/java/org/hswebframework/web/entity/file/SimpleFileInfoEntity.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.entity.file;
 package org.hswebframework.web.entity.file;
 
 
+import lombok.*;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 import org.hswebframework.web.commons.entity.SimpleGenericEntity;
 
 
 /**
 /**
@@ -7,6 +8,11 @@ import org.hswebframework.web.commons.entity.SimpleGenericEntity;
  *
  *
  * @author hsweb-generator-online
  * @author hsweb-generator-online
  */
  */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
 public class SimpleFileInfoEntity extends SimpleGenericEntity<String> implements FileInfoEntity {
 public class SimpleFileInfoEntity extends SimpleGenericEntity<String> implements FileInfoEntity {
     //文件名称
     //文件名称
     private String name;
     private String name;
@@ -27,135 +33,4 @@ public class SimpleFileInfoEntity extends SimpleGenericEntity<String> implements
     //创建人
     //创建人
     private String creatorId;
     private String creatorId;
 
 
-    /**
-     * @return 文件名称
-     */
-    @Override
-    public String getName() {
-        return this.name;
-    }
-
-    /**
-     * @param name 文件名称
-     */
-    @Override
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public String getLocation() {
-        return location;
-    }
-
-    @Override
-    public void setLocation(String location) {
-        this.location = location;
-    }
-
-    /**
-     * @return 类型
-     */
-    @Override
-    public String getType() {
-        return this.type;
-    }
-
-    /**
-     * @param type 类型
-     */
-    @Override
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    /**
-     * @return md5校验值
-     */
-    @Override
-    public String getMd5() {
-        return this.md5;
-    }
-
-    /**
-     * @param md5 md5校验值
-     */
-    @Override
-    public void setMd5(String md5) {
-        this.md5 = md5;
-    }
-
-    /**
-     * @return 文件大小
-     */
-    @Override
-    public Long getSize() {
-        return this.size;
-    }
-
-    /**
-     * @param size 文件大小
-     */
-    @Override
-    public void setSize(Long size) {
-        this.size = size;
-    }
-
-    /**
-     * @return 状态
-     */
-    @Override
-    public Byte getStatus() {
-        return this.status;
-    }
-
-    /**
-     * @param status 状态
-     */
-    @Override
-    public void setStatus(Byte status) {
-        this.status = status;
-    }
-
-    /**
-     * @return 分类
-     */
-    @Override
-    public String getClassified() {
-        return this.classified;
-    }
-
-    /**
-     * @param classified 分类
-     */
-    @Override
-    public void setClassified(String classified) {
-        this.classified = classified;
-    }
-
-    /**
-     * @return 创建人
-     */
-    @Override
-    public String getCreatorId() {
-        return this.creatorId;
-    }
-
-    @Override
-    public Long getCreateTime() {
-        return createTime;
-    }
-
-    @Override
-    public void setCreateTime(Long createTime) {
-        this.createTime = createTime;
-    }
-
-    /**
-     * @param creatorId 创建人
-     */
-    @Override
-    public void setCreatorId(String creatorId) {
-        this.creatorId = creatorId;
-    }
 }
 }

+ 26 - 0
hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/pom.xml

@@ -0,0 +1,26 @@
+<?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>hsweb-system-file-service</artifactId>
+        <groupId>org.hswebframework.web</groupId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hsweb-system-file-service-oauth2</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-file-service-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-commons-service-oauth2</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 28 - 0
hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/main/java/org/hswebframework/web/service/file/oauth2/OAuth2FileAutoConfiguration.java

@@ -0,0 +1,28 @@
+package org.hswebframework.web.service.file.oauth2;
+
+import org.hswebframework.web.authorization.oauth2.client.OAuth2RequestService;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author zhouhao
+ * @since 3.0
+ */
+@Configuration
+@ConditionalOnBean(OAuth2RequestService.class)
+public class OAuth2FileAutoConfiguration {
+
+    @ConfigurationProperties(prefix = "hsweb.oauth2.file-server")
+    @Bean
+    public OAuth2FileInfoService oAuth2FileInfoService() {
+        return new OAuth2FileInfoService();
+    }
+
+    @ConfigurationProperties(prefix = "hsweb.oauth2.file-server")
+    @Bean
+    public OAuth2FileService oAuth2FileService() {
+        return new OAuth2FileService();
+    }
+}

+ 50 - 0
hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/main/java/org/hswebframework/web/service/file/oauth2/OAuth2FileInfoService.java

@@ -0,0 +1,50 @@
+package org.hswebframework.web.service.file.oauth2;
+
+import org.hswebframework.web.commons.entity.param.QueryParamEntity;
+import org.hswebframework.web.entity.file.FileInfoEntity;
+import org.hswebframework.web.service.file.FileInfoService;
+import org.hswebframework.web.service.oauth2.AbstractOAuth2CrudService;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * @author zhouhao
+ * @since
+ */
+
+public class OAuth2FileInfoService extends AbstractOAuth2CrudService<FileInfoEntity, String> implements FileInfoService {
+
+    private String serviceId = "file-server";
+
+    private String uriPrefix = "file-info";
+
+    @Override
+    public FileInfoEntity selectByMd5(String md5) {
+        return selectSingle(QueryParamEntity
+                .single(FileInfoEntity.md5, md5));
+    }
+
+    @Override
+    public FileInfoEntity selectByIdOrMd5(String idOrMd5) {
+        return selectSingle(QueryParamEntity
+                .single(FileInfoEntity.id, idOrMd5)
+                .or(FileInfoEntity.md5, idOrMd5));
+    }
+
+    @Override
+    public String getServiceId() {
+        return serviceId;
+    }
+
+    @Override
+    public String getUriPrefix() {
+        return uriPrefix;
+    }
+
+    public void setServiceId(String serviceId) {
+        this.serviceId = serviceId;
+    }
+
+    public void setUriPrefix(String uriPrefix) {
+        this.uriPrefix = uriPrefix;
+    }
+}

+ 84 - 0
hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/main/java/org/hswebframework/web/service/file/oauth2/OAuth2FileService.java

@@ -0,0 +1,84 @@
+package org.hswebframework.web.service.file.oauth2;
+
+import org.hswebframework.web.authorization.oauth2.client.OAuth2RequestService;
+import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
+import org.hswebframework.web.entity.file.FileInfoEntity;
+import org.hswebframework.web.entity.file.SimpleFileInfoEntity;
+import org.hswebframework.web.service.file.FileService;
+import org.hswebframework.web.service.oauth2.OAuth2ServiceSupport;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.util.StreamUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author zhouhao
+ * @since 3.0
+ */
+@ConfigurationProperties(prefix = "hsweb.oauth2.file-server")
+public class OAuth2FileService implements FileService, OAuth2ServiceSupport {
+    private String serviceId = "file-server";
+
+    private String uriPrefix = "file";
+
+    @Autowired
+    private OAuth2RequestService requestService;
+
+    @Override
+    public InputStream readFile(String fileIdOrMd5) {
+        return createRequest("/md5/download/" + fileIdOrMd5)
+                .get()
+                .as(OAuth2Response::asStream);
+    }
+
+    @Override
+    public FileInfoEntity saveFile(InputStream fileStream, String fileName, String type, String creatorId) throws IOException {
+        return createRequest("/upload")
+                .upload("file", fileStream,fileName)
+                .as(getEntityType());
+    }
+
+    @Override
+    public String saveStaticFile(InputStream fileStream, String fileName) throws IOException {
+        return createRequest("/upload-static")
+                .upload("file", fileStream,fileName)
+                .as(String.class);
+    }
+
+    @Override
+    public void writeFile(String fileId, OutputStream out, long skip) throws IOException {
+        StreamUtils.copy(createRequest("/download/" + fileId)
+                .header("Range", "bytes=" + skip)
+                .get().asStream(), out);
+    }
+
+    @Override
+    public OAuth2RequestService getRequestService() {
+        return requestService;
+    }
+
+    @Override
+    public String getServiceId() {
+        return serviceId;
+    }
+
+    @Override
+    public String getUriPrefix() {
+        return uriPrefix;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Class<SimpleFileInfoEntity> getEntityType() {
+        return SimpleFileInfoEntity.class;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Class<String> getPrimaryKeyType() {
+        return String.class;
+    }
+}

+ 3 - 0
hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/main/resources/META-INF/spring.factories

@@ -0,0 +1,3 @@
+# Auto Configure
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.hswebframework.web.service.file.oauth2.OAuth2FileAutoConfiguration

+ 109 - 0
hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/test/java/org/hswebframework/web/service/file/oauth2/MockOAuth2Request.java

@@ -0,0 +1,109 @@
+package org.hswebframework.web.service.file.oauth2;
+
+import lombok.extern.slf4j.Slf4j;
+import org.hswebframework.web.authorization.oauth2.client.request.OAuth2Request;
+import org.hswebframework.web.authorization.oauth2.client.request.TokenExpiredCallBack;
+import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
+
+import java.io.InputStream;
+import java.util.Map;
+import java.util.function.Consumer;
+import java.util.function.Function;
+
+@Slf4j
+public class MockOAuth2Request implements OAuth2Request {
+
+    private Function<String, OAuth2Response> responseGetter;
+
+    public MockOAuth2Request(Function<String, OAuth2Response> responseGetter) {
+        this.responseGetter = responseGetter;
+    }
+
+    @Override
+    public OAuth2Request onRefreshTokenExpired(TokenExpiredCallBack refreshTokenExpiredCallBack) {
+        return this;
+    }
+
+    @Override
+    public OAuth2Request onTokenExpired(TokenExpiredCallBack callback) {
+        return this;
+    }
+
+    @Override
+    public OAuth2Request param(String name, Object value) {
+        log.info("set param :{}={}", name, value);
+        return this;
+    }
+
+    @Override
+    public OAuth2Request params(Map<String, String> params) {
+        log.info("set params :{}", params);
+        return this;
+    }
+
+    @Override
+    public OAuth2Response upload(String name, InputStream inputStream) {
+        return responseGetter.apply("post");
+    }
+
+    @Override
+    public OAuth2Response upload(String name, InputStream inputStream, String fileName) {
+        return responseGetter.apply("post");
+    }
+
+    @Override
+    public OAuth2Request requestBody(String value) {
+        log.info("set request body :{}", value);
+        return this;
+    }
+
+    @Override
+    public OAuth2Request header(String name, String value) {
+        return this;
+    }
+
+    @Override
+    public OAuth2Request cookie(String cookie) {
+        return this;
+    }
+
+    @Override
+    public OAuth2Request contentType(String contentType) {
+        return this;
+    }
+
+    @Override
+    public OAuth2Request accept(String accept) {
+        return this;
+    }
+
+    @Override
+    public OAuth2Request timeout(long millisecond, Consumer<OAuth2Request> timeoutCallBack) {
+        return this;
+    }
+
+    @Override
+    public OAuth2Response get() {
+        return responseGetter.apply("get");
+    }
+
+    @Override
+    public OAuth2Response put() {
+        return responseGetter.apply("put");
+    }
+
+    @Override
+    public OAuth2Response post() {
+        return responseGetter.apply("post");
+    }
+
+    @Override
+    public OAuth2Response delete() {
+        return responseGetter.apply("delete");
+    }
+
+    @Override
+    public OAuth2Response patch() {
+        return responseGetter.apply("patch");
+    }
+}

+ 71 - 0
hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/test/java/org/hswebframework/web/service/file/oauth2/MockOAuth2Response.java

@@ -0,0 +1,71 @@
+package org.hswebframework.web.service.file.oauth2;
+
+import org.hswebframework.web.authorization.oauth2.client.request.ResponseConvertHandler;
+import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response;
+import org.hswebframework.web.authorization.oauth2.client.response.ResponseConvert;
+import org.hswebframework.web.authorization.oauth2.client.simple.provider.HswebResponseConvertSupport;
+import org.hswebframework.web.authorization.simple.builder.SimpleAuthenticationBuilderFactory;
+import org.hswebframework.web.authorization.simple.builder.SimpleDataAccessConfigBuilderFactory;
+import org.hswebframework.web.oauth2.core.ErrorType;
+import org.springframework.util.StreamUtils;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.function.BiConsumer;
+
+public class MockOAuth2Response implements OAuth2Response {
+
+    private InputStream result;
+
+    private ResponseConvertHandler handler = new HswebResponseConvertSupport(new SimpleAuthenticationBuilderFactory(new SimpleDataAccessConfigBuilderFactory()));
+
+    @Override
+    public InputStream asStream() {
+        return result;
+    }
+
+    public MockOAuth2Response(InputStream result) {
+        this.result = result;
+    }
+
+    @Override
+    public String asString() {
+        return new String(asBytes());
+    }
+
+    @Override
+    public byte[] asBytes() {
+        try {
+            return StreamUtils.copyToByteArray(result);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public <T> T as(ResponseConvert<T> convert) {
+        return convert.convert(this);
+    }
+
+    @Override
+    public <T> T as(Class<T> type) {
+        return handler.convert(this, type);
+    }
+
+    @Override
+    public <T> List<T> asList(Class<T> type) {
+        return handler.convertList(this, type);
+    }
+
+    @Override
+    public int status() {
+        return 200;
+    }
+
+    @Override
+    public OAuth2Response onError(BiConsumer<OAuth2Response, ErrorType> onError) {
+        return this;
+    }
+}

+ 111 - 0
hsweb-system/hsweb-system-file/hsweb-system-file-service/hsweb-system-file-service-oauth2/src/test/java/org/hswebframework/web/service/file/oauth2/OAuth2FileServiceTest.java

@@ -0,0 +1,111 @@
+package org.hswebframework.web.service.file.oauth2;
+
+import com.alibaba.fastjson.JSON;
+import org.hswebframework.web.authorization.oauth2.client.OAuth2RequestService;
+import org.hswebframework.web.authorization.oauth2.client.OAuth2SessionBuilder;
+import org.hswebframework.web.authorization.oauth2.client.request.OAuth2Request;
+import org.hswebframework.web.authorization.oauth2.client.request.OAuth2Session;
+import org.hswebframework.web.commons.entity.PagerResult;
+import org.hswebframework.web.controller.message.ResponseMessage;
+import org.hswebframework.web.entity.file.FileInfoEntity;
+import org.hswebframework.web.entity.file.SimpleFileInfoEntity;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+/**
+ * @author zhouhao
+ * @since
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OAuth2FileServiceTest {
+
+    @InjectMocks
+    private OAuth2FileService fileService = new OAuth2FileService();
+
+    @Mock
+    private OAuth2RequestService auth2RequestService;
+
+    @Mock
+    private OAuth2Session oAuth2Session;
+
+    @Before
+    public void init() {
+        when(oAuth2Session.request("file/download/test")).thenReturn(
+                createFixedResponseRequest(
+                        whenRequest("get", new ByteArrayInputStream("test".getBytes())))
+        );
+
+        when(oAuth2Session.request("file/upload")).thenReturn(
+                createFixedResponseRequest(
+                        whenRequest("post", ResponseMessage.ok(SimpleFileInfoEntity.builder()
+                                .md5("test")
+                                .build()).toString()))
+        );
+
+        when(oAuth2Session.request("file/upload-static")).thenReturn(
+                createFixedResponseRequest(
+                        whenRequest("post", ResponseMessage.ok("http://file-server/upload/test.png").toString())));
+        OAuth2SessionBuilder builder = mock(OAuth2SessionBuilder.class);
+        when(builder.byClientCredentials()).thenReturn(oAuth2Session);
+
+        when(auth2RequestService.create(anyString())).thenReturn(builder);
+
+    }
+
+    @Test
+    public void uploadTest() throws IOException {
+        String staticFile = fileService.saveStaticFile(new ByteArrayInputStream("test".getBytes()), "test");
+        Assert.assertEquals(staticFile, "http://file-server/upload/test.png");
+        FileInfoEntity entity = fileService.saveFile(new ByteArrayInputStream("test".getBytes()), "test", "text/plain", "admin");
+        Assert.assertNotNull(entity);
+        Assert.assertEquals(entity.getMd5(), "test");
+    }
+
+    interface OAuth2MethodRequest {
+        String getMethod();
+
+        InputStream getResponse();
+    }
+
+    public OAuth2MethodRequest whenRequest(String method, String json) {
+        return whenRequest(method, new ByteArrayInputStream(json.getBytes()));
+    }
+
+    public OAuth2MethodRequest whenRequest(String method, InputStream stream) {
+        return new OAuth2MethodRequest() {
+            @Override
+            public String getMethod() {
+                return method;
+            }
+
+            @Override
+            public InputStream getResponse() {
+                return stream;
+            }
+        };
+    }
+
+    private OAuth2Request createFixedResponseRequest(OAuth2MethodRequest... requests) {
+        return new MockOAuth2Request((method) -> {
+            for (OAuth2MethodRequest request : requests) {
+                if (request.getMethod().equals(method)) {
+                    return new MockOAuth2Response(request.getResponse());
+                }
+            }
+            return new MockOAuth2Response(new ByteArrayInputStream(ResponseMessage.error(404, "not found").toString().getBytes()));
+        });
+    }
+}

+ 1 - 0
hsweb-system/hsweb-system-file/hsweb-system-file-service/pom.xml

@@ -14,6 +14,7 @@
     <modules>
     <modules>
         <module>hsweb-system-file-service-api</module>
         <module>hsweb-system-file-service-api</module>
         <module>hsweb-system-file-service-simple</module>
         <module>hsweb-system-file-service-simple</module>
+        <module>hsweb-system-file-service-oauth2</module>
     </modules>
     </modules>
 
 
 
 

+ 1 - 0
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/pom.xml

@@ -69,6 +69,7 @@
             <groupId>org.hswebframework.web</groupId>
             <groupId>org.hswebframework.web</groupId>
             <artifactId>hsweb-authorization-basic</artifactId>
             <artifactId>hsweb-authorization-basic</artifactId>
             <version>${project.version}</version>
             <version>${project.version}</version>
+            <optional>true</optional>
         </dependency>
         </dependency>
     </dependencies>
     </dependencies>
 </project>
 </project>

+ 1 - 2
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/src/main/resources/META-INF/spring.factories

@@ -1,4 +1,3 @@
 # Auto Configure
 # Auto Configure
 org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
 org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.hswebframework.web.oauth2.OAuth2GranterAutoConfiguration,\
-  org.hswebframework.web.oauth2.OAuth2AuthorizationAutoConfiguration
+org.hswebframework.web.oauth2.OAuth2GranterAutoConfiguration

+ 23 - 20
pom.xml

@@ -99,7 +99,7 @@
 
 
         <hsweb.ezorm.version>3.0.1-SNAPSHOT</hsweb.ezorm.version>
         <hsweb.ezorm.version>3.0.1-SNAPSHOT</hsweb.ezorm.version>
         <hsweb.utils.version>3.0.2</hsweb.utils.version>
         <hsweb.utils.version>3.0.2</hsweb.utils.version>
-        <hsweb.expands.version>3.0.0</hsweb.expands.version>
+        <hsweb.expands.version>3.0.2-SNAPSHOT</hsweb.expands.version>
 
 
         <swagger.version>2.7.0</swagger.version>
         <swagger.version>2.7.0</swagger.version>
     </properties>
     </properties>
@@ -326,22 +326,28 @@
                 <version>1.9.3</version>
                 <version>1.9.3</version>
             </dependency>
             </dependency>
 
 
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring.boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+
             <dependency>
             <dependency>
                 <groupId>org.hswebframework</groupId>
                 <groupId>org.hswebframework</groupId>
-                <artifactId>hsweb-utils</artifactId>
-                <version>${hsweb.utils.version}</version>
+                <artifactId>hsweb-easy-orm</artifactId>
+                <version>${hsweb.ezorm.version}</version>
                 <exclusions>
                 <exclusions>
+                    <exclusion>
+                        <groupId>org.hswebframework</groupId>
+                        <artifactId>hsweb-expands-script</artifactId>
+                    </exclusion>
                     <exclusion>
                     <exclusion>
                         <groupId>com.alibaba</groupId>
                         <groupId>com.alibaba</groupId>
                         <artifactId>fastjson</artifactId>
                         <artifactId>fastjson</artifactId>
                     </exclusion>
                     </exclusion>
                 </exclusions>
                 </exclusions>
-            </dependency>
-
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-dependencies</artifactId>
-                <version>${spring.boot.version}</version>
                 <type>pom</type>
                 <type>pom</type>
                 <scope>import</scope>
                 <scope>import</scope>
             </dependency>
             </dependency>
@@ -366,18 +372,15 @@
 
 
             <dependency>
             <dependency>
                 <groupId>org.hswebframework</groupId>
                 <groupId>org.hswebframework</groupId>
-                <artifactId>hsweb-easy-orm</artifactId>
-                <version>${hsweb.ezorm.version}</version>
+                <artifactId>hsweb-utils</artifactId>
+                <version>${hsweb.utils.version}</version>
                 <exclusions>
                 <exclusions>
                     <exclusion>
                     <exclusion>
                         <groupId>com.alibaba</groupId>
                         <groupId>com.alibaba</groupId>
                         <artifactId>fastjson</artifactId>
                         <artifactId>fastjson</artifactId>
                     </exclusion>
                     </exclusion>
                 </exclusions>
                 </exclusions>
-                <type>pom</type>
-                <scope>import</scope>
             </dependency>
             </dependency>
-
         </dependencies>
         </dependencies>
     </dependencyManagement>
     </dependencyManagement>
 
 
@@ -415,12 +418,12 @@
 
 
     <pluginRepositories>
     <pluginRepositories>
         <!--<pluginRepository>-->
         <!--<pluginRepository>-->
-            <!--<id>hsweb-nexus</id>-->
-            <!--<name>Nexus Release Repository</name>-->
-            <!--<url>http://nexus.hsweb.me/content/groups/public/</url>-->
-            <!--<snapshots>-->
-                <!--<enabled>true</enabled>-->
-            <!--</snapshots>-->
+        <!--<id>hsweb-nexus</id>-->
+        <!--<name>Nexus Release Repository</name>-->
+        <!--<url>http://nexus.hsweb.me/content/groups/public/</url>-->
+        <!--<snapshots>-->
+        <!--<enabled>true</enabled>-->
+        <!--</snapshots>-->
         <!--</pluginRepository>-->
         <!--</pluginRepository>-->
         <pluginRepository>
         <pluginRepository>
             <id>aliyun-nexus</id>
             <id>aliyun-nexus</id>