remove 移除 feign 相关代码与依赖
This commit is contained in:
parent
95dcae1a85
commit
8a93371baa
27
pom.xml
27
pom.xml
@ -29,8 +29,6 @@
|
|||||||
<mybatis-plus.version>3.4.3.4</mybatis-plus.version>
|
<mybatis-plus.version>3.4.3.4</mybatis-plus.version>
|
||||||
<p6spy.version>3.9.1</p6spy.version>
|
<p6spy.version>3.9.1</p6spy.version>
|
||||||
<hutool.version>5.7.15</hutool.version>
|
<hutool.version>5.7.15</hutool.version>
|
||||||
<feign.version>3.0.3</feign.version>
|
|
||||||
<feign-okhttp.version>11.6</feign-okhttp.version>
|
|
||||||
<okhttp.version>4.9.1</okhttp.version>
|
<okhttp.version>4.9.1</okhttp.version>
|
||||||
<spring-boot-admin.version>2.5.2</spring-boot-admin.version>
|
<spring-boot-admin.version>2.5.2</spring-boot-admin.version>
|
||||||
<redisson.version>3.16.3</redisson.version>
|
<redisson.version>3.16.3</redisson.version>
|
||||||
@ -168,25 +166,6 @@
|
|||||||
<version>${hutool.version}</version>
|
<version>${hutool.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- @deprecated 由于使用人数较少 决定与 3.4.0 版本移除 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
||||||
<version>${feign.version}</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>feign-core</artifactId>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<!-- @deprecated 由于使用人数较少 决定与 3.4.0 版本移除 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-okhttp</artifactId>
|
|
||||||
<version>${feign-okhttp.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
<artifactId>okhttp</artifactId>
|
<artifactId>okhttp</artifactId>
|
||||||
@ -245,12 +224,6 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.yomahub</groupId>
|
|
||||||
<artifactId>tlog-feign</artifactId>
|
|
||||||
<version>${tlog.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.yomahub</groupId>
|
<groupId>com.yomahub</groupId>
|
||||||
<artifactId>tlog-xxl-job</artifactId>
|
<artifactId>tlog-xxl-job</artifactId>
|
||||||
|
@ -242,22 +242,6 @@ thread-pool:
|
|||||||
# ABORT_POLICY 中止
|
# ABORT_POLICY 中止
|
||||||
rejectedExecutionHandler: CALLER_RUNS_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 缓存配置
|
||||||
redisson:
|
redisson:
|
||||||
cacheGroup:
|
cacheGroup:
|
||||||
|
@ -117,18 +117,6 @@
|
|||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- @deprecated 由于使用人数较少 决定与 3.4.0 版本移除 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- @deprecated 由于使用人数较少 决定与 3.4.0 版本移除 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-okhttp</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.codecentric</groupId>
|
<groupId>de.codecentric</groupId>
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
@ -175,10 +163,6 @@
|
|||||||
<artifactId>tlog-webroot</artifactId>
|
<artifactId>tlog-webroot</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.yomahub</groupId>
|
|
||||||
<artifactId>tlog-feign</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
@ -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";
|
|
||||||
|
|
||||||
}
|
|
@ -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 "报错啦";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
package com.ruoyi.demo.feign.fallback;
|
|
@ -1 +0,0 @@
|
|||||||
package com.ruoyi.demo.feign;
|
|
@ -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;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +1,6 @@
|
|||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.framework.config;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.LocaleResolver;
|
import org.springframework.web.servlet.LocaleResolver;
|
||||||
@ -28,7 +27,6 @@ public class I18nConfig {
|
|||||||
*/
|
*/
|
||||||
static class I18nLocaleResolver implements LocaleResolver {
|
static class I18nLocaleResolver implements LocaleResolver {
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public Locale resolveLocale(HttpServletRequest httpServletRequest) {
|
public Locale resolveLocale(HttpServletRequest httpServletRequest) {
|
||||||
String language = httpServletRequest.getHeader("content-language");
|
String language = httpServletRequest.getHeader("content-language");
|
||||||
@ -41,7 +39,7 @@ public class I18nConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLocale(@NotNull HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) {
|
public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.framework.config;
|
||||||
|
|
||||||
import com.yomahub.tlog.core.aop.AspectLogAop;
|
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.TLogPropertyInit;
|
||||||
import com.yomahub.tlog.spring.TLogSpringAware;
|
import com.yomahub.tlog.spring.TLogSpringAware;
|
||||||
import com.yomahub.tlog.springboot.property.TLogProperty;
|
import com.yomahub.tlog.springboot.property.TLogProperty;
|
||||||
@ -41,9 +40,4 @@ public class TLogConfig {
|
|||||||
return new AspectLogAop();
|
return new AspectLogAop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public TLogFeignFilter tLogFeignFilter() {
|
|
||||||
return new TLogFeignFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.generator.controller;
|
package com.ruoyi.generator.controller;
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
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.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -201,6 +201,6 @@ public class GenController extends BaseController {
|
|||||||
response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
|
response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
|
||||||
response.addHeader("Content-Length", "" + data.length);
|
response.addHeader("Content-Length", "" + data.length);
|
||||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||||
IOUtils.write(data, response.getOutputStream());
|
IoUtil.write(response.getOutputStream(), false, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package com.ruoyi.generator.service;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.constant.GenConstants;
|
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.VelocityInitializer;
|
||||||
import com.ruoyi.generator.util.VelocityUtils;
|
import com.ruoyi.generator.util.VelocityUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.Template;
|
||||||
import org.apache.velocity.VelocityContext;
|
import org.apache.velocity.VelocityContext;
|
||||||
import org.apache.velocity.app.Velocity;
|
import org.apache.velocity.app.Velocity;
|
||||||
@ -33,6 +34,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
@ -341,8 +343,8 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
|||||||
try {
|
try {
|
||||||
// 添加到zip
|
// 添加到zip
|
||||||
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
|
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
|
||||||
IOUtils.write(sw.toString(), zip, Constants.UTF8);
|
IoUtil.write(zip, StandardCharsets.UTF_8, false, sw.toString());
|
||||||
IOUtils.closeQuietly(sw);
|
IoUtil.close(sw);
|
||||||
zip.flush();
|
zip.flush();
|
||||||
zip.closeEntry();
|
zip.closeEntry();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user