From b42565cdebc181eaafba44e051ad7fcd1f289edd Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 19 九月 2024 13:10:55 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/page/code/useCodeImport.jsx                                                   |    9 ++++
 zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/CodeController.java        |   26 ++++++++++++
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/AStarNavigateService.java |    3 -
 zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java         |   17 ++++++++
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MapService.java                  |    8 ---
 5 files changed, 51 insertions(+), 12 deletions(-)

diff --git a/zy-acs-flow/src/page/code/useCodeImport.jsx b/zy-acs-flow/src/page/code/useCodeImport.jsx
index b53286c..ced0084 100644
--- a/zy-acs-flow/src/page/code/useCodeImport.jsx
+++ b/zy-acs-flow/src/page/code/useCodeImport.jsx
@@ -1,11 +1,18 @@
 import { useCallback, useMemo } from 'react';
 import { useDataProvider, useGetIdentity } from 'react-admin';
+import request from '@/utils/request';
 
 export function useCodeImport() {
 
     const processBatch = useCallback(async (batch) => {
-        console.log(batch);
+        const res = await request.post('/code/import', batch);
+        const { code, msg, data } = res.data;
+        if (code === 200) {
 
+        } else {
+            console.error(msg);
+            throw new Error(`Batch import failed: ${msg}`);
+        }
     }, []);
 
     return {
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MapService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MapService.java
index f421485..107e9a3 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MapService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MapService.java
@@ -1,8 +1,8 @@
 package com.zy.acs.manager.core.service;
 
 import com.alibaba.fastjson.JSONObject;
-import com.zy.acs.framework.common.Cools;
 import com.zy.acs.common.enums.AgvDirectionType;
+import com.zy.acs.framework.common.Cools;
 import com.zy.acs.manager.common.utils.MapDataUtils;
 import com.zy.acs.manager.core.service.astart.*;
 import com.zy.acs.manager.core.service.astart.domain.DynamicNode;
@@ -10,9 +10,7 @@
 import com.zy.acs.manager.manager.entity.Code;
 import com.zy.acs.manager.manager.entity.Loc;
 import com.zy.acs.manager.manager.service.ActionService;
-import com.zy.acs.manager.manager.service.CodeGapService;
 import com.zy.acs.manager.manager.service.CodeService;
-import com.zy.acs.manager.manager.service.RouteService;
 import com.zy.acs.manager.system.service.ConfigService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.time.StopWatch;
@@ -31,10 +29,6 @@
 
     @Autowired
     private CodeService codeService;
-    @Autowired
-    private CodeGapService codeGapService;
-    @Autowired
-    private RouteService routeService;
     @Autowired
     private FloydNavigateService floydNavigateService;
     @Autowired
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/AStarNavigateService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/AStarNavigateService.java
index a0af323..6179fa3 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/AStarNavigateService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/AStarNavigateService.java
@@ -6,7 +6,6 @@
 import com.zy.acs.manager.core.service.astart.domain.DynamicNode;
 import com.zy.acs.manager.manager.entity.Route;
 import com.zy.acs.manager.manager.service.AgvService;
-import com.zy.acs.manager.manager.service.CodeGapService;
 import com.zy.acs.manager.manager.service.CodeService;
 import com.zy.acs.manager.manager.service.RouteService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,8 +23,6 @@
 
     @Autowired
     private CodeService codeService;
-    @Autowired
-    private CodeGapService codeGapService;
     @Autowired
     private RouteService routeService;
     @Autowired
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/CodeController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/CodeController.java
index 6b54c89..ce8b2c6 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/CodeController.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/CodeController.java
@@ -2,13 +2,14 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zy.acs.common.utils.GsonUtils;
 import com.zy.acs.framework.common.Cools;
 import com.zy.acs.framework.common.R;
-import com.zy.acs.manager.common.utils.ExcelUtil;
 import com.zy.acs.manager.common.annotation.OperationLog;
 import com.zy.acs.manager.common.domain.BaseParam;
 import com.zy.acs.manager.common.domain.KeyValVo;
 import com.zy.acs.manager.common.domain.PageParam;
+import com.zy.acs.manager.common.utils.ExcelUtil;
 import com.zy.acs.manager.manager.entity.Code;
 import com.zy.acs.manager.manager.service.CodeService;
 import com.zy.acs.manager.system.controller.BaseController;
@@ -18,6 +19,7 @@
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/api")
@@ -78,6 +80,22 @@
         return R.ok("Update Success").add(code);
     }
 
+    @PreAuthorize("hasAuthority('manager:loc:update')")
+    @OperationLog("Update Code")
+    @PostMapping("/code/update/many")
+    public R updateMany(@RequestBody List<Code> list) {
+        if (!Cools.isEmpty(list)) {
+            for (Code code : list) {
+                code.setUpdateBy(getLoginUserId());
+                code.setUpdateTime(new Date());
+                if (!codeService.updateById(code)) {
+                    return R.error("Update Fail");
+                }
+            }
+        }
+        return R.ok("Update Success").add(list.stream().map(Code::getId).collect(Collectors.toList()));
+    }
+
     @PreAuthorize("hasAuthority('manager:code:remove')")
     @OperationLog("Delete Code")
     @PostMapping("/code/remove/{ids}")
@@ -108,4 +126,10 @@
         ExcelUtil.build(ExcelUtil.create(codeService.list(), Code.class), response);
     }
 
+    @PreAuthorize("hasAuthority('manager:code:save')")
+    @PostMapping("/code/import")
+    public R importBatch(@RequestBody List<Map<String, Object>> list) {
+        return R.ok().add(GsonUtils.toJson(list));
+    }
+
 }
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java
index 8daf91e..4c59da5 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java
@@ -25,6 +25,7 @@
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/api")
@@ -87,6 +88,22 @@
         return R.ok("Update Success").add(loc);
     }
 
+    @PreAuthorize("hasAuthority('manager:loc:update')")
+    @OperationLog("Update Loc")
+    @PostMapping("/loc/update/many")
+    public R updateMany(@RequestBody List<Loc> locList) {
+        if (!Cools.isEmpty(locList)) {
+            for (Loc loc : locList) {
+                loc.setUpdateBy(getLoginUserId());
+                loc.setUpdateTime(new Date());
+                if (!locService.updateById(loc)) {
+                    return R.error("Update Fail");
+                }
+            }
+        }
+        return R.ok("Update Success").add(locList.stream().map(Loc::getId).collect(Collectors.toList()));
+    }
+
     @PreAuthorize("hasAuthority('manager:loc:remove')")
     @OperationLog("Delete Loc")
     @PostMapping("/loc/remove/{ids}")

--
Gitblit v1.9.1