Browse Source

调整附件对应的表头解析,获取附件ID

wuzhenyue 3 years ago
parent
commit
e9ae7f7eff

+ 18 - 9
application-facade/src/main/java/com/factory/controller/web/FileBlobController.java

@@ -3,6 +3,7 @@ package com.factory.controller.web;
 import com.alibaba.fastjson.JSONObject;
 import com.factory.base.entity.aggregates.ResponseBean;
 import com.factory.base.util.res.ResponseBeanBuilder;
+import com.factory.web.entity.pm.OnsiteTitle;
 import com.factory.web.entity.pm.OnsiteTitleBlob;
 import com.factory.web.service.FileService;
 import com.factory.web.service.impl.DownLoadParam;
@@ -10,6 +11,8 @@ import com.factory.web.service.impl.FileEntry;
 import com.factory.web.service.impl.FileResultInfo;
 import com.factory.web.service.impl.FileServiceImpl;
 import com.factory.web.service.pm.OnsiteTitleBlobService;
+import com.factory.web.service.pm.PreventMistakeService;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
@@ -38,6 +41,9 @@ public class FileBlobController {
     private FileService fileService;
     @Autowired
     private OnsiteTitleBlobService blobService;
+    
+    @Autowired
+	private PreventMistakeService preventMistakeService;
 
 
     @PostMapping("/addFile")
@@ -63,15 +69,18 @@ public class FileBlobController {
 
         long id = -1;
         if (param.getType() == 2) {
-            OnsiteTitleBlob blob = blobService.queryBlobForPlanId(param.getPlanId());
-            if (blob != null) {
-                blob.setTitleContentStr(new String(blob.getTitleContent(), StandardCharsets.UTF_8));
-                JSONObject jsonObject = JSONObject.parseObject(blob.getTitleContentStr());
-                String uploadAttachmentId = jsonObject.getString("uploadAttachmentId");
-                if (uploadAttachmentId != null) {
-                    id = Long.parseLong(uploadAttachmentId);
-                }
-            }
+        	OnsiteTitle onsiteTitle = preventMistakeService.getTitle(param.getPlanId());
+        	id = Long.parseLong(onsiteTitle.getUploadAttachmentId());
+
+//            OnsiteTitleBlob blob = blobService.queryBlobForPlanId(param.getPlanId());
+//            if (blob != null) {
+//                blob.setTitleContentStr(new String(blob.getTitleContent(), StandardCharsets.UTF_8));
+//                JSONObject jsonObject = JSONObject.parseObject(blob.getTitleContentStr());
+//                String uploadAttachmentId = jsonObject.getString("uploadAttachmentId");
+//                if (uploadAttachmentId != null) {
+//                    id = Long.parseLong(uploadAttachmentId);
+//                }
+//            }
         } else {
 
         }