|
@@ -27,21 +27,49 @@ import java.util.List;
|
|
@RequestMapping("/admin/up")
|
|
@RequestMapping("/admin/up")
|
|
@Log
|
|
@Log
|
|
public class UploadController {
|
|
public class UploadController {
|
|
|
|
+ /**
|
|
|
|
+ * 文件目录,解析后的文件目录
|
|
|
|
+ */
|
|
@Value("${report.file.xmlSourcePath}")
|
|
@Value("${report.file.xmlSourcePath}")
|
|
- private String filePath;
|
|
|
|
|
|
+ private String xmlSourcePath;
|
|
|
|
+ /**
|
|
|
|
+ * 文件目录,解析后的文件目录
|
|
|
|
+ */
|
|
|
|
+ @Value("${report.file.xmlTargetPath}")
|
|
|
|
+ private String xmlTargetPath;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 模型文件目标文件
|
|
|
|
+ */
|
|
@Value("${report.file.modelTargetPath}")
|
|
@Value("${report.file.modelTargetPath}")
|
|
private String modelPath;
|
|
private String modelPath;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 存放JSON文件路径
|
|
|
|
+ */
|
|
|
|
+ @Value("${report.file.jsonTargetPath}")
|
|
|
|
+ private String jsonTargetPath;
|
|
|
|
+
|
|
@PostMapping("/uploadUi")
|
|
@PostMapping("/uploadUi")
|
|
public Result uploadUi(@RequestParam("files") MultipartFile[] files ) {
|
|
public Result uploadUi(@RequestParam("files") MultipartFile[] files ) {
|
|
if(files.length>0) {
|
|
if(files.length>0) {
|
|
for(MultipartFile file : files) {
|
|
for(MultipartFile file : files) {
|
|
String fileName = file.getOriginalFilename();
|
|
String fileName = file.getOriginalFilename();
|
|
try{
|
|
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);
|
|
FileOutputStream os = new FileOutputStream(filePath+fileName);
|