Compare commits

..

No commits in common. "db5f285d5bbe46517d4682ebd897f3e7f8de99c5" and "ab145a49932a264633a35a789c143cf3a23f54c0" have entirely different histories.

4 changed files with 22 additions and 59 deletions

View File

@ -210,14 +210,14 @@ public class CommonController {
public void view(HttpServletRequest request, HttpServletResponse response) { public void view(HttpServletRequest request, HttpServletResponse response) {
// ISO-8859-1 ==> UTF-8 进行编码转换 // ISO-8859-1 ==> UTF-8 进行编码转换
String imgPath = extractPathFromPattern(request); String imgPath = extractPathFromPattern(request);
if (oConvertUtils.isEmpty(imgPath) || CommonConstant.STRING_NULL.equals(imgPath)) { if(oConvertUtils.isEmpty(imgPath) || CommonConstant.STRING_NULL.equals(imgPath)){
return; return;
} }
// 其余处理略 // 其余处理略
InputStream inputStream = null; InputStream inputStream = null;
OutputStream outputStream = null; OutputStream outputStream = null;
try { try {
imgPath = imgPath.replace("..", "").replace("../", ""); imgPath = imgPath.replace("..", "").replace("../","");
if (imgPath.endsWith(SymbolConstant.COMMA)) { if (imgPath.endsWith(SymbolConstant.COMMA)) {
imgPath = imgPath.substring(0, imgPath.length() - 1); imgPath = imgPath.substring(0, imgPath.length() - 1);
} }
@ -227,20 +227,15 @@ public class CommonController {
String filePath = uploadpath + File.separator + imgPath; String filePath = uploadpath + File.separator + imgPath;
File file = new File(filePath); File file = new File(filePath);
if (!file.exists()) { if(!file.exists()){
response.setStatus(404); response.setStatus(404);
log.error("文件[" + imgPath + "]不存在.."); log.error("文件["+imgPath+"]不存在..");
return; return;
//throw new RuntimeException();
} }
// 获取文件大小并设置Content-Length
long fileLength = file.length();
response.setHeader("Content-Length", String.valueOf(fileLength));
// 设置强制下载不打开 // 设置强制下载不打开
response.setContentType("application/force-download"); response.setContentType("application/force-download");
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"), "iso-8859-1")); response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1"));
inputStream = new BufferedInputStream(new FileInputStream(filePath)); inputStream = new BufferedInputStream(new FileInputStream(filePath));
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
@ -269,6 +264,7 @@ public class CommonController {
} }
} }
} }
} }
// /** // /**

View File

@ -1,5 +1,5 @@
server: server:
port: 8082 port: 8080
tomcat: tomcat:
max-swallow-size: -1 max-swallow-size: -1
error: error:
@ -7,7 +7,7 @@ server:
include-stacktrace: ALWAYS include-stacktrace: ALWAYS
include-message: ALWAYS include-message: ALWAYS
servlet: servlet:
context-path: /nursing-unit-nacos context-path: /nursing-unit
compression: compression:
enabled: true enabled: true
min-response-size: 1024 min-response-size: 1024
@ -20,12 +20,6 @@ management:
include: metrics,jeecghttptrace include: metrics,jeecghttptrace
spring: spring:
application:
name: nursing-unit-nacos
cloud:
nacos:
discovery:
service-name: nursing-unit-nacos
# flyway配置 # flyway配置
flyway: flyway:
# 是否启用flyway # 是否启用flyway
@ -169,10 +163,10 @@ spring:
slow-sql-millis: 5000 slow-sql-millis: 5000
datasource: datasource:
master: master:
url: jdbc:mysql://mysql8-prod:3306/nursing_unit?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai url: jdbc:mysql://localhost:40521/nursing_unit?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# url: jdbc:mysql://localhost:3306/nursing_unit_001?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai # url: jdbc:mysql://localhost:3306/nursing_unit_001?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: fw8864sshdang username: root
password: uGDBkM25I6nZCNM2 password: BLXC@123.
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
# 多数据源配置 # 多数据源配置
#multi-datasource1: #multi-datasource1:
@ -182,10 +176,10 @@ spring:
#driver-class-name: com.mysql.cj.jdbc.Driver #driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置 #redis 配置
redis: redis:
database: 1 database: 0
host: redis host: 127.0.0.1
port: 6379 port: 6379
password: uUgrUus4JAYuwxzo password:
#mybatis plus 设置 #mybatis plus 设置
mybatis-plus: mybatis-plus:
mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml,classpath*:com/nu/**/xml/*Mapper.xml mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml,classpath*:com/nu/**/xml/*Mapper.xml
@ -231,9 +225,9 @@ jeecg:
app: http://localhost:8051 app: http://localhost:8051
path: path:
#文件上传根目录 设置 #文件上传根目录 设置
upload: /opt/nu/upFiles upload: /opt/upFiles
#webapp文件路径 #webapp文件路径
webapp: /opt/nu/webapp webapp: /opt/webapp
shiro: shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/** excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置 #阿里云oss存储和大鱼短信秘钥配置

View File

@ -1,16 +0,0 @@
spring:
cloud:
nacos:
discovery:
server-addr: ${config.server-addr}
namespace: ${config.namespace}
group: ${config.group}
username: ${config.username}
password: ${config.password}
config:
server-addr: ${config.server-addr}
namespace: ${config.namespace}
group: ${config.group}
file-extension: yaml
username: ${config.username}
password: ${config.password}

21
pom.xml
View File

@ -150,17 +150,6 @@
<artifactId>commonmark</artifactId> <artifactId>commonmark</artifactId>
<version>${commonmark.version}</version> <version>${commonmark.version}</version>
</dependency> </dependency>
<!-- Nacos 服务发现 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- Nacos 配置中心 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
@ -476,7 +465,7 @@
<id>dev</id> <id>dev</id>
<activation> <activation>
<!--默认激活配置--> <!--默认激活配置-->
<activeByDefault>false</activeByDefault> <activeByDefault>true</activeByDefault>
</activation> </activation>
<properties> <properties>
<!--当前环境--> <!--当前环境-->
@ -528,21 +517,21 @@
<id>uat</id> <id>uat</id>
<activation> <activation>
<!--默认激活配置--> <!--默认激活配置-->
<activeByDefault>true</activeByDefault> <activeByDefault>false</activeByDefault>
</activation> </activation>
<properties> <properties>
<!--当前环境--> <!--当前环境-->
<profile.name>uat</profile.name> <profile.name>uat</profile.name>
<!--Nacos服务地址--> <!--Nacos服务地址-->
<config.server-addr>121.36.88.64</config.server-addr> <config.server-addr>jeecg-boot-nacos:8848</config.server-addr>
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID不能使用名称,默认为空--> <!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID不能使用名称,默认为空-->
<config.namespace></config.namespace> <config.namespace></config.namespace>
<!--Nacos配置分组名称--> <!--Nacos配置分组名称-->
<config.group>DEFAULT_GROUP</config.group> <config.group>DEFAULT_GROUP</config.group>
<!--Nacos用户名--> <!--Nacos用户名-->
<config.username>fw8864nasadn</config.username> <config.username></config.username>
<!--Nacos密码--> <!--Nacos密码-->
<config.password>JINisgIngV82G2</config.password> <config.password></config.password>
</properties> </properties>
</profile> </profile>
<!-- 生产 --> <!-- 生产 -->