From 6923315545b3f97c86719148f85dac1220a14a63 Mon Sep 17 00:00:00 2001
From: chen.llin <1442464845@qq.comm>
Date: 星期三, 14 一月 2026 19:23:54 +0800
Subject: [PATCH] agv空托入库接口以及机器人组站点配置

---
 src/main/java/com/zy/asrs/controller/AppVersionController.java |   71 +++++++++++++++++++++++++----------
 1 files changed, 51 insertions(+), 20 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/AppVersionController.java b/src/main/java/com/zy/asrs/controller/AppVersionController.java
index dd879b2..2b5aed4 100644
--- a/src/main/java/com/zy/asrs/controller/AppVersionController.java
+++ b/src/main/java/com/zy/asrs/controller/AppVersionController.java
@@ -12,6 +12,10 @@
 import com.zy.asrs.entity.AppVersion;
 import com.zy.asrs.service.AppVersionService;
 import com.zy.common.web.BaseController;
+import com.zy.system.entity.Permission;
+import com.zy.system.entity.RolePermission;
+import com.zy.system.service.PermissionService;
+import com.zy.system.service.RolePermissionService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.util.ClassUtils;
@@ -22,10 +26,15 @@
 import java.io.*;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @RestController
 public class AppVersionController extends BaseController {
 
+    @Autowired
+    private PermissionService permissionService;
+    @Autowired
+    private RolePermissionService rolePermissionService;
     @Autowired
     private AppVersionService appVersionService;
 
@@ -37,17 +46,19 @@
 
     @RequestMapping(value = "/appVersion/list/auth")
     @ManagerAuth
-    public R list(@RequestParam(defaultValue = "1")Integer curr,
-                  @RequestParam(defaultValue = "10")Integer limit,
-                  @RequestParam(required = false)String orderByField,
-                  @RequestParam(required = false)String orderByType,
-                  @RequestParam(required = false)String condition,
-                  @RequestParam Map<String, Object> param){
+    public R list(@RequestParam(defaultValue = "1") Integer curr,
+                  @RequestParam(defaultValue = "10") Integer limit,
+                  @RequestParam(required = false) String orderByField,
+                  @RequestParam(required = false) String orderByType,
+                  @RequestParam(required = false) String condition,
+                  @RequestParam Map<String, Object> param) {
         EntityWrapper<AppVersion> wrapper = new EntityWrapper<>();
         excludeTrash(param);
         convert(param, wrapper);
         allLike(AppVersion.class, param.keySet(), wrapper, condition);
-        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+        if (!Cools.isEmpty(orderByField)) {
+            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
+        }
         return R.ok(appVersionService.selectPage(new Page<>(curr, limit), wrapper));
     }
 
@@ -55,6 +66,7 @@
     public R checkUpdate(@PathVariable("version") String version,
                          @PathVariable("type") Integer type) {
         EntityWrapper<AppVersion> wrapper = new EntityWrapper<>();
+        wrapper.eq("type", type);
         AppVersion appVersion = appVersionService.selectOne(wrapper);
         if (Cools.isEmpty(appVersion)) {
             return R.ok("宸叉槸鏈�鏂扮増鏈�");
@@ -71,10 +83,10 @@
         return R.ok("鏈夋柊鐗堟湰锛岄渶瑕佹洿鏂�").add(latestApp);
     }
 
-    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
-        for (Map.Entry<String, Object> entry : map.entrySet()){
+    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) {
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
             String val = String.valueOf(entry.getValue());
-            if (val.contains(RANGE_TIME_LINK)){
+            if (val.contains(RANGE_TIME_LINK)) {
                 String[] dates = val.split(RANGE_TIME_LINK);
                 wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                 wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
@@ -97,8 +109,8 @@
 
     @RequestMapping(value = "/appVersion/update/auth")
     @ManagerAuth
-    public R update(AppVersion appVersion){
-        if (Cools.isEmpty(appVersion) || null==appVersion.getId()){
+    public R update(AppVersion appVersion) {
+        if (Cools.isEmpty(appVersion) || null == appVersion.getId()) {
             return R.error();
         }
         if (appVersion.getLatest() == 1) {
@@ -111,8 +123,8 @@
 
     @RequestMapping(value = "/appVersion/delete/auth")
     @ManagerAuth
-    public R delete(@RequestParam(value="ids[]") Long[] ids){
-        for (Long id : ids){
+    public R delete(@RequestParam(value = "ids[]") Long[] ids) {
+        for (Long id : ids) {
             appVersionService.deleteById(id);
         }
         return R.ok();
@@ -120,7 +132,7 @@
 
     @RequestMapping(value = "/appVersion/export/auth")
     @ManagerAuth
-    public R export(@RequestBody JSONObject param){
+    public R export(@RequestBody JSONObject param) {
         EntityWrapper<AppVersion> wrapper = new EntityWrapper<>();
         List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
         Map<String, Object> map = excludeTrash(param.getJSONObject("appVersion"));
@@ -136,7 +148,7 @@
         wrapper.like("id", condition);
         Page<AppVersion> page = appVersionService.selectPage(new Page<>(0, 10), wrapper);
         List<Map<String, Object>> result = new ArrayList<>();
-        for (AppVersion appVersion : page.getRecords()){
+        for (AppVersion appVersion : page.getRecords()) {
             Map<String, Object> map = new HashMap<>();
             map.put("id", appVersion.getId());
             map.put("value", appVersion.getId());
@@ -149,7 +161,7 @@
     @ManagerAuth
     public R query(@RequestBody JSONObject param) {
         Wrapper<AppVersion> wrapper = new EntityWrapper<AppVersion>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
-        if (null != appVersionService.selectOne(wrapper)){
+        if (null != appVersionService.selectOne(wrapper)) {
             return R.parse(BaseRes.REPEAT).add(getComment(AppVersion.class, String.valueOf(param.get("key"))));
         }
         return R.ok();
@@ -158,12 +170,12 @@
     @RequestMapping(value = "/appVersion/uploadApp/auth")
     @ManagerAuth
     public R uploadApp(@RequestParam("id") Integer id,
-                       @RequestParam("file") MultipartFile[] files){
+                       @RequestParam("file") MultipartFile[] files) {
         AppVersion appVersion = appVersionService.selectById(id);
 
         MultipartFile file = files[0];
         SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss");
-        String path =  ClassUtils.getDefaultClassLoader().getResource("appVersion").getPath();
+        String path = ClassUtils.getDefaultClassLoader().getResource("appVersion").getPath();
         //鏂囦欢鍚庣紑鍚�
         String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
         //涓婁紶鏂囦欢鍚�
@@ -174,7 +186,7 @@
 
         //鏈嶅姟鍣ㄧ淇濆瓨鐨勬枃浠跺璞�
         File serverFile = new File(filepath);
-        if(!serverFile.exists()) {
+        if (!serverFile.exists()) {
             try {
                 //鍒涘缓鏂囦欢
                 serverFile.createNewFile();
@@ -218,4 +230,23 @@
             response.setStatus(404);
         }
     }
+    @RequestMapping("/menu/pda/auth")
+    @ManagerAuth
+    public R menuPda(){
+        Long userId = getUserId();
+        List<RolePermission> rolePermissions;
+        if (userId == 9527L) {
+            rolePermissions = rolePermissionService.selectList(new EntityWrapper<>());
+        } else {
+            Long roleId = getUser().getRoleId();
+            rolePermissions = rolePermissionService.selectList(new EntityWrapper<RolePermission>().eq("role_id", roleId));
+        }
+        if (Cools.isEmpty(rolePermissions)) {
+            return R.ok();
+        }
+        List<Long> collect = rolePermissions.stream().map(RolePermission::getPermissionId).distinct().collect(Collectors.toList());
+        List<Permission> permissions = permissionService.selectBatchIds(collect);
+        return R.ok().add(permissions);
+    }
 }
+

--
Gitblit v1.9.1