|
@@ -27,21 +27,49 @@ import java.util.List;
|
|
|
@RequestMapping("/admin/up")
|
|
|
@Log
|
|
|
public class UploadController {
|
|
|
+ /**
|
|
|
+ * 文件目录,解析后的文件目录
|
|
|
+ */
|
|
|
@Value("${report.file.xmlSourcePath}")
|
|
|
- private String filePath;
|
|
|
+ private String xmlSourcePath;
|
|
|
+ /**
|
|
|
+ * 文件目录,解析后的文件目录
|
|
|
+ */
|
|
|
+ @Value("${report.file.xmlTargetPath}")
|
|
|
+ private String xmlTargetPath;
|
|
|
|
|
|
+ /**
|
|
|
+ * 模型文件目标文件
|
|
|
+ */
|
|
|
@Value("${report.file.modelTargetPath}")
|
|
|
private String modelPath;
|
|
|
|
|
|
+ /**
|
|
|
+ * 存放JSON文件路径
|
|
|
+ */
|
|
|
+ @Value("${report.file.jsonTargetPath}")
|
|
|
+ private String jsonTargetPath;
|
|
|
+
|
|
|
@PostMapping("/uploadUi")
|
|
|
public Result uploadUi(@RequestParam("files") MultipartFile[] files ) {
|
|
|
if(files.length>0) {
|
|
|
for(MultipartFile file : files) {
|
|
|
String fileName = file.getOriginalFilename();
|
|
|
try{
|
|
|
- File mkdir = new File(filePath);
|
|
|
- if(!mkdir.exists()) {
|
|
|
- mkdir.mkdirs();
|
|
|
+ String filePath = "";
|
|
|
+ if(fileName.endsWith("xml")){
|
|
|
+ filePath = xmlSourcePath;
|
|
|
+ File mkdir = new File(xmlSourcePath);
|
|
|
+ if(!mkdir.exists()) {
|
|
|
+ mkdir.mkdirs();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ filePath = jsonTargetPath;
|
|
|
+ File mkdir = new File(jsonTargetPath);
|
|
|
+ if (!mkdir.exists()) {
|
|
|
+ mkdir.mkdirs();
|
|
|
+ }
|
|
|
}
|
|
|
//定义输出流,将文件写入硬盘
|
|
|
FileOutputStream os = new FileOutputStream(filePath+fileName);
|