diff --git a/pom.xml b/pom.xml index c18418ca5..5a2c8b1f0 100644 --- a/pom.xml +++ b/pom.xml @@ -29,8 +29,6 @@ 3.4.3.4 3.9.1 5.7.15 - 3.0.3 - 11.6 4.9.1 2.5.2 3.16.3 @@ -168,25 +166,6 @@ ${hutool.version} - - - org.springframework.cloud - spring-cloud-starter-openfeign - ${feign.version} - - - feign-core - io.github.openfeign - - - - - - io.github.openfeign - feign-okhttp - ${feign-okhttp.version} - - com.squareup.okhttp3 okhttp @@ -245,12 +224,6 @@ - - com.yomahub - tlog-feign - ${tlog.version} - - com.yomahub tlog-xxl-job diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 7acd7efcd..cd53e4a37 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -242,22 +242,6 @@ thread-pool: # ABORT_POLICY 中止 rejectedExecutionHandler: CALLER_RUNS_POLICY -# feign 相关配置 -feign: - # 不支持多包, 如有需要可在注解配置 或 提升扫包等级 - # 例如 com.**.**.feign - package: com.ruoyi.**.feign - # 开启压缩 - compression: - request: - enabled: true - response: - enabled: true - okhttp: - enabled: true - circuitbreaker: - enabled: true - --- # redisson 缓存配置 redisson: cacheGroup: diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 12f14a06e..9b5af9876 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -117,18 +117,6 @@ lombok - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - - - io.github.openfeign - feign-okhttp - - de.codecentric spring-boot-admin-starter-client @@ -175,10 +163,6 @@ tlog-webroot - - com.yomahub - tlog-feign - diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java deleted file mode 100644 index 7de92e24c..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ruoyi.common.exception.file; - -import lombok.*; -import org.apache.commons.fileupload.FileUploadException; - -import java.util.Arrays; - -/** - * 文件上传 误异常类 - * - * @author ruoyi - */ -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -public class InvalidExtensionException extends FileUploadException { - private static final long serialVersionUID = 1L; - - private String[] allowedExtension; - private String extension; - private String filename; - - public InvalidExtensionException(String[] allowedExtension, String extension, String filename) { - super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]"); - this.allowedExtension = allowedExtension; - this.extension = extension; - this.filename = filename; - } - - public static class InvalidImageExtensionException extends InvalidExtensionException { - private static final long serialVersionUID = 1L; - - public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) { - super(allowedExtension, extension, filename); - } - } - - public static class InvalidFlashExtensionException extends InvalidExtensionException { - private static final long serialVersionUID = 1L; - - public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) { - super(allowedExtension, extension, filename); - } - } - - public static class InvalidMediaExtensionException extends InvalidExtensionException { - private static final long serialVersionUID = 1L; - - public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) { - super(allowedExtension, extension, filename); - } - } - - public static class InvalidVideoExtensionException extends InvalidExtensionException { - private static final long serialVersionUID = 1L; - - public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) { - super(allowedExtension, extension, filename); - } - } -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/FeignTestController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/FeignTestController.java deleted file mode 100644 index 2f833e33e..000000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/FeignTestController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ruoyi.demo.controller; - -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.demo.feign.FeignTestService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * feign测试controller - * - * @author Lion Li - * @deprecated 由于使用人数较少 决定与 3.4.0 版本移除 - */ -@Api(value = "feign测试", tags = {"feign测试"}) -@RequiredArgsConstructor(onConstructor_ = @Autowired) -@RestController -@RequestMapping("/feign/test") -public class FeignTestController { - - private final FeignTestService feignTestService; - - /** - * 搜索数据 - */ - @ApiOperation("测试使用feign请求数据") - @GetMapping("/search/{wd}") - public AjaxResult search(@PathVariable String wd) { - String search = feignTestService.search(wd); - return AjaxResult.success("操作成功",search); - } -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/FeignTestService.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/FeignTestService.java deleted file mode 100644 index 50eb4ebf6..000000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/FeignTestService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ruoyi.demo.feign; - -import com.ruoyi.demo.feign.constant.FeignTestConstant; -import com.ruoyi.demo.feign.fallback.FeignTestFallback; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; - -/** - * feign测试service - * 规范接口 Service 无感调用 - * 常量管理请求路径 更加规范 - * 自定义容错处理 安全可靠 (需自行配置熔断器) - * 增加 feign 的目的为使 http 请求接口化 - * - * @author Lion Li - * @deprecated 由于使用人数较少 决定与 3.4.0 版本移除 - */ -@FeignClient( - name = FeignTestConstant.BAIDU_NAME, - url = FeignTestConstant.BAIDU_URL, - fallback = FeignTestFallback.class) -public interface FeignTestService { - - @GetMapping("/s") - String search(@RequestParam("wd") String wd); -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/constant/FeignTestConstant.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/constant/FeignTestConstant.java deleted file mode 100644 index 28dfa8adb..000000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/constant/FeignTestConstant.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ruoyi.demo.feign.constant; - -/** - * @deprecated 由于使用人数较少 决定与 3.4.0 版本移除 - */ -@Deprecated -public class FeignTestConstant { - - public static final String BAIDU_NAME = "baidu"; - - public static final String BAIDU_URL = "http://www.baidu.com"; - -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/fallback/FeignTestFallback.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/fallback/FeignTestFallback.java deleted file mode 100644 index 8e81ad7ad..000000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/fallback/FeignTestFallback.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ruoyi.demo.feign.fallback; - - -import com.ruoyi.demo.feign.FeignTestService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -/** - * feign测试fallback - * 自定义封装结构体熔断 - * 需重写解码器 根据自定义实体 自行解析熔断 - * - * 熔断器需要自行添加配置 - * - * @see {com.ruoyi.framework.config.FeignConfig#errorDecoder()} - * @author Lion Li - * @deprecated 由于使用人数较少 决定与 3.4.0 版本移除 - */ -@Slf4j -@Component -public class FeignTestFallback implements FeignTestService { - - @Override - public String search(String wd) { - log.error("fallback"); - return "报错啦"; - } -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/fallback/package-info.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/fallback/package-info.java deleted file mode 100644 index 47983a0e1..000000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/fallback/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.ruoyi.demo.feign.fallback; \ No newline at end of file diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/package-info.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/package-info.java deleted file mode 100644 index 91e4b4a5b..000000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/feign/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.ruoyi.demo.feign; \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FeignConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FeignConfig.java deleted file mode 100644 index 8b432ad89..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FeignConfig.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.ruoyi.framework.config; - -import feign.*; -import okhttp3.ConnectionPool; -import okhttp3.OkHttpClient; -import org.springframework.boot.autoconfigure.AutoConfigureBefore; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.cloud.openfeign.FeignAutoConfiguration; -import org.springframework.cloud.openfeign.support.SpringMvcContract; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.util.concurrent.TimeUnit; - -/** - * openfeign配置类 - * - * @author Lion Li - * @deprecated 由于使用人数较少 决定与 3.4.0 版本移除 - */ -@Deprecated -@EnableFeignClients("${feign.package}") -@Configuration -@ConditionalOnClass(Feign.class) -@AutoConfigureBefore(FeignAutoConfiguration.class) -public class FeignConfig { - - @Bean - public OkHttpClient okHttpClient(){ - return new OkHttpClient.Builder() - .readTimeout(60, TimeUnit.SECONDS) - .connectTimeout(60, TimeUnit.SECONDS) - .writeTimeout(120, TimeUnit.SECONDS) - .connectionPool(new ConnectionPool()) - .build(); - } - - @Bean - public Contract feignContract() { - return new SpringMvcContract(); - } - - @Bean - public Logger.Level feignLoggerLevel() { - return Logger.Level.BASIC; - } - - @Bean - public Request.Options feignRequestOptions() { - return new Request.Options(10, TimeUnit.SECONDS, 60,TimeUnit.SECONDS,true); - } - - @Bean - public Retryer feignRetry() { - return new Retryer.Default(); - } - -// /** -// * 自定义异常解码器 -// * 用于自定义返回体异常熔断 -// */ -// @Bean -// public ErrorDecoder errorDecoder() { -// return new CustomErrorDecoder(); -// } -// -// -// /** -// * 自定义返回体解码器 -// */ -// @Slf4j -// public static class CustomErrorDecoder implements ErrorDecoder { -// -// @Override -// public Exception decode(String methodKey, Response response) { -// Exception exception = null; -// try { -// // 获取原始的返回内容 -// String json = JsonUtils.toJsonString(response.body().asReader(StandardCharsets.UTF_8)); -// exception = new RuntimeException(json); -// // 将返回内容反序列化为Result,这里应根据自身项目作修改 -// AjaxResult result = JsonUtils.parseObject(json, AjaxResult.class); -// // 业务异常抛出简单的 RuntimeException,保留原来错误信息 -// if (result.getCode() != 200) { -// exception = new RuntimeException(result.getMsg()); -// } -// } catch (IOException e) { -// log.error(e.getMessage(), e); -// } -// return exception; -// } -// } - -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java index 48b341beb..20b52a8e2 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java @@ -1,7 +1,6 @@ package com.ruoyi.framework.config; import cn.hutool.core.util.StrUtil; -import org.jetbrains.annotations.NotNull; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.LocaleResolver; @@ -28,7 +27,6 @@ public class I18nConfig { */ static class I18nLocaleResolver implements LocaleResolver { - @NotNull @Override public Locale resolveLocale(HttpServletRequest httpServletRequest) { String language = httpServletRequest.getHeader("content-language"); @@ -41,7 +39,7 @@ public class I18nConfig { } @Override - public void setLocale(@NotNull HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) { + public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) { } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/TLogConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/TLogConfig.java index 68bc425d6..c1665d9b0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/TLogConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/TLogConfig.java @@ -1,7 +1,6 @@ package com.ruoyi.framework.config; import com.yomahub.tlog.core.aop.AspectLogAop; -import com.yomahub.tlog.feign.filter.TLogFeignFilter; import com.yomahub.tlog.spring.TLogPropertyInit; import com.yomahub.tlog.spring.TLogSpringAware; import com.yomahub.tlog.springboot.property.TLogProperty; @@ -41,9 +40,4 @@ public class TLogConfig { return new AspectLogAop(); } - @Bean - public TLogFeignFilter tLogFeignFilter() { - return new TLogFeignFilter(); - } - } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 649d1dc67..b90addf71 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -1,6 +1,7 @@ package com.ruoyi.generator.controller; import cn.hutool.core.convert.Convert; +import cn.hutool.core.io.IoUtil; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -13,7 +14,6 @@ import com.ruoyi.generator.service.IGenTableService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -201,6 +201,6 @@ public class GenController extends BaseController { response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\""); response.addHeader("Content-Length", "" + data.length); response.setContentType("application/octet-stream; charset=UTF-8"); - IOUtils.write(data, response.getOutputStream()); + IoUtil.write(response.getOutputStream(), false, data); } -} \ No newline at end of file +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 62fe67a3a..b53393f0c 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -2,6 +2,7 @@ package com.ruoyi.generator.service; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; +import cn.hutool.core.io.IoUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.GenConstants; @@ -21,7 +22,7 @@ import com.ruoyi.generator.util.GenUtils; import com.ruoyi.generator.util.VelocityInitializer; import com.ruoyi.generator.util.VelocityUtils; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.io.IOUtils; +import org.apache.poi.util.IOUtils; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; @@ -33,6 +34,7 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.StringWriter; +import java.nio.charset.StandardCharsets; import java.util.*; import java.util.stream.Collectors; import java.util.zip.ZipEntry; @@ -341,8 +343,8 @@ public class GenTableServiceImpl extends ServicePlusImpl