修改文件上传
This commit is contained in:
parent
62a23e7d77
commit
9faaafafa9
|
@ -22,7 +22,7 @@ spring:
|
|||
# password: 62e4295b615a30dbf3b8ee96f41c820b
|
||||
# driver-class-name: dm.jdbc.driver.DmDriver
|
||||
# type: com.alibaba.druid.pool.DruidDataSource
|
||||
url: jdbc:mysql://ufidahz.com.cn:9014/businesscentercopy?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
|
||||
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
|
||||
username: root
|
||||
password: 62e4295b615a30dbf3b8ee96f41c820b
|
||||
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.hzya.frame.basedao.service.impl.BaseService;
|
|||
import com.hzya.frame.sys.file.upload.entity.FileUploadDto;
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.hzya.frame.sys.file.download.entity.FileDownloadEntity;
|
||||
import com.hzya.frame.sys.file.download.service.IFileDownloadService;
|
||||
|
@ -22,7 +23,8 @@ import java.io.File;
|
|||
public class FileDownloadServiceImpl extends BaseService< FileDownloadEntity,Long> implements IFileDownloadService{
|
||||
|
||||
protected IFileDownloadDao filedownloadDao;
|
||||
|
||||
@Value("${savefile.path}")
|
||||
public String DSK;
|
||||
@Autowired
|
||||
public void setFileDownloadDao(IFileDownloadDao dao) {
|
||||
|
||||
|
@ -74,7 +76,7 @@ public class FileDownloadServiceImpl extends BaseService< FileDownloadEntity,Lo
|
|||
throw new BaseSystemException("文件不存在!");
|
||||
}
|
||||
/** 拼接文件路径*/
|
||||
String filePath = fileDownloadEntity.getFilepath();
|
||||
String filePath = DSK + fileDownloadEntity.getFilepath().replace("/",File.separator).replace("\\",File.separator);
|
||||
/** 获取file文件*/
|
||||
File file = new File(filePath);
|
||||
/** 设置file*/
|
||||
|
|
|
@ -56,7 +56,7 @@ public class FileUploadServiceImpl extends BaseService<FileUploadEntity, Long> i
|
|||
/** 获取系统设置文件存放的盘符*/
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
/** 获取根目录*/
|
||||
stringBuffer.append(DSK);
|
||||
//stringBuffer.append(DSK);
|
||||
/** 根据当前日期创建文件目录*/
|
||||
String nowDateString = DateUtil.dateToString(new Date(), "yyyy-MM-dd");
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class FileUploadServiceImpl extends BaseService<FileUploadEntity, Long> i
|
|||
String path = stringBuffer.toString();
|
||||
/** 保存到file表信息*/
|
||||
FileUploadEntity fileUploadEntity = saveFile(file, path, "附件备注");
|
||||
path = fileUploadEntity.getFilepath();
|
||||
path = DSK + fileUploadEntity.getFilepath();
|
||||
/** 创建文件夹*/
|
||||
FileUtils.createDir(path);
|
||||
File uploadFile = new File(path);
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
|
@ -46,6 +47,8 @@ import java.nio.charset.StandardCharsets;
|
|||
@RequestMapping("/entranceController")
|
||||
public class EntranceController {
|
||||
private final Logger logger = LoggerFactory.getLogger(EntranceController.class);
|
||||
@Value("${savefile.path}")
|
||||
public String DSK;
|
||||
@Autowired
|
||||
protected IBipSsoService bipSsoService;
|
||||
@Autowired
|
||||
|
|
Loading…
Reference in New Issue