Commit b0a4039e authored by liqin's avatar liqin 💬

bug fixed

parent c88ee674
#FROM openjdk:8-jdk-alpine
#FROM halcom/oracle-jdk8:151
FROM liumiaocn/jdk:ora8u201-alpine3.9-glibc2.29
USER root
MAINTAINER Danny Lee
......
......@@ -42,6 +42,8 @@ public class UploadServiceImpl implements UploadService {
@Autowired
private ShopZxMapper shopZxMapper;
@Value("${file.upload.path:#{null}}")
private String path;
/**
* 视频文件上传
......@@ -194,12 +196,12 @@ public class UploadServiceImpl implements UploadService {
//创建集合
List<Map<String, Object>> root = new ArrayList<Map<String, Object>>();
String imgUrl = null;
String imgUrl = "";
String zxName=null;
String fileName=null;
String zxUrl=null;
// 要上传的目标文件存放的绝对路径
final String localPath = "d:\\IDEAProject\\imageupload\\target\\classes\\static\\img";
final String localPath = path;
Map<String, Object> result = new HashMap<String, Object>();//一个文件上传的结果
String result_msg = "";//上传结果信息
//遍历图片数据
......@@ -211,7 +213,7 @@ public class UploadServiceImpl implements UploadService {
}
//判断上传文件格式
String fileType = file.getContentType();
if (fileType.equals("image/jpeg") || fileType.equals("image/png") || fileType.equals("image/jpeg")) {
if (fileType.equals("image/jpeg") || fileType.equals("image/png")) {
// 要上传的目标文件存放的绝对路径
//上传后保存的文件名(需要防止图片重名导致的文件覆盖)
......@@ -223,7 +225,7 @@ public class UploadServiceImpl implements UploadService {
fileName = UUID.randomUUID() + suffixName;
zxUrl="";
zxName+=fileName+",";
zxName += fileName+",";
imgUrl+=localPath+fileName+",";
// shopZxMapper.zxadd(zxUrl,userId,zxName,zxField,imgUrl,zxAddress);
if (FileUtils.upload(file, localPath, fileName)) {
......@@ -250,8 +252,6 @@ public class UploadServiceImpl implements UploadService {
System.out.println(imgUrl);
shopZxMapper.zxadd(zxUrl,userId,zxName,zxField,imgUrl,zxAddress);
return root;
}
/**
......@@ -259,7 +259,7 @@ public class UploadServiceImpl implements UploadService {
*/
private Path fileStorageLocation; // 文件在本地存储的地址
public UploadServiceImpl(@Value("${file.upload.path:#{null}}") String path) {
public UploadServiceImpl() {
if (!StringUtil.isBlank(path)) {
this.fileStorageLocation = Paths.get(path).toAbsolutePath().normalize();
try {
......
......@@ -52,7 +52,7 @@ uploadFile:
location: /opt/images/upload_flowChart/ #自定义上传文件服务器硬盘保存路径 ,linux服务器保存路径 /home/changfa/app/wxbjgkpt/upload_flowChart/
file:
upload:
path: C:/aplus
path: /opt/images/
jwt:
# 加密秘钥
secret: f4e2e52034348f86b67cde581c0f9eb5
......
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