From 1e64ef03770f4e3a7f357049a6fe744f39c2c4b6 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期二, 21 十一月 2023 09:12:20 +0800
Subject: [PATCH] 后台bug修改

---
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java |   71 +++++++++++++++++++++++------------
 1 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java
index 4f9e5a3..4558895 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java
@@ -86,24 +86,23 @@
     private IUserService userService;
 
 
+    // 添加SUTU
     @RequestMapping("/tShop_addDevice/{id}")
     public String addDevice(@PathVariable("id") Integer id,Model model) {
-        // 查询门店下的所有场地
-        List<TSite> list = siteService.list(new QueryWrapper<TSite>().eq("storeId", id));
         // 门店id
         model.addAttribute("id",id);
-        model.addAttribute("list",list);
         return PREFIX + "TShop_add_device.html";
     }
     @RequestMapping("/addDevice")
-    public Object addDevice(Integer id,Integer siteId,String device) {
+    public Object addDevice(Integer id,String device) {
         HashMap<String, String> map = new HashMap<>();
         map.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
         map.put("space_id",id.toString());
-        map.put("device_id",device);
-        map.put("region_id",siteId+"");
+        map.put("name",device);
+        map.put("city_code","");
         // 添加门禁
-        String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map);
+        String s1 = HttpRequestUtil.postRequest
+                ("https://try.daowepark.com/v7/user_api/general/addSpaceSutu", map);
         return SUCCESS_TIP;
     }
 
@@ -536,25 +535,49 @@
                 storeConfigs.add(storeConfig);
             }
             storeConfigService.saveBatch(storeConfigs);
+            // 添加场地
+            TSite tSite = new TSite();
+            tSite.setName(tStore.getName());
+            tSite.setStoreId(tStore.getId());
+            tSite.setSign(1);
+            siteService.save(tSite);
+
+            HashMap<String, String> mapSite = new HashMap<>();
+            mapSite.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
+            mapSite.put("name",tStore.getName());
+            mapSite.put("space_id",tStore.getId().toString());
+            mapSite.put("area_id",tSite.getId().toString());
+            HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpaceArea", mapSite);
+            // 添加门店
+            HashMap<String, String> map1 = new HashMap<>();
+            map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
+            map1.put("name",tStore.getName());
+            map1.put("short_name",tStore.getName());
+            map1.put("location",tStore.getCity());
+            map1.put("address",tStore.getAddress());
+            map1.put("telephone",tStore.getPhone());
+            map1.put("linkman",userName);
+            map1.put("business_time","[{\"start_time\":\""+tStore.getStartTime()+"\",\"close_time\":\""+tStore.getEndTime()+"\"}]");
+            map1.put("logo",tStore.getCoverDrawing());
+            map1.put("remark",tStore.getIntroduce());
+            map1.put("lat",tStore.getLat());
+            map1.put("lng",tStore.getLon());
+            map1.put("space_id",tStore.getId().toString());
+            String result = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpace", map1);
+            System.out.println(result);
 
 
-//            // 添加门店
-//            HashMap<String, String> map1 = new HashMap<>();
-//            map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
-//            map1.put("name",tStore.getName());
-//            map1.put("short_name",tStore.getName());
-//            map1.put("location",tStore.getCity());
-//            map1.put("address",tStore.getAddress());
-//            map1.put("telephone",tStore.getPhone());
-//            map1.put("linkman",userName);
-//            map1.put("business_time","[{\"start_time\":\""+tStore.getStartTime()+"\",\"close_time\":\""+tStore.getEndTime()+"\"}]");
-//            map1.put("logo",tStore.getCoverDrawing());
-//            map1.put("remark",tStore.getIntroduce());
-//            map1.put("lat",tStore.getLat());
-//            map1.put("lng",tStore.getLon());
-//            map1.put("space_id",tStore.getId().toString());
-//            String result = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpace", map1);
-//            System.out.println(result);
+
+            for (String s : tStore.getIds().split(",")) {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
+                map.put("space_id",tStore.getId()+"");
+                map.put("device_id",s);
+                map.put("region_id",tSite.getId().toString());
+                // 添加门禁
+                String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map);
+                System.out.println(s1);
+            }
 
 
             return new SuccessTip<>();

--
Gitblit v1.7.1