|
@@ -24,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.io.File;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
import java.util.concurrent.BlockingQueue;
|
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -45,9 +46,6 @@ public class FdModelController {
|
|
|
@Value("${output.file.path.model}")
|
|
|
private String OUTPUT_FILE_PATH;
|
|
|
|
|
|
-// @Autowired
|
|
|
-// private FileServer fileServer;
|
|
|
-
|
|
|
@Autowired
|
|
|
private CmdServer cmdServer;
|
|
|
|
|
@@ -66,10 +64,7 @@ public class FdModelController {
|
|
|
*/
|
|
|
@PostConstruct
|
|
|
private void init() {
|
|
|
-
|
|
|
-
|
|
|
new Thread(new modelSliceConsumerThread(modelQueue)).start();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -124,6 +119,23 @@ public class FdModelController {
|
|
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation("上传数据,校验文件名")
|
|
|
+ @GetMapping("check/{fileName}/")
|
|
|
+ private R checkFileName(@RequestParam("fileName") String fileName) {
|
|
|
+ log.info("run checkFileName");
|
|
|
+
|
|
|
+ // 文件是否包含中文字符
|
|
|
+ if (RegexUtils.regexChinese(fileName)) {
|
|
|
+ return new R(51005, MsgCode.E51005);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<FileEntity> list = modelServer.findByFileName(fileName);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ return new R(51006, MsgCode.E51006);
|
|
|
+ }
|
|
|
+ return new R(200, MsgCode.SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("上传3D模型数据,只能上传zip文件")
|
|
|
@PostMapping(value = "upload", consumes = {"multipart/form-data"})
|
|
|
private R upload(@RequestParam("file") MultipartFile file) {
|
|
@@ -142,14 +154,10 @@ public class FdModelController {
|
|
|
return new R(50007, MsgCode.E50007);
|
|
|
}
|
|
|
|
|
|
- FileEntity entity = modelServer.findByFileName(fileName);
|
|
|
- if (entity != null) {
|
|
|
+ List<FileEntity> list = modelServer.findByFileName(fileName);
|
|
|
+ if (list.size() > 0) {
|
|
|
return new R(51006, MsgCode.E51006);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
return modelServer.uploadBigFile(file);
|
|
|
}
|
|
|
|