liujie
2023-10-17 add2d28c3aeccfe57338c439967abbb83117b20e
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java
@@ -1,6 +1,7 @@
package com.dsh.guns.modular.system.controller.code;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -104,7 +105,7 @@
//        if (!roleid.equals("1")){
            TOperator operator1 = tOperatorService.getOne(new QueryWrapper<TOperator>().eq("userId", UserExt.getUser().getId()));
            if (operator1!=null){
            if(operator1!=null){
                model.addAttribute("operator",operator1.getId());
            }else {
                model.addAttribute("operator",0);
@@ -241,6 +242,7 @@
        cityListQuery.setOffset(1);
        cityListQuery.setLimit(10000);
        cityListQuery.setCityCode(byId.getCityCode());
        model.addAttribute("yysList", tOperatorService.list());
        Page<TCityManager> list2 = cityClient.list(cityListQuery);
        model.addAttribute("list1",list1);
        model.addAttribute("list2",list2.getRecords());
@@ -317,11 +319,11 @@
    @RequestMapping(value = "/add")
    @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,String provinceCode,String cityCode) {
    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){
            if(yyId==null || type==1){
                yyId=0;
            }
@@ -387,13 +389,7 @@
            storeService.save(tStore);
            HashMap<String, String> map = new HashMap<>();
            map.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
            map.put("space_id","");
            map.put("device_id",tStore.getIds()+"");
            map.put("region_id",tStore.getId()+"");
            // 添加门禁
            String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map);
            ArrayList<StoreConfig> storeConfigs = new ArrayList<>();
@@ -406,6 +402,41 @@
                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","");
                // 添加门禁
                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();
@@ -483,16 +514,30 @@
            tStore.setLon(lon);
            tStore.setLat(lat);
            storeService.updateById(tStore);
            HashMap<String, String> map = new HashMap<>();
            map.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
            map.put("space_id","");
            map.put("device_id",tStore.getIds());
            map.put("region_id",tStore.getId()+"");
            // 编辑门禁
            String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/editDevice/ids/82", map);
            JSONObject jsonObject = JSONObject.parseObject(s);
            JSONObject data = jsonObject.getJSONObject("data");
            String spaceId = data.getString("space_id");
            String ids1 = byIdc.getIds();
            HashMap<String, String> mapx = new HashMap<>();
            mapx.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
            for (String s : ids1.split(",")) {
              String post = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/deleteDevice/ids/" + s,mapx);
                System.out.println(post);
            }
            for (String s : ids.split(",")) {
                HashMap<String, String> map1 = new HashMap<>();
                map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
                map1.put("space_id",tStore.getId()+"");
                map1.put("device_id",s);
                map1.put("region_id","");
                // 添加门禁
                String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map1);
                System.out.println(s1);
            }
            return new SuccessTip<>();
        }catch (Exception e){
            e.printStackTrace();