You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sdny-jxpt/dxhy-oss/src/test/java/com/dxhy/OfdHandle.java

40 lines
922 B

package com.dxhy;
import com.dxhy.oss.model.FileModel;
import com.dxhy.oss.service.FileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
/**
* @author user
*/
@SuppressWarnings("FieldCanBeLocal")
@Slf4j
public class OfdHandle extends Thread {
private final File file;
@Autowired
private FileService fileService;
public OfdHandle(File file) {
this.file = file;
}
@Override
public void run() {
fileService = (FileService) SpringContextUtils.getBean("fileService");
FileModel fileModel = new FileModel();
try {
fileModel = fileService.uploadFile(file.getPath(), file.getPath());
} catch (Exception e) {
e.printStackTrace();
}
log.info("文件上传返回结果:" + fileModel.getCode() + " " + fileModel.getFilePath());
}
}