|
|
@@ -3,6 +3,7 @@ package com.siwei.apply.controller;
|
|
|
import com.siwei.apply.domain.NodeAttachment;
|
|
|
import com.siwei.apply.service.NodeAttachmentService;
|
|
|
import com.siwei.common.core.domain.R;
|
|
|
+import com.siwei.common.core.utils.StringUtils;
|
|
|
import com.siwei.common.core.web.controller.BaseController;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -208,4 +209,78 @@ public class NodeAttachmentController extends BaseController {
|
|
|
return R.fail("更新nodeId异常:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/processOneFile")
|
|
|
+ public R<Map<String, String>> processOneFile(@RequestBody Map<String, String> requestBody) {
|
|
|
+ try {
|
|
|
+ String filePath = requestBody.get("filePath");
|
|
|
+ String fileUploadPath = requestBody.get("fileUploadPath");
|
|
|
+ if (filePath == null || filePath.trim().isEmpty()) {
|
|
|
+ return R.fail(502,"filePath不能为空");
|
|
|
+ }
|
|
|
+ if (fileUploadPath == null || fileUploadPath.trim().isEmpty()) {
|
|
|
+ return R.fail(502,"fileUploadPath");
|
|
|
+ }
|
|
|
+
|
|
|
+ //这里把文件迁移到当前目录中,重新更新目录结构
|
|
|
+ //String id = nodeAttachmentService.processFileAndSave(filePath);
|
|
|
+ String id = "11111111222";
|
|
|
+ if (id != null) {
|
|
|
+ Map<String, String> responseData = new HashMap<>();
|
|
|
+ responseData.put("nodeAttachmentId", id);
|
|
|
+ return R.ok(responseData);
|
|
|
+ } else {
|
|
|
+ return R.fail("处理一个文件失败");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("处理文件异常", e);
|
|
|
+ return R.fail("处理一个文件异常:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 当用户进入此页面进行数据初始化
|
|
|
+ *
|
|
|
+ * @param requestBody 包含filePath的请求体
|
|
|
+ * @return 数据库存储后的id
|
|
|
+ */
|
|
|
+ @PostMapping("/initProcess")
|
|
|
+ public R<Map<String, String>> initProcessFile(@RequestBody Map<String, String> requestBody) {
|
|
|
+ try {
|
|
|
+ String nodeId = requestBody.get("nodeId");
|
|
|
+ String projectId = requestBody.get("projectId");
|
|
|
+ if (StringUtils.isBlank(nodeId)) {
|
|
|
+ return R.fail("nodeId不能为空");
|
|
|
+ }
|
|
|
+ // 1.根据nodeId进行查询。
|
|
|
+ // 2.如果不存在插入数据返回。
|
|
|
+ //String id = nodeAttachmentService.processFileAndSave(null);
|
|
|
+ String id = "222222222222222111";
|
|
|
+ if (id != null) {
|
|
|
+ Map<String, String> responseData = new HashMap<>();
|
|
|
+ responseData.put("nodeAttachmentId", id);
|
|
|
+ return R.ok(responseData);
|
|
|
+ } else {
|
|
|
+ return R.fail(502,"处理文件失败");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("初始化附件信息异常", e);
|
|
|
+ return R.fail(502,"初始化附件信息异常:" + e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|