44323
2023-11-14 ddbb38c54db9c3670e5ff53f4bf713525de1099d
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java
@@ -82,7 +82,30 @@
    @Autowired
    private ITSiteService siteService;
    @Autowired
    private IUserService userService;
    @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) {
        HashMap<String, String> map = new HashMap<>();
        map.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
        map.put("space_id",siteId+"");
        map.put("device_id",device);
        map.put("region_id",id.toString());
        // 添加门禁
        String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map);
        return SUCCESS_TIP;
    }
    /**
     * 跳转到车辆管理首页
@@ -497,67 +520,53 @@
                }
            storeService.save(tStore);
            user.setObjectId(tStore.getId());
            userService.updateById(user);
            // 添加场地
//            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);
//
//            ArrayList<StoreConfig> storeConfigs = new ArrayList<>();
//            for (int i = 1; i < 9; i++) {
//                StoreConfig storeConfig = new StoreConfig();
//                storeConfig.setIsOpen(1);
//                storeConfig.setSort(i);
//                storeConfig.setType(i);
//                storeConfig.setStoreId(tStore.getId());
//                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);
            ArrayList<StoreConfig> storeConfigs = new ArrayList<>();
            for (int i = 1; i < 9; i++) {
                StoreConfig storeConfig = new StoreConfig();
                storeConfig.setIsOpen(1);
                storeConfig.setSort(i);
                storeConfig.setType(i);
                storeConfig.setStoreId(tStore.getId());
                storeConfigs.add(storeConfig);
            }
            storeConfigService.saveBatch(storeConfigs);
//            // 添加门店
//            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);
//            }
            // 添加门店
            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);
            return new SuccessTip<>();
@@ -859,9 +868,15 @@
    @ResponseBody
    public Object freeze(Integer id) {
        try {
            TStore byId = storeService.getById(id);
            byId.setState(2);
            storeService.updateById(byId);
            // 查询门店 获取门店店长id
            TStore store = storeService.getById(id);
            // 冻结
            store.setState(2);
            storeService.updateById(store);
            Integer storeStaffId = store.getStoreStaffId();
            User user = userService.getById(storeStaffId);
            user.setStatus(2);
            userService.updateById(user);
            return SUCCESS_TIP;
        }catch (Exception e){
            e.printStackTrace();
@@ -872,9 +887,15 @@
    @ResponseBody
    public Object unfreeze(Integer id) {
        try {
            TStore byId = storeService.getById(id);
            byId.setState(1);
            storeService.updateById(byId);
            // 查询门店 获取门店店长id
            TStore store = storeService.getById(id);
            // 解冻
            store.setState(1);
            storeService.updateById(store);
            Integer storeStaffId = store.getStoreStaffId();
            User user = userService.getById(storeStaffId);
            user.setStatus(1);
            userService.updateById(user);
            return SUCCESS_TIP;
        }catch (Exception e){
            e.printStackTrace();
@@ -955,13 +976,14 @@
    }
    @RequestMapping(value = "/addConfig")
    @ResponseBody
    public Object addConfig(String name,Integer id) {
    public Object addConfig(String name,Integer id,Integer sort) {
        try {
            List<TStoreOtherConfig> list = storeOtherConfigService.list();
            if(list.size()>0){
                TStoreOther tStoreOther = new TStoreOther();
                tStoreOther.setName(name);
                tStoreOther.setStoreId(id);
                tStoreOther.setSort(sort);
                storeOtherService.save(tStoreOther);
                // 找出temp表数据
@@ -986,12 +1008,11 @@
    }
    @RequestMapping(value = "/addConfig1")
    @ResponseBody
    public Object addConfig1(String name,Integer id) {
    public Object addConfig1(String name,Integer id,Integer sort) {
        try {
            TStoreOther byId = storeOtherService.getById(id);
            byId.setName(
                    name
            );
            byId.setName(name);
            byId.setSort(sort);
            storeOtherService.updateById(byId);