Commit 57ed9887 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/master'

parents 413c2373 f7ceaf9c
......@@ -40,11 +40,6 @@
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>-->
<!--断路器依赖-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-feign</artifactId>
</dependency>
<!--upms api、model 模块-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
......
package com.yifu.cloud.plus.v1.yifu.auth.util;
import com.alibaba.cloud.commons.lang.StringUtils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.Charsets;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.*;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/**
* @author fxj *
* @date 2022年05月27日 11:01
* @description
*/
public class MyHttpRequest extends HttpServletRequestWrapper {
private String body;
public MyHttpRequest(HttpServletRequest request) throws IOException {
super(request);
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = null;
try {
InputStream inputStream = request.getInputStream();
if (inputStream != null) {
bufferedReader = new BufferedReader(new InputStreamReader(inputStream,"UTF-8"));
char[] charBuffer = new char[128];
int bytesRead = -1;
while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
stringBuilder.append(charBuffer, 0, bytesRead);
}
} else {
stringBuilder.append("");
}
} catch (IOException ex) {
throw ex;
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException ex) {
throw ex;
}
}
}
body = stringBuilder.toString();
}
@Override
public ServletInputStream getInputStream() throws IOException {
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body.getBytes("UTF-8"));
ServletInputStream servletInputStream = new ServletInputStream() {
@Override
public boolean isFinished() {
return false;
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() throws IOException {
return byteArrayInputStream.read();
}
};
return servletInputStream;
}
@Override
public BufferedReader getReader() throws IOException {
return new BufferedReader(new InputStreamReader(this.getInputStream(), Charsets.UTF_8));
}
public String getBody() {
return this.body;
}
@Override
public String getParameter(String name) {
return super.getParameter(name);
}
@Override
public Map<String, String[]> getParameterMap() {
return super.getParameterMap();
}
@Override
public Enumeration<String> getParameterNames() {
return super.getParameterNames();
}
@Override
public String[] getParameterValues(String name) {
return super.getParameterValues(name);
}
/**
* 设置自定义post参数 //
*
* @param paramMaps
* @return
*/
public void setParamsMaps(Map paramMaps) {
Map paramBodyMap = new HashMap();
if (!StringUtils.isEmpty(body)) {
paramBodyMap = JSONObject.parseObject(body, Map.class);
}
paramBodyMap.putAll(paramMaps);
body = JSONObject.toJSONString(paramBodyMap);
}
}
......@@ -62,7 +62,7 @@ spring:
pathmatch:
matching-strategy: ant_path_matcher
redis:
host: yifu-redis
host: 127.0.0.1
password: '@yf_2017'
cloud:
sentinel:
......@@ -102,7 +102,8 @@ spring:
pathmatch:
matching-strategy: ant_path_matcher
redis:
host: yifu-redis
host: 192.168.1.65
port: 22379
password: '@yf_2017'
cloud:
sentinel:
......
......@@ -28,7 +28,7 @@ seata:
enable-degrade: false # 降级开关
disable-global-transaction: false # 禁用全局事务(默认false)
grouplist:
default: yifu-seata:8091
default: 127.0.0.1:8091
transport:
shutdown:
wait: 3
......
......@@ -49,7 +49,7 @@ spring:
# 数据源配置
spring:
redis:
host: yifu-redis
host: 127.0.0.1
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
......@@ -65,7 +65,8 @@ spring:
# 数据源配置
spring:
redis:
host: yifu-redis
host: 192.168.1.65
port: 22379
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
......
......@@ -69,7 +69,7 @@ spring:
activate:
on-profile: test
redis:
host: yifu-redis
host: 127.0.0.1
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
......@@ -87,7 +87,8 @@ spring:
activate:
on-profile: dev
redis:
host: yifu-redis
host: 192.168.1.65
port: 22379
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
......
......@@ -32,10 +32,10 @@
<dependencies>
<!--接口文档-->
<dependency>
<!-- <dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-swagger</artifactId>
</dependency>
</dependency>-->
<!--注册中心客户端-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
......@@ -47,10 +47,10 @@
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!--断路器依赖-->
<dependency>
<!--<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-feign</artifactId>
</dependency>
</dependency>-->
<!--数据源-->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment