puzhibing
2023-11-28 3c12858927ce26f277ba758e520c81be599d8df1
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java
@@ -161,11 +161,20 @@
    @RequestMapping("/getProvinceYys")
    @ResponseBody
    public Object getProvinceYys(Integer operatorId) {
        // 获取运营商管理的所有省
        List<TOperatorCity> list = operatorCityService.list(new QueryWrapper<TOperatorCity>().eq("operatorId", operatorId)
                .eq("pid", 0));
        // 判断当前运营商是管理全国还是指定区域
        TOperator byId = tOperatorService.getById(operatorId);
        // 说明是管理全国
        if (byId.getType()==1){
            List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
            return list;
        }else{
            // 获取运营商管理的所有省
            List<TOperatorCity> list = operatorCityService.list(new QueryWrapper<TOperatorCity>().eq("operatorId", operatorId)
                    .eq("pid", 0));
            return list;
        }
        return list;
    }
    // 运营商根据省筛选市区
    @RequestMapping("/getCityYys")
@@ -437,8 +446,6 @@
    @ResponseBody
    public Object list(TStore tStore,String time,String userName,String userPhone,String ids,Integer type,Integer yyId,String lat,String lon,String pCode1,String cCode1) {
        try {
            if(yyId==null || type==1){
                yyId=0;
            }
@@ -522,7 +529,7 @@
            if (UserExt.getUser().getObjectType()==2){
                tStore.setOperatorId(UserExt.getUser().getObjectId());
            }
            storeService.save(tStore);
            user.setObjectId(tStore.getId());
            userService.updateById(user);
            ArrayList<StoreConfig> storeConfigs = new ArrayList<>();
@@ -535,19 +542,6 @@
                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");
@@ -562,24 +556,31 @@
            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);
            }
            JSONObject jsonObject = JSONObject.parseObject(result);
            JSONObject data = jsonObject.getJSONObject("data");
            String space_id = data.getString("space_id");
            Integer integer = Integer.valueOf(space_id);
            tStore.setId(integer);
            storeService.save(tStore);
            System.err.println(tStore);
//            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);
//            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<>();
        }catch (Exception e){
            e.printStackTrace();