Procházet zdrojové kódy

数据治理优化

chenendian před 1 týdnem
rodič
revize
e41d031a7e

+ 34 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/DealExcelController.java

@@ -1,6 +1,7 @@
 package com.siwei.apply.controller.third;
 
 import com.siwei.apply.common.Constant;
+import com.siwei.apply.service.NodeAttachmentService;
 import com.siwei.apply.service.third.impl.DealExcelServiceImpl;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.web.controller.BaseController;
@@ -34,6 +35,39 @@ public class DealExcelController extends BaseController {
     @Autowired
     DealExcelServiceImpl  dealExcelService;
 
+    @Autowired
+    private NodeAttachmentService nodeAttachmentService;
+
+
+    /**
+     * 附件入库后,附件名称未进入查询表,需要刷新数据
+     * @param fileName
+     * @return
+     */
+    @PostMapping("/attachmentToDb/{fileName}")
+    public R<Map<String, List<Map<String, String>>>> dealAttachmentInfo(@PathVariable String fileName) {
+        try {
+            String uploadFile = Constant.IMPORT_EXCEL_DATA_FILE_PATH+"\\"+fileName;
+            Path filePath = Paths.get(uploadFile);
+            File file = filePath.toFile();
+            Map<String, List<Map<String, String>>> dataMap = readExcelWithMergedHeaders(file);
+            List<Map<String, String>>  list =  dataMap.get("data_info");
+            for(Map<String, String>  obj :  list){
+                String projectId = obj.get("project_id");
+                String nodeId = obj.get("node_id");
+                String id = obj.get("attachment_id");
+                //Boolean res  = nodeAttachmentService.modifyAttachmentInfo(projectId,nodeId,id);
+                //logger.info("数据入库结果{},id{},projectId{},nodeId{}",res,id,projectId,nodeId);
+            }
+            return R.ok(dataMap);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+
 
 
     @GetMapping("testData/{fileName}")