From add2d28c3aeccfe57338c439967abbb83117b20e Mon Sep 17 00:00:00 2001 From: liujie <liujie> Date: 星期二, 17 十月 2023 09:56:55 +0800 Subject: [PATCH] 修改bug --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java | 91 ++++++++++++++++++++++++++++++++++++--------- 1 files changed, 72 insertions(+), 19 deletions(-) diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java index 50cac19..4efb096 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TSiteController.java @@ -281,6 +281,10 @@ } model.addAttribute("nextNames",strings1); + ArrayList<String> strings3 = new ArrayList<>(); + strings3.add("普通场地"); + strings3.add("智慧场地"); + model.addAttribute("typeNames",strings3); String halfNames = site.getHalfName(); ArrayList<String> strings2 = new ArrayList<>(); @@ -355,6 +359,36 @@ }else{ stores = storeClient.getStore(site.getCity()); } + + ArrayList<String> strings3 = new ArrayList<>(); + strings3.add("普通场地"); + strings3.add("智慧场地"); + model.addAttribute("typeNames",strings3); + + + String nextName = site.getNextName(); + ArrayList<String> strings1 = new ArrayList<>(); + for (String s : nextName.split(",")) { + strings1.add(s); + } + model.addAttribute("nextNames",strings1); + + + + String halfNames = site.getHalfName(); + ArrayList<String> strings2 = new ArrayList<>(); + String[] split = halfNames.split(","); + String halfName=null; + for (int i = 0; i < split.length; i++) { + if(i==0){ + halfName = split[0]; + }else { + strings2.add(split[i]); + } + } + model.addAttribute("halfNames",strings2); + model.addAttribute("halfName",halfName); + List<CityManager> accounts = cityManagerClient.getAccount(site.getCity()); model.addAttribute("list",site); Date insuranceEndTime = site.getInsuranceEndTime(); @@ -407,34 +441,30 @@ site.setCityManagerId(cityManagerId); site.setInsertTime(new Date()); site.setState(1); - siteClient.addSite(site); + Integer integer1 = siteClient.addSite(site); HashMap<String, String> map = new HashMap<>(); map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); map.put("name",site.getName()); - map.put("short_name",site.getName()); - map.put("location",city); - map.put("address",store.getAddress()); - map.put("telephone",store.getPhone()); - map.put("linkman",""); - map.put("business_time","[{\"start_time\":\"00:00\",\"close_time\":\"23:59\"}]"); - map.put("logo",store.getCoverDrawing()); - map.put("remark",site.getIntroduce()); - map.put("lat",store.getLat()); - map.put("lng",store.getLon()); + map.put("space_id",integer1.toString()); + String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpaceArea", map); + // 添加门禁 - String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpace", map); JSONObject jsonObject = JSONObject.parseObject(s); JSONObject data = jsonObject.getJSONObject("data"); String spaceId = data.getString("space_id"); Integer integer = Integer.valueOf(spaceId); - HashMap<String, String> map1 = new HashMap<>(); - map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); - map1.put("space_id",integer+""); - map1.put("device_id",site.getIds()+""); - map1.put("region_id",""); - String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); + for (String s1 : site.getIds().split(",")) { + HashMap<String, String> map1 = new HashMap<>(); + map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); + map1.put("space_id",site.getStoreId()+""); + map1.put("device_id",s1); + map1.put("region_id",integer1+""); + String s2 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); + System.out.println("添加闸机:"+s2); + } + return ResultUtil.success("添加成功"); } @@ -449,6 +479,9 @@ if(site.getInsuranceImg().equals("")){ site.setInsuranceImg(null); } + + TSite byId = siteService.getById(site.getId()); + Store store = storeClient.getStoreById(site.getStoreId()); String province = store.getProvince(); @@ -466,7 +499,27 @@ site.setInsertTime(new Date()); site.setState(1); siteClient.addSite(site); - Integer id = site.getId(); + + String ids = byId.getIds(); + HashMap<String, String> map = new HashMap<>(); + map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); + for (String s : ids.split(",")) { + String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/deleteDevice/ids/" + s,map); + System.out.println(s1); + } + + for (String s : site.getIds().split(",")) { + HashMap<String, String> map1 = new HashMap<>(); + map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); + map1.put("space_id",store.getId()+""); + map1.put("device_id",s); + map1.put("region_id",site.getId()+""); + // 添加门禁 + String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1); + System.out.println(s1); + } + + return ResultUtil.success(); } -- Gitblit v1.7.1