feat: 新增十一地市表格上传与结果查看
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package mjkf.xinke;
|
||||
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import mjkf.xinke.dev.modular.file.enums.DevFileEngineTypeEnum;
|
||||
import mjkf.xinke.dev.modular.file.service.DevFileService;
|
||||
import org.junit.Test;
|
||||
@@ -14,7 +13,6 @@ import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
@SpringBootTest(classes = Application.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@@ -24,13 +22,20 @@ public class UploadFileTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
var filePath = "C:\\Users\\Administrator\\Desktop\\材料管理系统模版\\主材\\网络价格.xlsx";
|
||||
var filePath = "C:\\Users\\Administrator\\Desktop\\材料管理系统模版\\主材\\交通局.xlsx";
|
||||
var file = new File(filePath);
|
||||
var multipartFile = this.mockMultipartFile(file, "网络价格.xlsx", "application/x-zip-compressed");
|
||||
var fileId = devFileService.uploadReturnId(DevFileEngineTypeEnum.LOCAL.getValue(), multipartFile);
|
||||
System.out.println("UploadFileTest.test | fileId " + fileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1810213380969066497 网络价格.xlsx 1201
|
||||
* 1810481654990442497 调查表.xlsx 501
|
||||
* 1810481965629005826 公路局.xlsx 40201
|
||||
* 1810482216079302658 交通局.xlsx 40101
|
||||
*/
|
||||
|
||||
private MultipartFile mockMultipartFile(File file, String fileName, String contentType) {
|
||||
try {
|
||||
// 使用文件内容和文件名创建MockMultipartFile
|
||||
|
||||
Reference in New Issue
Block a user